@ndlib/component-library 1.0.30 → 1.0.42

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 (70) hide show
  1. package/README.md +16 -0
  2. package/dist/components/elements/AlertsV2/AlertV2.stories.d.ts +10 -0
  3. package/dist/components/elements/AlertsV2/AlertV2.stories.js +51 -0
  4. package/dist/components/elements/AlertsV2/AlertsV2.module.css +49 -0
  5. package/dist/components/elements/AlertsV2/AlertsV2.stories.d.ts +7 -0
  6. package/dist/components/elements/AlertsV2/AlertsV2.stories.js +17 -0
  7. package/dist/components/elements/AlertsV2/index.d.ts +15 -0
  8. package/dist/components/elements/AlertsV2/index.js +50 -0
  9. package/dist/components/elements/BlockQuoteV2/BlockQuoteV2.module.css +6 -0
  10. package/dist/components/elements/BlockQuoteV2/index.d.ts +4 -0
  11. package/dist/components/elements/BlockQuoteV2/index.js +21 -0
  12. package/dist/components/elements/BrandingBarV2/BrandingBarV2.module.css +68 -0
  13. package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.d.ts +6 -0
  14. package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.js +13 -0
  15. package/dist/components/elements/BrandingBarV2/index.d.ts +2 -0
  16. package/dist/components/elements/BrandingBarV2/index.js +10 -0
  17. package/dist/components/elements/CaptionV2/index.d.ts +2 -0
  18. package/dist/components/elements/CaptionV2/index.js +22 -0
  19. package/dist/components/elements/DatePickerV2/DatePickerV2.stories.d.ts +8 -0
  20. package/dist/components/elements/DatePickerV2/DatePickerV2.stories.js +53 -0
  21. package/dist/components/elements/DatePickerV2/index.d.ts +23 -0
  22. package/dist/components/elements/DatePickerV2/index.js +57 -0
  23. package/dist/components/elements/DropdownV2/DropdownV2.stories.d.ts +8 -0
  24. package/dist/components/elements/DropdownV2/DropdownV2.stories.js +26 -0
  25. package/dist/components/elements/DropdownV2/index.d.ts +26 -0
  26. package/dist/components/elements/DropdownV2/index.js +81 -0
  27. package/dist/components/elements/Heading/index.js +1 -1
  28. package/dist/components/elements/InlineV2/InlineV2.stories.d.ts +6 -0
  29. package/dist/components/elements/InlineV2/InlineV2.stories.js +14 -0
  30. package/dist/components/elements/InlineV2/index.d.ts +6 -0
  31. package/dist/components/elements/InlineV2/index.js +23 -0
  32. package/dist/components/elements/ListV2/ListV2.stories.d.ts +10 -0
  33. package/dist/components/elements/ListV2/ListV2.stories.js +39 -0
  34. package/dist/components/elements/ListV2/index.d.ts +27 -0
  35. package/dist/components/elements/ListV2/index.js +102 -0
  36. package/dist/components/elements/MarkdownV2/MarkdownV2.module.css +39 -0
  37. package/dist/components/elements/MarkdownV2/MarkdownV2.stories.d.ts +10 -0
  38. package/dist/components/elements/MarkdownV2/MarkdownV2.stories.js +130 -0
  39. package/dist/components/elements/MarkdownV2/index.d.ts +11 -0
  40. package/dist/components/elements/MarkdownV2/index.js +123 -0
  41. package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.d.ts +7 -0
  42. package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.js +33 -0
  43. package/dist/components/elements/MonthPickerV2/index.d.ts +14 -0
  44. package/dist/components/elements/MonthPickerV2/index.js +26 -0
  45. package/dist/components/elements/PillV2/PillV2.module.css +29 -0
  46. package/dist/components/elements/PillV2/PillV2.stories.d.ts +8 -0
  47. package/dist/components/elements/PillV2/PillV2.stories.js +42 -0
  48. package/dist/components/elements/PillV2/index.d.ts +21 -0
  49. package/dist/components/elements/PillV2/index.js +79 -0
  50. package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.d.ts +7 -0
  51. package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.js +28 -0
  52. package/dist/components/elements/RadioGroupV2/index.d.ts +16 -0
  53. package/dist/components/elements/RadioGroupV2/index.js +27 -0
  54. package/dist/components/elements/RadioV2/RadioV2.module.css +17 -0
  55. package/dist/components/elements/RadioV2/RadioV2.stories.d.ts +6 -0
  56. package/dist/components/elements/RadioV2/RadioV2.stories.js +19 -0
  57. package/dist/components/elements/RadioV2/index.d.ts +8 -0
  58. package/dist/components/elements/RadioV2/index.js +23 -0
  59. package/dist/components/elements/TabListV2/TabListV2.module.css +21 -0
  60. package/dist/components/elements/TabListV2/TabListV2.stories.d.ts +6 -0
  61. package/dist/components/elements/TabListV2/TabListV2.stories.js +14 -0
  62. package/dist/components/elements/TabListV2/example.d.ts +7 -0
  63. package/dist/components/elements/TabListV2/example.js +36 -0
  64. package/dist/components/elements/TabListV2/index.d.ts +10 -0
  65. package/dist/components/elements/TabListV2/index.js +31 -0
  66. package/dist/index.d.ts +11 -0
  67. package/dist/index.js +11 -0
  68. package/dist/utils/sanitizeHtml.d.ts +1 -0
  69. package/dist/utils/sanitizeHtml.js +25 -1
  70. package/package.json +6 -1
package/dist/index.js CHANGED
@@ -4,8 +4,10 @@ export { COLOR, colors } from './theme/colors';
4
4
  export { TYPOGRAPHY_TYPE, FONT, FONT_SIZE, FONT_WEIGHT, LINE_HEIGHT, } from './theme/typography';
5
5
  export { GlobalStyles } from './theme/GlobalStyles';
6
6
  export { Alert, Alerts } from './components/elements/Alerts';
7
+ export { AlertV2, AlertsV2 } from './components/elements/AlertsV2';
7
8
  export { ArrowLink } from './components/elements/ArrowLink';
8
9
  export { BrandingBar } from './components/elements/BrandingBar';
10
+ export { BrandingBarV2 } from './components/elements/BrandingBarV2';
9
11
  export { Button, BUTTON_SIZE, BUTTON_TYPE, LinkButton, } from './components/elements/Button';
10
12
  export { ButtonV2, BUTTONV2_SIZE, BUTTONV2_TYPE, LinkButtonV2, } from './components/elements/ButtonV2';
11
13
  export { Heading, HEADING_SIZE } from './components/elements/Heading';
@@ -17,6 +19,7 @@ export { ParagraphV2, PARAGRAPHV2_SIZE, } from './components/elements/ParagraphV
17
19
  export { Group, useGroup, GROUP_TYPE } from './components/elements/Group';
18
20
  export { GroupV2, useGroupV2, GROUPV2_TYPE, } from './components/elements/GroupV2';
19
21
  export { Markdown } from './components/elements/Markdown';
22
+ export { MarkdownV2 } from './components/elements/MarkdownV2';
20
23
  export { Box } from './components/elements/layout/Box';
21
24
  export { BoxV2 } from './components/elements/BoxV2';
22
25
  export { Column } from './components/elements/layout/Column';
@@ -29,25 +32,33 @@ export { INPUTV2_SIZE, TextInputV2 } from './components/elements/TextInputV2';
29
32
  export { Select } from './components/elements/Select';
30
33
  export { SelectV2 } from './components/elements/SelectV2';
31
34
  export { DatePicker } from './components/elements/DatePicker';
35
+ export { DatePickerV2 } from './components/elements/DatePickerV2';
32
36
  export { MonthPicker } from './components/elements/MonthPicker';
37
+ export { MonthPickerV2 } from './components/elements/MonthPickerV2';
33
38
  export { Checkbox } from './components/elements/Checkbox';
34
39
  export { CheckboxV2 } from './components/elements/CheckboxV2';
35
40
  export { CheckboxGroup } from './components/elements/CheckboxGroup';
36
41
  export { CheckboxGroupV2 } from './components/elements/CheckboxGroupV2';
37
42
  export { ConsentBanner } from './components/elements/ConsentBanner';
38
43
  export { Radio } from './components/elements/Radio';
44
+ export { RadioV2 } from './components/elements/RadioV2';
39
45
  export { RadioGroup } from './components/elements/RadioGroup';
46
+ export { RadioGroupV2 } from './components/elements/RadioGroupV2';
40
47
  export { List, ListItem, LIST_SIZE } from './components/elements/List';
48
+ export { ListV2, ListItemV2, LISTV2_SIZE } from './components/elements/ListV2';
41
49
  export { ReadMore } from './components/elements/ReadMore';
42
50
  export { ReadMoreV2 } from './components/elements/ReadMoreV2';
43
51
  export { Icon } from './components/elements/Icon';
44
52
  export { IconV2 } from './components/elements/IconV2';
45
53
  export { Dropdown } from './components/elements/Dropdown';
54
+ export { DropdownV2 } from './components/elements/DropdownV2';
46
55
  export { Spinner, SPINNER_SIZE } from './components/elements/Spinner';
47
56
  export { SpinnerV2, SPINNERV2_SIZE } from './components/elements/SpinnerV2';
48
57
  export { Pill, PILL_SIZE, PILL_TYPE } from './components/elements/Pill';
58
+ export { PillV2, PILLV2_SIZE, PILLV2_TYPE } from './components/elements/PillV2';
49
59
  export { Table, TableColumn } from './components/elements/Table';
50
60
  export { TabList, Tab } from './components/elements/TabList';
61
+ export { TabListV2, TabV2 } from './components/elements/TabListV2';
51
62
  export { RawHtml } from './components/elements/RawHtml';
52
63
  export { ListBoxV2 } from './components/elements/ListBoxV2';
53
64
  export { Card, CARD_SIZE, CARD_LAYOUT } from './components/composites/Card';
@@ -4,6 +4,7 @@ export declare const DEFAULT_ALLOWED_ATTRIBUTES: {
4
4
  iframe: string[];
5
5
  img: string[];
6
6
  p: string[];
7
+ span: string[];
7
8
  figure: string[];
8
9
  a: sanitize.AllowedAttribute[];
9
10
  };
@@ -1,9 +1,14 @@
1
1
  import sanitize from 'sanitize-html';
2
+ const BRAND_COLORS = ['#000000', '#0c2340', '#1c4f8f', '#ae9142'].map((c) => c.toLowerCase());
3
+ const isAllowedColor = (styleString) => {
4
+ return BRAND_COLORS.some((color) => styleString.toLowerCase().includes(color));
5
+ };
2
6
  export const DEFAULT_ALLOWED_TAGS = sanitize.defaults.allowedTags.concat([
3
7
  'iframe',
4
8
  'img',
5
9
  'p',
6
10
  'figure',
11
+ 'span',
7
12
  ]);
8
13
  export const DEFAULT_ALLOWED_ATTRIBUTES = Object.assign(Object.assign({}, sanitize.defaults.allowedAttributes), { iframe: [
9
14
  'src',
@@ -13,7 +18,7 @@ export const DEFAULT_ALLOWED_ATTRIBUTES = Object.assign(Object.assign({}, saniti
13
18
  'allowfullscreen',
14
19
  'webkitallowfullscreen',
15
20
  'mozallowfullscreen',
16
- ], img: ['*'], p: ['*'], figure: ['class'], a: sanitize.defaults.allowedAttributes.a.concat([
21
+ ], img: ['*'], p: ['*'], span: ['style'], figure: ['class'], a: sanitize.defaults.allowedAttributes.a.concat([
17
22
  'id',
18
23
  'class',
19
24
  'data-card-width',
@@ -23,5 +28,24 @@ export const sanitizeHtml = (content) => {
23
28
  return sanitize(content, {
24
29
  allowedTags: DEFAULT_ALLOWED_TAGS,
25
30
  allowedAttributes: DEFAULT_ALLOWED_ATTRIBUTES,
31
+ transformTags: {
32
+ span: (_tagName, attribs) => {
33
+ const newAttributes = {};
34
+ if (attribs.style) {
35
+ const colorMatch = attribs.style.match(/color\s*:\s*([^;]+)/i);
36
+ if (colorMatch) {
37
+ const colorValue = colorMatch[0];
38
+ if (isAllowedColor(colorValue) &&
39
+ !colorValue.includes('transparent')) {
40
+ newAttributes.style = colorValue;
41
+ }
42
+ }
43
+ }
44
+ return {
45
+ tagName: 'span',
46
+ attribs: newAttributes,
47
+ };
48
+ },
49
+ },
26
50
  });
27
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "1.0.30",
3
+ "version": "1.0.42",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -17,6 +17,11 @@
17
17
  "type": "git",
18
18
  "url": "https://github.com/ndlibrary/hesburgh-component-library.git"
19
19
  },
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "registry": "https://registry.npmjs.org/",
23
+ "provenance": false
24
+ },
20
25
  "scripts": {
21
26
  "prepare": "husky install",
22
27
  "test-build": "echo '\n\nTesting Build...' && tsc --noEmit",