reshaped 3.4.0 → 3.4.2
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 +3 -32
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +11 -11
- package/dist/cjs/cli/theming/index.js +0 -1
- package/dist/cjs/themes/_generator/definitions/figma.d.ts +1 -1
- package/dist/cjs/themes/_generator/definitions/figma.js +6 -5
- package/dist/cjs/themes/_generator/utilities/color.js +11 -11
- package/dist/cjs/themes/_generator/utilities/generateBackgroundColors.js +0 -2
- package/dist/cjs/themes/_generator/utilities/generateColors.js +1 -1
- package/dist/cjs/themes/_generator/utilities/generateUnits.js +0 -1
- package/dist/cjs/themes/_generator/utilities/mergeDeep.js +1 -1
- package/dist/cjs/themes/_generator/utilities/resolveTokenReference.js +2 -0
- package/dist/cjs/themes/figma/tailwind.css +1 -1
- package/dist/cjs/themes/figma/theme.css +1 -1
- package/dist/cli/theming/index.js +0 -1
- package/dist/components/Actionable/Actionable.js +2 -0
- package/dist/components/Autocomplete/Autocomplete.js +1 -0
- package/dist/components/Calendar/Calendar.module.css +1 -1
- package/dist/components/Calendar/Calendar.types.d.ts +4 -4
- package/dist/components/Calendar/CalendarControlled.js +2 -2
- package/dist/components/Calendar/CalendarDate.js +29 -11
- package/dist/components/Calendar/CalendarMonth.js +2 -6
- package/dist/components/Calendar/tests/Calendar.stories.d.ts +19 -4
- package/dist/components/Calendar/tests/Calendar.stories.js +237 -26
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +2 -4
- package/dist/components/Card/tests/Card.stories.d.ts +1 -1
- package/dist/components/Card/tests/Card.test.stories.d.ts +1 -1
- package/dist/components/Carousel/Carousel.js +1 -2
- package/dist/components/Carousel/Carousel.types.d.ts +1 -5
- package/dist/components/Carousel/Carousel.types.js +1 -5
- package/dist/components/Carousel/CarouselControl.js +2 -3
- package/dist/components/FormControl/FormControl.context.d.ts +4 -0
- package/dist/components/Grid/Grid.js +8 -2
- package/dist/components/Icon/Icon.js +1 -3
- package/dist/components/PinField/PinFieldControlled.js +0 -1
- package/dist/components/Resizable/Resizable.js +1 -0
- package/dist/components/Slider/SliderControlled.js +9 -3
- package/dist/components/Stepper/Stepper.js +7 -2
- package/dist/components/Tabs/TabsList.js +7 -3
- package/dist/components/Text/Text.js +2 -4
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Toast/ToastProvider.js +8 -4
- package/dist/components/View/View.js +10 -5
- package/dist/components/_private/Flyout/FlyoutContent.js +1 -1
- package/dist/components/_private/Flyout/FlyoutTrigger.js +1 -1
- package/dist/components/_private/Flyout/useFlyout.js +3 -1
- package/dist/components/_private/Portal/Portal.d.ts +1 -1
- package/dist/config/tailwind.d.ts +1 -1
- package/dist/hooks/_private/useOnClickOutside.d.ts +1 -1
- package/dist/hooks/_private/useOnClickOutside.js +26 -10
- package/dist/hooks/_private/useSingletonHotkeys.js +2 -0
- package/dist/hooks/useResponsiveClientValue.d.ts +1 -1
- package/dist/themes/_generator/definitions/figma.d.ts +1 -1
- package/dist/themes/_generator/definitions/figma.js +6 -5
- package/dist/themes/_generator/utilities/color.js +11 -11
- package/dist/themes/_generator/utilities/generateBackgroundColors.js +0 -2
- package/dist/themes/_generator/utilities/generateColors.js +1 -1
- package/dist/themes/_generator/utilities/generateUnits.js +0 -1
- package/dist/themes/_generator/utilities/mergeDeep.js +1 -1
- package/dist/themes/_generator/utilities/resolveTokenReference.js +2 -0
- package/dist/themes/figma/tailwind.css +1 -1
- package/dist/themes/figma/theme.css +1 -1
- package/dist/types/global.d.ts +2 -2
- package/dist/utilities/helpers.js +4 -1
- package/dist/utilities/platform.js +1 -0
- package/package.json +36 -40
- package/dist/components/Calendar/tests/Calendar.test.stories.d.ts +0 -26
- package/dist/components/Calendar/tests/Calendar.test.stories.js +0 -161
@@ -1,3 +1,4 @@
|
|
1
|
+
import { fn, expect, userEvent, within, waitFor } from "@storybook/test";
|
1
2
|
import { Example } from "../../../utilities/storybook/index.js";
|
2
3
|
import Calendar from "../index.js";
|
3
4
|
export default {
|
@@ -9,29 +10,239 @@ export default {
|
|
9
10
|
},
|
10
11
|
},
|
11
12
|
};
|
12
|
-
export const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
13
|
+
export const defaultMonth = {
|
14
|
+
name: "defaultMonth",
|
15
|
+
render: () => (<Example>
|
16
|
+
<Example.Item title="defaultMonth: 2020 January">
|
17
|
+
<Calendar defaultMonth={new Date(2020, 0)}/>
|
18
|
+
</Example.Item>
|
19
|
+
</Example>),
|
20
|
+
play: ({ canvas }) => {
|
21
|
+
const grid = canvas.getByRole("grid");
|
22
|
+
const gridCells = canvas.getAllByRole("gridcell");
|
23
|
+
const dates = canvas.getAllByRole("checkbox");
|
24
|
+
const [prevButton, monthButton, nextButton] = canvas.getAllByRole("button");
|
25
|
+
expect(grid).toBeInTheDocument();
|
26
|
+
expect(gridCells).toHaveLength(31);
|
27
|
+
expect(dates).toHaveLength(31);
|
28
|
+
const focusableDates = dates.filter((el) => {
|
29
|
+
return el.getAttribute("tabIndex") === "0";
|
30
|
+
});
|
31
|
+
// Defaults keyboard focus to the first day of the month
|
32
|
+
expect(focusableDates).toHaveLength(1);
|
33
|
+
expect(focusableDates[0]).toBe(dates[0]);
|
34
|
+
// Default Labels
|
35
|
+
expect(dates[0]).toHaveAccessibleName("Wednesday, January 1");
|
36
|
+
expect(prevButton).toHaveAccessibleName("Previous month");
|
37
|
+
expect(monthButton).toHaveAccessibleName("January 2020 Select a month");
|
38
|
+
expect(nextButton).toHaveAccessibleName("Next month");
|
39
|
+
},
|
40
|
+
};
|
41
|
+
export const uncontrolled = {
|
42
|
+
name: "defaultValue, range",
|
43
|
+
args: {
|
44
|
+
handleChange: fn(),
|
45
|
+
},
|
46
|
+
render: (args) => (<Example>
|
47
|
+
<Example.Item title="defaultValue">
|
48
|
+
<Calendar defaultMonth={new Date(2020, 0)} defaultValue={new Date(2020, 0, 10)} onChange={args.handleChange}/>
|
49
|
+
</Example.Item>
|
50
|
+
<Example.Item title="defaultValue, range">
|
51
|
+
<Calendar range defaultMonth={new Date(2020, 0)} defaultValue={{ start: new Date(2020, 0, 10), end: new Date(2020, 0, 15) }} onChange={args.handleChange}/>
|
52
|
+
</Example.Item>
|
53
|
+
</Example>),
|
54
|
+
play: async ({ canvas, args }) => {
|
55
|
+
const [singleCalendar, rangeCalendar] = canvas.getAllByRole("grid");
|
56
|
+
const singleCalendarDates = within(singleCalendar).getAllByRole("checkbox");
|
57
|
+
const rangeCalendarDates = within(rangeCalendar).getAllByRole("checkbox");
|
58
|
+
await userEvent.click(singleCalendarDates[7]);
|
59
|
+
expect(singleCalendarDates[7]).toBeChecked();
|
60
|
+
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
61
|
+
expect(args.handleChange).toHaveBeenLastCalledWith({ value: new Date(2020, 0, 8) });
|
62
|
+
await userEvent.click(rangeCalendarDates[7]);
|
63
|
+
expect(rangeCalendarDates[7]).toBeChecked();
|
64
|
+
expect(args.handleChange).toHaveBeenCalledTimes(2);
|
65
|
+
expect(args.handleChange).toHaveBeenLastCalledWith({
|
66
|
+
value: { start: new Date(2020, 0, 8), end: null },
|
67
|
+
});
|
68
|
+
// While selecting end value, clicking on a date < start value should change the start value
|
69
|
+
await userEvent.click(rangeCalendarDates[6]);
|
70
|
+
expect(rangeCalendarDates[6]).toBeChecked();
|
71
|
+
expect(rangeCalendarDates[7]).not.toBeChecked();
|
72
|
+
expect(args.handleChange).toHaveBeenCalledTimes(3);
|
73
|
+
expect(args.handleChange).toHaveBeenLastCalledWith({
|
74
|
+
value: { start: new Date(2020, 0, 7), end: null },
|
75
|
+
});
|
76
|
+
await userEvent.click(rangeCalendarDates[10]);
|
77
|
+
expect(args.handleChange).toHaveBeenCalledTimes(4);
|
78
|
+
expect(args.handleChange).toHaveBeenLastCalledWith({
|
79
|
+
value: { start: new Date(2020, 0, 7), end: new Date(2020, 0, 11) },
|
80
|
+
});
|
81
|
+
for (let i = 6; i < 10; i++) {
|
82
|
+
expect(rangeCalendarDates[i]).toBeChecked();
|
83
|
+
}
|
84
|
+
},
|
85
|
+
};
|
86
|
+
export const controlled = {
|
87
|
+
name: "value, range",
|
88
|
+
args: {
|
89
|
+
handleChange: fn(),
|
90
|
+
},
|
91
|
+
render: (args) => (<Example>
|
92
|
+
<Example.Item title="value">
|
93
|
+
<Calendar defaultMonth={new Date(2020, 0)} value={new Date(2020, 0, 10)} onChange={args.handleChange}/>
|
94
|
+
</Example.Item>
|
95
|
+
<Example.Item title="defaultValue, range">
|
96
|
+
<Calendar range defaultMonth={new Date(2020, 0)} value={{ start: new Date(2020, 0, 10), end: new Date(2020, 0, 15) }} onChange={args.handleChange}/>
|
97
|
+
</Example.Item>
|
98
|
+
</Example>),
|
99
|
+
play: async ({ canvas, args }) => {
|
100
|
+
const [singleCalendar, rangeCalendar] = canvas.getAllByRole("grid");
|
101
|
+
const singleCalendarDates = within(singleCalendar).getAllByRole("checkbox");
|
102
|
+
const rangeCalendarDates = within(rangeCalendar).getAllByRole("checkbox");
|
103
|
+
await userEvent.click(singleCalendarDates[7]);
|
104
|
+
expect(singleCalendarDates[7]).not.toBeChecked();
|
105
|
+
expect(singleCalendarDates[9]).toBeChecked();
|
106
|
+
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
107
|
+
expect(args.handleChange).toHaveBeenLastCalledWith({ value: new Date(2020, 0, 8) });
|
108
|
+
await userEvent.click(rangeCalendarDates[7]);
|
109
|
+
expect(rangeCalendarDates[7]).not.toBeChecked();
|
110
|
+
expect(rangeCalendarDates[9]).toBeChecked();
|
111
|
+
expect(args.handleChange).toHaveBeenCalledTimes(2);
|
112
|
+
expect(args.handleChange).toHaveBeenLastCalledWith({
|
113
|
+
value: { start: new Date(2020, 0, 8), end: null },
|
114
|
+
});
|
115
|
+
// While selecting end value, clicking on a date < start value should change the start value
|
116
|
+
await userEvent.click(rangeCalendarDates[6]);
|
117
|
+
expect(rangeCalendarDates[6]).not.toBeChecked();
|
118
|
+
expect(rangeCalendarDates[9]).toBeChecked();
|
119
|
+
expect(args.handleChange).toHaveBeenCalledTimes(3);
|
120
|
+
expect(args.handleChange).toHaveBeenLastCalledWith({
|
121
|
+
value: { start: new Date(2020, 0, 7), end: null },
|
122
|
+
});
|
123
|
+
// In controlled mode, clicking on a date > startValue still changes startValue since we're not updating the state
|
124
|
+
await userEvent.click(rangeCalendarDates[10]);
|
125
|
+
expect(args.handleChange).toHaveBeenCalledTimes(4);
|
126
|
+
expect(args.handleChange).toHaveBeenLastCalledWith({
|
127
|
+
value: { start: new Date(2020, 0, 11), end: null },
|
128
|
+
});
|
129
|
+
expect(rangeCalendarDates[6]).not.toBeChecked();
|
130
|
+
expect(rangeCalendarDates[9]).toBeChecked();
|
131
|
+
},
|
132
|
+
};
|
133
|
+
export const selectedDates = {
|
134
|
+
name: "selectedDates",
|
135
|
+
render: () => (<Example>
|
136
|
+
<Example.Item title="selectedDates: [4,8]">
|
137
|
+
<Calendar defaultMonth={new Date(2020, 0)} value={null} selectedDates={[new Date(2020, 0, 4), new Date(2020, 0, 8)]}/>
|
138
|
+
</Example.Item>
|
139
|
+
</Example>),
|
140
|
+
play: ({ canvas }) => {
|
141
|
+
const dates = canvas.getAllByRole("checkbox");
|
142
|
+
expect(dates[3]).toBeChecked();
|
143
|
+
expect(dates[7]).toBeChecked();
|
144
|
+
},
|
145
|
+
};
|
146
|
+
export const minMax = {
|
147
|
+
name: "min, max",
|
148
|
+
render: () => (<Example>
|
149
|
+
<Example.Item title="min: 4, max: 20">
|
150
|
+
<Calendar defaultMonth={new Date(2020, 0)} min={new Date(2020, 0, 4)} max={new Date(2020, 0, 20)}/>
|
151
|
+
</Example.Item>
|
152
|
+
</Example>),
|
153
|
+
play: ({ canvas }) => {
|
154
|
+
const dates = canvas.getAllByRole("checkbox");
|
155
|
+
expect(dates).toHaveLength(17);
|
156
|
+
},
|
157
|
+
};
|
158
|
+
export const firstWeekDay = {
|
159
|
+
name: "firstWeekDay",
|
160
|
+
render: () => (<Example>
|
161
|
+
<Example.Item title="firstWeekDay: 3 (Wed)">
|
162
|
+
<Calendar defaultMonth={new Date(2020, 0)} firstWeekDay={3}/>
|
163
|
+
</Example.Item>
|
164
|
+
</Example>),
|
165
|
+
};
|
166
|
+
export const translation = {
|
167
|
+
name: "render functions",
|
168
|
+
render: () => (<Example>
|
169
|
+
<Example.Item title="translated to NL">
|
170
|
+
<Calendar defaultMonth={new Date(2020, 0)} renderMonthLabel={({ date }) => date.toLocaleDateString("nl", { month: "short" })} renderSelectedMonthLabel={({ date }) => date.toLocaleDateString("nl", { month: "long", year: "numeric" })} renderWeekDay={({ date }) => date.toLocaleDateString("nl", { weekday: "short" })}/>
|
171
|
+
</Example.Item>
|
172
|
+
</Example>),
|
173
|
+
};
|
174
|
+
export const ariaLabels = {
|
175
|
+
name: "aria labels",
|
176
|
+
render: () => (<Example>
|
177
|
+
<Example.Item title="aria labels">
|
178
|
+
<Calendar defaultMonth={new Date(2020, 0)} nextYearAriaLabel="Test next year" nextMonthAriaLabel="Test next month" renderDateAriaLabel={() => "Test date"} renderMonthAriaLabel={() => "Test month"} previousYearAriaLabel="Test previous year" previousMonthAriaLabel="Test previous month" monthSelectionAriaLabel="Test month selection"/>
|
179
|
+
</Example.Item>
|
180
|
+
</Example>),
|
181
|
+
play: async ({ canvas }) => {
|
182
|
+
const buttonEls = canvas.getAllByRole("button");
|
183
|
+
const dateEls = canvas.getAllByRole("checkbox");
|
184
|
+
expect(buttonEls[0]).toHaveAttribute("aria-label", "Test previous month");
|
185
|
+
expect(buttonEls[1]).toHaveTextContent("Test month selection");
|
186
|
+
expect(buttonEls[2]).toHaveAttribute("aria-label", "Test next month");
|
187
|
+
expect(dateEls[0]).toHaveAttribute("aria-label", "Test date");
|
188
|
+
await userEvent.click(buttonEls[1], { delay: null });
|
189
|
+
const yearButtonEls = canvas.getAllByRole("button");
|
190
|
+
expect(yearButtonEls[0]).toHaveAttribute("aria-label", "Test previous year");
|
191
|
+
expect(yearButtonEls[1]).toHaveAttribute("aria-label", "Test next year");
|
192
|
+
expect(yearButtonEls[2]).toHaveAttribute("aria-label", "Test month");
|
193
|
+
},
|
194
|
+
};
|
195
|
+
export const monthSelection = {
|
196
|
+
name: "test: month selection",
|
197
|
+
render: () => (<Example>
|
198
|
+
<Example.Item title="month selection">
|
199
|
+
<Calendar defaultMonth={new Date(2020, 1)}/>
|
200
|
+
</Example.Item>
|
201
|
+
</Example>),
|
202
|
+
play: async ({ canvas }) => {
|
203
|
+
let buttons = canvas.getAllByRole("button");
|
204
|
+
let monthButton = buttons[1];
|
205
|
+
expect(monthButton).toHaveAccessibleName("February 2020 Select a month");
|
206
|
+
await userEvent.click(monthButton);
|
207
|
+
let months = canvas.getAllByRole("button").filter((el) => el.hasAttribute("data-rs-date"));
|
208
|
+
expect(months).toHaveLength(12);
|
209
|
+
await userEvent.click(months[0]);
|
210
|
+
buttons = canvas.getAllByRole("button");
|
211
|
+
months = buttons.filter((el) => el.hasAttribute("data-rs-date"));
|
212
|
+
monthButton = buttons[1];
|
213
|
+
expect(months).toHaveLength(0);
|
214
|
+
expect(monthButton).toHaveAccessibleName("January 2020 Select a month");
|
215
|
+
},
|
216
|
+
};
|
217
|
+
export const keyboardNavigation = {
|
218
|
+
name: "test: keyboard navigation",
|
219
|
+
render: () => (<Example>
|
220
|
+
<Example.Item title="keyboard navigation">
|
221
|
+
<Calendar defaultMonth={new Date(2020, 0)}/>
|
222
|
+
</Example.Item>
|
223
|
+
</Example>),
|
224
|
+
play: async ({ canvas }) => {
|
225
|
+
const dateEls = canvas.getAllByRole("checkbox");
|
226
|
+
dateEls[0].focus();
|
227
|
+
await userEvent.keyboard("{ArrowRight/}");
|
228
|
+
waitFor(() => {
|
229
|
+
expect(document.activeElement).toHaveAttribute("data-rs-date", "2020-01-02");
|
230
|
+
});
|
231
|
+
await userEvent.keyboard("{ArrowLeft/}");
|
232
|
+
waitFor(() => {
|
233
|
+
expect(document.activeElement).toHaveAttribute("data-rs-date", "2020-01-01");
|
234
|
+
});
|
235
|
+
await userEvent.keyboard("{ArrowDown/}");
|
236
|
+
waitFor(() => {
|
237
|
+
expect(document.activeElement).toHaveAttribute("data-rs-date", "2020-01-08");
|
238
|
+
});
|
239
|
+
await userEvent.keyboard("{ArrowUp/}");
|
240
|
+
waitFor(() => {
|
241
|
+
expect(document.activeElement).toHaveAttribute("data-rs-date", "2020-01-01");
|
242
|
+
});
|
243
|
+
await userEvent.keyboard("{ArrowUp/}");
|
244
|
+
waitFor(() => {
|
245
|
+
expect(document.activeElement).toHaveAttribute("data-rs-date", "2019-12-25");
|
246
|
+
});
|
247
|
+
},
|
248
|
+
};
|
@@ -9,7 +9,7 @@ declare const Card: React.ForwardRefExoticComponent<{
|
|
9
9
|
href?: string;
|
10
10
|
as?: keyof React.JSX.IntrinsicElements | undefined;
|
11
11
|
className?: import("../../types/global").ClassName;
|
12
|
-
attributes?: (import("../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "form" | "slot" | "style" | "title" | "disabled" | "className" | "color" | "hidden" | "content" | "ref" | "children" | "onToggle" | "value" | "type" | "key" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
|
12
|
+
attributes?: (import("../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "form" | "slot" | "style" | "title" | "disabled" | "className" | "color" | "hidden" | "content" | "ref" | "children" | "onToggle" | "value" | "type" | "key" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
|
13
13
|
ref?: React.RefObject<HTMLButtonElement | HTMLAnchorElement | null>;
|
14
14
|
}) | undefined)) | undefined;
|
15
15
|
} & Pick<import("../View").ViewProps, "height"> & React.RefAttributes<HTMLElement>>;
|
@@ -10,10 +10,8 @@ import getHeightStyles from "../../styles/height/index.js";
|
|
10
10
|
const Card = forwardRef((props, ref) => {
|
11
11
|
const { padding = 4 } = props;
|
12
12
|
const { selected, elevated, bleed, height, onClick, href, children, className, attributes,
|
13
|
-
|
14
|
-
|
15
|
-
* It still resolves the attributes correctly based on the tag
|
16
|
-
*/
|
13
|
+
// Using any here to let TS save on type resolving, otherwise TS throws an error due to the type complexity
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
17
15
|
as: TagName = "div", } = props;
|
18
16
|
const isActionable = !!href || !!onClick;
|
19
17
|
const radiusStyles = getRadiusStyles("medium");
|
@@ -11,7 +11,7 @@ declare const _default: {
|
|
11
11
|
href?: string;
|
12
12
|
as?: keyof React.JSX.IntrinsicElements | undefined;
|
13
13
|
className?: import("../../../types/global").ClassName;
|
14
|
-
attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "color" | "className" | "hidden" | "content" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "dir" | "name" | "key" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
|
14
|
+
attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "color" | "className" | "hidden" | "content" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "dir" | "name" | "key" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
|
15
15
|
ref?: React.RefObject<HTMLButtonElement | HTMLAnchorElement | null>;
|
16
16
|
}) | undefined)) | undefined;
|
17
17
|
} & Pick<import("../../View").ViewProps, "height"> & React.RefAttributes<HTMLElement>>;
|
@@ -13,7 +13,7 @@ declare const _default: {
|
|
13
13
|
href?: string;
|
14
14
|
as?: keyof React.JSX.IntrinsicElements | undefined;
|
15
15
|
className?: import("../../../types/global").ClassName;
|
16
|
-
attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "color" | "className" | "hidden" | "content" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "dir" | "name" | "key" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
|
16
|
+
attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "color" | "className" | "hidden" | "content" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "dir" | "name" | "key" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
|
17
17
|
ref?: React.RefObject<HTMLButtonElement | HTMLAnchorElement | null>;
|
18
18
|
}) | undefined)) | undefined;
|
19
19
|
} & Pick<import("../../View").ViewProps, "height"> & React.RefAttributes<HTMLElement>>;
|
@@ -6,7 +6,6 @@ import View from "../View/index.js";
|
|
6
6
|
import useRTL from "../../hooks/useRTL.js";
|
7
7
|
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
8
8
|
import CarouselControl from "./CarouselControl.js";
|
9
|
-
import * as T from "./Carousel.types.js";
|
10
9
|
import s from "./Carousel.module.css";
|
11
10
|
const Carousel = (props) => {
|
12
11
|
const { children, gap = 3, visibleItems, bleed, navigationDisplay, onChange, onScroll, instanceRef, className, attributes, } = props;
|
@@ -112,6 +111,6 @@ const Carousel = (props) => {
|
|
112
111
|
...responsiveVariables("--rs-carousel-items", visibleItems),
|
113
112
|
...responsiveVariables("--rs-carousel-bleed", bleed),
|
114
113
|
...attributes?.style,
|
115
|
-
}, children: [navigationDisplay !== "hidden" && (_jsxs(_Fragment, { children: [_jsx(CarouselControl, { isRTL: isRTL, type:
|
114
|
+
}, children: [navigationDisplay !== "hidden" && (_jsxs(_Fragment, { children: [_jsx(CarouselControl, { isRTL: isRTL, type: "back", scrollElRef: scrollElRef, scrollPosition: scrollPosition, onClick: navigateBack, mounted: mounted }), _jsx(CarouselControl, { isRTL: isRTL, type: "forward", scrollElRef: scrollElRef, scrollPosition: scrollPosition, onClick: navigateForward, mounted: mounted })] })), _jsx(View, { as: "ul", direction: "row", wrap: false, gap: gap, className: s.scroll, attributes: { ref: scrollElRef, onScroll: handleScroll }, children: React.Children.map(children, (child, index) => (_jsx(View.Item, { className: s.item, as: "li", attributes: { ref: (el) => handleItemRef(el, index) }, children: child }))) })] }));
|
116
115
|
};
|
117
116
|
export default Carousel;
|
@@ -5,12 +5,8 @@ export type Instance = {
|
|
5
5
|
navigateForward: () => void;
|
6
6
|
navigateTo: (index: number) => void;
|
7
7
|
} | undefined;
|
8
|
-
export declare enum ControlType {
|
9
|
-
back = "back",
|
10
|
-
forward = "forward"
|
11
|
-
}
|
12
8
|
export type ControlProps = {
|
13
|
-
type:
|
9
|
+
type: "back" | "forward";
|
14
10
|
scrollElRef: React.RefObject<HTMLElement | null>;
|
15
11
|
scrollPosition: number;
|
16
12
|
onClick: () => void;
|
@@ -6,14 +6,13 @@ import Button from "../Button/index.js";
|
|
6
6
|
import IconChevronRight from "../../icons/ChevronRight.js";
|
7
7
|
import IconChevronLeft from "../../icons/ChevronLeft.js";
|
8
8
|
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
9
|
-
import * as T from "./Carousel.types.js";
|
10
9
|
import s from "./Carousel.module.css";
|
11
10
|
const CarouselControl = (props) => {
|
12
11
|
const { type, scrollElRef, scrollPosition, onClick, isRTL, mounted } = props;
|
13
12
|
const [visible, setVisible] = React.useState(false);
|
14
13
|
const [rendered, setRendered] = React.useState(false);
|
15
|
-
const isNext = type ===
|
16
|
-
const isDisplayedAsNext = type === (isRTL ?
|
14
|
+
const isNext = type === "forward";
|
15
|
+
const isDisplayedAsNext = type === (isRTL ? "back" : "forward");
|
17
16
|
const controlClassNames = classNames(s.control, isDisplayedAsNext ? s["--control-next"] : s["--control-prev"], visible && s["--control-visible"], rendered && s["--control-rendered"]);
|
18
17
|
useIsomorphicLayoutEffect(() => {
|
19
18
|
const scrollEl = scrollElRef.current;
|
@@ -57,6 +57,8 @@ export declare const useFormControl: () => {
|
|
57
57
|
inert?: boolean | undefined | undefined;
|
58
58
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
59
59
|
is?: string | undefined | undefined;
|
60
|
+
exportparts?: string | undefined | undefined;
|
61
|
+
part?: string | undefined | undefined;
|
60
62
|
"aria-activedescendant"?: string | undefined | undefined;
|
61
63
|
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
62
64
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
@@ -264,6 +266,8 @@ export declare const useFormControl: () => {
|
|
264
266
|
onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
265
267
|
onScroll?: React.UIEventHandler<HTMLElement> | undefined;
|
266
268
|
onScrollCapture?: React.UIEventHandler<HTMLElement> | undefined;
|
269
|
+
onScrollEnd?: React.UIEventHandler<HTMLElement> | undefined;
|
270
|
+
onScrollEndCapture?: React.UIEventHandler<HTMLElement> | undefined;
|
267
271
|
onWheel?: React.WheelEventHandler<HTMLElement> | undefined;
|
268
272
|
onWheelCapture?: React.WheelEventHandler<HTMLElement> | undefined;
|
269
273
|
onAnimationStart?: React.AnimationEventHandler<HTMLElement> | undefined;
|
@@ -4,7 +4,10 @@ import getAlignStyles from "../../styles/align/index.js";
|
|
4
4
|
import getJustifyStyles from "../../styles/justify/index.js";
|
5
5
|
import s from "./Grid.module.css";
|
6
6
|
const GridItem = (props) => {
|
7
|
-
const { area, colStart, colEnd, colSpan, rowStart, rowEnd, rowSpan, children, className,
|
7
|
+
const { area, colStart, colEnd, colSpan, rowStart, rowEnd, rowSpan, children, className,
|
8
|
+
// Using any here to let TS save on type resolving, otherwise TS throws an error due to the type complexity
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
10
|
+
as: TagName = "div", attributes, } = props;
|
8
11
|
const itemClassNames = classNames(s.item, className);
|
9
12
|
const resolvedColSpan = responsivePropDependency(colSpan, (value) => value && `span ${value}`);
|
10
13
|
const resolvedRowSpan = responsivePropDependency(rowSpan, (value) => value && `span ${value}`);
|
@@ -22,7 +25,10 @@ const GridItem = (props) => {
|
|
22
25
|
return (_jsx(TagName, { ...attributes, className: itemClassNames, style: rootVariables, children: children }));
|
23
26
|
};
|
24
27
|
const Grid = (props) => {
|
25
|
-
const { areas, columns, rows, gap, align, justify, autoColumns, autoRows, autoFlow, children, className,
|
28
|
+
const { areas, columns, rows, gap, align, justify, autoColumns, autoRows, autoFlow, children, className,
|
29
|
+
// Using any here to let TS save on type resolving, otherwise TS throws an error due to the type complexity
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
31
|
+
as: TagName = "div", attributes, } = props;
|
26
32
|
const alignStyles = getAlignStyles(align);
|
27
33
|
const justifyStyles = getJustifyStyles(justify);
|
28
34
|
const resolvedRows = responsivePropDependency(rows, (value) => typeof value === "number" ? `repeat(${value}, 1fr)` : value);
|
@@ -7,9 +7,7 @@ const Icon = (props) => {
|
|
7
7
|
const { svg: Component, className, color, size = "1em", autoWidth, attributes } = props;
|
8
8
|
const heightStyles = getHeightStyles(size);
|
9
9
|
const rootClassName = classNames(s.root, className, heightStyles?.classNames, color && s[`--color-${color}`], autoWidth && s["--auto"]);
|
10
|
-
const icon = React.isValidElement(Component) ?
|
11
|
-
// @ts-ignore
|
12
|
-
_jsx(Component, {}));
|
10
|
+
const icon = React.isValidElement(Component) ? Component : _jsx(Component, {});
|
13
11
|
const style = { ...attributes?.style, ...heightStyles?.variables };
|
14
12
|
return (
|
15
13
|
// All icons are decorative, a11y attributes should be set for buttons wrapping them
|
@@ -111,7 +111,6 @@ const PinFieldControlled = (props) => {
|
|
111
111
|
*/
|
112
112
|
inputRef.current.value = updatedValue;
|
113
113
|
inputRef.current.selectionEnd = focusedIndex;
|
114
|
-
inputRef.current.selectionStart = inputRef.current.selectionStart;
|
115
114
|
};
|
116
115
|
const handleInput = (event) => {
|
117
116
|
const el = event.target;
|
@@ -84,18 +84,24 @@ const SliderControlled = (props) => {
|
|
84
84
|
if (!range)
|
85
85
|
return;
|
86
86
|
const method = options?.commit ? onChangeCommitRef.current : onChangeRef.current;
|
87
|
-
//
|
87
|
+
// Manually controlled resolving of single/range handlers
|
88
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
89
|
+
// @ts-ignore
|
88
90
|
method?.({ minValue: value, maxValue, name });
|
89
91
|
}, [maxValue, name, range, onChangeCommitRef, onChangeRef]);
|
90
92
|
const handleMaxChange = React.useCallback((value, options) => {
|
91
93
|
if (range) {
|
92
94
|
const method = options?.commit ? onChangeCommitRef.current : onChangeRef.current;
|
93
|
-
//
|
95
|
+
// Manually controlled resolving of single/range handlers
|
96
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
97
|
+
// @ts-ignore
|
94
98
|
method?.({ minValue: minValue, maxValue: value, name });
|
95
99
|
return;
|
96
100
|
}
|
97
101
|
const method = options?.commit ? onChangeCommitRef.current : onChangeRef.current;
|
98
|
-
//
|
102
|
+
// Manually controlled resolving of single/range handlers
|
103
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
104
|
+
// @ts-ignore
|
99
105
|
method?.({ value, name });
|
100
106
|
}, [minValue, name, range, onChangeRef, onChangeCommitRef]);
|
101
107
|
const handleMouseDown = ({ nativeEvent }) => {
|
@@ -22,8 +22,13 @@ const Stepper = (props) => {
|
|
22
22
|
const vertical = direction === "column";
|
23
23
|
const length = React.Children.count(children);
|
24
24
|
return (_jsx(View, { attributes: attributes, direction: direction, align: vertical ? "stretch" : "center", className: className, gap: 3, wrap: false, children: React.Children.map(children, (child, index) => {
|
25
|
-
|
26
|
-
|
25
|
+
if (!React.isValidElement(child))
|
26
|
+
return null;
|
27
|
+
if (child.type !== StepperItem)
|
28
|
+
return null;
|
29
|
+
const props = child.props;
|
30
|
+
const itemId = props.id || `${index}`;
|
31
|
+
return (_jsxs(React.Fragment, { children: [_jsx(StepperItemPrivate, { ...props, id: itemId, active: activeId?.toString() === itemId, step: index + 1, last: index === length - 1, direction: direction, labelDisplay: labelDisplay }), !vertical && index < length - 1 && (_jsx(View, { grow: true, children: _jsx(Divider, {}) }))] }, index));
|
27
32
|
}) }));
|
28
33
|
};
|
29
34
|
Stepper.Item = StepperItem;
|