diff --git a/ui-parts/design/src/main.ts b/ui-parts/design/src/main.ts index 6df24ce82..749194cb1 100644 --- a/ui-parts/design/src/main.ts +++ b/ui-parts/design/src/main.ts @@ -16,8 +16,8 @@ const config: StorybookConfig = { stories: [ '../../**/src/*.stories.@(js|jsx|mjs|ts|tsx|mdx)', '../../**/src/*.mdx', - '../../**/stories/*.stories.@(js|jsx|mjs|ts|tsx|mdx)', - '../../**/stories/*.mdx', + '../../**/stories/**/*.stories.@(js|jsx|mjs|ts|tsx|mdx)', + '../../**/stories/**/*.mdx', ], addons: [ getAbsolutePath('@storybook/addon-webpack5-compiler-swc'), diff --git a/ui-parts/theme/stories/opacity/constants.ts b/ui-parts/theme/stories/opacity/constants.ts new file mode 100644 index 000000000..5240620c0 --- /dev/null +++ b/ui-parts/theme/stories/opacity/constants.ts @@ -0,0 +1,14 @@ +import type { OpacityName } from './interfaces.js' + +export const opacityNames: Array = [ + 'none', + 'xs2', + 'xs', + 'sm', + 'md', + 'lg', + 'xl', + 'xl2', + 'xl3', + 'full', +] diff --git a/ui-parts/theme/stories/opacity/interfaces.ts b/ui-parts/theme/stories/opacity/interfaces.ts new file mode 100644 index 000000000..8c273cff6 --- /dev/null +++ b/ui-parts/theme/stories/opacity/interfaces.ts @@ -0,0 +1,8 @@ +import type { OpacityTokens } from '@atls-ui/theme/tokens' + +export type ThemeName = 'dark' | 'light' +export type OpacityName = keyof OpacityTokens + +export interface OpacityStoryProps { + theme: ThemeName +} diff --git a/ui-parts/theme/stories/opacity/opacity.stories.tsx b/ui-parts/theme/stories/opacity/opacity.stories.tsx new file mode 100644 index 000000000..7225e1a51 --- /dev/null +++ b/ui-parts/theme/stories/opacity/opacity.stories.tsx @@ -0,0 +1,79 @@ +import type { Meta } from '@storybook/react' +import type { StoryObj } from '@storybook/react' + +import type { OpacityStoryProps } from './interfaces.js' + +import { darkTheme } from '@atls-ui/theme' +import { lightTheme } from '@atls-ui/theme' +import { opacity } from '@atls-ui/theme/tokens' + +import { opacityNames } from './constants.js' + +const meta: Meta = { + title: 'Theme/Opacity', + args: { + theme: 'light', + }, + argTypes: { + theme: { + control: 'inline-radio', + options: ['light', 'dark'], + }, + }, + render: ({ theme: themeName }) => { + const theme = themeName === 'light' ? lightTheme : darkTheme + + return ( +
+
+ {opacityNames.map((name) => ( +
+
+ {name} + + {opacity[name] * 100}% + +
+
+
+
+
+ ))} +
+
+ ) + }, +} + +export default meta + +export const Opacity: StoryObj = {} diff --git a/ui/theme/src/tokens/effects/index.ts b/ui/theme/src/tokens/effects/index.ts new file mode 100644 index 000000000..42eaaf5e2 --- /dev/null +++ b/ui/theme/src/tokens/effects/index.ts @@ -0,0 +1 @@ +export * from './opacity.js' diff --git a/ui/theme/src/tokens/effects/opacity.ts b/ui/theme/src/tokens/effects/opacity.ts new file mode 100644 index 000000000..1d111b745 --- /dev/null +++ b/ui/theme/src/tokens/effects/opacity.ts @@ -0,0 +1,14 @@ +export const opacity = { + none: 0, + xs2: 0.04, + xs: 0.08, + sm: 0.12, + md: 0.16, + lg: 0.24, + xl: 0.4, + xl2: 0.64, + xl3: 0.8, + full: 1, +} as const + +export type OpacityTokens = typeof opacity diff --git a/ui/theme/src/tokens/elevation/blurs.ts b/ui/theme/src/tokens/elevation/blurs.ts index c7f5af2d7..944d9ebf7 100644 --- a/ui/theme/src/tokens/elevation/blurs.ts +++ b/ui/theme/src/tokens/elevation/blurs.ts @@ -11,4 +11,3 @@ export const shadowBlurs = { xl2: '16px', xl3: '20px', } as const - diff --git a/ui/theme/src/tokens/elevation/elevations.ts b/ui/theme/src/tokens/elevation/elevations.ts index 1f23f3066..544a74da4 100644 --- a/ui/theme/src/tokens/elevation/elevations.ts +++ b/ui/theme/src/tokens/elevation/elevations.ts @@ -181,4 +181,3 @@ export const elevations = (colors: Colors): ElevationsTokens => ({ }), }, }) - diff --git a/ui/theme/src/tokens/elevation/index.ts b/ui/theme/src/tokens/elevation/index.ts index 39160c868..8f7a241c1 100644 --- a/ui/theme/src/tokens/elevation/index.ts +++ b/ui/theme/src/tokens/elevation/index.ts @@ -4,4 +4,3 @@ export type * from './interfaces.js' export * from './offsets.js' export * from './spreads.js' export * from './utils/index.js' - diff --git a/ui/theme/src/tokens/elevation/interfaces.ts b/ui/theme/src/tokens/elevation/interfaces.ts index e5f5dcbd8..538a8772d 100644 --- a/ui/theme/src/tokens/elevation/interfaces.ts +++ b/ui/theme/src/tokens/elevation/interfaces.ts @@ -35,4 +35,3 @@ export interface ElevationsTokens { lg: PressableElevationStates modal: ElevationStates } - diff --git a/ui/theme/src/tokens/elevation/offsets.ts b/ui/theme/src/tokens/elevation/offsets.ts index 5318ab066..8f810307f 100644 --- a/ui/theme/src/tokens/elevation/offsets.ts +++ b/ui/theme/src/tokens/elevation/offsets.ts @@ -8,4 +8,3 @@ export const shadowOffsets = { xl2: '7px', xl3: '12px', } as const - diff --git a/ui/theme/src/tokens/elevation/spreads.ts b/ui/theme/src/tokens/elevation/spreads.ts index 9923fc7d3..ecc112e1a 100644 --- a/ui/theme/src/tokens/elevation/spreads.ts +++ b/ui/theme/src/tokens/elevation/spreads.ts @@ -6,4 +6,3 @@ export const shadowSpreads = { none: '0', xs: '1px', } as const - diff --git a/ui/theme/src/tokens/elevation/utils/createElevation.ts b/ui/theme/src/tokens/elevation/utils/createElevation.ts index 1fc7523d3..ce409fbbd 100644 --- a/ui/theme/src/tokens/elevation/utils/createElevation.ts +++ b/ui/theme/src/tokens/elevation/utils/createElevation.ts @@ -17,4 +17,3 @@ export const createElevation = (...shadows: Array): Elevation => }) => `${inset ? 'inset ' : ''}${offsetX} ${offsetY} ${blur} ${spread} ${color}` ) .join(', ') - diff --git a/ui/theme/src/tokens/elevation/utils/index.ts b/ui/theme/src/tokens/elevation/utils/index.ts index 025294029..a000147b3 100644 --- a/ui/theme/src/tokens/elevation/utils/index.ts +++ b/ui/theme/src/tokens/elevation/utils/index.ts @@ -1,2 +1 @@ export * from './createElevation.js' - diff --git a/ui/theme/src/tokens/index.ts b/ui/theme/src/tokens/index.ts index 59d742faf..0ac66e432 100644 --- a/ui/theme/src/tokens/index.ts +++ b/ui/theme/src/tokens/index.ts @@ -1,6 +1,7 @@ export * from './animations.js' export * from './borders/index.js' export * from './colors/index.js' +export * from './effects/index.js' export * from './elevation/index.js' export * from './layout/spaces.js' export * from './opacities.js' diff --git a/ui/theme/src/tokens/opacities.ts b/ui/theme/src/tokens/opacities.ts index 0146b7595..016b372dc 100644 --- a/ui/theme/src/tokens/opacities.ts +++ b/ui/theme/src/tokens/opacities.ts @@ -1,3 +1,4 @@ +// TODO remove after components migration to opacity export const opacities = { transparent: 0, disabled: 0.5,