@uni-design-system/uni-core 1.0.0 → 1.0.1
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/dist/concepts/background/background.model.d.ts +10 -0
- package/dist/concepts/background/background.model.d.ts.map +1 -0
- package/dist/concepts/background/background.model.js +2 -0
- package/dist/concepts/background/background.model.js.map +1 -0
- package/dist/concepts/background/background.types.d.ts +2 -0
- package/dist/concepts/background/background.types.d.ts.map +1 -0
- package/dist/concepts/background/background.types.js +2 -0
- package/dist/concepts/background/background.types.js.map +1 -0
- package/dist/concepts/background/index.d.ts +3 -0
- package/dist/concepts/background/index.d.ts.map +1 -0
- package/dist/concepts/background/index.js +3 -0
- package/dist/concepts/background/index.js.map +1 -0
- package/dist/concepts/border/border.model.d.ts +15 -0
- package/dist/concepts/border/border.model.d.ts.map +1 -0
- package/dist/concepts/border/border.model.js +2 -0
- package/dist/concepts/border/border.model.js.map +1 -0
- package/{src/core/border/border.types.ts → dist/concepts/border/border.types.d.ts} +1 -0
- package/dist/concepts/border/border.types.d.ts.map +1 -0
- package/dist/concepts/border/border.types.js +2 -0
- package/dist/concepts/border/border.types.js.map +1 -0
- package/dist/concepts/border/index.d.ts +3 -0
- package/dist/concepts/border/index.d.ts.map +1 -0
- package/dist/concepts/border/index.js +3 -0
- package/dist/concepts/border/index.js.map +1 -0
- package/dist/concepts/button/button.model.d.ts +18 -0
- package/dist/concepts/button/button.model.d.ts.map +1 -0
- package/dist/concepts/button/button.model.js +2 -0
- package/dist/concepts/button/button.model.js.map +1 -0
- package/dist/concepts/button/button.types.d.ts +2 -0
- package/dist/concepts/button/button.types.d.ts.map +1 -0
- package/dist/concepts/button/button.types.js +2 -0
- package/dist/concepts/button/button.types.js.map +1 -0
- package/dist/concepts/button/index.d.ts +3 -0
- package/dist/concepts/button/index.d.ts.map +1 -0
- package/dist/concepts/button/index.js +3 -0
- package/dist/concepts/button/index.js.map +1 -0
- package/dist/concepts/color/color.helper.d.ts +6 -0
- package/dist/concepts/color/color.helper.d.ts.map +1 -0
- package/dist/concepts/color/color.helper.js +29 -0
- package/dist/concepts/color/color.helper.js.map +1 -0
- package/dist/concepts/color/color.model.d.ts +46 -0
- package/dist/concepts/color/color.model.d.ts.map +1 -0
- package/dist/concepts/color/color.model.js +2 -0
- package/dist/concepts/color/color.model.js.map +1 -0
- package/dist/concepts/color/color.records.d.ts +6 -0
- package/dist/concepts/color/color.records.d.ts.map +1 -0
- package/dist/concepts/color/color.records.js +28 -0
- package/dist/concepts/color/color.records.js.map +1 -0
- package/dist/concepts/color/color.types.d.ts +13 -0
- package/dist/concepts/color/color.types.d.ts.map +1 -0
- package/dist/concepts/color/color.types.js +4 -0
- package/dist/concepts/color/color.types.js.map +1 -0
- package/dist/concepts/color/color.utils.d.ts +8 -0
- package/dist/concepts/color/color.utils.d.ts.map +1 -0
- package/dist/concepts/color/color.utils.js +17 -0
- package/dist/concepts/color/color.utils.js.map +1 -0
- package/dist/concepts/color/index.d.ts +6 -0
- package/dist/concepts/color/index.d.ts.map +1 -0
- package/dist/concepts/color/index.js +6 -0
- package/dist/concepts/color/index.js.map +1 -0
- package/dist/concepts/container/container.model.d.ts +46 -0
- package/dist/concepts/container/container.model.d.ts.map +1 -0
- package/dist/concepts/container/container.model.js +2 -0
- package/dist/concepts/container/container.model.js.map +1 -0
- package/dist/concepts/container/container.types.d.ts +2 -0
- package/dist/concepts/container/container.types.d.ts.map +1 -0
- package/dist/concepts/container/container.types.js +2 -0
- package/dist/concepts/container/container.types.js.map +1 -0
- package/dist/concepts/container/index.d.ts +3 -0
- package/dist/concepts/container/index.d.ts.map +1 -0
- package/dist/concepts/container/index.js +3 -0
- package/dist/concepts/container/index.js.map +1 -0
- package/dist/concepts/core.types.d.ts +12 -0
- package/dist/concepts/core.types.d.ts.map +1 -0
- package/dist/concepts/core.types.js +2 -0
- package/dist/concepts/core.types.js.map +1 -0
- package/dist/concepts/flex/flex.types.d.ts +9 -0
- package/dist/concepts/flex/flex.types.d.ts.map +1 -0
- package/dist/concepts/flex/flex.types.js +2 -0
- package/dist/concepts/flex/flex.types.js.map +1 -0
- package/dist/concepts/flex/index.d.ts +2 -0
- package/dist/concepts/flex/index.d.ts.map +1 -0
- package/dist/concepts/flex/index.js +2 -0
- package/dist/concepts/flex/index.js.map +1 -0
- package/dist/concepts/gradient/gradient.helper.d.ts +3 -0
- package/dist/concepts/gradient/gradient.helper.d.ts.map +1 -0
- package/dist/concepts/gradient/gradient.helper.js +4 -0
- package/dist/concepts/gradient/gradient.helper.js.map +1 -0
- package/dist/concepts/gradient/gradient.model.d.ts +7 -0
- package/dist/concepts/gradient/gradient.model.d.ts.map +1 -0
- package/dist/concepts/gradient/gradient.model.js +2 -0
- package/dist/concepts/gradient/gradient.model.js.map +1 -0
- package/dist/concepts/gradient/gradient.types.d.ts +2 -0
- package/dist/concepts/gradient/gradient.types.d.ts.map +1 -0
- package/dist/concepts/gradient/gradient.types.js +2 -0
- package/dist/concepts/gradient/gradient.types.js.map +1 -0
- package/dist/concepts/gradient/index.d.ts +4 -0
- package/dist/concepts/gradient/index.d.ts.map +1 -0
- package/dist/concepts/gradient/index.js +4 -0
- package/dist/concepts/gradient/index.js.map +1 -0
- package/dist/concepts/iconography/icon.model.d.ts +8 -0
- package/dist/concepts/iconography/icon.model.d.ts.map +1 -0
- package/dist/concepts/iconography/icon.model.js +2 -0
- package/dist/concepts/iconography/icon.model.js.map +1 -0
- package/dist/concepts/iconography/icon.types.d.ts +4 -0
- package/dist/concepts/iconography/icon.types.d.ts.map +1 -0
- package/dist/concepts/iconography/icon.types.js +2 -0
- package/dist/concepts/iconography/icon.types.js.map +1 -0
- package/dist/concepts/iconography/index.d.ts +3 -0
- package/dist/concepts/iconography/index.d.ts.map +1 -0
- package/dist/concepts/iconography/index.js +3 -0
- package/dist/concepts/iconography/index.js.map +1 -0
- package/dist/concepts/index.d.ts +15 -0
- package/dist/concepts/index.d.ts.map +1 -0
- package/dist/concepts/index.js +15 -0
- package/dist/concepts/index.js.map +1 -0
- package/dist/concepts/layout/index.d.ts +4 -0
- package/dist/concepts/layout/index.d.ts.map +1 -0
- package/dist/concepts/layout/index.js +4 -0
- package/dist/concepts/layout/index.js.map +1 -0
- package/dist/concepts/layout/layout.helper.d.ts +5 -0
- package/dist/concepts/layout/layout.helper.d.ts.map +1 -0
- package/dist/concepts/layout/layout.helper.js +20 -0
- package/dist/concepts/layout/layout.helper.js.map +1 -0
- package/dist/concepts/layout/layout.model.d.ts +6 -0
- package/dist/concepts/layout/layout.model.d.ts.map +1 -0
- package/dist/concepts/layout/layout.model.js +2 -0
- package/dist/concepts/layout/layout.model.js.map +1 -0
- package/dist/concepts/layout/layout.types.d.ts +2 -0
- package/dist/concepts/layout/layout.types.d.ts.map +1 -0
- package/dist/concepts/layout/layout.types.js +2 -0
- package/dist/concepts/layout/layout.types.js.map +1 -0
- package/dist/concepts/masking/index.d.ts +3 -0
- package/dist/concepts/masking/index.d.ts.map +1 -0
- package/dist/concepts/masking/index.js +3 -0
- package/dist/concepts/masking/index.js.map +1 -0
- package/dist/concepts/masking/masking.model.d.ts +7 -0
- package/dist/concepts/masking/masking.model.d.ts.map +1 -0
- package/dist/concepts/masking/masking.model.js +2 -0
- package/dist/concepts/masking/masking.model.js.map +1 -0
- package/{src/core/masking/masking.types.ts → dist/concepts/masking/masking.types.d.ts} +1 -0
- package/dist/concepts/masking/masking.types.d.ts.map +1 -0
- package/dist/concepts/masking/masking.types.js +2 -0
- package/dist/concepts/masking/masking.types.js.map +1 -0
- package/dist/concepts/palette/index.d.ts +2 -0
- package/dist/concepts/palette/index.d.ts.map +1 -0
- package/dist/concepts/palette/index.js +2 -0
- package/dist/concepts/palette/index.js.map +1 -0
- package/dist/concepts/palette/palette.model.d.ts +7 -0
- package/dist/concepts/palette/palette.model.d.ts.map +1 -0
- package/dist/concepts/palette/palette.model.js +2 -0
- package/dist/concepts/palette/palette.model.js.map +1 -0
- package/dist/concepts/shadow/index.d.ts +4 -0
- package/dist/concepts/shadow/index.d.ts.map +1 -0
- package/dist/concepts/shadow/index.js +4 -0
- package/dist/concepts/shadow/index.js.map +1 -0
- package/dist/concepts/shadow/shadow.model.d.ts +10 -0
- package/dist/concepts/shadow/shadow.model.d.ts.map +1 -0
- package/dist/concepts/shadow/shadow.model.js +2 -0
- package/dist/concepts/shadow/shadow.model.js.map +1 -0
- package/dist/concepts/shadow/shadow.records.d.ts +5 -0
- package/dist/concepts/shadow/shadow.records.d.ts.map +1 -0
- package/dist/concepts/shadow/shadow.records.js +71 -0
- package/dist/concepts/shadow/shadow.records.js.map +1 -0
- package/dist/concepts/shadow/shadow.types.d.ts +3 -0
- package/dist/concepts/shadow/shadow.types.d.ts.map +1 -0
- package/dist/concepts/shadow/shadow.types.js +3 -0
- package/dist/concepts/shadow/shadow.types.js.map +1 -0
- package/dist/concepts/shadow/shadow.utils.d.ts +4 -0
- package/dist/concepts/shadow/shadow.utils.d.ts.map +1 -0
- package/dist/concepts/shadow/shadow.utils.js +8 -0
- package/dist/concepts/shadow/shadow.utils.js.map +1 -0
- package/dist/concepts/theme/index.d.ts +7 -0
- package/dist/concepts/theme/index.d.ts.map +1 -0
- package/dist/concepts/theme/index.js +7 -0
- package/dist/concepts/theme/index.js.map +1 -0
- package/dist/concepts/theme/theme.model.d.ts +18 -0
- package/dist/concepts/theme/theme.model.d.ts.map +1 -0
- package/dist/concepts/theme/theme.model.js +2 -0
- package/dist/concepts/theme/theme.model.js.map +1 -0
- package/dist/concepts/theme/theme.records.d.ts +4 -0
- package/dist/concepts/theme/theme.records.d.ts.map +1 -0
- package/{src/core/theme/theme.records.ts → dist/concepts/theme/theme.records.js} +7 -7
- package/dist/concepts/theme/theme.records.js.map +1 -0
- package/{src/core/theme/theme.types.ts → dist/concepts/theme/theme.types.d.ts} +1 -1
- package/dist/concepts/theme/theme.types.d.ts.map +1 -0
- package/dist/concepts/theme/theme.types.js +2 -0
- package/dist/concepts/theme/theme.types.js.map +1 -0
- package/dist/concepts/theme/themes/base.theme.d.ts +3 -0
- package/dist/concepts/theme/themes/base.theme.d.ts.map +1 -0
- package/dist/concepts/theme/themes/base.theme.js +250 -0
- package/dist/concepts/theme/themes/base.theme.js.map +1 -0
- package/dist/concepts/theme/themes/dark.theme.d.ts +3 -0
- package/dist/concepts/theme/themes/dark.theme.d.ts.map +1 -0
- package/dist/concepts/theme/themes/dark.theme.js +38 -0
- package/dist/concepts/theme/themes/dark.theme.js.map +1 -0
- package/dist/concepts/theme/themes/light.theme.d.ts +3 -0
- package/dist/concepts/theme/themes/light.theme.d.ts.map +1 -0
- package/dist/concepts/theme/themes/light.theme.js +7 -0
- package/dist/concepts/theme/themes/light.theme.js.map +1 -0
- package/dist/concepts/theme/themes/square.theme.d.ts +3 -0
- package/dist/concepts/theme/themes/square.theme.d.ts.map +1 -0
- package/dist/concepts/theme/themes/square.theme.js +57 -0
- package/dist/concepts/theme/themes/square.theme.js.map +1 -0
- package/dist/concepts/typography/index.d.ts +4 -0
- package/dist/concepts/typography/index.d.ts.map +1 -0
- package/dist/concepts/typography/index.js +4 -0
- package/dist/concepts/typography/index.js.map +1 -0
- package/dist/concepts/typography/text.model.d.ts +17 -0
- package/dist/concepts/typography/text.model.d.ts.map +1 -0
- package/dist/concepts/typography/text.model.js +2 -0
- package/dist/concepts/typography/text.model.js.map +1 -0
- package/dist/concepts/typography/typography.records.d.ts +3 -0
- package/dist/concepts/typography/typography.records.d.ts.map +1 -0
- package/dist/concepts/typography/typography.records.js +13 -0
- package/dist/concepts/typography/typography.records.js.map +1 -0
- package/dist/concepts/typography/typography.types.d.ts +8 -0
- package/dist/concepts/typography/typography.types.d.ts.map +1 -0
- package/dist/concepts/typography/typography.types.js +2 -0
- package/dist/concepts/typography/typography.types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/debounce.d.ts +2 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/debounce.js +10 -0
- package/dist/utils/debounce.js.map +1 -0
- package/dist/utils/getValue.d.ts +3 -0
- package/dist/utils/getValue.d.ts.map +1 -0
- package/dist/utils/getValue.js +8 -0
- package/dist/utils/getValue.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/types.d.ts +5 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +2 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +25 -39
- package/.editorconfig +0 -10
- package/.storybook/main.js +0 -13
- package/.storybook/preview.js +0 -24
- package/LICENSE +0 -201
- package/README.md +0 -2
- package/src/components/button/button.component.tsx +0 -18
- package/src/components/button/button.stories.tsx +0 -22
- package/src/components/card/card.component.tsx +0 -14
- package/src/core/backgrounds/background.model.ts +0 -10
- package/src/core/backgrounds/background.types.ts +0 -2
- package/src/core/color/color.helper.ts +0 -16
- package/src/core/color/color.model.ts +0 -42
- package/src/core/color/color.types.ts +0 -76
- package/src/core/container/container.component.tsx +0 -14
- package/src/core/container/container.model.ts +0 -50
- package/src/core/core.types.ts +0 -63
- package/src/core/gradients/gradiennt.helper.ts +0 -7
- package/src/core/gradients/gradient.model.ts +0 -7
- package/src/core/gradients/gradient.types.ts +0 -0
- package/src/core/iconography/icon.model.ts +0 -8
- package/src/core/iconography/icon.types.ts +0 -68
- package/src/core/layout/layout.types.ts +0 -5
- package/src/core/masking/masking.model.ts +0 -7
- package/src/core/shadow/shadow.types.ts +0 -9
- package/src/core/theme/theme.context.tsx +0 -10
- package/src/core/theme/theme.hook.tsx +0 -18
- package/src/core/theme/theme.model.ts +0 -12
- package/src/core/theme/theme.provider.tsx +0 -56
- package/src/core/theme/themes/dark.theme.ts +0 -9
- package/src/core/theme/themes/light.theme.ts +0 -13
- package/src/core/typography/typography.types.ts +0 -10
- package/src/stories/Button.stories.tsx +0 -54
- package/src/stories/Button.tsx +0 -48
- package/src/stories/Header.stories.tsx +0 -25
- package/src/stories/Header.tsx +0 -56
- package/src/stories/Introduction.stories.mdx +0 -211
- package/src/stories/Page.stories.tsx +0 -26
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -69
- package/tsconfig.json +0 -19
package/src/core/core.types.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export type Role =
|
|
2
|
-
| 'primary'
|
|
3
|
-
| 'secondary'
|
|
4
|
-
| 'tertiary'
|
|
5
|
-
| 'ghost'
|
|
6
|
-
| 'error'
|
|
7
|
-
| 'warn'
|
|
8
|
-
| 'link'
|
|
9
|
-
;
|
|
10
|
-
|
|
11
|
-
export type SupportRole =
|
|
12
|
-
| 'info'
|
|
13
|
-
| 'warn'
|
|
14
|
-
| 'success'
|
|
15
|
-
| 'error'
|
|
16
|
-
;
|
|
17
|
-
|
|
18
|
-
export type Size =
|
|
19
|
-
| 'xs'
|
|
20
|
-
| 'sm'
|
|
21
|
-
| 'md'
|
|
22
|
-
| 'lg'
|
|
23
|
-
| 'xl'
|
|
24
|
-
;
|
|
25
|
-
|
|
26
|
-
export type HorizontalBinary =
|
|
27
|
-
| 'left'
|
|
28
|
-
| 'right'
|
|
29
|
-
;
|
|
30
|
-
|
|
31
|
-
export type HorizontalAlign = HorizontalBinary
|
|
32
|
-
| 'center'
|
|
33
|
-
;
|
|
34
|
-
|
|
35
|
-
export type VerticalBinary =
|
|
36
|
-
| 'top'
|
|
37
|
-
| 'bottom'
|
|
38
|
-
;
|
|
39
|
-
|
|
40
|
-
export type VerticalAlign = VerticalBinary
|
|
41
|
-
| 'middle'
|
|
42
|
-
;
|
|
43
|
-
|
|
44
|
-
export type Apply =
|
|
45
|
-
| HorizontalBinary
|
|
46
|
-
| VerticalBinary
|
|
47
|
-
| 'vertical'
|
|
48
|
-
| 'horizontal'
|
|
49
|
-
| 'all'
|
|
50
|
-
;
|
|
51
|
-
|
|
52
|
-
export type RadiusApply =
|
|
53
|
-
| 'left'
|
|
54
|
-
| 'right'
|
|
55
|
-
| 'top'
|
|
56
|
-
| 'bottom'
|
|
57
|
-
| 'topLeft'
|
|
58
|
-
| 'topRight'
|
|
59
|
-
| 'bottomLeft'
|
|
60
|
-
| 'bottomRight'
|
|
61
|
-
| 'all'
|
|
62
|
-
| 'none'
|
|
63
|
-
;
|
|
File without changes
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export type color = 'white' | 'black' | 'red' | 'blue' | 'green';
|
|
2
|
-
|
|
3
|
-
export type style = 'solid' | 'outline' | 'gradient';
|
|
4
|
-
|
|
5
|
-
export type display = 'logo'
|
|
6
|
-
| 'alert'
|
|
7
|
-
| 'warn'
|
|
8
|
-
| 'disabled'
|
|
9
|
-
| 'trash'
|
|
10
|
-
| 'user'
|
|
11
|
-
| 'back'
|
|
12
|
-
| 'next'
|
|
13
|
-
| 'unlock'
|
|
14
|
-
| 'view'
|
|
15
|
-
| 'hide'
|
|
16
|
-
;
|
|
17
|
-
|
|
18
|
-
export type actionable = 'add'
|
|
19
|
-
| 'create'
|
|
20
|
-
| 'copy'
|
|
21
|
-
| 'edit'
|
|
22
|
-
| 'disable'
|
|
23
|
-
| 'save'
|
|
24
|
-
| 'pin'
|
|
25
|
-
| 'fav'
|
|
26
|
-
| 'tag'
|
|
27
|
-
| 'update'
|
|
28
|
-
| 'archive'
|
|
29
|
-
| 'delete'
|
|
30
|
-
| 'lock'
|
|
31
|
-
| 'unlock'
|
|
32
|
-
| 'view'
|
|
33
|
-
| 'hide'
|
|
34
|
-
;
|
|
35
|
-
|
|
36
|
-
export type behavior = 'open'
|
|
37
|
-
| 'expand'
|
|
38
|
-
| 'collapse'
|
|
39
|
-
;
|
|
40
|
-
|
|
41
|
-
export type messaging = 'alert'
|
|
42
|
-
| 'info'
|
|
43
|
-
| 'success'
|
|
44
|
-
| 'warn'
|
|
45
|
-
| 'warning'
|
|
46
|
-
;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export type usage = 'logo'
|
|
50
|
-
| 'alert'
|
|
51
|
-
| 'chat'
|
|
52
|
-
| 'down'
|
|
53
|
-
| 'favorite'
|
|
54
|
-
| 'info'
|
|
55
|
-
| 'location'
|
|
56
|
-
| 'lock'
|
|
57
|
-
| 'message'
|
|
58
|
-
| 'profile'
|
|
59
|
-
| 'question'
|
|
60
|
-
| 'remove'
|
|
61
|
-
| 'schedule'
|
|
62
|
-
| 'search'
|
|
63
|
-
| 'send'
|
|
64
|
-
| 'settings'
|
|
65
|
-
| 'share'
|
|
66
|
-
| 'unlock'
|
|
67
|
-
| 'up'
|
|
68
|
-
;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ThemeProps } from './theme.model';
|
|
3
|
-
|
|
4
|
-
const ThemeContext = React.createContext<ThemeProps>({});
|
|
5
|
-
|
|
6
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
-
ThemeContext.displayName = 'ThemeContext';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default ThemeContext;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ThemeContext from './theme.context';
|
|
3
|
-
import { ThemeModel} from './theme.model';
|
|
4
|
-
import { LightTheme } from './themes/light.theme';
|
|
5
|
-
|
|
6
|
-
export default function useTheme(): ThemeModel {
|
|
7
|
-
|
|
8
|
-
const themeProps = React.useContext(ThemeContext);
|
|
9
|
-
|
|
10
|
-
const theme = themeProps && themeProps.themes && themeProps.themeId && themeProps.themes[themeProps.themeId];
|
|
11
|
-
|
|
12
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
|
-
React.useDebugValue(theme);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return theme || LightTheme;
|
|
18
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { DefaultThemeId } from './theme.records'
|
|
3
|
-
import { ThemeModel } from './theme.model';
|
|
4
|
-
import ThemeContext from './theme.context';
|
|
5
|
-
|
|
6
|
-
const STORAGE_KEY = 'THEME_ID';
|
|
7
|
-
|
|
8
|
-
interface ThemeProviderProps {
|
|
9
|
-
themeId: string;
|
|
10
|
-
themes: Record<string, ThemeModel>;
|
|
11
|
-
children?: React.ReactChild;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const ThemeProvider = ({ children, themeId, themes }: ThemeProviderProps) => {
|
|
15
|
-
|
|
16
|
-
const [_themeId, setThemeId] = useState<string>(themeId);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
(async () => {
|
|
20
|
-
const id = localStorage.getItem(STORAGE_KEY);
|
|
21
|
-
if (id) {
|
|
22
|
-
setThemeId(id);
|
|
23
|
-
} else {
|
|
24
|
-
setThemeId(DefaultThemeId);
|
|
25
|
-
}
|
|
26
|
-
})();
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<ThemeContext.Provider value={{themeId, themes}}>
|
|
31
|
-
{_themeId ? children : null}
|
|
32
|
-
</ThemeContext.Provider>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/*export function withTheme(Component: ({children, theme, themes }: (any & ThemeProps)) => JSX.Element) {
|
|
37
|
-
|
|
38
|
-
return (props: JSX.IntrinsicAttributes) => {
|
|
39
|
-
const { themeId, setThemeId } = useContext(ThemeContext);
|
|
40
|
-
|
|
41
|
-
const getTheme = (themeId: string) => themes[themeId];
|
|
42
|
-
const setTheme = (themeId: string) => {
|
|
43
|
-
localStorage.setItem(STORAGE_KEY, themeId);
|
|
44
|
-
setThemeId(themeId);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<Component
|
|
49
|
-
{...props}
|
|
50
|
-
themes={Themes}
|
|
51
|
-
theme={getTheme(themeId)}
|
|
52
|
-
setTheme={setTheme}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
}*/
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ThemeModel } from '../theme.model';
|
|
2
|
-
|
|
3
|
-
export const LightTheme: ThemeModel = {
|
|
4
|
-
id: 'LightTheme',
|
|
5
|
-
name: 'Light Theme',
|
|
6
|
-
colors: {
|
|
7
|
-
primary: '#35A7FF',
|
|
8
|
-
secondary: '#38618C',
|
|
9
|
-
error: '#FFE74C',
|
|
10
|
-
warn: '#FF5964',
|
|
11
|
-
background: '#FFFFFF'
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export type classes = 'sanserif' | 'serif' | 'slab' | 'script' | 'display' | 'monospace';
|
|
3
|
-
|
|
4
|
-
export type families = 'Open-Sans' | 'Times-New-Roman' | 'Noto-Serif-Display';
|
|
5
|
-
|
|
6
|
-
export type styles = 'thin' | 'light' | 'regular' | 'medium' | 'bold' | 'semi-bold' | 'black';
|
|
7
|
-
|
|
8
|
-
export type placement = 'overline' | 'title' | 'underline' | 'body' | 'label' | 'note' | 'footer';
|
|
9
|
-
|
|
10
|
-
export type alignment = 'left' | 'right' | 'center';
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import { withThemes } from '@react-theming/storybook-addon';
|
|
6
|
-
|
|
7
|
-
import { Button } from './Button';
|
|
8
|
-
import { BuiltInThemes, DefaultThemeId } from '../core/theme/theme.records';
|
|
9
|
-
import { ThemeProvider } from '../core/theme/theme.provider';
|
|
10
|
-
import { ThemeProps } from '../core/theme/theme.model';
|
|
11
|
-
|
|
12
|
-
// create decorator
|
|
13
|
-
const themingDecorator = withThemes(ThemeProvider, [DefaultThemeId]);
|
|
14
|
-
|
|
15
|
-
const providerFn = ({theme, children}: any & ThemeProps) => {
|
|
16
|
-
return <ThemeProvider themeId={theme.id} themes={BuiltInThemes}>{children}</ThemeProvider>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
20
|
-
export default {
|
|
21
|
-
title: 'Example/Button',
|
|
22
|
-
component: Button,
|
|
23
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
24
|
-
argTypes: {
|
|
25
|
-
backgroundColor: { control: 'color' },
|
|
26
|
-
},
|
|
27
|
-
} as ComponentMeta<typeof Button>;
|
|
28
|
-
|
|
29
|
-
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
30
|
-
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
|
|
31
|
-
|
|
32
|
-
export const Primary = Template.bind({});
|
|
33
|
-
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
34
|
-
Primary.args = {
|
|
35
|
-
primary: true,
|
|
36
|
-
label: 'Button',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Secondary = Template.bind({});
|
|
40
|
-
Secondary.args = {
|
|
41
|
-
label: 'Button',
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const Large = Template.bind({});
|
|
45
|
-
Large.args = {
|
|
46
|
-
size: 'large',
|
|
47
|
-
label: 'Button',
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const Small = Template.bind({});
|
|
51
|
-
Small.args = {
|
|
52
|
-
size: 'small',
|
|
53
|
-
label: 'Button',
|
|
54
|
-
};
|
package/src/stories/Button.tsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './button.css';
|
|
3
|
-
|
|
4
|
-
interface ButtonProps {
|
|
5
|
-
/**
|
|
6
|
-
* Is this the principal call to action on the page?
|
|
7
|
-
*/
|
|
8
|
-
primary?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* What background color to use
|
|
11
|
-
*/
|
|
12
|
-
backgroundColor?: string;
|
|
13
|
-
/**
|
|
14
|
-
* How large should the button be?
|
|
15
|
-
*/
|
|
16
|
-
size?: 'small' | 'medium' | 'large';
|
|
17
|
-
/**
|
|
18
|
-
* Button contents
|
|
19
|
-
*/
|
|
20
|
-
label: string;
|
|
21
|
-
/**
|
|
22
|
-
* Optional click handler
|
|
23
|
-
*/
|
|
24
|
-
onClick?: () => void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Primary UI component for user interaction
|
|
29
|
-
*/
|
|
30
|
-
export const Button = ({
|
|
31
|
-
primary = false,
|
|
32
|
-
size = 'medium',
|
|
33
|
-
backgroundColor,
|
|
34
|
-
label,
|
|
35
|
-
...props
|
|
36
|
-
}: ButtonProps) => {
|
|
37
|
-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
38
|
-
return (
|
|
39
|
-
<button
|
|
40
|
-
type="button"
|
|
41
|
-
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
42
|
-
style={{ backgroundColor }}
|
|
43
|
-
{...props}
|
|
44
|
-
>
|
|
45
|
-
{label}
|
|
46
|
-
</button>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { Header } from './Header';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Example/Header',
|
|
8
|
-
component: Header,
|
|
9
|
-
parameters: {
|
|
10
|
-
// More on Story layout: https://storybook.js.org/docs/react/configure/story-layout
|
|
11
|
-
layout: 'fullscreen',
|
|
12
|
-
},
|
|
13
|
-
} as ComponentMeta<typeof Header>;
|
|
14
|
-
|
|
15
|
-
const Template: ComponentStory<typeof Header> = (args) => <Header {...args} />;
|
|
16
|
-
|
|
17
|
-
export const LoggedIn = Template.bind({});
|
|
18
|
-
LoggedIn.args = {
|
|
19
|
-
user: {
|
|
20
|
-
name: 'Jane Doe',
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const LoggedOut = Template.bind({});
|
|
25
|
-
LoggedOut.args = {};
|
package/src/stories/Header.tsx
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Button } from './Button';
|
|
4
|
-
import './header.css';
|
|
5
|
-
|
|
6
|
-
type User = {
|
|
7
|
-
name: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
interface HeaderProps {
|
|
11
|
-
user?: User;
|
|
12
|
-
onLogin: () => void;
|
|
13
|
-
onLogout: () => void;
|
|
14
|
-
onCreateAccount: () => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const Header = ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => (
|
|
18
|
-
<header>
|
|
19
|
-
<div className="wrapper">
|
|
20
|
-
<div>
|
|
21
|
-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
22
|
-
<g fill="none" fillRule="evenodd">
|
|
23
|
-
<path
|
|
24
|
-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
25
|
-
fill="#FFF"
|
|
26
|
-
/>
|
|
27
|
-
<path
|
|
28
|
-
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
29
|
-
fill="#555AB9"
|
|
30
|
-
/>
|
|
31
|
-
<path
|
|
32
|
-
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
|
33
|
-
fill="#91BAF8"
|
|
34
|
-
/>
|
|
35
|
-
</g>
|
|
36
|
-
</svg>
|
|
37
|
-
<h1>Acme</h1>
|
|
38
|
-
</div>
|
|
39
|
-
<div>
|
|
40
|
-
{user ? (
|
|
41
|
-
<>
|
|
42
|
-
<span className="welcome">
|
|
43
|
-
Welcome, <b>{user.name}</b>!
|
|
44
|
-
</span>
|
|
45
|
-
<Button size="small" onClick={onLogout} label="Log out" />
|
|
46
|
-
</>
|
|
47
|
-
) : (
|
|
48
|
-
<>
|
|
49
|
-
<Button size="small" onClick={onLogin} label="Log in" />
|
|
50
|
-
<Button primary size="small" onClick={onCreateAccount} label="Sign up" />
|
|
51
|
-
</>
|
|
52
|
-
)}
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
</header>
|
|
56
|
-
);
|