@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.
Files changed (291) hide show
  1. package/dist/concepts/background/background.model.d.ts +10 -0
  2. package/dist/concepts/background/background.model.d.ts.map +1 -0
  3. package/dist/concepts/background/background.model.js +2 -0
  4. package/dist/concepts/background/background.model.js.map +1 -0
  5. package/dist/concepts/background/background.types.d.ts +2 -0
  6. package/dist/concepts/background/background.types.d.ts.map +1 -0
  7. package/dist/concepts/background/background.types.js +2 -0
  8. package/dist/concepts/background/background.types.js.map +1 -0
  9. package/dist/concepts/background/index.d.ts +3 -0
  10. package/dist/concepts/background/index.d.ts.map +1 -0
  11. package/dist/concepts/background/index.js +3 -0
  12. package/dist/concepts/background/index.js.map +1 -0
  13. package/dist/concepts/border/border.model.d.ts +15 -0
  14. package/dist/concepts/border/border.model.d.ts.map +1 -0
  15. package/dist/concepts/border/border.model.js +2 -0
  16. package/dist/concepts/border/border.model.js.map +1 -0
  17. package/{src/core/border/border.types.ts → dist/concepts/border/border.types.d.ts} +1 -0
  18. package/dist/concepts/border/border.types.d.ts.map +1 -0
  19. package/dist/concepts/border/border.types.js +2 -0
  20. package/dist/concepts/border/border.types.js.map +1 -0
  21. package/dist/concepts/border/index.d.ts +3 -0
  22. package/dist/concepts/border/index.d.ts.map +1 -0
  23. package/dist/concepts/border/index.js +3 -0
  24. package/dist/concepts/border/index.js.map +1 -0
  25. package/dist/concepts/button/button.model.d.ts +18 -0
  26. package/dist/concepts/button/button.model.d.ts.map +1 -0
  27. package/dist/concepts/button/button.model.js +2 -0
  28. package/dist/concepts/button/button.model.js.map +1 -0
  29. package/dist/concepts/button/button.types.d.ts +2 -0
  30. package/dist/concepts/button/button.types.d.ts.map +1 -0
  31. package/dist/concepts/button/button.types.js +2 -0
  32. package/dist/concepts/button/button.types.js.map +1 -0
  33. package/dist/concepts/button/index.d.ts +3 -0
  34. package/dist/concepts/button/index.d.ts.map +1 -0
  35. package/dist/concepts/button/index.js +3 -0
  36. package/dist/concepts/button/index.js.map +1 -0
  37. package/dist/concepts/color/color.helper.d.ts +6 -0
  38. package/dist/concepts/color/color.helper.d.ts.map +1 -0
  39. package/dist/concepts/color/color.helper.js +29 -0
  40. package/dist/concepts/color/color.helper.js.map +1 -0
  41. package/dist/concepts/color/color.model.d.ts +46 -0
  42. package/dist/concepts/color/color.model.d.ts.map +1 -0
  43. package/dist/concepts/color/color.model.js +2 -0
  44. package/dist/concepts/color/color.model.js.map +1 -0
  45. package/dist/concepts/color/color.records.d.ts +6 -0
  46. package/dist/concepts/color/color.records.d.ts.map +1 -0
  47. package/dist/concepts/color/color.records.js +28 -0
  48. package/dist/concepts/color/color.records.js.map +1 -0
  49. package/dist/concepts/color/color.types.d.ts +13 -0
  50. package/dist/concepts/color/color.types.d.ts.map +1 -0
  51. package/dist/concepts/color/color.types.js +4 -0
  52. package/dist/concepts/color/color.types.js.map +1 -0
  53. package/dist/concepts/color/color.utils.d.ts +8 -0
  54. package/dist/concepts/color/color.utils.d.ts.map +1 -0
  55. package/dist/concepts/color/color.utils.js +17 -0
  56. package/dist/concepts/color/color.utils.js.map +1 -0
  57. package/dist/concepts/color/index.d.ts +6 -0
  58. package/dist/concepts/color/index.d.ts.map +1 -0
  59. package/dist/concepts/color/index.js +6 -0
  60. package/dist/concepts/color/index.js.map +1 -0
  61. package/dist/concepts/container/container.model.d.ts +46 -0
  62. package/dist/concepts/container/container.model.d.ts.map +1 -0
  63. package/dist/concepts/container/container.model.js +2 -0
  64. package/dist/concepts/container/container.model.js.map +1 -0
  65. package/dist/concepts/container/container.types.d.ts +2 -0
  66. package/dist/concepts/container/container.types.d.ts.map +1 -0
  67. package/dist/concepts/container/container.types.js +2 -0
  68. package/dist/concepts/container/container.types.js.map +1 -0
  69. package/dist/concepts/container/index.d.ts +3 -0
  70. package/dist/concepts/container/index.d.ts.map +1 -0
  71. package/dist/concepts/container/index.js +3 -0
  72. package/dist/concepts/container/index.js.map +1 -0
  73. package/dist/concepts/core.types.d.ts +12 -0
  74. package/dist/concepts/core.types.d.ts.map +1 -0
  75. package/dist/concepts/core.types.js +2 -0
  76. package/dist/concepts/core.types.js.map +1 -0
  77. package/dist/concepts/flex/flex.types.d.ts +9 -0
  78. package/dist/concepts/flex/flex.types.d.ts.map +1 -0
  79. package/dist/concepts/flex/flex.types.js +2 -0
  80. package/dist/concepts/flex/flex.types.js.map +1 -0
  81. package/dist/concepts/flex/index.d.ts +2 -0
  82. package/dist/concepts/flex/index.d.ts.map +1 -0
  83. package/dist/concepts/flex/index.js +2 -0
  84. package/dist/concepts/flex/index.js.map +1 -0
  85. package/dist/concepts/gradient/gradient.helper.d.ts +3 -0
  86. package/dist/concepts/gradient/gradient.helper.d.ts.map +1 -0
  87. package/dist/concepts/gradient/gradient.helper.js +4 -0
  88. package/dist/concepts/gradient/gradient.helper.js.map +1 -0
  89. package/dist/concepts/gradient/gradient.model.d.ts +7 -0
  90. package/dist/concepts/gradient/gradient.model.d.ts.map +1 -0
  91. package/dist/concepts/gradient/gradient.model.js +2 -0
  92. package/dist/concepts/gradient/gradient.model.js.map +1 -0
  93. package/dist/concepts/gradient/gradient.types.d.ts +2 -0
  94. package/dist/concepts/gradient/gradient.types.d.ts.map +1 -0
  95. package/dist/concepts/gradient/gradient.types.js +2 -0
  96. package/dist/concepts/gradient/gradient.types.js.map +1 -0
  97. package/dist/concepts/gradient/index.d.ts +4 -0
  98. package/dist/concepts/gradient/index.d.ts.map +1 -0
  99. package/dist/concepts/gradient/index.js +4 -0
  100. package/dist/concepts/gradient/index.js.map +1 -0
  101. package/dist/concepts/iconography/icon.model.d.ts +8 -0
  102. package/dist/concepts/iconography/icon.model.d.ts.map +1 -0
  103. package/dist/concepts/iconography/icon.model.js +2 -0
  104. package/dist/concepts/iconography/icon.model.js.map +1 -0
  105. package/dist/concepts/iconography/icon.types.d.ts +4 -0
  106. package/dist/concepts/iconography/icon.types.d.ts.map +1 -0
  107. package/dist/concepts/iconography/icon.types.js +2 -0
  108. package/dist/concepts/iconography/icon.types.js.map +1 -0
  109. package/dist/concepts/iconography/index.d.ts +3 -0
  110. package/dist/concepts/iconography/index.d.ts.map +1 -0
  111. package/dist/concepts/iconography/index.js +3 -0
  112. package/dist/concepts/iconography/index.js.map +1 -0
  113. package/dist/concepts/index.d.ts +15 -0
  114. package/dist/concepts/index.d.ts.map +1 -0
  115. package/dist/concepts/index.js +15 -0
  116. package/dist/concepts/index.js.map +1 -0
  117. package/dist/concepts/layout/index.d.ts +4 -0
  118. package/dist/concepts/layout/index.d.ts.map +1 -0
  119. package/dist/concepts/layout/index.js +4 -0
  120. package/dist/concepts/layout/index.js.map +1 -0
  121. package/dist/concepts/layout/layout.helper.d.ts +5 -0
  122. package/dist/concepts/layout/layout.helper.d.ts.map +1 -0
  123. package/dist/concepts/layout/layout.helper.js +20 -0
  124. package/dist/concepts/layout/layout.helper.js.map +1 -0
  125. package/dist/concepts/layout/layout.model.d.ts +6 -0
  126. package/dist/concepts/layout/layout.model.d.ts.map +1 -0
  127. package/dist/concepts/layout/layout.model.js +2 -0
  128. package/dist/concepts/layout/layout.model.js.map +1 -0
  129. package/dist/concepts/layout/layout.types.d.ts +2 -0
  130. package/dist/concepts/layout/layout.types.d.ts.map +1 -0
  131. package/dist/concepts/layout/layout.types.js +2 -0
  132. package/dist/concepts/layout/layout.types.js.map +1 -0
  133. package/dist/concepts/masking/index.d.ts +3 -0
  134. package/dist/concepts/masking/index.d.ts.map +1 -0
  135. package/dist/concepts/masking/index.js +3 -0
  136. package/dist/concepts/masking/index.js.map +1 -0
  137. package/dist/concepts/masking/masking.model.d.ts +7 -0
  138. package/dist/concepts/masking/masking.model.d.ts.map +1 -0
  139. package/dist/concepts/masking/masking.model.js +2 -0
  140. package/dist/concepts/masking/masking.model.js.map +1 -0
  141. package/{src/core/masking/masking.types.ts → dist/concepts/masking/masking.types.d.ts} +1 -0
  142. package/dist/concepts/masking/masking.types.d.ts.map +1 -0
  143. package/dist/concepts/masking/masking.types.js +2 -0
  144. package/dist/concepts/masking/masking.types.js.map +1 -0
  145. package/dist/concepts/palette/index.d.ts +2 -0
  146. package/dist/concepts/palette/index.d.ts.map +1 -0
  147. package/dist/concepts/palette/index.js +2 -0
  148. package/dist/concepts/palette/index.js.map +1 -0
  149. package/dist/concepts/palette/palette.model.d.ts +7 -0
  150. package/dist/concepts/palette/palette.model.d.ts.map +1 -0
  151. package/dist/concepts/palette/palette.model.js +2 -0
  152. package/dist/concepts/palette/palette.model.js.map +1 -0
  153. package/dist/concepts/shadow/index.d.ts +4 -0
  154. package/dist/concepts/shadow/index.d.ts.map +1 -0
  155. package/dist/concepts/shadow/index.js +4 -0
  156. package/dist/concepts/shadow/index.js.map +1 -0
  157. package/dist/concepts/shadow/shadow.model.d.ts +10 -0
  158. package/dist/concepts/shadow/shadow.model.d.ts.map +1 -0
  159. package/dist/concepts/shadow/shadow.model.js +2 -0
  160. package/dist/concepts/shadow/shadow.model.js.map +1 -0
  161. package/dist/concepts/shadow/shadow.records.d.ts +5 -0
  162. package/dist/concepts/shadow/shadow.records.d.ts.map +1 -0
  163. package/dist/concepts/shadow/shadow.records.js +71 -0
  164. package/dist/concepts/shadow/shadow.records.js.map +1 -0
  165. package/dist/concepts/shadow/shadow.types.d.ts +3 -0
  166. package/dist/concepts/shadow/shadow.types.d.ts.map +1 -0
  167. package/dist/concepts/shadow/shadow.types.js +3 -0
  168. package/dist/concepts/shadow/shadow.types.js.map +1 -0
  169. package/dist/concepts/shadow/shadow.utils.d.ts +4 -0
  170. package/dist/concepts/shadow/shadow.utils.d.ts.map +1 -0
  171. package/dist/concepts/shadow/shadow.utils.js +8 -0
  172. package/dist/concepts/shadow/shadow.utils.js.map +1 -0
  173. package/dist/concepts/theme/index.d.ts +7 -0
  174. package/dist/concepts/theme/index.d.ts.map +1 -0
  175. package/dist/concepts/theme/index.js +7 -0
  176. package/dist/concepts/theme/index.js.map +1 -0
  177. package/dist/concepts/theme/theme.model.d.ts +18 -0
  178. package/dist/concepts/theme/theme.model.d.ts.map +1 -0
  179. package/dist/concepts/theme/theme.model.js +2 -0
  180. package/dist/concepts/theme/theme.model.js.map +1 -0
  181. package/dist/concepts/theme/theme.records.d.ts +4 -0
  182. package/dist/concepts/theme/theme.records.d.ts.map +1 -0
  183. package/{src/core/theme/theme.records.ts → dist/concepts/theme/theme.records.js} +7 -7
  184. package/dist/concepts/theme/theme.records.js.map +1 -0
  185. package/{src/core/theme/theme.types.ts → dist/concepts/theme/theme.types.d.ts} +1 -1
  186. package/dist/concepts/theme/theme.types.d.ts.map +1 -0
  187. package/dist/concepts/theme/theme.types.js +2 -0
  188. package/dist/concepts/theme/theme.types.js.map +1 -0
  189. package/dist/concepts/theme/themes/base.theme.d.ts +3 -0
  190. package/dist/concepts/theme/themes/base.theme.d.ts.map +1 -0
  191. package/dist/concepts/theme/themes/base.theme.js +250 -0
  192. package/dist/concepts/theme/themes/base.theme.js.map +1 -0
  193. package/dist/concepts/theme/themes/dark.theme.d.ts +3 -0
  194. package/dist/concepts/theme/themes/dark.theme.d.ts.map +1 -0
  195. package/dist/concepts/theme/themes/dark.theme.js +38 -0
  196. package/dist/concepts/theme/themes/dark.theme.js.map +1 -0
  197. package/dist/concepts/theme/themes/light.theme.d.ts +3 -0
  198. package/dist/concepts/theme/themes/light.theme.d.ts.map +1 -0
  199. package/dist/concepts/theme/themes/light.theme.js +7 -0
  200. package/dist/concepts/theme/themes/light.theme.js.map +1 -0
  201. package/dist/concepts/theme/themes/square.theme.d.ts +3 -0
  202. package/dist/concepts/theme/themes/square.theme.d.ts.map +1 -0
  203. package/dist/concepts/theme/themes/square.theme.js +57 -0
  204. package/dist/concepts/theme/themes/square.theme.js.map +1 -0
  205. package/dist/concepts/typography/index.d.ts +4 -0
  206. package/dist/concepts/typography/index.d.ts.map +1 -0
  207. package/dist/concepts/typography/index.js +4 -0
  208. package/dist/concepts/typography/index.js.map +1 -0
  209. package/dist/concepts/typography/text.model.d.ts +17 -0
  210. package/dist/concepts/typography/text.model.d.ts.map +1 -0
  211. package/dist/concepts/typography/text.model.js +2 -0
  212. package/dist/concepts/typography/text.model.js.map +1 -0
  213. package/dist/concepts/typography/typography.records.d.ts +3 -0
  214. package/dist/concepts/typography/typography.records.d.ts.map +1 -0
  215. package/dist/concepts/typography/typography.records.js +13 -0
  216. package/dist/concepts/typography/typography.records.js.map +1 -0
  217. package/dist/concepts/typography/typography.types.d.ts +8 -0
  218. package/dist/concepts/typography/typography.types.d.ts.map +1 -0
  219. package/dist/concepts/typography/typography.types.js +2 -0
  220. package/dist/concepts/typography/typography.types.js.map +1 -0
  221. package/dist/index.d.ts +3 -0
  222. package/dist/index.d.ts.map +1 -0
  223. package/dist/index.js +3 -0
  224. package/dist/index.js.map +1 -0
  225. package/dist/utils/debounce.d.ts +2 -0
  226. package/dist/utils/debounce.d.ts.map +1 -0
  227. package/dist/utils/debounce.js +10 -0
  228. package/dist/utils/debounce.js.map +1 -0
  229. package/dist/utils/getValue.d.ts +3 -0
  230. package/dist/utils/getValue.d.ts.map +1 -0
  231. package/dist/utils/getValue.js +8 -0
  232. package/dist/utils/getValue.js.map +1 -0
  233. package/dist/utils/index.d.ts +3 -0
  234. package/dist/utils/index.d.ts.map +1 -0
  235. package/dist/utils/index.js +3 -0
  236. package/dist/utils/index.js.map +1 -0
  237. package/dist/utils/types.d.ts +5 -0
  238. package/dist/utils/types.d.ts.map +1 -0
  239. package/dist/utils/types.js +2 -0
  240. package/dist/utils/types.js.map +1 -0
  241. package/package.json +25 -39
  242. package/.editorconfig +0 -10
  243. package/.storybook/main.js +0 -13
  244. package/.storybook/preview.js +0 -24
  245. package/LICENSE +0 -201
  246. package/README.md +0 -2
  247. package/src/components/button/button.component.tsx +0 -18
  248. package/src/components/button/button.stories.tsx +0 -22
  249. package/src/components/card/card.component.tsx +0 -14
  250. package/src/core/backgrounds/background.model.ts +0 -10
  251. package/src/core/backgrounds/background.types.ts +0 -2
  252. package/src/core/color/color.helper.ts +0 -16
  253. package/src/core/color/color.model.ts +0 -42
  254. package/src/core/color/color.types.ts +0 -76
  255. package/src/core/container/container.component.tsx +0 -14
  256. package/src/core/container/container.model.ts +0 -50
  257. package/src/core/core.types.ts +0 -63
  258. package/src/core/gradients/gradiennt.helper.ts +0 -7
  259. package/src/core/gradients/gradient.model.ts +0 -7
  260. package/src/core/gradients/gradient.types.ts +0 -0
  261. package/src/core/iconography/icon.model.ts +0 -8
  262. package/src/core/iconography/icon.types.ts +0 -68
  263. package/src/core/layout/layout.types.ts +0 -5
  264. package/src/core/masking/masking.model.ts +0 -7
  265. package/src/core/shadow/shadow.types.ts +0 -9
  266. package/src/core/theme/theme.context.tsx +0 -10
  267. package/src/core/theme/theme.hook.tsx +0 -18
  268. package/src/core/theme/theme.model.ts +0 -12
  269. package/src/core/theme/theme.provider.tsx +0 -56
  270. package/src/core/theme/themes/dark.theme.ts +0 -9
  271. package/src/core/theme/themes/light.theme.ts +0 -13
  272. package/src/core/typography/typography.types.ts +0 -10
  273. package/src/stories/Button.stories.tsx +0 -54
  274. package/src/stories/Button.tsx +0 -48
  275. package/src/stories/Header.stories.tsx +0 -25
  276. package/src/stories/Header.tsx +0 -56
  277. package/src/stories/Introduction.stories.mdx +0 -211
  278. package/src/stories/Page.stories.tsx +0 -26
  279. package/src/stories/Page.tsx +0 -73
  280. package/src/stories/assets/code-brackets.svg +0 -1
  281. package/src/stories/assets/colors.svg +0 -1
  282. package/src/stories/assets/comments.svg +0 -1
  283. package/src/stories/assets/direction.svg +0 -1
  284. package/src/stories/assets/flow.svg +0 -1
  285. package/src/stories/assets/plugin.svg +0 -1
  286. package/src/stories/assets/repo.svg +0 -1
  287. package/src/stories/assets/stackalt.svg +0 -1
  288. package/src/stories/button.css +0 -30
  289. package/src/stories/header.css +0 -32
  290. package/src/stories/page.css +0 -69
  291. package/tsconfig.json +0 -19
@@ -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
- ;
@@ -1,7 +0,0 @@
1
- import { IGradient } from './gradient.model';
2
-
3
-
4
-
5
- export function gradient(config: IGradient): string {
6
- return ``;
7
- }
@@ -1,7 +0,0 @@
1
- import { IColor } from '../color/color.model';
2
-
3
- export interface IGradient {
4
- defaultColor: IColor;
5
- degee: number,
6
- colors: Record<string, IColor>
7
- }
File without changes
@@ -1,8 +0,0 @@
1
- import { IColor } from '../color/color.model';
2
- import { IMasking } from '../masking/masking.model';
3
-
4
- export interface Icon {
5
- background: IColor;
6
- foreground: IColor;
7
- mask: IMasking;
8
- }
@@ -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,5 +0,0 @@
1
- import { Size } from '../core.types';
2
-
3
- export type elements = 'margin' | 'border' | 'padding';
4
-
5
- export const spacings: Record<Size, number> = { xs: 5, sm: 8, md: 13, lg: 21, xl: 34 };
@@ -1,7 +0,0 @@
1
- import { IColor } from '../color/color.model';
2
- import { MaskingShape } from './masking.types';
3
-
4
- export interface IMasking {
5
- background: IColor;
6
- shape: MaskingShape;
7
- }
@@ -1,9 +0,0 @@
1
- export type ShadowStyle =
2
- | 'Flat'
3
- | 'Raised'
4
- | 'Focussed'
5
- | 'Pressed'
6
- | 'Modal'
7
- | 'Navigation'
8
- | 'Drawer'
9
- ;
@@ -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,12 +0,0 @@
1
-
2
- export interface ThemeProps {
3
- themeId?: string;
4
- themes?: Record<string, ThemeModel>;
5
- setTheme?: any;
6
- }
7
-
8
- export interface ThemeModel {
9
- name: string;
10
- id: string;
11
- colors: Record<string, string>;
12
- }
@@ -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,9 +0,0 @@
1
- import { ThemeModel } from '../theme.model';
2
-
3
- export const DarkTheme: ThemeModel = {
4
- id: 'DarkTheme',
5
- name: 'Dark Theme',
6
- colors: {
7
-
8
- }
9
- }
@@ -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
- };
@@ -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 = {};
@@ -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
- );