@ndlib/component-library 0.0.7-9.1
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.
- package/README.md +101 -0
- package/dist/FontLoader.d.ts +1 -0
- package/dist/FontLoader.js +4 -0
- package/dist/components/composites/Card/Card.stories.d.ts +13 -0
- package/dist/components/composites/Card/Card.stories.js +122 -0
- package/dist/components/composites/Card/Card.test.d.ts +1 -0
- package/dist/components/composites/Card/Card.test.js +37 -0
- package/dist/components/composites/Card/index.d.ts +36 -0
- package/dist/components/composites/Card/index.js +89 -0
- package/dist/components/composites/DragDropList/DragDropList.stories.d.ts +7 -0
- package/dist/components/composites/DragDropList/DragDropList.stories.js +32 -0
- package/dist/components/composites/DragDropList/index.d.ts +25 -0
- package/dist/components/composites/DragDropList/index.js +48 -0
- package/dist/components/composites/DropdownLinks/DropdownLinks.stories.d.ts +8 -0
- package/dist/components/composites/DropdownLinks/DropdownLinks.stories.js +25 -0
- package/dist/components/composites/DropdownLinks/DropdownLinks.test.d.ts +1 -0
- package/dist/components/composites/DropdownLinks/DropdownLinks.test.js +27 -0
- package/dist/components/composites/DropdownLinks/index.d.ts +15 -0
- package/dist/components/composites/DropdownLinks/index.js +28 -0
- package/dist/components/composites/EmptyState/EmptyState.stories.d.ts +10 -0
- package/dist/components/composites/EmptyState/EmptyState.stories.js +31 -0
- package/dist/components/composites/EmptyState/EmptyState.test.d.ts +1 -0
- package/dist/components/composites/EmptyState/EmptyState.test.js +20 -0
- package/dist/components/composites/EmptyState/index.d.ts +15 -0
- package/dist/components/composites/EmptyState/index.js +32 -0
- package/dist/components/composites/Modal/Modal.stories.d.ts +6 -0
- package/dist/components/composites/Modal/Modal.stories.js +40 -0
- package/dist/components/composites/Modal/index.d.ts +21 -0
- package/dist/components/composites/Modal/index.js +64 -0
- package/dist/components/composites/NavMenu/NavMenu.stories.d.ts +6 -0
- package/dist/components/composites/NavMenu/NavMenu.stories.js +12 -0
- package/dist/components/composites/NavMenu/NavMenu.test.d.ts +1 -0
- package/dist/components/composites/NavMenu/NavMenu.test.js +96 -0
- package/dist/components/composites/NavMenu/demo.d.ts +1 -0
- package/dist/components/composites/NavMenu/demo.js +172 -0
- package/dist/components/composites/NavMenu/index.d.ts +5 -0
- package/dist/components/composites/NavMenu/index.js +52 -0
- package/dist/components/composites/Seo/SeoDataDisplay/index.d.ts +2 -0
- package/dist/components/composites/Seo/SeoDataDisplay/index.js +9 -0
- package/dist/components/composites/Seo/index.d.ts +11 -0
- package/dist/components/composites/Seo/index.js +16 -0
- package/dist/components/composites/Seo/seo.stories.d.ts +6 -0
- package/dist/components/composites/Seo/seo.stories.js +12 -0
- package/dist/components/composites/Seo/seo.test.d.ts +1 -0
- package/dist/components/composites/Seo/seo.test.js +56 -0
- package/dist/components/composites/Seo/siteMetadata.d.ts +9 -0
- package/dist/components/composites/Seo/siteMetadata.js +16 -0
- package/dist/components/composites/SnackBar/SnackBar.stories.d.ts +8 -0
- package/dist/components/composites/SnackBar/SnackBar.stories.js +20 -0
- package/dist/components/composites/SnackBar/SnackBar.test.d.ts +1 -0
- package/dist/components/composites/SnackBar/SnackBar.test.js +75 -0
- package/dist/components/composites/SnackBar/examples.d.ts +3 -0
- package/dist/components/composites/SnackBar/examples.js +35 -0
- package/dist/components/composites/SnackBar/index.d.ts +1 -0
- package/dist/components/composites/SnackBar/index.js +45 -0
- package/dist/components/composites/StructuredData/StructuredData.stories.d.ts +6 -0
- package/dist/components/composites/StructuredData/StructuredData.stories.js +12 -0
- package/dist/components/composites/StructuredData/StructuredData.test.d.ts +1 -0
- package/dist/components/composites/StructuredData/StructuredData.test.js +48 -0
- package/dist/components/composites/StructuredData/StructuredDataDisplay/index.d.ts +2 -0
- package/dist/components/composites/StructuredData/StructuredDataDisplay/index.js +37 -0
- package/dist/components/composites/StructuredData/index.d.ts +38 -0
- package/dist/components/composites/StructuredData/index.js +58 -0
- package/dist/components/composites/StructuredData/sdEvent/index.d.ts +13 -0
- package/dist/components/composites/StructuredData/sdEvent/index.js +16 -0
- package/dist/components/composites/StructuredData/sdEvent/makeEventSchema.d.ts +15 -0
- package/dist/components/composites/StructuredData/sdEvent/makeEventSchema.js +16 -0
- package/dist/components/composites/StructuredData/sdNews/index.d.ts +11 -0
- package/dist/components/composites/StructuredData/sdNews/index.js +14 -0
- package/dist/components/composites/StructuredData/sdNews/makeNewsSchema.d.ts +12 -0
- package/dist/components/composites/StructuredData/sdNews/makeNewsSchema.js +11 -0
- package/dist/components/composites/StructuredData/sdWebsite/index.d.ts +8 -0
- package/dist/components/composites/StructuredData/sdWebsite/index.js +11 -0
- package/dist/components/composites/StructuredData/sdWebsite/makeWebPageSchema.d.ts +9 -0
- package/dist/components/composites/StructuredData/sdWebsite/makeWebPageSchema.js +9 -0
- package/dist/components/composites/StructuredData/siteMetadata.d.ts +9 -0
- package/dist/components/composites/StructuredData/siteMetadata.js +12 -0
- package/dist/components/elements/Alerts/Alert.stories.d.ts +9 -0
- package/dist/components/elements/Alerts/Alert.stories.js +41 -0
- package/dist/components/elements/Alerts/Alerts.stories.d.ts +6 -0
- package/dist/components/elements/Alerts/Alerts.stories.js +12 -0
- package/dist/components/elements/Alerts/Alerts.test.d.ts +1 -0
- package/dist/components/elements/Alerts/Alerts.test.js +61 -0
- package/dist/components/elements/Alerts/index.d.ts +14 -0
- package/dist/components/elements/Alerts/index.js +64 -0
- package/dist/components/elements/ArrowLink/ArrowLink.stories.d.ts +6 -0
- package/dist/components/elements/ArrowLink/ArrowLink.stories.js +12 -0
- package/dist/components/elements/ArrowLink/ArrowLink.test.d.ts +1 -0
- package/dist/components/elements/ArrowLink/ArrowLink.test.js +34 -0
- package/dist/components/elements/ArrowLink/index.d.ts +7 -0
- package/dist/components/elements/ArrowLink/index.js +39 -0
- package/dist/components/elements/BrandingBar/BrandingBar.stories.d.ts +6 -0
- package/dist/components/elements/BrandingBar/BrandingBar.stories.js +11 -0
- package/dist/components/elements/BrandingBar/index.d.ts +2 -0
- package/dist/components/elements/BrandingBar/index.js +52 -0
- package/dist/components/elements/Button/Button.stories.d.ts +15 -0
- package/dist/components/elements/Button/Button.stories.js +88 -0
- package/dist/components/elements/Button/Button.test.d.ts +1 -0
- package/dist/components/elements/Button/Button.test.js +39 -0
- package/dist/components/elements/Button/index.d.ts +49 -0
- package/dist/components/elements/Button/index.js +138 -0
- package/dist/components/elements/Dropdown/Dropdown.stories.d.ts +7 -0
- package/dist/components/elements/Dropdown/Dropdown.stories.js +20 -0
- package/dist/components/elements/Dropdown/index.d.ts +24 -0
- package/dist/components/elements/Dropdown/index.js +87 -0
- package/dist/components/elements/Fields/AutoComplete/AutoComplete.stories.d.ts +6 -0
- package/dist/components/elements/Fields/AutoComplete/AutoComplete.stories.js +60 -0
- package/dist/components/elements/Fields/AutoComplete/index.d.ts +11 -0
- package/dist/components/elements/Fields/AutoComplete/index.js +26 -0
- package/dist/components/elements/Fields/Checkbox/Checkbox.stories.d.ts +6 -0
- package/dist/components/elements/Fields/Checkbox/Checkbox.stories.js +17 -0
- package/dist/components/elements/Fields/Checkbox/index.d.ts +8 -0
- package/dist/components/elements/Fields/Checkbox/index.js +22 -0
- package/dist/components/elements/Fields/CheckboxGroup/CheckboxGroup.stories.d.ts +7 -0
- package/dist/components/elements/Fields/CheckboxGroup/CheckboxGroup.stories.js +26 -0
- package/dist/components/elements/Fields/CheckboxGroup/index.d.ts +16 -0
- package/dist/components/elements/Fields/CheckboxGroup/index.js +49 -0
- package/dist/components/elements/Fields/DatePicker/DatePicker.stories.d.ts +8 -0
- package/dist/components/elements/Fields/DatePicker/DatePicker.stories.js +31 -0
- package/dist/components/elements/Fields/DatePicker/index.d.ts +20 -0
- package/dist/components/elements/Fields/DatePicker/index.js +48 -0
- package/dist/components/elements/Fields/MonthPicker/MonthPicker.stories.d.ts +7 -0
- package/dist/components/elements/Fields/MonthPicker/MonthPicker.stories.js +20 -0
- package/dist/components/elements/Fields/MonthPicker/index.d.ts +13 -0
- package/dist/components/elements/Fields/MonthPicker/index.js +24 -0
- package/dist/components/elements/Fields/Radio/Radio.stories.d.ts +6 -0
- package/dist/components/elements/Fields/Radio/Radio.stories.js +17 -0
- package/dist/components/elements/Fields/Radio/index.d.ts +8 -0
- package/dist/components/elements/Fields/Radio/index.js +22 -0
- package/dist/components/elements/Fields/RadioGroup/RadioGroup.stories.d.ts +6 -0
- package/dist/components/elements/Fields/RadioGroup/RadioGroup.stories.js +23 -0
- package/dist/components/elements/Fields/RadioGroup/index.d.ts +14 -0
- package/dist/components/elements/Fields/RadioGroup/index.js +28 -0
- package/dist/components/elements/Fields/Select/Select.stories.d.ts +8 -0
- package/dist/components/elements/Fields/Select/Select.stories.js +39 -0
- package/dist/components/elements/Fields/Select/index.d.ts +18 -0
- package/dist/components/elements/Fields/Select/index.js +178 -0
- package/dist/components/elements/Fields/TextInput/TextInput.stories.d.ts +9 -0
- package/dist/components/elements/Fields/TextInput/TextInput.stories.js +35 -0
- package/dist/components/elements/Fields/TextInput/index.d.ts +45 -0
- package/dist/components/elements/Fields/TextInput/index.js +119 -0
- package/dist/components/elements/Fields/option.d.ts +16 -0
- package/dist/components/elements/Fields/option.js +3 -0
- package/dist/components/elements/Group/index.d.ts +22 -0
- package/dist/components/elements/Group/index.js +69 -0
- package/dist/components/elements/Icon/Icon.stories.d.ts +7 -0
- package/dist/components/elements/Icon/Icon.stories.js +29 -0
- package/dist/components/elements/Icon/Icon.test.d.ts +1 -0
- package/dist/components/elements/Icon/Icon.test.js +26 -0
- package/dist/components/elements/Icon/index.d.ts +10 -0
- package/dist/components/elements/Icon/index.js +34 -0
- package/dist/components/elements/Link/Link.stories.d.ts +6 -0
- package/dist/components/elements/Link/Link.stories.js +21 -0
- package/dist/components/elements/Link/Link.test.d.ts +1 -0
- package/dist/components/elements/Link/Link.test.js +58 -0
- package/dist/components/elements/Link/index.d.ts +14 -0
- package/dist/components/elements/Link/index.js +41 -0
- package/dist/components/elements/List/List.stories.d.ts +10 -0
- package/dist/components/elements/List/List.stories.js +37 -0
- package/dist/components/elements/List/List.test.d.ts +1 -0
- package/dist/components/elements/List/List.test.js +24 -0
- package/dist/components/elements/List/index.d.ts +27 -0
- package/dist/components/elements/List/index.js +103 -0
- package/dist/components/elements/ListBox/Listbox.stories.d.ts +6 -0
- package/dist/components/elements/ListBox/Listbox.stories.js +17 -0
- package/dist/components/elements/ListBox/index.d.ts +33 -0
- package/dist/components/elements/ListBox/index.js +51 -0
- package/dist/components/elements/Markdown/Markdown.stories.d.ts +10 -0
- package/dist/components/elements/Markdown/Markdown.stories.js +97 -0
- package/dist/components/elements/Markdown/Markdown.test.d.ts +1 -0
- package/dist/components/elements/Markdown/Markdown.test.js +91 -0
- package/dist/components/elements/Markdown/index.d.ts +21 -0
- package/dist/components/elements/Markdown/index.js +75 -0
- package/dist/components/elements/Pill/Pill.stories.d.ts +8 -0
- package/dist/components/elements/Pill/Pill.stories.js +40 -0
- package/dist/components/elements/Pill/Pill.test.d.ts +1 -0
- package/dist/components/elements/Pill/Pill.test.js +18 -0
- package/dist/components/elements/Pill/index.d.ts +21 -0
- package/dist/components/elements/Pill/index.js +117 -0
- package/dist/components/elements/Spinner/Spinner.stories.d.ts +7 -0
- package/dist/components/elements/Spinner/Spinner.stories.js +26 -0
- package/dist/components/elements/Spinner/Spinner.test.d.ts +1 -0
- package/dist/components/elements/Spinner/Spinner.test.js +9 -0
- package/dist/components/elements/Spinner/index.d.ts +14 -0
- package/dist/components/elements/Spinner/index.js +49 -0
- package/dist/components/elements/TabList/TabList.stories.d.ts +6 -0
- package/dist/components/elements/TabList/TabList.stories.js +12 -0
- package/dist/components/elements/TabList/TabList.test.d.ts +1 -0
- package/dist/components/elements/TabList/TabList.test.js +19 -0
- package/dist/components/elements/TabList/example.d.ts +7 -0
- package/dist/components/elements/TabList/example.js +36 -0
- package/dist/components/elements/TabList/index.d.ts +10 -0
- package/dist/components/elements/TabList/index.js +30 -0
- package/dist/components/elements/Table/Table.stories.d.ts +10 -0
- package/dist/components/elements/Table/Table.stories.js +96 -0
- package/dist/components/elements/Table/Table.test.d.ts +1 -0
- package/dist/components/elements/Table/Table.test.js +36 -0
- package/dist/components/elements/Table/index.d.ts +30 -0
- package/dist/components/elements/Table/index.js +100 -0
- package/dist/components/elements/layout/Box.d.ts +9 -0
- package/dist/components/elements/layout/Box.js +3 -0
- package/dist/components/elements/layout/Box.stories.d.ts +6 -0
- package/dist/components/elements/layout/Box.stories.js +12 -0
- package/dist/components/elements/layout/Column.d.ts +8 -0
- package/dist/components/elements/layout/Column.js +19 -0
- package/dist/components/elements/layout/Flex.stories.d.ts +10 -0
- package/dist/components/elements/layout/Flex.stories.js +26 -0
- package/dist/components/elements/layout/Flex.test.d.ts +1 -0
- package/dist/components/elements/layout/Flex.test.js +34 -0
- package/dist/components/elements/layout/Row.d.ts +20 -0
- package/dist/components/elements/layout/Row.js +52 -0
- package/dist/components/elements/text/Heading/Heading.stories.d.ts +8 -0
- package/dist/components/elements/text/Heading/Heading.stories.js +35 -0
- package/dist/components/elements/text/Heading/Heading.test.d.ts +1 -0
- package/dist/components/elements/text/Heading/Heading.test.js +51 -0
- package/dist/components/elements/text/Heading/index.d.ts +20 -0
- package/dist/components/elements/text/Heading/index.js +62 -0
- package/dist/components/elements/text/Inline/Inline.stories.d.ts +6 -0
- package/dist/components/elements/text/Inline/Inline.stories.js +12 -0
- package/dist/components/elements/text/Inline/index.d.ts +6 -0
- package/dist/components/elements/text/Inline/index.js +21 -0
- package/dist/components/elements/text/Label/Label.stories.d.ts +6 -0
- package/dist/components/elements/text/Label/Label.stories.js +20 -0
- package/dist/components/elements/text/Label/Label.test.d.ts +1 -0
- package/dist/components/elements/text/Label/Label.test.js +56 -0
- package/dist/components/elements/text/Label/index.d.ts +20 -0
- package/dist/components/elements/text/Label/index.js +38 -0
- package/dist/components/elements/text/Paragraph/Paragraph.stories.d.ts +6 -0
- package/dist/components/elements/text/Paragraph/Paragraph.stories.js +25 -0
- package/dist/components/elements/text/Paragraph/Paragraph.test.d.ts +1 -0
- package/dist/components/elements/text/Paragraph/Paragraph.test.js +9 -0
- package/dist/components/elements/text/Paragraph/index.d.ts +14 -0
- package/dist/components/elements/text/Paragraph/index.js +29 -0
- package/dist/components/elements/text/ReadMore/ReadMore.stories.d.ts +8 -0
- package/dist/components/elements/text/ReadMore/ReadMore.stories.js +26 -0
- package/dist/components/elements/text/ReadMore/index.d.ts +12 -0
- package/dist/components/elements/text/ReadMore/index.js +71 -0
- package/dist/components/providers/alerts.d.ts +41 -0
- package/dist/components/providers/alerts.js +133 -0
- package/dist/components/providers/componentConfig.d.ts +25 -0
- package/dist/components/providers/componentConfig.js +37 -0
- package/dist/components/providers/dialogs.d.ts +9 -0
- package/dist/components/providers/dialogs.js +32 -0
- package/dist/components/providers/env.d.ts +14 -0
- package/dist/components/providers/env.js +25 -0
- package/dist/components/providers/media.d.ts +8 -0
- package/dist/components/providers/media.js +43 -0
- package/dist/components/providers/menu.d.ts +46 -0
- package/dist/components/providers/menu.js +304 -0
- package/dist/components/providers/snackBar.d.ts +23 -0
- package/dist/components/providers/snackBar.js +53 -0
- package/dist/components/providers/ui.d.ts +18 -0
- package/dist/components/providers/ui.js +16 -0
- package/dist/components/providers/uniqueIds.d.ts +3 -0
- package/dist/components/providers/uniqueIds.js +23 -0
- package/dist/components/providers/uniqueIds.test.d.ts +1 -0
- package/dist/components/providers/uniqueIds.test.js +26 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +51 -0
- package/dist/theme/Color.stories.d.ts +5 -0
- package/dist/theme/Color.stories.js +63 -0
- package/dist/theme/GlobalStyles.d.ts +1 -0
- package/dist/theme/GlobalStyles.js +167 -0
- package/dist/theme/Typography.stories.d.ts +5 -0
- package/dist/theme/Typography.stories.js +44 -0
- package/dist/theme/colors.d.ts +51 -0
- package/dist/theme/colors.js +97 -0
- package/dist/theme/custom.d.ts +11 -0
- package/dist/theme/custom.js +13 -0
- package/dist/theme/index.d.ts +185 -0
- package/dist/theme/index.js +25 -0
- package/dist/theme/spacing.d.ts +0 -0
- package/dist/theme/spacing.js +1 -0
- package/dist/theme/typography.d.ts +100 -0
- package/dist/theme/typography.js +206 -0
- package/dist/utils/hooks/useCheckMidClick.d.ts +8 -0
- package/dist/utils/hooks/useCheckMidClick.js +17 -0
- package/dist/utils/hooks/useCheckMidKeyPress.d.ts +9 -0
- package/dist/utils/hooks/useCheckMidKeyPress.js +23 -0
- package/dist/utils/hooks/useHover.d.ts +7 -0
- package/dist/utils/hooks/useHover.js +12 -0
- package/dist/utils/hooks/useStorage.d.ts +14 -0
- package/dist/utils/hooks/useStorage.js +37 -0
- package/dist/utils/misc.d.ts +14 -0
- package/dist/utils/misc.js +19 -0
- package/dist/utils/sortByKey.d.ts +12 -0
- package/dist/utils/sortByKey.js +20 -0
- package/dist/utils/test.d.ts +2 -0
- package/dist/utils/test.js +9 -0
- package/package.json +98 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export declare enum FONT {
|
|
2
|
+
BRANDED = "branded",
|
|
3
|
+
BRANDED2 = "branded2",
|
|
4
|
+
SERIF = "serif",
|
|
5
|
+
NORMAL = "normal"
|
|
6
|
+
}
|
|
7
|
+
export declare enum FONT_SIZE {
|
|
8
|
+
XXS = "xxs",
|
|
9
|
+
XS = "xs",
|
|
10
|
+
SM = "sm",
|
|
11
|
+
MS = "ms",
|
|
12
|
+
MD = "md",
|
|
13
|
+
ML = "ml",
|
|
14
|
+
LG = "lg",
|
|
15
|
+
XL = "xl",
|
|
16
|
+
XXL = "xxl"
|
|
17
|
+
}
|
|
18
|
+
export declare const getIconSize: (fontSize: FONT_SIZE) => FONT_SIZE;
|
|
19
|
+
export declare enum FONT_WEIGHT {
|
|
20
|
+
NORMAL = "normal",
|
|
21
|
+
HEADING = "heading",
|
|
22
|
+
BOLD = "bold"
|
|
23
|
+
}
|
|
24
|
+
export declare enum LINE_HEIGHT {
|
|
25
|
+
NORMAL = "normal",
|
|
26
|
+
CONDENSED = "condensed"
|
|
27
|
+
}
|
|
28
|
+
export declare const fontSizeMap: {
|
|
29
|
+
xxs: string;
|
|
30
|
+
xs: string;
|
|
31
|
+
sm: string;
|
|
32
|
+
ms: string;
|
|
33
|
+
md: string;
|
|
34
|
+
ml: string;
|
|
35
|
+
lg: string;
|
|
36
|
+
xl: string;
|
|
37
|
+
xxl: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const fontStyles: {
|
|
40
|
+
fonts: {
|
|
41
|
+
branded: string;
|
|
42
|
+
branded2: string;
|
|
43
|
+
serif: string;
|
|
44
|
+
normal: string;
|
|
45
|
+
};
|
|
46
|
+
fontSizes: {
|
|
47
|
+
xxs: string;
|
|
48
|
+
xs: string;
|
|
49
|
+
sm: string;
|
|
50
|
+
ms: string;
|
|
51
|
+
md: string;
|
|
52
|
+
ml: string;
|
|
53
|
+
lg: string;
|
|
54
|
+
xl: string;
|
|
55
|
+
xxl: string;
|
|
56
|
+
};
|
|
57
|
+
lineHeights: {
|
|
58
|
+
normal: number;
|
|
59
|
+
condensed: number;
|
|
60
|
+
};
|
|
61
|
+
fontWeights: {
|
|
62
|
+
normal: number;
|
|
63
|
+
heading: number;
|
|
64
|
+
bold: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export declare enum TYPOGRAPHY_TYPE {
|
|
68
|
+
PARAGRAPH_XSMALL = "paragraphXSmall",
|
|
69
|
+
PARAGRAPH_SMALL = "paragraphSmall",
|
|
70
|
+
PARAGRAPH_MEDIUM = "paragraphMedium",
|
|
71
|
+
PARAGRAPH_LARGE = "paragraphLarge",
|
|
72
|
+
CONDENSED_TEXT_XSMALL = "condensedTextXSmall",
|
|
73
|
+
CONDENSED_TEXT_SMALL = "condensedTextSmall",
|
|
74
|
+
CONDENSED_TEXT_MEDIUM = "condensedTextMedium",
|
|
75
|
+
CONDENSED_TEXT_LARGE = "condensedTextLarge",
|
|
76
|
+
HEADING_SMALL = "headingSmall",
|
|
77
|
+
HEADING_MEDIUM = "headingMedium",
|
|
78
|
+
HEADING_LARGE = "headingLarge",
|
|
79
|
+
HEADING_XLARGE = "headingXLarge",
|
|
80
|
+
CONTROL_SMALL = "controlSmall",
|
|
81
|
+
CONTROL_MEDIUM = "controlMedium",
|
|
82
|
+
CONTROL_LARGE = "controlLarge",
|
|
83
|
+
HEADLINE_SMALL = "headlineSmall",
|
|
84
|
+
HEADLINE_MEDIUM = "headlineMedium",
|
|
85
|
+
HEADLINE_LARGE = "headlineLarge"
|
|
86
|
+
}
|
|
87
|
+
export declare const typographyStyleMap: {
|
|
88
|
+
[key in TYPOGRAPHY_TYPE]: {
|
|
89
|
+
fontFamily: FONT;
|
|
90
|
+
fontSize: FONT_SIZE;
|
|
91
|
+
fontWeight?: FONT_WEIGHT;
|
|
92
|
+
lineHeight: LINE_HEIGHT;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export declare const getTypographyStyles: (typography?: TYPOGRAPHY_TYPE) => {
|
|
96
|
+
fontFamily: FONT;
|
|
97
|
+
fontSize: FONT_SIZE;
|
|
98
|
+
fontWeight?: FONT_WEIGHT | undefined;
|
|
99
|
+
lineHeight: LINE_HEIGHT;
|
|
100
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
export var FONT;
|
|
2
|
+
(function (FONT) {
|
|
3
|
+
FONT["BRANDED"] = "branded";
|
|
4
|
+
FONT["BRANDED2"] = "branded2";
|
|
5
|
+
FONT["SERIF"] = "serif";
|
|
6
|
+
FONT["NORMAL"] = "normal";
|
|
7
|
+
})(FONT || (FONT = {}));
|
|
8
|
+
export var FONT_SIZE;
|
|
9
|
+
(function (FONT_SIZE) {
|
|
10
|
+
FONT_SIZE["XXS"] = "xxs";
|
|
11
|
+
FONT_SIZE["XS"] = "xs";
|
|
12
|
+
FONT_SIZE["SM"] = "sm";
|
|
13
|
+
FONT_SIZE["MS"] = "ms";
|
|
14
|
+
FONT_SIZE["MD"] = "md";
|
|
15
|
+
FONT_SIZE["ML"] = "ml";
|
|
16
|
+
FONT_SIZE["LG"] = "lg";
|
|
17
|
+
FONT_SIZE["XL"] = "xl";
|
|
18
|
+
FONT_SIZE["XXL"] = "xxl";
|
|
19
|
+
})(FONT_SIZE || (FONT_SIZE = {}));
|
|
20
|
+
export const getIconSize = (fontSize) => {
|
|
21
|
+
return {
|
|
22
|
+
[FONT_SIZE.XXS]: FONT_SIZE.XS,
|
|
23
|
+
[FONT_SIZE.XS]: FONT_SIZE.SM,
|
|
24
|
+
[FONT_SIZE.SM]: FONT_SIZE.SM,
|
|
25
|
+
[FONT_SIZE.MS]: FONT_SIZE.MD,
|
|
26
|
+
[FONT_SIZE.MD]: FONT_SIZE.MD,
|
|
27
|
+
[FONT_SIZE.ML]: FONT_SIZE.LG,
|
|
28
|
+
[FONT_SIZE.LG]: FONT_SIZE.LG,
|
|
29
|
+
[FONT_SIZE.XL]: FONT_SIZE.XXL,
|
|
30
|
+
[FONT_SIZE.XXL]: FONT_SIZE.XXL,
|
|
31
|
+
}[fontSize];
|
|
32
|
+
};
|
|
33
|
+
export var FONT_WEIGHT;
|
|
34
|
+
(function (FONT_WEIGHT) {
|
|
35
|
+
FONT_WEIGHT["NORMAL"] = "normal";
|
|
36
|
+
FONT_WEIGHT["HEADING"] = "heading";
|
|
37
|
+
FONT_WEIGHT["BOLD"] = "bold";
|
|
38
|
+
})(FONT_WEIGHT || (FONT_WEIGHT = {}));
|
|
39
|
+
export var LINE_HEIGHT;
|
|
40
|
+
(function (LINE_HEIGHT) {
|
|
41
|
+
LINE_HEIGHT["NORMAL"] = "normal";
|
|
42
|
+
LINE_HEIGHT["CONDENSED"] = "condensed";
|
|
43
|
+
})(LINE_HEIGHT || (LINE_HEIGHT = {}));
|
|
44
|
+
export const fontSizeMap = {
|
|
45
|
+
[FONT_SIZE.XXS]: '0.675rem',
|
|
46
|
+
[FONT_SIZE.XS]: '0.75rem',
|
|
47
|
+
[FONT_SIZE.SM]: '0.875rem',
|
|
48
|
+
[FONT_SIZE.MS]: '1rem',
|
|
49
|
+
[FONT_SIZE.MD]: '1.25rem',
|
|
50
|
+
[FONT_SIZE.ML]: '1.5rem',
|
|
51
|
+
[FONT_SIZE.LG]: '1.75rem',
|
|
52
|
+
[FONT_SIZE.XL]: '2.0rem',
|
|
53
|
+
[FONT_SIZE.XXL]: '2.25rem',
|
|
54
|
+
};
|
|
55
|
+
export const fontStyles = {
|
|
56
|
+
fonts: {
|
|
57
|
+
[FONT.BRANDED]: 'GPMed, sans-serif',
|
|
58
|
+
[FONT.BRANDED2]: 'GPCMed, sans-serif',
|
|
59
|
+
[FONT.SERIF]: '"Sumana", Georgia, "Times New Roman", Times, serif;',
|
|
60
|
+
[FONT.NORMAL]: '"Libre Franklin", "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;',
|
|
61
|
+
},
|
|
62
|
+
fontSizes: fontSizeMap,
|
|
63
|
+
lineHeights: {
|
|
64
|
+
[LINE_HEIGHT.NORMAL]: 1.625,
|
|
65
|
+
[LINE_HEIGHT.CONDENSED]: 1.3,
|
|
66
|
+
},
|
|
67
|
+
fontWeights: {
|
|
68
|
+
[FONT_WEIGHT.NORMAL]: 400,
|
|
69
|
+
[FONT_WEIGHT.HEADING]: 600,
|
|
70
|
+
[FONT_WEIGHT.BOLD]: 700,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
export var TYPOGRAPHY_TYPE;
|
|
74
|
+
(function (TYPOGRAPHY_TYPE) {
|
|
75
|
+
TYPOGRAPHY_TYPE["PARAGRAPH_XSMALL"] = "paragraphXSmall";
|
|
76
|
+
TYPOGRAPHY_TYPE["PARAGRAPH_SMALL"] = "paragraphSmall";
|
|
77
|
+
TYPOGRAPHY_TYPE["PARAGRAPH_MEDIUM"] = "paragraphMedium";
|
|
78
|
+
TYPOGRAPHY_TYPE["PARAGRAPH_LARGE"] = "paragraphLarge";
|
|
79
|
+
TYPOGRAPHY_TYPE["CONDENSED_TEXT_XSMALL"] = "condensedTextXSmall";
|
|
80
|
+
TYPOGRAPHY_TYPE["CONDENSED_TEXT_SMALL"] = "condensedTextSmall";
|
|
81
|
+
TYPOGRAPHY_TYPE["CONDENSED_TEXT_MEDIUM"] = "condensedTextMedium";
|
|
82
|
+
TYPOGRAPHY_TYPE["CONDENSED_TEXT_LARGE"] = "condensedTextLarge";
|
|
83
|
+
TYPOGRAPHY_TYPE["HEADING_SMALL"] = "headingSmall";
|
|
84
|
+
TYPOGRAPHY_TYPE["HEADING_MEDIUM"] = "headingMedium";
|
|
85
|
+
TYPOGRAPHY_TYPE["HEADING_LARGE"] = "headingLarge";
|
|
86
|
+
TYPOGRAPHY_TYPE["HEADING_XLARGE"] = "headingXLarge";
|
|
87
|
+
TYPOGRAPHY_TYPE["CONTROL_SMALL"] = "controlSmall";
|
|
88
|
+
TYPOGRAPHY_TYPE["CONTROL_MEDIUM"] = "controlMedium";
|
|
89
|
+
TYPOGRAPHY_TYPE["CONTROL_LARGE"] = "controlLarge";
|
|
90
|
+
TYPOGRAPHY_TYPE["HEADLINE_SMALL"] = "headlineSmall";
|
|
91
|
+
TYPOGRAPHY_TYPE["HEADLINE_MEDIUM"] = "headlineMedium";
|
|
92
|
+
TYPOGRAPHY_TYPE["HEADLINE_LARGE"] = "headlineLarge";
|
|
93
|
+
})(TYPOGRAPHY_TYPE || (TYPOGRAPHY_TYPE = {}));
|
|
94
|
+
export const typographyStyleMap = {
|
|
95
|
+
[TYPOGRAPHY_TYPE.PARAGRAPH_XSMALL]: {
|
|
96
|
+
fontFamily: FONT.NORMAL,
|
|
97
|
+
fontSize: FONT_SIZE.XS,
|
|
98
|
+
lineHeight: LINE_HEIGHT.NORMAL,
|
|
99
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
100
|
+
},
|
|
101
|
+
[TYPOGRAPHY_TYPE.PARAGRAPH_SMALL]: {
|
|
102
|
+
fontFamily: FONT.NORMAL,
|
|
103
|
+
fontSize: FONT_SIZE.SM,
|
|
104
|
+
lineHeight: LINE_HEIGHT.NORMAL,
|
|
105
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
106
|
+
},
|
|
107
|
+
[TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM]: {
|
|
108
|
+
fontFamily: FONT.NORMAL,
|
|
109
|
+
fontSize: FONT_SIZE.MS,
|
|
110
|
+
lineHeight: LINE_HEIGHT.NORMAL,
|
|
111
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
112
|
+
},
|
|
113
|
+
[TYPOGRAPHY_TYPE.PARAGRAPH_LARGE]: {
|
|
114
|
+
fontFamily: FONT.NORMAL,
|
|
115
|
+
fontSize: FONT_SIZE.MD,
|
|
116
|
+
lineHeight: LINE_HEIGHT.NORMAL,
|
|
117
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
118
|
+
},
|
|
119
|
+
[TYPOGRAPHY_TYPE.CONDENSED_TEXT_XSMALL]: {
|
|
120
|
+
fontFamily: FONT.NORMAL,
|
|
121
|
+
fontSize: FONT_SIZE.XS,
|
|
122
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
123
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
124
|
+
},
|
|
125
|
+
[TYPOGRAPHY_TYPE.CONDENSED_TEXT_SMALL]: {
|
|
126
|
+
fontFamily: FONT.NORMAL,
|
|
127
|
+
fontSize: FONT_SIZE.SM,
|
|
128
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
129
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
130
|
+
},
|
|
131
|
+
[TYPOGRAPHY_TYPE.CONDENSED_TEXT_MEDIUM]: {
|
|
132
|
+
fontFamily: FONT.NORMAL,
|
|
133
|
+
fontSize: FONT_SIZE.MS,
|
|
134
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
135
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
136
|
+
},
|
|
137
|
+
[TYPOGRAPHY_TYPE.CONDENSED_TEXT_LARGE]: {
|
|
138
|
+
fontFamily: FONT.NORMAL,
|
|
139
|
+
fontSize: FONT_SIZE.MD,
|
|
140
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
141
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
142
|
+
},
|
|
143
|
+
[TYPOGRAPHY_TYPE.HEADING_SMALL]: {
|
|
144
|
+
fontFamily: FONT.NORMAL,
|
|
145
|
+
fontSize: FONT_SIZE.MD,
|
|
146
|
+
fontWeight: FONT_WEIGHT.HEADING,
|
|
147
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
148
|
+
},
|
|
149
|
+
[TYPOGRAPHY_TYPE.HEADING_MEDIUM]: {
|
|
150
|
+
fontFamily: FONT.BRANDED2,
|
|
151
|
+
fontSize: FONT_SIZE.LG,
|
|
152
|
+
fontWeight: FONT_WEIGHT.HEADING,
|
|
153
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
154
|
+
},
|
|
155
|
+
[TYPOGRAPHY_TYPE.HEADING_LARGE]: {
|
|
156
|
+
fontFamily: FONT.BRANDED2,
|
|
157
|
+
fontSize: FONT_SIZE.XL,
|
|
158
|
+
fontWeight: FONT_WEIGHT.HEADING,
|
|
159
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
160
|
+
},
|
|
161
|
+
[TYPOGRAPHY_TYPE.HEADING_XLARGE]: {
|
|
162
|
+
fontFamily: FONT.BRANDED2,
|
|
163
|
+
fontSize: FONT_SIZE.XXL,
|
|
164
|
+
fontWeight: FONT_WEIGHT.HEADING,
|
|
165
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
166
|
+
},
|
|
167
|
+
[TYPOGRAPHY_TYPE.CONTROL_SMALL]: {
|
|
168
|
+
fontFamily: FONT.NORMAL,
|
|
169
|
+
fontSize: FONT_SIZE.SM,
|
|
170
|
+
fontWeight: FONT_WEIGHT.BOLD,
|
|
171
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
172
|
+
},
|
|
173
|
+
[TYPOGRAPHY_TYPE.CONTROL_MEDIUM]: {
|
|
174
|
+
fontFamily: FONT.NORMAL,
|
|
175
|
+
fontSize: FONT_SIZE.MS,
|
|
176
|
+
fontWeight: FONT_WEIGHT.BOLD,
|
|
177
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
178
|
+
},
|
|
179
|
+
[TYPOGRAPHY_TYPE.CONTROL_LARGE]: {
|
|
180
|
+
fontFamily: FONT.NORMAL,
|
|
181
|
+
fontSize: FONT_SIZE.MD,
|
|
182
|
+
fontWeight: FONT_WEIGHT.BOLD,
|
|
183
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
184
|
+
},
|
|
185
|
+
[TYPOGRAPHY_TYPE.HEADLINE_SMALL]: {
|
|
186
|
+
fontFamily: FONT.SERIF,
|
|
187
|
+
fontSize: FONT_SIZE.MD,
|
|
188
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
189
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
190
|
+
},
|
|
191
|
+
[TYPOGRAPHY_TYPE.HEADLINE_MEDIUM]: {
|
|
192
|
+
fontFamily: FONT.SERIF,
|
|
193
|
+
fontSize: FONT_SIZE.ML,
|
|
194
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
195
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
196
|
+
},
|
|
197
|
+
[TYPOGRAPHY_TYPE.HEADLINE_LARGE]: {
|
|
198
|
+
fontFamily: FONT.SERIF,
|
|
199
|
+
fontSize: FONT_SIZE.LG,
|
|
200
|
+
fontWeight: FONT_WEIGHT.NORMAL,
|
|
201
|
+
lineHeight: LINE_HEIGHT.CONDENSED,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
export const getTypographyStyles = (typography) => {
|
|
205
|
+
return typographyStyleMap[typography || TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM];
|
|
206
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const useCheckMidClick = () => {
|
|
3
|
+
const isMidClick = React.useRef(false);
|
|
4
|
+
const onMouseDown = () => {
|
|
5
|
+
isMidClick.current = true;
|
|
6
|
+
};
|
|
7
|
+
const onMouseUp = () => {
|
|
8
|
+
isMidClick.current = false;
|
|
9
|
+
};
|
|
10
|
+
return React.useMemo(() => ({
|
|
11
|
+
elementProps: {
|
|
12
|
+
onMouseDown,
|
|
13
|
+
onMouseUp,
|
|
14
|
+
},
|
|
15
|
+
isMidClick,
|
|
16
|
+
}), []);
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const useCheckMidKeyPress = () => {
|
|
3
|
+
const isMidKeyPress = React.useRef(false);
|
|
4
|
+
const onKeyDown = (e) => {
|
|
5
|
+
if (e.key === 'Tab' || e.key === 'Escape')
|
|
6
|
+
return;
|
|
7
|
+
isMidKeyPress.current = true;
|
|
8
|
+
};
|
|
9
|
+
const onKeyUp = () => {
|
|
10
|
+
isMidKeyPress.current = false;
|
|
11
|
+
};
|
|
12
|
+
const onBlur = () => {
|
|
13
|
+
isMidKeyPress.current = false;
|
|
14
|
+
};
|
|
15
|
+
return React.useMemo(() => ({
|
|
16
|
+
elementProps: {
|
|
17
|
+
onKeyDown,
|
|
18
|
+
onKeyUp,
|
|
19
|
+
onBlur,
|
|
20
|
+
},
|
|
21
|
+
isMidKeyPress,
|
|
22
|
+
}), []);
|
|
23
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const useHover = () => {
|
|
3
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
4
|
+
const anchorElementProps = {
|
|
5
|
+
onMouseEnter: () => setIsHovered(true),
|
|
6
|
+
onMouseLeave: () => setIsHovered(false),
|
|
7
|
+
};
|
|
8
|
+
return {
|
|
9
|
+
isHovered,
|
|
10
|
+
anchorElementProps,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -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,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const fallbackMemory = {};
|
|
3
|
+
const isBrowser = typeof window !== 'undefined';
|
|
4
|
+
const fallbackStorage = {
|
|
5
|
+
getItem(key) {
|
|
6
|
+
return fallbackMemory[key];
|
|
7
|
+
},
|
|
8
|
+
setItem(key, value) {
|
|
9
|
+
fallbackMemory[key] = value;
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
class StorageAdaptor {
|
|
13
|
+
constructor(prefix) {
|
|
14
|
+
if (isBrowser) {
|
|
15
|
+
this.storage = window.sessionStorage || fallbackStorage;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.storage = fallbackStorage;
|
|
19
|
+
}
|
|
20
|
+
this.prefix = prefix;
|
|
21
|
+
}
|
|
22
|
+
getStorageKey(key) {
|
|
23
|
+
return this.prefix ? `${this.prefix}-${key}` : key;
|
|
24
|
+
}
|
|
25
|
+
getItem(key) {
|
|
26
|
+
return this.storage.getItem(this.getStorageKey(key));
|
|
27
|
+
}
|
|
28
|
+
setItem(key, value) {
|
|
29
|
+
this.storage.setItem(this.getStorageKey(key), value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export const useStorage = (prefix) => {
|
|
33
|
+
const storage = React.useMemo(() => {
|
|
34
|
+
return new StorageAdaptor(prefix);
|
|
35
|
+
}, [prefix]);
|
|
36
|
+
return storage;
|
|
37
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type DeepPartial<T> = T extends object ? {
|
|
2
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
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
|
+
ARROW_RIGHT = "ArrowRight",
|
|
10
|
+
ARROW_LEFT = "ArrowLeft",
|
|
11
|
+
ESCAPE = "Escape"
|
|
12
|
+
}
|
|
13
|
+
export declare const equals: (a: any, b: any) => boolean;
|
|
14
|
+
export declare function importedDefaultComponentShim<T>(component: T): T;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const firstChildAltSelector = ':first-of-type:not(style):not(:first-of-type ~ *),style + *';
|
|
2
|
+
export var KEY_CODES;
|
|
3
|
+
(function (KEY_CODES) {
|
|
4
|
+
KEY_CODES["ENTER"] = "Enter";
|
|
5
|
+
KEY_CODES["ARROW_UP"] = "ArrowUp";
|
|
6
|
+
KEY_CODES["ARROW_DOWN"] = "ArrowDown";
|
|
7
|
+
KEY_CODES["ARROW_RIGHT"] = "ArrowRight";
|
|
8
|
+
KEY_CODES["ARROW_LEFT"] = "ArrowLeft";
|
|
9
|
+
KEY_CODES["ESCAPE"] = "Escape";
|
|
10
|
+
})(KEY_CODES || (KEY_CODES = {}));
|
|
11
|
+
export const equals = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
12
|
+
export function importedDefaultComponentShim(component) {
|
|
13
|
+
if (component && typeof component === 'object' && 'default' in component) {
|
|
14
|
+
return component.default;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return component;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum SORT_DIRECTION {
|
|
2
|
+
ASC = "ASC",
|
|
3
|
+
DESC = "DESC"
|
|
4
|
+
}
|
|
5
|
+
export type SortConfig<RowData> = {
|
|
6
|
+
key: keyof RowData;
|
|
7
|
+
direction: SORT_DIRECTION;
|
|
8
|
+
};
|
|
9
|
+
export declare function sortByKey<Item = any>(params: {
|
|
10
|
+
items: Item[];
|
|
11
|
+
config: SortConfig<Item>;
|
|
12
|
+
}): Item[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var SORT_DIRECTION;
|
|
2
|
+
(function (SORT_DIRECTION) {
|
|
3
|
+
SORT_DIRECTION["ASC"] = "ASC";
|
|
4
|
+
SORT_DIRECTION["DESC"] = "DESC";
|
|
5
|
+
})(SORT_DIRECTION || (SORT_DIRECTION = {}));
|
|
6
|
+
export function sortByKey(params) {
|
|
7
|
+
const { items, config: { key, direction }, } = params;
|
|
8
|
+
const newItems = [...items];
|
|
9
|
+
return newItems.sort((a, b) => {
|
|
10
|
+
if (a[key] < b[key] && direction === SORT_DIRECTION.ASC) {
|
|
11
|
+
return -1;
|
|
12
|
+
}
|
|
13
|
+
else if (b[key] < a[key] && direction === SORT_DIRECTION.DESC) {
|
|
14
|
+
return -1;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render as rtlRender } from '@testing-library/react';
|
|
3
|
+
import { UiProvider } from '../components/providers/ui';
|
|
4
|
+
export const render = (component, configParam) => {
|
|
5
|
+
const config = configParam || {};
|
|
6
|
+
return rtlRender(_jsx(UiProvider, Object.assign({ env: config.env, components: config.components, alertsConfig: {
|
|
7
|
+
disable: true,
|
|
8
|
+
} }, { children: component })));
|
|
9
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ndlib/component-library",
|
|
3
|
+
"version": "0.0.79.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"global.css"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./dist/index.js",
|
|
14
|
+
"./global.css": "./global.css"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/ndlibrary/hesburgh-component-library.git"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"prepare": "husky install",
|
|
22
|
+
"test-build": "echo '\n\nTesting Build...' && tsc --noEmit",
|
|
23
|
+
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives && yarn prettier && yarn test-build",
|
|
24
|
+
"lint:fix": "eslint src --ext ts,tsx --report-unused-disable-directives --fix && yarn prettify && yarn test-build",
|
|
25
|
+
"test": "vitest",
|
|
26
|
+
"prettier": "prettier --check \"src/**/*.{ts,tsx}\"",
|
|
27
|
+
"prettify": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
28
|
+
"start": "storybook dev -p 6006",
|
|
29
|
+
"build-storybook": "storybook build -o storybook && touch storybook/.nojekyll",
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"debug": "echo src/**/*.tsx"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@emotion/react": "^11.11.0",
|
|
35
|
+
"@emotion/styled": "^11.11.0",
|
|
36
|
+
"@mui/icons-material": "^5.11.16",
|
|
37
|
+
"@mui/material": "^5.11.16",
|
|
38
|
+
"react": "^18.2.0",
|
|
39
|
+
"react-dom": "^18.2.0",
|
|
40
|
+
"theme-ui": "^0.16.1"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@emotion/react": "^11.11.0",
|
|
44
|
+
"@emotion/styled": "^11.11.0",
|
|
45
|
+
"@mui/icons-material": "^5.11.16",
|
|
46
|
+
"@mui/material": "^5.11.16",
|
|
47
|
+
"@storybook/addon-essentials": "^7.0.17",
|
|
48
|
+
"@storybook/addon-interactions": "^7.0.18",
|
|
49
|
+
"@storybook/addon-links": "^7.0.17",
|
|
50
|
+
"@storybook/blocks": "^7.0.17",
|
|
51
|
+
"@storybook/react": "^7.0.17",
|
|
52
|
+
"@storybook/react-vite": "^7.0.17",
|
|
53
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
54
|
+
"@testing-library/react": "^14.0.0",
|
|
55
|
+
"@testing-library/user-event": "^14.4.3",
|
|
56
|
+
"@types/pretty": "^2.0.1",
|
|
57
|
+
"@types/react": "^18.0.28",
|
|
58
|
+
"@types/react-beautiful-dnd": "^13.1.5",
|
|
59
|
+
"@types/react-datepicker": "^4.15.0",
|
|
60
|
+
"@types/react-dom": "^18.0.11",
|
|
61
|
+
"@types/react-modal": "^3.16.0",
|
|
62
|
+
"@types/sanitize-html": "^2.9.0",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
64
|
+
"@typescript-eslint/parser": "^5.57.1",
|
|
65
|
+
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
66
|
+
"eslint": "^8.38.0",
|
|
67
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
68
|
+
"eslint-plugin-react-refresh": "^0.3.4",
|
|
69
|
+
"eslint-plugin-storybook": "^0.6.12",
|
|
70
|
+
"husky": "^8.0.3",
|
|
71
|
+
"jsdom": "^22.1.0",
|
|
72
|
+
"prettier": "^3.0.3",
|
|
73
|
+
"pretty": "^2.0.0",
|
|
74
|
+
"prop-types": "^15.8.1",
|
|
75
|
+
"react": "^18.2.0",
|
|
76
|
+
"react-dom": "^18.2.0",
|
|
77
|
+
"storybook": "^7.0.17",
|
|
78
|
+
"theme-ui": "^0.16.1",
|
|
79
|
+
"typescript": "^5.0.2",
|
|
80
|
+
"vite": "^4.3.9",
|
|
81
|
+
"vitest": "^0.31.4"
|
|
82
|
+
},
|
|
83
|
+
"prettier": {
|
|
84
|
+
"singleQuote": true,
|
|
85
|
+
"semi": false,
|
|
86
|
+
"trailingComma": "all"
|
|
87
|
+
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"@floating-ui/react": "^0.24.5",
|
|
90
|
+
"react-beautiful-dnd": "^13.1.1",
|
|
91
|
+
"react-datepicker": "^4.16.0",
|
|
92
|
+
"react-markdown": "^8.0.7",
|
|
93
|
+
"react-modal": "^3.16.1",
|
|
94
|
+
"rehype-raw": "^6.1.1",
|
|
95
|
+
"sanitize-html": "^2.11.0",
|
|
96
|
+
"schema-dts": "^1.1.2"
|
|
97
|
+
}
|
|
98
|
+
}
|