@jongh/ui 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/index.css +1 -0
- package/.storybook/main.ts +40 -0
- package/.storybook/preview.ts +16 -0
- package/.storybook/vitest.setup.ts +9 -0
- package/.turbo/turbo-build.log +79 -0
- package/CHANGELOG.md +54 -0
- package/chromatic.config.json +6 -0
- package/eslint.config.mjs +14 -0
- package/index.html +13 -0
- package/package.json +58 -0
- package/panda.config.ts +13 -0
- package/postcss.config.cjs +3 -0
- package/preset.ts +134 -0
- package/src/component/accordion/ui/index.tsx +80 -0
- package/src/component/accordion/ui/recipe.ts +65 -0
- package/src/component/avatar/ui/index.tsx +47 -0
- package/src/component/avatar/ui/recipe.ts +30 -0
- package/src/component/button/ui/index.tsx +29 -0
- package/src/component/button/ui/recipe.ts +102 -0
- package/src/component/chip/ui/index.tsx +30 -0
- package/src/component/chip/ui/recipe.ts +112 -0
- package/src/component/dialog/ui/index.tsx +73 -0
- package/src/component/dialog/ui/recipe.ts +92 -0
- package/src/component/select/ui/index.tsx +128 -0
- package/src/component/select/ui/recipe.ts +142 -0
- package/src/component/slider/ui/index.tsx +61 -0
- package/src/component/slider/ui/recipe.ts +52 -0
- package/src/component/tabs/ui/index.tsx +61 -0
- package/src/component/tabs/ui/recipe.ts +59 -0
- package/src/hooks/createContext.tsx +34 -0
- package/src/hooks/useComposedRefs.ts +20 -0
- package/src/hooks/useControllableState.ts +87 -0
- package/src/hooks/useKeyboardEvent.ts +58 -0
- package/src/stories/accordion.stories.tsx +63 -0
- package/src/stories/avatar.stories.tsx +33 -0
- package/src/stories/button.stories.tsx +53 -0
- package/src/stories/chip.stories.tsx +69 -0
- package/src/stories/dialog.stories.tsx +134 -0
- package/src/stories/select.stories.tsx +35 -0
- package/src/stories/slider.stories.tsx +31 -0
- package/src/stories/tabs.stories.tsx +63 -0
- package/src/test/accordion.test.tsx +66 -0
- package/src/test/tabs.test.tsx +30 -0
- package/src/types/index.ts +1 -0
- package/src/utils/createStyleContext.tsx +108 -0
- package/src/utils/defineSafe.ts +46 -0
- package/src/utils/getObjectKeys.ts +20 -0
- package/src/vite-env.d.ts +1 -0
- package/storybook-static/assets/Color-F6OSRLHC-CrKta8Qx.js +1 -0
- package/storybook-static/assets/DocsRenderer-CFRXHY34-Crd9Mepd.js +586 -0
- package/storybook-static/assets/_commonjsHelpers-Cpj98o6Y.js +1 -0
- package/storybook-static/assets/accordion.stories-0Om0AnMm.js +50 -0
- package/storybook-static/assets/avatar.stories-DMDsrSks.js +16 -0
- package/storybook-static/assets/axe-Dzet_oDA.js +30 -0
- package/storybook-static/assets/button.stories-CuVC-3x-.js +40 -0
- package/storybook-static/assets/chip.stories-FBIp8XNi.js +48 -0
- package/storybook-static/assets/chunk-XP5HYGXS-D5tuasO7.js +1 -0
- package/storybook-static/assets/createLucideIcon-DmXe7Z8R.js +21 -0
- package/storybook-static/assets/dialog.stories-3WsEvXt4.js +106 -0
- package/storybook-static/assets/entry-preview-Bkgdgq1b.js +10 -0
- package/storybook-static/assets/entry-preview-docs-zLz1Es7d.js +46 -0
- package/storybook-static/assets/iframe-LPPPXabV.js +199 -0
- package/storybook-static/assets/index-Bklpsb39.js +1 -0
- package/storybook-static/assets/index-BrlJLjep.js +24 -0
- package/storybook-static/assets/index-C2tRLqin.js +41 -0
- package/storybook-static/assets/index-CBft-ReK.js +8 -0
- package/storybook-static/assets/index-CSbWd7UJ.js +1 -0
- package/storybook-static/assets/index-ClcD9ViR.js +9 -0
- package/storybook-static/assets/index-Cu4lwwaE.js +1 -0
- package/storybook-static/assets/index-Cvkemp2J.js +1 -0
- package/storybook-static/assets/index-D59aU5s_.js +240 -0
- package/storybook-static/assets/index-DNo8LKN3.js +1 -0
- package/storybook-static/assets/index-DUy19JZU.js +1 -0
- package/storybook-static/assets/index-D_35mznO.js +1 -0
- package/storybook-static/assets/index-DrFu-skq.js +6 -0
- package/storybook-static/assets/index-DvbTp2M2.js +1 -0
- package/storybook-static/assets/index-rtmQni2k.js +1 -0
- package/storybook-static/assets/jsx-runtime-BYYWji4R.js +9 -0
- package/storybook-static/assets/matchers-57EZJSQE-oeXCqs4p.js +14 -0
- package/storybook-static/assets/preview-1l6V4UsQ.js +1 -0
- package/storybook-static/assets/preview-B3PTUHS7.js +1 -0
- package/storybook-static/assets/preview-BBWR9nbA.js +1 -0
- package/storybook-static/assets/preview-BCV5r-Ja.js +1 -0
- package/storybook-static/assets/preview-BWzBA1C2.js +396 -0
- package/storybook-static/assets/preview-Bb56VplF.js +2 -0
- package/storybook-static/assets/preview-Bl8rsKRy.js +1 -0
- package/storybook-static/assets/preview-Bm-a94Ct.js +2 -0
- package/storybook-static/assets/preview-Br-h4d84.js +1 -0
- package/storybook-static/assets/preview-D77C14du.js +34 -0
- package/storybook-static/assets/preview-DC8N7cZb.css +1 -0
- package/storybook-static/assets/preview-DGUiP6tS.js +7 -0
- package/storybook-static/assets/react-18-BPs3tMGP.js +1 -0
- package/storybook-static/assets/select.stories-AN8Hb81Z.js +20 -0
- package/storybook-static/assets/slider.stories-CxOczq0y.js +12 -0
- package/storybook-static/assets/tabs.stories-BbTU4QU3.js +28 -0
- package/storybook-static/favicon.svg +1 -0
- package/storybook-static/iframe.html +666 -0
- package/storybook-static/index.html +193 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/sb-addons/a11y-12/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/a11y-12/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +331 -0
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +51 -0
- package/storybook-static/sb-addons/controls-11/manager-bundle.js +391 -0
- package/storybook-static/sb-addons/controls-11/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js +12 -0
- package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +391 -0
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-docs-4/manager-bundle.js +230 -0
- package/storybook-static/sb-addons/essentials-docs-4/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-toolbars-7/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-toolbars-7/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/links-1/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/storybook-experimental-addon-test-13/manager-bundle.js +211 -0
- package/storybook-static/sb-addons/storybook-experimental-addon-test-13/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +1037 -0
- package/storybook-static/sb-manager/globals-runtime.js +40857 -0
- package/storybook-static/sb-manager/globals.js +48 -0
- package/storybook-static/sb-manager/runtime.js +11963 -0
- package/styled-system/css/conditions.mjs +36 -0
- package/styled-system/css/css.d.ts +22 -0
- package/styled-system/css/css.mjs +45 -0
- package/styled-system/css/cva.d.ts +6 -0
- package/styled-system/css/cva.mjs +87 -0
- package/styled-system/css/cx.d.ts +5 -0
- package/styled-system/css/cx.mjs +15 -0
- package/styled-system/css/index.d.ts +5 -0
- package/styled-system/css/index.mjs +4 -0
- package/styled-system/css/sva.d.ts +4 -0
- package/styled-system/css/sva.mjs +41 -0
- package/styled-system/helpers.mjs +336 -0
- package/styled-system/jsx/aspect-ratio.d.ts +10 -0
- package/styled-system/jsx/aspect-ratio.mjs +14 -0
- package/styled-system/jsx/bleed.d.ts +10 -0
- package/styled-system/jsx/bleed.mjs +14 -0
- package/styled-system/jsx/box.d.ts +10 -0
- package/styled-system/jsx/box.mjs +14 -0
- package/styled-system/jsx/center.d.ts +10 -0
- package/styled-system/jsx/center.mjs +14 -0
- package/styled-system/jsx/circle.d.ts +10 -0
- package/styled-system/jsx/circle.mjs +14 -0
- package/styled-system/jsx/container.d.ts +10 -0
- package/styled-system/jsx/container.mjs +14 -0
- package/styled-system/jsx/cq.d.ts +10 -0
- package/styled-system/jsx/cq.mjs +14 -0
- package/styled-system/jsx/divider.d.ts +10 -0
- package/styled-system/jsx/divider.mjs +14 -0
- package/styled-system/jsx/factory-helper.mjs +22 -0
- package/styled-system/jsx/factory.d.ts +3 -0
- package/styled-system/jsx/factory.mjs +80 -0
- package/styled-system/jsx/flex.d.ts +10 -0
- package/styled-system/jsx/flex.mjs +14 -0
- package/styled-system/jsx/float.d.ts +10 -0
- package/styled-system/jsx/float.mjs +14 -0
- package/styled-system/jsx/grid-item.d.ts +10 -0
- package/styled-system/jsx/grid-item.mjs +14 -0
- package/styled-system/jsx/grid.d.ts +10 -0
- package/styled-system/jsx/grid.mjs +14 -0
- package/styled-system/jsx/hstack.d.ts +10 -0
- package/styled-system/jsx/hstack.mjs +14 -0
- package/styled-system/jsx/index.d.ts +24 -0
- package/styled-system/jsx/index.mjs +22 -0
- package/styled-system/jsx/is-valid-prop.d.ts +11 -0
- package/styled-system/jsx/is-valid-prop.mjs +17 -0
- package/styled-system/jsx/link-overlay.d.ts +10 -0
- package/styled-system/jsx/link-overlay.mjs +14 -0
- package/styled-system/jsx/spacer.d.ts +10 -0
- package/styled-system/jsx/spacer.mjs +14 -0
- package/styled-system/jsx/square.d.ts +10 -0
- package/styled-system/jsx/square.mjs +14 -0
- package/styled-system/jsx/stack.d.ts +10 -0
- package/styled-system/jsx/stack.mjs +14 -0
- package/styled-system/jsx/visually-hidden.d.ts +10 -0
- package/styled-system/jsx/visually-hidden.mjs +14 -0
- package/styled-system/jsx/vstack.d.ts +10 -0
- package/styled-system/jsx/vstack.mjs +14 -0
- package/styled-system/jsx/wrap.d.ts +10 -0
- package/styled-system/jsx/wrap.mjs +14 -0
- package/styled-system/patterns/aspect-ratio.d.ts +21 -0
- package/styled-system/patterns/aspect-ratio.mjs +38 -0
- package/styled-system/patterns/bleed.d.ts +22 -0
- package/styled-system/patterns/bleed.mjs +24 -0
- package/styled-system/patterns/box.d.ts +21 -0
- package/styled-system/patterns/box.mjs +15 -0
- package/styled-system/patterns/center.d.ts +21 -0
- package/styled-system/patterns/center.mjs +21 -0
- package/styled-system/patterns/circle.d.ts +21 -0
- package/styled-system/patterns/circle.mjs +25 -0
- package/styled-system/patterns/container.d.ts +21 -0
- package/styled-system/patterns/container.mjs +21 -0
- package/styled-system/patterns/cq.d.ts +22 -0
- package/styled-system/patterns/cq.mjs +21 -0
- package/styled-system/patterns/divider.d.ts +23 -0
- package/styled-system/patterns/divider.mjs +25 -0
- package/styled-system/patterns/flex.d.ts +27 -0
- package/styled-system/patterns/flex.mjs +26 -0
- package/styled-system/patterns/float.d.ts +24 -0
- package/styled-system/patterns/float.mjs +52 -0
- package/styled-system/patterns/grid-item.d.ts +26 -0
- package/styled-system/patterns/grid-item.mjs +25 -0
- package/styled-system/patterns/grid.d.ts +25 -0
- package/styled-system/patterns/grid.mjs +27 -0
- package/styled-system/patterns/hstack.d.ts +22 -0
- package/styled-system/patterns/hstack.mjs +24 -0
- package/styled-system/patterns/index.d.ts +21 -0
- package/styled-system/patterns/index.mjs +20 -0
- package/styled-system/patterns/link-overlay.d.ts +21 -0
- package/styled-system/patterns/link-overlay.mjs +24 -0
- package/styled-system/patterns/spacer.d.ts +21 -0
- package/styled-system/patterns/spacer.mjs +21 -0
- package/styled-system/patterns/square.d.ts +21 -0
- package/styled-system/patterns/square.mjs +24 -0
- package/styled-system/patterns/stack.d.ts +24 -0
- package/styled-system/patterns/stack.mjs +24 -0
- package/styled-system/patterns/visually-hidden.d.ts +21 -0
- package/styled-system/patterns/visually-hidden.mjs +18 -0
- package/styled-system/patterns/vstack.d.ts +22 -0
- package/styled-system/patterns/vstack.mjs +24 -0
- package/styled-system/patterns/wrap.d.ts +25 -0
- package/styled-system/patterns/wrap.mjs +25 -0
- package/styled-system/tokens/index.d.ts +9 -0
- package/styled-system/tokens/index.mjs +1992 -0
- package/styled-system/tokens/tokens.d.ts +60 -0
- package/styled-system/types/composition.d.ts +164 -0
- package/styled-system/types/conditions.d.ts +274 -0
- package/styled-system/types/csstype.d.ts +21298 -0
- package/styled-system/types/global.d.ts +20 -0
- package/styled-system/types/index.d.ts +8 -0
- package/styled-system/types/jsx.d.ts +52 -0
- package/styled-system/types/parts.d.ts +8 -0
- package/styled-system/types/pattern.d.ts +78 -0
- package/styled-system/types/prop-type.d.ts +235 -0
- package/styled-system/types/recipe.d.ts +181 -0
- package/styled-system/types/selectors.d.ts +59 -0
- package/styled-system/types/static-css.d.ts +56 -0
- package/styled-system/types/style-props.d.ts +7468 -0
- package/styled-system/types/system-types.d.ts +109 -0
- package/tsconfig.json +13 -0
- package/turbo/generators/config.cjs +7 -0
- package/turbo/generators/stories.cjs +23 -0
- package/turbo/generators/templates/stories.tsx.hbs +16 -0
- package/turbo/generators/templates/ui.tsx.hbs +8 -0
- package/turbo/generators/ui.cjs +19 -0
- package/vite.config.ts +7 -0
- package/vitest.config.ts +45 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { ConditionalValue, Nested } from './conditions';
|
|
3
|
+
import type { AtRule, PropertiesFallback } from './csstype';
|
|
4
|
+
import type { SystemProperties, CssVarProperties } from './style-props';
|
|
5
|
+
|
|
6
|
+
type String = string & {}
|
|
7
|
+
type Number = number & {}
|
|
8
|
+
|
|
9
|
+
export type Pretty<T> = { [K in keyof T]: T[K] } & {}
|
|
10
|
+
|
|
11
|
+
export type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never
|
|
12
|
+
|
|
13
|
+
export type DistributiveUnion<T, U> = {
|
|
14
|
+
[K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]
|
|
15
|
+
} & DistributiveOmit<U, keyof T>
|
|
16
|
+
|
|
17
|
+
export type Assign<T, U> = {
|
|
18
|
+
[K in keyof T]: K extends keyof U ? U[K] : T[K]
|
|
19
|
+
} & U
|
|
20
|
+
|
|
21
|
+
/* -----------------------------------------------------------------------------
|
|
22
|
+
* Native css properties
|
|
23
|
+
* -----------------------------------------------------------------------------*/
|
|
24
|
+
|
|
25
|
+
export type CssProperty = keyof PropertiesFallback
|
|
26
|
+
|
|
27
|
+
export interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties {}
|
|
28
|
+
|
|
29
|
+
export interface CssKeyframes {
|
|
30
|
+
[name: string]: {
|
|
31
|
+
[time: string]: CssProperties
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* -----------------------------------------------------------------------------
|
|
36
|
+
* Conditional css properties
|
|
37
|
+
* -----------------------------------------------------------------------------*/
|
|
38
|
+
|
|
39
|
+
interface GenericProperties {
|
|
40
|
+
[key: string]: ConditionalValue<String | Number | boolean>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* -----------------------------------------------------------------------------
|
|
44
|
+
* Native css props
|
|
45
|
+
* -----------------------------------------------------------------------------*/
|
|
46
|
+
|
|
47
|
+
export type NestedCssProperties = Nested<CssProperties>
|
|
48
|
+
|
|
49
|
+
export type SystemStyleObject = Omit<Nested<SystemProperties & CssVarProperties>, 'base'>
|
|
50
|
+
|
|
51
|
+
export interface GlobalStyleObject {
|
|
52
|
+
[selector: string]: SystemStyleObject
|
|
53
|
+
}
|
|
54
|
+
export interface ExtendableGlobalStyleObject {
|
|
55
|
+
[selector: string]: SystemStyleObject | undefined
|
|
56
|
+
extend?: GlobalStyleObject | undefined
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* -----------------------------------------------------------------------------
|
|
60
|
+
* Composition (text styles, layer styles)
|
|
61
|
+
* -----------------------------------------------------------------------------*/
|
|
62
|
+
|
|
63
|
+
type FilterStyleObject<P extends string> = {
|
|
64
|
+
[K in P]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>
|
|
68
|
+
|
|
69
|
+
/* -----------------------------------------------------------------------------
|
|
70
|
+
* Font face
|
|
71
|
+
* -----------------------------------------------------------------------------*/
|
|
72
|
+
|
|
73
|
+
export type GlobalFontfaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>
|
|
74
|
+
|
|
75
|
+
export type FontfaceRule = Omit<GlobalFontfaceRule, 'fontFamily'>
|
|
76
|
+
|
|
77
|
+
export interface GlobalFontface {
|
|
78
|
+
[name: string]: FontfaceRule | FontfaceRule[]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface ExtendableGlobalFontface {
|
|
82
|
+
[name: string]: FontfaceRule | FontfaceRule[] | GlobalFontface | undefined
|
|
83
|
+
extend?: GlobalFontface | undefined
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* -----------------------------------------------------------------------------
|
|
87
|
+
* Jsx style props
|
|
88
|
+
* -----------------------------------------------------------------------------*/
|
|
89
|
+
interface WithCss {
|
|
90
|
+
css?: SystemStyleObject | SystemStyleObject[]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type JsxStyleProps = SystemStyleObject & WithCss
|
|
94
|
+
|
|
95
|
+
export interface PatchedHTMLProps {
|
|
96
|
+
htmlWidth?: string | number
|
|
97
|
+
htmlHeight?: string | number
|
|
98
|
+
htmlTranslate?: 'yes' | 'no' | undefined
|
|
99
|
+
htmlContent?: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'
|
|
103
|
+
|
|
104
|
+
type WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps
|
|
105
|
+
|
|
106
|
+
export type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<
|
|
107
|
+
WithHTMLProps<T>,
|
|
108
|
+
P
|
|
109
|
+
>
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@jongh/tsconfig/react.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"baseUrl": "./",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@styled-system/*": ["styled-system/*"],
|
|
8
|
+
"@utils/*": ["./src/utils/*"],
|
|
9
|
+
"@/*": ["./src/*"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["node_modules", "dist"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = function generator(plop) {
|
|
2
|
+
plop.setGenerator("stories", {
|
|
3
|
+
description: "create new storybook template",
|
|
4
|
+
prompts: [
|
|
5
|
+
{
|
|
6
|
+
type: "input",
|
|
7
|
+
name: "name",
|
|
8
|
+
message: "What is the name of the new file to create?",
|
|
9
|
+
validate: (input) => {
|
|
10
|
+
console.log(input)
|
|
11
|
+
return true
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
actions: [
|
|
16
|
+
{
|
|
17
|
+
type: "add",
|
|
18
|
+
path: "src/stories/{{camelCase name}}.stories.tsx",
|
|
19
|
+
templateFile: "templates/stories.tsx.hbs",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
})
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import { {{pascalCase name}} } from "../components/{{pascalCase name}}/{{pascalCase name}}.tsx"
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "{{pascalCase name}}",
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
} satisfies Meta<typeof {{pascalCase name}}>
|
|
9
|
+
|
|
10
|
+
export default meta
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Primary: Story = {
|
|
15
|
+
args: {},
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module.exports = function generator(plop) {
|
|
2
|
+
plop.setGenerator("component", {
|
|
3
|
+
description: "Create a new React component",
|
|
4
|
+
prompts: [
|
|
5
|
+
{
|
|
6
|
+
type: "input",
|
|
7
|
+
name: "name",
|
|
8
|
+
message: "What is the name of the component?",
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
actions: [
|
|
12
|
+
{
|
|
13
|
+
type: "add",
|
|
14
|
+
path: "src/component/{{camelCase name}}/ui/index.tsx",
|
|
15
|
+
templateFile: "templates/ui.tsx.hbs",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
})
|
|
19
|
+
}
|
package/vite.config.ts
ADDED
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import path from "node:path"
|
|
2
|
+
import { fileURLToPath } from "node:url"
|
|
3
|
+
|
|
4
|
+
import { storybookTest } from "@storybook/experimental-addon-test/vitest-plugin"
|
|
5
|
+
import { defineConfig, defineProject, mergeConfig } from "vitest/config"
|
|
6
|
+
|
|
7
|
+
const dirname =
|
|
8
|
+
typeof __dirname !== "undefined"
|
|
9
|
+
? __dirname
|
|
10
|
+
: path.dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
|
|
12
|
+
// 👇 If you're using Next.js, apply this framework plugin as well
|
|
13
|
+
// import { storybookNextJsPlugin } from '@storybook/experimental-nextjs-vite/vite-plugin';
|
|
14
|
+
import viteConfig from "./vite.config"
|
|
15
|
+
|
|
16
|
+
export default defineProject(
|
|
17
|
+
mergeConfig(
|
|
18
|
+
viteConfig,
|
|
19
|
+
defineConfig({
|
|
20
|
+
plugins: [
|
|
21
|
+
storybookTest({
|
|
22
|
+
configDir: path.join(dirname, ".storybook"),
|
|
23
|
+
storybookScript: "pnpm storybook --ci",
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
test: {
|
|
27
|
+
browser: {
|
|
28
|
+
instances: [
|
|
29
|
+
{
|
|
30
|
+
browser: "chromium",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
enabled: true,
|
|
34
|
+
provider: "playwright",
|
|
35
|
+
headless: true,
|
|
36
|
+
},
|
|
37
|
+
// Speed up tests and better match how they run in Storybook itself
|
|
38
|
+
// https://vitest.dev/config/#isolate
|
|
39
|
+
// Consider removing this if you have flaky tests
|
|
40
|
+
isolate: false,
|
|
41
|
+
setupFiles: ["./.storybook/vitest.setup.ts"],
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
),
|
|
45
|
+
)
|