-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce o-spacing to o-private-foundation #1867
Merged
Merged
Changes from 8 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
ce94f3c
feat: introduce o-private-foundation (#1863)
frshwtr 8a2ba22
feat: Add public function to get the current brand.
notlee 0168fc4
backstage: Map tokens to o2 brand pattern
notlee 76e942c
backstage: Remove stories
notlee 620310b
docs: Remove misleading SassDoc
notlee 2b53cd3
backstage: Remove example css
notlee 244e334
chore: introduce variables
frshwtr 729cba1
chore: introduce spacing functions
frshwtr 48c97b8
feat: introduce o-normalise to o-private-foundation (#1864)
frshwtr ad76564
feat: use oPrivateSpacing sass components
frshwtr 1923b8e
chore: Merge branch '2025-release' into 2025-release-o-spacing
frshwtr 3e9dc5b
chore: Merge branch 'main' into 2025-release
frshwtr 8b706ba
chore: align file structure with confirmed convention
frshwtr 35a899c
chore: namespace variables
frshwtr 619d00d
backstage: Add initial buttons support to o-private-foundations
notlee 0434097
backstage: Replace o-buttons with o-private-foundation in o-table
notlee f0c242c
backstage: fix private button force-colors and family
notlee 1a3bd58
backstage: Update private buttons to actually use type/theme argument
notlee cc5bb79
docs: Update components/o-private-foundation/src/scss/o-buttons/main.…
notlee d19c3e1
fix: fix typo
frshwtr 958350c
fix: remove duplications
frshwtr 8cc6539
Merge branch '2025-release' into 2025-release-o-spacing
frshwtr f491692
fix: remove engine property from package.json
frshwtr 7e9b1a4
fix: fix lint issues
frshwtr dcc2a0b
fix: fix colors test assertions
frshwtr 3ba78a1
fix: remove unecessary normalise import
frshwtr f0d2d89
fix: oPrivateNormaliseApply to order sass rule
frshwtr 38e7e27
fix: fix sass lint errors
frshwtr a94b087
fix: use rgn in o-label sass tests
frshwtr 4803987
fix: lint o-multi-select sass
frshwtr 7243f5c
fix: update package-lock
frshwtr dd2272d
backstage: Reduce use of Sass modules to prevent errors when importin…
notlee 1119d13
backstage: Update o-table to use latest o-private-foundation changes.
notlee f37d196
backstage: Remove o-buttons as an o-tabs dependency
notlee 9b8ac5d
backstage: Remove o-buttons as an o-header dependency
notlee b0dc76d
backstage: Remove o-buttons as an o-forms peer dependency
notlee c83e828
backstage: Throw in o-private-foundation if a token is not found
notlee be6f8c9
backstage: Remove o-buttons as an o-comments dependency
notlee 7186aa5
backstage: Remove o-buttons Sass import from o-header
notlee cc2b79a
Remove o-buttons as an o-message dependency (#1882)
notlee 1a65176
chore: remove unecessary variables, use pf namespacing
frshwtr e4952a9
chore: Merge branch '2025-release' into 2025-release-o-spacing
frshwtr 3912af3
chore: remove private-foundations
frshwtr 798538e
Merge branch '2025-release' into 2025-release-o-spacing
frshwtr b952028
chore: remove duplicate keys
frshwtr 2933501
chore: align o-private-foundation/o-normalise directory structure (#1…
frshwtr 9829504
feat: introduce o visual effects (#1877)
frshwtr ce2e860
chore: Merge branch '2025-release' into 2025-release-o-spacing
frshwtr 89f51b9
chore: update package lock
frshwtr 06d5cea
chore: run only one job at a time
frshwtr d844ba7
chore: regen package lock
frshwtr 362149f
chore: Merge branch '2025-release' into 2025-release-o-spacing
frshwtr d8b51f7
chore: regen package lock
frshwtr 96ce127
chore: Merge branch '2025-release' into 2025-release-o-spacing
frshwtr 201afcf
chore: reintroduce relative units
frshwtr a5c0026
chore: increase max-parallel to 4
frshwtr f882e9e
Merge branch '2025-release' into 2025-release-o-spacing
frshwtr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import path from 'node:path'; | ||
import {sharedTransformers} from '../transformers.js'; | ||
|
||
function sassConfigForBrand(brand) { | ||
const parentBrand = brand.split('/').slice(-1); | ||
return { | ||
transformGroup: 'scss', | ||
transforms: [ | ||
...sharedTransformers, | ||
'value/figma-shadow-shorthand', | ||
'value/transformSVG', | ||
], | ||
buildPath: path.join(process.cwd(), '../../components/'), | ||
files: [ | ||
{ | ||
destination: `o-private-foundation/src/scss/tokens/${parentBrand}.scss`, | ||
format: 'scss/map-flat', | ||
options: { | ||
outputReferences: false, | ||
}, | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
export {sassConfigForBrand}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
demos/local/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
"extends": "origami-component" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
.env | ||
/.sass-cache/ | ||
/bower_components/ | ||
/node_modules/ | ||
/build/ | ||
.idea/ | ||
/demos/local | ||
/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.env | ||
.gitignore | ||
.npmignore | ||
.eslintrc.cjs | ||
.remarkrc.cjs | ||
.stylelintrc.cjs | ||
.prettierrc.toml | ||
.eslintignore | ||
.stylelintignore | ||
stories/ | ||
src/tsx/ | ||
.github/ | ||
test/ | ||
demos/local/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports.plugins = [require("remark-preset-lint-origami-component")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
demos/local/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
"extends": "stylelint-config-origami-component" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# o-private-foundation | ||
|
||
> :warning: NOTE: this package should ONLY be used in Origami components. If you are not developing a component that is part of Origami, please do not use this package. | ||
|
||
A collection of Origami components for use in other Origami components. | ||
|
||
- [Usage](#usage) | ||
- [Behaviour](#behaviour) | ||
- [Markup](#markup) | ||
- [Sass](#sass) | ||
- [JavaScript](#javascript) | ||
- [Troubleshooting](#troubleshooting) | ||
- [Contributing](#contributing) | ||
- [Migration](#migration) | ||
- [Contact](#contact) | ||
- [Licence](#licence) | ||
|
||
_Instructions for the component. We've broken this down by Markup, JavaScript, Sass, etc. You may add more sections as needed._ | ||
|
||
## Usage | ||
|
||
Check out [how to include Origami components in your project](https://origami.ft.com/docs/components/#including-components-in-your-project) to get started with `o-private-foundation`. | ||
|
||
## Behaviour | ||
|
||
`o-private-foundation` Behaviour description. | ||
|
||
## Markup | ||
|
||
_Markup documentation for the component. Including css classes, data attributes, and tags for variations of the component._ | ||
_Demo markup is also shown in the registry. For complex markup it can be useful to describe the markup and link to the registry demos for a full example._ | ||
_Remember to start your codeblocks with three backticks and "html" so your markup is syntax highlighted correctly._ | ||
```html | ||
<div data-o-component="o-private-foundation" class='o-private-foundation'> | ||
</div> | ||
``` | ||
|
||
## Sass | ||
|
||
_Sass documentation. With instructions to include styles with a primary mixin, what options are available, brand support where applicable._ | ||
_For complex components it may be helpful to document apis with SassDoc and link to the components SassDoc in the Origami Registry._ | ||
_Remember to start your codeblocks with three backticks and "scss" so your markup is syntax highlighted correctly._ | ||
|
||
Use `@include oPrivateFoundation()` to include styles for all `o-private-foundation` features. | ||
|
||
```scss | ||
@import "@financial-times/o-private-foundation"; | ||
|
||
@include oPrivateFoundation(); | ||
``` | ||
|
||
|
||
## JavaScript | ||
|
||
_JavaScript documentation. Including how to initialise the component, available options, and common usecases._ | ||
_For complex components it may be helpful to document apis with JSDoc and link to the components JSDocs in the Origami Registry._ | ||
_Remember to start your codeblocks with three backticks and "js" so your js is syntax highlighted correctly._ | ||
|
||
JavaScript is initialised automatically for [Origami Build Service](https://www.ft.com/__origami/service/build/v2/) users. If your project is using a manual build process, [initialise `o-private-foundation` manually](https://origami.ft.com/docs/tutorials/manual-build/). | ||
|
||
For example call the `init` method to initialise all `o-private-foundation` instances in the document: | ||
|
||
```js | ||
import oPrivateFoundation from 'o-private-foundation'; | ||
oPrivateFoundation.init(); | ||
``` | ||
|
||
Or pass an element to initialise a specific `o-private-foundation` instance: | ||
|
||
```js | ||
import oPrivateFoundation from 'o-private-foundation'; | ||
const oPrivateFoundationElement = document.getElementById('#my-o-private-foundation-element'); | ||
oPrivateFoundation.init(oPrivateFoundationElement); | ||
``` | ||
|
||
|
||
|
||
## Troubleshooting | ||
|
||
_Answers to questions or problems that come up repeatedly._ | ||
_It's likely you can delete this section for now. Remember to remove it from the table of contents._ | ||
|
||
## Contributing | ||
|
||
_Contributing documentation for non typical components._ | ||
_It's likely you can delete this section if your component conforms with other components._ | ||
_Remember to update the table of contents is you remove this section._ | ||
|
||
## Migration | ||
|
||
_Guides to upgrade from one major version of a component to another._ | ||
_This section includes a table of major versions with links to `MIGRATION.md`._ | ||
_`MIGRATION.md` would provide upgrade instructions, but since this is a new component there is no `MIGRATION.md`._ | ||
_Delete this section, including from the table of contents, until there is a second major version of this component._ | ||
|
||
State | Major Version | Last Minor Release | Migration guide | | ||
:---: | :---: | :---: | :---: | ||
✨ active | 3 | N/A | [migrate to v3](MIGRATION.md#migrating-from-v2-to-v3) | | ||
⚠ maintained | 2 | 2.0 | [migrate to v2](MIGRATION.md#migrating-from-v1-to-v2) | | ||
╳ deprecated | 1 | 1.0 | N/A | | ||
|
||
## Contact | ||
If you have any questions or comments about this component, or need help using it, please either [raise an issue](https://github.com/Financial-Times/origami/issues/new?labels=o-private-foundation,components), visit [#origami-support](https://financialtimes.slack.com/messages/#origami-support/) or email [[email protected]](mailto:[email protected]). | ||
|
||
## Licence | ||
This software is published by the Financial Times under the [MIT licence](http://opensource.org/licenses/MIT). | ||
`; | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import '../../main.scss'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@use './src/scss/brand' with ( | ||
$o-brand: $o-brand | ||
); | ||
@import './src/scss/variables'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// @type Boolean | ||
$o-spacing-is-silent: true !default; | ||
|
||
/// When true output relative `rem` space values, not `px`. | ||
/// Relative spaces will respect the browser's configured font size. | ||
/// | ||
/// For legacy reasons, this defaults to `false` (outputs px units). | ||
/// Projects may need to be updated to support relative units. | ||
/// @type Bool | ||
$o-spacing-relative-units: false !default; | ||
|
||
/// Represents the baseline number (pixels) to base spaces off. | ||
/// @type Number | ||
/// @access private | ||
$_o-spacing-baseline: 4; | ||
|
||
/// The named spaces. Where the key is the name and the number value is the | ||
/// increment of the baseline value. | ||
/// @type Map | ||
/// @access private | ||
$_o-spacing-sizes: ( | ||
's1': 1, | ||
's2': 2, | ||
's3': 3, | ||
's4': 4, | ||
's6': 6, | ||
's8': 8, | ||
'm12': 12, | ||
'm16': 16, | ||
'l18': 18, | ||
'l24': 24, | ||
); | ||
|
||
/// All space names supported by o-spacing. | ||
/// @type Map | ||
$o-spacing-names: map-keys($_o-spacing-sizes); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@import './_variables'; | ||
|
||
/// @param {String} $size-name - Get a recommended space size by name. | ||
/// @return {Number} - A px value (or rem value if relative units have been enabled). | ||
@function oPrivateSpacingByName($size-name) { | ||
$value: map-get($_o-spacing-sizes, $size-name); | ||
@if(type-of($value) != 'number') { | ||
@error 'There is no recommended space named "#{$size-name}". Should be one of #{map-keys($_o-spacing-sizes)}.'; | ||
} | ||
@return oPrivateSpacingByIncrement($value); | ||
} | ||
|
||
/// @param {Number} $increment - The number to multiply the baseline size by. | ||
/// @return {Number} - A px value (or rem value if relative units have been enabled). | ||
@function oPrivateSpacingByIncrement($increment) { | ||
@if(type-of($increment) != 'number' and floor($increment) != $increment) { | ||
@error 'Expected a whole number but was given "#{$increment}".'; | ||
} | ||
@return $increment * oPrivateSpacingGetBaselineValue(); | ||
} | ||
|
||
/// @return {Number} - A px value representing our spacing baseline (or rem value if relative units have been enabled). | ||
@function oPrivateSpacingGetBaselineValue() { | ||
@if($o-spacing-relative-units) { | ||
@return div($_o-spacing-baseline, 16) * 1rem; | ||
} | ||
@return $_o-spacing-baseline * 1px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"origamiType": "component", | ||
"origamiVersion": "2.0", | ||
"brands": ["core", "internal", "whitelabel"], | ||
"support": "https://github.com/Financial-Times/origami/issues/new?labels=o-private-foundation,components", | ||
"supportContact": { | ||
"email": "[email protected]", | ||
"slack": "#origami-support" | ||
}, | ||
"supportStatus": "experimental", | ||
"browserFeatures": {}, | ||
"demosDefaults": { | ||
"sass": "demos/src/demo.scss", | ||
"template": "demos/src/demo.mustache", | ||
"documentClasses": "", | ||
"dependencies": [] | ||
}, | ||
"demos": [ | ||
{ | ||
"title": "A Useful Demo", | ||
"name": "demo", | ||
"template": "demos/src/demo.mustache", | ||
"description": "Description of the demo" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@financial-times/o-private-foundation", | ||
"version": "0.0.0", | ||
"description": "Foundation components for use in Origami components only.", | ||
"keywords": [], | ||
"homepage": "https://registry.origami.ft.com/components/o-private-foundation", | ||
"bugs": { | ||
"url": "https://github.com/Financial-Times/origami/issues/new?labels=o-private-foundation,components", | ||
"email": "[email protected]" | ||
}, | ||
"license": "MIT", | ||
"type": "module", | ||
"browser": "main.js", | ||
"scripts": { | ||
"build": "bash ../../scripts/component/build.bash", | ||
"test": "bash ../../scripts/component/test.bash", | ||
"lint": "bash ../../scripts/component/lint.bash", | ||
"watch": "bash ../../scripts/component/watch.bash" | ||
}, | ||
"peerDependencies": { | ||
"@financial-times/o-brand": "^4.1.0" | ||
}, | ||
"devDependencies": {}, | ||
"engines": { | ||
"npm": "^7 || ^8" | ||
}, | ||
"volta": { | ||
"node": "14.16.1", | ||
"npm": "7.11.1" | ||
}, | ||
"percy": true, | ||
"private": false | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variables also need to be renamed to avoid conflicts