@openedx/paragon 23.0.0-alpha.3 → 23.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/bin/paragon-scripts.js +10 -0
  2. package/dist/Annotation/index.scss +16 -0
  3. package/dist/Card/CardDeck.js +0 -2
  4. package/dist/Card/CardDeck.js.map +1 -1
  5. package/dist/Card/index.scss +8 -6
  6. package/dist/Carousel/index.scss +24 -1
  7. package/dist/Chip/ChipIcon.d.ts +1 -1
  8. package/dist/CloseButton/index.scss +8 -0
  9. package/dist/ColorPicker/index.scss +1 -1
  10. package/dist/Container/index.d.ts +16 -0
  11. package/dist/Container/index.js +15 -13
  12. package/dist/Container/index.js.map +1 -1
  13. package/dist/DataTable/index.scss +12 -0
  14. package/dist/Dropdown/dropdown-bootstrap.scss +6 -0
  15. package/dist/Dropzone/index.scss +34 -0
  16. package/dist/Form/_FormText.scss +1 -1
  17. package/dist/Form/_bootstrap-custom-forms.scss +40 -0
  18. package/dist/Form/_index.scss +9 -0
  19. package/dist/Form/_mixins.scss +22 -0
  20. package/dist/IconButton/index.d.ts +1 -1
  21. package/dist/IconButton/index.js +1 -1
  22. package/dist/IconButton/index.js.map +1 -1
  23. package/dist/IconButton/index.scss +146 -0
  24. package/dist/Menu/SelectMenu.js +9 -4
  25. package/dist/Menu/SelectMenu.js.map +1 -1
  26. package/dist/Menu/index.scss +8 -0
  27. package/dist/Modal/ModalContext.d.ts +15 -0
  28. package/dist/Modal/ModalContext.js +7 -14
  29. package/dist/Modal/ModalContext.js.map +1 -1
  30. package/dist/Modal/ModalDialog.d.ts +110 -0
  31. package/dist/Modal/ModalDialog.js +30 -24
  32. package/dist/Modal/ModalDialog.js.map +1 -1
  33. package/dist/Modal/ModalDialogHeader.d.ts +10 -0
  34. package/dist/Modal/ModalDialogHeader.js +6 -7
  35. package/dist/Modal/ModalDialogHeader.js.map +1 -1
  36. package/dist/Modal/ModalLayer.d.ts +53 -0
  37. package/dist/Modal/ModalLayer.js +5 -14
  38. package/dist/Modal/ModalLayer.js.map +1 -1
  39. package/dist/Modal/Portal.d.ts +11 -0
  40. package/dist/Modal/Portal.js +5 -6
  41. package/dist/Modal/Portal.js.map +1 -1
  42. package/dist/Modal/_ModalDialog.scss +22 -2
  43. package/dist/Nav/index.scss +8 -0
  44. package/dist/Overlay/index.d.ts +2 -2
  45. package/dist/PageBanner/index.scss +2 -2
  46. package/dist/Pagination/pagination-bootstrap.scss +9 -0
  47. package/dist/Popover/index.scss +1 -1
  48. package/dist/ProductTour/Checkpoint.scss +1 -1
  49. package/dist/ProgressBar/bootstrap-progress.scss +20 -5
  50. package/dist/ProgressBar/index.scss +3 -3
  51. package/dist/Stepper/index.scss +1 -1
  52. package/dist/Sticky/index.scss +12 -0
  53. package/dist/Toast/index.scss +13 -1
  54. package/dist/Tooltip/index.scss +16 -0
  55. package/dist/core.css +913 -470
  56. package/dist/core.css.map +1 -1
  57. package/dist/core.min.css +1 -1
  58. package/dist/hooks/useArrowKeyNavigation.js +2 -3
  59. package/dist/hooks/useArrowKeyNavigation.js.map +1 -1
  60. package/dist/index.d.ts +19 -5
  61. package/dist/index.js +5 -5
  62. package/dist/light.css +2035 -1315
  63. package/dist/light.css.map +1 -1
  64. package/dist/light.min.css +1 -1
  65. package/icons/es5/Newsstand.js +15 -0
  66. package/icons/es5/index.js +1 -0
  67. package/icons/es5/index.ts +1 -0
  68. package/icons/jsx/Newsstand.jsx +17 -0
  69. package/icons/jsx/index.jsx +1 -0
  70. package/icons/svg/newsstand.svg +1 -0
  71. package/lib/build-tokens.js +67 -31
  72. package/package.json +8 -5
  73. package/src/Annotation/index.scss +16 -0
  74. package/src/Card/CardDeck.jsx +0 -3
  75. package/src/Card/README.md +0 -31
  76. package/src/Card/index.scss +8 -6
  77. package/src/Carousel/index.scss +24 -1
  78. package/src/CloseButton/index.scss +8 -0
  79. package/src/ColorPicker/index.scss +1 -1
  80. package/src/Container/{Container.test.jsx → Container.test.tsx} +14 -8
  81. package/src/Container/README.md +4 -0
  82. package/src/Container/index.tsx +64 -0
  83. package/src/DataTable/index.scss +12 -0
  84. package/src/DataTable/selection/tests/ControlledSelectHeader.test.jsx +7 -7
  85. package/src/Dropdown/dropdown-bootstrap.scss +6 -0
  86. package/src/Dropzone/index.scss +34 -0
  87. package/src/Form/_FormText.scss +1 -1
  88. package/src/Form/_bootstrap-custom-forms.scss +40 -0
  89. package/src/Form/_index.scss +9 -0
  90. package/src/Form/_mixins.scss +22 -0
  91. package/src/IconButton/index.scss +146 -0
  92. package/src/IconButton/index.tsx +1 -1
  93. package/src/Menu/SelectMenu.jsx +5 -0
  94. package/src/Menu/SelectMenu.test.jsx +6 -0
  95. package/src/Menu/index.scss +8 -0
  96. package/src/Menu/select-menu.md +8 -0
  97. package/src/Modal/{ModalContext.jsx → ModalContext.tsx} +19 -16
  98. package/src/Modal/{ModalDialog.jsx → ModalDialog.tsx} +57 -26
  99. package/src/Modal/{ModalDialogHeader.jsx → ModalDialogHeader.tsx} +17 -11
  100. package/src/Modal/{ModalLayer.jsx → ModalLayer.tsx} +17 -17
  101. package/src/Modal/{Portal.jsx → Portal.tsx} +10 -7
  102. package/src/Modal/_ModalDialog.scss +22 -2
  103. package/src/Modal/modal-dialog.mdx +95 -6
  104. package/src/Modal/tests/{ModalDialog.test.jsx → ModalDialog.test.tsx} +18 -10
  105. package/src/Modal/tests/{ModalLayer.test.jsx → ModalLayer.test.tsx} +5 -5
  106. package/src/Modal/tests/{Portal.test.jsx → Portal.test.tsx} +3 -3
  107. package/src/Nav/index.scss +8 -0
  108. package/src/PageBanner/index.scss +2 -2
  109. package/src/Pagination/pagination-bootstrap.scss +9 -0
  110. package/src/Popover/index.scss +1 -1
  111. package/src/ProductTour/Checkpoint.scss +1 -1
  112. package/src/ProgressBar/bootstrap-progress.scss +20 -5
  113. package/src/ProgressBar/index.scss +3 -3
  114. package/src/Stepper/index.scss +1 -1
  115. package/src/Sticky/index.scss +12 -0
  116. package/src/Toast/index.scss +13 -1
  117. package/src/Tooltip/index.scss +16 -0
  118. package/src/hooks/useArrowKeyNavigation.jsx +1 -2
  119. package/src/index.d.ts +19 -5
  120. package/src/index.js +5 -5
  121. package/styles/css/core/abstraction-variables.css +44 -0
  122. package/styles/css/core/custom-media-breakpoints.css +3 -4
  123. package/styles/css/core/index.css +2 -1
  124. package/styles/css/core/variables.css +494 -430
  125. package/styles/css/themes/light/abstraction-variables.css +304 -0
  126. package/styles/css/themes/light/index.css +1 -0
  127. package/styles/css/themes/light/utility-classes.css +2 -3
  128. package/styles/css/themes/light/variables.css +1753 -1334
  129. package/styles/scss/core/_typography.scss +16 -4
  130. package/styles/scss/core/_utilities.scss +7 -3
  131. package/styles/scss/core/_variables.scss +43 -30
  132. package/styles/scss/core/core.scss +1 -0
  133. package/tokens/src/core/alias/size.json +6 -5
  134. package/tokens/src/core/components/ActionRow.json +3 -2
  135. package/tokens/src/core/components/Alert.json +12 -10
  136. package/tokens/src/core/components/Annotation.json +9 -7
  137. package/tokens/src/core/components/Avatar.json +9 -9
  138. package/tokens/src/core/components/AvatarButton.json +4 -3
  139. package/tokens/src/core/components/Badge.json +12 -9
  140. package/tokens/src/core/components/Breadcrumb.json +7 -5
  141. package/tokens/src/core/components/Bubble.json +4 -3
  142. package/tokens/src/core/components/Button/core.json +35 -59
  143. package/tokens/src/core/components/Card.json +33 -44
  144. package/tokens/src/core/components/Carousel.json +39 -13
  145. package/tokens/src/core/components/Chip.json +13 -21
  146. package/tokens/src/core/components/ChipCarousel.json +4 -5
  147. package/tokens/src/core/components/CloseButton.json +2 -6
  148. package/tokens/src/core/components/Code.json +9 -8
  149. package/tokens/src/core/components/Collapsible.json +10 -13
  150. package/tokens/src/core/components/ColorPicker.json +3 -2
  151. package/tokens/src/core/components/Container.json +6 -5
  152. package/tokens/src/core/components/DataTable.json +17 -9
  153. package/tokens/src/core/components/Dropdown.json +24 -29
  154. package/tokens/src/core/components/Dropzone.json +5 -7
  155. package/tokens/src/core/components/Form/other.json +5 -4
  156. package/tokens/src/core/components/Form/size.json +72 -119
  157. package/tokens/src/core/components/Form/spacing.json +39 -83
  158. package/tokens/src/core/components/Form/transition.json +43 -7
  159. package/tokens/src/core/components/Form/typography.json +24 -88
  160. package/tokens/src/core/components/Icon.json +6 -5
  161. package/tokens/src/core/components/IconButton.json +4 -7
  162. package/tokens/src/core/components/Image.json +7 -6
  163. package/tokens/src/core/components/Menu.json +14 -12
  164. package/tokens/src/core/components/Modal.json +26 -21
  165. package/tokens/src/core/components/Nav.json +14 -16
  166. package/tokens/src/core/components/Navbar.json +15 -30
  167. package/tokens/src/core/components/Pagination.json +23 -24
  168. package/tokens/src/core/components/Popover.json +18 -14
  169. package/tokens/src/core/components/ProductTour.json +8 -14
  170. package/tokens/src/core/components/ProgressBar.json +29 -14
  171. package/tokens/src/core/components/SearchField.json +7 -9
  172. package/tokens/src/core/components/SelectableBox.json +4 -3
  173. package/tokens/src/core/components/Sheet.json +3 -2
  174. package/tokens/src/core/components/Spinner.json +9 -7
  175. package/tokens/src/core/components/Stack.json +2 -1
  176. package/tokens/src/core/components/Stepper.json +12 -14
  177. package/tokens/src/core/components/Sticky.json +2 -1
  178. package/tokens/src/core/components/Tab.json +8 -7
  179. package/tokens/src/core/components/Tabs.json +5 -5
  180. package/tokens/src/core/components/Toast.json +11 -8
  181. package/tokens/src/core/components/Tooltip.json +13 -11
  182. package/tokens/src/core/components/general/caret.json +5 -3
  183. package/tokens/src/core/components/general/headings.json +5 -4
  184. package/tokens/src/core/components/general/hr.json +3 -2
  185. package/tokens/src/core/components/general/input.json +19 -19
  186. package/tokens/src/core/components/general/link.json +13 -12
  187. package/tokens/src/core/components/general/list.json +9 -6
  188. package/tokens/src/core/components/general/text.json +6 -12
  189. package/tokens/src/core/global/breakpoints.json +25 -6
  190. package/tokens/src/core/global/elevation.json +55 -13
  191. package/tokens/src/core/global/other.json +5 -1
  192. package/tokens/src/core/global/spacing.json +70 -17
  193. package/tokens/src/core/global/transition.json +41 -4
  194. package/tokens/src/core/global/typography.json +248 -53
  195. package/tokens/src/core/utilities/color.json +35 -4
  196. package/tokens/src/themes/light/alias/color.json +276 -75
  197. package/tokens/src/themes/light/components/Alert.json +15 -26
  198. package/tokens/src/themes/light/components/Annotation.json +27 -13
  199. package/tokens/src/themes/light/components/Avatar.json +2 -1
  200. package/tokens/src/themes/light/components/Badge.json +57 -122
  201. package/tokens/src/themes/light/components/Breadcrumb.json +6 -5
  202. package/tokens/src/themes/light/components/Bubble.json +9 -8
  203. package/tokens/src/themes/light/components/Button/brand.json +171 -119
  204. package/tokens/src/themes/light/components/Button/core.json +8 -9
  205. package/tokens/src/themes/light/components/Button/danger.json +171 -112
  206. package/tokens/src/themes/light/components/Button/dark.json +188 -106
  207. package/tokens/src/themes/light/components/Button/info.json +186 -112
  208. package/tokens/src/themes/light/components/Button/light.json +186 -110
  209. package/tokens/src/themes/light/components/Button/primary.json +178 -116
  210. package/tokens/src/themes/light/components/Button/secondary.json +166 -132
  211. package/tokens/src/themes/light/components/Button/success.json +176 -117
  212. package/tokens/src/themes/light/components/Button/tertiary.json +34 -60
  213. package/tokens/src/themes/light/components/Button/warning.json +164 -128
  214. package/tokens/src/themes/light/components/Card.json +10 -21
  215. package/tokens/src/themes/light/components/Carousel.json +12 -11
  216. package/tokens/src/themes/light/components/Chip.json +14 -26
  217. package/tokens/src/themes/light/components/CloseButton.json +12 -2
  218. package/tokens/src/themes/light/components/Code.json +7 -9
  219. package/tokens/src/themes/light/components/DataTable.json +7 -11
  220. package/tokens/src/themes/light/components/Dropdown.json +17 -20
  221. package/tokens/src/themes/light/components/Dropzone.json +49 -11
  222. package/tokens/src/themes/light/components/Form/color.json +101 -155
  223. package/tokens/src/themes/light/components/Form/elevation.json +38 -42
  224. package/tokens/src/themes/light/components/Form/other.json +44 -41
  225. package/tokens/src/themes/light/components/IconButton.json +408 -256
  226. package/tokens/src/themes/light/components/Image.json +7 -4
  227. package/tokens/src/themes/light/components/Menu.json +12 -10
  228. package/tokens/src/themes/light/components/Modal.json +22 -12
  229. package/tokens/src/themes/light/components/Nav.json +82 -94
  230. package/tokens/src/themes/light/components/Navbar.json +32 -76
  231. package/tokens/src/themes/light/components/OverflowScroll.json +3 -1
  232. package/tokens/src/themes/light/components/PageBanner.json +11 -10
  233. package/tokens/src/themes/light/components/Pagination.json +19 -23
  234. package/tokens/src/themes/light/components/Popover.json +22 -27
  235. package/tokens/src/themes/light/components/ProductTour.json +9 -20
  236. package/tokens/src/themes/light/components/ProgressBar.json +12 -10
  237. package/tokens/src/themes/light/components/Scrollable.json +3 -3
  238. package/tokens/src/themes/light/components/SearchField.json +9 -9
  239. package/tokens/src/themes/light/components/Sheet.json +6 -7
  240. package/tokens/src/themes/light/components/Stepper.json +12 -17
  241. package/tokens/src/themes/light/components/Sticky.json +31 -6
  242. package/tokens/src/themes/light/components/Tab.json +47 -24
  243. package/tokens/src/themes/light/components/Toast.json +26 -14
  244. package/tokens/src/themes/light/components/Tooltip.json +25 -10
  245. package/tokens/src/themes/light/components/general/body.json +3 -2
  246. package/tokens/src/themes/light/components/general/headings.json +2 -1
  247. package/tokens/src/themes/light/components/general/hr.json +3 -6
  248. package/tokens/src/themes/light/components/general/input.json +11 -4
  249. package/tokens/src/themes/light/components/general/link.json +34 -43
  250. package/tokens/src/themes/light/components/general/list.json +15 -19
  251. package/tokens/src/themes/light/components/general/text.json +5 -6
  252. package/tokens/src/themes/light/global/color.json +1592 -867
  253. package/tokens/src/themes/light/global/elevation.json +481 -93
  254. package/tokens/style-dictionary.js +342 -144
  255. package/tokens/utils.js +176 -6
  256. package/src/Container/index.jsx +0 -49
  257. package/tokens/src/core/global/display.json +0 -22
  258. /package/src/Truncate/{Truncate.test.js → utils.test.js} +0 -0
@@ -0,0 +1,15 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import * as React from "react";
3
+ var SvgNewsstand = function SvgNewsstand(props) {
4
+ return /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ height: 24,
7
+ viewBox: "0 -960 960 960",
8
+ width: 24,
9
+ fill: "none"
10
+ }, props), /*#__PURE__*/React.createElement("path", {
11
+ d: "M80-160v-80h800v80H80Zm80-160v-320h80v320h-80Zm160 0v-480h80v480h-80Zm160 0v-480h80v480h-80Zm280 0L600-600l70-40 160 280-70 40Z",
12
+ fill: "currentColor"
13
+ }));
14
+ };
15
+ export default SvgNewsstand;
@@ -1381,6 +1381,7 @@ export { default as NetworkWifi3Bar } from "./NetworkWifi3Bar";
1381
1381
  export { default as NewLabel } from "./NewLabel";
1382
1382
  export { default as NewReleases } from "./NewReleases";
1383
1383
  export { default as Newspaper } from "./Newspaper";
1384
+ export { default as Newsstand } from "./Newsstand";
1384
1385
  export { default as NextPlan } from "./NextPlan";
1385
1386
  export { default as NextWeek } from "./NextWeek";
1386
1387
  export { default as Nfc } from "./Nfc";
@@ -1382,6 +1382,7 @@ export { default as NetworkWifi3Bar } from "./NetworkWifi3Bar";
1382
1382
  export { default as NewLabel } from "./NewLabel";
1383
1383
  export { default as NewReleases } from "./NewReleases";
1384
1384
  export { default as Newspaper } from "./Newspaper";
1385
+ export { default as Newsstand } from "./Newsstand";
1385
1386
  export { default as NextPlan } from "./NextPlan";
1386
1387
  export { default as NextWeek } from "./NextWeek";
1387
1388
  export { default as Nfc } from "./Nfc";
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ const SvgNewsstand = (props) => (
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ height={24}
6
+ viewBox="0 -960 960 960"
7
+ width={24}
8
+ fill="none"
9
+ {...props}
10
+ >
11
+ <path
12
+ d="M80-160v-80h800v80H80Zm80-160v-320h80v320h-80Zm160 0v-480h80v480h-80Zm160 0v-480h80v480h-80Zm280 0L600-600l70-40 160 280-70 40Z"
13
+ fill="currentColor"
14
+ />
15
+ </svg>
16
+ );
17
+ export default SvgNewsstand;
@@ -1381,6 +1381,7 @@ export { default as NetworkWifi3Bar } from "./NetworkWifi3Bar";
1381
1381
  export { default as NewLabel } from "./NewLabel";
1382
1382
  export { default as NewReleases } from "./NewReleases";
1383
1383
  export { default as Newspaper } from "./Newspaper";
1384
+ export { default as Newsstand } from "./Newsstand";
1384
1385
  export { default as NextPlan } from "./NextPlan";
1385
1386
  export { default as NextWeek } from "./NextWeek";
1386
1387
  export { default as Nfc } from "./Nfc";
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px"><path d="M80-160v-80h800v80H80Zm80-160v-320h80v320h-80Zm160 0v-480h80v480h-80Zm160 0v-480h80v480h-80Zm280 0L600-600l70-40 160 280-70 40Z"/></svg>
@@ -1,6 +1,10 @@
1
1
  const path = require('path');
2
2
  const minimist = require('minimist');
3
- const { StyleDictionary, colorTransform, createCustomCSSVariables } = require('../tokens/style-dictionary');
3
+ const {
4
+ initializeStyleDictionary,
5
+ getTokensStudioTransforms,
6
+ colorTransform,
7
+ } = require('../tokens/style-dictionary');
4
8
  const { createIndexCssFile } = require('../tokens/utils');
5
9
 
6
10
  /**
@@ -16,19 +20,34 @@ async function buildTokensCommand(commandArgs) {
16
20
  const defaultParams = {
17
21
  themes: ['light'],
18
22
  'build-dir': './build/',
23
+ 'source-tokens-only': false,
24
+ 'output-references': true,
25
+ verbose: false,
19
26
  };
20
27
 
21
28
  const alias = {
22
29
  'build-dir': 'b',
23
30
  themes: 't',
31
+ verbose: '-v',
24
32
  };
25
33
 
26
34
  const {
27
35
  'build-dir': buildDir,
28
36
  source: tokensSource,
29
- 'source-tokens-only': hasSourceTokensOnly,
37
+ 'source-tokens-only': transformSourceTokensOnly,
38
+ 'output-references': outputReferences,
30
39
  themes,
31
- } = minimist(commandArgs, { alias, default: defaultParams, boolean: 'source-tokens-only' });
40
+ verbose,
41
+ } = minimist(
42
+ commandArgs,
43
+ {
44
+ alias,
45
+ default: defaultParams,
46
+ boolean: ['source-tokens-only', 'output-references', 'verbose'],
47
+ },
48
+ );
49
+
50
+ const StyleDictionary = await initializeStyleDictionary({ themes });
32
51
 
33
52
  const coreConfig = {
34
53
  include: [
@@ -38,36 +57,42 @@ async function buildTokensCommand(commandArgs) {
38
57
  source: tokensSource
39
58
  ? [`${tokensSource}/core/**/*.json`, `${tokensSource}/core/**/*.toml`]
40
59
  : [],
60
+ preprocessors: ['pgn-annotate-token-extensions-with-references', 'tokens-studio'],
61
+ expand: {
62
+ typesMap: (await getTokensStudioTransforms()).expandTypesMap,
63
+ },
41
64
  platforms: {
42
65
  css: {
43
66
  prefix: 'pgn',
44
- transformGroup: 'css',
67
+ transformGroup: 'paragon-css',
45
68
  // NOTE: buildPath must end with a slash
46
69
  buildPath: buildDir.slice(-1) === '/' ? buildDir : `${buildDir}/`,
70
+ options: {
71
+ fileHeader: 'customFileHeader',
72
+ },
47
73
  files: [
48
74
  {
49
75
  format: 'css/custom-variables',
50
76
  destination: 'core/variables.css',
51
- filter: hasSourceTokensOnly ? 'isSource' : undefined,
77
+ filter: transformSourceTokensOnly ? 'isSource' : undefined,
52
78
  options: {
53
- outputReferences: !hasSourceTokensOnly,
79
+ outputReferences,
54
80
  },
55
81
  },
56
82
  {
57
83
  format: 'css/custom-media-breakpoints',
58
84
  destination: 'core/custom-media-breakpoints.css',
59
- filter: hasSourceTokensOnly ? 'isSource' : undefined,
85
+ filter: transformSourceTokensOnly ? 'isSource' : undefined,
60
86
  options: {
61
- outputReferences: !hasSourceTokensOnly,
87
+ outputReferences,
62
88
  },
63
89
  },
64
90
  ],
65
- transforms: StyleDictionary.transformGroup.css.filter(item => item !== 'size/rem').concat('color/sass-color-functions', 'str-replace'),
66
- options: {
67
- fileHeader: 'customFileHeader',
68
- },
69
91
  },
70
92
  },
93
+ log: {
94
+ verbosity: verbose ? 'verbose' : 'default',
95
+ },
71
96
  };
72
97
 
73
98
  const getStyleDictionaryConfig = (themeVariant) => ({
@@ -85,16 +110,10 @@ async function buildTokensCommand(commandArgs) {
85
110
  : [],
86
111
  transform: {
87
112
  'color/sass-color-functions': {
88
- ...StyleDictionary.transform['color/sass-color-functions'],
89
- transformer: (token) => colorTransform(token, themeVariant),
113
+ ...StyleDictionary.hooks.transforms['color/sass-color-functions'],
114
+ transform: (token) => colorTransform(token, themeVariant),
90
115
  },
91
116
  },
92
- format: {
93
- 'css/custom-variables': formatterArgs => createCustomCSSVariables({
94
- formatterArgs,
95
- themeVariant,
96
- }),
97
- },
98
117
  platforms: {
99
118
  css: {
100
119
  ...coreConfig.platforms.css,
@@ -102,17 +121,19 @@ async function buildTokensCommand(commandArgs) {
102
121
  {
103
122
  format: 'css/custom-variables',
104
123
  destination: `themes/${themeVariant}/variables.css`,
105
- filter: hasSourceTokensOnly ? 'isSource' : undefined,
124
+ filter: transformSourceTokensOnly
125
+ ? `isSource.${themeVariant}`
126
+ : `isThemeVariant.${themeVariant}`,
106
127
  options: {
107
- outputReferences: !hasSourceTokensOnly,
128
+ outputReferences,
108
129
  },
109
130
  },
110
131
  {
111
132
  format: 'css/utility-classes',
112
133
  destination: `themes/${themeVariant}/utility-classes.css`,
113
- filter: hasSourceTokensOnly ? 'isSource' : undefined,
134
+ filter: transformSourceTokensOnly ? 'isSource' : undefined,
114
135
  options: {
115
- outputReferences: !hasSourceTokensOnly,
136
+ outputReferences,
116
137
  },
117
138
  },
118
139
  ],
@@ -120,14 +141,29 @@ async function buildTokensCommand(commandArgs) {
120
141
  },
121
142
  });
122
143
 
123
- StyleDictionary.extend(coreConfig).buildAllPlatforms();
124
- createIndexCssFile({ buildDir, isTheme: false });
144
+ // Create list of style-dictionary configurations to build (core + theme variants)
145
+ const configs = [
146
+ { config: coreConfig },
147
+ ...themes.map((themeVariant) => {
148
+ const config = getStyleDictionaryConfig(themeVariant);
149
+ return {
150
+ config,
151
+ themeVariant,
152
+ };
153
+ }),
154
+ ];
125
155
 
126
- themes.forEach((themeVariant) => {
127
- const config = getStyleDictionaryConfig(themeVariant);
128
- StyleDictionary.extend(config).buildAllPlatforms();
129
- createIndexCssFile({ buildDir, isTheme: true, themeVariant });
130
- });
156
+ // Build tokens for each configuration
157
+ await Promise.all(configs.map(async ({ config, themeVariant }) => {
158
+ const sd = new StyleDictionary(config);
159
+ await sd.cleanAllPlatforms();
160
+ await sd.buildAllPlatforms();
161
+ createIndexCssFile({
162
+ buildDir,
163
+ isThemeVariant: !!themeVariant,
164
+ themeVariant,
165
+ });
166
+ }));
131
167
  }
132
168
 
133
169
  module.exports = buildTokensCommand;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openedx/paragon",
3
- "version": "23.0.0-alpha.3",
3
+ "version": "23.0.0-alpha.5",
4
4
  "description": "Accessible, responsive UI component library based on Bootstrap.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -51,11 +51,14 @@
51
51
  "playroom:build": "npm run playroom:build --workspace=www",
52
52
  "prepare": "husky || true",
53
53
  "build-tokens": "./bin/paragon-scripts.js build-tokens --build-dir ./styles/css",
54
+ "build-tokens:watch": "npx nodemon --ignore styles/css -x \"npm run build-tokens\"",
54
55
  "replace-variables-usage-with-css": "./bin/paragon-scripts.js replace-variables -p src -t usage",
55
- "replace-variables-definition-with-css": "./bin/paragon-scripts.js replace-variables -p src -t definition"
56
+ "replace-variables-definition-with-css": "./bin/paragon-scripts.js replace-variables -p src -t definition",
57
+ "cli:help": "./bin/paragon-scripts.js help"
56
58
  },
57
59
  "dependencies": {
58
60
  "@popperjs/core": "^2.11.4",
61
+ "@tokens-studio/sd-transforms": "^1.2.4",
59
62
  "axios": "^0.27.2",
60
63
  "bootstrap": "^4.6.2",
61
64
  "chalk": "^4.1.2",
@@ -93,7 +96,7 @@
93
96
  "react-table": "^7.7.0",
94
97
  "react-transition-group": "^4.4.2",
95
98
  "sass": "^1.58.3",
96
- "style-dictionary": "^3.7.1",
99
+ "style-dictionary": "^4.0.1",
97
100
  "tabbable": "^5.3.3",
98
101
  "uncontrollable": "^7.2.1",
99
102
  "uuid": "^9.0.0"
@@ -112,9 +115,9 @@
112
115
  "@babel/preset-env": "^7.16.8",
113
116
  "@babel/preset-react": "^7.16.7",
114
117
  "@babel/preset-typescript": "^7.16.7",
115
- "@edx/eslint-config": "^3.2.0",
118
+ "@edx/eslint-config": "^4.2.0",
116
119
  "@edx/stylelint-config-edx": "^2.3.0",
117
- "@edx/typescript-config": "^1.0.1",
120
+ "@edx/typescript-config": "^1.1.0",
118
121
  "@formatjs/cli": "^5.0.2",
119
122
  "@semantic-release/changelog": "^6.0.1",
120
123
  "@semantic-release/git": "^10.0.1",
@@ -1,5 +1,21 @@
1
1
  @import "mixins";
2
2
 
3
+ :root {
4
+ --pgn-elevation-annotation-box-shadow:
5
+ drop-shadow(
6
+ var(--pgn-elevation-annotation-box-shadow-1-offset-x)
7
+ var(--pgn-elevation-annotation-box-shadow-1-offset-y)
8
+ var(--pgn-elevation-annotation-box-shadow-1-blur)
9
+ var(--pgn-elevation-annotation-box-shadow-1-color)
10
+ )
11
+ drop-shadow(
12
+ var(--pgn-elevation-annotation-box-shadow-2-offset-x)
13
+ var(--pgn-elevation-annotation-box-shadow-2-offset-y)
14
+ var(--pgn-elevation-annotation-box-shadow-2-blur)
15
+ var(--pgn-elevation-annotation-box-shadow-2-color)
16
+ );
17
+ }
18
+
3
19
  .pgn__annotation {
4
20
  padding: var(--pgn-spacing-annotation-padding);
5
21
  border-radius: var(--pgn-size-annotation-border-radius);
@@ -1,7 +1,6 @@
1
1
  import React, { Children, useMemo } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import PropTypes from 'prop-types';
4
- import BaseCardDeck from 'react-bootstrap/CardDeck';
5
4
  import Row from 'react-bootstrap/Row';
6
5
  import Col from 'react-bootstrap/Col';
7
6
  import { useOverflowScrollItems } from '../OverflowScroll';
@@ -102,6 +101,4 @@ CardDeck.defaultProps = {
102
101
  hasEqualColumnHeights: true,
103
102
  };
104
103
 
105
- CardDeck.Deprecated = BaseCardDeck;
106
-
107
104
  export default CardDeck;
@@ -899,37 +899,6 @@ For accessibility, if the child `Card` components are interactive (e.g., `isClic
899
899
  }
900
900
  ```
901
901
 
902
- ### CardDeck.Deprecated
903
-
904
- Gives any child `Card` components equal height with an appropriate gutter between cards. Each child `Card` component's width will be adjusted (e.g., become more narrow) to ensure all `Card` components fit within its parent's width.
905
-
906
- Note: This component is a pass-thru from `react-bootstrap`.
907
-
908
- ```jsx live
909
- () => {
910
- const CardComponent = () => (
911
- <Card>
912
- <Card.ImageCap
913
- src="https://picsum.photos/360/200/"
914
- srcAlt="Card image"
915
- />
916
- <Card.Header title="Card title" />
917
- <Card.Section title="Section title">
918
- <HipsterIpsum numShortParagraphs={1} />
919
- </Card.Section>
920
- </Card>
921
- );
922
-
923
- return (
924
- <CardDeck.Deprecated>
925
- <CardComponent />
926
- <CardComponent />
927
- <CardComponent />
928
- </CardDeck.Deprecated>
929
- )
930
- }
931
- ```
932
-
933
902
  ## CardCarousel
934
903
 
935
904
  Extends `CardDeck` to support navigating between any overflow `Card` components via left and right `IconButton` components as a scrollable carousel.
@@ -136,11 +136,11 @@ a.pgn__card {
136
136
  }
137
137
 
138
138
  .pgn__card-header-title-sm {
139
- font-size: var(--pgn-typography-font-size-h4);
139
+ font-size: var(--pgn-typography-font-size-h4-base);
140
140
  }
141
141
 
142
142
  .pgn__card-header-title-md {
143
- font-size: var(--pgn-typography-font-size-h3);
143
+ font-size: var(--pgn-typography-font-size-h3-base);
144
144
  }
145
145
 
146
146
  %header-subtitle {
@@ -155,11 +155,11 @@ a.pgn__card {
155
155
  }
156
156
 
157
157
  .pgn__card-header-subtitle-sm {
158
- font-size: var(--pgn-typography-font-size-h5);
158
+ font-size: var(--pgn-typography-font-size-h5-base);
159
159
  }
160
160
 
161
161
  .pgn__card-header-subtitle-md {
162
- font-size: var(--pgn-typography-font-size-h4);
162
+ font-size: var(--pgn-typography-font-size-h4-base);
163
163
  }
164
164
 
165
165
  .pgn__card-header-actions {
@@ -271,7 +271,7 @@ a.pgn__card {
271
271
  .pgn__card-section-title {
272
272
  color: var(--pgn-color-black);
273
273
  font-weight: var(--pgn-typography-font-weight-bold);
274
- font-size: var(--pgn-typography-font-size-h5);
274
+ font-size: var(--pgn-typography-font-size-h5-base);
275
275
  margin-bottom: var(--pgn-spacing-card-spacer-y);
276
276
  }
277
277
 
@@ -352,6 +352,8 @@ a.pgn__card {
352
352
  bottom: calc(-1 * var(--pgn-spacing-card-logo-bottom-offset-base));
353
353
  width: var(--pgn-size-card-logo-width);
354
354
  height: var(--pgn-size-card-logo-height);
355
+ object-fit: scale-down;
356
+ object-position: center center;
355
357
  border-radius: var(--pgn-size-card-border-radius-logo);
356
358
  box-shadow: var(--pgn-elevation-box-shadow-level-1);
357
359
  padding: map_get($spacers, 2);
@@ -392,7 +394,7 @@ a.pgn__card {
392
394
  }
393
395
 
394
396
  .pgn__card-status__heading {
395
- font-size: var(--pgn-typography-font-size-h4);
397
+ font-size: var(--pgn-typography-font-size-h4-base);
396
398
  color: var(--pgn-color-black);
397
399
  display: flex;
398
400
  font-weight: var(--pgn-typography-font-weight-bold);
@@ -1,3 +1,26 @@
1
+ :root {
2
+ --pgn-transition-carousel-base:
3
+ var(--pgn-transition-carousel-base-property)
4
+ var(--pgn-transition-carousel-base-duration)
5
+ var(--pgn-transition-carousel-base-timing-function)
6
+ var(--pgn-transition-carousel-base-delay)
7
+ var(--pgn-transition-carousel-base-behavior);
8
+
9
+ --pgn-transition-carousel-indicator:
10
+ var(--pgn-transition-carousel-indicator-property)
11
+ var(--pgn-transition-carousel-indicator-duration)
12
+ var(--pgn-transition-carousel-indicator-timing-function)
13
+ var(--pgn-transition-carousel-indicator-delay)
14
+ var(--pgn-transition-carousel-indicator-behavior);
15
+
16
+ --pgn-transition-carousel-control:
17
+ var(--pgn-transition-carousel-control-property)
18
+ var(--pgn-transition-carousel-control-duration)
19
+ var(--pgn-transition-carousel-control-timing-function)
20
+ var(--pgn-transition-carousel-control-delay)
21
+ var(--pgn-transition-carousel-control-behavior);
22
+ }
23
+
1
24
  .carousel {
2
25
  position: relative;
3
26
  }
@@ -58,7 +81,7 @@
58
81
  .active.carousel-item-right {
59
82
  z-index: 0;
60
83
  opacity: 0;
61
- transition: opacity 0s var(--pgn-transition-carousel-base);
84
+ transition: var(--pgn-transition-carousel-base);
62
85
  }
63
86
  }
64
87
 
@@ -1,3 +1,11 @@
1
+ :root {
2
+ --pgn-elevation-close-button-text-shadow:
3
+ var(--pgn-elevation-close-button-text-shadow-offset-x)
4
+ var(--pgn-elevation-close-button-text-shadow-offset-y)
5
+ var(--pgn-elevation-close-button-text-shadow-blur)
6
+ var(--pgn-elevation-close-button-text-shadow-color);
7
+ }
8
+
1
9
  .close {
2
10
  float: right;
3
11
  font-weight: var(--pgn-typography-close-button-font-weight);
@@ -37,7 +37,7 @@
37
37
 
38
38
  .pgn__hex-label {
39
39
  font-weight: bold;
40
- font-size: var(--pgn-typography-font-size-mobile-h5);
40
+ font-size: var(--pgn-typography-font-size-h5-mobile);
41
41
  padding: .5rem;
42
42
  margin-bottom: 0 !important;
43
43
  }
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
- import Container from '.';
3
+ import Container, { type ContainerSize } from '.';
4
4
 
5
- const getClassNames = (container) => container.className.split(' ');
5
+ const getClassNames = (container: HTMLElement) => container.className.split(' ');
6
6
 
7
7
  describe('<Container />', () => {
8
8
  it('displays children', () => {
@@ -12,32 +12,38 @@ describe('<Container />', () => {
12
12
 
13
13
  it('adds the .container-fluid class', () => {
14
14
  const { container } = render(<Container>Content</Container>);
15
- const containerElement = container.firstChild;
15
+ const containerElement = container.firstChild as HTMLElement;
16
16
  expect(getClassNames(containerElement)).toContain('container-fluid');
17
17
  });
18
18
 
19
19
  it('adds the .container class', () => {
20
20
  const { container } = render(<Container fluid={false}>Content</Container>);
21
- const containerElement = container.firstChild;
22
- expect(getClassNames(containerElement)).toContain('container');
21
+ const containerElement = container.firstChild as HTMLElement;
22
+ expect(getClassNames(containerElement!)).toContain('container');
23
23
  expect(getClassNames(containerElement)).not.toContain('container-fluid');
24
24
  });
25
25
 
26
- ['xs', 'sm', 'md', 'lg', 'xl'].forEach((size) => {
26
+ ['xs', 'sm', 'md', 'lg', 'xl'].forEach((size: ContainerSize) => {
27
27
  it(`adds the .container-mw-${size} class`, () => {
28
28
  const { container } = render(<Container size={size}>Content</Container>);
29
- const containerElement = container.firstChild;
29
+ const containerElement = container.firstChild as HTMLElement;
30
30
  expect(getClassNames(containerElement)).toContain(`container-mw-${size}`);
31
31
  });
32
32
  });
33
33
 
34
+ it('does not add a size class when size is not specified', () => {
35
+ const { container } = render(<Container>Content</Container>);
36
+ const containerElement = container.firstChild as HTMLElement;
37
+ expect(getClassNames(containerElement)).toEqual(['container-fluid']);
38
+ });
39
+
34
40
  it('preserves custom class names', () => {
35
41
  const { container } = render(
36
42
  <Container className="custom-class" size="md">
37
43
  Content
38
44
  </Container>,
39
45
  );
40
- const containerElement = container.firstChild;
46
+ const containerElement = container.firstChild as HTMLElement;
41
47
  expect(getClassNames(containerElement)).toContain('container-mw-md');
42
48
  expect(getClassNames(containerElement)).toContain('container-fluid');
43
49
  expect(getClassNames(containerElement)).toContain('custom-class');
@@ -19,6 +19,10 @@ The base container to contain, pad, and center content in the viewport. This com
19
19
  ```jsx live
20
20
  <div style={{ overflowX: 'auto' }}>
21
21
  <div style={{ width: '1500px', border: 'solid 3px red' }}>
22
+ <Container className="bg-danger-300 my-4">
23
+ The content in this container doesn't have a max width
24
+ </Container>
25
+
22
26
  <Container size="xl" className="bg-danger-300 my-4">
23
27
  The content in this container won't exceed the extra large width.
24
28
  </Container>
@@ -0,0 +1,64 @@
1
+ /* eslint-disable react/require-default-props */
2
+ import React from 'react';
3
+ import classNames from 'classnames';
4
+ import PropTypes from 'prop-types';
5
+ import RBContainer, { type ContainerProps as RBContainerProps } from 'react-bootstrap/Container';
6
+
7
+ import type { ComponentWithAsProp } from '../utils/types/bootstrap';
8
+
9
+ enum ContainerSizeClass {
10
+ xs = 'container-mw-xs',
11
+ sm = 'container-mw-sm',
12
+ md = 'container-mw-md',
13
+ lg = 'container-mw-lg',
14
+ xl = 'container-mw-xl',
15
+ }
16
+
17
+ export type ContainerSize = keyof typeof ContainerSizeClass;
18
+
19
+ interface ContainerProps extends RBContainerProps {
20
+ size?: ContainerSize;
21
+ }
22
+
23
+ type ContainerType = ComponentWithAsProp<'div', ContainerProps>;
24
+
25
+ const Container: ContainerType = React.forwardRef<Element, ContainerProps>(({
26
+ size,
27
+ children,
28
+ ...props
29
+ }, ref) => (
30
+ <RBContainer
31
+ {...props}
32
+ ref={ref}
33
+ className={classNames(
34
+ props.className,
35
+ size && ContainerSizeClass[size],
36
+ )}
37
+ >
38
+ {children}
39
+ </RBContainer>
40
+ ));
41
+
42
+ Container.propTypes = {
43
+ ...RBContainer.propTypes,
44
+ /** Override the base element */
45
+ as: PropTypes.elementType,
46
+ /** Specifies the contents of the container */
47
+ children: PropTypes.node,
48
+ /** Fill all available space at any breakpoint */
49
+ fluid: PropTypes.bool,
50
+ /** Set the maximum width for the container. Omiting the prop will remove the max-width */
51
+ size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
52
+ /** Overrides underlying component base CSS class name */
53
+ bsPrefix: PropTypes.string,
54
+ };
55
+
56
+ Container.defaultProps = {
57
+ as: 'div',
58
+ children: undefined,
59
+ fluid: true,
60
+ size: undefined,
61
+ bsPrefix: 'container',
62
+ };
63
+
64
+ export default Container;
@@ -1,3 +1,15 @@
1
+ :root {
2
+ --pgn-elevation-data-table-box-shadow:
3
+ var(--pgn-elevation-data-table-box-shadow-offset-x)
4
+ var(--pgn-elevation-data-table-box-shadow-offset-y)
5
+ var(--pgn-elevation-data-table-box-shadow-blur)
6
+ var(--pgn-elevation-data-table-box-shadow-color);
7
+
8
+ --pgn-spacing-data-table-padding-cell:
9
+ var(--pgn-spacing-data-table-padding-cell-x)
10
+ var(--pgn-spacing-data-table-padding-cell-y);
11
+ }
12
+
1
13
  .pgn__data-table-wrapper {
2
14
  font-size: var(--pgn-typography-font-size-sm);
3
15
  border-radius: var(--pgn-size-border-radius-base);
@@ -8,6 +8,13 @@ import DataTableContext from '../../DataTableContext';
8
8
  import * as selectActions from '../data/actions';
9
9
  import { getRowIds } from '../data/helpers';
10
10
 
11
+ function DataTableContextChild() {
12
+ const contextValue = useContext(DataTableContext);
13
+ return (
14
+ <div className="context-value" data-contextvalue={contextValue} />
15
+ );
16
+ }
17
+
11
18
  // eslint-disable-next-line react/prop-types
12
19
  function ControlledSelectHeaderWrapper({ tableProps, selectProps, ...rest }) {
13
20
  return (
@@ -18,13 +25,6 @@ function ControlledSelectHeaderWrapper({ tableProps, selectProps, ...rest }) {
18
25
  );
19
26
  }
20
27
 
21
- function DataTableContextChild() {
22
- const contextValue = useContext(DataTableContext);
23
- return (
24
- <div className="context-value" data-contextvalue={contextValue} />
25
- );
26
- }
27
-
28
28
  const mockToggleAllPageRowsSelectedProps = jest.fn();
29
29
  const rows = [{ id: 1 }, { id: 2 }];
30
30
  const tableProps = {
@@ -1,3 +1,9 @@
1
+ :root {
2
+ --pgn-spacing-dropdown-padding-header:
3
+ var(--pgn-spacing-dropdown-padding-header-y)
4
+ var(--pgn-spacing-dropdown-padding-header-x);
5
+ }
6
+
1
7
  .dropup,
2
8
  .dropright,
3
9
  .dropdown,