@ndlib/component-library 1.0.21 → 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 +0 -1
  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
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
3
+ import { PARAGRAPHV2_SIZE, ParagraphV2 } from '.';
4
+ import { ColumnV2 } from '../layoutV2/ColumnV2';
5
+ import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
6
+ import { COLOR } from '../../../theme/colors';
7
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
8
+ const meta = {
9
+ title: 'Elements/ParagraphV2',
10
+ component: ParagraphV2,
11
+ tags: ['autodocs'],
12
+ decorators: [UIVersion2],
13
+ };
14
+ export default meta;
15
+ const sizes = [
16
+ { size: PARAGRAPHV2_SIZE.LG, label: 'Large' },
17
+ { size: PARAGRAPHV2_SIZE.MD, label: 'Medium' },
18
+ { size: PARAGRAPHV2_SIZE.SM, label: 'Small' },
19
+ ];
20
+ const p1 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ultrices venenatis purus at porta. Etiam congue sapien leo, sed malesuada justo commodo in. Nunc consequat, massa non cursus posuere, magna eros lacinia lectus, eget lobortis mi erat ut justo. Maecenas nisi mi, mollis sed ornare vitae, pharetra sed augue. Curabitur mollis orci risus, sed imperdiet nisi aliquet et. Ut non elit nec magna rhoncus maximus sit amet ut dui. Mauris sit amet eleifend lectus. Aliquam consectetur posuere libero eu ultricies. Etiam rutrum non orci nec vulputate. Sed vel accumsan diam. Cras aliquet eros eros, sit amet pharetra eros tincidunt ut. Vestibulum est erat, eleifend dapibus eros vel, elementum vehicula risus. Etiam blandit condimentum sodales. Donec non libero in orci aliquam egestas fringilla eget purus. Suspendisse pellentesque at ligula ut accumsan.';
21
+ const p2 = 'Sed non lobortis mi, vitae dapibus arcu. Aenean at euismod arcu. Ut consectetur porttitor mattis. In eget vehicula augue. Ut at dolor posuere, tristique nisi finibus, posuere turpis. Etiam placerat, dui id lacinia volutpat, lorem turpis volutpat nisi, vel dapibus purus lorem at ante. Ut imperdiet enim nec arcu sagittis luctus.';
22
+ export const Default = {
23
+ render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.LG, underline: true, sx: { color: COLOR.PRIMARY } }, { children: size.label })), [p1, p2].map((content) => (_jsx(ParagraphV2, Object.assign({}, args, { size: size.size }, { children: content }))))] })))) })),
24
+ args: {
25
+ children: 'Heading',
26
+ },
27
+ };
28
+ export const LineClamp = {
29
+ render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.LG, underline: true, sx: { color: COLOR.PRIMARY } }, { children: size.label })), [p1, p2].map((content) => (_jsx(ParagraphV2, Object.assign({}, args, { size: size.size, clampLines: 2 }, { children: content }))))] })))) })),
30
+ args: {
31
+ children: 'Heading',
32
+ },
33
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '../../../utils/test';
3
+ import { ParagraphV2 } from '.';
4
+ describe('Paragraph', () => {
5
+ it('renders without an error', () => {
6
+ const { getByText } = render(_jsx(ParagraphV2, { children: "Foo" }));
7
+ expect(getByText('Foo')).toBeInTheDocument();
8
+ });
9
+ });
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
3
+ import { StyledElementPropsV2 } from '../../../theme';
4
+ type ParagraphV2Props = StyledElementPropsV2<HTMLSpanElement, {
5
+ size?: PARAGRAPHV2_SIZE;
6
+ typography?: TYPOGRAPHY_TYPE;
7
+ clampLines?: number;
8
+ }>;
9
+ export declare enum PARAGRAPHV2_SIZE {
10
+ SM = "sm",
11
+ MD = "md",
12
+ LG = "lg"
13
+ }
14
+ export declare const ParagraphV2: React.FC<ParagraphV2Props>;
15
+ export {};
@@ -0,0 +1,39 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { fontStyles, getTypographyStyles, TYPOGRAPHY_TYPE, } from '../../../theme/typography';
14
+ import { multiplyRemSize } from '../../../utils/misc';
15
+ import { processSx } from '../../../utils/processSx';
16
+ export var PARAGRAPHV2_SIZE;
17
+ (function (PARAGRAPHV2_SIZE) {
18
+ PARAGRAPHV2_SIZE["SM"] = "sm";
19
+ PARAGRAPHV2_SIZE["MD"] = "md";
20
+ PARAGRAPHV2_SIZE["LG"] = "lg";
21
+ })(PARAGRAPHV2_SIZE || (PARAGRAPHV2_SIZE = {}));
22
+ const SIZE_TYPOGRAPHY_MAP = {
23
+ [PARAGRAPHV2_SIZE.SM]: TYPOGRAPHY_TYPE.PARAGRAPH_SMALL,
24
+ [PARAGRAPHV2_SIZE.MD]: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM,
25
+ [PARAGRAPHV2_SIZE.LG]: TYPOGRAPHY_TYPE.PARAGRAPH_LARGE,
26
+ };
27
+ export const ParagraphV2 = (_a) => {
28
+ var { size, typography: typographyParam, sx, clampLines } = _a, rest = __rest(_a, ["size", "typography", "sx", "clampLines"]);
29
+ const typography = typographyParam || SIZE_TYPOGRAPHY_MAP[size || PARAGRAPHV2_SIZE.MD];
30
+ const typographyStyles = getTypographyStyles(typography);
31
+ const processedStyles = processSx(Object.assign(Object.assign({}, typographyStyles), sx));
32
+ const marginHeightMultiple = fontStyles.lineHeights[typographyStyles.lineHeight] * 0.7;
33
+ const fontSize = fontStyles.fontSizes[typographyStyles.fontSize];
34
+ const topMargin = multiplyRemSize({
35
+ size: fontSize,
36
+ multiple: marginHeightMultiple,
37
+ });
38
+ return (_jsx("p", Object.assign({ style: Object.assign({ display: clampLines ? '-webkit-box' : undefined, WebkitLineClamp: clampLines ? String(clampLines) : undefined, WebkitBoxOrient: 'vertical', overflow: clampLines ? 'hidden' : undefined, marginTop: topMargin }, processedStyles) }, rest)));
39
+ };
@@ -2,13 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import SearchIcon from '@mui/icons-material/Search';
3
3
  import { PILL_SIZE, PILL_TYPE, Pill } from '.';
4
4
  import { GROUP_TYPE, Group } from '../Group';
5
- import { HEADING_SIZE, Heading } from '../text/Heading';
5
+ import { HEADING_SIZE, Heading } from '../Heading';
6
6
  import { Column } from '../layout/Column';
7
7
  import { Row } from '../layout/Row';
8
+ import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
8
9
  const meta = {
9
10
  title: 'Elements/Pill',
10
11
  component: Pill,
11
12
  tags: ['autodocs'],
13
+ decorators: [UIVersion1],
12
14
  };
13
15
  export default meta;
14
16
  const sizes = [
@@ -42,6 +42,7 @@ export var PILL_TYPE;
42
42
  PILL_TYPE["OUTLINE"] = "outline";
43
43
  })(PILL_TYPE || (PILL_TYPE = {}));
44
44
  export const Pill = React.forwardRef((_a, ref) => {
45
+ var _b;
45
46
  var { size: sizeParam, type: typeParam, color, icon, children, sx, onClick } = _a, rest = __rest(_a, ["size", "type", "color", "icon", "children", "sx", "onClick"]);
46
47
  const theme = useTheme();
47
48
  const [hover, setHover] = useState(false);
@@ -52,7 +53,7 @@ export const Pill = React.forwardRef((_a, ref) => {
52
53
  let hoverTextColor = undefined;
53
54
  let borderColor = COLOR.TRANSPARENT;
54
55
  const cursor = clickable ? 'pointer' : 'default';
55
- const hoverShadow = theme.boxShadow.NORMAL;
56
+ const hoverShadow = (_b = theme.boxShadow) === null || _b === void 0 ? void 0 : _b.NORMAL;
56
57
  const hoverDecoration = undefined;
57
58
  const hoverTransform = 'scale(1.03)';
58
59
  const type = typeParam || PILL_TYPE.DEFAULT;
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Radio } from './index';
3
3
  import { useState } from 'react';
4
- import { Row } from '../../layout/Row';
4
+ import { Row } from '../layout/Row';
5
+ import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
5
6
  const meta = {
6
7
  title: 'Elements/Fields/Radio',
7
8
  component: Radio,
8
9
  tags: ['autodocs'],
10
+ decorators: [UIVersion1],
9
11
  };
10
12
  export default meta;
11
13
  const StatefulRadio = (props) => {
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "theme-ui/jsx-runtime";
2
2
  import { render, screen, fireEvent } from '@testing-library/react';
3
3
  import { describe, it, expect, vi, beforeEach } from 'vitest';
4
- import { Radio } from './';
5
- import { useTheme } from '../../../../theme';
6
- vi.mock('../../../../theme', () => ({
4
+ import { Radio } from '.';
5
+ import { useTheme } from '../../../theme';
6
+ vi.mock('../../../theme', () => ({
7
7
  useTheme: vi.fn(),
8
8
  }));
9
9
  describe('Radio Component', () => {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { StyledElementProps } from '../../../../theme';
2
+ import { StyledElementProps } from '../../../theme';
3
3
  export type RadioProps = StyledElementProps<HTMLInputElement, {
4
4
  checked: boolean;
5
5
  onChange: (value: boolean) => void;
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx } from "theme-ui/jsx-runtime";
13
- import { BOX_SHADOW } from '../../../../theme/custom';
13
+ import { BOX_SHADOW } from '../../../theme/custom';
14
14
  export const Radio = (_a) => {
15
15
  var { checked, onChange, disabled, sx } = _a, rest = __rest(_a, ["checked", "onChange", "disabled", "sx"]);
16
16
  return (_jsx("input", Object.assign({ type: "radio", onChange: (e) => {
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { RadioGroup } from './index';
3
3
  import { useState } from 'react';
4
- import { Row } from '../../layout/Row';
4
+ import { Row } from '../layout/Row';
5
+ import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
5
6
  const meta = {
6
7
  title: 'Elements/Fields/RadioGroup',
7
8
  component: RadioGroup,
8
9
  tags: ['autodocs'],
10
+ decorators: [UIVersion1],
9
11
  };
10
12
  export default meta;
11
13
  const options = [
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render, screen, fireEvent } from '@testing-library/react';
3
3
  import { describe, it, expect, vi } from 'vitest';
4
4
  import '@testing-library/jest-dom';
5
- import { RadioGroup } from './';
5
+ import { RadioGroup } from '.';
6
6
  describe('RadioGroup', () => {
7
7
  const options = [
8
8
  { value: 'option1', label: 'Option 1' },
@@ -1,4 +1,4 @@
1
- import { StyledElementProps, StylesProp } from '../../../../theme';
1
+ import { StyledElementProps, StylesProp } from '../../../theme';
2
2
  import { Key } from '../option';
3
3
  type Option<K extends Key = string> = {
4
4
  value: K;
@@ -10,12 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Row } from '../../layout/Row';
14
- import { Label } from '../../text/Label';
15
- import { Group } from '../../Group';
16
- import { GROUP_TYPE } from '../../Group';
17
- import { Column } from '../../layout/Column';
18
- import { TYPOGRAPHY_TYPE, getTypographyStyles, } from '../../../../theme/typography';
13
+ import { Row } from '../layout/Row';
14
+ import { Label } from '../Label';
15
+ import { Group } from '../Group';
16
+ import { GROUP_TYPE } from '../Group';
17
+ import { Column } from '../layout/Column';
18
+ import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
19
19
  import { Radio } from '../Radio';
20
20
  export function RadioGroup(_a) {
21
21
  var { options, checked, onChange, columnStyles, rowStyles } = _a, rest = __rest(_a, ["options", "checked", "onChange", "columnStyles", "rowStyles"]);
@@ -1,12 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ReadMore } from '.';
3
- import { Column } from '../../layout/Column';
4
- import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
5
- import { COLOR } from '../../../../theme/colors';
3
+ import { Column } from '../layout/Column';
4
+ import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
5
+ import { COLOR } from '../../../theme/colors';
6
+ import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
6
7
  const meta = {
7
8
  title: 'Elements/ReadMore',
8
9
  component: ReadMore,
9
10
  tags: ['autodocs'],
11
+ decorators: [UIVersion1],
10
12
  };
11
13
  export default meta;
12
14
  const p1 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ultrices venenatis purus at porta. Etiam congue sapien leo, sed malesuada justo commodo in. Nunc consequat, massa non cursus posuere, magna eros lacinia lectus, eget lobortis mi erat ut justo. Maecenas nisi mi, mollis sed ornare vitae, pharetra sed augue. Curabitur mollis orci risus, sed imperdiet nisi aliquet et. Ut non elit nec magna rhoncus maximus sit amet ut dui. Mauris sit amet eleifend lectus. Aliquam consectetur posuere libero eu ultricies. Etiam rutrum non orci nec vulputate. Sed vel accumsan diam. Cras aliquet eros eros, sit amet pharetra eros tincidunt ut. Vestibulum est erat, eleifend dapibus eros vel, elementum vehicula risus. Etiam blandit condimentum sodales. Donec non libero in orci aliquam egestas fringilla eget purus. Suspendisse pellentesque at ligula ut accumsan.';
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { screen } from '@testing-library/react';
3
3
  import { describe, it, expect, vi, afterEach } from 'vitest';
4
- import { ReadMore } from './';
5
- import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
6
- import { render } from '../../../../utils/test';
4
+ import { ReadMore } from '.';
5
+ import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
6
+ import { render } from '../../../utils/test';
7
7
  describe('ReadMore Component', () => {
8
8
  const mockText = 'This is a test content for the ReadMore component. It should truncate properly if it exceeds the given number of lines.';
9
9
  const defaultProps = {
@@ -16,17 +16,12 @@ describe('ReadMore Component', () => {
16
16
  });
17
17
  it('renders without crashing', () => {
18
18
  render(_jsx(ReadMore, Object.assign({}, defaultProps, { children: mockText })));
19
- expect(screen.getByRole('paragraph')).toBeInTheDocument();
19
+ expect(screen.getByRole('region')).toBeInTheDocument();
20
20
  });
21
21
  it('displays the correct text content', () => {
22
22
  render(_jsx(ReadMore, Object.assign({}, defaultProps, { children: mockText })));
23
23
  expect(screen.getByText(mockText)).toBeInTheDocument();
24
24
  });
25
- it('applies the correct typography styles', () => {
26
- render(_jsx(ReadMore, Object.assign({}, defaultProps)));
27
- const paragraph = screen.getByRole('paragraph');
28
- expect(paragraph).toHaveStyle('font-size: 1rem');
29
- });
30
25
  it('does not show ellipsis if content fits within allotted space', () => {
31
26
  const shortText = 'Short text';
32
27
  render(_jsx(ReadMore, Object.assign({}, defaultProps, { children: shortText })));
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { StyledElementProps } from '../../../../theme';
3
- import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
2
+ import { StyledElementProps } from '../../../theme';
3
+ import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
4
4
  export declare const useLinesHeight: (args: {
5
5
  lines: number;
6
6
  typography: TYPOGRAPHY_TYPE;
@@ -11,12 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
13
13
  import React, { useState, useEffect } from 'react';
14
- import { useTheme } from '../../../../theme';
15
- import { COLOR, colors } from '../../../../theme/colors';
16
- import { getTypographyStyles, } from '../../../../theme/typography';
17
- import { useMediaQuery } from '../../../providers/media';
18
- import { multiplyRemSize } from '../../../../utils/misc';
19
- import { useManualRerender } from '../../../../utils/hooks/useManualRerender';
14
+ import { useTheme } from '../../../theme';
15
+ import { COLOR, colors } from '../../../theme/colors';
16
+ import { getTypographyStyles } from '../../../theme/typography';
17
+ import { useMediaQuery } from '../../providers/media';
18
+ import { multiplyRemSize } from '../../../utils/misc';
19
+ import { useManualRerender } from '../../../utils/hooks/useManualRerender';
20
20
  const ReadMoreLink = (props) => {
21
21
  const bg = colors[props.bg || COLOR.BACKGROUND];
22
22
  const color = colors[props.color || COLOR.ND_BLUE_LIGHT];
@@ -34,11 +34,12 @@ const ReadMoreLink = (props) => {
34
34
  } }, { children: "Read More..." })) })));
35
35
  };
36
36
  export const useLinesHeight = (args) => {
37
+ var _a, _b;
37
38
  const theme = useTheme();
38
39
  const styles = getTypographyStyles(args.typography);
39
40
  const fontSize = styles.fontSize;
40
- const fontSizeRem = theme.fontSizes[fontSize];
41
- const linesHeight = theme.lineHeights[styles.lineHeight] * args.lines;
41
+ const fontSizeRem = ((_a = theme.fontSizes) === null || _a === void 0 ? void 0 : _a[fontSize]) || '1rem';
42
+ const linesHeight = (((_b = theme.lineHeights) === null || _b === void 0 ? void 0 : _b[styles.lineHeight]) || 1.625) * args.lines;
42
43
  return multiplyRemSize({
43
44
  size: fontSizeRem,
44
45
  multiple: linesHeight,
@@ -77,5 +78,5 @@ export const ReadMore = (_a) => {
77
78
  (_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.scrollHeight,
78
79
  (_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.clientHeight,
79
80
  ]);
80
- return (_jsxs("div", Object.assign({ role: role || 'paragraph', ref: ref, sx: Object.assign(Object.assign({ maxHeight: wrapperHeight, overflow: 'hidden', position: 'relative', height: fixedHeight ? wrapperHeight : 'auto' }, getTypographyStyles(typography)), sx) }, rest, { children: [children, showEllipsis && _jsx(ReadMoreLink, { bg: bg, color: color })] })));
81
+ return (_jsxs("div", Object.assign({ role: role || 'region', ref: ref, sx: Object.assign(Object.assign({ maxHeight: wrapperHeight, overflow: 'hidden', position: 'relative', height: fixedHeight ? wrapperHeight : 'auto' }, getTypographyStyles(typography)), sx) }, rest, { children: [children, showEllipsis && _jsx(ReadMoreLink, { bg: bg, color: color })] })));
81
82
  };
@@ -0,0 +1,19 @@
1
+ .linkOuterWrapper {
2
+ white-space: nowrap;
3
+ position: absolute;
4
+ right: 0;
5
+ bottom: 0;
6
+ padding-left: 3rem;
7
+ }
8
+
9
+ .linkInnerWrapper {
10
+ transform: scale(0.9);
11
+ cursor: pointer;
12
+ color: var(--ndBlueLight)
13
+ }
14
+
15
+ .outerWrapper {
16
+ overflow: hidden;
17
+ position: relative;
18
+ height: auto;
19
+ }
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { ReadMoreV2 } from '.';
3
+ declare const meta: Meta<typeof ReadMoreV2>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ReadMoreV2>;
6
+ export declare const Default: Story;
7
+ export declare const NotTruncated: Story;
8
+ export declare const CustomColor: Story;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ReadMoreV2 } from '.';
3
+ import { ColumnV2 } from '../layoutV2/ColumnV2';
4
+ import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
5
+ import { COLOR } from '../../../theme/colors';
6
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
7
+ const meta = {
8
+ title: 'Elements/ReadMoreV2',
9
+ component: ReadMoreV2,
10
+ tags: ['autodocs'],
11
+ decorators: [UIVersion2],
12
+ };
13
+ export default meta;
14
+ const p1 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ultrices venenatis purus at porta. Etiam congue sapien leo, sed malesuada justo commodo in. Nunc consequat, massa non cursus posuere, magna eros lacinia lectus, eget lobortis mi erat ut justo. Maecenas nisi mi, mollis sed ornare vitae, pharetra sed augue. Curabitur mollis orci risus, sed imperdiet nisi aliquet et. Ut non elit nec magna rhoncus maximus sit amet ut dui. Mauris sit amet eleifend lectus. Aliquam consectetur posuere libero eu ultricies. Etiam rutrum non orci nec vulputate. Sed vel accumsan diam. Cras aliquet eros eros, sit amet pharetra eros tincidunt ut. Vestibulum est erat, eleifend dapibus eros vel, elementum vehicula risus. Etiam blandit condimentum sodales. Donec non libero in orci aliquam egestas fringilla eget purus. Suspendisse pellentesque at ligula ut accumsan.';
15
+ const p2 = 'Lorem ipsum dolor sit';
16
+ export const Default = {
17
+ render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2, Object.assign({ sx: { width: '250px' }, lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM }, { children: p1 })) })),
18
+ };
19
+ export const NotTruncated = {
20
+ render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2, Object.assign({ sx: { width: '250px' }, lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM }, { children: p2 })) })),
21
+ };
22
+ export const CustomColor = {
23
+ render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2, Object.assign({ lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM, sx: {
24
+ color: COLOR.BACKGROUND,
25
+ bg: COLOR.PRIMARY,
26
+ width: '250px',
27
+ } }, { children: p1 })) })),
28
+ };
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { screen } from '@testing-library/react';
3
+ import { describe, it, expect, vi, afterEach } from 'vitest';
4
+ import { ReadMoreV2 } from '.';
5
+ import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
6
+ import { render } from '../../../utils/test';
7
+ describe('ReadMoreV2 Component', () => {
8
+ const mockText = 'This is a test content for the ReadMore component. It should truncate properly if it exceeds the given number of lines.';
9
+ const defaultProps = {
10
+ typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM,
11
+ lines: 3,
12
+ fixedHeight: false,
13
+ };
14
+ afterEach(() => {
15
+ vi.clearAllMocks();
16
+ });
17
+ it('renders without crashing', () => {
18
+ render(_jsx(ReadMoreV2, Object.assign({}, defaultProps, { children: mockText })));
19
+ expect(screen.getByRole('region')).toBeInTheDocument();
20
+ });
21
+ it('displays the correct text content', () => {
22
+ render(_jsx(ReadMoreV2, Object.assign({}, defaultProps, { children: mockText })));
23
+ expect(screen.getByText(mockText)).toBeInTheDocument();
24
+ });
25
+ it('does not show ellipsis if content fits within allotted space', () => {
26
+ const shortText = 'Short text';
27
+ render(_jsx(ReadMoreV2, Object.assign({}, defaultProps, { children: shortText })));
28
+ expect(screen.queryByText('Read More...')).not.toBeInTheDocument();
29
+ });
30
+ });
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { StyledElementPropsV2 } from '../../../theme';
3
+ import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
4
+ export declare const useLinesHeightV2: (args: {
5
+ lines: number;
6
+ typography: TYPOGRAPHY_TYPE;
7
+ }) => string;
8
+ export declare const ReadMoreV2: React.FC<StyledElementPropsV2<HTMLDivElement, {
9
+ typography: TYPOGRAPHY_TYPE;
10
+ lines: number;
11
+ fixedHeight?: boolean;
12
+ }, string>>;
@@ -0,0 +1,81 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React, { useState, useEffect } from 'react';
14
+ import { COLOR, colors } from '../../../theme/colors';
15
+ import { fontStyles, getTypographyStyles, } from '../../../theme/typography';
16
+ import { useMediaQueryV2 } from '../../providers/mediaV2';
17
+ import { multiplyRemSize } from '../../../utils/misc';
18
+ import { useManualRerender } from '../../../utils/hooks/useManualRerender';
19
+ import { processSx } from '../../../utils/processSx';
20
+ import * as styles from './ReadMoreV2.module.css';
21
+ const typeSafeStyles = styles;
22
+ const ReadMoreLinkV2 = (props) => {
23
+ const bg = colors[props.bg || COLOR.BACKGROUND];
24
+ const color = props.color ? colors[props.color] : '';
25
+ return (_jsx("div", Object.assign({ className: typeSafeStyles.linkOuterWrapper, style: {
26
+ background: `linear-gradient(to right, ${bg}00, ${bg} 30%, ${bg} 100%)`,
27
+ } }, { children: _jsx("div", Object.assign({ className: typeSafeStyles.linkInnerWrapper, "aria-hidden": "true", style: {
28
+ color,
29
+ } }, { children: "Read More..." })) })));
30
+ };
31
+ export const useLinesHeightV2 = (args) => {
32
+ const styles = getTypographyStyles(args.typography);
33
+ const fontSize = styles.fontSize;
34
+ const fontSizeRem = fontStyles.fontSizes[fontSize];
35
+ const linesHeight = fontStyles.lineHeights[styles.lineHeight] * args.lines;
36
+ return multiplyRemSize({
37
+ size: fontSizeRem,
38
+ multiple: linesHeight,
39
+ });
40
+ };
41
+ export const ReadMoreV2 = (_a) => {
42
+ var _b, _c;
43
+ var { typography, sx, role, lines, fixedHeight, children } = _a, rest = __rest(_a, ["typography", "sx", "role", "lines", "fixedHeight", "children"]);
44
+ const ref = React.useRef(null);
45
+ const [showEllipsis, setShowEllipsis] = useState(true);
46
+ const forceRerender = useManualRerender();
47
+ const wrapperHeight = useLinesHeightV2({ typography, lines });
48
+ const { screenSize } = useMediaQueryV2();
49
+ const { color: _color, bg: _bg } = sx || {};
50
+ const color = Array.isArray(_color) ? _color[0] : _color;
51
+ const bg = Array.isArray(_bg) ? _bg[0] : _bg;
52
+ const validColor = color && Object.values(COLOR).includes(color)
53
+ ? color
54
+ : undefined;
55
+ const validBg = bg && Object.values(COLOR).includes(bg) ? bg : undefined;
56
+ const typographyStyles = getTypographyStyles(typography);
57
+ const processedStyles = processSx(Object.assign(Object.assign({}, typographyStyles), sx));
58
+ useEffect(() => {
59
+ forceRerender({
60
+ delay: [100, 500, 2000],
61
+ });
62
+ }, []);
63
+ useEffect(() => {
64
+ if (ref.current) {
65
+ const isOverflowing = ref.current.scrollHeight > ref.current.clientHeight;
66
+ if (isOverflowing) {
67
+ setShowEllipsis(true);
68
+ }
69
+ else {
70
+ setShowEllipsis(false);
71
+ }
72
+ }
73
+ }, [
74
+ children,
75
+ wrapperHeight,
76
+ screenSize,
77
+ (_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.scrollHeight,
78
+ (_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.clientHeight,
79
+ ]);
80
+ return (_jsxs("div", Object.assign({ role: role || 'region', ref: ref, className: typeSafeStyles.outerWrapper, style: Object.assign(Object.assign({}, processedStyles), { maxHeight: wrapperHeight, height: fixedHeight ? wrapperHeight : '' }) }, rest, { children: [children, showEllipsis && _jsx(ReadMoreLinkV2, { bg: validBg, color: validColor })] })));
81
+ };
@@ -3,14 +3,16 @@ import AppleIcon from '@mui/icons-material/Apple';
3
3
  import { INPUT_SIZE } from '../TextInput';
4
4
  import { Select } from './index';
5
5
  import { useState } from 'react';
6
- import { Column } from '../../layout/Column';
7
- import { Group } from '../../Group';
8
- import { Heading, HEADING_SIZE } from '../../text/Heading';
9
- import { COLOR } from '../../../../theme/colors';
6
+ import { Column } from '../layout/Column';
7
+ import { Group } from '../Group';
8
+ import { Heading, HEADING_SIZE } from '../Heading';
9
+ import { COLOR } from '../../../theme/colors';
10
+ import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
10
11
  const meta = {
11
12
  title: 'Elements/Fields/Select',
12
13
  component: Select,
13
14
  tags: ['autodocs'],
15
+ decorators: [UIVersion1],
14
16
  };
15
17
  export default meta;
16
18
  const sizes = [
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render, screen, fireEvent } from '@testing-library/react';
3
3
  import { describe, it, expect, vi } from 'vitest';
4
- import { Select } from './';
4
+ import { Select } from '.';
5
5
  describe('Select', () => {
6
6
  const options = [
7
7
  { value: 'option1', label: 'Option 1' },
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { StyledElementProps } from '../../../../theme';
2
+ import { StyledElementProps } from '../../../theme';
3
3
  import { INPUT_SIZE } from '../TextInput';
4
4
  import { BasicOption, Key, RenderOption, RenderOptionLabel } from '../option';
5
5
  type SelectProps<Value extends Key, Option extends BasicOption<Value>> = StyledElementProps<HTMLSelectElement, {
@@ -2,17 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
3
  import _ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
4
4
  import { useFloating, size as sizeMiddleware, offset, autoPlacement, } from '@floating-ui/react';
5
- import { TYPOGRAPHY_TYPE, getTypographyStyles, } from '../../../../theme/typography';
5
+ import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
6
6
  import { INPUT_SIZE, labelOffsetMap, labelTypographyMap } from '../TextInput';
7
- import { ListBox } from '../../ListBox';
8
- import { BUTTON_SIZE, BUTTON_TYPE, Button } from '../../Button';
7
+ import { ListBox } from '../ListBox';
8
+ import { BUTTON_SIZE, BUTTON_TYPE, Button } from '../Button';
9
9
  import { defaultRenderOptionLabel, getOptionId, } from '../option';
10
- import { KEY_CODES, importedDefaultComponentShim } from '../../../../utils/misc';
11
- import { COLOR } from '../../../../theme/colors';
12
- import { Box } from '../../layout/Box';
13
- import { Label } from '../../text/Label';
14
- import { useUniqueId } from '../../../providers/uniqueIds';
15
- import { BOX_SHADOW, Z_INDEX } from '../../../../theme/custom';
10
+ import { KEY_CODES, importedDefaultComponentShim } from '../../../utils/misc';
11
+ import { COLOR } from '../../../theme/colors';
12
+ import { Box } from '../layout/Box';
13
+ import { Label } from '../Label';
14
+ import { useUniqueId } from '../../providers/uniqueIds';
15
+ import { BOX_SHADOW, Z_INDEX } from '../../../theme/custom';
16
16
  const ArrowDropDownIcon = importedDefaultComponentShim(_ArrowDropDownIcon);
17
17
  const typographyMap = {
18
18
  [INPUT_SIZE.SM]: TYPOGRAPHY_TYPE.PARAGRAPH_SMALL,