@recursica/mui-adapter 0.4.0 → 0.6.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/CHANGELOG.md +15 -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 +6651 -201
- package/dist/mui-adapter.js.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts +63 -2
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +9 -2
- package/dist/src/components/Autocomplete/Autocomplete.d.ts +17 -0
- package/dist/src/components/Autocomplete/index.d.ts +1 -0
- package/dist/src/components/Avatar/Avatar.d.ts +14 -2
- package/dist/src/components/Badge/Badge.d.ts +13 -3
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +10 -3
- package/dist/src/components/Button/Button.d.ts +1 -1
- package/dist/src/components/Card/Card.d.ts +40 -3
- package/dist/src/components/Checkbox/Checkbox.d.ts +15 -2
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +16 -0
- package/dist/src/components/Checkbox/index.d.ts +5 -1
- package/dist/src/components/Chip/Chip.d.ts +18 -2
- package/dist/src/components/Dropdown/Dropdown.d.ts +23 -3
- package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +10 -2
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +24 -2
- package/dist/src/components/HoverCard/HoverCard.d.ts +55 -3
- package/dist/src/components/Label/Label.d.ts +13 -2
- package/dist/src/components/Link/Link.d.ts +1 -1
- package/dist/src/components/Menu/Menu.d.ts +99 -3
- package/dist/src/components/Modal/Modal.d.ts +36 -2
- package/dist/src/components/NumberInput/NumberInput.d.ts +14 -2
- package/dist/src/components/Pagination/Pagination.d.ts +44 -2
- package/dist/src/components/Pagination/Pagination.icons.d.ts +8 -0
- package/dist/src/components/Panel/Panel.d.ts +65 -3
- package/dist/src/components/Radio/Radio.d.ts +13 -3
- package/dist/src/components/Radio/RadioGroup.d.ts +13 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyBooleanField.d.ts +5 -0
- package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +7 -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 +31 -3
- package/dist/src/components/Slider/Slider.d.ts +28 -2
- package/dist/src/components/Stepper/Stepper.d.ts +21 -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/Tabs/Tabs.d.ts +35 -3
- package/dist/src/components/Text/Text.d.ts +1 -1
- package/dist/src/components/TextArea/TextArea.d.ts +18 -2
- package/dist/src/components/TextField/TextField.d.ts +16 -2
- package/dist/src/components/Timeline/Timeline.d.ts +14 -2
- package/dist/src/components/Timeline/TimelineItem.d.ts +29 -0
- package/dist/src/components/Title/Title.d.ts +1 -1
- package/dist/src/components/Toast/Toast.d.ts +25 -2
- package/dist/src/components/Tooltip/Tooltip.d.ts +42 -3
- package/dist/src/components/Typography/Typography.d.ts +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/package.json +12 -2
- package/src/GlobalExemptions.modules.css +13 -0
- package/src/components/Accordion/Accordion.module.css +295 -0
- package/src/components/Accordion/Accordion.stories.tsx +149 -21
- package/src/components/Accordion/Accordion.tsx +264 -4
- package/src/components/AssistiveElement/AssistiveElement.module.css +111 -0
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +76 -19
- package/src/components/AssistiveElement/AssistiveElement.tsx +85 -4
- package/src/components/Autocomplete/Autocomplete.module.css +325 -0
- package/src/components/Autocomplete/Autocomplete.stories.tsx +196 -0
- package/src/components/Autocomplete/Autocomplete.tsx +201 -0
- package/src/components/Autocomplete/index.ts +1 -0
- package/src/components/Avatar/Avatar.module.css +344 -0
- package/src/components/Avatar/Avatar.stories.tsx +94 -22
- package/src/components/Avatar/Avatar.tsx +110 -5
- package/src/components/Badge/Badge.module.css +127 -0
- package/src/components/Badge/Badge.stories.tsx +65 -22
- package/src/components/Badge/Badge.tsx +70 -5
- package/src/components/Breadcrumb/Breadcrumb.module.css +26 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +57 -22
- package/src/components/Breadcrumb/Breadcrumb.tsx +62 -5
- package/src/components/Button/Button.module.css +113 -20
- package/src/components/Button/Button.stories.tsx +3 -0
- package/src/components/Button/Button.tsx +10 -3
- package/src/components/Card/Card.module.css +118 -0
- package/src/components/Card/Card.stories.tsx +117 -19
- package/src/components/Card/Card.tsx +179 -4
- package/src/components/Checkbox/Checkbox.module.css +232 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +81 -19
- package/src/components/Checkbox/Checkbox.tsx +146 -4
- package/src/components/Checkbox/CheckboxGroup.tsx +117 -0
- package/src/components/Checkbox/index.ts +6 -1
- package/src/components/Chip/Chip.module.css +236 -0
- package/src/components/Chip/Chip.stories.tsx +101 -21
- package/src/components/Chip/Chip.tsx +138 -5
- package/src/components/DatePicker/DatePicker.module.css +42 -0
- package/src/components/DatePicker/DatePicker.tsx +1 -0
- package/src/components/Dropdown/Dropdown.module.css +296 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +80 -21
- package/src/components/Dropdown/Dropdown.tsx +182 -5
- package/src/components/FileInput/FileInput.module.css +47 -0
- package/src/components/FileInput/FileInput.tsx +1 -0
- package/src/components/FileUpload/FileUpload.module.css +40 -0
- package/src/components/FileUpload/FileUpload.tsx +1 -0
- package/src/components/FormControlLayout/FormControlLayout.module.css +92 -0
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +74 -19
- package/src/components/FormControlLayout/FormControlLayout.tsx +58 -4
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +96 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +122 -19
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +145 -6
- package/src/components/HoverCard/HoverCard.module.css +91 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +158 -21
- package/src/components/HoverCard/HoverCard.tsx +150 -4
- package/src/components/Label/Label.module.css +136 -0
- package/src/components/Label/Label.stories.tsx +98 -17
- package/src/components/Label/Label.tsx +88 -4
- package/src/components/Link/Link.module.css +8 -0
- package/src/components/Menu/Menu.module.css +287 -0
- package/src/components/Menu/Menu.stories.tsx +307 -21
- package/src/components/Menu/Menu.tsx +318 -4
- package/src/components/Modal/Modal.module.css +172 -0
- package/src/components/Modal/Modal.stories.tsx +66 -22
- package/src/components/Modal/Modal.tsx +216 -3
- package/src/components/NumberInput/NumberInput.module.css +281 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +83 -20
- package/src/components/NumberInput/NumberInput.tsx +148 -5
- package/src/components/Pagination/Pagination.icons.tsx +66 -0
- package/src/components/Pagination/Pagination.module.css +307 -0
- package/src/components/Pagination/Pagination.stories.tsx +42 -21
- package/src/components/Pagination/Pagination.tsx +193 -4
- package/src/components/Panel/Panel.module.css +206 -0
- package/src/components/Panel/Panel.stories.tsx +214 -22
- package/src/components/Panel/Panel.tsx +153 -4
- package/src/components/Radio/Radio.module.css +220 -0
- package/src/components/Radio/Radio.stories.tsx +77 -19
- package/src/components/Radio/Radio.tsx +178 -4
- package/src/components/Radio/RadioGroup.tsx +111 -0
- package/src/components/ReadOnlyField/ReadOnlyBooleanField.tsx +21 -0
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +54 -0
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +175 -16
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +109 -4
- 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 +203 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +102 -20
- package/src/components/SegmentedControl/SegmentedControl.tsx +110 -5
- package/src/components/Slider/Slider.module.css +542 -0
- package/src/components/Slider/Slider.stories.tsx +157 -19
- package/src/components/Slider/Slider.tsx +282 -4
- package/src/components/Stepper/Stepper.module.css +410 -0
- package/src/components/Stepper/Stepper.stories.tsx +132 -19
- package/src/components/Stepper/Stepper.tsx +145 -5
- package/src/components/Switch/Switch.module.css +238 -0
- package/src/components/Switch/Switch.stories.tsx +98 -19
- package/src/components/Switch/Switch.tsx +153 -5
- package/src/components/Switch/SwitchGroup.tsx +111 -0
- package/src/components/Tabs/Tabs.module.css +422 -0
- package/src/components/Tabs/Tabs.stories.tsx +138 -19
- package/src/components/Tabs/Tabs.tsx +103 -5
- package/src/components/TextArea/TextArea.module.css +160 -0
- package/src/components/TextArea/TextArea.stories.tsx +80 -21
- package/src/components/TextArea/TextArea.tsx +156 -5
- package/src/components/TextField/TextField.module.css +266 -0
- package/src/components/TextField/TextField.stories.tsx +168 -15
- package/src/components/TextField/TextField.tsx +171 -5
- package/src/components/TimePicker/TimePicker.module.css +41 -0
- package/src/components/TimePicker/TimePicker.tsx +1 -0
- package/src/components/Timeline/Timeline.module.css +367 -0
- package/src/components/Timeline/Timeline.stories.tsx +114 -21
- package/src/components/Timeline/Timeline.tsx +80 -4
- package/src/components/Timeline/TimelineItem.tsx +101 -0
- package/src/components/Toast/Toast.module.css +170 -0
- package/src/components/Toast/Toast.stories.tsx +54 -22
- package/src/components/Toast/Toast.tsx +90 -4
- package/src/components/Tooltip/Tooltip.module.css +90 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +152 -22
- package/src/components/Tooltip/Tooltip.tsx +114 -4
- package/src/components/TransferList/TransferList.module.css +38 -0
- package/src/components/TransferList/TransferList.tsx +1 -0
- package/src/components/index.ts +1 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/* EXEMPTIONS:
|
|
2
|
+
- state-specific border-size variables are ignored because a uniform 1px border is applied globally to prevent
|
|
3
|
+
unexpected layout shift or flickering during focus, disabled, or error state transitions. */
|
|
4
|
+
/* recursica-ignore: --recursica_ui-kit_components_dropdown_variants_states_default_properties_border-size */
|
|
5
|
+
/* recursica-ignore: --recursica_ui-kit_components_dropdown_variants_states_disabled_properties_border-size */
|
|
6
|
+
/* recursica-ignore: --recursica_ui-kit_components_dropdown_variants_states_error_properties_border-size */
|
|
7
|
+
/* recursica-ignore: --recursica_ui-kit_components_dropdown_variants_states_focus_properties_border-size */
|
|
8
|
+
|
|
9
|
+
/* LAYOUT SPACING OVERRIDES:
|
|
10
|
+
- Sets the --form-control-margin-bottom spacing hook to map component-specific layout tokens. */
|
|
11
|
+
.layoutOverride {
|
|
12
|
+
--form-control-margin-bottom: var(
|
|
13
|
+
--recursica_ui-kit_components_dropdown_variants_layouts_stacked_properties_top-bottom-margin
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.layoutOverride[data-form-layout="side-by-side"] {
|
|
18
|
+
--form-control-margin-bottom: var(
|
|
19
|
+
--recursica_ui-kit_components_dropdown_variants_layouts_side-by-side_properties_top-bottom-margin
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* HARDCODED VALUES:
|
|
24
|
+
- border-width: 1px. Native geometric boundary for the input box.
|
|
25
|
+
- border-style: solid. Native structural rendering rule.
|
|
26
|
+
- outline: none. Bypassing browser focus rings to rely strictly on Recursica focus states natively.
|
|
27
|
+
- flex/layout: display: flex on the root wrapper safely encapsulating internal section rendering.
|
|
28
|
+
- placeholder opacity: 0.5. The dropdown parameters currently lack a dedicated placeholder-opacity variable.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
.root {
|
|
32
|
+
display: flex;
|
|
33
|
+
position: relative;
|
|
34
|
+
width: 100%;
|
|
35
|
+
min-height: var(--recursica_ui-kit_components_dropdown_properties_min-height);
|
|
36
|
+
|
|
37
|
+
/* Override Mantine native Input variables governing section spacing padding mathematics safely */
|
|
38
|
+
--input-left-section-size: calc(
|
|
39
|
+
var(--recursica_ui-kit_components_dropdown_properties_horizontal-padding) +
|
|
40
|
+
var(--recursica_ui-kit_components_dropdown_properties_icon-size) +
|
|
41
|
+
var(--recursica_ui-kit_components_dropdown_properties_icon-text-gap)
|
|
42
|
+
);
|
|
43
|
+
--input-right-section-size: calc(
|
|
44
|
+
var(--recursica_ui-kit_components_dropdown_properties_horizontal-padding) +
|
|
45
|
+
var(--recursica_ui-kit_components_dropdown_properties_icon-size) +
|
|
46
|
+
var(--recursica_ui-kit_components_dropdown_properties_icon-text-gap)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.input {
|
|
51
|
+
/* Structural Overrides */
|
|
52
|
+
width: 100%;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
margin: 0;
|
|
55
|
+
|
|
56
|
+
/* Box Geometry */
|
|
57
|
+
min-height: var(--recursica_ui-kit_components_dropdown_properties_min-height);
|
|
58
|
+
padding-top: var(
|
|
59
|
+
--recursica_ui-kit_components_dropdown_properties_vertical-padding
|
|
60
|
+
);
|
|
61
|
+
padding-bottom: var(
|
|
62
|
+
--recursica_ui-kit_components_dropdown_properties_vertical-padding
|
|
63
|
+
);
|
|
64
|
+
padding-left: var(
|
|
65
|
+
--recursica_ui-kit_components_dropdown_properties_horizontal-padding
|
|
66
|
+
);
|
|
67
|
+
padding-right: var(
|
|
68
|
+
--recursica_ui-kit_components_dropdown_properties_horizontal-padding
|
|
69
|
+
);
|
|
70
|
+
border-radius: var(
|
|
71
|
+
--recursica_ui-kit_components_dropdown_properties_border-radius
|
|
72
|
+
);
|
|
73
|
+
border-width: 1px;
|
|
74
|
+
border-style: solid;
|
|
75
|
+
|
|
76
|
+
/* Strict Typography Unification */
|
|
77
|
+
font-family: var(
|
|
78
|
+
--recursica_ui-kit_components_dropdown_properties_text_font-family
|
|
79
|
+
);
|
|
80
|
+
font-size: var(
|
|
81
|
+
--recursica_ui-kit_components_dropdown_properties_text_font-size
|
|
82
|
+
);
|
|
83
|
+
font-style: var(
|
|
84
|
+
--recursica_ui-kit_components_dropdown_properties_text_font-style
|
|
85
|
+
);
|
|
86
|
+
font-weight: var(
|
|
87
|
+
--recursica_ui-kit_components_dropdown_properties_text_font-weight
|
|
88
|
+
);
|
|
89
|
+
letter-spacing: var(
|
|
90
|
+
--recursica_ui-kit_components_dropdown_properties_text_letter-spacing
|
|
91
|
+
);
|
|
92
|
+
line-height: var(
|
|
93
|
+
--recursica_ui-kit_components_dropdown_properties_text_line-height
|
|
94
|
+
);
|
|
95
|
+
text-decoration: var(
|
|
96
|
+
--recursica_ui-kit_components_dropdown_properties_text_text-decoration
|
|
97
|
+
);
|
|
98
|
+
text-transform: var(
|
|
99
|
+
--recursica_ui-kit_components_dropdown_properties_text_text-transform
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
/* Base State Default Execution */
|
|
103
|
+
background-color: var(
|
|
104
|
+
--recursica_ui-kit_components_dropdown_variants_states_default_properties_colors_background
|
|
105
|
+
);
|
|
106
|
+
border-color: var(
|
|
107
|
+
--recursica_ui-kit_components_dropdown_variants_states_default_properties_colors_border-color
|
|
108
|
+
);
|
|
109
|
+
color: var(
|
|
110
|
+
--recursica_ui-kit_components_dropdown_variants_states_default_properties_colors_text
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
outline: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.input::placeholder {
|
|
117
|
+
/* HARDCODE: Dropdown properties currently missing placeholder-opacity tokens from Figma JSON */
|
|
118
|
+
opacity: 0.5;
|
|
119
|
+
color: inherit;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* Dynamic Padding Overrides */
|
|
123
|
+
.root[data-with-left-section] .input {
|
|
124
|
+
padding-left: var(--input-left-section-size);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.root[data-with-right-section] .input {
|
|
128
|
+
padding-right: var(--input-right-section-size);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Flexible End-Caps (Icons, actions) */
|
|
132
|
+
.section {
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
height: 100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.section[data-position="left"] {
|
|
139
|
+
justify-content: flex-start;
|
|
140
|
+
padding-left: var(
|
|
141
|
+
--recursica_ui-kit_components_dropdown_properties_horizontal-padding
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.section[data-position="right"] {
|
|
146
|
+
justify-content: flex-end;
|
|
147
|
+
padding-right: var(
|
|
148
|
+
--recursica_ui-kit_components_dropdown_properties_horizontal-padding
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.section :global(svg) {
|
|
153
|
+
width: var(--recursica_ui-kit_components_dropdown_properties_icon-size);
|
|
154
|
+
height: var(--recursica_ui-kit_components_dropdown_properties_icon-size);
|
|
155
|
+
color: var(
|
|
156
|
+
--recursica_ui-kit_components_dropdown_variants_states_default_properties_colors_leading-icon
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.section[data-position="right"] :global(svg) {
|
|
161
|
+
color: var(
|
|
162
|
+
--recursica_ui-kit_components_dropdown_variants_states_default_properties_colors_trailing-icon
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* -------------------------------------
|
|
167
|
+
STATE CASCADE ARCHITECTURE
|
|
168
|
+
-------------------------------------- */
|
|
169
|
+
|
|
170
|
+
/* Focus State Mapping (Triggered internally via browser pseudo-pseudo-class) */
|
|
171
|
+
.input:focus-within,
|
|
172
|
+
.input:focus {
|
|
173
|
+
border-color: var(
|
|
174
|
+
--recursica_ui-kit_components_dropdown_variants_states_focus_properties_colors_border-color
|
|
175
|
+
);
|
|
176
|
+
background-color: var(
|
|
177
|
+
--recursica_ui-kit_components_dropdown_variants_states_focus_properties_colors_background
|
|
178
|
+
);
|
|
179
|
+
color: var(
|
|
180
|
+
--recursica_ui-kit_components_dropdown_variants_states_focus_properties_colors_text
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.root:focus-within .section[data-position="left"] :global(svg) {
|
|
185
|
+
color: var(
|
|
186
|
+
--recursica_ui-kit_components_dropdown_variants_states_focus_properties_colors_leading-icon
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.root:focus-within .section[data-position="right"] :global(svg) {
|
|
191
|
+
color: var(
|
|
192
|
+
--recursica_ui-kit_components_dropdown_variants_states_focus_properties_colors_trailing-icon
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Error State Mapping (Propagated strictly down from the wrapper DOM context) */
|
|
197
|
+
.root[data-error] .input {
|
|
198
|
+
border-color: var(
|
|
199
|
+
--recursica_ui-kit_components_dropdown_variants_states_error_properties_colors_border-color
|
|
200
|
+
) !important;
|
|
201
|
+
background-color: var(
|
|
202
|
+
--recursica_ui-kit_components_dropdown_variants_states_error_properties_colors_background
|
|
203
|
+
) !important;
|
|
204
|
+
color: var(
|
|
205
|
+
--recursica_ui-kit_components_dropdown_variants_states_error_properties_colors_text
|
|
206
|
+
) !important;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.root[data-error] .section[data-position="left"] :global(svg) {
|
|
210
|
+
color: var(
|
|
211
|
+
--recursica_ui-kit_components_dropdown_variants_states_error_properties_colors_leading-icon
|
|
212
|
+
) !important;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.root[data-error] .section[data-position="right"] :global(svg) {
|
|
216
|
+
color: var(
|
|
217
|
+
--recursica_ui-kit_components_dropdown_variants_states_error_properties_colors_trailing-icon
|
|
218
|
+
) !important;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* Disabled State Mapping (Propagated strictly down from the wrapper DOM context) */
|
|
222
|
+
.root[data-disabled] .input {
|
|
223
|
+
border-color: var(
|
|
224
|
+
--recursica_ui-kit_components_dropdown_variants_states_disabled_properties_colors_border-color
|
|
225
|
+
) !important;
|
|
226
|
+
background-color: var(
|
|
227
|
+
--recursica_ui-kit_components_dropdown_variants_states_disabled_properties_colors_background
|
|
228
|
+
) !important;
|
|
229
|
+
color: var(
|
|
230
|
+
--recursica_ui-kit_components_dropdown_variants_states_disabled_properties_colors_text
|
|
231
|
+
) !important;
|
|
232
|
+
cursor: not-allowed;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.root[data-disabled] .section[data-position="left"] :global(svg) {
|
|
236
|
+
color: var(
|
|
237
|
+
--recursica_ui-kit_components_dropdown_variants_states_disabled_properties_colors_leading-icon
|
|
238
|
+
) !important;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.root[data-disabled] .section[data-position="right"] :global(svg) {
|
|
242
|
+
color: var(
|
|
243
|
+
--recursica_ui-kit_components_dropdown_variants_states_disabled_properties_colors_trailing-icon
|
|
244
|
+
) !important;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* -------------------------------------
|
|
248
|
+
DROPDOWN & OPTIONS ARCHITECTURE
|
|
249
|
+
-------------------------------------- */
|
|
250
|
+
|
|
251
|
+
.dropdown {
|
|
252
|
+
background-color: var(
|
|
253
|
+
--recursica_ui-kit_components_dropdown_variants_states_default_properties_colors_background
|
|
254
|
+
);
|
|
255
|
+
border: 1px solid
|
|
256
|
+
var(
|
|
257
|
+
--recursica_ui-kit_components_dropdown_variants_states_default_properties_colors_border-color
|
|
258
|
+
);
|
|
259
|
+
border-radius: var(
|
|
260
|
+
--recursica_ui-kit_components_dropdown_properties_border-radius
|
|
261
|
+
);
|
|
262
|
+
overflow: hidden;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.option {
|
|
266
|
+
font-family: var(
|
|
267
|
+
--recursica_ui-kit_components_dropdown_properties_text_font-family
|
|
268
|
+
);
|
|
269
|
+
font-size: var(
|
|
270
|
+
--recursica_ui-kit_components_dropdown_properties_text_font-size
|
|
271
|
+
);
|
|
272
|
+
font-weight: var(
|
|
273
|
+
--recursica_ui-kit_components_dropdown_properties_text_font-weight
|
|
274
|
+
);
|
|
275
|
+
color: var(
|
|
276
|
+
--recursica_ui-kit_components_dropdown_variants_states_default_properties_colors_text
|
|
277
|
+
);
|
|
278
|
+
padding: calc(
|
|
279
|
+
var(--recursica_ui-kit_components_dropdown_properties_vertical-padding) *
|
|
280
|
+
0.75
|
|
281
|
+
)
|
|
282
|
+
var(--recursica_ui-kit_components_dropdown_properties_horizontal-padding);
|
|
283
|
+
cursor: pointer;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.option[data-selected="true"],
|
|
287
|
+
.option[data-combobox-selected="true"],
|
|
288
|
+
.option[data-hovered="true"],
|
|
289
|
+
.option:hover {
|
|
290
|
+
background-color: var(
|
|
291
|
+
--recursica_ui-kit_components_dropdown_variants_states_focus_properties_colors_background
|
|
292
|
+
);
|
|
293
|
+
color: var(
|
|
294
|
+
--recursica_ui-kit_components_dropdown_variants_states_focus_properties_colors_text
|
|
295
|
+
);
|
|
296
|
+
}
|
|
@@ -1,35 +1,94 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { Dropdown } from "./Dropdown";
|
|
3
|
-
import {
|
|
4
|
+
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
type DropdownStoryProps = React.ComponentProps<typeof Dropdown>;
|
|
7
|
+
|
|
8
|
+
const meta: Meta<DropdownStoryProps> = {
|
|
9
|
+
title: "UI-Kit/Dropdown",
|
|
7
10
|
component: Dropdown,
|
|
8
11
|
tags: ["autodocs"],
|
|
9
12
|
parameters: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"Dropdown provides a selectable list of options, mapping natively over Mantine's Select component encapsulated within the standardized FormControlWrapper.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
label: "Country Selection",
|
|
22
|
+
assistiveText: "Select your country of origin.",
|
|
23
|
+
placeholder: "Pick value",
|
|
24
|
+
data: ["United States", "Canada", "Mexico", "United Kingdom", "France"],
|
|
25
|
+
disabled: false,
|
|
26
|
+
required: false,
|
|
27
|
+
readOnly: false,
|
|
28
|
+
searchable: false,
|
|
29
|
+
clearable: false,
|
|
30
|
+
},
|
|
31
|
+
argTypes: {
|
|
32
|
+
disabled: {
|
|
33
|
+
control: "boolean",
|
|
34
|
+
},
|
|
35
|
+
...formControlArgTypes,
|
|
36
|
+
readOnly: {
|
|
37
|
+
control: "boolean",
|
|
38
|
+
},
|
|
39
|
+
searchable: {
|
|
40
|
+
control: "boolean",
|
|
41
|
+
},
|
|
42
|
+
clearable: {
|
|
43
|
+
control: "boolean",
|
|
44
|
+
},
|
|
45
|
+
checked: {
|
|
46
|
+
table: { disable: true },
|
|
47
|
+
},
|
|
48
|
+
defaultChecked: {
|
|
49
|
+
table: { disable: true },
|
|
50
|
+
},
|
|
51
|
+
containerWidth: {
|
|
52
|
+
table: { disable: true },
|
|
26
53
|
},
|
|
27
54
|
},
|
|
28
55
|
};
|
|
29
56
|
|
|
30
57
|
export default meta;
|
|
31
|
-
|
|
58
|
+
|
|
59
|
+
type Story = StoryObj<DropdownStoryProps>;
|
|
32
60
|
|
|
33
61
|
export const Default: Story = {
|
|
34
|
-
|
|
62
|
+
args: {},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const SearchableClearable: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
label: "Search & Clear Options",
|
|
68
|
+
searchable: true,
|
|
69
|
+
clearable: true,
|
|
70
|
+
placeholder: "Start typing...",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const StaticError: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
error: "You must choose a valid destination.",
|
|
77
|
+
value: "Invalid Island",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const StaticDisabled: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
disabled: true,
|
|
84
|
+
value: "United States",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const StaticReadOnly: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
label: "Read Only View",
|
|
91
|
+
readOnly: true,
|
|
92
|
+
value: "Canada",
|
|
93
|
+
},
|
|
35
94
|
};
|
|
@@ -1,7 +1,184 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef, ReactNode } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Select as MuiSelect,
|
|
4
|
+
SelectProps as MuiSelectProps,
|
|
5
|
+
MenuItem,
|
|
6
|
+
} from "@mui/material";
|
|
7
|
+
import { type ReadOnlyControlProps } from "@recursica/adapter-common";
|
|
8
|
+
import {
|
|
9
|
+
filterStylingProps,
|
|
10
|
+
type RecursicaOverStyled,
|
|
11
|
+
} from "../../utils/filterStylingProps";
|
|
12
|
+
import { type RecursicaFormControlWrapperProps } from "../FormControlWrapper/FormControlWrapper";
|
|
13
|
+
import { WithReadOnlyWrapper } from "../ReadOnlyField/WithReadOnlyWrapper";
|
|
14
|
+
import styles from "./Dropdown.module.css";
|
|
2
15
|
|
|
3
|
-
export
|
|
16
|
+
export interface RecursicaDropdownProps
|
|
17
|
+
extends Omit<
|
|
18
|
+
MuiSelectProps,
|
|
19
|
+
"size" | "variant" | "classes" | "inputProps" | "SelectDisplayProps"
|
|
20
|
+
>,
|
|
21
|
+
Pick<
|
|
22
|
+
RecursicaFormControlWrapperProps,
|
|
23
|
+
| "assistiveText"
|
|
24
|
+
| "assistiveWithIcon"
|
|
25
|
+
| "formLayout"
|
|
26
|
+
| "labelSize"
|
|
27
|
+
| "labelAlignment"
|
|
28
|
+
| "labelOptionalText"
|
|
29
|
+
| "labelWithEditIcon"
|
|
30
|
+
| "onLabelEditClick"
|
|
31
|
+
>,
|
|
32
|
+
ReadOnlyControlProps {
|
|
33
|
+
/** Internal hook for Selects to override raw layout width properties when necessary */
|
|
34
|
+
containerWidth?: React.CSSProperties["width"];
|
|
35
|
+
data?: (string | { value: string; label: ReactNode; disabled?: boolean })[];
|
|
36
|
+
searchable?: boolean;
|
|
37
|
+
clearable?: boolean;
|
|
38
|
+
withAsterisk?: boolean;
|
|
39
|
+
}
|
|
4
40
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
41
|
+
export type DropdownProps = RecursicaOverStyled<RecursicaDropdownProps>;
|
|
42
|
+
|
|
43
|
+
export const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
44
|
+
function Dropdown(props, ref) {
|
|
45
|
+
const {
|
|
46
|
+
overStyled = false,
|
|
47
|
+
formLayout = "stacked",
|
|
48
|
+
containerWidth,
|
|
49
|
+
|
|
50
|
+
// Label & Wrapper Maps
|
|
51
|
+
labelSize,
|
|
52
|
+
labelAlignment,
|
|
53
|
+
labelOptionalText,
|
|
54
|
+
labelWithEditIcon,
|
|
55
|
+
onLabelEditClick,
|
|
56
|
+
|
|
57
|
+
label,
|
|
58
|
+
assistiveText,
|
|
59
|
+
assistiveWithIcon,
|
|
60
|
+
error,
|
|
61
|
+
required,
|
|
62
|
+
withAsterisk,
|
|
63
|
+
id,
|
|
64
|
+
className,
|
|
65
|
+
style,
|
|
66
|
+
disabled,
|
|
67
|
+
readOnly,
|
|
68
|
+
readOnlyComponent,
|
|
69
|
+
emptyValueComponent,
|
|
70
|
+
value,
|
|
71
|
+
defaultValue,
|
|
72
|
+
data,
|
|
73
|
+
searchable, // Not natively supported by basic MUI Select, stubbed
|
|
74
|
+
clearable, // Not natively supported by basic MUI Select, stubbed
|
|
75
|
+
...rest
|
|
76
|
+
} = props;
|
|
77
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
78
|
+
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
79
|
+
|
|
80
|
+
// Delete prohibited sizing hooks
|
|
81
|
+
delete restRecord["size"];
|
|
82
|
+
delete restRecord["variant"];
|
|
83
|
+
|
|
84
|
+
const injectedStyles = {
|
|
85
|
+
...((style as React.CSSProperties) || {}),
|
|
86
|
+
width: containerWidth || "100%",
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const wrapperClass = className
|
|
90
|
+
? `${styles.layoutOverride} ${className}`
|
|
91
|
+
: styles.layoutOverride;
|
|
92
|
+
|
|
93
|
+
const renderOptions = () => {
|
|
94
|
+
if (!data) return null;
|
|
95
|
+
return data.map((item, index) => {
|
|
96
|
+
if (typeof item === "string") {
|
|
97
|
+
return (
|
|
98
|
+
<MenuItem
|
|
99
|
+
key={`${item}-${index}`}
|
|
100
|
+
value={item}
|
|
101
|
+
className={styles.option}
|
|
102
|
+
>
|
|
103
|
+
{item}
|
|
104
|
+
</MenuItem>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
return (
|
|
108
|
+
<MenuItem
|
|
109
|
+
key={`${item.value}-${index}`}
|
|
110
|
+
value={item.value}
|
|
111
|
+
disabled={item.disabled}
|
|
112
|
+
className={styles.option}
|
|
113
|
+
>
|
|
114
|
+
{item.label}
|
|
115
|
+
</MenuItem>
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<WithReadOnlyWrapper
|
|
122
|
+
className={wrapperClass}
|
|
123
|
+
style={injectedStyles}
|
|
124
|
+
controlMaxWidth="var(--recursica_ui-kit_components_dropdown_properties_max-width)"
|
|
125
|
+
controlMinWidth="var(--recursica_ui-kit_components_dropdown_properties_min-width)"
|
|
126
|
+
overStyled={overStyled as true}
|
|
127
|
+
formLayout={formLayout}
|
|
128
|
+
labelSize={labelSize}
|
|
129
|
+
labelAlignment={labelAlignment}
|
|
130
|
+
labelOptionalText={labelOptionalText}
|
|
131
|
+
labelWithEditIcon={labelWithEditIcon}
|
|
132
|
+
onLabelEditClick={onLabelEditClick}
|
|
133
|
+
label={label as ReactNode}
|
|
134
|
+
assistiveText={assistiveText}
|
|
135
|
+
assistiveWithIcon={assistiveWithIcon}
|
|
136
|
+
error={!!error}
|
|
137
|
+
required={required}
|
|
138
|
+
withAsterisk={withAsterisk}
|
|
139
|
+
id={id}
|
|
140
|
+
readOnly={readOnly}
|
|
141
|
+
readOnlyComponent={readOnlyComponent}
|
|
142
|
+
emptyValueComponent={emptyValueComponent}
|
|
143
|
+
readOnlyType="text"
|
|
144
|
+
readOnlyValue={
|
|
145
|
+
value !== undefined
|
|
146
|
+
? String(value)
|
|
147
|
+
: defaultValue
|
|
148
|
+
? String(defaultValue)
|
|
149
|
+
: undefined
|
|
150
|
+
}
|
|
151
|
+
readOnlyNativeProps={props}
|
|
152
|
+
activeComponent={
|
|
153
|
+
<MuiSelect
|
|
154
|
+
ref={ref}
|
|
155
|
+
disabled={disabled}
|
|
156
|
+
value={value}
|
|
157
|
+
defaultValue={defaultValue}
|
|
158
|
+
error={!!error}
|
|
159
|
+
required={required}
|
|
160
|
+
displayEmpty
|
|
161
|
+
className={styles.root}
|
|
162
|
+
classes={{
|
|
163
|
+
select: styles.input,
|
|
164
|
+
icon: styles.icon,
|
|
165
|
+
}}
|
|
166
|
+
MenuProps={{
|
|
167
|
+
classes: { paper: styles.dropdown },
|
|
168
|
+
}}
|
|
169
|
+
inputProps={{
|
|
170
|
+
"data-disabled": disabled ? "true" : undefined,
|
|
171
|
+
"data-error": error ? "true" : undefined,
|
|
172
|
+
...(restRecord.inputProps as any),
|
|
173
|
+
}}
|
|
174
|
+
{...(sanitizedProps as unknown as MuiSelectProps)}
|
|
175
|
+
>
|
|
176
|
+
{renderOptions()}
|
|
177
|
+
</MuiSelect>
|
|
178
|
+
}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
},
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
Dropdown.displayName = "Dropdown";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* EXEMPTIONS:
|
|
2
|
+
This component is a placeholder stub. Once fully implemented, its specific
|
|
3
|
+
tokens will be fully wired up to direct styles. */
|
|
4
|
+
|
|
5
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_border-radius */
|
|
6
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_horizontal-padding */
|
|
7
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_icon-size */
|
|
8
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_icon-text-gap */
|
|
9
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_max-width */
|
|
10
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_min-height */
|
|
11
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_min-width */
|
|
12
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_placeholder-opacity */
|
|
13
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_text_font-family */
|
|
14
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_text_font-size */
|
|
15
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_text_font-style */
|
|
16
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_text_font-weight */
|
|
17
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_text_letter-spacing */
|
|
18
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_text_line-height */
|
|
19
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_text_text-decoration */
|
|
20
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_text_text-transform */
|
|
21
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_properties_vertical-padding */
|
|
22
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_layouts_side-by-side_properties_top-bottom-margin */
|
|
23
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_layouts_stacked_properties_top-bottom-margin */
|
|
24
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_default_properties_border-size */
|
|
25
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_default_properties_colors_background */
|
|
26
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_default_properties_colors_border-color */
|
|
27
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_default_properties_colors_leading-icon */
|
|
28
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_default_properties_colors_text */
|
|
29
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_default_properties_colors_trailing-icon */
|
|
30
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_disabled_properties_border-size */
|
|
31
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_disabled_properties_colors_background */
|
|
32
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_disabled_properties_colors_border-color */
|
|
33
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_disabled_properties_colors_leading-icon */
|
|
34
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_disabled_properties_colors_text */
|
|
35
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_disabled_properties_colors_trailing-icon */
|
|
36
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_error_properties_border-size */
|
|
37
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_error_properties_colors_background */
|
|
38
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_error_properties_colors_border-color */
|
|
39
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_error_properties_colors_leading-icon */
|
|
40
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_error_properties_colors_text */
|
|
41
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_error_properties_colors_trailing-icon */
|
|
42
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_focus_properties_border-size */
|
|
43
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_focus_properties_colors_background */
|
|
44
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_focus_properties_colors_border-color */
|
|
45
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_focus_properties_colors_leading-icon */
|
|
46
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_focus_properties_colors_text */
|
|
47
|
+
/* recursica-ignore: --recursica_ui-kit_components_file-input_variants_states_focus_properties_colors_trailing-icon */
|