@strapi/design-system 1.4.0-beta.0 → 1.4.0-beta.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/dist/Accordion/Accordion.cjs +8 -8
- package/dist/Accordion/Accordion.js +6 -7
- package/dist/Accordion/AccordionContent.cjs +1 -1
- package/dist/Accordion/AccordionContent.js +37 -17
- package/dist/Accordion/AccordionToggle.cjs +6 -6
- package/dist/Accordion/AccordionToggle.js +96 -75
- package/dist/Alert/Alert.cjs +12 -12
- package/dist/Alert/Alert.js +102 -83
- package/dist/Badge/Badge.cjs +4 -1
- package/dist/Badge/Badge.js +56 -26
- package/dist/BaseButton/BaseButton.cjs +3 -3
- package/dist/BaseButton/BaseButton.js +42 -20
- package/dist/BaseCheckbox/BaseCheckbox.cjs +6 -6
- package/dist/BaseCheckbox/BaseCheckbox.js +56 -36
- package/dist/BaseLink/BaseLink.cjs +2 -2
- package/dist/BaseLink/BaseLink.js +43 -21
- package/dist/BaseRadio/BaseRadio.cjs +8 -8
- package/dist/BaseRadio/BaseRadio.js +51 -31
- package/dist/BaseRadio/RadioGroup.cjs +1 -1
- package/dist/BaseRadio/RadioGroup.js +44 -24
- package/dist/Box/BoxProps.cjs +1 -1
- package/dist/Box/BoxProps.js +19 -10
- package/dist/Breadcrumbs/Breadcrumbs.cjs +4 -4
- package/dist/Breadcrumbs/Breadcrumbs.js +50 -29
- package/dist/Button/Button.cjs +14 -14
- package/dist/Button/Button.js +73 -53
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +37 -17
- package/dist/Card/CardAsset.cjs +4 -4
- package/dist/Card/CardAsset.js +42 -19
- package/dist/Card/CardBadge.cjs +3 -3
- package/dist/Card/CardBadge.js +18 -9
- package/dist/Card/CardBody.cjs +1 -1
- package/dist/Card/CardBody.js +19 -8
- package/dist/Card/CardCheckbox.cjs +1 -1
- package/dist/Card/CardCheckbox.js +22 -12
- package/dist/Card/CardContent.cjs +2 -2
- package/dist/Card/CardContent.js +32 -11
- package/dist/Card/CardHeader.cjs +2 -2
- package/dist/Card/CardHeader.js +19 -9
- package/dist/Card/CardTimer.cjs +2 -2
- package/dist/Card/CardTimer.js +42 -20
- package/dist/Card/CardTitle.cjs +1 -1
- package/dist/Card/CardTitle.js +27 -16
- package/dist/CarouselInput/Carousel.cjs +6 -6
- package/dist/CarouselInput/Carousel.js +107 -77
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +17 -7
- package/dist/CarouselInput/CarouselImage.cjs +3 -3
- package/dist/CarouselInput/CarouselImage.js +38 -26
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +84 -49
- package/dist/CarouselInput/CarouselSlide.cjs +2 -2
- package/dist/CarouselInput/CarouselSlide.js +42 -20
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +63 -44
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +262 -194
- package/dist/Combobox/ComboboxList.cjs +1 -1
- package/dist/Combobox/ComboboxList.js +5 -5
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +47 -25
- package/dist/Combobox/components.cjs +2 -2
- package/dist/Combobox/components.js +1 -1
- package/dist/Combobox/utils.cjs +1 -1
- package/dist/Combobox/utils.js +21 -21
- package/dist/DatePicker/DatePicker.cjs +1 -1
- package/dist/DatePicker/DatePicker.js +110 -80
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +18 -13
- package/dist/DatePicker/DatePickerTd.cjs +4 -4
- package/dist/DatePicker/DatePickerTd.js +42 -23
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +44 -23
- package/dist/DatePicker/utils/getYears.cjs +1 -1
- package/dist/DatePicker/utils/getYears.js +7 -6
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +124 -89
- package/dist/DateTimePicker/DateTimePickerProps.cjs +1 -1
- package/dist/DateTimePicker/DateTimePickerProps.js +19 -10
- package/dist/Dialog/Dialog.cjs +5 -5
- package/dist/Dialog/Dialog.js +58 -39
- package/dist/Dialog/DialogBody.cjs +2 -2
- package/dist/Dialog/DialogBody.js +14 -11
- package/dist/DismissibleLayer/DismissibleLayer.cjs +1 -1
- package/dist/DismissibleLayer/DismissibleLayer.js +22 -27
- package/dist/Divider/Divider.cjs +2 -2
- package/dist/Divider/Divider.js +38 -15
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +38 -19
- package/dist/Field/FieldAction.cjs +2 -2
- package/dist/Field/FieldAction.js +35 -13
- package/dist/Field/FieldInput.cjs +6 -6
- package/dist/Field/FieldInput.js +67 -47
- package/dist/Field/FieldLabel.cjs +3 -3
- package/dist/Field/FieldLabel.js +45 -25
- package/dist/Flex/FlexProps.cjs +1 -1
- package/dist/Flex/FlexProps.js +20 -10
- package/dist/FocusTrap/ExampleComponent.cjs +1 -1
- package/dist/FocusTrap/ExampleComponent.js +3 -2
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +56 -35
- package/dist/Grid/Grid.cjs +3 -3
- package/dist/Grid/Grid.js +42 -20
- package/dist/Grid/GridItem.cjs +2 -2
- package/dist/Grid/GridItem.js +41 -22
- package/dist/Icon/Icon.cjs +2 -2
- package/dist/Icon/Icon.js +27 -17
- package/dist/IconButton/IconButton.cjs +4 -4
- package/dist/IconButton/IconButton.js +68 -49
- package/dist/KeyboardNavigable/KeyboardNavigable.cjs +1 -1
- package/dist/KeyboardNavigable/KeyboardNavigable.js +58 -38
- package/dist/Layout/HeaderLayout.cjs +2 -2
- package/dist/Layout/HeaderLayout.js +96 -78
- package/dist/Link/Link.cjs +6 -6
- package/dist/Link/Link.js +59 -37
- package/dist/LinkButton/LinkButton.cjs +10 -10
- package/dist/LinkButton/LinkButton.js +71 -49
- package/dist/Loader/Loader.cjs +4 -4
- package/dist/Loader/Loader.js +47 -25
- package/dist/Main/Main.cjs +2 -2
- package/dist/Main/Main.js +35 -15
- package/dist/MainNav/MainNav.cjs +2 -2
- package/dist/MainNav/MainNav.js +39 -17
- package/dist/MainNav/NavCondense.cjs +3 -3
- package/dist/MainNav/NavCondense.js +40 -20
- package/dist/MainNav/NavLink.cjs +9 -9
- package/dist/MainNav/NavLink.js +72 -53
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +67 -46
- package/dist/MainNav/NavSections.cjs +1 -1
- package/dist/MainNav/NavSections.js +40 -18
- package/dist/MainNav/NavUser.cjs +2 -2
- package/dist/MainNav/NavUser.js +51 -31
- package/dist/ModalLayout/ModalBody.cjs +2 -2
- package/dist/ModalLayout/ModalBody.js +19 -9
- package/dist/ModalLayout/ModalLayout.cjs +3 -3
- package/dist/ModalLayout/ModalLayout.js +52 -30
- package/dist/NumberInput/NumberInput.cjs +6 -6
- package/dist/NumberInput/NumberInput.js +149 -117
- package/dist/Pagination/components.cjs +7 -7
- package/dist/Pagination/components.js +88 -65
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +93 -66
- package/dist/Portal/Portal.cjs +1 -1
- package/dist/Portal/Portal.js +12 -11
- package/dist/ProgressBar/ProgressBar.cjs +2 -2
- package/dist/ProgressBar/ProgressBar.js +49 -27
- package/dist/Radio/Radio.cjs +2 -2
- package/dist/Radio/Radio.js +40 -19
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +97 -62
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +67 -46
- package/dist/RawTable/RawTableContext.cjs +1 -1
- package/dist/RawTable/RawTableContext.js +1 -1
- package/dist/RawTable/RawTbody.cjs +1 -1
- package/dist/RawTable/RawTbody.js +30 -11
- package/dist/RawTable/RawThead.cjs +1 -1
- package/dist/RawTable/RawThead.js +29 -10
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +34 -14
- package/dist/Searchbar/SearchForm.cjs +1 -1
- package/dist/Searchbar/SearchForm.js +16 -5
- package/dist/Searchbar/Searchbar.cjs +7 -7
- package/dist/Searchbar/Searchbar.js +65 -45
- package/dist/Select/MultiSelectNested.cjs +1 -1
- package/dist/Select/MultiSelectNested.js +45 -23
- package/dist/Select/OptGroup.cjs +1 -1
- package/dist/Select/OptGroup.js +35 -15
- package/dist/Select/Option.cjs +7 -7
- package/dist/Select/Option.js +57 -37
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +187 -148
- package/dist/Select/SelectButton.cjs +2 -2
- package/dist/Select/SelectButton.js +53 -33
- package/dist/SimpleMenu/SimpleMenu.cjs +7 -7
- package/dist/SimpleMenu/SimpleMenu.js +143 -102
- package/dist/Stack/Stack.cjs +3 -3
- package/dist/Stack/Stack.js +50 -29
- package/dist/Status/Status.cjs +4 -4
- package/dist/Status/Status.js +50 -30
- package/dist/SubNav/SubNav.cjs +3 -3
- package/dist/SubNav/SubNav.js +37 -15
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +44 -43
- package/dist/SubNav/SubNavLink.cjs +6 -6
- package/dist/SubNav/SubNavLink.js +61 -40
- package/dist/SubNav/SubNavLinkSection.cjs +4 -4
- package/dist/SubNav/SubNavLinkSection.js +8 -7
- package/dist/SubNav/SubNavSection.cjs +2 -2
- package/dist/SubNav/SubNavSection.js +11 -10
- package/dist/SubNav/SubNavSectionLabel.cjs +1 -1
- package/dist/SubNav/SubNavSectionLabel.js +1 -1
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +39 -17
- package/dist/Switch/Switch.cjs +5 -5
- package/dist/Switch/Switch.js +57 -35
- package/dist/Table/Cell.cjs +3 -3
- package/dist/Table/Cell.js +40 -20
- package/dist/Table/TFooter.cjs +3 -3
- package/dist/Table/TFooter.js +50 -28
- package/dist/Table/Table.cjs +5 -5
- package/dist/Table/Table.js +59 -36
- package/dist/Table/Tbody.cjs +2 -2
- package/dist/Table/Tbody.js +17 -8
- package/dist/Table/Thead.cjs +2 -2
- package/dist/Table/Thead.js +17 -8
- package/dist/Table/Tr.cjs +2 -2
- package/dist/Table/Tr.js +17 -8
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +46 -27
- package/dist/Tabs/TabPanels.cjs +1 -1
- package/dist/Tabs/TabPanels.js +43 -24
- package/dist/Tabs/Tabs.cjs +2 -2
- package/dist/Tabs/Tabs.js +112 -94
- package/dist/Tabs/useTabsFocus.cjs +1 -1
- package/dist/Tabs/useTabsFocus.js +12 -11
- package/dist/Tag/Tag.cjs +4 -4
- package/dist/Tag/Tag.js +50 -27
- package/dist/TextButton/TextButton.cjs +6 -6
- package/dist/TextButton/TextButton.js +59 -39
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +69 -49
- package/dist/Textarea/Textarea.cjs +3 -3
- package/dist/Textarea/Textarea.js +63 -43
- package/dist/Textarea/TextareaInput.cjs +4 -4
- package/dist/Textarea/TextareaInput.js +49 -29
- package/dist/TimePicker/TimePicker.cjs +3 -3
- package/dist/TimePicker/TimePicker.js +93 -60
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +8 -8
- package/dist/ToggleCheckbox/ToggleCheckbox.js +75 -53
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +98 -66
- package/dist/Tooltip/Tooltip.cjs +2 -2
- package/dist/Tooltip/Tooltip.js +57 -38
- package/dist/Tooltip/hooks/useTooltipLayout.cjs +1 -1
- package/dist/Tooltip/hooks/useTooltipLayout.js +9 -9
- package/dist/Typography/TypographyProps.cjs +1 -1
- package/dist/Typography/TypographyProps.js +22 -13
- package/dist/helpers/getDefaultLocale.cjs +1 -1
- package/dist/helpers/getDefaultLocale.js +1 -1
- package/dist/helpers/handleResponsiveValues.cjs +5 -5
- package/dist/helpers/handleResponsiveValues.js +14 -14
- package/dist/helpers/useIntersection.cjs +1 -1
- package/dist/helpers/useIntersection.js +13 -11
- package/dist/helpers/useResizeObserver.cjs +1 -1
- package/dist/helpers/useResizeObserver.js +10 -8
- package/dist/hooks/useControllableState.cjs +1 -0
- package/dist/hooks/useControllableState.js +25 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +285 -284
- package/dist/themes/ColorButton.cjs +2 -2
- package/dist/themes/ColorButton.js +4 -4
- package/dist/themes/darkTheme/index.cjs +1 -1
- package/dist/themes/darkTheme/index.js +18 -8
- package/dist/themes/extendTheme.cjs +5 -5
- package/dist/themes/extendTheme.js +30 -19
- package/dist/themes/lightTheme/index.cjs +1 -1
- package/dist/themes/lightTheme/index.js +18 -8
- package/dist/themes/sizes.cjs +1 -1
- package/dist/themes/sizes.js +4 -0
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +2 -2
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +43 -23
- package/dist/v2/Breadcrumbs/Crumb.cjs +1 -1
- package/dist/v2/Breadcrumbs/Crumb.js +44 -22
- package/dist/v2/Breadcrumbs/CrumbLink.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbLink.js +35 -14
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +41 -19
- package/dist/v2/Link/Link.cjs +5 -5
- package/dist/v2/Link/Link.js +64 -42
- package/dist/v2/LinkButton/LinkButton.cjs +10 -10
- package/dist/v2/LinkButton/LinkButton.js +77 -53
- package/dist/v2/MainNav/MainNav.cjs +2 -2
- package/dist/v2/MainNav/MainNav.js +39 -17
- package/dist/v2/MainNav/NavBrand.cjs +3 -3
- package/dist/v2/MainNav/NavBrand.js +78 -57
- package/dist/v2/MainNav/NavCondense.cjs +3 -3
- package/dist/v2/MainNav/NavCondense.js +40 -20
- package/dist/v2/MainNav/NavLink.cjs +9 -9
- package/dist/v2/MainNav/NavLink.js +77 -56
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +67 -46
- package/dist/v2/MainNav/NavSections.cjs +1 -1
- package/dist/v2/MainNav/NavSections.js +40 -18
- package/dist/v2/MainNav/NavUser.cjs +2 -2
- package/dist/v2/MainNav/NavUser.js +51 -31
- package/dist/v2/Pagination/components.cjs +7 -7
- package/dist/v2/Pagination/components.js +89 -65
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +7 -7
- package/dist/v2/SimpleMenu/SimpleMenu.js +155 -120
- package/dist/v2/SubNav/SubNav.cjs +3 -3
- package/dist/v2/SubNav/SubNav.js +37 -15
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +44 -43
- package/dist/v2/SubNav/SubNavLink.cjs +6 -6
- package/dist/v2/SubNav/SubNavLink.js +64 -43
- package/dist/v2/SubNav/SubNavLinkSection.cjs +4 -4
- package/dist/v2/SubNav/SubNavLinkSection.js +8 -8
- package/dist/v2/SubNav/SubNavSection.cjs +2 -2
- package/dist/v2/SubNav/SubNavSection.js +1 -1
- package/dist/v2/SubNav/SubNavSectionLabel.cjs +1 -1
- package/dist/v2/SubNav/SubNavSectionLabel.js +1 -1
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +39 -17
- package/package.json +8 -15
|
@@ -1,63 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var n = Object.getOwnPropertySymbols;
|
|
3
|
+
var b = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var u = (e, t, r) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, x = (e, t) => {
|
|
5
|
+
for (var r in t || (t = {}))
|
|
6
|
+
b.call(t, r) && u(e, r, t[r]);
|
|
7
|
+
if (n)
|
|
8
|
+
for (var r of n(t))
|
|
9
|
+
E.call(t, r) && u(e, r, t[r]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
var y = (e, t) => {
|
|
13
|
+
var r = {};
|
|
14
|
+
for (var i in e)
|
|
15
|
+
b.call(e, i) && t.indexOf(i) < 0 && (r[i] = e[i]);
|
|
16
|
+
if (e != null && n)
|
|
17
|
+
for (var i of n(e))
|
|
18
|
+
t.indexOf(i) < 0 && E.call(e, i) && (r[i] = e[i]);
|
|
19
|
+
return r;
|
|
20
|
+
};
|
|
21
|
+
import l from "react";
|
|
22
|
+
import T from "styled-components";
|
|
23
|
+
import o from "prop-types";
|
|
24
|
+
import { sizes as I } from "../themes/sizes.js";
|
|
25
|
+
import { useId as O } from "../helpers/useId.js";
|
|
26
|
+
import { Field as z } from "../Field/Field.js";
|
|
27
|
+
import { FieldLabel as q } from "../Field/FieldLabel.js";
|
|
8
28
|
import "../Field/FieldInput.js";
|
|
9
|
-
import { FieldHint as
|
|
10
|
-
import { FieldError as
|
|
29
|
+
import { FieldHint as A } from "../Field/FieldHint.js";
|
|
30
|
+
import { FieldError as B } from "../Field/FieldError.js";
|
|
11
31
|
import "../Field/FieldContext.js";
|
|
12
32
|
import "../Field/FieldAction.js";
|
|
13
|
-
import { Stack as
|
|
14
|
-
import { Flex as
|
|
15
|
-
import { TextButton as
|
|
16
|
-
import { ToggleCheckbox as
|
|
17
|
-
const
|
|
33
|
+
import { Stack as L } from "../Stack/Stack.js";
|
|
34
|
+
import { Flex as P } from "../Flex/Flex.js";
|
|
35
|
+
import { TextButton as _ } from "../TextButton/TextButton.js";
|
|
36
|
+
import { ToggleCheckbox as j } from "../ToggleCheckbox/ToggleCheckbox.js";
|
|
37
|
+
const w = T(z)`
|
|
18
38
|
max-width: 320px;
|
|
19
|
-
`,
|
|
39
|
+
`, H = T(_)`
|
|
20
40
|
align-self: flex-end;
|
|
21
41
|
margin-left: auto;
|
|
22
|
-
`,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
hint
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
`, m = (M) => {
|
|
43
|
+
var f = M, {
|
|
44
|
+
disabled: e,
|
|
45
|
+
size: t,
|
|
46
|
+
error: r,
|
|
47
|
+
hint: i,
|
|
48
|
+
label: a,
|
|
49
|
+
name: p,
|
|
50
|
+
labelAction: v,
|
|
51
|
+
required: F,
|
|
52
|
+
id: h,
|
|
53
|
+
onClear: d,
|
|
54
|
+
clearLabel: s,
|
|
55
|
+
checked: c
|
|
56
|
+
} = f, k = y(f, [
|
|
57
|
+
"disabled",
|
|
58
|
+
"size",
|
|
59
|
+
"error",
|
|
60
|
+
"hint",
|
|
61
|
+
"label",
|
|
62
|
+
"name",
|
|
63
|
+
"labelAction",
|
|
64
|
+
"required",
|
|
65
|
+
"id",
|
|
66
|
+
"onClear",
|
|
67
|
+
"clearLabel",
|
|
68
|
+
"checked"
|
|
69
|
+
]);
|
|
70
|
+
const g = O("toggleinput", h);
|
|
71
|
+
return /* @__PURE__ */ l.createElement(w, {
|
|
72
|
+
name: p,
|
|
73
|
+
hint: i,
|
|
74
|
+
error: r,
|
|
75
|
+
id: g
|
|
76
|
+
}, /* @__PURE__ */ l.createElement(L, {
|
|
44
77
|
spacing: 1
|
|
45
|
-
}, /* @__PURE__ */
|
|
46
|
-
required:
|
|
47
|
-
action:
|
|
48
|
-
},
|
|
49
|
-
onClick:
|
|
50
|
-
},
|
|
51
|
-
id:
|
|
52
|
-
size:
|
|
53
|
-
name:
|
|
54
|
-
checked:
|
|
55
|
-
disabled:
|
|
56
|
-
|
|
57
|
-
}, i), /* @__PURE__ */ r.createElement(F, null), /* @__PURE__ */ r.createElement(h, null)));
|
|
78
|
+
}, /* @__PURE__ */ l.createElement(P, null, /* @__PURE__ */ l.createElement(q, {
|
|
79
|
+
required: F,
|
|
80
|
+
action: v
|
|
81
|
+
}, a), s && d && c !== null && !e && /* @__PURE__ */ l.createElement(H, {
|
|
82
|
+
onClick: d
|
|
83
|
+
}, s)), /* @__PURE__ */ l.createElement(j, x({
|
|
84
|
+
id: g,
|
|
85
|
+
size: t,
|
|
86
|
+
name: p,
|
|
87
|
+
checked: c,
|
|
88
|
+
disabled: e
|
|
89
|
+
}, k), a), /* @__PURE__ */ l.createElement(A, null), /* @__PURE__ */ l.createElement(B, null)));
|
|
58
90
|
};
|
|
59
|
-
|
|
60
|
-
|
|
91
|
+
m.displayName = "ToggleInput";
|
|
92
|
+
m.defaultProps = {
|
|
61
93
|
checked: !1,
|
|
62
94
|
clearLabel: void 0,
|
|
63
95
|
disabled: !1,
|
|
@@ -71,20 +103,20 @@ o.defaultProps = {
|
|
|
71
103
|
required: !1,
|
|
72
104
|
size: "M"
|
|
73
105
|
};
|
|
74
|
-
|
|
75
|
-
checked:
|
|
76
|
-
clearLabel:
|
|
77
|
-
disabled:
|
|
78
|
-
error:
|
|
79
|
-
hint:
|
|
80
|
-
id:
|
|
81
|
-
label:
|
|
82
|
-
labelAction:
|
|
83
|
-
name:
|
|
84
|
-
onClear:
|
|
85
|
-
required:
|
|
86
|
-
size:
|
|
106
|
+
m.propTypes = {
|
|
107
|
+
checked: o.bool,
|
|
108
|
+
clearLabel: o.string,
|
|
109
|
+
disabled: o.bool,
|
|
110
|
+
error: o.string,
|
|
111
|
+
hint: o.oneOfType([o.string, o.node, o.arrayOf(o.node)]),
|
|
112
|
+
id: o.string,
|
|
113
|
+
label: o.string,
|
|
114
|
+
labelAction: o.node,
|
|
115
|
+
name: o.string,
|
|
116
|
+
onClear: o.func,
|
|
117
|
+
required: o.bool,
|
|
118
|
+
size: o.oneOf(Object.keys(I.input))
|
|
87
119
|
};
|
|
88
120
|
export {
|
|
89
|
-
|
|
121
|
+
m as ToggleInput
|
|
90
122
|
};
|
package/dist/Tooltip/Tooltip.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";var E=Object.defineProperty;var r=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var g=(e,o,t)=>o in e?E(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,n=(e,o)=>{for(var t in o||(o={}))T.call(o,t)&&g(e,t,o[t]);if(r)for(var t of r(o))b.call(o,t)&&g(e,t,o[t]);return e};var u=(e,o)=>{var t={};for(var l in e)T.call(e,l)&&o.indexOf(l)<0&&(t[l]=e[l]);if(e!=null&&r)for(var l of r(e))o.indexOf(l)<0&&b.call(e,l)&&(t[l]=e[l]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("react"),R=require("prop-types"),B=require("styled-components"),L=require("../Box/Box.cjs"),V=require("../Typography/Typography.cjs"),k=require("../Portal/Portal.cjs"),M=require("./hooks/useTooltipHandlers.cjs"),S=require("./hooks/useTooltipLayout.cjs"),h=require("../helpers/useId.cjs"),W=require("../VisuallyHidden/VisuallyHidden.cjs"),p=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},s=p(I),i=p(R),z=p(B),C=z.default(L.Box)`
|
|
2
2
|
position: absolute;
|
|
3
3
|
/* z-index exist because of its position inside Modals */
|
|
4
4
|
z-index: 4;
|
|
5
5
|
display: ${({visible:e})=>e?"revert":"none"};
|
|
6
|
-
`,
|
|
6
|
+
`,c=O=>{var f=O,{children:e,label:o,description:t,delay:l,position:m,id:q}=f,v=u(f,["children","label","description","delay","position","id"]);const a=h.useId("tooltip",q),j=h.useId("description"),y=M.useTooltipHandlers(l),{visible:d}=y,x=u(y,["visible"]),{tooltipWrapperRef:_,toggleSourceRef:H}=S.useTooltipLayout(d,m),P=s.default.cloneElement(e,n({tabIndex:0,"aria-labelledby":o?a:void 0,"aria-describedby":t?a:void 0},x));return s.default.createElement(s.default.Fragment,null,s.default.createElement(k.Portal,null,s.default.createElement(C,n({id:a,background:"neutral900",hasRadius:!0,padding:2,role:"tooltip",ref:_,visible:d},v),d&&s.default.createElement(W.VisuallyHidden,{id:j},t),s.default.createElement(V.Typography,{as:"p",variant:"pi",fontWeight:"bold",textColor:"neutral0"},o||t))),s.default.createElement("span",{ref:H},P))};c.defaultProps={delay:500,id:void 0,position:"top",label:void 0,description:void 0};c.propTypes={children:i.default.node.isRequired,delay:i.default.number,description:i.default.string,id:i.default.string,label:i.default.string,position:i.default.oneOf(["top","left","bottom","right"])};exports.Tooltip=c;
|
package/dist/Tooltip/Tooltip.js
CHANGED
|
@@ -1,60 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var n = Object.getOwnPropertySymbols;
|
|
3
|
+
var u = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var f = (o, t, e) => t in o ? P(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, d = (o, t) => {
|
|
5
|
+
for (var e in t || (t = {}))
|
|
6
|
+
u.call(t, e) && f(o, e, t[e]);
|
|
7
|
+
if (n)
|
|
8
|
+
for (var e of n(t))
|
|
9
|
+
b.call(t, e) && f(o, e, t[e]);
|
|
10
|
+
return o;
|
|
11
|
+
};
|
|
12
|
+
var s = (o, t) => {
|
|
13
|
+
var e = {};
|
|
14
|
+
for (var i in o)
|
|
15
|
+
u.call(o, i) && t.indexOf(i) < 0 && (e[i] = o[i]);
|
|
16
|
+
if (o != null && n)
|
|
17
|
+
for (var i of n(o))
|
|
18
|
+
t.indexOf(i) < 0 && b.call(o, i) && (e[i] = o[i]);
|
|
19
|
+
return e;
|
|
20
|
+
};
|
|
21
|
+
import r from "react";
|
|
22
|
+
import l from "prop-types";
|
|
23
|
+
import W from "styled-components";
|
|
24
|
+
import { Box as z } from "../Box/Box.js";
|
|
25
|
+
import { Typography as C } from "../Typography/Typography.js";
|
|
26
|
+
import { Portal as _ } from "../Portal/Portal.js";
|
|
27
|
+
import { useTooltipHandlers as k } from "./hooks/useTooltipHandlers.js";
|
|
28
|
+
import { useTooltipLayout as q } from "./hooks/useTooltipLayout.js";
|
|
29
|
+
import { useId as y } from "../helpers/useId.js";
|
|
30
|
+
import { VisuallyHidden as B } from "../VisuallyHidden/VisuallyHidden.js";
|
|
31
|
+
const F = W(z)`
|
|
12
32
|
position: absolute;
|
|
13
33
|
/* z-index exist because of its position inside Modals */
|
|
14
34
|
z-index: 4;
|
|
15
|
-
display: ${({ visible:
|
|
16
|
-
`,
|
|
17
|
-
|
|
35
|
+
display: ${({ visible: o }) => o ? "revert" : "none"};
|
|
36
|
+
`, g = (L) => {
|
|
37
|
+
var m = L, { children: o, label: t, description: e, delay: i, position: v, id: x } = m, E = s(m, ["children", "label", "description", "delay", "position", "id"]);
|
|
38
|
+
const p = y("tooltip", x), T = y("description"), c = k(i), { visible: a } = c, h = s(c, ["visible"]), { tooltipWrapperRef: R, toggleSourceRef: I } = q(a, v), H = r.cloneElement(o, d({
|
|
18
39
|
tabIndex: 0,
|
|
19
|
-
"aria-labelledby":
|
|
20
|
-
"aria-describedby":
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
id: r,
|
|
40
|
+
"aria-labelledby": t ? p : void 0,
|
|
41
|
+
"aria-describedby": e ? p : void 0
|
|
42
|
+
}, h));
|
|
43
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(_, null, /* @__PURE__ */ r.createElement(F, d({
|
|
44
|
+
id: p,
|
|
25
45
|
background: "neutral900",
|
|
26
46
|
hasRadius: !0,
|
|
27
47
|
padding: 2,
|
|
28
48
|
role: "tooltip",
|
|
29
|
-
ref:
|
|
30
|
-
visible:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, i), /* @__PURE__ */ o.createElement(E, {
|
|
49
|
+
ref: R,
|
|
50
|
+
visible: a
|
|
51
|
+
}, E), a && /* @__PURE__ */ r.createElement(B, {
|
|
52
|
+
id: T
|
|
53
|
+
}, e), /* @__PURE__ */ r.createElement(C, {
|
|
35
54
|
as: "p",
|
|
36
55
|
variant: "pi",
|
|
37
56
|
fontWeight: "bold",
|
|
38
57
|
textColor: "neutral0"
|
|
39
|
-
},
|
|
40
|
-
ref:
|
|
41
|
-
},
|
|
58
|
+
}, t || e))), /* @__PURE__ */ r.createElement("span", {
|
|
59
|
+
ref: I
|
|
60
|
+
}, H));
|
|
42
61
|
};
|
|
43
|
-
|
|
62
|
+
g.defaultProps = {
|
|
44
63
|
delay: 500,
|
|
45
64
|
id: void 0,
|
|
46
65
|
position: "top",
|
|
47
66
|
label: void 0,
|
|
48
67
|
description: void 0
|
|
49
68
|
};
|
|
50
|
-
|
|
51
|
-
children:
|
|
52
|
-
delay:
|
|
53
|
-
description:
|
|
54
|
-
id:
|
|
55
|
-
label:
|
|
56
|
-
position:
|
|
69
|
+
g.propTypes = {
|
|
70
|
+
children: l.node.isRequired,
|
|
71
|
+
delay: l.number,
|
|
72
|
+
description: l.string,
|
|
73
|
+
id: l.string,
|
|
74
|
+
label: l.string,
|
|
75
|
+
position: l.oneOf(["top", "left", "bottom", "right"])
|
|
57
76
|
};
|
|
58
77
|
export {
|
|
59
|
-
|
|
78
|
+
g as Tooltip
|
|
60
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),c=require("../utils/positionTooltip.cjs"),n=(e,u)=>{const l=o.useRef(null),s=o.useRef(null);return o.useLayoutEffect(()=>{if(e){const t=l.current,r=s.current,i=c.positionTooltip(t,r,u);t.style.left=`${i.left}px`,t.style.top=`${i.top}px`}},[u,e]),{tooltipWrapperRef:l,toggleSourceRef:s}};exports.useTooltipLayout=n;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { positionTooltip as
|
|
3
|
-
const g = (
|
|
4
|
-
const
|
|
5
|
-
return
|
|
6
|
-
if (
|
|
7
|
-
const
|
|
8
|
-
|
|
1
|
+
import { useRef as n, useLayoutEffect as c } from "react";
|
|
2
|
+
import { positionTooltip as s } from "../utils/positionTooltip.js";
|
|
3
|
+
const g = (o, e) => {
|
|
4
|
+
const r = n(null), l = n(null);
|
|
5
|
+
return c(() => {
|
|
6
|
+
if (o) {
|
|
7
|
+
const t = r.current, u = l.current, p = s(t, u, e);
|
|
8
|
+
t.style.left = `${p.left}px`, t.style.top = `${p.top}px`;
|
|
9
9
|
}
|
|
10
|
-
}, [
|
|
10
|
+
}, [e, o]), { tooltipWrapperRef: r, toggleSourceRef: l };
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
13
|
g as useTooltipLayout
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";var d=Object.defineProperty;var s=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var n=(t,o,r)=>o in t?d(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r,l=(t,o)=>{for(var r in o||(o={}))y.call(o,r)&&n(t,r,o[r]);if(s)for(var r of s(o))g.call(o,r)&&n(t,r,o[r]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),T=require("prop-types"),i=require("./constants.cjs"),p=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},v=p(c),e=p(T),a=t=>v.default.createElement("div",l({},t)),f={ellipsis:!1,fontWeight:void 0,fontSize:void 0,lineHeight:void 0,textColor:void 0,textAlign:void 0,textTransform:void 0,variant:i.OMEGA},u={ellipsis:e.default.bool,fontSize:e.default.oneOfType([e.default.number,e.default.string]),fontWeight:e.default.string,lineHeight:e.default.oneOfType([e.default.number,e.default.string]),textAlign:e.default.string,textColor:e.default.string,textTransform:e.default.string,variant:e.default.oneOf(i.TEXT_VARIANTS)};a.defaultProps=f;a.propTypes=u;exports.TypographyProps=a;exports.typographyDefaultProps=f;exports.typographyPropTypes=u;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var i = Object.getOwnPropertySymbols;
|
|
3
|
+
var l = Object.prototype.hasOwnProperty, a = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var n = (r, o, e) => o in r ? f(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e, p = (r, o) => {
|
|
5
|
+
for (var e in o || (o = {}))
|
|
6
|
+
l.call(o, e) && n(r, e, o[e]);
|
|
7
|
+
if (i)
|
|
8
|
+
for (var e of i(o))
|
|
9
|
+
a.call(o, e) && n(r, e, o[e]);
|
|
10
|
+
return r;
|
|
11
|
+
};
|
|
12
|
+
import g from "react";
|
|
2
13
|
import t from "prop-types";
|
|
3
|
-
import { TEXT_VARIANTS as
|
|
4
|
-
const
|
|
5
|
-
...e
|
|
6
|
-
}), p = {
|
|
14
|
+
import { TEXT_VARIANTS as m, OMEGA as y } from "./constants.js";
|
|
15
|
+
const s = (r) => /* @__PURE__ */ g.createElement("div", p({}, r)), T = {
|
|
7
16
|
ellipsis: !1,
|
|
8
17
|
fontWeight: void 0,
|
|
9
18
|
fontSize: void 0,
|
|
@@ -11,8 +20,8 @@ const o = (e) => /* @__PURE__ */ r.createElement("div", {
|
|
|
11
20
|
textColor: void 0,
|
|
12
21
|
textAlign: void 0,
|
|
13
22
|
textTransform: void 0,
|
|
14
|
-
variant:
|
|
15
|
-
},
|
|
23
|
+
variant: y
|
|
24
|
+
}, d = {
|
|
16
25
|
ellipsis: t.bool,
|
|
17
26
|
fontSize: t.oneOfType([t.number, t.string]),
|
|
18
27
|
fontWeight: t.string,
|
|
@@ -20,12 +29,12 @@ const o = (e) => /* @__PURE__ */ r.createElement("div", {
|
|
|
20
29
|
textAlign: t.string,
|
|
21
30
|
textColor: t.string,
|
|
22
31
|
textTransform: t.string,
|
|
23
|
-
variant: t.oneOf(
|
|
32
|
+
variant: t.oneOf(m)
|
|
24
33
|
};
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
s.defaultProps = T;
|
|
35
|
+
s.propTypes = d;
|
|
27
36
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
s as TypographyProps,
|
|
38
|
+
T as typographyDefaultProps,
|
|
39
|
+
d as typographyPropTypes
|
|
31
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="en-EN",a=()=>typeof navigator
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="en-EN",a=()=>typeof navigator=="undefined"?e:navigator.language?navigator.language:navigator.userLanguage?navigator.userLanguage:e;exports.getDefaultLocale=a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const a = "en-EN", e = () => typeof navigator
|
|
1
|
+
const a = "en-EN", e = () => typeof navigator == "undefined" ? a : navigator.language ? navigator.language : navigator.userLanguage ? navigator.userLanguage : a;
|
|
2
2
|
export {
|
|
3
3
|
e as getDefaultLocale
|
|
4
4
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";const
|
|
2
|
-
${
|
|
3
|
-
}`),
|
|
4
|
-
${
|
|
5
|
-
}`),
|
|
1
|
+
"use strict";const e=(o,s,i)=>{let r=s;if(!Array.isArray(s)&&typeof s=="object"&&(r=[s==null?void 0:s.desktop,s==null?void 0:s.tablet,s==null?void 0:s.mobile]),r===void 0)return;if(Array.isArray(r)){const[n,c,d]=r;let t=`${o}: ${i.spaces[n]};`;return c!==void 0&&(t+=`${i.mediaQueries.tablet}{
|
|
2
|
+
${o}: ${i.spaces[c]};
|
|
3
|
+
}`),d!==void 0&&(t+=`${i.mediaQueries.mobile}{
|
|
4
|
+
${o}: ${i.spaces[d]};
|
|
5
|
+
}`),t}const $=i.spaces[r]||r;return`${o}: ${$};`};module.exports=e;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
if (!Array.isArray(s) && typeof s == "object" && (
|
|
1
|
+
const a = (o, s, i) => {
|
|
2
|
+
let r = s;
|
|
3
|
+
if (!Array.isArray(s) && typeof s == "object" && (r = [s == null ? void 0 : s.desktop, s == null ? void 0 : s.tablet, s == null ? void 0 : s.mobile]), r === void 0)
|
|
4
4
|
return;
|
|
5
|
-
if (Array.isArray(
|
|
6
|
-
const [
|
|
7
|
-
let
|
|
8
|
-
return
|
|
9
|
-
${
|
|
10
|
-
}`),
|
|
11
|
-
${
|
|
12
|
-
}`),
|
|
5
|
+
if (Array.isArray(r)) {
|
|
6
|
+
const [n, d, $] = r;
|
|
7
|
+
let t = `${o}: ${i.spaces[n]};`;
|
|
8
|
+
return d !== void 0 && (t += `${i.mediaQueries.tablet}{
|
|
9
|
+
${o}: ${i.spaces[d]};
|
|
10
|
+
}`), $ !== void 0 && (t += `${i.mediaQueries.mobile}{
|
|
11
|
+
${o}: ${i.spaces[$]};
|
|
12
|
+
}`), t;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
return `${
|
|
14
|
+
const c = i.spaces[r] || r;
|
|
15
|
+
return `${o}: ${c};`;
|
|
16
16
|
};
|
|
17
17
|
export {
|
|
18
|
-
|
|
18
|
+
a as default
|
|
19
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("react"),d=require("@radix-ui/react-use-callback-ref"),v=(e,s,{selectorToWatch:t,skipWhen:r=!1})=>{const n=d.useCallbackRef(s);g.useEffect(()=>{if(r)return;const i={root:e.current,rootMargin:"0px"},u=f=>{f.forEach(o=>{o.isIntersecting&&e.current.scrollHeight>e.current.clientHeight&&n(o)})},c=new IntersectionObserver(u,i),a=e.current.querySelector(t);return c.observe(a),()=>{c.disconnect()}},[r,n,t,e])};exports.useIntersection=v;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { useEffect as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useEffect as m } from "react";
|
|
2
|
+
import { useCallbackRef as p } from "@radix-ui/react-use-callback-ref";
|
|
3
|
+
const E = (t, i, { selectorToWatch: n, skipWhen: r = !1 }) => {
|
|
4
|
+
const e = p(i);
|
|
5
|
+
m(() => {
|
|
6
|
+
if (r)
|
|
5
7
|
return;
|
|
6
8
|
const s = {
|
|
7
9
|
root: t.current,
|
|
8
10
|
rootMargin: "0px"
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
}, u = (g) => {
|
|
12
|
+
g.forEach((c) => {
|
|
13
|
+
c.isIntersecting && t.current.scrollHeight > t.current.clientHeight && e(c);
|
|
12
14
|
});
|
|
13
|
-
}, o = new IntersectionObserver(
|
|
14
|
-
return o.observe(
|
|
15
|
+
}, o = new IntersectionObserver(u, s), f = t.current.querySelector(n);
|
|
16
|
+
return o.observe(f), () => {
|
|
15
17
|
o.disconnect();
|
|
16
18
|
};
|
|
17
|
-
}, [e, n,
|
|
19
|
+
}, [r, e, n, t]);
|
|
18
20
|
};
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
E as useIntersection
|
|
21
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react"),n=(e,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),i=require("@radix-ui/react-use-callback-ref"),n=(e,a)=>{const t=i.useCallbackRef(a);c.useLayoutEffect(()=>{const r=new ResizeObserver(t);return Array.isArray(e)?e.forEach(s=>{s.current&&r.observe(s.current)}):e.current&&r.observe(e.current),()=>{r.disconnect()}},[e,t])};exports.useResizeObserver=n;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { useLayoutEffect as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { useLayoutEffect as f } from "react";
|
|
2
|
+
import { useCallbackRef as s } from "@radix-ui/react-use-callback-ref";
|
|
3
|
+
const c = (e, i) => {
|
|
4
|
+
const t = s(i);
|
|
5
|
+
f(() => {
|
|
6
|
+
const r = new ResizeObserver(t);
|
|
7
|
+
return Array.isArray(e) ? e.forEach((n) => {
|
|
8
|
+
n.current && r.observe(n.current);
|
|
7
9
|
}) : e.current && r.observe(e.current), () => {
|
|
8
10
|
r.disconnect();
|
|
9
11
|
};
|
|
10
|
-
}, []);
|
|
12
|
+
}, [e, t]);
|
|
11
13
|
};
|
|
12
14
|
export {
|
|
13
|
-
|
|
15
|
+
c as useResizeObserver
|
|
14
16
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("react"),i=require("@radix-ui/react-use-callback-ref");function g(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const u=g(S);function p({prop:e,defaultProp:o,onChange:n=()=>{}}){const[t,c]=v({defaultProp:o,onChange:n}),r=e!==void 0,s=typeof e=="function"?e(t):e,d=r?s:t,a=i.useCallbackRef(n),b=u.useCallback(l=>{if(r){const f=typeof l=="function"?l(s):l;f!==s&&(a(f),c(l))}else c(l)},[r,s,c,a]);return[d,b]}function v({defaultProp:e,onChange:o}){const n=u.useState(e),[t]=n,c=u.useRef(t),r=i.useCallbackRef(o);return u.useEffect(()=>{c.current!==t&&(r(t),c.current=t)},[t,c,r]),n}exports.useControllableState=p;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import { useCallbackRef as i } from "@radix-ui/react-use-callback-ref";
|
|
3
|
+
function R({ prop: o, defaultProp: u, onChange: c = () => {
|
|
4
|
+
} }) {
|
|
5
|
+
const [t, e] = C({ defaultProp: u, onChange: c }), n = o !== void 0, l = typeof o == "function" ? o(t) : o, d = n ? l : t, a = i(c), v = r.useCallback(
|
|
6
|
+
(s) => {
|
|
7
|
+
if (n) {
|
|
8
|
+
const f = typeof s == "function" ? s(l) : s;
|
|
9
|
+
f !== l && (a(f), e(s));
|
|
10
|
+
} else
|
|
11
|
+
e(s);
|
|
12
|
+
},
|
|
13
|
+
[n, l, e, a]
|
|
14
|
+
);
|
|
15
|
+
return [d, v];
|
|
16
|
+
}
|
|
17
|
+
function C({ defaultProp: o, onChange: u }) {
|
|
18
|
+
const c = r.useState(o), [t] = c, e = r.useRef(t), n = i(u);
|
|
19
|
+
return r.useEffect(() => {
|
|
20
|
+
e.current !== t && (n(t), e.current = t);
|
|
21
|
+
}, [t, e, n]), c;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
R as useControllableState
|
|
25
|
+
};
|