@ndlib/component-library 1.0.20 → 1.0.22

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 (259) hide show
  1. package/README.md +26 -8
  2. package/dist/assets/index-3cfb730f.js +1 -0
  3. package/dist/components/composites/Card/Card.stories.js +2 -0
  4. package/dist/components/composites/Card/index.js +4 -3
  5. package/dist/components/composites/CardV2/CardV2.module.css +74 -0
  6. package/dist/components/composites/CardV2/CardV2.stories.d.ts +19 -0
  7. package/dist/components/composites/CardV2/CardV2.stories.js +187 -0
  8. package/dist/components/composites/CardV2/CardV2.test.js +67 -0
  9. package/dist/components/composites/CardV2/index.d.ts +42 -0
  10. package/dist/components/composites/CardV2/index.js +97 -0
  11. package/dist/components/composites/DragDropList/DragDropList.stories.js +3 -1
  12. package/dist/components/composites/DropdownLinks/DropdownLinks.stories.js +2 -0
  13. package/dist/components/composites/DropdownLinks/index.d.ts +1 -1
  14. package/dist/components/composites/EmptyState/EmptyState.stories.js +2 -0
  15. package/dist/components/composites/EmptyState/index.js +1 -1
  16. package/dist/components/composites/Modal/Modal.stories.js +5 -2
  17. package/dist/components/composites/Modal/index.js +3 -2
  18. package/dist/components/composites/ModalV2/ModalV2.stories.d.ts +6 -0
  19. package/dist/components/composites/ModalV2/ModalV2.stories.js +41 -0
  20. package/dist/components/composites/ModalV2/ModalV2.test.js +37 -0
  21. package/dist/components/composites/ModalV2/index.d.ts +20 -0
  22. package/dist/components/composites/ModalV2/index.js +65 -0
  23. package/dist/components/composites/NavMenu/NavMenu.stories.js +2 -0
  24. package/dist/components/composites/NavMenu/index.js +1 -1
  25. package/dist/components/composites/Seo/seo.stories.js +2 -0
  26. package/dist/components/composites/SnackBar/SnackBar.stories.js +2 -0
  27. package/dist/components/composites/StructuredData/StructuredData.stories.js +2 -0
  28. package/dist/components/elements/Alerts/Alert.stories.js +2 -0
  29. package/dist/components/elements/Alerts/Alerts.stories.js +2 -0
  30. package/dist/components/elements/Alerts/index.js +2 -1
  31. package/dist/components/elements/ArrowLink/ArrowLink.stories.js +2 -0
  32. package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/AutoComplete.stories.js +6 -4
  33. package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/AutoComplete.test.js +1 -1
  34. package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/index.js +3 -3
  35. package/dist/components/elements/BrandingBar/BrandingBar.stories.js +2 -0
  36. package/dist/components/elements/Button/Button.stories.js +4 -2
  37. package/dist/components/elements/ButtonV2/ButtonV2.module.css +25 -0
  38. package/dist/components/elements/ButtonV2/ButtonV2.stories.d.ts +15 -0
  39. package/dist/components/elements/ButtonV2/ButtonV2.stories.js +90 -0
  40. package/dist/components/elements/ButtonV2/ButtonV2.test.js +45 -0
  41. package/dist/components/elements/ButtonV2/index.d.ts +49 -0
  42. package/dist/components/elements/ButtonV2/index.js +136 -0
  43. package/dist/components/elements/{Fields/Checkbox → Checkbox}/Checkbox.stories.js +3 -1
  44. package/dist/components/elements/{Fields/Checkbox → Checkbox}/Checkbox.test.js +1 -1
  45. package/dist/components/elements/{Fields/Checkbox → Checkbox}/index.d.ts +1 -1
  46. package/dist/components/elements/{Fields/Checkbox → Checkbox}/index.js +2 -2
  47. package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/CheckboxGroup.stories.js +3 -1
  48. package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/CheckboxGroup.test.js +1 -1
  49. package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/index.d.ts +1 -1
  50. package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/index.js +7 -7
  51. package/dist/components/elements/CheckboxGroupV2/CheckboxGroupV2.stories.d.ts +8 -0
  52. package/dist/components/elements/CheckboxGroupV2/CheckboxGroupV2.stories.js +31 -0
  53. package/dist/components/elements/CheckboxGroupV2/CheckboxGroupV2.test.js +34 -0
  54. package/dist/components/elements/CheckboxGroupV2/index.d.ts +17 -0
  55. package/dist/components/elements/CheckboxGroupV2/index.js +50 -0
  56. package/dist/components/elements/CheckboxV2/CheckboxV2.module.css +5 -0
  57. package/dist/components/elements/CheckboxV2/CheckboxV2.stories.d.ts +6 -0
  58. package/dist/components/elements/CheckboxV2/CheckboxV2.stories.js +19 -0
  59. package/dist/components/elements/CheckboxV2/CheckboxV2.test.js +35 -0
  60. package/dist/components/elements/CheckboxV2/index.d.ts +9 -0
  61. package/dist/components/elements/CheckboxV2/index.js +22 -0
  62. package/dist/components/elements/{Fields/DatePicker → DatePicker}/DatePicker.stories.js +3 -1
  63. package/dist/components/elements/{Fields/DatePicker → DatePicker}/DatePicker.test.js +1 -1
  64. package/dist/components/elements/{Fields/DatePicker → DatePicker}/index.d.ts +1 -1
  65. package/dist/components/elements/{Fields/DatePicker → DatePicker}/index.js +2 -2
  66. package/dist/components/elements/Dropdown/Dropdown.stories.js +3 -1
  67. package/dist/components/elements/Dropdown/index.js +1 -1
  68. package/dist/components/elements/GroupV2/index.d.ts +22 -0
  69. package/dist/components/elements/GroupV2/index.js +71 -0
  70. package/dist/components/elements/{text/Heading → Heading}/Heading.stories.js +5 -3
  71. package/dist/components/elements/{text/Heading → Heading}/Heading.test.js +3 -3
  72. package/dist/components/elements/{text/Heading → Heading}/index.d.ts +3 -3
  73. package/dist/components/elements/{text/Heading → Heading}/index.js +10 -9
  74. package/dist/components/elements/HeadingV2/HeadingV2.module.css +8 -0
  75. package/dist/components/elements/HeadingV2/HeadingV2.stories.d.ts +8 -0
  76. package/dist/components/elements/HeadingV2/HeadingV2.stories.js +37 -0
  77. package/dist/components/elements/HeadingV2/HeadingV2.test.js +51 -0
  78. package/dist/components/elements/HeadingV2/index.d.ts +22 -0
  79. package/dist/components/elements/HeadingV2/index.js +100 -0
  80. package/dist/components/elements/Icon/Icon.stories.js +3 -1
  81. package/dist/components/elements/IconV2/IconV2.module.css +10 -0
  82. package/dist/components/elements/IconV2/IconV2.stories.d.ts +7 -0
  83. package/dist/components/elements/IconV2/IconV2.stories.js +31 -0
  84. package/dist/components/elements/IconV2/IconV2.test.js +62 -0
  85. package/dist/components/elements/IconV2/index.d.ts +10 -0
  86. package/dist/components/elements/IconV2/index.js +33 -0
  87. package/dist/components/elements/{text/Inline → Inline}/Inline.stories.js +2 -0
  88. package/dist/components/elements/{text/Inline → Inline}/index.d.ts +1 -1
  89. package/dist/components/elements/{text/Inline → Inline}/index.js +1 -1
  90. package/dist/components/elements/{text/Label → Label}/Label.stories.js +4 -2
  91. package/dist/components/elements/Label/Label.test.d.ts +1 -0
  92. package/dist/components/elements/{text/Label → Label}/Label.test.js +3 -3
  93. package/dist/components/elements/{text/Label → Label}/index.d.ts +2 -2
  94. package/dist/components/elements/{text/Label → Label}/index.js +3 -3
  95. package/dist/components/elements/LabelV2/LabelV2.stories.d.ts +6 -0
  96. package/dist/components/elements/LabelV2/LabelV2.stories.js +22 -0
  97. package/dist/components/elements/LabelV2/LabelV2.test.d.ts +1 -0
  98. package/dist/components/elements/LabelV2/LabelV2.test.js +56 -0
  99. package/dist/components/elements/LabelV2/index.d.ts +20 -0
  100. package/dist/components/elements/LabelV2/index.js +41 -0
  101. package/dist/components/elements/Link/Link.stories.js +3 -1
  102. package/dist/components/elements/List/List.stories.js +3 -1
  103. package/dist/components/elements/List/index.js +1 -1
  104. package/dist/components/elements/ListBox/Listbox.stories.js +2 -0
  105. package/dist/components/elements/ListBox/index.d.ts +1 -1
  106. package/dist/components/elements/ListBox/index.js +1 -1
  107. package/dist/components/elements/ListBoxV2/ListBoxV2.module.css +33 -0
  108. package/dist/components/elements/ListBoxV2/ListBoxV2.stories.d.ts +6 -0
  109. package/dist/components/elements/ListBoxV2/ListBoxV2.stories.js +19 -0
  110. package/dist/components/elements/ListBoxV2/index.d.ts +33 -0
  111. package/dist/components/elements/ListBoxV2/index.js +35 -0
  112. package/dist/components/elements/Markdown/Markdown.stories.js +2 -0
  113. package/dist/components/elements/Markdown/index.js +4 -4
  114. package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/MonthPicker.stories.js +3 -1
  115. package/dist/components/elements/MonthPicker/MonthPicker.test.d.ts +1 -0
  116. package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/MonthPicker.test.js +1 -1
  117. package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/index.d.ts +1 -1
  118. package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/index.js +2 -2
  119. package/dist/components/elements/{text/Paragraph → Paragraph}/Paragraph.stories.js +5 -3
  120. package/dist/components/elements/Paragraph/Paragraph.test.d.ts +1 -0
  121. package/dist/components/elements/{text/Paragraph → Paragraph}/Paragraph.test.js +1 -1
  122. package/dist/components/elements/{text/Paragraph → Paragraph}/index.d.ts +2 -2
  123. package/dist/components/elements/{text/Paragraph → Paragraph}/index.js +6 -5
  124. package/dist/components/elements/ParagraphV2/ParagraphV2.stories.d.ts +7 -0
  125. package/dist/components/elements/ParagraphV2/ParagraphV2.stories.js +33 -0
  126. package/dist/components/elements/ParagraphV2/ParagraphV2.test.d.ts +1 -0
  127. package/dist/components/elements/ParagraphV2/ParagraphV2.test.js +9 -0
  128. package/dist/components/elements/ParagraphV2/index.d.ts +15 -0
  129. package/dist/components/elements/ParagraphV2/index.js +39 -0
  130. package/dist/components/elements/Pill/Pill.stories.js +3 -1
  131. package/dist/components/elements/Pill/index.js +2 -1
  132. package/dist/components/elements/{Fields/Radio → Radio}/Radio.stories.js +3 -1
  133. package/dist/components/elements/Radio/Radio.test.d.ts +1 -0
  134. package/dist/components/elements/{Fields/Radio → Radio}/Radio.test.js +3 -3
  135. package/dist/components/elements/{Fields/Radio → Radio}/index.d.ts +1 -1
  136. package/dist/components/elements/{Fields/Radio → Radio}/index.js +1 -1
  137. package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/RadioGroup.stories.js +3 -1
  138. package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/RadioGroup.test.js +1 -1
  139. package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/index.d.ts +1 -1
  140. package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/index.js +6 -6
  141. package/dist/components/elements/{text/ReadMore → ReadMore}/ReadMore.stories.js +5 -3
  142. package/dist/components/elements/ReadMore/ReadMore.test.d.ts +1 -0
  143. package/dist/components/elements/{text/ReadMore → ReadMore}/ReadMore.test.js +4 -9
  144. package/dist/components/elements/{text/ReadMore → ReadMore}/index.d.ts +2 -2
  145. package/dist/components/elements/{text/ReadMore → ReadMore}/index.js +10 -9
  146. package/dist/components/elements/ReadMoreV2/ReadMoreV2.module.css +19 -0
  147. package/dist/components/elements/ReadMoreV2/ReadMoreV2.stories.d.ts +8 -0
  148. package/dist/components/elements/ReadMoreV2/ReadMoreV2.stories.js +28 -0
  149. package/dist/components/elements/ReadMoreV2/ReadMoreV2.test.d.ts +1 -0
  150. package/dist/components/elements/ReadMoreV2/ReadMoreV2.test.js +30 -0
  151. package/dist/components/elements/ReadMoreV2/index.d.ts +12 -0
  152. package/dist/components/elements/ReadMoreV2/index.js +81 -0
  153. package/dist/components/elements/{Fields/Select → Select}/Select.stories.js +6 -4
  154. package/dist/components/elements/Select/Select.test.d.ts +1 -0
  155. package/dist/components/elements/{Fields/Select → Select}/Select.test.js +1 -1
  156. package/dist/components/elements/{Fields/Select → Select}/index.d.ts +1 -1
  157. package/dist/components/elements/{Fields/Select → Select}/index.js +9 -9
  158. package/dist/components/elements/SelectV2/SelectV2.module.css +27 -0
  159. package/dist/components/elements/SelectV2/SelectV2.stories.d.ts +8 -0
  160. package/dist/components/elements/SelectV2/SelectV2.stories.js +41 -0
  161. package/dist/components/elements/SelectV2/SelectV2.test.d.ts +1 -0
  162. package/dist/components/elements/SelectV2/SelectV2.test.js +52 -0
  163. package/dist/components/elements/SelectV2/index.d.ts +18 -0
  164. package/dist/components/elements/SelectV2/index.js +164 -0
  165. package/dist/components/elements/Spinner/Spinner.stories.js +2 -0
  166. package/dist/components/elements/Spinner/index.js +1 -1
  167. package/dist/components/elements/SpinnerV2/SpinnerV2.module.css +12 -0
  168. package/dist/components/elements/SpinnerV2/SpinnerV2.stories.d.ts +7 -0
  169. package/dist/components/elements/SpinnerV2/SpinnerV2.stories.js +29 -0
  170. package/dist/components/elements/SpinnerV2/SpinnerV2.test.d.ts +1 -0
  171. package/dist/components/elements/SpinnerV2/SpinnerV2.test.js +9 -0
  172. package/dist/components/elements/SpinnerV2/index.d.ts +14 -0
  173. package/dist/components/elements/SpinnerV2/index.js +35 -0
  174. package/dist/components/elements/TabList/TabList.stories.js +2 -0
  175. package/dist/components/elements/Table/Table.stories.js +2 -0
  176. package/dist/components/elements/{Fields/TextInput → TextInput}/TextInput.stories.js +6 -4
  177. package/dist/components/elements/TextInput/TextInput.test.d.ts +1 -0
  178. package/dist/components/elements/{Fields/TextInput → TextInput}/TextInput.test.js +2 -2
  179. package/dist/components/elements/{Fields/TextInput → TextInput}/index.d.ts +3 -3
  180. package/dist/components/elements/{Fields/TextInput → TextInput}/index.js +9 -8
  181. package/dist/components/elements/TextInputV2/TextInputV2.module.css +71 -0
  182. package/dist/components/elements/TextInputV2/TextInputV2.stories.d.ts +9 -0
  183. package/dist/components/elements/TextInputV2/TextInputV2.stories.js +37 -0
  184. package/dist/components/elements/TextInputV2/TextInputV2.test.d.ts +1 -0
  185. package/dist/components/elements/TextInputV2/TextInputV2.test.js +59 -0
  186. package/dist/components/elements/TextInputV2/index.d.ts +45 -0
  187. package/dist/components/elements/TextInputV2/index.js +97 -0
  188. package/dist/components/elements/layout/Box.stories.js +2 -0
  189. package/dist/components/elements/layout/Flex.stories.js +3 -1
  190. package/dist/components/elements/layoutV2/BoxV2.d.ts +9 -0
  191. package/dist/components/elements/layoutV2/BoxV2.js +19 -0
  192. package/dist/components/elements/layoutV2/BoxV2.stories.d.ts +6 -0
  193. package/dist/components/elements/layoutV2/BoxV2.stories.js +14 -0
  194. package/dist/components/elements/layoutV2/ColumnV2.d.ts +8 -0
  195. package/dist/components/elements/layoutV2/ColumnV2.js +21 -0
  196. package/dist/components/elements/layoutV2/RowV2.d.ts +19 -0
  197. package/dist/components/elements/layoutV2/RowV2.js +54 -0
  198. package/dist/components/providers/alerts.js +5 -4
  199. package/dist/components/providers/alerts.test.d.ts +1 -0
  200. package/dist/components/providers/alerts.test.js +115 -0
  201. package/dist/components/providers/componentConfigV2.d.ts +25 -0
  202. package/dist/components/providers/componentConfigV2.js +37 -0
  203. package/dist/components/providers/media.js +1 -1
  204. package/dist/components/providers/mediaV2.d.ts +11 -0
  205. package/dist/components/providers/mediaV2.js +48 -0
  206. package/dist/components/providers/uiV2.d.ts +20 -0
  207. package/dist/components/providers/uiV2.js +16 -0
  208. package/dist/index.d.ts +34 -14
  209. package/dist/index.html +14 -0
  210. package/dist/index.js +33 -13
  211. package/dist/theme/Color.stories.js +3 -1
  212. package/dist/theme/GlobalStylesV2.d.ts +2 -0
  213. package/dist/theme/GlobalStylesV2.js +212 -0
  214. package/dist/theme/Typography.stories.js +3 -1
  215. package/dist/theme/css-variables.css +57 -0
  216. package/dist/theme/index.d.ts +127 -1
  217. package/dist/theme/index.js +14 -0
  218. package/dist/theme/typography.js +2 -2
  219. package/dist/utils/decorators/UIVersion1.d.ts +2 -0
  220. package/dist/utils/decorators/UIVersion1.js +7 -0
  221. package/dist/utils/decorators/UIVersion2.d.ts +2 -0
  222. package/dist/utils/decorators/UIVersion2.js +7 -0
  223. package/dist/utils/hooks/useFocus.d.ts +7 -0
  224. package/dist/utils/hooks/useFocus.js +12 -0
  225. package/dist/utils/processSx.d.ts +3 -0
  226. package/dist/utils/processSx.js +135 -0
  227. package/package.json +7 -4
  228. /package/dist/components/{elements/Fields/Checkbox/Checkbox.test.d.ts → composites/CardV2/CardV2.test.d.ts} +0 -0
  229. /package/dist/components/{elements/Fields/CheckboxGroup/CheckboxGroup.test.d.ts → composites/ModalV2/ModalV2.test.d.ts} +0 -0
  230. /package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/AutoComplete.stories.d.ts +0 -0
  231. /package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/AutoComplete.test.d.ts +0 -0
  232. /package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/index.d.ts +0 -0
  233. /package/dist/components/elements/{Fields/DatePicker/DatePicker.test.d.ts → ButtonV2/ButtonV2.test.d.ts} +0 -0
  234. /package/dist/components/elements/{text/Caption → Caption}/index.d.ts +0 -0
  235. /package/dist/components/elements/{text/Caption → Caption}/index.js +0 -0
  236. /package/dist/components/elements/{Fields/Checkbox → Checkbox}/Checkbox.stories.d.ts +0 -0
  237. /package/dist/components/elements/{Fields/MonthPicker/MonthPicker.test.d.ts → Checkbox/Checkbox.test.d.ts} +0 -0
  238. /package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/CheckboxGroup.stories.d.ts +0 -0
  239. /package/dist/components/elements/{Fields/Radio/Radio.test.d.ts → CheckboxGroup/CheckboxGroup.test.d.ts} +0 -0
  240. /package/dist/components/elements/{Fields/Select/Select.test.d.ts → CheckboxGroupV2/CheckboxGroupV2.test.d.ts} +0 -0
  241. /package/dist/components/elements/{text/Heading/Heading.test.d.ts → CheckboxV2/CheckboxV2.test.d.ts} +0 -0
  242. /package/dist/components/elements/{Fields/DatePicker → DatePicker}/DatePicker.stories.d.ts +0 -0
  243. /package/dist/components/elements/{text/Label/Label.test.d.ts → DatePicker/DatePicker.test.d.ts} +0 -0
  244. /package/dist/components/elements/{text/Heading → Heading}/Heading.stories.d.ts +0 -0
  245. /package/dist/components/elements/{text/Paragraph/Paragraph.test.d.ts → Heading/Heading.test.d.ts} +0 -0
  246. /package/dist/components/elements/{text/ReadMore/ReadMore.test.d.ts → HeadingV2/HeadingV2.test.d.ts} +0 -0
  247. /package/dist/components/elements/{Fields/RadioGroup/RadioGroup.test.d.ts → IconV2/IconV2.test.d.ts} +0 -0
  248. /package/dist/components/elements/{text/Inline → Inline}/Inline.stories.d.ts +0 -0
  249. /package/dist/components/elements/{text/Label → Label}/Label.stories.d.ts +0 -0
  250. /package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/MonthPicker.stories.d.ts +0 -0
  251. /package/dist/components/elements/{text/Paragraph → Paragraph}/Paragraph.stories.d.ts +0 -0
  252. /package/dist/components/elements/{Fields/Radio → Radio}/Radio.stories.d.ts +0 -0
  253. /package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/RadioGroup.stories.d.ts +0 -0
  254. /package/dist/components/elements/{Fields/TextInput/TextInput.test.d.ts → RadioGroup/RadioGroup.test.d.ts} +0 -0
  255. /package/dist/components/elements/{text/ReadMore → ReadMore}/ReadMore.stories.d.ts +0 -0
  256. /package/dist/components/elements/{Fields/Select → Select}/Select.stories.d.ts +0 -0
  257. /package/dist/components/elements/{Fields/TextInput → TextInput}/TextInput.stories.d.ts +0 -0
  258. /package/dist/components/elements/{Fields/option.d.ts → option.d.ts} +0 -0
  259. /package/dist/components/elements/{Fields/option.js → option.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { PropsWithChildren, CSSProperties } from 'react';
2
2
  import { ThemeUICSSObject } from 'theme-ui';
3
3
  import { FONT, FONT_SIZE, FONT_WEIGHT, LINE_HEIGHT } from './typography';
4
4
  import { COLOR } from './colors';
@@ -104,6 +104,95 @@ export declare const theme: {
104
104
  };
105
105
  };
106
106
  export type Theme = typeof theme;
107
+ export declare const themeV2: {
108
+ colors: {
109
+ text: string;
110
+ lightText: string;
111
+ background: string;
112
+ transparent: string;
113
+ primary: string;
114
+ textOnPrimary: string;
115
+ primaryHighlight: string;
116
+ secondary: string;
117
+ textOnSecondary: string;
118
+ secondaryHighlight: string;
119
+ white: string;
120
+ warmWhite: string;
121
+ warmWhiteDark: string;
122
+ black: string;
123
+ darkGray: string;
124
+ gray: string;
125
+ lightGray: string;
126
+ extraLightGray: string;
127
+ extraExtraLightGray: string;
128
+ ndTertiary1: string;
129
+ ndBlue: string;
130
+ ndBlueDark: string;
131
+ ndBlueLight: string;
132
+ ndBlueBright: string;
133
+ ndGold: string;
134
+ ndGoldLight: string;
135
+ ndGoldDark: string;
136
+ ndGreem: string;
137
+ ndGreenLight: string;
138
+ ndSkyBlue: string;
139
+ ndSkyBlueDark: string;
140
+ ndSkyBlueLight: string;
141
+ ndMetallicGold: string;
142
+ ndMetallicGoldLight: string;
143
+ ndProvostBlue: string;
144
+ ndSecondary1: string;
145
+ ndSecondary2: string;
146
+ ndSecondary3: string;
147
+ ndSecondary4: string;
148
+ ndSecondary5: string;
149
+ ndSecondary6: string;
150
+ ndTertiary2: string;
151
+ ndTertiary3: string;
152
+ ndTertiary4: string;
153
+ ndTertiary5: string;
154
+ ndTertiary6: string;
155
+ alertInformationalBg: string;
156
+ alertInformationalBorder: string;
157
+ alertInformationalYellowBg: string;
158
+ alertInformationalYellowBorder: string;
159
+ alertWarningBg: string;
160
+ alertWarningBorder: string;
161
+ alertSuccessBg: string;
162
+ };
163
+ space: string[];
164
+ boxShadow: typeof BOX_SHADOW;
165
+ breakpoints: string[];
166
+ zIndex: typeof Z_INDEX;
167
+ fonts: {
168
+ branded: string;
169
+ branded2: string;
170
+ serif: string;
171
+ normal: string;
172
+ };
173
+ fontSizes: {
174
+ xxs: string;
175
+ xs: string;
176
+ sm: string;
177
+ ms: string;
178
+ md: string;
179
+ ml: string;
180
+ lg: string;
181
+ xl: string;
182
+ xxl: string;
183
+ };
184
+ lineHeights: {
185
+ normal: number;
186
+ condensed: number;
187
+ extraCondensed: number;
188
+ };
189
+ fontWeights: {
190
+ normal: number;
191
+ heading: number;
192
+ bold: number;
193
+ };
194
+ };
195
+ export type ThemeV2 = typeof themeV2;
107
196
  export type StylesProp = Omit<ThemeUICSSObject, 'color' | 'bg' | 'borderColor' | 'fontSize' | 'font' | 'fontWeight' | 'lineHeight' | 'boxShadow'> & {
108
197
  color?: COLOR | COLOR[];
109
198
  bg?: COLOR | COLOR[];
@@ -114,12 +203,46 @@ export type StylesProp = Omit<ThemeUICSSObject, 'color' | 'bg' | 'borderColor' |
114
203
  lineHeight?: LINE_HEIGHT | number | (LINE_HEIGHT | number)[];
115
204
  boxShadow?: BOX_SHADOW | BOX_SHADOW[];
116
205
  };
206
+ type ShorthandProperties = {
207
+ p?: CSSProperties['padding'] | CSSProperties['padding'][];
208
+ pt?: CSSProperties['paddingTop'] | CSSProperties['paddingTop'][];
209
+ pr?: CSSProperties['paddingRight'] | CSSProperties['paddingRight'][];
210
+ pb?: CSSProperties['paddingBottom'] | CSSProperties['paddingBottom'][];
211
+ pl?: CSSProperties['paddingLeft'] | CSSProperties['paddingLeft'][];
212
+ px?: CSSProperties['paddingLeft'] | CSSProperties['paddingLeft'][];
213
+ py?: CSSProperties['paddingTop'] | CSSProperties['paddingTop'][];
214
+ m?: CSSProperties['margin'] | CSSProperties['margin'][];
215
+ mt?: CSSProperties['marginTop'] | CSSProperties['marginTop'][];
216
+ mr?: CSSProperties['marginRight'] | CSSProperties['marginRight'][];
217
+ mb?: CSSProperties['marginBottom'] | CSSProperties['marginBottom'][];
218
+ ml?: CSSProperties['marginLeft'] | CSSProperties['marginLeft'][];
219
+ mx?: CSSProperties['marginLeft'] | CSSProperties['marginLeft'][];
220
+ my?: CSSProperties['marginTop'] | CSSProperties['marginTop'][];
221
+ bg?: COLOR | string | COLOR[];
222
+ flexDirection?: string | string[];
223
+ };
224
+ export type StylesPropV2 = Omit<CSSProperties, 'color' | 'backgroundColor' | 'borderColor' | 'fontSize' | 'fontFamily' | 'fontWeight' | 'lineHeight' | 'boxShadow' | 'flexDirection'> & ShorthandProperties & {
225
+ color?: COLOR | COLOR[];
226
+ backgroundColor?: COLOR | string | COLOR[];
227
+ borderColor?: COLOR | COLOR[];
228
+ fontSize?: FONT_SIZE | FONT_SIZE[];
229
+ fontFamily?: FONT | FONT[];
230
+ fontWeight?: FONT_WEIGHT | FONT_WEIGHT[];
231
+ lineHeight?: LINE_HEIGHT | number | (LINE_HEIGHT | number)[];
232
+ boxShadow?: BOX_SHADOW | BOX_SHADOW[];
233
+ };
117
234
  export type StyledElementProps<E extends Element, CustomProps = object, Children = React.ReactNode> = {
118
235
  sx?: StylesProp;
119
236
  children?: Children;
120
237
  } & Omit<React.HTMLAttributes<E>, 'children' | 'onChange'> & CustomProps & {
121
238
  htmlFor?: string;
122
239
  };
240
+ export type StyledElementPropsV2<E extends Element, CustomProps = object, Children = React.ReactNode> = {
241
+ sx?: StylesPropV2;
242
+ children?: Children;
243
+ } & Omit<React.HTMLAttributes<E>, 'children' | 'onChange'> & CustomProps & {
244
+ htmlFor?: string;
245
+ };
123
246
  export declare const useTheme: () => {
124
247
  colors: {
125
248
  text: string;
@@ -209,3 +332,6 @@ export declare const useTheme: () => {
209
332
  };
210
333
  };
211
334
  export declare const ThemeProvider: React.FC<PropsWithChildren>;
335
+ export declare const useThemeV2: () => ThemeV2;
336
+ export declare const ThemeProviderV2: React.FC<PropsWithChildren>;
337
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo, } from 'react';
2
3
  import { ThemeUIProvider, useThemeUI } from 'theme-ui';
3
4
  import { fontStyles, } from './typography';
4
5
  import { colors } from './colors';
@@ -28,6 +29,7 @@ export const SPACING = [
28
29
  '4rem',
29
30
  ];
30
31
  export const theme = Object.assign(Object.assign({}, fontStyles), { colors, space: SPACING, boxShadow: BOX_SHADOW, breakpoints: BREAKPOINTS, zIndex: Z_INDEX });
32
+ export const themeV2 = Object.assign(Object.assign({}, fontStyles), { colors, space: SPACING, boxShadow: BOX_SHADOW, breakpoints: BREAKPOINTS, zIndex: Z_INDEX });
31
33
  export const useTheme = () => {
32
34
  const { theme } = useThemeUI();
33
35
  return theme;
@@ -35,3 +37,15 @@ export const useTheme = () => {
35
37
  export const ThemeProvider = ({ children }) => {
36
38
  return _jsx(ThemeUIProvider, Object.assign({ theme: theme }, { children: children }));
37
39
  };
40
+ const ThemeV2Context = createContext(themeV2);
41
+ export const useThemeV2 = () => {
42
+ const context = useContext(ThemeV2Context);
43
+ if (!context) {
44
+ throw new Error('useThemeV2 must be used within a ThemeProviderV2');
45
+ }
46
+ return context;
47
+ };
48
+ export const ThemeProviderV2 = ({ children }) => {
49
+ const value = useMemo(() => themeV2, []);
50
+ return (_jsx(ThemeV2Context.Provider, Object.assign({ value: value }, { children: children })));
51
+ };
@@ -57,8 +57,8 @@ export const fontStyles = {
57
57
  fonts: {
58
58
  [FONT.BRANDED]: 'GPMed, sans-serif',
59
59
  [FONT.BRANDED2]: 'GPCMed, sans-serif',
60
- [FONT.SERIF]: '"Sumana", Georgia, "Times New Roman", Times, serif;',
61
- [FONT.NORMAL]: '"Libre Franklin", "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;',
60
+ [FONT.SERIF]: '"Sumana", Georgia, "Times New Roman", Times, serif',
61
+ [FONT.NORMAL]: '"Libre Franklin", "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif',
62
62
  },
63
63
  fontSizes: fontSizeMap,
64
64
  lineHeights: {
@@ -0,0 +1,2 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ export declare const UIVersion1: (Story: StoryFn) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FontLoader } from '../../FontLoader';
3
+ import { GlobalStyles } from '../../theme/GlobalStyles';
4
+ import { UiProvider } from '../../components/providers/ui';
5
+ export const UIVersion1 = (Story) => {
6
+ return (_jsxs(UiProvider, { children: [_jsx(GlobalStyles, {}), _jsx(FontLoader, {}), _jsx(Story, {})] }));
7
+ };
@@ -0,0 +1,2 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ export declare const UIVersion2: (Story: StoryFn) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FontLoader } from '../../FontLoader';
3
+ import { GlobalStylesV2 } from '../../theme/GlobalStylesV2';
4
+ import { UiProviderV2 } from '../../components/providers/uiV2';
5
+ export const UIVersion2 = (Story) => {
6
+ return (_jsxs(UiProviderV2, { children: [_jsx(GlobalStylesV2, {}), _jsx(FontLoader, {}), _jsx(Story, {})] }));
7
+ };
@@ -0,0 +1,7 @@
1
+ export declare const useFocus: () => {
2
+ isFocused: boolean;
3
+ anchorElementProps: {
4
+ onFocus: () => void;
5
+ onBlur: () => void;
6
+ };
7
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export const useFocus = () => {
3
+ const [isFocused, setIsFocused] = React.useState(false);
4
+ const anchorElementProps = {
5
+ onFocus: () => setIsFocused(true),
6
+ onBlur: () => setIsFocused(false),
7
+ };
8
+ return {
9
+ isFocused,
10
+ anchorElementProps,
11
+ };
12
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+ import { StylesPropV2 } from '../theme';
3
+ export declare const processSx: (sx: StylesPropV2 | undefined) => CSSProperties & Record<string, any>;
@@ -0,0 +1,135 @@
1
+ import { colors, COLOR } from '../theme/colors';
2
+ import { fontStyles, FONT, FONT_SIZE, TYPOGRAPHY_TYPE, FONT_WEIGHT, LINE_HEIGHT, } from '../theme/typography';
3
+ import { getTypographyStyles } from '../theme/typography';
4
+ const breakpoints = {
5
+ xs: '576px',
6
+ sm: '768px',
7
+ md: '992px',
8
+ lg: '1200px',
9
+ xl: '1400px',
10
+ };
11
+ const resolveMappedValue = (key, value) => {
12
+ if (Object.values(COLOR).includes(value)) {
13
+ return colors[value];
14
+ }
15
+ if (key === 'fontFamily' && Object.values(FONT).includes(value)) {
16
+ return fontStyles.fonts[value];
17
+ }
18
+ if (Object.values(FONT_SIZE).includes(value)) {
19
+ return fontStyles.fontSizes[value];
20
+ }
21
+ if (key === 'fontWeight' && Object.values(FONT_WEIGHT).includes(value)) {
22
+ return fontStyles.fontWeights[value];
23
+ }
24
+ if (key === 'lineHeight' && Object.values(LINE_HEIGHT).includes(value)) {
25
+ return fontStyles.lineHeights[value];
26
+ }
27
+ if (Object.values(TYPOGRAPHY_TYPE).includes(value)) {
28
+ return getTypographyStyles(value);
29
+ }
30
+ return value;
31
+ };
32
+ const scaleRemValue = (value) => {
33
+ return `${value * 0.25}rem`;
34
+ };
35
+ const expandShorthandProperties = (key, value) => {
36
+ const expanded = {};
37
+ const scaledValue = typeof value === 'number' ? scaleRemValue(value) : value;
38
+ switch (key) {
39
+ case 'p':
40
+ expanded.padding = scaledValue;
41
+ break;
42
+ case 'pt':
43
+ expanded.paddingTop = scaledValue;
44
+ break;
45
+ case 'pb':
46
+ expanded.paddingBottom = scaledValue;
47
+ break;
48
+ case 'pl':
49
+ expanded.paddingLeft = scaledValue;
50
+ break;
51
+ case 'pr':
52
+ expanded.paddingRight = scaledValue;
53
+ break;
54
+ case 'px':
55
+ expanded.paddingLeft = scaledValue;
56
+ expanded.paddingRight = scaledValue;
57
+ break;
58
+ case 'py':
59
+ expanded.paddingTop = scaledValue;
60
+ expanded.paddingBottom = scaledValue;
61
+ break;
62
+ case 'm':
63
+ expanded.margin = scaledValue;
64
+ break;
65
+ case 'mt':
66
+ expanded.marginTop = scaledValue;
67
+ break;
68
+ case 'mb':
69
+ expanded.marginBottom = scaledValue;
70
+ break;
71
+ case 'ml':
72
+ expanded.marginLeft = scaledValue;
73
+ break;
74
+ case 'mr':
75
+ expanded.marginRight = scaledValue;
76
+ break;
77
+ case 'mx':
78
+ expanded.marginLeft = scaledValue;
79
+ expanded.marginRight = scaledValue;
80
+ break;
81
+ case 'my':
82
+ expanded.marginTop = scaledValue;
83
+ expanded.marginBottom = scaledValue;
84
+ break;
85
+ case 'bg':
86
+ expanded.backgroundColor = value;
87
+ break;
88
+ default:
89
+ expanded[key] = value;
90
+ }
91
+ return expanded;
92
+ };
93
+ export const processSx = (sx) => {
94
+ if (!sx)
95
+ return {};
96
+ const styles = {};
97
+ for (const key in sx) {
98
+ let value = sx[key];
99
+ value = resolveMappedValue(key, value);
100
+ if (Array.isArray(value)) {
101
+ styles[key] = value[0];
102
+ if (value[1]) {
103
+ styles[`@media (min-width: ${breakpoints.xs})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.xs})`]), { [key]: value[1] });
104
+ }
105
+ if (value[2]) {
106
+ styles[`@media (min-width: ${breakpoints.sm})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.sm})`]), { [key]: value[2] });
107
+ }
108
+ if (value[3]) {
109
+ styles[`@media (min-width: ${breakpoints.md})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.md})`]), { [key]: value[3] });
110
+ }
111
+ if (value[4]) {
112
+ styles[`@media (min-width: ${breakpoints.lg})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.lg})`]), { [key]: value[4] });
113
+ }
114
+ if (value[5]) {
115
+ styles[`@media (min-width: ${breakpoints.xl})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.xl})`]), { [key]: value[5] });
116
+ }
117
+ }
118
+ else {
119
+ Object.assign(styles, expandShorthandProperties(key, value));
120
+ }
121
+ }
122
+ const flattenedStyles = {};
123
+ for (const key in styles) {
124
+ if (typeof styles[key] === 'object' && key.startsWith('@media')) {
125
+ const mediaStyles = styles[key];
126
+ for (const mediaKey in mediaStyles) {
127
+ flattenedStyles[key] = Object.assign(Object.assign({}, flattenedStyles[key]), { [mediaKey]: mediaStyles[mediaKey] });
128
+ }
129
+ }
130
+ else {
131
+ flattenedStyles[key] = styles[key];
132
+ }
133
+ }
134
+ return flattenedStyles;
135
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -22,12 +22,14 @@
22
22
  "test-build": "echo '\n\nTesting Build...' && tsc --noEmit",
23
23
  "lint": "eslint src --ext ts,tsx --report-unused-disable-directives && yarn prettier && yarn test-build",
24
24
  "lint:fix": "eslint src --ext ts,tsx --report-unused-disable-directives --fix && yarn prettify && yarn test-build",
25
- "test": "vitest",
25
+ "build:colors": "tsc --build tsconfig.colors.json",
26
+ "test": "yarn build:colors && yarn generate-css-vars && vitest",
26
27
  "prettier": "prettier --check \"src/**/*.{ts,tsx}\"",
27
28
  "prettify": "prettier --write \"src/**/*.{ts,tsx}\"",
28
- "start": "storybook dev -p 6006",
29
+ "start": "yarn generate-css-vars && storybook dev -p 6006",
30
+ "generate-css-vars": "node generate-css-vars.js",
29
31
  "build-storybook": "storybook build -o storybook && touch storybook/.nojekyll",
30
- "build": "tsc",
32
+ "build": "vite build && tsc && node move-css.js && yarn generate-css-vars",
31
33
  "debug": "echo src/**/*.tsx"
32
34
  },
33
35
  "peerDependencies": {
@@ -80,6 +82,7 @@
80
82
  "theme-ui": "^0.16.1",
81
83
  "typescript": "^5.0.2",
82
84
  "vite": "^4.5.3",
85
+ "vite-plugin-static-copy": "^2.3.0",
83
86
  "vitest": "^1.6.0"
84
87
  },
85
88
  "prettier": {