reshaped 3.7.4 → 3.8.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-extra.md +3 -0
- package/CHANGELOG.md +68 -55
- package/LICENSE.md +1 -1
- package/README.md +24 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +11 -11
- package/dist/cjs/themes/index.d.ts +1 -0
- package/dist/cjs/themes/index.js +3 -1
- package/dist/components/Accordion/Accordion.types.d.ts +13 -2
- package/dist/components/ActionBar/ActionBar.types.d.ts +10 -0
- package/dist/components/Actionable/Actionable.types.d.ts +14 -0
- package/dist/components/Alert/Alert.types.d.ts +11 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +7 -0
- package/dist/components/Avatar/Avatar.types.d.ts +18 -0
- package/dist/components/Avatar/tests/Avatar.stories.js +1 -1
- package/dist/components/Badge/Badge.types.d.ts +25 -1
- package/dist/components/Badge/tests/Badge.test.stories.js +3 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -0
- package/dist/components/Button/Button.types.d.ts +20 -0
- package/dist/components/Calendar/Calendar.types.d.ts +31 -0
- package/dist/components/Calendar/tests/Calendar.stories.js +1 -1
- package/dist/components/Card/Card.types.d.ts +12 -0
- package/dist/components/Carousel/Carousel.types.d.ts +13 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +19 -0
- package/dist/components/Checkbox/tests/Checkbox.stories.js +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.types.d.ts +10 -0
- package/dist/components/Container/Container.types.d.ts +11 -1
- package/dist/components/Dismissible/Dismissible.types.d.ts +10 -0
- package/dist/components/Divider/Divider.types.d.ts +6 -0
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +4 -1
- package/dist/components/FileUpload/FileUpload.types.d.ts +10 -0
- package/dist/components/Flyout/Flyout.types.d.ts +41 -0
- package/dist/components/Flyout/FlyoutContent.js +1 -1
- package/dist/components/Flyout/FlyoutControlled.js +2 -1
- package/dist/components/Flyout/tests/Flyout.stories.d.ts +4 -0
- package/dist/components/Flyout/tests/Flyout.stories.js +59 -1
- package/dist/components/Flyout/useFlyout.d.ts +1 -0
- package/dist/components/Flyout/useFlyout.js +3 -1
- package/dist/components/Flyout/utilities/calculatePosition.d.ts +1 -1
- package/dist/components/Flyout/utilities/calculatePosition.js +52 -28
- package/dist/components/Flyout/utilities/flyout.js +22 -18
- package/dist/components/Flyout/utilities/helpers.d.ts +7 -0
- package/dist/components/Flyout/utilities/helpers.js +14 -0
- package/dist/components/Flyout/utilities/isFullyVisible.d.ts +5 -1
- package/dist/components/Flyout/utilities/isFullyVisible.js +1 -1
- package/dist/components/FormControl/FormControl.types.d.ts +9 -0
- package/dist/components/Grid/Grid.js +3 -1
- package/dist/components/Grid/Grid.module.css +1 -1
- package/dist/components/Grid/Grid.types.d.ts +31 -0
- package/dist/components/Grid/tests/Grid.stories.d.ts +3 -0
- package/dist/components/Grid/tests/Grid.stories.js +39 -1
- package/dist/components/Hidden/Hidden.types.d.ts +4 -0
- package/dist/components/HiddenVisually/HiddenVisually.types.d.ts +1 -0
- package/dist/components/Hotkey/Hotkey.types.d.ts +4 -0
- package/dist/components/Icon/Icon.types.d.ts +6 -0
- package/dist/components/Image/Image.types.d.ts +15 -0
- package/dist/components/Link/Link.types.d.ts +7 -0
- package/dist/components/Loader/Loader.types.d.ts +5 -0
- package/dist/components/MenuItem/MenuItem.types.d.ts +13 -1
- package/dist/components/Modal/Modal.types.d.ts +19 -0
- package/dist/components/NumberField/NumberField.types.d.ts +10 -0
- package/dist/components/Overlay/Overlay.types.d.ts +13 -0
- package/dist/components/Pagination/Pagination.types.d.ts +11 -29
- package/dist/components/PinField/PinField.module.css +1 -1
- package/dist/components/PinField/PinField.types.d.ts +13 -0
- package/dist/components/PinField/tests/PinField.stories.d.ts +24 -3
- package/dist/components/PinField/tests/PinField.stories.js +194 -47
- package/dist/components/Popover/Popover.types.d.ts +4 -1
- package/dist/components/Progress/Progress.types.d.ts +9 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.js +13 -84
- package/dist/components/ProgressIndicator/ProgressIndicator.module.css +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.types.d.ts +8 -0
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +8 -1
- package/dist/components/Radio/Radio.types.d.ts +12 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +14 -0
- package/dist/components/Reshaped/Reshaped.css +1 -1
- package/dist/components/Reshaped/Reshaped.types.d.ts +12 -0
- package/dist/components/Resizable/Resizable.types.d.ts +7 -0
- package/dist/components/Scrim/Scrim.types.d.ts +6 -1
- package/dist/components/ScrollArea/ScrollArea.types.d.ts +7 -0
- package/dist/components/Select/Select.types.d.ts +27 -0
- package/dist/components/Skeleton/Skeleton.types.d.ts +2 -0
- package/dist/components/Slider/Slider.types.d.ts +56 -0
- package/dist/components/Stepper/Stepper.types.d.ts +13 -0
- package/dist/components/Switch/Switch.types.d.ts +16 -0
- package/dist/components/Table/Table.types.d.ts +29 -0
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +24 -0
- package/dist/components/Tabs/TabsItem.js +2 -2
- package/dist/components/Tabs/tests/Tabs.stories.js +6 -6
- package/dist/components/Text/Text.types.d.ts +12 -0
- package/dist/components/TextArea/TextArea.types.d.ts +17 -0
- package/dist/components/TextField/TextField.types.d.ts +29 -0
- package/dist/components/Theme/Theme.js +4 -1
- package/dist/components/Theme/Theme.types.d.ts +5 -0
- package/dist/components/Timeline/Timeline.types.d.ts +7 -0
- package/dist/components/Toast/Toast.types.d.ts +18 -0
- package/dist/components/ToggleButton/ToggleButton.types.d.ts +9 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.types.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +5 -0
- package/dist/components/View/View.types.d.ts +56 -1
- package/dist/components/_private/Aligner/Aligner.types.d.ts +6 -0
- package/dist/themes/index.d.ts +1 -0
- package/dist/themes/index.js +1 -0
- package/package.json +47 -32
- package/LICENSE-SOURCE.md +0 -40
- package/dist/components/Grid/tests/Grid.test.stories.d.ts +0 -23
- package/dist/components/Grid/tests/Grid.test.stories.js +0 -42
- package/dist/components/PinField/tests/PinField.test.stories.d.ts +0 -29
- package/dist/components/PinField/tests/PinField.test.stories.js +0 -177
@@ -24,7 +24,7 @@ const GridItem = (props) => {
|
|
24
24
|
return (_jsx(TagName, { ...attributes, className: itemClassNames, style: rootVariables, children: children }));
|
25
25
|
};
|
26
26
|
const Grid = (props) => {
|
27
|
-
const { areas, columns, rows, gap, align, justify, autoColumns, autoRows, autoFlow, children, className, width, height, maxWidth,
|
27
|
+
const { areas, columns, rows, gap, columnGap, rowGap, align, justify, autoColumns, autoRows, autoFlow, children, className, width, height, maxWidth,
|
28
28
|
// Using any here to let TS save on type resolving, otherwise TS throws an error due to the type complexity
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
30
|
as: TagName = "div", attributes, } = props;
|
@@ -39,6 +39,8 @@ const Grid = (props) => {
|
|
39
39
|
const rootVariables = {
|
40
40
|
...attributes?.style,
|
41
41
|
...responsiveVariables("--rs-grid-gap", gap),
|
42
|
+
...responsiveVariables("--rs-grid-column-gap", columnGap),
|
43
|
+
...responsiveVariables("--rs-grid-row-gap", rowGap),
|
42
44
|
...responsiveVariables("--rs-grid-rows", resolvedRows),
|
43
45
|
...responsiveVariables("--rs-grid-columns", resolvedColumns),
|
44
46
|
...responsiveVariables("--rs-grid-areas", resolvedAreas),
|
@@ -1 +1 @@
|
|
1
|
-
.root{display:grid}.root[style*="--rs-grid-gap"]{--rs-grid-gap-value:calc(var(--rs-grid-gap) * var(--rs-unit-x1));gap:var(--rs-grid-gap-value);--rs-grid-gap-s:0;--rs-grid-gap-m:var(--rs-grid-gap-s);--rs-grid-gap-l:var(--rs-grid-gap-m);--rs-grid-gap-xl:var(--rs-grid-gap-l);--rs-grid-gap:var(--rs-grid-gap-s)}.root[style*="--rs-grid-rows"]{grid-template-rows:var(--rs-grid-rows);--rs-grid-rows-s: ;--rs-grid-rows-m:var(--rs-grid-rows-s);--rs-grid-rows-l:var(--rs-grid-rows-m);--rs-grid-rows-xl:var(--rs-grid-rows-l);--rs-grid-rows:var(--rs-grid-rows-s)}.root[style*="--rs-grid-columns"]{grid-template-columns:var(--rs-grid-columns);--rs-grid-columns-s: ;--rs-grid-columns-m:var(--rs-grid-columns-s);--rs-grid-columns-l:var(--rs-grid-columns-m);--rs-grid-columns-xl:var(--rs-grid-columns-l);--rs-grid-columns:var(--rs-grid-columns-s)}.root[style*="--rs-grid-areas"]{grid-template-areas:var(--rs-grid-areas);--rs-grid-areas-s: ;--rs-grid-areas-m:var(--rs-grid-areas-s);--rs-grid-areas-l:var(--rs-grid-areas-m);--rs-grid-areas-xl:var(--rs-grid-areas-l);--rs-grid-areas:var(--rs-grid-areas-s)}.root[style*="--rs-grid-auto-flow"]{grid-auto-flow:var(--rs-grid-auto-flow);--rs-grid-auto-flow-s: ;--rs-grid-auto-flow-m:var(--rs-grid-auto-flow-s);--rs-grid-auto-flow-l:var(--rs-grid-auto-flow-m);--rs-grid-auto-flow-xl:var(--rs-grid-auto-flow-l);--rs-grid-auto-flow:var(--rs-grid-auto-flow-s)}.root[style*="--rs-grid-auto-columns"]{grid-auto-columns:var(--rs-grid-auto-columns);--rs-grid-auto-columns-s: ;--rs-grid-auto-columns-m:var(--rs-grid-auto-columns-s);--rs-grid-auto-columns-l:var(--rs-grid-auto-columns-m);--rs-grid-auto-columns-xl:var(--rs-grid-auto-columns-l);--rs-grid-auto-columns:var(--rs-grid-auto-columns-s)}.root[style*="--rs-grid-auto-rows"]{grid-auto-rows:var(--rs-grid-auto-rows);--rs-grid-auto-rows-s: ;--rs-grid-auto-rows-m:var(--rs-grid-auto-rows-s);--rs-grid-auto-rows-l:var(--rs-grid-auto-rows-m);--rs-grid-auto-rows-xl:var(--rs-grid-auto-rows-l);--rs-grid-auto-rows:var(--rs-grid-auto-rows-s)}.item[style*="--rs-grid-area"]{grid-area:var(--rs-grid-area);--rs-grid-area-s: ;--rs-grid-area-m:var(--rs-grid-area-s);--rs-grid-area-l:var(--rs-grid-area-m);--rs-grid-area-xl:var(--rs-grid-area-l);--rs-grid-area:var(--rs-grid-area-s)}.item[style*="--rs-grid-col-start"]{grid-column-start:var(--rs-grid-col-start);--rs-grid-col-start-s: ;--rs-grid-col-start-m:var(--rs-grid-col-start-s);--rs-grid-col-start-l:var(--rs-grid-col-start-m);--rs-grid-col-start-xl:var(--rs-grid-col-start-l);--rs-grid-col-start:var(--rs-grid-col-start-s)}.item[style*="--rs-grid-col-end"]{grid-column-end:var(--rs-grid-col-end);--rs-grid-col-end-s: ;--rs-grid-col-end-m:var(--rs-grid-col-end-s);--rs-grid-col-end-l:var(--rs-grid-col-end-m);--rs-grid-col-end-xl:var(--rs-grid-col-end-l);--rs-grid-col-end:var(--rs-grid-col-end-s)}.item[style*="--rs-grid-row-start"]{grid-row-start:var(--rs-grid-row-start);--rs-grid-row-start-s: ;--rs-grid-row-start-m:var(--rs-grid-row-start-s);--rs-grid-row-start-l:var(--rs-grid-row-start-m);--rs-grid-row-start-xl:var(--rs-grid-row-start-l);--rs-grid-row-start:var(--rs-grid-row-start-s)}.item[style*="--rs-grid-row-end"]{grid-row-end:var(--rs-grid-row-end);--rs-grid-row-end-s: ;--rs-grid-row-end-m:var(--rs-grid-row-end-s);--rs-grid-row-end-l:var(--rs-grid-row-end-m);--rs-grid-row-end-xl:var(--rs-grid-row-end-l);--rs-grid-row-end:var(--rs-grid-row-end-s)}@media (--rs-viewport-m ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-m)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-m)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-m)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-m)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-m)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-m)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-m)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-m)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-m)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-m)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-m)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-m)}}@media (--rs-viewport-l ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-l)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-l)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-l)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-l)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-l)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-l)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-l)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-l)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-l)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-l)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-l)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-l)}}@media (--rs-viewport-xl ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-xl)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-xl)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-xl)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-xl)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-xl)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-xl)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-xl)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-xl)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-xl)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-xl)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-xl)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-xl)}}
|
1
|
+
.root{display:grid}.root[style*="--rs-grid-gap"]{--rs-grid-gap-value:calc(var(--rs-grid-gap) * var(--rs-unit-x1));gap:var(--rs-grid-gap-value);--rs-grid-gap-s:0;--rs-grid-gap-m:var(--rs-grid-gap-s);--rs-grid-gap-l:var(--rs-grid-gap-m);--rs-grid-gap-xl:var(--rs-grid-gap-l);--rs-grid-gap:var(--rs-grid-gap-s)}.root[style*="--rs-grid-column-gap"]{--rs-grid-column-gap-value:calc(var(--rs-grid-column-gap) * var(--rs-unit-x1));column-gap:var(--rs-grid-column-gap-value);--rs-grid-column-gap-s:0;--rs-grid-column-gap-m:var(--rs-grid-column-gap-s);--rs-grid-column-gap-l:var(--rs-grid-column-gap-m);--rs-grid-column-gap-xl:var(--rs-grid-column-gap-l);--rs-grid-column-gap:var(--rs-grid-column-gap-s)}.root[style*="--rs-grid-row-gap"]{--rs-grid-row-gap-value:calc(var(--rs-grid-row-gap) * var(--rs-unit-x1));row-gap:var(--rs-grid-row-gap-value);--rs-grid-row-gap-s:0;--rs-grid-row-gap-m:var(--rs-grid-row-gap-s);--rs-grid-row-gap-l:var(--rs-grid-row-gap-m);--rs-grid-row-gap-xl:var(--rs-grid-row-gap-l);--rs-grid-row-gap:var(--rs-grid-row-gap-s)}.root[style*="--rs-grid-rows"]{grid-template-rows:var(--rs-grid-rows);--rs-grid-rows-s: ;--rs-grid-rows-m:var(--rs-grid-rows-s);--rs-grid-rows-l:var(--rs-grid-rows-m);--rs-grid-rows-xl:var(--rs-grid-rows-l);--rs-grid-rows:var(--rs-grid-rows-s)}.root[style*="--rs-grid-columns"]{grid-template-columns:var(--rs-grid-columns);--rs-grid-columns-s: ;--rs-grid-columns-m:var(--rs-grid-columns-s);--rs-grid-columns-l:var(--rs-grid-columns-m);--rs-grid-columns-xl:var(--rs-grid-columns-l);--rs-grid-columns:var(--rs-grid-columns-s)}.root[style*="--rs-grid-areas"]{grid-template-areas:var(--rs-grid-areas);--rs-grid-areas-s: ;--rs-grid-areas-m:var(--rs-grid-areas-s);--rs-grid-areas-l:var(--rs-grid-areas-m);--rs-grid-areas-xl:var(--rs-grid-areas-l);--rs-grid-areas:var(--rs-grid-areas-s)}.root[style*="--rs-grid-auto-flow"]{grid-auto-flow:var(--rs-grid-auto-flow);--rs-grid-auto-flow-s: ;--rs-grid-auto-flow-m:var(--rs-grid-auto-flow-s);--rs-grid-auto-flow-l:var(--rs-grid-auto-flow-m);--rs-grid-auto-flow-xl:var(--rs-grid-auto-flow-l);--rs-grid-auto-flow:var(--rs-grid-auto-flow-s)}.root[style*="--rs-grid-auto-columns"]{grid-auto-columns:var(--rs-grid-auto-columns);--rs-grid-auto-columns-s: ;--rs-grid-auto-columns-m:var(--rs-grid-auto-columns-s);--rs-grid-auto-columns-l:var(--rs-grid-auto-columns-m);--rs-grid-auto-columns-xl:var(--rs-grid-auto-columns-l);--rs-grid-auto-columns:var(--rs-grid-auto-columns-s)}.root[style*="--rs-grid-auto-rows"]{grid-auto-rows:var(--rs-grid-auto-rows);--rs-grid-auto-rows-s: ;--rs-grid-auto-rows-m:var(--rs-grid-auto-rows-s);--rs-grid-auto-rows-l:var(--rs-grid-auto-rows-m);--rs-grid-auto-rows-xl:var(--rs-grid-auto-rows-l);--rs-grid-auto-rows:var(--rs-grid-auto-rows-s)}.item[style*="--rs-grid-area"]{grid-area:var(--rs-grid-area);--rs-grid-area-s: ;--rs-grid-area-m:var(--rs-grid-area-s);--rs-grid-area-l:var(--rs-grid-area-m);--rs-grid-area-xl:var(--rs-grid-area-l);--rs-grid-area:var(--rs-grid-area-s)}.item[style*="--rs-grid-col-start"]{grid-column-start:var(--rs-grid-col-start);--rs-grid-col-start-s: ;--rs-grid-col-start-m:var(--rs-grid-col-start-s);--rs-grid-col-start-l:var(--rs-grid-col-start-m);--rs-grid-col-start-xl:var(--rs-grid-col-start-l);--rs-grid-col-start:var(--rs-grid-col-start-s)}.item[style*="--rs-grid-col-end"]{grid-column-end:var(--rs-grid-col-end);--rs-grid-col-end-s: ;--rs-grid-col-end-m:var(--rs-grid-col-end-s);--rs-grid-col-end-l:var(--rs-grid-col-end-m);--rs-grid-col-end-xl:var(--rs-grid-col-end-l);--rs-grid-col-end:var(--rs-grid-col-end-s)}.item[style*="--rs-grid-row-start"]{grid-row-start:var(--rs-grid-row-start);--rs-grid-row-start-s: ;--rs-grid-row-start-m:var(--rs-grid-row-start-s);--rs-grid-row-start-l:var(--rs-grid-row-start-m);--rs-grid-row-start-xl:var(--rs-grid-row-start-l);--rs-grid-row-start:var(--rs-grid-row-start-s)}.item[style*="--rs-grid-row-end"]{grid-row-end:var(--rs-grid-row-end);--rs-grid-row-end-s: ;--rs-grid-row-end-m:var(--rs-grid-row-end-s);--rs-grid-row-end-l:var(--rs-grid-row-end-m);--rs-grid-row-end-xl:var(--rs-grid-row-end-l);--rs-grid-row-end:var(--rs-grid-row-end-s)}@media (--rs-viewport-m ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-m)}.root[style*="--rs-grid-column-gap"]{--rs-grid-column-gap:var(--rs-grid-column-gap-m)}.root[style*="--rs-grid-row-gap"]{--rs-grid-row-gap:var(--rs-grid-row-gap-m)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-m)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-m)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-m)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-m)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-m)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-m)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-m)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-m)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-m)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-m)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-m)}}@media (--rs-viewport-l ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-l)}.root[style*="--rs-grid-column-gap"]{--rs-grid-column-gap:var(--rs-grid-column-gap-l)}.root[style*="--rs-grid-row-gap"]{--rs-grid-row-gap:var(--rs-grid-row-gap-l)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-l)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-l)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-l)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-l)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-l)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-l)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-l)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-l)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-l)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-l)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-l)}}@media (--rs-viewport-xl ){.root[style*="--rs-grid-gap"]{--rs-grid-gap:var(--rs-grid-gap-xl)}.root[style*="--rs-grid-column-gap"]{--rs-grid-column-gap:var(--rs-grid-column-gap-xl)}.root[style*="--rs-grid-row-gap"]{--rs-grid-row-gap:var(--rs-grid-row-gap-xl)}.root[style*="--rs-grid-rows"]{--rs-grid-rows:var(--rs-grid-rows-xl)}.root[style*="--rs-grid-columns"]{--rs-grid-columns:var(--rs-grid-columns-xl)}.root[style*="--rs-grid-areas"]{--rs-grid-areas:var(--rs-grid-areas-xl)}.root[style*="--rs-grid-auto-flow"]{--rs-grid-auto-flow:var(--rs-grid-auto-flow-xl)}.root[style*="--rs-grid-auto-columns"]{--rs-grid-auto-columns:var(--rs-grid-auto-columns-xl)}.root[style*="--rs-grid-auto-rows"]{--rs-grid-auto-rows:var(--rs-grid-auto-rows-xl)}.item[style*="--rs-grid-area"]{--rs-grid-area:var(--rs-grid-area-xl)}.item[style*="--rs-grid-col-start"]{--rs-grid-col-start:var(--rs-grid-col-start-xl)}.item[style*="--rs-grid-col-end"]{--rs-grid-col-end:var(--rs-grid-col-end-xl)}.item[style*="--rs-grid-row-start"]{--rs-grid-row-start:var(--rs-grid-row-start-xl)}.item[style*="--rs-grid-row-end"]{--rs-grid-row-end:var(--rs-grid-row-end-xl)}}
|
@@ -3,33 +3,64 @@ import type { Property } from "csstype";
|
|
3
3
|
import type * as G from "../../types/global";
|
4
4
|
import type * as TStyles from "../../styles/types";
|
5
5
|
export type Props<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
|
6
|
+
/** Gap between grid items */
|
6
7
|
gap?: G.Responsive<number>;
|
8
|
+
/** Horizontal gap between grid items */
|
9
|
+
columnGap?: G.Responsive<number>;
|
10
|
+
/** Vertical gap between grid items */
|
11
|
+
rowGap?: G.Responsive<number>;
|
12
|
+
/** Align grid items vertically */
|
7
13
|
align?: G.Responsive<TStyles.Align>;
|
14
|
+
/** Justify grid items horizontally */
|
8
15
|
justify?: G.Responsive<TStyles.Justify>;
|
16
|
+
/** Grid template rows */
|
9
17
|
rows?: G.Responsive<number | Property.GridTemplateRows>;
|
18
|
+
/** Grid template columns */
|
10
19
|
columns?: G.Responsive<number | Property.GridTemplateColumns>;
|
20
|
+
/** Grid areas for template syntax */
|
11
21
|
areas?: G.Responsive<string[]>;
|
22
|
+
/** Grid auto flow */
|
12
23
|
autoFlow?: G.Responsive<Property.GridAutoFlow>;
|
24
|
+
/** Grid auto columns */
|
13
25
|
autoColumns?: G.Responsive<Property.GridAutoColumns>;
|
26
|
+
/** Grid auto rows */
|
14
27
|
autoRows?: G.Responsive<Property.GridAutoRows>;
|
28
|
+
/** Maximum width of the grid container, literal css value or unit token multiplier */
|
15
29
|
maxWidth?: G.Responsive<string | number>;
|
30
|
+
/** Width of the grid container, literal css value or unit token multiplier */
|
16
31
|
width?: G.Responsive<string | number>;
|
32
|
+
/** Height of the grid container, literal css value or unit token multiplier */
|
17
33
|
height?: G.Responsive<string | number>;
|
34
|
+
/** Node for inserting children */
|
18
35
|
children?: React.ReactNode;
|
36
|
+
/** Custom root element html tag */
|
19
37
|
as?: TagName;
|
38
|
+
/** Additional classname for the root element */
|
20
39
|
className?: G.ClassName;
|
40
|
+
/** Additional attributes for the root element */
|
21
41
|
attributes?: G.Attributes<TagName>;
|
22
42
|
};
|
23
43
|
export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
|
44
|
+
/** Grid area for template syntax */
|
24
45
|
area?: string;
|
46
|
+
/** Starting column position */
|
25
47
|
colStart?: G.Responsive<number>;
|
48
|
+
/** Ending column position */
|
26
49
|
colEnd?: G.Responsive<number>;
|
50
|
+
/** Column span value */
|
27
51
|
colSpan?: G.Responsive<number>;
|
52
|
+
/** Starting row position */
|
28
53
|
rowStart?: G.Responsive<number>;
|
54
|
+
/** Ending row position */
|
29
55
|
rowEnd?: G.Responsive<number>;
|
56
|
+
/** Row span value */
|
30
57
|
rowSpan?: G.Responsive<number>;
|
58
|
+
/** Node for inserting children */
|
31
59
|
children?: React.ReactNode;
|
60
|
+
/** Custom item element html tag */
|
32
61
|
as?: TagName;
|
62
|
+
/** Additional classname for the item element */
|
33
63
|
className?: G.ClassName;
|
64
|
+
/** Additional attributes for the item element */
|
34
65
|
attributes?: G.Attributes<TagName>;
|
35
66
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react-vite";
|
1
2
|
declare const _default: {
|
2
3
|
title: string;
|
3
4
|
component: {
|
@@ -35,3 +36,5 @@ export declare const auto: {
|
|
35
36
|
name: string;
|
36
37
|
render: () => import("react").JSX.Element;
|
37
38
|
};
|
39
|
+
export declare const as: StoryObj;
|
40
|
+
export declare const className: StoryObj;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { expect } from "storybook/test";
|
1
2
|
import { Example } from "../../../utilities/storybook/index.js";
|
2
3
|
import Grid from "../index.js";
|
3
4
|
import View from "../../View/index.js";
|
@@ -11,7 +12,7 @@ export default {
|
|
11
12
|
},
|
12
13
|
};
|
13
14
|
export const base = {
|
14
|
-
name: "gap, align, justify, maxWidth, width, height",
|
15
|
+
name: "gap, columnGap, rowGap, align, justify, maxWidth, width, height",
|
15
16
|
render: () => (<Example>
|
16
17
|
<Example.Item title="gap: 2">
|
17
18
|
<Grid gap={2} columns={2}>
|
@@ -20,6 +21,13 @@ export const base = {
|
|
20
21
|
</View>))}
|
21
22
|
</Grid>
|
22
23
|
</Example.Item>
|
24
|
+
<Example.Item title="columnGap: 2, rowGap: 4">
|
25
|
+
<Grid columnGap={2} rowGap={4} columns={2}>
|
26
|
+
{[1, 2, 3, 4].map((i) => (<View backgroundColor="neutral-faded" borderRadius="medium" padding={4} key={i}>
|
27
|
+
{i}
|
28
|
+
</View>))}
|
29
|
+
</Grid>
|
30
|
+
</Example.Item>
|
23
31
|
<Example.Item title="align: center">
|
24
32
|
<Grid gap={2} columns={2} align="center">
|
25
33
|
<View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
|
@@ -205,3 +213,33 @@ export const auto = {
|
|
205
213
|
</Example.Item>
|
206
214
|
</Example>),
|
207
215
|
};
|
216
|
+
export const as = {
|
217
|
+
name: "as",
|
218
|
+
render: () => (<Grid as="ul">
|
219
|
+
<Grid.Item as="li">Content</Grid.Item>
|
220
|
+
</Grid>),
|
221
|
+
play: ({ canvas }) => {
|
222
|
+
const ul = canvas.getByRole("list");
|
223
|
+
const li = canvas.getByRole("listitem");
|
224
|
+
expect(ul).toBeInTheDocument();
|
225
|
+
expect(li).toBeInTheDocument();
|
226
|
+
},
|
227
|
+
};
|
228
|
+
export const className = {
|
229
|
+
name: "className, attributes",
|
230
|
+
render: () => (<div data-testid="root">
|
231
|
+
<Grid className="test-class" attributes={{ id: "test-id" }}>
|
232
|
+
<Grid.Item className="test-item-class" attributes={{ id: "test-item-id" }}>
|
233
|
+
Content
|
234
|
+
</Grid.Item>
|
235
|
+
</Grid>
|
236
|
+
</div>),
|
237
|
+
play: async ({ canvas }) => {
|
238
|
+
const root = canvas.getByTestId("root").firstChild;
|
239
|
+
const item = root?.firstChild;
|
240
|
+
expect(root).toHaveAttribute("id", "test-id");
|
241
|
+
expect(root).toHaveClass("test-class");
|
242
|
+
expect(item).toHaveAttribute("id", "test-item-id");
|
243
|
+
expect(item).toHaveClass("test-item-class");
|
244
|
+
},
|
245
|
+
};
|
@@ -1,8 +1,12 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Pick at which viewport sizes to hide the children*/
|
4
5
|
hide?: G.Responsive<boolean>;
|
6
|
+
/** Use visibility hidden instead of display none */
|
5
7
|
visibility?: boolean;
|
8
|
+
/** Custom root element html tag */
|
6
9
|
as?: keyof React.JSX.IntrinsicElements;
|
10
|
+
/** Node for inserting children */
|
7
11
|
children: React.ReactNode;
|
8
12
|
};
|
@@ -1,8 +1,12 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Node for inserting children */
|
4
5
|
children: React.ReactNode;
|
6
|
+
/** Highlight the component, can be used to show when hotkey is pressed */
|
5
7
|
active?: boolean;
|
8
|
+
/** Additional classname for the root element */
|
6
9
|
className?: G.ClassName;
|
10
|
+
/** Additional attributes for the root element */
|
7
11
|
attributes?: G.Attributes<"span">;
|
8
12
|
};
|
@@ -1,10 +1,16 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Icon svg component or node */
|
4
5
|
svg: React.ReactElement | React.ComponentType;
|
6
|
+
/** Icon size, literal css value or unit token multiplier */
|
5
7
|
size?: G.Responsive<number | string>;
|
8
|
+
/** Icon color, based on the color tokens */
|
6
9
|
color?: "neutral" | "neutral-faded" | "positive" | "critical" | "warning" | "primary" | "disabled";
|
10
|
+
/** Use the width of the svg asset instead of providing a square bounding box */
|
7
11
|
autoWidth?: boolean;
|
12
|
+
/** Additional classname for the root element */
|
8
13
|
className?: G.ClassName;
|
14
|
+
/** Additional attributes for the root element */
|
9
15
|
attributes?: G.Attributes<"span">;
|
10
16
|
};
|
@@ -2,22 +2,37 @@ import type React from "react";
|
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
import type * as TStyles from "../../styles/types";
|
4
4
|
export type Props = {
|
5
|
+
/** Image URL */
|
5
6
|
src?: string;
|
7
|
+
/** Image alt text */
|
6
8
|
alt?: string;
|
9
|
+
/** Image width, literal css value or unit token multiplier */
|
7
10
|
width?: G.Responsive<string | number>;
|
11
|
+
/** Image height, literal css value or unit token multiplier */
|
8
12
|
height?: G.Responsive<string | number>;
|
13
|
+
/** Image max width, literal css value or unit token multiplier */
|
9
14
|
maxWidth?: G.Responsive<string | number>;
|
15
|
+
/** Image aspect ratio, width / height */
|
10
16
|
aspectRatio?: G.Responsive<number>;
|
17
|
+
/** Image border radius, based on the radius tokens */
|
11
18
|
borderRadius?: Extract<TStyles.Radius, "small" | "medium" | "large">;
|
19
|
+
/** Image display mode for controlling how it fits into the provided boundaries */
|
12
20
|
displayMode?: "cover" | "contain";
|
21
|
+
/** Image on load event */
|
13
22
|
onLoad?: (e: React.SyntheticEvent) => void;
|
23
|
+
/** Image on error event */
|
14
24
|
onError?: (e: React.SyntheticEvent) => void;
|
25
|
+
/** Image fallback content if the image fails to load or was not provided */
|
15
26
|
fallback?: string | React.ReactNode | boolean;
|
27
|
+
/** Image render function, can be used for integrating with Image component in 3rd party frameworks */
|
16
28
|
renderImage?: (attributes: Omit<G.Attributes<"img">, "src" | "alt"> & {
|
17
29
|
src: string;
|
18
30
|
alt: string;
|
19
31
|
}) => React.ReactNode;
|
32
|
+
/** Additional attributes for the image element */
|
20
33
|
imageAttributes?: G.Attributes<"img">;
|
34
|
+
/** Additional classname for the root element */
|
21
35
|
className?: G.ClassName;
|
36
|
+
/** Additional attributes for the root element */
|
22
37
|
attributes?: G.Attributes<"div"> & G.Attributes<"img">;
|
23
38
|
};
|
@@ -1,7 +1,14 @@
|
|
1
1
|
import type { ActionableProps } from "../Actionable";
|
2
2
|
import type { IconProps } from "../Icon";
|
3
3
|
export type Props = Pick<ActionableProps, "attributes" | "className" | "disabled" | "children" | "href" | "onClick" | "type" | "stopPropagation"> & {
|
4
|
+
/** Icon at the start position */
|
4
5
|
icon?: IconProps["svg"];
|
6
|
+
/** Link color, based on the color tokens
|
7
|
+
* @default "primary"
|
8
|
+
*/
|
5
9
|
color?: "inherit" | "critical" | "primary" | "positive" | "warning";
|
10
|
+
/** Link render variant
|
11
|
+
* @default "underline"
|
12
|
+
*/
|
6
13
|
variant?: "plain" | "underline";
|
7
14
|
};
|
@@ -1,8 +1,13 @@
|
|
1
1
|
import type * as G from "../../types/global";
|
2
2
|
export type Props = {
|
3
|
+
/** Component size */
|
3
4
|
size?: G.Responsive<"small" | "medium" | "large">;
|
5
|
+
/** Component color, based on the color tokens */
|
4
6
|
color?: "primary" | "critical" | "positive" | "inherit";
|
7
|
+
/** aria-label attribute for the root element */
|
5
8
|
ariaLabel?: string;
|
9
|
+
/** Additional classname for the root element */
|
6
10
|
className?: G.ClassName;
|
11
|
+
/** Additional attributes for the root element */
|
7
12
|
attributes?: G.Attributes<"span">;
|
8
13
|
};
|
@@ -4,19 +4,31 @@ import type { ActionableProps, ActionableRef } from "../Actionable";
|
|
4
4
|
import type * as G from "../../types/global";
|
5
5
|
export type Size = "small" | "medium" | "large";
|
6
6
|
export type Props = Pick<ActionableProps, "attributes" | "className" | "disabled" | "children" | "href" | "onClick" | "as" | "stopPropagation"> & {
|
7
|
+
/** Component color, based on the color tokens */
|
7
8
|
color?: "neutral" | "critical" | "primary";
|
9
|
+
/** Icon at the start position */
|
8
10
|
icon?: IconProps["svg"];
|
9
|
-
|
11
|
+
/** Node for inserting children */
|
10
12
|
children: React.ReactNode;
|
13
|
+
/** Node for inserting content at the start side of the component */
|
14
|
+
startSlot?: React.ReactNode;
|
15
|
+
/** Node for inserting content at the end side of the component */
|
11
16
|
endSlot?: React.ReactNode;
|
17
|
+
/** Highlight the component as hovered or focused. For example, when displaying currently focused item in Autocomplete */
|
12
18
|
highlighted?: boolean;
|
19
|
+
/** Highlight the component as selected */
|
13
20
|
selected?: boolean;
|
21
|
+
/** Component size */
|
14
22
|
size?: G.Responsive<Size>;
|
23
|
+
/** Round the corners of the component */
|
15
24
|
roundedCorners?: G.Responsive<boolean>;
|
16
25
|
};
|
17
26
|
export type AlignerProps = {
|
27
|
+
/** Node for inserting children */
|
18
28
|
children: React.ReactElement;
|
29
|
+
/** Additional classname for the root element */
|
19
30
|
className?: G.ClassName;
|
31
|
+
/** Additional attributes for the root element */
|
20
32
|
attributes?: G.Attributes<"div">;
|
21
33
|
};
|
22
34
|
export type Export = React.ForwardRefExoticComponent<Props & {
|
@@ -9,28 +9,47 @@ export type Context = {
|
|
9
9
|
setSubtitleMounted: (b: boolean) => void;
|
10
10
|
};
|
11
11
|
export type TitleProps = {
|
12
|
+
/** Node for inserting the title text */
|
12
13
|
children: React.ReactNode;
|
13
14
|
};
|
14
15
|
export type SubtitleProps = {
|
16
|
+
/** Node for inserting the subtitle text */
|
15
17
|
children: React.ReactNode;
|
16
18
|
};
|
17
19
|
export type Props = {
|
20
|
+
/** Node for inserting children */
|
18
21
|
children?: React.ReactNode;
|
22
|
+
/** Component position on the screen */
|
19
23
|
position?: G.Responsive<"center" | "end" | "bottom" | "start" | "full-screen">;
|
24
|
+
/** Component size, literal css value */
|
20
25
|
size?: G.Responsive<string>;
|
26
|
+
/** Component padding, unit token multiplier */
|
21
27
|
padding?: G.Responsive<number>;
|
28
|
+
/** Remove overflow from the component content */
|
22
29
|
overflow?: "visible";
|
30
|
+
/** Callback when the component is closed */
|
23
31
|
onClose?: (args: {
|
24
32
|
reason: OverlayCloseReason | "drag";
|
25
33
|
}) => void;
|
34
|
+
/** Make the overlay transparent */
|
26
35
|
transparentOverlay?: boolean;
|
36
|
+
/** Make the overlay blurred */
|
27
37
|
blurredOverlay?: boolean;
|
38
|
+
/** Disable swipe gesture to close the component on touch devices */
|
28
39
|
disableSwipeGesture?: boolean;
|
40
|
+
/** Disable closing the component on outside click */
|
29
41
|
disableCloseOnOutsideClick?: boolean;
|
42
|
+
/** Focus the first focusable element in the component when it is opened, when false, focus will be set on the component content container
|
43
|
+
* @default true
|
44
|
+
*/
|
30
45
|
autoFocus?: boolean;
|
46
|
+
/** aria-label attribute for the root element, useful when there is no visible title */
|
31
47
|
ariaLabel?: string;
|
48
|
+
/** Additional classname for the root element */
|
32
49
|
className?: G.ClassName;
|
50
|
+
/** Additional classname for the overlay element */
|
33
51
|
overlayClassName?: G.ClassName;
|
52
|
+
/** Additional attributes for the root element */
|
34
53
|
attributes?: G.Attributes<"div"> & {
|
35
54
|
ref?: React.RefObject<HTMLDivElement | null>;
|
36
55
|
};
|
@@ -1,19 +1,29 @@
|
|
1
1
|
import type { TextFieldBaseProps } from "../TextField";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type BaseProps = Omit<TextFieldBaseProps, "endSlot" | "onChange" | "rounded" | "multiline"> & {
|
4
|
+
/** Callback when the component value is changed */
|
4
5
|
onChange?: G.ChangeHandler<number>;
|
6
|
+
/** aria-label attribute for the increase button */
|
5
7
|
increaseAriaLabel: string;
|
8
|
+
/** aria-label attribute for the decrease button */
|
6
9
|
decreaseAriaLabel: string;
|
10
|
+
/** Minimum value supported in the form field */
|
7
11
|
min?: number;
|
12
|
+
/** Maximum value supported in the form field */
|
8
13
|
max?: number;
|
14
|
+
/** Step at which the value will increase or decrease when clicking the button controls */
|
9
15
|
step?: number;
|
10
16
|
};
|
11
17
|
export type ControlledProps = BaseProps & {
|
18
|
+
/** Value of the form field, enables controlled mode */
|
12
19
|
value: number | null;
|
20
|
+
/** Default value of the form field, enables uncontrolled mode */
|
13
21
|
defaultValue?: never;
|
14
22
|
};
|
15
23
|
export type UncontrolledProps = BaseProps & {
|
24
|
+
/** Value of the form field, enables controlled mode */
|
16
25
|
value?: never;
|
26
|
+
/** Default value of the form field, enables uncontrolled mode */
|
17
27
|
defaultValue?: number;
|
18
28
|
};
|
19
29
|
export type Props = ControlledProps | UncontrolledProps;
|
@@ -2,21 +2,34 @@ import type React from "react";
|
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type CloseReason = "overlay-click" | "escape-key";
|
4
4
|
export type Props = {
|
5
|
+
/** Make the overlay transparent */
|
5
6
|
transparent?: boolean | number;
|
7
|
+
/** Make the overlay blurred */
|
6
8
|
blurred?: boolean;
|
9
|
+
/** Control the overflow of the component content */
|
7
10
|
overflow?: "auto" | "hidden";
|
11
|
+
/** Node for inserting children, render function receives the state of the component as an argument */
|
8
12
|
children?: React.ReactNode | ((props: {
|
9
13
|
active: boolean;
|
10
14
|
}) => React.ReactNode);
|
15
|
+
/** Control the visibility of the component */
|
11
16
|
active?: boolean;
|
17
|
+
/** Callback when the component is closed */
|
12
18
|
onClose?: (args: {
|
13
19
|
reason: CloseReason;
|
14
20
|
}) => void;
|
21
|
+
/** Callback after the component close transition is complete */
|
15
22
|
onAfterClose?: () => void;
|
23
|
+
/** Callback when the component is opened */
|
16
24
|
onOpen?: () => void;
|
25
|
+
/** Callback after the component open transition is complete */
|
17
26
|
onAfterOpen?: () => void;
|
27
|
+
/** Disable closing the component on outside click */
|
18
28
|
disableCloseOnClick?: boolean;
|
29
|
+
/** Element to render the component in */
|
19
30
|
containerRef?: React.RefObject<HTMLElement | null>;
|
31
|
+
/** Additional classname for the root element */
|
20
32
|
className?: G.ClassName;
|
33
|
+
/** Additional attributes for the root element */
|
21
34
|
attributes?: G.Attributes<"div">;
|
22
35
|
};
|
@@ -1,52 +1,34 @@
|
|
1
1
|
import type * as G from "../../types/global";
|
2
2
|
export type BaseProps = {
|
3
|
-
/**
|
4
|
-
* Total number of pages available
|
5
|
-
*/
|
3
|
+
/** Total number of pages available */
|
6
4
|
total: number;
|
7
|
-
/**
|
8
|
-
* Event handler triggered when the current page changes
|
9
|
-
*/
|
5
|
+
/** Callback when the current page changes */
|
10
6
|
onChange?: (args: {
|
11
7
|
page: number;
|
12
8
|
}) => void;
|
13
|
-
/**
|
14
|
-
* Function to dynamically get an aria-label for each
|
15
|
-
*/
|
9
|
+
/** Function to dynamically get an aria-label for each page */
|
16
10
|
pageAriaLabel?: (args: {
|
17
11
|
page: number;
|
18
12
|
}) => string;
|
19
|
-
/**
|
20
|
-
* aria-label for the previous page button
|
21
|
-
*/
|
13
|
+
/** aria-label attribute for the previous page button */
|
22
14
|
previousAriaLabel: string;
|
23
|
-
/**
|
24
|
-
* aria-label for the next page button
|
25
|
-
*/
|
15
|
+
/** aria-label attribute for the next page button */
|
26
16
|
nextAriaLabel: string;
|
27
|
-
/**
|
28
|
-
* Custom root element className
|
29
|
-
*/
|
17
|
+
/** Additional classname for the root element */
|
30
18
|
className?: G.ClassName;
|
31
|
-
/**
|
32
|
-
* Custom root element attributes
|
33
|
-
*/
|
19
|
+
/** Additional attributes for the root element */
|
34
20
|
attributes?: G.Attributes<"div">;
|
35
21
|
};
|
36
22
|
export type ControlledProps = BaseProps & {
|
37
|
-
/**
|
38
|
-
* Currently selected page number, starts with 1.
|
39
|
-
* Enables controlled component behavior.
|
40
|
-
*/
|
23
|
+
/** Currently selected page number, starts with 1, enables controlled mode */
|
41
24
|
page: number;
|
25
|
+
/** Default selected page number, starts with 1, enables uncontrolled mode */
|
42
26
|
defaultPage?: never;
|
43
27
|
};
|
44
28
|
export type UncontrolledProps = BaseProps & {
|
29
|
+
/** Currently selected page number, starts with 1, enables controlled mode */
|
45
30
|
page?: never;
|
46
|
-
/**
|
47
|
-
* Default selected page number, starts with 1.
|
48
|
-
* Enables uncontrolled component behavior.
|
49
|
-
*/
|
31
|
+
/** Default selected page number, starts with 1, enables uncontrolled mode */
|
50
32
|
defaultPage?: number;
|
51
33
|
};
|
52
34
|
export type Props = ControlledProps | UncontrolledProps;
|
@@ -1 +1 @@
|
|
1
|
-
.root{display:inline-flex}.input,.root{vertical-align:top}.input{background:transparent;border:transparent;caret-color:transparent;color:transparent;font-size:16px;inset:0;outline:none;padding-left:100%;position:absolute}.item{box-sizing:border-box;cursor:text}.item--focused{border-color:var(--rs-color-border-primary);box-shadow:0 0 0 1px var(--rs-color-border-primary)}.item--focused:empty:before{animation:rs-pin-field-caret 1s ease-out infinite;background:var(--rs-color-foreground-neutral);border-radius:var(--rs-radius-circular);content:"";height:var(--rs-font-size-body-2);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:1px}@media (hover:hover){.root:hover .input{pointer-events:none}}@keyframes rs-pin-field-caret{0%,49.9%,to{opacity:1}50%,99.9%{opacity:0}}
|
1
|
+
.root{display:inline-flex}.input,.root{vertical-align:top}.input{background:transparent;border:transparent;caret-color:transparent;clip-path:inset(0 calc(50% + var(--rs-unit-x2)) 0 0);color:transparent;font-size:16px;inset-block:0;inset-inline-start:0;outline:none;padding-left:100%;position:absolute}.item{box-sizing:border-box;cursor:text}.item--focused{border-color:var(--rs-color-border-primary);box-shadow:0 0 0 1px var(--rs-color-border-primary)}.item--focused:empty:before{animation:rs-pin-field-caret 1s ease-out infinite;background:var(--rs-color-foreground-neutral);border-radius:var(--rs-radius-circular);content:"";height:var(--rs-font-size-body-2);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:1px}@media (hover:hover){.root:hover .input{pointer-events:none}}@keyframes rs-pin-field-caret{0%,49.9%,to{opacity:1}50%,99.9%{opacity:0}}
|
@@ -1,22 +1,35 @@
|
|
1
1
|
import type * as G from "../../types/global";
|
2
2
|
export type Size = "small" | "medium" | "large" | "xlarge";
|
3
3
|
type BaseProps = {
|
4
|
+
/** Name of the input element */
|
4
5
|
name: string;
|
6
|
+
/** Amount of characters in the pin */
|
5
7
|
valueLength?: number;
|
8
|
+
/** Character pattern used in the input value */
|
6
9
|
pattern?: "alphabetic" | "numeric" | "alphanumeric";
|
10
|
+
/** Component size */
|
7
11
|
size?: G.Responsive<Size>;
|
12
|
+
/** Input fields render variant */
|
8
13
|
variant?: "outline" | "faded";
|
14
|
+
/** Callback when the input value changes */
|
9
15
|
onChange?: G.ChangeHandler<string>;
|
16
|
+
/** Additional attributes for the input element */
|
10
17
|
inputAttributes?: G.Attributes<"input">;
|
18
|
+
/** Additional classname for the root element */
|
11
19
|
className?: G.ClassName;
|
20
|
+
/** Additional attributes for the root element */
|
12
21
|
attributes?: G.Attributes<"div">;
|
13
22
|
};
|
14
23
|
export type ControlledProps = BaseProps & {
|
24
|
+
/** Value of the input element, enables controlled mode */
|
15
25
|
value: string;
|
26
|
+
/** Default value of the input element, enables uncontrolled mode */
|
16
27
|
defaultValue?: never;
|
17
28
|
};
|
18
29
|
export type UncontrolledProps = BaseProps & {
|
30
|
+
/** Value of the input element, enables controlled mode */
|
19
31
|
value?: never;
|
32
|
+
/** Default value of the input element, enables uncontrolled mode */
|
20
33
|
defaultValue?: string;
|
21
34
|
};
|
22
35
|
export type Props = ControlledProps | UncontrolledProps;
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react-vite";
|
2
|
+
import { fn } from "storybook/internal/test";
|
1
3
|
declare const _default: {
|
2
4
|
title: string;
|
3
5
|
component: import("react").FC<import("./..").PinFieldProps>;
|
@@ -8,6 +10,25 @@ declare const _default: {
|
|
8
10
|
};
|
9
11
|
};
|
10
12
|
export default _default;
|
11
|
-
export declare const base:
|
12
|
-
export declare const variant:
|
13
|
-
|
13
|
+
export declare const base: StoryObj;
|
14
|
+
export declare const variant: {
|
15
|
+
name: string;
|
16
|
+
render: () => import("react").JSX.Element;
|
17
|
+
};
|
18
|
+
export declare const size: {
|
19
|
+
name: string;
|
20
|
+
render: () => import("react").JSX.Element;
|
21
|
+
};
|
22
|
+
export declare const valueLength: StoryObj;
|
23
|
+
export declare const defaultValue: StoryObj<{
|
24
|
+
handleChange?: ReturnType<typeof fn>;
|
25
|
+
}>;
|
26
|
+
export declare const value: StoryObj<{
|
27
|
+
handleChange?: ReturnType<typeof fn>;
|
28
|
+
}>;
|
29
|
+
export declare const pattern: StoryObj<{
|
30
|
+
handleChange?: ReturnType<typeof fn>;
|
31
|
+
}>;
|
32
|
+
export declare const className: StoryObj;
|
33
|
+
export declare const formControl: StoryObj;
|
34
|
+
export declare const keyboard: StoryObj;
|