Skip to content

Commit

Permalink
refactor: remove autofocus from Stories & add system themes (#233)
Browse files Browse the repository at this point in the history
closes #232
  • Loading branch information
joduplessis authored Jun 1, 2024
1 parent c19a11b commit 4cb41c7
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 29 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fold-dev",
"title": "Fold",
"version": "0.11.2",
"version": "0.11.3",
"description": "The UI component library for product teams.",
"workspaces": {
"packages": [
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fold-dev/core",
"title": "Fold",
"version": "0.11.2",
"version": "0.11.3",
"description": "The UI library for product teams.",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
23 changes: 3 additions & 20 deletions packages/core/src/menu/menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,11 @@ export const docs = {
'Menu components are a very common feature of almost any user interface. They are useful when screen real estate is limited or when there is a need to provide additional functionality to the relevant menu target.',
}

export const Usage = () => (
<Menu>
<MenuItem>Edit</MenuItem>
<MenuItem>Copy</MenuItem>
<MenuItem>Cut</MenuItem>
<MenuItem>Paste</MenuItem>
<MenuItem>Select</MenuItem>
<MenuDivider />
<MenuHeading>Rotation</MenuHeading>
<MenuItem>Rotate Left</MenuItem>
<MenuItem>Rotate Right</MenuItem>
<MenuItem>Flip Horizontal</MenuItem>
<MenuItem>Flip Vertical</MenuItem>
</Menu>
)

// --

/**
* Whilst not recommended, the automatic focus on the first item can be disabled
* Whilst not recommended, the automatic focus on the first item can be disabled. It's disabled here so the page doesn't jump down (to focus on the first item).
*/
export const DisableAutoFocus = () => (

export const Usage = () => (
<Menu disableAutoFocus>
<MenuItem>Edit</MenuItem>
<MenuItem>Copy</MenuItem>
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/select/select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export const AlwaysOpen = () => {

return (
<Select
noListFocus
prefix={<IconLib icon="time" />}
suffix={<IconLib icon="chevron-down" />}
width={350}
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/styles/reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ img {
max-width: 100%;
height: auto;
}

[data-theme='light'] {
color-scheme: light;
}

[data-theme='dark'] {
color-scheme: dark;
}
4 changes: 2 additions & 2 deletions packages/core/src/virtual/virtual.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const Usage = () => {
className="f-row"
style={{
...style,
borderTop: '2px solid white',
borderTop: '2px solid var(--f-color-border)',
width: '100%',
}}>
<label>{item.name}</label>
Expand Down Expand Up @@ -129,7 +129,7 @@ export const AutoFetchOnBoundary = () => {
...style,
padding: 5,
background: 'var(--f-color-surface-strong)',
borderTop: '2px solid white',
borderTop: '2px solid var(--f-color-border)',
height: 40,
width: '100%',
}}>
Expand Down
2 changes: 1 addition & 1 deletion packages/design/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fold-dev/design",
"title": "Design Tokens",
"version": "0.11.2",
"version": "0.11.3",
"description": "The UI library for product teams.",
"main": "",
"module": "",
Expand Down
2 changes: 2 additions & 0 deletions scripts/docgen/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ useWindowResize
})
}

console.log('Make sure Core is build first (npm run build:prod)')

generateMdx(process.argv[2].split('=')[1])

const navigationFile = prettier.format(`export const navigation = ${JSON.stringify(navigation)}`, {
Expand Down

0 comments on commit 4cb41c7

Please sign in to comment.