@ndlib/component-library 1.0.21 → 1.0.23
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 +26 -8
- package/dist/assets/index-3cfb730f.js +1 -0
- package/dist/components/composites/Card/Card.stories.js +2 -0
- package/dist/components/composites/Card/index.js +4 -3
- package/dist/components/composites/CardV2/CardV2.module.css +74 -0
- package/dist/components/composites/CardV2/CardV2.stories.d.ts +19 -0
- package/dist/components/composites/CardV2/CardV2.stories.js +187 -0
- package/dist/components/composites/CardV2/CardV2.test.js +67 -0
- package/dist/components/composites/CardV2/index.d.ts +43 -0
- package/dist/components/composites/CardV2/index.js +99 -0
- package/dist/components/composites/DragDropList/DragDropList.stories.js +3 -1
- package/dist/components/composites/DropdownLinks/DropdownLinks.stories.js +2 -0
- package/dist/components/composites/DropdownLinks/index.d.ts +1 -1
- package/dist/components/composites/EmptyState/EmptyState.stories.js +2 -0
- package/dist/components/composites/EmptyState/index.js +1 -1
- package/dist/components/composites/Modal/Modal.stories.js +5 -2
- package/dist/components/composites/Modal/index.js +3 -2
- package/dist/components/composites/ModalV2/ModalV2.stories.d.ts +6 -0
- package/dist/components/composites/ModalV2/ModalV2.stories.js +41 -0
- package/dist/components/composites/ModalV2/ModalV2.test.js +37 -0
- package/dist/components/composites/ModalV2/index.d.ts +20 -0
- package/dist/components/composites/ModalV2/index.js +65 -0
- package/dist/components/composites/NavMenu/NavMenu.stories.js +2 -0
- package/dist/components/composites/NavMenu/index.js +1 -1
- package/dist/components/composites/Seo/seo.stories.js +2 -0
- package/dist/components/composites/SnackBar/SnackBar.stories.js +2 -0
- package/dist/components/composites/StructuredData/StructuredData.stories.js +2 -0
- package/dist/components/elements/Alerts/Alert.stories.js +2 -0
- package/dist/components/elements/Alerts/Alerts.stories.js +2 -0
- package/dist/components/elements/Alerts/index.js +2 -1
- package/dist/components/elements/ArrowLink/ArrowLink.stories.js +2 -0
- package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/AutoComplete.stories.js +6 -4
- package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/AutoComplete.test.js +1 -1
- package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/index.js +3 -3
- package/dist/components/elements/BrandingBar/BrandingBar.stories.js +2 -0
- package/dist/components/elements/Button/Button.stories.js +4 -2
- package/dist/components/elements/ButtonV2/ButtonV2.module.css +25 -0
- package/dist/components/elements/ButtonV2/ButtonV2.stories.d.ts +15 -0
- package/dist/components/elements/ButtonV2/ButtonV2.stories.js +90 -0
- package/dist/components/elements/ButtonV2/ButtonV2.test.js +45 -0
- package/dist/components/elements/ButtonV2/index.d.ts +51 -0
- package/dist/components/elements/ButtonV2/index.js +137 -0
- package/dist/components/elements/{Fields/Checkbox → Checkbox}/Checkbox.stories.js +3 -1
- package/dist/components/elements/{Fields/Checkbox → Checkbox}/Checkbox.test.js +1 -1
- package/dist/components/elements/{Fields/Checkbox → Checkbox}/index.d.ts +1 -1
- package/dist/components/elements/{Fields/Checkbox → Checkbox}/index.js +2 -2
- package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/CheckboxGroup.stories.js +3 -1
- package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/CheckboxGroup.test.js +1 -1
- package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/index.d.ts +1 -1
- package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/index.js +7 -7
- package/dist/components/elements/CheckboxGroupV2/CheckboxGroupV2.stories.d.ts +8 -0
- package/dist/components/elements/CheckboxGroupV2/CheckboxGroupV2.stories.js +31 -0
- package/dist/components/elements/CheckboxGroupV2/CheckboxGroupV2.test.js +34 -0
- package/dist/components/elements/CheckboxGroupV2/index.d.ts +17 -0
- package/dist/components/elements/CheckboxGroupV2/index.js +50 -0
- package/dist/components/elements/CheckboxV2/CheckboxV2.module.css +5 -0
- package/dist/components/elements/CheckboxV2/CheckboxV2.stories.d.ts +6 -0
- package/dist/components/elements/CheckboxV2/CheckboxV2.stories.js +19 -0
- package/dist/components/elements/CheckboxV2/CheckboxV2.test.js +35 -0
- package/dist/components/elements/CheckboxV2/index.d.ts +10 -0
- package/dist/components/elements/CheckboxV2/index.js +23 -0
- package/dist/components/elements/{Fields/DatePicker → DatePicker}/DatePicker.stories.js +3 -1
- package/dist/components/elements/{Fields/DatePicker → DatePicker}/DatePicker.test.js +1 -1
- package/dist/components/elements/{Fields/DatePicker → DatePicker}/index.d.ts +1 -1
- package/dist/components/elements/{Fields/DatePicker → DatePicker}/index.js +2 -2
- package/dist/components/elements/Dropdown/Dropdown.stories.js +3 -1
- package/dist/components/elements/Dropdown/index.js +1 -1
- package/dist/components/elements/GroupV2/index.d.ts +22 -0
- package/dist/components/elements/GroupV2/index.js +71 -0
- package/dist/components/elements/{text/Heading → Heading}/Heading.stories.js +5 -3
- package/dist/components/elements/{text/Heading → Heading}/Heading.test.js +3 -3
- package/dist/components/elements/{text/Heading → Heading}/index.d.ts +3 -3
- package/dist/components/elements/{text/Heading → Heading}/index.js +10 -9
- package/dist/components/elements/HeadingV2/HeadingV2.module.css +8 -0
- package/dist/components/elements/HeadingV2/HeadingV2.stories.d.ts +8 -0
- package/dist/components/elements/HeadingV2/HeadingV2.stories.js +37 -0
- package/dist/components/elements/HeadingV2/HeadingV2.test.js +51 -0
- package/dist/components/elements/HeadingV2/index.d.ts +23 -0
- package/dist/components/elements/HeadingV2/index.js +101 -0
- package/dist/components/elements/Icon/Icon.stories.js +3 -1
- package/dist/components/elements/IconV2/IconV2.module.css +10 -0
- package/dist/components/elements/IconV2/IconV2.stories.d.ts +7 -0
- package/dist/components/elements/IconV2/IconV2.stories.js +31 -0
- package/dist/components/elements/IconV2/IconV2.test.js +62 -0
- package/dist/components/elements/IconV2/index.d.ts +11 -0
- package/dist/components/elements/IconV2/index.js +34 -0
- package/dist/components/elements/{text/Inline → Inline}/Inline.stories.js +2 -0
- package/dist/components/elements/{text/Inline → Inline}/index.d.ts +1 -1
- package/dist/components/elements/{text/Inline → Inline}/index.js +1 -1
- package/dist/components/elements/{text/Label → Label}/Label.stories.js +4 -2
- package/dist/components/elements/Label/Label.test.d.ts +1 -0
- package/dist/components/elements/{text/Label → Label}/Label.test.js +3 -3
- package/dist/components/elements/{text/Label → Label}/index.d.ts +2 -2
- package/dist/components/elements/{text/Label → Label}/index.js +3 -3
- package/dist/components/elements/LabelV2/LabelV2.stories.d.ts +6 -0
- package/dist/components/elements/LabelV2/LabelV2.stories.js +22 -0
- package/dist/components/elements/LabelV2/LabelV2.test.d.ts +1 -0
- package/dist/components/elements/LabelV2/LabelV2.test.js +56 -0
- package/dist/components/elements/LabelV2/index.d.ts +20 -0
- package/dist/components/elements/LabelV2/index.js +41 -0
- package/dist/components/elements/Link/Link.stories.js +3 -1
- package/dist/components/elements/List/List.stories.js +3 -1
- package/dist/components/elements/List/index.js +1 -1
- package/dist/components/elements/ListBox/Listbox.stories.js +2 -0
- package/dist/components/elements/ListBox/index.d.ts +1 -1
- package/dist/components/elements/ListBox/index.js +1 -1
- package/dist/components/elements/ListBoxV2/ListBoxV2.module.css +33 -0
- package/dist/components/elements/ListBoxV2/ListBoxV2.stories.d.ts +6 -0
- package/dist/components/elements/ListBoxV2/ListBoxV2.stories.js +19 -0
- package/dist/components/elements/ListBoxV2/index.d.ts +35 -0
- package/dist/components/elements/ListBoxV2/index.js +36 -0
- package/dist/components/elements/Markdown/Markdown.stories.js +2 -0
- package/dist/components/elements/Markdown/index.js +4 -4
- package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/MonthPicker.stories.js +3 -1
- package/dist/components/elements/MonthPicker/MonthPicker.test.d.ts +1 -0
- package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/MonthPicker.test.js +1 -1
- package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/index.d.ts +1 -1
- package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/index.js +2 -2
- package/dist/components/elements/{text/Paragraph → Paragraph}/Paragraph.stories.js +5 -3
- package/dist/components/elements/Paragraph/Paragraph.test.d.ts +1 -0
- package/dist/components/elements/{text/Paragraph → Paragraph}/Paragraph.test.js +1 -1
- package/dist/components/elements/{text/Paragraph → Paragraph}/index.d.ts +2 -2
- package/dist/components/elements/{text/Paragraph → Paragraph}/index.js +6 -5
- package/dist/components/elements/ParagraphV2/ParagraphV2.stories.d.ts +7 -0
- package/dist/components/elements/ParagraphV2/ParagraphV2.stories.js +33 -0
- package/dist/components/elements/ParagraphV2/ParagraphV2.test.d.ts +1 -0
- package/dist/components/elements/ParagraphV2/ParagraphV2.test.js +9 -0
- package/dist/components/elements/ParagraphV2/index.d.ts +15 -0
- package/dist/components/elements/ParagraphV2/index.js +39 -0
- package/dist/components/elements/Pill/Pill.stories.js +3 -1
- package/dist/components/elements/Pill/index.js +2 -1
- package/dist/components/elements/{Fields/Radio → Radio}/Radio.stories.js +3 -1
- package/dist/components/elements/Radio/Radio.test.d.ts +1 -0
- package/dist/components/elements/{Fields/Radio → Radio}/Radio.test.js +3 -3
- package/dist/components/elements/{Fields/Radio → Radio}/index.d.ts +1 -1
- package/dist/components/elements/{Fields/Radio → Radio}/index.js +1 -1
- package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/RadioGroup.stories.js +3 -1
- package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/RadioGroup.test.js +1 -1
- package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/index.d.ts +1 -1
- package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/index.js +6 -6
- package/dist/components/elements/{text/ReadMore → ReadMore}/ReadMore.stories.js +5 -3
- package/dist/components/elements/ReadMore/ReadMore.test.d.ts +1 -0
- package/dist/components/elements/{text/ReadMore → ReadMore}/ReadMore.test.js +4 -9
- package/dist/components/elements/{text/ReadMore → ReadMore}/index.d.ts +2 -2
- package/dist/components/elements/{text/ReadMore → ReadMore}/index.js +10 -9
- package/dist/components/elements/ReadMoreV2/ReadMoreV2.module.css +19 -0
- package/dist/components/elements/ReadMoreV2/ReadMoreV2.stories.d.ts +8 -0
- package/dist/components/elements/ReadMoreV2/ReadMoreV2.stories.js +28 -0
- package/dist/components/elements/ReadMoreV2/ReadMoreV2.test.d.ts +1 -0
- package/dist/components/elements/ReadMoreV2/ReadMoreV2.test.js +30 -0
- package/dist/components/elements/ReadMoreV2/index.d.ts +13 -0
- package/dist/components/elements/ReadMoreV2/index.js +82 -0
- package/dist/components/elements/{Fields/Select → Select}/Select.stories.js +6 -4
- package/dist/components/elements/Select/Select.test.d.ts +1 -0
- package/dist/components/elements/{Fields/Select → Select}/Select.test.js +1 -1
- package/dist/components/elements/{Fields/Select → Select}/index.d.ts +1 -1
- package/dist/components/elements/{Fields/Select → Select}/index.js +9 -9
- package/dist/components/elements/SelectV2/SelectV2.module.css +27 -0
- package/dist/components/elements/SelectV2/SelectV2.stories.d.ts +8 -0
- package/dist/components/elements/SelectV2/SelectV2.stories.js +41 -0
- package/dist/components/elements/SelectV2/SelectV2.test.d.ts +1 -0
- package/dist/components/elements/SelectV2/SelectV2.test.js +52 -0
- package/dist/components/elements/SelectV2/index.d.ts +19 -0
- package/dist/components/elements/SelectV2/index.js +164 -0
- package/dist/components/elements/Spinner/Spinner.stories.js +2 -0
- package/dist/components/elements/Spinner/index.js +1 -1
- package/dist/components/elements/SpinnerV2/SpinnerV2.module.css +12 -0
- package/dist/components/elements/SpinnerV2/SpinnerV2.stories.d.ts +7 -0
- package/dist/components/elements/SpinnerV2/SpinnerV2.stories.js +29 -0
- package/dist/components/elements/SpinnerV2/SpinnerV2.test.d.ts +1 -0
- package/dist/components/elements/SpinnerV2/SpinnerV2.test.js +9 -0
- package/dist/components/elements/SpinnerV2/index.d.ts +15 -0
- package/dist/components/elements/SpinnerV2/index.js +36 -0
- package/dist/components/elements/TabList/TabList.stories.js +2 -0
- package/dist/components/elements/Table/Table.stories.js +2 -0
- package/dist/components/elements/{Fields/TextInput → TextInput}/TextInput.stories.js +6 -4
- package/dist/components/elements/TextInput/TextInput.test.d.ts +1 -0
- package/dist/components/elements/{Fields/TextInput → TextInput}/TextInput.test.js +2 -2
- package/dist/components/elements/{Fields/TextInput → TextInput}/index.d.ts +3 -3
- package/dist/components/elements/{Fields/TextInput → TextInput}/index.js +9 -8
- package/dist/components/elements/TextInputV2/TextInputV2.module.css +71 -0
- package/dist/components/elements/TextInputV2/TextInputV2.stories.d.ts +9 -0
- package/dist/components/elements/TextInputV2/TextInputV2.stories.js +37 -0
- package/dist/components/elements/TextInputV2/TextInputV2.test.d.ts +1 -0
- package/dist/components/elements/TextInputV2/TextInputV2.test.js +59 -0
- package/dist/components/elements/TextInputV2/index.d.ts +47 -0
- package/dist/components/elements/TextInputV2/index.js +98 -0
- package/dist/components/elements/layout/Box.stories.js +2 -0
- package/dist/components/elements/layout/Flex.stories.js +3 -1
- package/dist/components/elements/layoutV2/BoxV2.d.ts +9 -0
- package/dist/components/elements/layoutV2/BoxV2.js +19 -0
- package/dist/components/elements/layoutV2/BoxV2.stories.d.ts +6 -0
- package/dist/components/elements/layoutV2/BoxV2.stories.js +14 -0
- package/dist/components/elements/layoutV2/ColumnV2.d.ts +8 -0
- package/dist/components/elements/layoutV2/ColumnV2.js +21 -0
- package/dist/components/elements/layoutV2/RowV2.d.ts +19 -0
- package/dist/components/elements/layoutV2/RowV2.js +54 -0
- package/dist/components/providers/alerts.js +0 -1
- package/dist/components/providers/alerts.test.d.ts +1 -0
- package/dist/components/providers/alerts.test.js +115 -0
- package/dist/components/providers/componentConfigV2.d.ts +25 -0
- package/dist/components/providers/componentConfigV2.js +37 -0
- package/dist/components/providers/media.js +1 -1
- package/dist/components/providers/mediaV2.d.ts +11 -0
- package/dist/components/providers/mediaV2.js +48 -0
- package/dist/components/providers/uiV2.d.ts +20 -0
- package/dist/components/providers/uiV2.js +16 -0
- package/dist/index.d.ts +34 -14
- package/dist/index.html +14 -0
- package/dist/index.js +33 -13
- package/dist/theme/Color.stories.js +3 -1
- package/dist/theme/GlobalStylesV2.d.ts +2 -0
- package/dist/theme/GlobalStylesV2.js +212 -0
- package/dist/theme/Typography.stories.js +3 -1
- package/dist/theme/css-variables.css +57 -0
- package/dist/theme/index.d.ts +127 -1
- package/dist/theme/index.js +14 -0
- package/dist/theme/typography.js +2 -2
- package/dist/utils/decorators/UIVersion1.d.ts +2 -0
- package/dist/utils/decorators/UIVersion1.js +7 -0
- package/dist/utils/decorators/UIVersion2.d.ts +2 -0
- package/dist/utils/decorators/UIVersion2.js +7 -0
- package/dist/utils/hooks/useFocus.d.ts +7 -0
- package/dist/utils/hooks/useFocus.js +12 -0
- package/dist/utils/processSx.d.ts +3 -0
- package/dist/utils/processSx.js +135 -0
- package/package.json +8 -4
- /package/dist/components/{elements/Fields/Checkbox/Checkbox.test.d.ts → composites/CardV2/CardV2.test.d.ts} +0 -0
- /package/dist/components/{elements/Fields/CheckboxGroup/CheckboxGroup.test.d.ts → composites/ModalV2/ModalV2.test.d.ts} +0 -0
- /package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/AutoComplete.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/AutoComplete.test.d.ts +0 -0
- /package/dist/components/elements/{Fields/AutoComplete → AutoComplete}/index.d.ts +0 -0
- /package/dist/components/elements/{Fields/DatePicker/DatePicker.test.d.ts → ButtonV2/ButtonV2.test.d.ts} +0 -0
- /package/dist/components/elements/{text/Caption → Caption}/index.d.ts +0 -0
- /package/dist/components/elements/{text/Caption → Caption}/index.js +0 -0
- /package/dist/components/elements/{Fields/Checkbox → Checkbox}/Checkbox.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/MonthPicker/MonthPicker.test.d.ts → Checkbox/Checkbox.test.d.ts} +0 -0
- /package/dist/components/elements/{Fields/CheckboxGroup → CheckboxGroup}/CheckboxGroup.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/Radio/Radio.test.d.ts → CheckboxGroup/CheckboxGroup.test.d.ts} +0 -0
- /package/dist/components/elements/{Fields/Select/Select.test.d.ts → CheckboxGroupV2/CheckboxGroupV2.test.d.ts} +0 -0
- /package/dist/components/elements/{text/Heading/Heading.test.d.ts → CheckboxV2/CheckboxV2.test.d.ts} +0 -0
- /package/dist/components/elements/{Fields/DatePicker → DatePicker}/DatePicker.stories.d.ts +0 -0
- /package/dist/components/elements/{text/Label/Label.test.d.ts → DatePicker/DatePicker.test.d.ts} +0 -0
- /package/dist/components/elements/{text/Heading → Heading}/Heading.stories.d.ts +0 -0
- /package/dist/components/elements/{text/Paragraph/Paragraph.test.d.ts → Heading/Heading.test.d.ts} +0 -0
- /package/dist/components/elements/{text/ReadMore/ReadMore.test.d.ts → HeadingV2/HeadingV2.test.d.ts} +0 -0
- /package/dist/components/elements/{Fields/RadioGroup/RadioGroup.test.d.ts → IconV2/IconV2.test.d.ts} +0 -0
- /package/dist/components/elements/{text/Inline → Inline}/Inline.stories.d.ts +0 -0
- /package/dist/components/elements/{text/Label → Label}/Label.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/MonthPicker → MonthPicker}/MonthPicker.stories.d.ts +0 -0
- /package/dist/components/elements/{text/Paragraph → Paragraph}/Paragraph.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/Radio → Radio}/Radio.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/RadioGroup → RadioGroup}/RadioGroup.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/TextInput/TextInput.test.d.ts → RadioGroup/RadioGroup.test.d.ts} +0 -0
- /package/dist/components/elements/{text/ReadMore → ReadMore}/ReadMore.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/Select → Select}/Select.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/TextInput → TextInput}/TextInput.stories.d.ts +0 -0
- /package/dist/components/elements/{Fields/option.d.ts → option.d.ts} +0 -0
- /package/dist/components/elements/{Fields/option.js → option.js} +0 -0
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
import { FONT_WEIGHT } from '
|
|
13
|
+
import { FONT_WEIGHT } from '../../../theme/typography';
|
|
14
14
|
export const Bold = (_a) => {
|
|
15
15
|
var { sx } = _a, rest = __rest(_a, ["sx"]);
|
|
16
16
|
return (_jsx("span", Object.assign({ sx: Object.assign(Object.assign({}, sx), { fontWeight: FONT_WEIGHT.BOLD }) }, rest)));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { GROUP_TYPE, Group } from '
|
|
2
|
+
import { GROUP_TYPE, Group } from '../Group';
|
|
3
3
|
import { LABEL_SIZE, Label } from '.';
|
|
4
|
-
import { Column } from '
|
|
4
|
+
import { Column } from '../layout/Column';
|
|
5
|
+
import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
|
|
5
6
|
const meta = {
|
|
6
7
|
title: 'Elements/Label',
|
|
7
8
|
component: Label,
|
|
9
|
+
decorators: [UIVersion1],
|
|
8
10
|
};
|
|
9
11
|
export default meta;
|
|
10
12
|
const sizes = [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { vi } from 'vitest';
|
|
12
|
-
import { render as _render } from '
|
|
12
|
+
import { render as _render } from '../../../utils/test';
|
|
13
13
|
import { Label } from '.';
|
|
14
|
-
import { GROUP_TYPE, Group } from '
|
|
15
|
-
import { ENVIRONMENT } from '
|
|
14
|
+
import { GROUP_TYPE, Group } from '../Group';
|
|
15
|
+
import { ENVIRONMENT } from '../../providers/env';
|
|
16
16
|
import userEvent from '@testing-library/user-event';
|
|
17
17
|
import { waitFor } from '@testing-library/react';
|
|
18
18
|
const render = (component) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TYPOGRAPHY_TYPE } from '
|
|
3
|
-
import { StyledElementProps } from '
|
|
2
|
+
import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
|
|
3
|
+
import { StyledElementProps } from '../../../theme';
|
|
4
4
|
export declare enum LABEL_SIZE {
|
|
5
5
|
SM = "sm",
|
|
6
6
|
MD = "md",
|
|
@@ -10,9 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
import { getTypographyStyles, TYPOGRAPHY_TYPE
|
|
14
|
-
import { GROUP_TYPE, useGroup } from '
|
|
15
|
-
import { useEnvironment } from '
|
|
13
|
+
import { getTypographyStyles, TYPOGRAPHY_TYPE } from '../../../theme/typography';
|
|
14
|
+
import { GROUP_TYPE, useGroup } from '../Group';
|
|
15
|
+
import { useEnvironment } from '../../providers/env';
|
|
16
16
|
export var LABEL_SIZE;
|
|
17
17
|
(function (LABEL_SIZE) {
|
|
18
18
|
LABEL_SIZE["SM"] = "sm";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
3
|
+
import { LABELV2_SIZE, LabelV2 } from '.';
|
|
4
|
+
import { ColumnV2 } from '../layoutV2/ColumnV2';
|
|
5
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Elements/LabelV2',
|
|
8
|
+
component: LabelV2,
|
|
9
|
+
decorators: [UIVersion2],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
const sizes = [
|
|
13
|
+
{ size: LABELV2_SIZE.LG, label: 'Large' },
|
|
14
|
+
{ size: LABELV2_SIZE.MD, label: 'Medium' },
|
|
15
|
+
{ size: LABELV2_SIZE.SM, label: 'Small' },
|
|
16
|
+
];
|
|
17
|
+
export const Default = {
|
|
18
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2, Object.assign({ type: GROUPV2_TYPE.GROUP }, { children: _jsx(LabelV2, Object.assign({ size: size.size }, { children: size.label })) })))) })),
|
|
19
|
+
args: {
|
|
20
|
+
children: 'Label',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { vi } from 'vitest';
|
|
12
|
+
import { render as _render } from '../../../utils/test';
|
|
13
|
+
import { LabelV2 } from '.';
|
|
14
|
+
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
15
|
+
import { ENVIRONMENT } from '../../providers/env';
|
|
16
|
+
import userEvent from '@testing-library/user-event';
|
|
17
|
+
import { waitFor } from '@testing-library/react';
|
|
18
|
+
const render = (component) => {
|
|
19
|
+
return _render(component, { env: ENVIRONMENT.DEV });
|
|
20
|
+
};
|
|
21
|
+
describe('LabelV2', () => {
|
|
22
|
+
const originalError = console.error;
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
console.error = vi.fn();
|
|
25
|
+
});
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
console.error = originalError;
|
|
28
|
+
vi.useRealTimers();
|
|
29
|
+
});
|
|
30
|
+
it('renders without an error if passed standalone prop', () => {
|
|
31
|
+
const { getByText } = render(_jsx(LabelV2, Object.assign({ standalone: true }, { children: "Foo" })));
|
|
32
|
+
expect(getByText('Foo')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
it('renders without an error if used within region Group component', () => {
|
|
35
|
+
const { getByText } = render(_jsx(GroupV2, Object.assign({ type: GROUPV2_TYPE.GROUP }, { children: _jsx(LabelV2, { children: "Foo" }) })));
|
|
36
|
+
expect(getByText('Foo')).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
it('throws if used outside a Group component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
expect(() => render(_jsx(LabelV2, { children: "Foo" }))).toThrow();
|
|
40
|
+
}));
|
|
41
|
+
it('throws if used within non-group-type Group component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
expect(() => render(_jsx(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: _jsx(LabelV2, { children: "Foo" }) })))).toThrow();
|
|
43
|
+
}));
|
|
44
|
+
it('labels group target automatically', () => {
|
|
45
|
+
const { getByLabelText } = render(_jsx(GroupV2, Object.assign({ type: GROUPV2_TYPE.GROUP }, { children: _jsx(LabelV2, { children: "Foo" }) })));
|
|
46
|
+
expect(getByLabelText('Foo')).toBeDefined();
|
|
47
|
+
});
|
|
48
|
+
it('can send focus to label target', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const INPUT_TEST_ID = 'input-test-id';
|
|
50
|
+
const { getByText, getByTestId } = render(_jsx(GroupV2, Object.assign({ type: GROUPV2_TYPE.GROUP }, { children: ({ labelTargetId }) => (_jsxs(_Fragment, { children: [_jsx(LabelV2, { children: "Foo" }), _jsx("input", { id: labelTargetId, "data-testid": INPUT_TEST_ID })] })) })));
|
|
51
|
+
userEvent.click(getByText('Foo'));
|
|
52
|
+
yield waitFor(() => {
|
|
53
|
+
expect(getByTestId(INPUT_TEST_ID)).toHaveFocus();
|
|
54
|
+
});
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
|
|
3
|
+
import { StyledElementPropsV2 } from '../../../theme';
|
|
4
|
+
export declare enum LABELV2_SIZE {
|
|
5
|
+
SM = "sm",
|
|
6
|
+
MD = "md",
|
|
7
|
+
LG = "lg"
|
|
8
|
+
}
|
|
9
|
+
export declare const SIZE_TYPOGRAPHY_MAP_V2: {
|
|
10
|
+
sm: TYPOGRAPHY_TYPE;
|
|
11
|
+
md: TYPOGRAPHY_TYPE;
|
|
12
|
+
lg: TYPOGRAPHY_TYPE;
|
|
13
|
+
};
|
|
14
|
+
type LabelV2Props = StyledElementPropsV2<HTMLLabelElement, {
|
|
15
|
+
size?: LABELV2_SIZE;
|
|
16
|
+
typography?: TYPOGRAPHY_TYPE;
|
|
17
|
+
standalone?: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const LabelV2: React.FC<LabelV2Props>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { getTypographyStyles, TYPOGRAPHY_TYPE } from '../../../theme/typography';
|
|
14
|
+
import { GROUPV2_TYPE, useGroupV2 } from '../GroupV2';
|
|
15
|
+
import { useEnvironment } from '../../providers/env';
|
|
16
|
+
import { processSx } from '../../../utils/processSx';
|
|
17
|
+
export var LABELV2_SIZE;
|
|
18
|
+
(function (LABELV2_SIZE) {
|
|
19
|
+
LABELV2_SIZE["SM"] = "sm";
|
|
20
|
+
LABELV2_SIZE["MD"] = "md";
|
|
21
|
+
LABELV2_SIZE["LG"] = "lg";
|
|
22
|
+
})(LABELV2_SIZE || (LABELV2_SIZE = {}));
|
|
23
|
+
export const SIZE_TYPOGRAPHY_MAP_V2 = {
|
|
24
|
+
[LABELV2_SIZE.SM]: TYPOGRAPHY_TYPE.CONTROL_SMALL,
|
|
25
|
+
[LABELV2_SIZE.MD]: TYPOGRAPHY_TYPE.CONTROL_MEDIUM,
|
|
26
|
+
[LABELV2_SIZE.LG]: TYPOGRAPHY_TYPE.CONTROL_LARGE,
|
|
27
|
+
};
|
|
28
|
+
export const LabelV2 = (_a) => {
|
|
29
|
+
var { sx, size, standalone, typography: typographyParam } = _a, rest = __rest(_a, ["sx", "size", "standalone", "typography"]);
|
|
30
|
+
const { labelId, labelTargetId, type: groupType } = useGroupV2();
|
|
31
|
+
const { flagInDevelopment } = useEnvironment();
|
|
32
|
+
const typography = typographyParam || SIZE_TYPOGRAPHY_MAP_V2[size || LABELV2_SIZE.MD];
|
|
33
|
+
const typographyStyles = getTypographyStyles(typography);
|
|
34
|
+
const processedStyles = processSx(Object.assign(Object.assign({}, typographyStyles), sx));
|
|
35
|
+
if (groupType !== GROUPV2_TYPE.GROUP &&
|
|
36
|
+
groupType !== GROUPV2_TYPE.RAW &&
|
|
37
|
+
!standalone) {
|
|
38
|
+
flagInDevelopment('Label component should be used within a Group component with property type={GROUP_TYPE.GROUP} or given the standalone flag');
|
|
39
|
+
}
|
|
40
|
+
return (_jsx("label", Object.assign({ id: labelId, htmlFor: labelTargetId, style: processedStyles }, rest)));
|
|
41
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Link, LINK_SIZE } from '.';
|
|
3
3
|
import { Group } from '../Group';
|
|
4
|
-
import { HEADING_SIZE, Heading } from '../
|
|
4
|
+
import { HEADING_SIZE, Heading } from '../Heading';
|
|
5
5
|
import { Column } from '../layout/Column';
|
|
6
|
+
import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
|
|
6
7
|
const meta = {
|
|
7
8
|
title: 'Elements/Link',
|
|
8
9
|
component: Link,
|
|
10
|
+
decorators: [UIVersion1],
|
|
9
11
|
};
|
|
10
12
|
export default meta;
|
|
11
13
|
const sizes = [
|
|
@@ -5,14 +5,16 @@ import BookmarkBorderIcon from '@mui/icons-material/BookmarkBorder';
|
|
|
5
5
|
import { LIST_SIZE, List, ListItem } from './index';
|
|
6
6
|
import { Row } from '../layout/Row';
|
|
7
7
|
import { Column } from '../layout/Column';
|
|
8
|
-
import { HEADING_SIZE, Heading } from '../
|
|
8
|
+
import { HEADING_SIZE, Heading } from '../Heading';
|
|
9
9
|
import { GROUP_TYPE, Group } from '../Group';
|
|
10
10
|
import { COLOR } from '../../..';
|
|
11
11
|
import { FONT_SIZE } from '../../../theme/typography';
|
|
12
|
+
import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
|
|
12
13
|
const meta = {
|
|
13
14
|
title: 'Elements/List',
|
|
14
15
|
component: List,
|
|
15
16
|
tags: ['autodocs'],
|
|
17
|
+
decorators: [UIVersion1],
|
|
16
18
|
};
|
|
17
19
|
export default meta;
|
|
18
20
|
export const Default = {
|
|
@@ -19,7 +19,7 @@ import { COLOR, Label, TYPOGRAPHY_TYPE } from '../../..';
|
|
|
19
19
|
import { FONT_SIZE, getTypographyStyles } from '../../../theme/typography';
|
|
20
20
|
import { Icon } from '../Icon';
|
|
21
21
|
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
22
|
-
import { useLinesHeight } from '../
|
|
22
|
+
import { useLinesHeight } from '../ReadMore';
|
|
23
23
|
import { Column } from '../layout/Column';
|
|
24
24
|
import { useEnvironment } from '../../providers/env';
|
|
25
25
|
const CircleIcon = importedDefaultComponentShim(_CircleIcon);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ListBox } from '.';
|
|
3
|
+
import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
|
|
3
4
|
const meta = {
|
|
4
5
|
title: 'Elements/ListBox',
|
|
5
6
|
component: ListBox,
|
|
6
7
|
tags: ['autodocs'],
|
|
8
|
+
decorators: [UIVersion1],
|
|
7
9
|
};
|
|
8
10
|
export default meta;
|
|
9
11
|
const options = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Key } from 'react';
|
|
2
2
|
import { StyledElementProps } from '../../../theme';
|
|
3
|
-
import { BasicOption, RenderOption } from '../
|
|
3
|
+
import { BasicOption, RenderOption } from '../option';
|
|
4
4
|
type ListBoxProps<Value extends Key, Option extends BasicOption<Value>> = StyledElementProps<HTMLDivElement, {
|
|
5
5
|
options: Option[];
|
|
6
6
|
renderOption?: RenderOption<Value, Option>;
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { COLOR } from '../../..';
|
|
15
15
|
import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
|
|
16
|
-
import { defaultRenderOption, getOptionId, } from '../
|
|
16
|
+
import { defaultRenderOption, getOptionId, } from '../option';
|
|
17
17
|
function ListBoxInner(_a, ref) {
|
|
18
18
|
var { options, renderOption: renderOptionParam, selected, focused, selectOption, sx } = _a, rest = __rest(_a, ["options", "renderOption", "selected", "focused", "selectOption", "sx"]);
|
|
19
19
|
const renderOption = renderOptionParam || defaultRenderOption;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.listBoxOption {
|
|
2
|
+
padding: 0.75rem 1rem;
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
border-bottom: 1px solid var(--lightGray);
|
|
5
|
+
color: var(--text);
|
|
6
|
+
background-color: var(--background);
|
|
7
|
+
|
|
8
|
+
&:first-of-type {
|
|
9
|
+
border-top-left-radius: 4px;
|
|
10
|
+
border-top-right-radius: 4px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&:last-of-type {
|
|
14
|
+
border-bottom: none;
|
|
15
|
+
border-bottom-left-radius: 4px;
|
|
16
|
+
border-bottom-right-radius: 4px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:focus {
|
|
20
|
+
background-color: var(--extraExtraLightGray);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
background-color: var(--extraExtraLightGray);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.listBox {
|
|
29
|
+
border: 1px solid var(--lightGray);
|
|
30
|
+
border-radius: 4px;
|
|
31
|
+
background-color: var(--background);
|
|
32
|
+
box-shadow: 0px 0px 8px 2px #dddddd;
|
|
33
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ListBoxV2 } from '.';
|
|
3
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Elements/ListBoxV2',
|
|
6
|
+
component: ListBoxV2,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
decorators: [UIVersion2],
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
const options = [
|
|
12
|
+
{ value: 'orange', label: 'Orange' },
|
|
13
|
+
{ value: 'apple', label: 'Apple' },
|
|
14
|
+
{ value: 'strawberry', label: 'Strawberry' },
|
|
15
|
+
{ value: 'pineapple', label: 'Pineapple' },
|
|
16
|
+
];
|
|
17
|
+
export const Default = {
|
|
18
|
+
render: () => _jsx(ListBoxV2, { options: options }),
|
|
19
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { Key } from 'react';
|
|
2
|
+
import { StyledElementPropsV2 } from '../../../theme';
|
|
3
|
+
import { BasicOption, RenderOption } from '../option';
|
|
4
|
+
type ListBoxV2Props<Value extends Key, Option extends BasicOption<Value>> = StyledElementPropsV2<HTMLDivElement, {
|
|
5
|
+
options: Option[];
|
|
6
|
+
className?: string;
|
|
7
|
+
renderOption?: RenderOption<Value, Option>;
|
|
8
|
+
selected?: Value;
|
|
9
|
+
focused?: Value;
|
|
10
|
+
selectOption?: (option: Option) => void;
|
|
11
|
+
onDownPress?: () => void;
|
|
12
|
+
onUpPress?: () => void;
|
|
13
|
+
onSelect?: () => void;
|
|
14
|
+
onBlur?: () => void;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const ListBoxV2: <Value extends React.Key = string, Option extends BasicOption<Value> = any>(props: {
|
|
17
|
+
sx?: import("../../../theme").StylesPropV2 | undefined;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & {
|
|
20
|
+
options: Option[];
|
|
21
|
+
className?: string | undefined;
|
|
22
|
+
renderOption?: RenderOption<Value, Option> | undefined;
|
|
23
|
+
selected?: Value | undefined;
|
|
24
|
+
focused?: Value | undefined;
|
|
25
|
+
selectOption?: ((option: Option) => void) | undefined;
|
|
26
|
+
onDownPress?: (() => void) | undefined;
|
|
27
|
+
onUpPress?: (() => void) | undefined;
|
|
28
|
+
onSelect?: (() => void) | undefined;
|
|
29
|
+
onBlur?: (() => void) | undefined;
|
|
30
|
+
} & {
|
|
31
|
+
htmlFor?: string | undefined;
|
|
32
|
+
} & {
|
|
33
|
+
ref?: React.ForwardedRef<HTMLDivElement> | undefined;
|
|
34
|
+
}) => any;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
|
|
15
|
+
import { defaultRenderOption, getOptionId, } from '../option';
|
|
16
|
+
import { processSx } from '../../../utils/processSx';
|
|
17
|
+
import * as styles from './ListBoxV2.module.css';
|
|
18
|
+
import clsx from 'clsx';
|
|
19
|
+
const typeSafeStyles = styles;
|
|
20
|
+
function ListBoxOption({ option, selected, focused, selectOption, renderOption, }) {
|
|
21
|
+
return (_jsx("div", Object.assign({ id: getOptionId(option.value), "aria-selected": selected === option.value, role: "option", onClick: option.onClick, onMouseDown: () => selectOption && selectOption(option), className: typeSafeStyles.listBoxOption }, { children: renderOption({
|
|
22
|
+
option,
|
|
23
|
+
selected: selected === option.value,
|
|
24
|
+
focused: focused === option.value,
|
|
25
|
+
}) }), option.value));
|
|
26
|
+
}
|
|
27
|
+
function ListBoxInnerV2(_a, ref) {
|
|
28
|
+
var { options, renderOption: renderOptionParam, selected, focused, selectOption, className, sx, style } = _a, rest = __rest(_a, ["options", "renderOption", "selected", "focused", "selectOption", "className", "sx", "style"]);
|
|
29
|
+
const renderOption = renderOptionParam || defaultRenderOption;
|
|
30
|
+
const typography = getTypographyStyles(TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM);
|
|
31
|
+
const processedStyles = processSx(Object.assign(Object.assign({}, typography), sx));
|
|
32
|
+
return (_jsx("div", Object.assign({ role: "listbox", ref: ref, className: clsx(typeSafeStyles.listBox, className), style: Object.assign(Object.assign({}, style), processedStyles), onKeyDown: (e) => {
|
|
33
|
+
console.log(e);
|
|
34
|
+
} }, rest, { children: options.map((option) => (_jsx(ListBoxOption, { option: option, selected: selected, focused: focused, selectOption: selectOption, renderOption: renderOption }, option.value))) })));
|
|
35
|
+
}
|
|
36
|
+
export const ListBoxV2 = React.forwardRef(ListBoxInnerV2);
|
|
@@ -2,10 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Markdown } from '.';
|
|
3
3
|
import { FONT_WEIGHT } from '../../../theme/typography';
|
|
4
4
|
import { COLOR } from '../../../theme/colors';
|
|
5
|
+
import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
|
|
5
6
|
const meta = {
|
|
6
7
|
title: 'Elements/Markdown',
|
|
7
8
|
component: Markdown,
|
|
8
9
|
tags: ['autodocs'],
|
|
10
|
+
decorators: [UIVersion1],
|
|
9
11
|
};
|
|
10
12
|
const sampleParagraph = `
|
|
11
13
|
Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies
|
|
@@ -13,13 +13,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { ReactMarkdown } from 'react-markdown/lib/react-markdown';
|
|
14
14
|
import rehypeRaw from 'rehype-raw';
|
|
15
15
|
import { List, ListItem } from '../List';
|
|
16
|
-
import { Paragraph } from '../
|
|
17
|
-
import { HEADING_SIZE, Heading } from '../
|
|
18
|
-
import { Bold, Italic } from '../
|
|
16
|
+
import { Paragraph } from '../Paragraph';
|
|
17
|
+
import { HEADING_SIZE, Heading } from '../Heading';
|
|
18
|
+
import { Bold, Italic } from '../Inline';
|
|
19
19
|
import { firstChildAltSelector } from '../../../utils/misc';
|
|
20
20
|
import remarkGfm from 'remark-gfm';
|
|
21
21
|
import { BlockQuote } from '../BlockQuote';
|
|
22
|
-
import { Caption } from '../
|
|
22
|
+
import { Caption } from '../Caption';
|
|
23
23
|
import { sanitizeHtml } from '../../../utils/sanitizeHtml';
|
|
24
24
|
const parseBlockquotes = (content) => {
|
|
25
25
|
const contentArray = content.split('\n');
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { MonthPicker } from '.';
|
|
4
|
-
import { Box } from '
|
|
4
|
+
import { Box } from '../layout/Box';
|
|
5
|
+
import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
|
|
5
6
|
const meta = {
|
|
6
7
|
title: 'Elements/Fields/MonthPicker',
|
|
7
8
|
component: MonthPicker,
|
|
8
9
|
tags: ['autodocs'],
|
|
10
|
+
decorators: [UIVersion1],
|
|
9
11
|
};
|
|
10
12
|
export default meta;
|
|
11
13
|
const StatefulMonthPicker = (props) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
4
|
-
import { MonthPicker } from '
|
|
4
|
+
import { MonthPicker } from '.';
|
|
5
5
|
describe('MonthPicker component', () => {
|
|
6
6
|
const mockOnChange = vi.fn();
|
|
7
7
|
const selectedDate = new Date(Date.UTC(96, 1, 2, 3, 4, 5));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
3
3
|
import { TextInputProps } from '../TextInput';
|
|
4
|
-
import { BoxProps } from '
|
|
4
|
+
import { BoxProps } from '../layout/Box';
|
|
5
5
|
export declare const MonthPicker: React.FC<{
|
|
6
6
|
value: Date;
|
|
7
7
|
onChange: (date: Date) => void;
|
|
@@ -14,8 +14,8 @@ import _ReactDatePicker from 'react-datepicker';
|
|
|
14
14
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
15
15
|
import { TextInput } from '../TextInput';
|
|
16
16
|
import { InputWrapper } from '../DatePicker';
|
|
17
|
-
import { Box } from '
|
|
18
|
-
import { importedDefaultComponentShim } from '
|
|
17
|
+
import { Box } from '../layout/Box';
|
|
18
|
+
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
19
19
|
const ReactDatePicker = importedDefaultComponentShim(_ReactDatePicker);
|
|
20
20
|
const PermissiveTextInput = TextInput;
|
|
21
21
|
export const MonthPicker = (_a) => {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { GROUP_TYPE, Group } from '
|
|
2
|
+
import { GROUP_TYPE, Group } from '../Group';
|
|
3
3
|
import { PARAGRAPH_SIZE, Paragraph } from '.';
|
|
4
|
-
import { Column } from '
|
|
4
|
+
import { Column } from '../layout/Column';
|
|
5
5
|
import { HEADING_SIZE, Heading } from '../Heading';
|
|
6
|
-
import { COLOR } from '
|
|
6
|
+
import { COLOR } from '../../../theme/colors';
|
|
7
|
+
import { UIVersion1 } from '../../../utils/decorators/UIVersion1';
|
|
7
8
|
const meta = {
|
|
8
9
|
title: 'Elements/Paragraph',
|
|
9
10
|
component: Paragraph,
|
|
10
11
|
tags: ['autodocs'],
|
|
12
|
+
decorators: [UIVersion1],
|
|
11
13
|
};
|
|
12
14
|
export default meta;
|
|
13
15
|
const sizes = [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TYPOGRAPHY_TYPE } from '
|
|
3
|
-
import { StyledElementProps } from '
|
|
2
|
+
import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
|
|
3
|
+
import { StyledElementProps } from '../../../theme';
|
|
4
4
|
type ParagraphProps = StyledElementProps<HTMLSpanElement, {
|
|
5
5
|
size?: PARAGRAPH_SIZE;
|
|
6
6
|
typography?: TYPOGRAPHY_TYPE;
|
|
@@ -10,9 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
import { getTypographyStyles, TYPOGRAPHY_TYPE
|
|
14
|
-
import { useTheme } from '
|
|
15
|
-
import { multiplyRemSize } from '
|
|
13
|
+
import { getTypographyStyles, TYPOGRAPHY_TYPE } from '../../../theme/typography';
|
|
14
|
+
import { useTheme } from '../../../theme';
|
|
15
|
+
import { multiplyRemSize } from '../../../utils/misc';
|
|
16
16
|
export var PARAGRAPH_SIZE;
|
|
17
17
|
(function (PARAGRAPH_SIZE) {
|
|
18
18
|
PARAGRAPH_SIZE["SM"] = "sm";
|
|
@@ -25,12 +25,13 @@ const SIZE_TYPOGRAPHY_MAP = {
|
|
|
25
25
|
[PARAGRAPH_SIZE.LG]: TYPOGRAPHY_TYPE.PARAGRAPH_LARGE,
|
|
26
26
|
};
|
|
27
27
|
export const Paragraph = (_a) => {
|
|
28
|
+
var _b, _c;
|
|
28
29
|
var { size, typography: typographyParam, sx, clampLines } = _a, rest = __rest(_a, ["size", "typography", "sx", "clampLines"]);
|
|
29
30
|
const theme = useTheme();
|
|
30
31
|
const typography = typographyParam || SIZE_TYPOGRAPHY_MAP[size || PARAGRAPH_SIZE.MD];
|
|
31
32
|
const typographyStyles = getTypographyStyles(typography);
|
|
32
|
-
const marginHeightMultiple = theme.lineHeights[typographyStyles.lineHeight] * 0.7;
|
|
33
|
-
const fontSize = theme.fontSizes[typographyStyles.fontSize];
|
|
33
|
+
const marginHeightMultiple = (((_b = theme.lineHeights) === null || _b === void 0 ? void 0 : _b[typographyStyles.lineHeight]) || 1.625) * 0.7;
|
|
34
|
+
const fontSize = ((_c = theme.fontSizes) === null || _c === void 0 ? void 0 : _c[typographyStyles.fontSize]) || '1rem';
|
|
34
35
|
const topMargin = multiplyRemSize({
|
|
35
36
|
size: fontSize,
|
|
36
37
|
multiple: marginHeightMultiple,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ParagraphV2 } from '.';
|
|
3
|
+
declare const meta: Meta<typeof ParagraphV2>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ParagraphV2>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const LineClamp: Story;
|