@recursica/mui-adapter 0.5.0 → 0.7.0
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/ARCHITECTURE.md +15 -0
- package/CHANGELOG.md +15 -0
- package/SETUP.md +77 -0
- package/USAGE.md +55 -0
- package/dist/mui-adapter.cjs +74 -1
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +6863 -205
- package/dist/mui-adapter.js.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts +43 -2
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +6 -2
- package/dist/src/components/Autocomplete/Autocomplete.d.ts +12 -2
- package/dist/src/components/Avatar/Avatar.d.ts +10 -3
- package/dist/src/components/Badge/Badge.d.ts +10 -3
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +9 -3
- package/dist/src/components/Button/Button.d.ts +2 -17
- package/dist/src/components/Card/Card.d.ts +38 -3
- package/dist/src/components/Checkbox/Checkbox.d.ts +13 -2
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +18 -0
- package/dist/src/components/Checkbox/index.d.ts +5 -1
- package/dist/src/components/Chip/Chip.d.ts +9 -2
- package/dist/src/components/Container/Container.d.ts +1 -5
- package/dist/src/components/DatePicker/DatePicker.d.ts +2 -1
- package/dist/src/components/Dropdown/Dropdown.d.ts +12 -2
- package/dist/src/components/Flex/Flex.d.ts +2 -22
- package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +5 -2
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +9 -2
- package/dist/src/components/Group/Group.d.ts +2 -7
- package/dist/src/components/HoverCard/HoverCard.d.ts +28 -2
- package/dist/src/components/Label/Label.d.ts +6 -2
- package/dist/src/components/Link/Link.d.ts +2 -6
- package/dist/src/components/Loader/Loader.d.ts +2 -7
- package/dist/src/components/Menu/Menu.d.ts +25 -3
- package/dist/src/components/Modal/Modal.d.ts +37 -2
- package/dist/src/components/NumberInput/NumberInput.d.ts +12 -2
- package/dist/src/components/Pagination/Pagination.d.ts +12 -3
- package/dist/src/components/Pagination/Pagination.icons.d.ts +8 -0
- package/dist/src/components/Panel/Panel.d.ts +52 -3
- package/dist/src/components/Radio/Radio.d.ts +13 -3
- package/dist/src/components/Radio/RadioGroup.d.ts +9 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyBooleanField.d.ts +5 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +4 -2
- package/dist/src/components/ReadOnlyField/ReadOnlySwitchField.d.ts +5 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyTextField.d.ts +8 -0
- package/dist/src/components/ReadOnlyField/WithReadOnlyWrapper.d.ts +28 -0
- package/dist/src/components/ReadOnlyField/index.d.ts +1 -0
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +21 -3
- package/dist/src/components/Slider/Slider.d.ts +18 -2
- package/dist/src/components/Stack/Stack.d.ts +2 -5
- package/dist/src/components/Stepper/Stepper.d.ts +41 -2
- package/dist/src/components/Switch/Switch.d.ts +10 -3
- package/dist/src/components/Switch/SwitchGroup.d.ts +13 -0
- package/dist/src/components/Table/Table.d.ts +2 -1
- package/dist/src/components/Tabs/Tabs.d.ts +20 -3
- package/dist/src/components/Text/Text.d.ts +2 -16
- package/dist/src/components/TextArea/TextArea.d.ts +12 -2
- package/dist/src/components/TextField/TextField.d.ts +12 -2
- package/dist/src/components/TimePicker/TimePicker.d.ts +2 -1
- package/dist/src/components/Timeline/Timeline.d.ts +15 -2
- package/dist/src/components/Timeline/TimelineItem.d.ts +18 -0
- package/dist/src/components/Title/Title.d.ts +2 -15
- package/dist/src/components/Toast/Toast.d.ts +20 -2
- package/dist/src/components/Tooltip/Tooltip.d.ts +28 -3
- package/dist/src/components/TransferList/TransferList.d.ts +2 -1
- package/dist/src/components/Typography/Typography.d.ts +1 -1
- package/dist/src/utils/RequireAccessibleLabel.d.ts +1 -18
- package/dist/src/utils/filterStylingProps.d.ts +1 -11
- package/llms.txt +16 -0
- package/package.json +14 -3
- package/src/components/Accordion/Accordion.module.css +294 -56
- package/src/components/Accordion/Accordion.stories.tsx +131 -21
- package/src/components/Accordion/Accordion.tsx +260 -5
- package/src/components/AssistiveElement/AssistiveElement.module.css +114 -20
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +60 -20
- package/src/components/AssistiveElement/AssistiveElement.tsx +81 -5
- package/src/components/Autocomplete/Autocomplete.module.css +319 -42
- package/src/components/Autocomplete/Autocomplete.stories.tsx +175 -23
- package/src/components/Autocomplete/Autocomplete.tsx +181 -6
- package/src/components/Avatar/Avatar.module.css +343 -73
- package/src/components/Avatar/Avatar.stories.tsx +94 -22
- package/src/components/Avatar/Avatar.tsx +99 -6
- package/src/components/Badge/Badge.module.css +127 -29
- package/src/components/Badge/Badge.stories.tsx +65 -22
- package/src/components/Badge/Badge.tsx +67 -6
- package/src/components/Breadcrumb/Breadcrumb.module.css +25 -5
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +57 -22
- package/src/components/Breadcrumb/Breadcrumb.tsx +59 -6
- package/src/components/Button/Button.module.css +19 -61
- package/src/components/Button/Button.stories.tsx +24 -23
- package/src/components/Button/Button.tsx +7 -18
- package/src/components/Card/Card.module.css +154 -38
- package/src/components/Card/Card.stories.tsx +117 -19
- package/src/components/Card/Card.tsx +181 -5
- package/src/components/Checkbox/Checkbox.module.css +249 -39
- package/src/components/Checkbox/Checkbox.stories.tsx +81 -19
- package/src/components/Checkbox/Checkbox.tsx +246 -5
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +137 -0
- package/src/components/Checkbox/index.ts +6 -1
- package/src/components/Chip/Chip.module.css +246 -43
- package/src/components/Chip/Chip.stories.tsx +101 -21
- package/src/components/Chip/Chip.tsx +136 -6
- package/src/components/Container/Container.stories.tsx +103 -20
- package/src/components/Container/Container.tsx +1 -13
- package/src/components/DatePicker/DatePicker.stories.tsx +125 -19
- package/src/components/DatePicker/DatePicker.tsx +3 -1
- package/src/components/Dropdown/Dropdown.module.css +291 -41
- package/src/components/Dropdown/Dropdown.stories.tsx +80 -21
- package/src/components/Dropdown/Dropdown.tsx +180 -6
- package/src/components/FileInput/FileInput.stories.tsx +2 -19
- package/src/components/FileUpload/FileUpload.stories.tsx +2 -19
- package/src/components/Flex/Flex.stories.tsx +113 -20
- package/src/components/Flex/Flex.tsx +16 -26
- package/src/components/FormControlLayout/FormControlLayout.module.css +92 -0
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +67 -20
- package/src/components/FormControlLayout/FormControlLayout.tsx +69 -4
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +87 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +116 -22
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +126 -6
- package/src/components/Group/Group.stories.tsx +6 -30
- package/src/components/Group/Group.tsx +14 -9
- package/src/components/HoverCard/HoverCard.module.css +90 -22
- package/src/components/HoverCard/HoverCard.stories.tsx +158 -21
- package/src/components/HoverCard/HoverCard.tsx +147 -5
- package/src/components/Label/Label.module.css +140 -35
- package/src/components/Label/Label.stories.tsx +108 -21
- package/src/components/Label/Label.tsx +82 -5
- package/src/components/Link/Link.module.css +4 -3
- package/src/components/Link/Link.stories.tsx +2 -8
- package/src/components/Link/Link.tsx +1 -5
- package/src/components/Loader/Loader.module.css +1 -2
- package/src/components/Loader/Loader.tsx +1 -7
- package/src/components/Menu/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Menu/Menu.module.css +285 -51
- package/src/components/Menu/Menu.stories.tsx +229 -25
- package/src/components/Menu/Menu.tsx +73 -6
- package/src/components/Modal/Modal.module.css +171 -35
- package/src/components/Modal/Modal.stories.tsx +66 -22
- package/src/components/Modal/Modal.tsx +215 -5
- package/src/components/NumberInput/NumberInput.module.css +276 -42
- package/src/components/NumberInput/NumberInput.stories.tsx +83 -20
- package/src/components/NumberInput/NumberInput.tsx +136 -6
- package/src/components/Pagination/IMPLEMENTATION_NOTES.md +3 -0
- package/src/components/Pagination/Pagination.icons.tsx +66 -0
- package/src/components/Pagination/Pagination.module.css +234 -20
- package/src/components/Pagination/Pagination.stories.tsx +34 -21
- package/src/components/Pagination/Pagination.tsx +74 -6
- package/src/components/Panel/Panel.module.css +206 -38
- package/src/components/Panel/Panel.stories.tsx +214 -22
- package/src/components/Panel/Panel.tsx +130 -5
- package/src/components/Radio/Radio.module.css +235 -37
- package/src/components/Radio/Radio.stories.tsx +77 -19
- package/src/components/Radio/Radio.tsx +210 -5
- package/src/components/Radio/RadioGroup.stories.tsx +117 -0
- package/src/components/Radio/RadioGroup.tsx +125 -0
- package/src/components/ReadOnlyField/ReadOnlyBooleanField.tsx +21 -0
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +53 -15
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +147 -19
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +105 -5
- package/src/components/ReadOnlyField/ReadOnlySwitchField.tsx +21 -0
- package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +48 -0
- package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +93 -0
- package/src/components/ReadOnlyField/index.ts +1 -0
- package/src/components/SegmentedControl/SegmentedControl.module.css +179 -47
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +102 -20
- package/src/components/SegmentedControl/SegmentedControl.tsx +140 -6
- package/src/components/Slider/Slider.module.css +539 -86
- package/src/components/Slider/Slider.stories.tsx +157 -19
- package/src/components/Slider/Slider.tsx +283 -5
- package/src/components/Stack/Stack.stories.tsx +4 -25
- package/src/components/Stack/Stack.tsx +1 -5
- package/src/components/Stepper/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Stepper/Stepper.module.css +410 -71
- package/src/components/Stepper/Stepper.stories.tsx +146 -20
- package/src/components/Stepper/Stepper.tsx +147 -6
- package/src/components/Switch/Switch.module.css +259 -39
- package/src/components/Switch/Switch.stories.tsx +98 -19
- package/src/components/Switch/Switch.tsx +200 -6
- package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
- package/src/components/Switch/SwitchGroup.tsx +120 -0
- package/src/components/Table/Table.stories.tsx +1 -19
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/Tabs/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Tabs/Tabs.module.css +422 -79
- package/src/components/Tabs/Tabs.stories.tsx +156 -20
- package/src/components/Tabs/Tabs.tsx +86 -6
- package/src/components/Text/Text.stories.tsx +5 -17
- package/src/components/Text/Text.tsx +1 -15
- package/src/components/TextArea/TextArea.module.css +155 -32
- package/src/components/TextArea/TextArea.stories.tsx +80 -21
- package/src/components/TextArea/TextArea.tsx +146 -6
- package/src/components/TextField/TextField.module.css +261 -42
- package/src/components/TextField/TextField.stories.tsx +147 -20
- package/src/components/TextField/TextField.tsx +169 -6
- package/src/components/TimePicker/TimePicker.stories.tsx +2 -19
- package/src/components/TimePicker/TimePicker.tsx +3 -1
- package/src/components/Timeline/Timeline.module.css +365 -76
- package/src/components/Timeline/Timeline.stories.tsx +114 -21
- package/src/components/Timeline/Timeline.tsx +83 -5
- package/src/components/Timeline/TimelineItem.tsx +90 -0
- package/src/components/Title/Title.stories.tsx +0 -18
- package/src/components/Title/Title.tsx +1 -7
- package/src/components/Toast/Toast.module.css +166 -28
- package/src/components/Toast/Toast.stories.tsx +54 -22
- package/src/components/Toast/Toast.tsx +124 -5
- package/src/components/Tooltip/Tooltip.module.css +89 -24
- package/src/components/Tooltip/Tooltip.stories.tsx +152 -22
- package/src/components/Tooltip/Tooltip.tsx +88 -5
- package/src/components/TransferList/TransferList.stories.tsx +1 -19
- package/src/components/TransferList/TransferList.tsx +3 -1
- package/src/utils/RequireAccessibleLabel.ts +1 -12
- package/src/utils/filterStylingProps.ts +7 -20
|
@@ -1,51 +1,254 @@
|
|
|
1
1
|
/* EXEMPTIONS:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_border-size */
|
|
2
|
+
- close-icon-color, leading-icon-color, and select-specific state icon variables are ignored because
|
|
3
|
+
Chip uses explicit state color definitions (e.g. unselected, selected, error, error-selected variant colors)
|
|
4
|
+
to drive pixel-perfect hover and click transitions, rather than generic single-color overrides.
|
|
5
|
+
- text-size is ignored since actual chip sizing is dynamically driven by precise vertical padding and line-heights. */
|
|
7
6
|
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_close-icon-color */
|
|
8
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_close-icon-size */
|
|
9
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_elevation */
|
|
10
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_horizontal-padding */
|
|
11
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_icon-size */
|
|
12
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_icon-text-gap */
|
|
13
7
|
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_leading-icon-color */
|
|
14
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_max-width */
|
|
15
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_min-width */
|
|
16
8
|
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text-size */
|
|
17
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text_font-family */
|
|
18
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text_font-size */
|
|
19
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text_font-style */
|
|
20
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text_font-weight */
|
|
21
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text_letter-spacing */
|
|
22
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text_line-height */
|
|
23
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text_text-decoration */
|
|
24
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_text_text-transform */
|
|
25
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_properties_vertical-padding */
|
|
26
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_background */
|
|
27
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_border-color */
|
|
28
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_close-icon-color */
|
|
29
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_icon */
|
|
30
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_leading-icon-color */
|
|
31
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_selected-icon-color */
|
|
32
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_text */
|
|
33
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error_properties_colors_background */
|
|
34
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error_properties_colors_border-color */
|
|
35
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error_properties_colors_close-icon-color */
|
|
36
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error_properties_colors_icon */
|
|
37
9
|
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error_properties_colors_leading-icon-color */
|
|
38
10
|
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error_properties_colors_selected-icon-color */
|
|
39
|
-
/* recursica-ignore: --recursica_ui-
|
|
40
|
-
/* recursica-ignore: --recursica_ui-
|
|
41
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_border-color */
|
|
42
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_close-icon-color */
|
|
11
|
+
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_icon */
|
|
12
|
+
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_leading-icon-color */
|
|
43
13
|
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_leading-icon-color */
|
|
44
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_selected-icon-color */
|
|
45
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_text */
|
|
46
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_background */
|
|
47
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_border-color */
|
|
48
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_close-icon-color */
|
|
49
|
-
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_leading-icon-color */
|
|
50
14
|
/* recursica-ignore: --recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_selected-icon-color */
|
|
51
|
-
|
|
15
|
+
|
|
16
|
+
/* HARDCODED VALUES
|
|
17
|
+
border-style: solid; (Baseline reset)
|
|
18
|
+
box-sizing: border-box; (Baseline reset)
|
|
19
|
+
display: inline-flex; (Baseline reset)
|
|
20
|
+
align-items: center; (Baseline reset)
|
|
21
|
+
outline: none; (Accessible fallback)
|
|
22
|
+
padding: 0; (Override mantine default)
|
|
23
|
+
background: transparent; (Override mantine default)
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
.root.root {
|
|
27
|
+
/* Set preset layout variables to override mantine defaults safely */
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
|
|
33
|
+
/* Token properties */
|
|
34
|
+
--chip-height: max-content; /* Sizing is driven by padding and line height */
|
|
35
|
+
--chip-bg: var(
|
|
36
|
+
--recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_background
|
|
37
|
+
);
|
|
38
|
+
--chip-border: var(
|
|
39
|
+
--recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_border-color
|
|
40
|
+
);
|
|
41
|
+
--chip-text: var(
|
|
42
|
+
--recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_text
|
|
43
|
+
);
|
|
44
|
+
--chip-icon: var(
|
|
45
|
+
--recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_leading-icon-color
|
|
46
|
+
);
|
|
47
|
+
--chip-close: var(
|
|
48
|
+
--recursica_ui-kit_components_chip_variants_styles_unselected_properties_colors_close-icon-color
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
/* Container geometry */
|
|
52
|
+
height: var(--chip-height);
|
|
53
|
+
border-radius: var(
|
|
54
|
+
--recursica_ui-kit_components_chip_properties_border-radius
|
|
55
|
+
);
|
|
56
|
+
border-style: solid;
|
|
57
|
+
border-width: var(--recursica_ui-kit_components_chip_properties_border-size);
|
|
58
|
+
padding: var(--recursica_ui-kit_components_chip_properties_vertical-padding)
|
|
59
|
+
var(--recursica_ui-kit_components_chip_properties_horizontal-padding);
|
|
60
|
+
|
|
61
|
+
/* Gap for native MUI icons */
|
|
62
|
+
gap: var(--recursica_ui-kit_components_chip_properties_icon-text-gap);
|
|
63
|
+
|
|
64
|
+
/* Background and colors */
|
|
65
|
+
background-color: var(--chip-bg);
|
|
66
|
+
border-color: var(--chip-border);
|
|
67
|
+
color: var(--chip-text);
|
|
68
|
+
min-width: var(--recursica_ui-kit_components_chip_properties_min-width);
|
|
69
|
+
max-width: var(--recursica_ui-kit_components_chip_properties_max-width);
|
|
70
|
+
box-shadow: var(--recursica_ui-kit_components_chip_properties_elevation);
|
|
71
|
+
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
user-select: none;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
transition: all 0.2s ease;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* We target the mantine label directly because that is the visible container in Mantine's Chip */
|
|
79
|
+
.label.label {
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
|
|
85
|
+
/* Reset MUI styles */
|
|
86
|
+
background: transparent;
|
|
87
|
+
padding: 0;
|
|
88
|
+
border: none;
|
|
89
|
+
border-radius: 0;
|
|
90
|
+
|
|
91
|
+
/* Typography */
|
|
92
|
+
font-family: var(
|
|
93
|
+
--recursica_ui-kit_components_chip_properties_text_font-family
|
|
94
|
+
);
|
|
95
|
+
font-size: var(--recursica_ui-kit_components_chip_properties_text_font-size);
|
|
96
|
+
font-weight: var(
|
|
97
|
+
--recursica_ui-kit_components_chip_properties_text_font-weight
|
|
98
|
+
);
|
|
99
|
+
font-style: var(
|
|
100
|
+
--recursica_ui-kit_components_chip_properties_text_font-style
|
|
101
|
+
);
|
|
102
|
+
letter-spacing: var(
|
|
103
|
+
--recursica_ui-kit_components_chip_properties_text_letter-spacing
|
|
104
|
+
);
|
|
105
|
+
line-height: var(
|
|
106
|
+
--recursica_ui-kit_components_chip_properties_text_line-height
|
|
107
|
+
);
|
|
108
|
+
text-decoration: var(
|
|
109
|
+
--recursica_ui-kit_components_chip_properties_text_text-decoration
|
|
110
|
+
);
|
|
111
|
+
text-transform: var(
|
|
112
|
+
--recursica_ui-kit_components_chip_properties_text_text-transform
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
/* Token evaluation */
|
|
116
|
+
background-color: var(--chip-bg);
|
|
117
|
+
border-color: var(--chip-border);
|
|
118
|
+
color: var(--chip-text);
|
|
119
|
+
min-width: var(--recursica_ui-kit_components_chip_properties_min-width);
|
|
120
|
+
max-width: var(--recursica_ui-kit_components_chip_properties_max-width);
|
|
121
|
+
box-shadow: var(--recursica_ui-kit_components_chip_properties_elevation);
|
|
122
|
+
|
|
123
|
+
transition: all 0.2s ease;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Default (Unselected) hover/active interactions (Mantine overrides) */
|
|
127
|
+
.root.root[data-checked] {
|
|
128
|
+
--chip-bg: var(
|
|
129
|
+
--recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_background
|
|
130
|
+
);
|
|
131
|
+
--chip-border: var(
|
|
132
|
+
--recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_border-color
|
|
133
|
+
);
|
|
134
|
+
--chip-text: var(
|
|
135
|
+
--recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_text
|
|
136
|
+
);
|
|
137
|
+
--chip-icon: var(
|
|
138
|
+
--recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_selected-icon-color
|
|
139
|
+
);
|
|
140
|
+
--chip-close: var(
|
|
141
|
+
--recursica_ui-kit_components_chip_variants_styles_selected_properties_colors_close-icon-color
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.root.root[data-error] {
|
|
146
|
+
--chip-bg: var(
|
|
147
|
+
--recursica_ui-kit_components_chip_variants_styles_error_properties_colors_background
|
|
148
|
+
);
|
|
149
|
+
--chip-border: var(
|
|
150
|
+
--recursica_ui-kit_components_chip_variants_styles_error_properties_colors_border-color
|
|
151
|
+
);
|
|
152
|
+
--chip-text: var(
|
|
153
|
+
--recursica_ui-kit_components_chip_variants_styles_error_properties_colors_text
|
|
154
|
+
);
|
|
155
|
+
--chip-icon: var(
|
|
156
|
+
--recursica_ui-kit_components_chip_variants_styles_error_properties_colors_icon
|
|
157
|
+
);
|
|
158
|
+
--chip-close: var(
|
|
159
|
+
--recursica_ui-kit_components_chip_variants_styles_error_properties_colors_close-icon-color
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.root.root[data-error][data-checked] {
|
|
164
|
+
--chip-bg: var(
|
|
165
|
+
--recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_background
|
|
166
|
+
);
|
|
167
|
+
--chip-border: var(
|
|
168
|
+
--recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_border-color
|
|
169
|
+
);
|
|
170
|
+
--chip-text: var(
|
|
171
|
+
--recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_text
|
|
172
|
+
);
|
|
173
|
+
--chip-icon: var(
|
|
174
|
+
--recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_selected-icon-color
|
|
175
|
+
);
|
|
176
|
+
--chip-close: var(
|
|
177
|
+
--recursica_ui-kit_components_chip_variants_styles_error-selected_properties_colors_close-icon-color
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.root.root[data-disabled] {
|
|
182
|
+
opacity: var(--recursica_brand_states_disabled);
|
|
183
|
+
cursor: not-allowed;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* Override Mantine's built-in check icon colors and size if we keep it */
|
|
187
|
+
.mantineIconWrapper.mantineIconWrapper {
|
|
188
|
+
color: var(--chip-icon);
|
|
189
|
+
width: var(--recursica_ui-kit_components_chip_properties_icon-size);
|
|
190
|
+
height: var(--recursica_ui-kit_components_chip_properties_icon-size);
|
|
191
|
+
margin-right: var(
|
|
192
|
+
--recursica_ui-kit_components_chip_properties_icon-text-gap
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.innerWrapper {
|
|
197
|
+
display: inline-flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
gap: var(--recursica_ui-kit_components_chip_properties_icon-text-gap);
|
|
200
|
+
width: 100%;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.children {
|
|
204
|
+
flex-grow: 1;
|
|
205
|
+
text-overflow: ellipsis;
|
|
206
|
+
overflow: hidden;
|
|
207
|
+
white-space: nowrap;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.leadingIcon {
|
|
211
|
+
display: inline-flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
color: var(--chip-icon);
|
|
215
|
+
width: var(--recursica_ui-kit_components_chip_properties_icon-size);
|
|
216
|
+
height: var(--recursica_ui-kit_components_chip_properties_icon-size);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.leadingIcon svg {
|
|
220
|
+
width: 100%;
|
|
221
|
+
height: 100%;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.removeIconWrapper {
|
|
225
|
+
display: inline-flex;
|
|
226
|
+
align-items: center;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
color: var(--chip-close);
|
|
229
|
+
width: var(--recursica_ui-kit_components_chip_properties_close-icon-size);
|
|
230
|
+
height: var(--recursica_ui-kit_components_chip_properties_close-icon-size);
|
|
231
|
+
cursor: pointer;
|
|
232
|
+
border-radius: 50%; /* HARDCODE: Make focus ring rounded */
|
|
233
|
+
outline: none;
|
|
234
|
+
/* Reset MUI icon defaults */
|
|
235
|
+
margin: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.removeIconWrapper:focus-visible {
|
|
239
|
+
box-shadow: 0 0 0 2px var(--chip-border); /* HARDCODE: Focus indication */
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.removeIconWrapper svg {
|
|
243
|
+
width: 100%;
|
|
244
|
+
height: 100%;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.root.root[data-icon-only] {
|
|
248
|
+
padding-left: var(
|
|
249
|
+
--recursica_ui-kit_components_chip_properties_vertical-padding
|
|
250
|
+
);
|
|
251
|
+
padding-right: var(
|
|
252
|
+
--recursica_ui-kit_components_chip_properties_vertical-padding
|
|
253
|
+
);
|
|
254
|
+
}
|
|
@@ -1,35 +1,115 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { Chip } from "./Chip";
|
|
3
|
-
import { ComingSoon } from "@recursica/storybook-template";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type ChipStoryProps = React.ComponentProps<typeof Chip>;
|
|
6
|
+
|
|
7
|
+
const meta: Meta<ChipStoryProps> = {
|
|
8
|
+
title: "UI-Kit/Chip",
|
|
7
9
|
component: Chip,
|
|
8
10
|
tags: ["autodocs"],
|
|
9
11
|
parameters: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component:
|
|
15
|
+
"The Chip component is used to represent interactive selections, descriptive tags, or dynamic filters natively bounded to Recursica variables. It can be used as a toggleable input, can render a custom leading `icon`, and handles close constraints automatically via the `onRemove` property.",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
error: {
|
|
21
|
+
control: "boolean",
|
|
22
|
+
description: "Applies the error state styling dynamically.",
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
control: "boolean",
|
|
26
|
+
description: "Applies disabled token states.",
|
|
27
|
+
},
|
|
28
|
+
checked: {
|
|
29
|
+
control: "boolean",
|
|
30
|
+
description: "Forces the visual selected state.",
|
|
26
31
|
},
|
|
27
32
|
},
|
|
28
33
|
};
|
|
29
34
|
|
|
30
35
|
export default meta;
|
|
31
|
-
type Story = StoryObj<typeof Chip>;
|
|
32
36
|
|
|
37
|
+
type Story = StoryObj<ChipStoryProps>;
|
|
38
|
+
|
|
39
|
+
// The Default story exposing native properties for the playground.
|
|
33
40
|
export const Default: Story = {
|
|
34
|
-
|
|
41
|
+
args: {
|
|
42
|
+
children: "Default Chip",
|
|
43
|
+
error: false,
|
|
44
|
+
disabled: false,
|
|
45
|
+
checked: false,
|
|
46
|
+
},
|
|
47
|
+
render: (args: ChipStoryProps) => <Chip {...args} />,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Static Stories for Regression Snapshots
|
|
51
|
+
export const Unselected: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
children: "Unselected",
|
|
54
|
+
checked: false,
|
|
55
|
+
},
|
|
56
|
+
render: (args: ChipStoryProps) => <Chip {...args} />,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Selected: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
children: "Selected",
|
|
62
|
+
checked: true,
|
|
63
|
+
},
|
|
64
|
+
render: (args: ChipStoryProps) => <Chip {...args} onChange={() => {}} />,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const ErrorState: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
children: "Error",
|
|
70
|
+
error: true,
|
|
71
|
+
checked: false,
|
|
72
|
+
},
|
|
73
|
+
render: (args: ChipStoryProps) => <Chip {...args} />,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const ErrorSelected: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
children: "Error Selected",
|
|
79
|
+
error: true,
|
|
80
|
+
checked: true,
|
|
81
|
+
},
|
|
82
|
+
render: (args: ChipStoryProps) => <Chip {...args} onChange={() => {}} />,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const Removable: Story = {
|
|
86
|
+
args: {
|
|
87
|
+
children: "Dismissible",
|
|
88
|
+
checked: false,
|
|
89
|
+
onRemove: () => console.log("Removal Action Triggered"),
|
|
90
|
+
},
|
|
91
|
+
render: (args: ChipStoryProps) => <Chip {...args} />,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const WithLeadingIcon: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
children: "Leading Icon",
|
|
97
|
+
checked: false,
|
|
98
|
+
icon: (
|
|
99
|
+
<svg
|
|
100
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
101
|
+
viewBox="0 0 24 24"
|
|
102
|
+
fill="none"
|
|
103
|
+
stroke="currentColor"
|
|
104
|
+
strokeWidth="2"
|
|
105
|
+
strokeLinecap="round"
|
|
106
|
+
strokeLinejoin="round"
|
|
107
|
+
>
|
|
108
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
109
|
+
<path d="M12 8v4"></path>
|
|
110
|
+
<path d="M12 16h.01"></path>
|
|
111
|
+
</svg>
|
|
112
|
+
),
|
|
113
|
+
},
|
|
114
|
+
render: (args: ChipStoryProps) => <Chip {...args} />,
|
|
35
115
|
};
|
|
@@ -1,8 +1,138 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Chip as MuiChip, type ChipProps as MuiChipProps } from "@mui/material";
|
|
3
|
+
import {
|
|
4
|
+
filterStylingProps,
|
|
5
|
+
type RecursicaOverStyled,
|
|
6
|
+
} from "../../utils/filterStylingProps";
|
|
7
|
+
import styles from "./Chip.module.css";
|
|
3
8
|
|
|
4
|
-
|
|
9
|
+
import { type RecursicaChipProps } from "@recursica/adapter-common";
|
|
5
10
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
export type ChipProps = RecursicaOverStyled<
|
|
12
|
+
Omit<MuiChipProps, "variant" | "size" | "color" | "radius"> &
|
|
13
|
+
RecursicaChipProps
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
function CloseIcon(props: React.ComponentPropsWithoutRef<"svg">) {
|
|
17
|
+
return (
|
|
18
|
+
<svg
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
width="24"
|
|
21
|
+
height="24"
|
|
22
|
+
viewBox="0 0 24 24"
|
|
23
|
+
fill="none"
|
|
24
|
+
stroke="currentColor"
|
|
25
|
+
strokeWidth="2"
|
|
26
|
+
strokeLinecap="round"
|
|
27
|
+
strokeLinejoin="round"
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
31
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function CheckIcon(props: React.ComponentPropsWithoutRef<"svg">) {
|
|
37
|
+
return (
|
|
38
|
+
<svg
|
|
39
|
+
viewBox="0 0 10 7"
|
|
40
|
+
fill="none"
|
|
41
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
<path
|
|
45
|
+
d="M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z"
|
|
46
|
+
fill="currentColor"
|
|
47
|
+
fillRule="evenodd"
|
|
48
|
+
clipRule="evenodd"
|
|
49
|
+
/>
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const Chip = forwardRef<HTMLInputElement, ChipProps>(function Chip(
|
|
55
|
+
{
|
|
56
|
+
error = false,
|
|
57
|
+
icon,
|
|
58
|
+
onRemove,
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
60
|
+
removeLabel = "Remove",
|
|
61
|
+
children,
|
|
62
|
+
checked,
|
|
63
|
+
overStyled = false,
|
|
64
|
+
...rest
|
|
65
|
+
},
|
|
66
|
+
ref,
|
|
67
|
+
) {
|
|
68
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
69
|
+
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
70
|
+
|
|
71
|
+
const mergedClassNames: Partial<Record<string, string>> = {
|
|
72
|
+
root: styles.root,
|
|
73
|
+
label: styles.label,
|
|
74
|
+
icon: styles.leadingIcon,
|
|
75
|
+
deleteIcon: styles.removeIconWrapper,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const classNamesProp = restRecord.classNames;
|
|
79
|
+
if (
|
|
80
|
+
classNamesProp &&
|
|
81
|
+
typeof classNamesProp === "object" &&
|
|
82
|
+
!Array.isArray(classNamesProp)
|
|
83
|
+
) {
|
|
84
|
+
const o = classNamesProp as Partial<Record<string, string>>;
|
|
85
|
+
mergedClassNames.root = o.root ? `${styles.root} ${o.root}` : styles.root;
|
|
86
|
+
mergedClassNames.label = o.label
|
|
87
|
+
? `${styles.label} ${o.label}`
|
|
88
|
+
: styles.label;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const classNameProp = restRecord.className as string | undefined;
|
|
92
|
+
const finalClass = classNameProp
|
|
93
|
+
? `${styles.root} ${classNameProp}`
|
|
94
|
+
: styles.root;
|
|
95
|
+
|
|
96
|
+
// Determine state
|
|
97
|
+
const dataError = error ? "" : undefined;
|
|
98
|
+
const dataChecked = checked ? "" : undefined;
|
|
99
|
+
const isIconOnly = !children && (!!icon || !!onRemove);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<MuiChip
|
|
103
|
+
ref={ref}
|
|
104
|
+
className={finalClass}
|
|
105
|
+
classes={mergedClassNames}
|
|
106
|
+
{...(dataError !== undefined ? { "data-error": "" } : {})}
|
|
107
|
+
{...(dataChecked !== undefined ? { "data-checked": "" } : {})}
|
|
108
|
+
{...(isIconOnly ? { "data-icon-only": "" } : {})}
|
|
109
|
+
{...sanitizedProps}
|
|
110
|
+
icon={
|
|
111
|
+
checked ? (
|
|
112
|
+
<span className={styles.mantineIconWrapper} aria-hidden>
|
|
113
|
+
<CheckIcon />
|
|
114
|
+
</span>
|
|
115
|
+
) : icon ? (
|
|
116
|
+
<span className={styles.leadingIcon} aria-hidden>
|
|
117
|
+
{icon}
|
|
118
|
+
</span>
|
|
119
|
+
) : undefined
|
|
120
|
+
}
|
|
121
|
+
onDelete={onRemove}
|
|
122
|
+
deleteIcon={
|
|
123
|
+
onRemove ? (
|
|
124
|
+
<span className={styles.removeIconWrapper}>
|
|
125
|
+
<CloseIcon />
|
|
126
|
+
</span>
|
|
127
|
+
) : undefined
|
|
128
|
+
}
|
|
129
|
+
label={
|
|
130
|
+
<span className={styles.innerWrapper}>
|
|
131
|
+
<span className={styles.children}>{children}</span>
|
|
132
|
+
</span>
|
|
133
|
+
}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
Chip.displayName = "Chip";
|