@ndlib/component-library 0.0.10 → 0.0.14

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 (131) hide show
  1. package/dist/FontLoader.d.ts +1 -0
  2. package/dist/FontLoader.js +4 -0
  3. package/dist/components/composites/Card/Card.stories.d.ts +9 -0
  4. package/dist/components/composites/Card/Card.stories.js +77 -0
  5. package/dist/components/composites/Card/Card.test.d.ts +1 -0
  6. package/dist/components/composites/Card/Card.test.js +29 -0
  7. package/dist/components/composites/Card/index.d.ts +22 -0
  8. package/dist/components/composites/Card/index.js +71 -0
  9. package/dist/components/elements/Alerts/Alert.stories.d.ts +9 -0
  10. package/dist/components/elements/Alerts/Alert.stories.js +41 -0
  11. package/dist/components/elements/Alerts/Alerts.stories.d.ts +6 -0
  12. package/dist/components/elements/Alerts/Alerts.stories.js +12 -0
  13. package/dist/components/elements/Alerts/Alerts.test.d.ts +1 -0
  14. package/dist/components/elements/Alerts/Alerts.test.js +62 -0
  15. package/dist/components/elements/Alerts/index.d.ts +15 -0
  16. package/dist/components/elements/Alerts/index.js +63 -0
  17. package/dist/components/elements/BrandingBar/BrandingBar.stories.js +1 -1
  18. package/dist/components/elements/BrandingBar/index.js +5 -5
  19. package/dist/components/elements/Button/Button.stories.d.ts +4 -0
  20. package/dist/components/elements/Button/Button.stories.js +42 -9
  21. package/dist/components/elements/Button/Button.test.js +11 -2
  22. package/dist/components/elements/Button/index.d.ts +16 -11
  23. package/dist/components/elements/Button/index.js +84 -34
  24. package/dist/components/elements/Fields/Checkbox/Checkbox.stories.d.ts +6 -0
  25. package/dist/components/elements/Fields/Checkbox/Checkbox.stories.js +17 -0
  26. package/dist/components/elements/Fields/Checkbox/index.d.ts +9 -0
  27. package/dist/components/elements/Fields/Checkbox/index.js +22 -0
  28. package/dist/components/elements/Fields/CheckboxGroup/CheckboxGroup.stories.d.ts +6 -0
  29. package/dist/components/elements/Fields/CheckboxGroup/CheckboxGroup.stories.js +23 -0
  30. package/dist/components/elements/Fields/CheckboxGroup/index.d.ts +14 -0
  31. package/dist/components/elements/Fields/CheckboxGroup/index.js +35 -0
  32. package/dist/components/elements/Fields/Radio/Radio.stories.d.ts +6 -0
  33. package/dist/components/elements/Fields/Radio/Radio.stories.js +17 -0
  34. package/dist/components/elements/Fields/Radio/index.d.ts +9 -0
  35. package/dist/components/elements/Fields/Radio/index.js +22 -0
  36. package/dist/components/elements/Fields/RadioGroup/RadioGroup.stories.d.ts +6 -0
  37. package/dist/components/elements/Fields/RadioGroup/RadioGroup.stories.js +23 -0
  38. package/dist/components/elements/Fields/RadioGroup/index.d.ts +14 -0
  39. package/dist/components/elements/Fields/RadioGroup/index.js +28 -0
  40. package/dist/components/elements/Fields/Select/Select.stories.d.ts +6 -0
  41. package/dist/components/elements/Fields/Select/Select.stories.js +32 -0
  42. package/dist/components/elements/Fields/Select/index.d.ts +16 -0
  43. package/dist/components/elements/Fields/Select/index.js +136 -0
  44. package/dist/components/elements/Fields/TextInput/TextInput.stories.d.ts +6 -0
  45. package/dist/components/elements/Fields/TextInput/TextInput.stories.js +25 -0
  46. package/dist/components/elements/Fields/TextInput/index.d.ts +17 -0
  47. package/dist/components/elements/Fields/TextInput/index.js +60 -0
  48. package/dist/components/elements/Fields/option.d.ts +15 -0
  49. package/dist/components/elements/Fields/option.js +3 -0
  50. package/dist/components/elements/Group/index.js +3 -3
  51. package/dist/components/elements/Icon/Icon.stories.d.ts +7 -0
  52. package/dist/components/elements/Icon/Icon.stories.js +29 -0
  53. package/dist/components/elements/Icon/Icon.test.d.ts +1 -0
  54. package/dist/components/elements/Icon/Icon.test.js +26 -0
  55. package/dist/components/elements/Icon/index.d.ts +11 -0
  56. package/dist/components/elements/Icon/index.js +25 -0
  57. package/dist/components/elements/Link/Link.stories.js +3 -3
  58. package/dist/components/elements/Link/Link.test.js +13 -13
  59. package/dist/components/elements/Link/index.d.ts +2 -2
  60. package/dist/components/elements/Link/index.js +4 -4
  61. package/dist/components/elements/List/List.stories.d.ts +9 -0
  62. package/dist/components/elements/List/List.stories.js +31 -0
  63. package/dist/components/elements/List/List.test.d.ts +1 -0
  64. package/dist/components/elements/List/List.test.js +24 -0
  65. package/dist/components/elements/List/index.d.ts +21 -0
  66. package/dist/components/elements/List/index.js +75 -0
  67. package/dist/components/elements/ListBox/Listbox.stories.d.ts +6 -0
  68. package/dist/components/elements/ListBox/Listbox.stories.js +17 -0
  69. package/dist/components/elements/ListBox/index.d.ts +32 -0
  70. package/dist/components/elements/ListBox/index.js +50 -0
  71. package/dist/components/elements/Markdown/Markdown.stories.d.ts +6 -0
  72. package/dist/components/elements/Markdown/Markdown.stories.js +53 -0
  73. package/dist/components/elements/Markdown/Markdown.test.d.ts +1 -0
  74. package/dist/components/elements/Markdown/Markdown.test.js +58 -0
  75. package/dist/components/elements/Markdown/index.d.ts +7 -0
  76. package/dist/components/elements/Markdown/index.js +50 -0
  77. package/dist/components/elements/layout/Box.d.ts +1 -1
  78. package/dist/components/elements/layout/Box.stories.js +1 -1
  79. package/dist/components/elements/layout/Column.d.ts +2 -2
  80. package/dist/components/elements/layout/Column.js +2 -2
  81. package/dist/components/elements/layout/Flex.stories.js +2 -2
  82. package/dist/components/elements/layout/Flex.test.js +2 -2
  83. package/dist/components/elements/layout/Row.d.ts +2 -2
  84. package/dist/components/elements/layout/Row.js +1 -1
  85. package/dist/components/elements/text/Heading/Heading.stories.js +10 -11
  86. package/dist/components/elements/text/Heading/Heading.test.js +1 -1
  87. package/dist/components/elements/text/Heading/index.d.ts +6 -4
  88. package/dist/components/elements/text/Heading/index.js +19 -13
  89. package/dist/components/elements/text/Inline/Inline.stories.d.ts +6 -0
  90. package/dist/components/elements/text/Inline/Inline.stories.js +13 -0
  91. package/dist/components/elements/text/Inline/index.d.ts +7 -0
  92. package/dist/components/elements/text/Inline/index.js +21 -0
  93. package/dist/components/elements/text/Label/Label.stories.js +3 -3
  94. package/dist/components/elements/text/Label/Label.test.js +2 -2
  95. package/dist/components/elements/text/Label/index.d.ts +3 -3
  96. package/dist/components/elements/text/Label/index.js +4 -4
  97. package/dist/components/elements/text/Paragraph/Paragraph.stories.js +2 -2
  98. package/dist/components/elements/text/Paragraph/Paragraph.test.js +1 -1
  99. package/dist/components/elements/text/Paragraph/index.d.ts +2 -2
  100. package/dist/components/elements/text/Paragraph/index.js +2 -2
  101. package/dist/components/providers/alerts.d.ts +41 -0
  102. package/dist/components/providers/alerts.js +133 -0
  103. package/dist/components/providers/componentConfig.d.ts +3 -3
  104. package/dist/components/providers/componentConfig.js +5 -4
  105. package/dist/components/providers/env.d.ts +1 -1
  106. package/dist/components/providers/env.js +3 -3
  107. package/dist/components/providers/theme.js +1 -1
  108. package/dist/components/providers/ui.d.ts +7 -3
  109. package/dist/components/providers/ui.js +8 -6
  110. package/dist/index.d.ts +5 -1
  111. package/dist/index.js +5 -1
  112. package/dist/theme/Color.stories.js +17 -2
  113. package/dist/theme/Typography.stories.d.ts +6 -0
  114. package/dist/theme/Typography.stories.js +43 -0
  115. package/dist/theme/colors.d.ts +11 -1
  116. package/dist/theme/colors.js +20 -0
  117. package/dist/theme/custom.d.ts +3 -0
  118. package/dist/theme/custom.js +5 -0
  119. package/dist/theme/index.d.ts +139 -4
  120. package/dist/theme/index.js +18 -12
  121. package/dist/theme/typography.d.ts +47 -6
  122. package/dist/theme/typography.js +74 -36
  123. package/dist/utils/hooks/useStorage.d.ts +14 -0
  124. package/dist/utils/hooks/useStorage.js +31 -0
  125. package/dist/utils/hooks/useUniqueHtmlId.d.ts +1 -0
  126. package/dist/utils/hooks/useUniqueHtmlId.js +7 -0
  127. package/dist/utils/misc.d.ts +7 -0
  128. package/dist/utils/misc.js +13 -1
  129. package/dist/utils/test.js +3 -1
  130. package/global.css +4 -9
  131. package/package.json +19 -12
@@ -1,8 +1,76 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { Theme, ThemeUICSSObject } from 'theme-ui';
2
+ import { ThemeUICSSObject } from 'theme-ui';
3
3
  import { FONT, FONT_SIZE, FONT_WEIGHT, LINE_HEIGHT } from './typography';
4
4
  import { COLOR } from './colors';
5
- export declare const theme: Theme;
5
+ import { BOX_SHADOW } from './custom';
6
+ export declare const SPACING: string[];
7
+ export declare const theme: {
8
+ colors: {
9
+ text: string;
10
+ background: string;
11
+ transparent: string;
12
+ primary: string;
13
+ primaryHighlight: string;
14
+ secondary: string;
15
+ secondaryHighlight: string;
16
+ textOnPrimary: string;
17
+ textOnSecondary: string;
18
+ lightGray: string;
19
+ faintGray: string;
20
+ ndBlue: string;
21
+ ndGold: string;
22
+ ndSkyBlue: string;
23
+ ndSkyBlueDark: string;
24
+ ndMetallicGold: string;
25
+ ndProvostBlue: string;
26
+ ndSecondary1: string;
27
+ ndSecondary2: string;
28
+ ndSecondary3: string;
29
+ ndSecondary4: string;
30
+ ndSecondary5: string;
31
+ ndSecondary6: string;
32
+ ndTertiary1: string;
33
+ ndTertiary2: string;
34
+ ndTertiary3: string;
35
+ ndTertiary4: string;
36
+ ndTertiary5: string;
37
+ ndTertiary6: string;
38
+ alertInformationalBg: string;
39
+ alertInformationalBorder: string;
40
+ alertInformationalYellowBg: string;
41
+ alertInformationalYellowBorder: string;
42
+ alertWarningBg: string;
43
+ alertWarningBorder: string;
44
+ };
45
+ space: string[];
46
+ boxShadow: typeof BOX_SHADOW;
47
+ fonts: {
48
+ branded: string;
49
+ branded2: string;
50
+ serif: string;
51
+ normal: string;
52
+ };
53
+ fontSizes: {
54
+ xs: string;
55
+ sm: string;
56
+ ms: string;
57
+ md: string;
58
+ ml: string;
59
+ lg: string;
60
+ xl: string;
61
+ xxl: string;
62
+ };
63
+ lineHeights: {
64
+ normal: number;
65
+ condensed: number;
66
+ };
67
+ fontWeights: {
68
+ normal: number;
69
+ heading: number;
70
+ bold: number;
71
+ };
72
+ };
73
+ export type Theme = typeof theme;
6
74
  export type StylesProp = ThemeUICSSObject & {
7
75
  color?: COLOR;
8
76
  bg?: COLOR;
@@ -11,9 +79,76 @@ export type StylesProp = ThemeUICSSObject & {
11
79
  font?: FONT;
12
80
  fontWeight?: FONT_WEIGHT;
13
81
  lineHeight?: LINE_HEIGHT;
82
+ boxShadow?: BOX_SHADOW;
14
83
  };
15
- export type StyledElementProps<E extends Element, CustomProps = object> = {
84
+ export type StyledElementProps<E extends Element, CustomProps = object, Children = React.ReactNode> = {
16
85
  sx?: StylesProp;
17
- children?: React.ReactNode;
86
+ children?: Children;
18
87
  } & React.HTMLAttributes<E> & CustomProps;
88
+ export declare const useTheme: () => {
89
+ colors: {
90
+ text: string;
91
+ background: string;
92
+ transparent: string;
93
+ primary: string;
94
+ primaryHighlight: string;
95
+ secondary: string;
96
+ secondaryHighlight: string;
97
+ textOnPrimary: string;
98
+ textOnSecondary: string;
99
+ lightGray: string;
100
+ faintGray: string;
101
+ ndBlue: string;
102
+ ndGold: string;
103
+ ndSkyBlue: string;
104
+ ndSkyBlueDark: string;
105
+ ndMetallicGold: string;
106
+ ndProvostBlue: string;
107
+ ndSecondary1: string;
108
+ ndSecondary2: string;
109
+ ndSecondary3: string;
110
+ ndSecondary4: string;
111
+ ndSecondary5: string;
112
+ ndSecondary6: string;
113
+ ndTertiary1: string;
114
+ ndTertiary2: string;
115
+ ndTertiary3: string;
116
+ ndTertiary4: string;
117
+ ndTertiary5: string;
118
+ ndTertiary6: string;
119
+ alertInformationalBg: string;
120
+ alertInformationalBorder: string;
121
+ alertInformationalYellowBg: string;
122
+ alertInformationalYellowBorder: string;
123
+ alertWarningBg: string;
124
+ alertWarningBorder: string;
125
+ };
126
+ space: string[];
127
+ boxShadow: typeof BOX_SHADOW;
128
+ fonts: {
129
+ branded: string;
130
+ branded2: string;
131
+ serif: string;
132
+ normal: string;
133
+ };
134
+ fontSizes: {
135
+ xs: string;
136
+ sm: string;
137
+ ms: string;
138
+ md: string;
139
+ ml: string;
140
+ lg: string;
141
+ xl: string;
142
+ xxl: string;
143
+ };
144
+ lineHeights: {
145
+ normal: number;
146
+ condensed: number;
147
+ };
148
+ fontWeights: {
149
+ normal: number;
150
+ heading: number;
151
+ bold: number;
152
+ };
153
+ };
19
154
  export declare const ThemeProvider: React.FC<PropsWithChildren>;
@@ -1,18 +1,24 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ThemeProvider as ThemeUiProvider, } from 'theme-ui';
2
+ import { ThemeProvider as ThemeUiProvider, useThemeUI, } from 'theme-ui';
3
3
  import { fontStyles, } from './typography';
4
4
  import { colors } from './colors';
5
- export const theme = Object.assign(Object.assign({}, fontStyles), { colors, space: [
6
- '0rem',
7
- '0.25rem',
8
- '0.5rem',
9
- '0.75rem',
10
- '1rem',
11
- '1.5rem',
12
- '2rem',
13
- '3rem',
14
- '4rem',
15
- ] });
5
+ import { BOX_SHADOW } from './custom';
6
+ export const SPACING = [
7
+ '0rem',
8
+ '0.25rem',
9
+ '0.5rem',
10
+ '0.75rem',
11
+ '1rem',
12
+ '1.5rem',
13
+ '2rem',
14
+ '3rem',
15
+ '4rem',
16
+ ];
17
+ export const theme = Object.assign(Object.assign({}, fontStyles), { colors, space: SPACING, boxShadow: BOX_SHADOW });
18
+ export const useTheme = () => {
19
+ const { theme } = useThemeUI();
20
+ return theme;
21
+ };
16
22
  export const ThemeProvider = ({ children }) => {
17
23
  return _jsx(ThemeUiProvider, Object.assign({ theme: theme }, { children: children }));
18
24
  };
@@ -1,40 +1,81 @@
1
1
  /** @jsxImportSource theme-ui */
2
- import { Theme } from 'theme-ui';
3
2
  export declare enum FONT {
4
3
  BRANDED = "branded",
5
4
  BRANDED2 = "branded2",
5
+ SERIF = "serif",
6
6
  NORMAL = "normal"
7
7
  }
8
8
  export declare enum FONT_SIZE {
9
9
  XS = "xs",
10
10
  SM = "sm",
11
+ MS = "ms",
11
12
  MD = "md",
13
+ ML = "ml",
12
14
  LG = "lg",
13
15
  XL = "xl",
14
16
  XXL = "xxl"
15
17
  }
18
+ export declare const getIconSize: (fontSize: FONT_SIZE) => FONT_SIZE;
16
19
  export declare enum FONT_WEIGHT {
17
20
  NORMAL = "normal",
21
+ HEADING = "heading",
18
22
  BOLD = "bold"
19
23
  }
20
24
  export declare enum LINE_HEIGHT {
21
25
  NORMAL = "normal",
22
- CONDENSED = "condensed",
23
- EXTRA = "extra"
26
+ CONDENSED = "condensed"
24
27
  }
25
- export declare const fontStyles: Partial<Theme>;
28
+ export declare const fontSizeMap: {
29
+ xs: string;
30
+ sm: string;
31
+ ms: string;
32
+ md: string;
33
+ ml: string;
34
+ lg: string;
35
+ xl: string;
36
+ xxl: string;
37
+ };
38
+ export declare const fontStyles: {
39
+ fonts: {
40
+ branded: string;
41
+ branded2: string;
42
+ serif: string;
43
+ normal: string;
44
+ };
45
+ fontSizes: {
46
+ xs: string;
47
+ sm: string;
48
+ ms: string;
49
+ md: string;
50
+ ml: string;
51
+ lg: string;
52
+ xl: string;
53
+ xxl: string;
54
+ };
55
+ lineHeights: {
56
+ normal: number;
57
+ condensed: number;
58
+ };
59
+ fontWeights: {
60
+ normal: number;
61
+ heading: number;
62
+ bold: number;
63
+ };
64
+ };
26
65
  export declare enum TYPOGRAPHY_TYPE {
27
66
  PARAGRAPH_SMALL = "paragraphSmall",
28
67
  PARAGRAPH_MEDIUM = "paragraphMedium",
29
68
  PARAGRAPH_LARGE = "paragraphLarge",
30
- HEADING_XSMALL = "headingXSmall",
31
69
  HEADING_SMALL = "headingSmall",
32
70
  HEADING_MEDIUM = "headingMedium",
33
71
  HEADING_LARGE = "headingLarge",
34
72
  HEADING_XLARGE = "headingXLarge",
35
73
  CONTROL_SMALL = "controlSmall",
36
74
  CONTROL_MEDIUM = "controlMedium",
37
- CONTROL_LARGE = "controlLarge"
75
+ CONTROL_LARGE = "controlLarge",
76
+ HEADLINE_SMALL = "headlineSmall",
77
+ HEADLINE_MEDIUM = "headlineMedium",
78
+ HEADLINE_LARGE = "headlineLarge"
38
79
  }
39
80
  export declare const typographyStyleMap: {
40
81
  [key in TYPOGRAPHY_TYPE]: {
@@ -1,54 +1,70 @@
1
+ /** @jsxImportSource theme-ui */
1
2
  export var FONT;
2
3
  (function (FONT) {
3
4
  FONT["BRANDED"] = "branded";
4
5
  FONT["BRANDED2"] = "branded2";
6
+ FONT["SERIF"] = "serif";
5
7
  FONT["NORMAL"] = "normal";
6
8
  })(FONT || (FONT = {}));
7
9
  export var FONT_SIZE;
8
10
  (function (FONT_SIZE) {
9
11
  FONT_SIZE["XS"] = "xs";
10
12
  FONT_SIZE["SM"] = "sm";
13
+ FONT_SIZE["MS"] = "ms";
11
14
  FONT_SIZE["MD"] = "md";
15
+ FONT_SIZE["ML"] = "ml";
12
16
  FONT_SIZE["LG"] = "lg";
13
17
  FONT_SIZE["XL"] = "xl";
14
18
  FONT_SIZE["XXL"] = "xxl";
15
19
  })(FONT_SIZE || (FONT_SIZE = {}));
20
+ export const getIconSize = (fontSize) => {
21
+ return {
22
+ [FONT_SIZE.XS]: FONT_SIZE.MD,
23
+ [FONT_SIZE.SM]: FONT_SIZE.LG,
24
+ [FONT_SIZE.MS]: FONT_SIZE.XL,
25
+ [FONT_SIZE.MD]: FONT_SIZE.XL,
26
+ [FONT_SIZE.ML]: FONT_SIZE.XL,
27
+ [FONT_SIZE.LG]: FONT_SIZE.XXL,
28
+ [FONT_SIZE.XL]: FONT_SIZE.XXL,
29
+ [FONT_SIZE.XXL]: FONT_SIZE.XXL,
30
+ }[fontSize];
31
+ };
16
32
  export var FONT_WEIGHT;
17
33
  (function (FONT_WEIGHT) {
18
34
  FONT_WEIGHT["NORMAL"] = "normal";
35
+ FONT_WEIGHT["HEADING"] = "heading";
19
36
  FONT_WEIGHT["BOLD"] = "bold";
20
37
  })(FONT_WEIGHT || (FONT_WEIGHT = {}));
21
- // export enum LETTER_SPACING {
22
- // NORMAL='normal',
23
- // EXTRA='extra',
24
- // }
25
38
  export var LINE_HEIGHT;
26
39
  (function (LINE_HEIGHT) {
27
40
  LINE_HEIGHT["NORMAL"] = "normal";
28
41
  LINE_HEIGHT["CONDENSED"] = "condensed";
29
- LINE_HEIGHT["EXTRA"] = "extra";
30
42
  })(LINE_HEIGHT || (LINE_HEIGHT = {}));
43
+ export const fontSizeMap = {
44
+ [FONT_SIZE.XS]: '0.75rem',
45
+ [FONT_SIZE.SM]: '0.875rem',
46
+ [FONT_SIZE.MS]: '1rem',
47
+ [FONT_SIZE.MD]: '1.25rem',
48
+ [FONT_SIZE.ML]: '1.5rem',
49
+ [FONT_SIZE.LG]: '1.75rem',
50
+ [FONT_SIZE.XL]: '2.0rem',
51
+ [FONT_SIZE.XXL]: '2.25rem',
52
+ };
31
53
  export const fontStyles = {
32
54
  fonts: {
33
55
  [FONT.BRANDED]: 'GPMed, sans-serif',
34
56
  [FONT.BRANDED2]: 'GPCMed, sans-serif',
35
- [FONT.NORMAL]: "Inter, Roboto, 'Helvetica Neue', sans-serif",
36
- },
37
- fontSizes: {
38
- [FONT_SIZE.XS]: '0.75rem',
39
- [FONT_SIZE.SM]: '0.875rem',
40
- [FONT_SIZE.MD]: '1rem',
41
- [FONT_SIZE.LG]: '1.25rem',
42
- [FONT_SIZE.XL]: '2rem',
43
- [FONT_SIZE.XXL]: '3rem',
57
+ [FONT.SERIF]: '"Sumana", Georgia, "Times New Roman", Times, serif;',
58
+ [FONT.NORMAL]: '"Libre Franklin", "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;',
44
59
  },
60
+ fontSizes: fontSizeMap,
45
61
  lineHeights: {
46
- [LINE_HEIGHT.NORMAL]: 1.2,
47
- [LINE_HEIGHT.CONDENSED]: 1.1,
48
- [LINE_HEIGHT.EXTRA]: 1.3,
62
+ [LINE_HEIGHT.NORMAL]: 1.625,
63
+ [LINE_HEIGHT.CONDENSED]: 1.3,
49
64
  },
50
65
  fontWeights: {
51
66
  [FONT_WEIGHT.NORMAL]: 400,
67
+ [FONT_WEIGHT.HEADING]: 600,
52
68
  [FONT_WEIGHT.BOLD]: 700,
53
69
  },
54
70
  // letterSpacings: {
@@ -61,7 +77,6 @@ export var TYPOGRAPHY_TYPE;
61
77
  TYPOGRAPHY_TYPE["PARAGRAPH_SMALL"] = "paragraphSmall";
62
78
  TYPOGRAPHY_TYPE["PARAGRAPH_MEDIUM"] = "paragraphMedium";
63
79
  TYPOGRAPHY_TYPE["PARAGRAPH_LARGE"] = "paragraphLarge";
64
- TYPOGRAPHY_TYPE["HEADING_XSMALL"] = "headingXSmall";
65
80
  TYPOGRAPHY_TYPE["HEADING_SMALL"] = "headingSmall";
66
81
  TYPOGRAPHY_TYPE["HEADING_MEDIUM"] = "headingMedium";
67
82
  TYPOGRAPHY_TYPE["HEADING_LARGE"] = "headingLarge";
@@ -69,47 +84,52 @@ export var TYPOGRAPHY_TYPE;
69
84
  TYPOGRAPHY_TYPE["CONTROL_SMALL"] = "controlSmall";
70
85
  TYPOGRAPHY_TYPE["CONTROL_MEDIUM"] = "controlMedium";
71
86
  TYPOGRAPHY_TYPE["CONTROL_LARGE"] = "controlLarge";
87
+ TYPOGRAPHY_TYPE["HEADLINE_SMALL"] = "headlineSmall";
88
+ TYPOGRAPHY_TYPE["HEADLINE_MEDIUM"] = "headlineMedium";
89
+ TYPOGRAPHY_TYPE["HEADLINE_LARGE"] = "headlineLarge";
72
90
  })(TYPOGRAPHY_TYPE || (TYPOGRAPHY_TYPE = {}));
73
91
  export const typographyStyleMap = {
74
92
  [TYPOGRAPHY_TYPE.PARAGRAPH_SMALL]: {
75
93
  fontFamily: FONT.NORMAL,
76
94
  fontSize: FONT_SIZE.SM,
77
- lineHeight: LINE_HEIGHT.EXTRA,
95
+ lineHeight: LINE_HEIGHT.NORMAL,
96
+ fontWeight: FONT_WEIGHT.NORMAL,
78
97
  },
79
98
  [TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM]: {
80
99
  fontFamily: FONT.NORMAL,
81
- fontSize: FONT_SIZE.MD,
100
+ fontSize: FONT_SIZE.MS,
82
101
  lineHeight: LINE_HEIGHT.NORMAL,
102
+ fontWeight: FONT_WEIGHT.NORMAL,
83
103
  },
84
104
  [TYPOGRAPHY_TYPE.PARAGRAPH_LARGE]: {
85
105
  fontFamily: FONT.NORMAL,
86
- fontSize: FONT_SIZE.LG,
87
- lineHeight: LINE_HEIGHT.NORMAL,
88
- },
89
- [TYPOGRAPHY_TYPE.HEADING_XSMALL]: {
90
- fontFamily: FONT.BRANDED2,
91
- fontSize: FONT_SIZE.SM,
106
+ fontSize: FONT_SIZE.MD,
92
107
  lineHeight: LINE_HEIGHT.NORMAL,
108
+ fontWeight: FONT_WEIGHT.NORMAL,
93
109
  },
94
110
  [TYPOGRAPHY_TYPE.HEADING_SMALL]: {
95
- fontFamily: FONT.BRANDED2,
111
+ fontFamily: FONT.NORMAL,
96
112
  fontSize: FONT_SIZE.MD,
97
- lineHeight: LINE_HEIGHT.NORMAL,
113
+ fontWeight: FONT_WEIGHT.HEADING,
114
+ lineHeight: LINE_HEIGHT.CONDENSED,
98
115
  },
99
116
  [TYPOGRAPHY_TYPE.HEADING_MEDIUM]: {
100
- fontFamily: FONT.BRANDED,
117
+ fontFamily: FONT.BRANDED2,
101
118
  fontSize: FONT_SIZE.LG,
102
- lineHeight: LINE_HEIGHT.NORMAL,
119
+ fontWeight: FONT_WEIGHT.HEADING,
120
+ lineHeight: LINE_HEIGHT.CONDENSED,
103
121
  },
104
122
  [TYPOGRAPHY_TYPE.HEADING_LARGE]: {
105
- fontFamily: FONT.BRANDED,
123
+ fontFamily: FONT.BRANDED2,
106
124
  fontSize: FONT_SIZE.XL,
107
- lineHeight: LINE_HEIGHT.NORMAL,
125
+ fontWeight: FONT_WEIGHT.HEADING,
126
+ lineHeight: LINE_HEIGHT.CONDENSED,
108
127
  },
109
128
  [TYPOGRAPHY_TYPE.HEADING_XLARGE]: {
110
- fontFamily: FONT.BRANDED,
129
+ fontFamily: FONT.BRANDED2,
111
130
  fontSize: FONT_SIZE.XXL,
112
- lineHeight: LINE_HEIGHT.NORMAL,
131
+ fontWeight: FONT_WEIGHT.HEADING,
132
+ lineHeight: LINE_HEIGHT.CONDENSED,
113
133
  },
114
134
  [TYPOGRAPHY_TYPE.CONTROL_SMALL]: {
115
135
  fontFamily: FONT.NORMAL,
@@ -119,16 +139,34 @@ export const typographyStyleMap = {
119
139
  },
120
140
  [TYPOGRAPHY_TYPE.CONTROL_MEDIUM]: {
121
141
  fontFamily: FONT.NORMAL,
122
- fontSize: FONT_SIZE.MD,
142
+ fontSize: FONT_SIZE.MS,
123
143
  fontWeight: FONT_WEIGHT.BOLD,
124
144
  lineHeight: LINE_HEIGHT.NORMAL,
125
145
  },
126
146
  [TYPOGRAPHY_TYPE.CONTROL_LARGE]: {
127
147
  fontFamily: FONT.NORMAL,
128
- fontSize: FONT_SIZE.LG,
148
+ fontSize: FONT_SIZE.ML,
129
149
  fontWeight: FONT_WEIGHT.BOLD,
130
150
  lineHeight: LINE_HEIGHT.NORMAL,
131
151
  },
152
+ [TYPOGRAPHY_TYPE.HEADLINE_SMALL]: {
153
+ fontFamily: FONT.SERIF,
154
+ fontSize: FONT_SIZE.MD,
155
+ fontWeight: FONT_WEIGHT.NORMAL,
156
+ lineHeight: LINE_HEIGHT.CONDENSED,
157
+ },
158
+ [TYPOGRAPHY_TYPE.HEADLINE_MEDIUM]: {
159
+ fontFamily: FONT.SERIF,
160
+ fontSize: FONT_SIZE.ML,
161
+ fontWeight: FONT_WEIGHT.NORMAL,
162
+ lineHeight: LINE_HEIGHT.CONDENSED,
163
+ },
164
+ [TYPOGRAPHY_TYPE.HEADLINE_LARGE]: {
165
+ fontFamily: FONT.SERIF,
166
+ fontSize: FONT_SIZE.LG,
167
+ fontWeight: FONT_WEIGHT.NORMAL,
168
+ lineHeight: LINE_HEIGHT.CONDENSED,
169
+ },
132
170
  };
133
171
  export const getTypographyStyles = (typography) => {
134
172
  return typographyStyleMap[typography || TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM];
@@ -0,0 +1,14 @@
1
+ interface _Storage {
2
+ getItem: (key: string) => string | null;
3
+ setItem: (key: string, value: string) => void;
4
+ }
5
+ declare class StorageAdaptor implements _Storage {
6
+ prefix?: string;
7
+ storage: _Storage;
8
+ constructor(prefix?: string);
9
+ getStorageKey(key: string): string;
10
+ getItem(key: string): string | null;
11
+ setItem(key: string, value: string): void;
12
+ }
13
+ export declare const useStorage: (prefix?: string) => StorageAdaptor;
14
+ export {};
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ const fallbackMemory = {};
3
+ const fallbackStorage = {
4
+ getItem(key) {
5
+ return fallbackMemory[key];
6
+ },
7
+ setItem(key, value) {
8
+ fallbackMemory[key] = value;
9
+ },
10
+ };
11
+ class StorageAdaptor {
12
+ constructor(prefix) {
13
+ this.storage = window.sessionStorage || fallbackStorage;
14
+ this.prefix = prefix;
15
+ }
16
+ getStorageKey(key) {
17
+ return this.prefix ? `${this.prefix}-${key}` : key;
18
+ }
19
+ getItem(key) {
20
+ return this.storage.getItem(this.getStorageKey(key));
21
+ }
22
+ setItem(key, value) {
23
+ this.storage.setItem(this.getStorageKey(key), value);
24
+ }
25
+ }
26
+ export const useStorage = (prefix) => {
27
+ const storage = React.useMemo(() => {
28
+ return new StorageAdaptor(prefix);
29
+ }, [prefix]);
30
+ return storage;
31
+ };
@@ -0,0 +1 @@
1
+ export declare const useUniqueHtmlId: (prefix?: string) => string;
@@ -0,0 +1,7 @@
1
+ import { useMemo } from 'react';
2
+ export const useUniqueHtmlId = (prefix) => {
3
+ return useMemo(() => {
4
+ const random = Math.random().toString().slice(2);
5
+ return `${prefix}-${random}`;
6
+ }, [prefix]);
7
+ };
@@ -1,3 +1,10 @@
1
1
  export type DeepPartial<T> = T extends object ? {
2
2
  [P in keyof T]?: DeepPartial<T[P]>;
3
3
  } : T;
4
+ export declare const firstChildAltSelector = ":first-of-type:not(style):not(:first-of-type ~ *),style + *";
5
+ export declare enum KEY_CODES {
6
+ ENTER = "Enter",
7
+ ARROW_UP = "ArrowUp",
8
+ ARROW_DOWN = "ArrowDown",
9
+ ESCAPE = "Escape"
10
+ }
@@ -1 +1,13 @@
1
- export {};
1
+ // :first-child can cause problems with emotion because styles tags are sometimes added before
2
+ // nodes, which can throw off :first-child selector. Not sure if this will actually be an issue
3
+ // for us, but it does create noisy warnings.
4
+ //
5
+ // This work-around mimics :first-child behavior in a way that plays nice with emotion
6
+ export const firstChildAltSelector = ':first-of-type:not(style):not(:first-of-type ~ *),style + *';
7
+ export var KEY_CODES;
8
+ (function (KEY_CODES) {
9
+ KEY_CODES["ENTER"] = "Enter";
10
+ KEY_CODES["ARROW_UP"] = "ArrowUp";
11
+ KEY_CODES["ARROW_DOWN"] = "ArrowDown";
12
+ KEY_CODES["ESCAPE"] = "Escape";
13
+ })(KEY_CODES || (KEY_CODES = {}));
@@ -3,5 +3,7 @@ import { render as rtlRender } from '@testing-library/react';
3
3
  import { UiProvider } from '../components/providers/ui';
4
4
  export const render = (component, configParam) => {
5
5
  const config = configParam || {};
6
- return rtlRender(_jsx(UiProvider, Object.assign({ env: config.env, components: config.components }, { children: component })));
6
+ return rtlRender(_jsx(UiProvider, Object.assign({ env: config.env, components: config.components, alertsConfig: {
7
+ disable: true,
8
+ } }, { children: component })));
7
9
  };
package/global.css CHANGED
@@ -47,13 +47,8 @@ table {
47
47
  @font-face {
48
48
  font-family: GPCMed;
49
49
  font-display: swap;
50
- src: url('https://static.nd.edu/fonts/gp-min/gpc-medium.woff2');
51
- src:url("https://static.nd.edu/fonts/gp-min/gpc-medium.woff2") format("woff2"),url("https://static.nd.edu/fonts/gp-min/gpc-medium.woff") format("woff"),url("https://static.nd.edu/fonts/gp-min/gpc-medium.ttf") format("truetype")
50
+ src:
51
+ url("https://static.nd.edu/fonts/gp-min/gpc-medium.woff2") format("woff2"),
52
+ url("https://static.nd.edu/fonts/gp-min/gpc-medium.woff") format("woff"),
53
+ url("https://static.nd.edu/fonts/gp-min/gpc-medium.ttf") format("truetype")
52
54
  }
53
-
54
- @font-face {
55
- font-family: GPMed;
56
- font-display: swap;
57
- src: url('https://static.nd.edu/fonts/gp-min/gp-medium.woff2');
58
- src:url("https://static.nd.edu/fonts/gp-min/gp-medium.woff2") format("woff2"),url("https://static.nd.edu/fonts/gp-min/gp-medium.woff") format("woff"),url("https://static.nd.edu/fonts/gp-min/gp-medium.ttf") format("truetype")
59
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "0.0.10",
3
+ "version": "0.0.14",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -21,23 +21,25 @@
21
21
  "lint": "eslint src --ext ts,tsx --report-unused-disable-directives && yarn prettier",
22
22
  "lint:fix": "eslint src --ext ts,tsx --report-unused-disable-directives --fix && yarn prettify",
23
23
  "test": "vitest",
24
- "prettier": "prettier --check src/**/*.{ts,tsx}",
25
- "prettify": "prettier --write src/**/*.{ts,tsx}",
24
+ "prettier": "prettier --check \"src/**/*.{ts,tsx}\"",
25
+ "prettify": "prettier --write \"src/**/*.{ts,tsx}\"",
26
26
  "start": "storybook dev -p 6006",
27
27
  "build-storybook": "storybook build -o storybook && touch storybook/.nojekyll",
28
- "build": "tsc"
29
- },
30
- "dependencies": {
31
- "@emotion/react": "^11.11.0",
32
- "@mui/lab": "^5.0.0-alpha.133",
33
- "formik": "^2.2.9",
34
- "theme-ui": "^0.15.7"
28
+ "build": "tsc",
29
+ "debug": "echo src/**/*.tsx"
35
30
  },
36
31
  "peerDependencies": {
32
+ "@emotion/react": "^11.11.0",
33
+ "@emotion/styled": "^11.11.0",
37
34
  "react": "^18.2.0",
38
- "react-dom": "^18.2.0"
35
+ "react-dom": "^18.2.0",
36
+ "theme-ui": "^0.15.7"
39
37
  },
40
38
  "devDependencies": {
39
+ "@emotion/react": "^11.11.0",
40
+ "@emotion/styled": "^11.11.0",
41
+ "@mui/icons-material": "^5.11.16",
42
+ "@mui/material": "^5.11.16",
41
43
  "@storybook/addon-essentials": "^7.0.17",
42
44
  "@storybook/addon-interactions": "^7.0.18",
43
45
  "@storybook/addon-links": "^7.0.17",
@@ -62,12 +64,17 @@
62
64
  "react": "^18.2.0",
63
65
  "react-dom": "^18.2.0",
64
66
  "storybook": "^7.0.17",
67
+ "theme-ui": "^0.15.7",
65
68
  "typescript": "^5.0.2",
66
- "vite": "^4.3.2",
69
+ "vite": "^4.3.9",
67
70
  "vitest": "^0.31.4"
68
71
  },
69
72
  "prettier": {
70
73
  "singleQuote": true,
71
74
  "semi": false
75
+ },
76
+ "dependencies": {
77
+ "@floating-ui/react": "^0.24.5",
78
+ "react-markdown": "^8.0.7"
72
79
  }
73
80
  }