@redis-ui/components 42.7.0 → 43.0.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/dist/AutoCompleteSelect/AutoCompleteSelect.cjs +7 -1
- package/dist/AutoCompleteSelect/AutoCompleteSelect.js +7 -1
- package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.cjs +7 -1
- package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.d.ts +8 -1
- package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.js +7 -1
- package/dist/BoxSelectionGroup/components/Item/components/BoxStateIndicator/BoxStateIndicator.cjs +8 -4
- package/dist/BoxSelectionGroup/components/Item/components/BoxStateIndicator/BoxStateIndicator.js +8 -4
- package/dist/BoxSelectionGroup/components/Item/components/Compose/Compose.style.cjs +18 -4
- package/dist/BoxSelectionGroup/components/Item/components/Compose/Compose.style.js +18 -4
- package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.cjs +3 -1
- package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.js +3 -1
- package/dist/Breadcrumbs/Breadcrumbs.cjs +51 -0
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +10 -0
- package/dist/Breadcrumbs/Breadcrumbs.js +51 -0
- package/dist/Breadcrumbs/Breadcrumbs.types.d.ts +17 -0
- package/dist/Breadcrumbs/components/Compose/Compose.cjs +14 -0
- package/dist/Breadcrumbs/components/Compose/Compose.d.ts +3 -0
- package/dist/Breadcrumbs/components/Compose/Compose.js +14 -0
- package/dist/Breadcrumbs/components/Compose/Compose.style.cjs +10 -0
- package/dist/Breadcrumbs/components/Compose/Compose.style.d.ts +1 -0
- package/dist/Breadcrumbs/components/Compose/Compose.style.js +8 -0
- package/dist/Breadcrumbs/components/Compose/Compose.types.d.ts +5 -0
- package/dist/Breadcrumbs/components/Current/Current.cjs +13 -0
- package/dist/Breadcrumbs/components/Current/Current.d.ts +3 -0
- package/dist/Breadcrumbs/components/Current/Current.js +13 -0
- package/dist/Breadcrumbs/components/Current/Current.style.cjs +11 -0
- package/dist/Breadcrumbs/components/Current/Current.style.d.ts +1 -0
- package/dist/Breadcrumbs/components/Current/Current.style.js +9 -0
- package/dist/Breadcrumbs/components/Current/Current.types.d.ts +4 -0
- package/dist/Breadcrumbs/components/Item/Item.cjs +12 -0
- package/dist/Breadcrumbs/components/Item/Item.d.ts +3 -0
- package/dist/Breadcrumbs/components/Item/Item.js +12 -0
- package/dist/Breadcrumbs/components/Item/Item.style.cjs +11 -0
- package/dist/Breadcrumbs/components/Item/Item.style.d.ts +1 -0
- package/dist/Breadcrumbs/components/Item/Item.style.js +9 -0
- package/dist/Breadcrumbs/components/Item/Item.types.d.ts +2 -0
- package/dist/Breadcrumbs/components/Link/Link.cjs +52 -0
- package/dist/Breadcrumbs/components/Link/Link.d.ts +3 -0
- package/dist/Breadcrumbs/components/Link/Link.js +52 -0
- package/dist/Breadcrumbs/components/Link/Link.style.cjs +13 -0
- package/dist/Breadcrumbs/components/Link/Link.style.d.ts +1 -0
- package/dist/Breadcrumbs/components/Link/Link.style.js +11 -0
- package/dist/Breadcrumbs/components/Link/Link.types.d.ts +5 -0
- package/dist/Breadcrumbs/components/List/List.cjs +12 -0
- package/dist/Breadcrumbs/components/List/List.d.ts +3 -0
- package/dist/Breadcrumbs/components/List/List.js +12 -0
- package/dist/Breadcrumbs/components/List/List.style.cjs +11 -0
- package/dist/Breadcrumbs/components/List/List.style.d.ts +1 -0
- package/dist/Breadcrumbs/components/List/List.style.js +9 -0
- package/dist/Breadcrumbs/components/List/List.types.d.ts +2 -0
- package/dist/Breadcrumbs/components/Separator/Separator.cjs +13 -0
- package/dist/Breadcrumbs/components/Separator/Separator.d.ts +3 -0
- package/dist/Breadcrumbs/components/Separator/Separator.js +13 -0
- package/dist/Breadcrumbs/components/Separator/Separator.style.cjs +11 -0
- package/dist/Breadcrumbs/components/Separator/Separator.style.d.ts +1 -0
- package/dist/Breadcrumbs/components/Separator/Separator.style.js +9 -0
- package/dist/Breadcrumbs/components/Separator/Separator.types.d.ts +4 -0
- package/dist/Breadcrumbs/index.d.ts +5 -0
- package/dist/Button/Button.style.cjs +4 -1
- package/dist/Button/Button.style.js +4 -1
- package/dist/Button/Button.style.utils.cjs +16 -1
- package/dist/Button/Button.style.utils.js +16 -1
- package/dist/Button/Button.types.cjs +1 -1
- package/dist/Button/Button.types.d.ts +1 -1
- package/dist/Button/Button.types.js +1 -1
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.cjs +59 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.d.ts +4 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.js +57 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.cjs +40 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.d.ts +8 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.js +38 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.d.ts +5 -0
- package/dist/Button/TextButton/TextButton.style.cjs +4 -1
- package/dist/Button/TextButton/TextButton.style.js +4 -1
- package/dist/Button/TextButton/TextButton.types.cjs +1 -1
- package/dist/Button/TextButton/TextButton.types.d.ts +1 -1
- package/dist/Button/TextButton/TextButton.types.js +1 -1
- package/dist/Button/index.d.ts +2 -0
- package/dist/Checkbox/components/Label/Label.style.cjs +15 -3
- package/dist/Checkbox/components/Label/Label.style.js +15 -3
- package/dist/Chip/components/CloseButton/CloseButton.cjs +3 -1
- package/dist/Chip/components/CloseButton/CloseButton.js +3 -1
- package/dist/Chip/components/Compose/Compose.style.cjs +4 -1
- package/dist/Chip/components/Compose/Compose.style.js +4 -1
- package/dist/Drawer/components/Description/Description.cjs +3 -1
- package/dist/Drawer/components/Description/Description.js +3 -1
- package/dist/Helpers/contexts/Popper/PopperCollisionBoundaryManager.cjs +3 -1
- package/dist/Helpers/contexts/Popper/PopperCollisionBoundaryManager.js +3 -1
- package/dist/Helpers/contexts/PrimitiveContextState.cjs +28 -16
- package/dist/Helpers/contexts/PrimitiveContextState.js +28 -16
- package/dist/Helpers/contexts/SharedId.context.cjs +9 -5
- package/dist/Helpers/contexts/SharedId.context.js +9 -5
- package/dist/Helpers/css.utils.cjs +18 -4
- package/dist/Helpers/css.utils.d.ts +15 -3
- package/dist/Helpers/css.utils.js +18 -4
- package/dist/Helpers/hooks/useScrollable.cjs +3 -1
- package/dist/Helpers/hooks/useScrollable.js +3 -1
- package/dist/Helpers/react.utils.cjs +6 -2
- package/dist/Helpers/react.utils.js +6 -2
- package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.cjs +9 -5
- package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.js +9 -5
- package/dist/Inputs/components/Compose/Compose.style.cjs +29 -6
- package/dist/Inputs/components/Compose/Compose.style.js +29 -6
- package/dist/Inputs/hooks/numericInput/numericInput.utils.cjs +12 -4
- package/dist/Inputs/hooks/numericInput/numericInput.utils.js +12 -4
- package/dist/Inputs/hooks/numericInput/useNumericInput.cjs +15 -3
- package/dist/Inputs/hooks/numericInput/useNumericInput.js +15 -3
- package/dist/Loader/Loader.cjs +1 -0
- package/dist/Loader/Loader.js +1 -0
- package/dist/Menu/components/Content/components/Item/Components/Compose/Compose.style.cjs +19 -4
- package/dist/Menu/components/Content/components/Item/Components/Compose/Compose.style.js +19 -4
- package/dist/Menu/components/Content/components/Label/components/Compose/Compose.style.cjs +4 -1
- package/dist/Menu/components/Content/components/Label/components/Compose/Compose.style.js +4 -1
- package/dist/Modal/components/Content/components/Compose/Compose.cjs +3 -1
- package/dist/Modal/components/Content/components/Compose/Compose.js +3 -1
- package/dist/Modal/components/Content/components/Description/Description.cjs +3 -1
- package/dist/Modal/components/Content/components/Description/Description.js +3 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.cjs +3 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.js +3 -1
- package/dist/MultiSelect/components/Trigger/components/MultiValue/MultiValue.cjs +3 -1
- package/dist/MultiSelect/components/Trigger/components/MultiValue/MultiValue.js +3 -1
- package/dist/Overflow/Overflow.cjs +3 -1
- package/dist/Overflow/Overflow.js +3 -1
- package/dist/Overflow/Overflow.utils.cjs +15 -6
- package/dist/Overflow/Overflow.utils.js +15 -6
- package/dist/Overflow/components/OverflowContainer/OverflowContainer.cjs +3 -1
- package/dist/Overflow/components/OverflowContainer/OverflowContainer.js +3 -1
- package/dist/Pagination/components/PageSizeSelect.cjs +3 -1
- package/dist/Pagination/components/PageSizeSelect.js +3 -1
- package/dist/Popover/components/Content/Content.cjs +3 -1
- package/dist/Popover/components/Content/Content.js +3 -1
- package/dist/Popover/components/Content/components/Footer/Footer.cjs +3 -1
- package/dist/Popover/components/Content/components/Footer/Footer.js +3 -1
- package/dist/RadioGroup/components/Item/components/Label/Label.style.cjs +15 -3
- package/dist/RadioGroup/components/Item/components/Label/Label.style.js +15 -3
- package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.cjs +3 -1
- package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.js +3 -1
- package/dist/Section/components/Header/components/CollapseButton/CollapseButton.cjs +3 -1
- package/dist/Section/components/Header/components/CollapseButton/CollapseButton.js +3 -1
- package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.cjs +16 -4
- package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.js +16 -4
- package/dist/Select/components/Content/components/OptionList/OptionList.cjs +6 -4
- package/dist/Select/components/Content/components/OptionList/OptionList.js +6 -4
- package/dist/Select/components/Content/components/OptionList/Virtual.cjs +9 -5
- package/dist/Select/components/Content/components/OptionList/Virtual.js +9 -5
- package/dist/Select/components/Context/hooks/useSearch.cjs +3 -1
- package/dist/Select/components/Context/hooks/useSearch.js +3 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.style.cjs +33 -7
- package/dist/Select/components/Trigger/components/Compose/Compose.style.js +33 -7
- package/dist/SideBar/components/Item/Item.style.cjs +14 -3
- package/dist/SideBar/components/Item/Item.style.js +14 -3
- package/dist/Skeleton/components/Circle/Circle.cjs +1 -1
- package/dist/Skeleton/components/Circle/Circle.js +1 -1
- package/dist/Skeleton/components/Square/Square.cjs +1 -1
- package/dist/Skeleton/components/Square/Square.js +1 -1
- package/dist/Slider/components/Label/Compose/Compose.cjs +3 -1
- package/dist/Slider/components/Label/Compose/Compose.js +3 -1
- package/dist/Slider/components/Mark/Compose/Compose.cjs +3 -1
- package/dist/Slider/components/Mark/Compose/Compose.js +3 -1
- package/dist/Slider/hooks/useOffset.cjs +3 -1
- package/dist/Slider/hooks/useOffset.js +3 -1
- package/dist/Stepper/components/Step/components/Compose/Compose.cjs +3 -1
- package/dist/Stepper/components/Step/components/Compose/Compose.js +3 -1
- package/dist/Stepper/hooks/useStepperInteractive.cjs +12 -4
- package/dist/Stepper/hooks/useStepperInteractive.js +12 -4
- package/dist/Switch/components/Switcher/Switcher.cjs +3 -1
- package/dist/Switch/components/Switcher/Switcher.js +3 -1
- package/dist/Switch/components/Switcher/Switcher.style.cjs +31 -8
- package/dist/Switch/components/Switcher/Switcher.style.js +31 -8
- package/dist/Tabs/components/TabBar/components/Trigger/components/Marker/Marker.style.cjs +24 -5
- package/dist/Tabs/components/TabBar/components/Trigger/components/Marker/Marker.style.js +24 -5
- package/dist/Tabs/components/TabBar/components/Trigger/components/Tab/Tab.style.cjs +24 -5
- package/dist/Tabs/components/TabBar/components/Trigger/components/Tab/Tab.style.js +24 -5
- package/dist/ThemeModeSwitch/useThemeModeSwitch.cjs +6 -2
- package/dist/ThemeModeSwitch/useThemeModeSwitch.js +6 -2
- package/dist/Toast/core/content.helper.cjs +8 -4
- package/dist/Toast/core/content.helper.js +8 -4
- package/dist/Tooltip/components/Content/Content.cjs +3 -1
- package/dist/Tooltip/components/Content/Content.js +3 -1
- package/dist/TreeView/TreeView.cjs +3 -1
- package/dist/TreeView/TreeView.js +3 -1
- package/dist/TreeView/components/TreeItem/components/Compose/Compose.cjs +6 -4
- package/dist/TreeView/components/TreeItem/components/Compose/Compose.js +6 -4
- package/dist/Typography/Typography.types.cjs +4 -0
- package/dist/Typography/Typography.types.d.ts +2 -1
- package/dist/Typography/Typography.types.js +4 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +110 -104
- package/package.json +10 -9
- package/skills/redis-ui-components/SKILL.md +128 -0
- package/skills/redis-ui-components/references/Button.md +169 -0
- package/skills/redis-ui-components/references/FlexDivider.md +152 -0
- package/skills/redis-ui-components/references/FlexGroup.md +149 -0
- package/skills/redis-ui-components/references/FlexItem.md +58 -0
- package/skills/redis-ui-components/references/FlexSplit.md +37 -0
- package/skills/redis-ui-components/references/Select.md +517 -0
|
@@ -11,8 +11,16 @@ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
|
11
11
|
const _styled__default = /* @__PURE__ */ _interopDefault(_styled);
|
|
12
12
|
const maps = [Button_style_utils.textColorMap];
|
|
13
13
|
const getStateStyles = (tokens) => {
|
|
14
|
-
const getLabelStateSelector = (state, stateTokens, fallbackTokens) => `${css_utils.getRelatedStateSelector(
|
|
15
|
-
|
|
14
|
+
const getLabelStateSelector = (state, stateTokens, fallbackTokens) => `${css_utils.getRelatedStateSelector({
|
|
15
|
+
inputSelector: Indicator_style.CheckboxIndicator,
|
|
16
|
+
inputStateSelector: state,
|
|
17
|
+
commonContainer: Compose_style.CheckboxCompose
|
|
18
|
+
})} {
|
|
19
|
+
${css_utils.styleFromTokens({
|
|
20
|
+
tokenMaps: maps,
|
|
21
|
+
tokens: stateTokens,
|
|
22
|
+
fallbackTokens
|
|
23
|
+
})};
|
|
16
24
|
}`;
|
|
17
25
|
return _styled.css`
|
|
18
26
|
${getLabelStateSelector("", tokens.normal)};
|
|
@@ -20,7 +28,11 @@ const getStateStyles = (tokens) => {
|
|
|
20
28
|
${getLabelStateSelector(":active", tokens.active, tokens.normal)};
|
|
21
29
|
${getLabelStateSelector(":disabled", tokens.disabled)};
|
|
22
30
|
|
|
23
|
-
${css_utils.getRelatedStateSelector(
|
|
31
|
+
${css_utils.getRelatedStateSelector({
|
|
32
|
+
inputSelector: Indicator_style.CheckboxIndicator,
|
|
33
|
+
inputStateSelector: ":disabled",
|
|
34
|
+
commonContainer: Compose_style.CheckboxCompose
|
|
35
|
+
})} {
|
|
24
36
|
pointer-events: none;
|
|
25
37
|
}
|
|
26
38
|
`;
|
|
@@ -7,8 +7,16 @@ import { CheckboxIndicator } from "../Indicator/Indicator.style.js";
|
|
|
7
7
|
import Typography from "../../../Typography/Typography.js";
|
|
8
8
|
const maps = [textColorMap];
|
|
9
9
|
const getStateStyles = (tokens) => {
|
|
10
|
-
const getLabelStateSelector = (state, stateTokens, fallbackTokens) => `${getRelatedStateSelector(
|
|
11
|
-
|
|
10
|
+
const getLabelStateSelector = (state, stateTokens, fallbackTokens) => `${getRelatedStateSelector({
|
|
11
|
+
inputSelector: CheckboxIndicator,
|
|
12
|
+
inputStateSelector: state,
|
|
13
|
+
commonContainer: CheckboxCompose
|
|
14
|
+
})} {
|
|
15
|
+
${styleFromTokens({
|
|
16
|
+
tokenMaps: maps,
|
|
17
|
+
tokens: stateTokens,
|
|
18
|
+
fallbackTokens
|
|
19
|
+
})};
|
|
12
20
|
}`;
|
|
13
21
|
return css`
|
|
14
22
|
${getLabelStateSelector("", tokens.normal)};
|
|
@@ -16,7 +24,11 @@ const getStateStyles = (tokens) => {
|
|
|
16
24
|
${getLabelStateSelector(":active", tokens.active, tokens.normal)};
|
|
17
25
|
${getLabelStateSelector(":disabled", tokens.disabled)};
|
|
18
26
|
|
|
19
|
-
${getRelatedStateSelector(
|
|
27
|
+
${getRelatedStateSelector({
|
|
28
|
+
inputSelector: CheckboxIndicator,
|
|
29
|
+
inputStateSelector: ":disabled",
|
|
30
|
+
commonContainer: CheckboxCompose
|
|
31
|
+
})} {
|
|
20
32
|
pointer-events: none;
|
|
21
33
|
}
|
|
22
34
|
`;
|
|
@@ -14,7 +14,10 @@ const ChipContainer = _styled__default.default.span.withConfig({
|
|
|
14
14
|
$disabled
|
|
15
15
|
}) => {
|
|
16
16
|
const variantStyle = redisUiStyles.useTheme().components.chip.variant[$variant][$disabled ? "disabled" : "normal"];
|
|
17
|
-
return css_utils.styleFromTokens(
|
|
17
|
+
return css_utils.styleFromTokens({
|
|
18
|
+
tokenMaps: [Button_style_utils.bgColorMap, Button_style_utils.textColorMap],
|
|
19
|
+
tokens: variantStyle
|
|
20
|
+
});
|
|
18
21
|
}, ({
|
|
19
22
|
$size
|
|
20
23
|
}) => {
|
|
@@ -10,7 +10,10 @@ const ChipContainer = _styled.span.withConfig({
|
|
|
10
10
|
$disabled
|
|
11
11
|
}) => {
|
|
12
12
|
const variantStyle = useTheme().components.chip.variant[$variant][$disabled ? "disabled" : "normal"];
|
|
13
|
-
return styleFromTokens(
|
|
13
|
+
return styleFromTokens({
|
|
14
|
+
tokenMaps: [bgColorMap, textColorMap],
|
|
15
|
+
tokens: variantStyle
|
|
16
|
+
});
|
|
14
17
|
}, ({
|
|
15
18
|
$size
|
|
16
19
|
}) => {
|
|
@@ -13,7 +13,9 @@ const Description = Object.assign(({
|
|
|
13
13
|
}) => {
|
|
14
14
|
var _a;
|
|
15
15
|
const emptyContent = !((_a = react_utils.childrenToString(children)) == null ? void 0 : _a.trim());
|
|
16
|
-
if (emptyContent)
|
|
16
|
+
if (emptyContent) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
17
19
|
const mainElement = jsxRuntime.jsxRuntimeExports.jsx(index.Description, {
|
|
18
20
|
asChild: true,
|
|
19
21
|
children: jsxRuntime.jsxRuntimeExports.jsx(Description_style.DescriptionContainer, {
|
|
@@ -11,7 +11,9 @@ const Description = Object.assign(({
|
|
|
11
11
|
}) => {
|
|
12
12
|
var _a;
|
|
13
13
|
const emptyContent = !((_a = childrenToString(children)) == null ? void 0 : _a.trim());
|
|
14
|
-
if (emptyContent)
|
|
14
|
+
if (emptyContent) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
15
17
|
const mainElement = jsxRuntimeExports.jsx(Description$1, {
|
|
16
18
|
asChild: true,
|
|
17
19
|
children: jsxRuntimeExports.jsx(DescriptionContainer, {
|
|
@@ -12,7 +12,9 @@ const PopperCollisionBoundaryManager = ({
|
|
|
12
12
|
const [resetBoundary, setResetBoundary] = React.useState(false);
|
|
13
13
|
React.useEffect(() => {
|
|
14
14
|
function doesBoundaryContainTrigger() {
|
|
15
|
-
if (!triggerRef.current)
|
|
15
|
+
if (!triggerRef.current) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
16
18
|
const boundaries = Array.isArray(popperContext.collisionBoundary) ? popperContext.collisionBoundary : [popperContext.collisionBoundary];
|
|
17
19
|
return boundaries.some((boundary) => boundary == null ? void 0 : boundary.contains(triggerRef.current));
|
|
18
20
|
}
|
|
@@ -10,7 +10,9 @@ const PopperCollisionBoundaryManager = ({
|
|
|
10
10
|
const [resetBoundary, setResetBoundary] = useState(false);
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
function doesBoundaryContainTrigger() {
|
|
13
|
-
if (!triggerRef.current)
|
|
13
|
+
if (!triggerRef.current) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
14
16
|
const boundaries = Array.isArray(popperContext.collisionBoundary) ? popperContext.collisionBoundary : [popperContext.collisionBoundary];
|
|
15
17
|
return boundaries.some((boundary) => boundary == null ? void 0 : boundary.contains(triggerRef.current));
|
|
16
18
|
}
|
|
@@ -14,7 +14,9 @@ const createPrimitiveContextState = () => {
|
|
|
14
14
|
setState
|
|
15
15
|
}), [state]);
|
|
16
16
|
React.useLayoutEffect(() => {
|
|
17
|
-
if (value !== void 0)
|
|
17
|
+
if (value !== void 0) {
|
|
18
|
+
setState(value);
|
|
19
|
+
}
|
|
18
20
|
}, [value]);
|
|
19
21
|
return jsxRuntime.jsxRuntimeExports.jsx(Context.Provider, {
|
|
20
22
|
value: context,
|
|
@@ -27,7 +29,9 @@ const createPrimitiveContextState = () => {
|
|
|
27
29
|
setState
|
|
28
30
|
} = React.useContext(Context) ?? {};
|
|
29
31
|
React.useLayoutEffect(() => {
|
|
30
|
-
if (value !== void 0)
|
|
32
|
+
if (value !== void 0) {
|
|
33
|
+
setState == null ? void 0 : setState(value);
|
|
34
|
+
}
|
|
31
35
|
}, [setState, value]);
|
|
32
36
|
return state ?? value;
|
|
33
37
|
};
|
|
@@ -48,7 +52,9 @@ const createPrimitiveContextState = () => {
|
|
|
48
52
|
var _a;
|
|
49
53
|
const [state, setState] = React.useState(value);
|
|
50
54
|
React.useLayoutEffect(() => {
|
|
51
|
-
if (value !== void 0)
|
|
55
|
+
if (value !== void 0) {
|
|
56
|
+
setState(value);
|
|
57
|
+
}
|
|
52
58
|
}, [value]);
|
|
53
59
|
const contextState = (_a = React.useContext(Context)) == null ? void 0 : _a.state;
|
|
54
60
|
const mergedState = contextState !== void 0 && (passOnlyStateDown === contextState || typeof passOnlyStateDown === "function" && passOnlyStateDown(contextState)) ? contextState : state;
|
|
@@ -67,19 +73,25 @@ const createPrimitiveContextState = () => {
|
|
|
67
73
|
children
|
|
68
74
|
}) => {
|
|
69
75
|
const context = React.useContext(Context);
|
|
70
|
-
if (!context)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
76
|
+
if (!context) {
|
|
77
|
+
return jsxRuntime.jsxRuntimeExports.jsx(StateProvider, {
|
|
78
|
+
value,
|
|
79
|
+
children
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (passOnlyStateDown !== void 0) {
|
|
83
|
+
return jsxRuntime.jsxRuntimeExports.jsx(OverridingStateProvider, {
|
|
84
|
+
passOnlyStateDown,
|
|
85
|
+
value,
|
|
86
|
+
children
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (value !== void 0) {
|
|
90
|
+
return jsxRuntime.jsxRuntimeExports.jsx(ValueUpdater, {
|
|
91
|
+
value,
|
|
92
|
+
children
|
|
93
|
+
});
|
|
94
|
+
}
|
|
83
95
|
return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment, {
|
|
84
96
|
children
|
|
85
97
|
});
|
|
@@ -12,7 +12,9 @@ const createPrimitiveContextState = () => {
|
|
|
12
12
|
setState
|
|
13
13
|
}), [state]);
|
|
14
14
|
useLayoutEffect(() => {
|
|
15
|
-
if (value !== void 0)
|
|
15
|
+
if (value !== void 0) {
|
|
16
|
+
setState(value);
|
|
17
|
+
}
|
|
16
18
|
}, [value]);
|
|
17
19
|
return jsxRuntimeExports.jsx(Context.Provider, {
|
|
18
20
|
value: context,
|
|
@@ -25,7 +27,9 @@ const createPrimitiveContextState = () => {
|
|
|
25
27
|
setState
|
|
26
28
|
} = useContext(Context) ?? {};
|
|
27
29
|
useLayoutEffect(() => {
|
|
28
|
-
if (value !== void 0)
|
|
30
|
+
if (value !== void 0) {
|
|
31
|
+
setState == null ? void 0 : setState(value);
|
|
32
|
+
}
|
|
29
33
|
}, [setState, value]);
|
|
30
34
|
return state ?? value;
|
|
31
35
|
};
|
|
@@ -46,7 +50,9 @@ const createPrimitiveContextState = () => {
|
|
|
46
50
|
var _a;
|
|
47
51
|
const [state, setState] = useState(value);
|
|
48
52
|
useLayoutEffect(() => {
|
|
49
|
-
if (value !== void 0)
|
|
53
|
+
if (value !== void 0) {
|
|
54
|
+
setState(value);
|
|
55
|
+
}
|
|
50
56
|
}, [value]);
|
|
51
57
|
const contextState = (_a = useContext(Context)) == null ? void 0 : _a.state;
|
|
52
58
|
const mergedState = contextState !== void 0 && (passOnlyStateDown === contextState || typeof passOnlyStateDown === "function" && passOnlyStateDown(contextState)) ? contextState : state;
|
|
@@ -65,19 +71,25 @@ const createPrimitiveContextState = () => {
|
|
|
65
71
|
children
|
|
66
72
|
}) => {
|
|
67
73
|
const context = useContext(Context);
|
|
68
|
-
if (!context)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
74
|
+
if (!context) {
|
|
75
|
+
return jsxRuntimeExports.jsx(StateProvider, {
|
|
76
|
+
value,
|
|
77
|
+
children
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (passOnlyStateDown !== void 0) {
|
|
81
|
+
return jsxRuntimeExports.jsx(OverridingStateProvider, {
|
|
82
|
+
passOnlyStateDown,
|
|
83
|
+
value,
|
|
84
|
+
children
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (value !== void 0) {
|
|
88
|
+
return jsxRuntimeExports.jsx(ValueUpdater, {
|
|
89
|
+
value,
|
|
90
|
+
children
|
|
91
|
+
});
|
|
92
|
+
}
|
|
81
93
|
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
|
|
82
94
|
children
|
|
83
95
|
});
|
|
@@ -28,7 +28,9 @@ const useSharedId = (customId) => {
|
|
|
28
28
|
setId
|
|
29
29
|
} = React.useContext(Context) || {};
|
|
30
30
|
React.useLayoutEffect(() => {
|
|
31
|
-
if (customId)
|
|
31
|
+
if (customId) {
|
|
32
|
+
setId == null ? void 0 : setId((origId) => origId ?? customId);
|
|
33
|
+
}
|
|
32
34
|
}, [setId, customId]);
|
|
33
35
|
return id || customId;
|
|
34
36
|
};
|
|
@@ -43,10 +45,12 @@ const Updater = ({
|
|
|
43
45
|
};
|
|
44
46
|
const SharedIdTransProvider = (props) => {
|
|
45
47
|
const context = React.useContext(Context);
|
|
46
|
-
if (!context)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (!context) {
|
|
49
|
+
return jsxRuntime.jsxRuntimeExports.jsx(SharedIdProvider, {
|
|
50
|
+
...props,
|
|
51
|
+
noDefaultId: true
|
|
52
|
+
});
|
|
53
|
+
}
|
|
50
54
|
const {
|
|
51
55
|
customId,
|
|
52
56
|
children
|
|
@@ -26,7 +26,9 @@ const useSharedId = (customId) => {
|
|
|
26
26
|
setId
|
|
27
27
|
} = useContext(Context) || {};
|
|
28
28
|
useLayoutEffect(() => {
|
|
29
|
-
if (customId)
|
|
29
|
+
if (customId) {
|
|
30
|
+
setId == null ? void 0 : setId((origId) => origId ?? customId);
|
|
31
|
+
}
|
|
30
32
|
}, [setId, customId]);
|
|
31
33
|
return id || customId;
|
|
32
34
|
};
|
|
@@ -41,10 +43,12 @@ const Updater = ({
|
|
|
41
43
|
};
|
|
42
44
|
const SharedIdTransProvider = (props) => {
|
|
43
45
|
const context = useContext(Context);
|
|
44
|
-
if (!context)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (!context) {
|
|
47
|
+
return jsxRuntimeExports.jsx(SharedIdProvider, {
|
|
48
|
+
...props,
|
|
49
|
+
noDefaultId: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
48
52
|
const {
|
|
49
53
|
customId,
|
|
50
54
|
children
|
|
@@ -5,7 +5,12 @@ const numToUnit = (value = 0, toRem = false) => toRem ? `${pxToRem(value)}rem` :
|
|
|
5
5
|
const calcSize = (size, defaultSize = "", toRem = false) => {
|
|
6
6
|
return typeof size === "number" ? numToUnit(size, toRem) : size || (typeof defaultSize === "number" ? numToUnit(defaultSize, toRem) : defaultSize);
|
|
7
7
|
};
|
|
8
|
-
const styleFromTokens = (
|
|
8
|
+
const styleFromTokens = ({
|
|
9
|
+
tokenMaps: tokenMaps2,
|
|
10
|
+
tokens,
|
|
11
|
+
fallbackTokens,
|
|
12
|
+
customData
|
|
13
|
+
}) => tokenMaps2.map(({
|
|
9
14
|
cssProp,
|
|
10
15
|
token,
|
|
11
16
|
transformValue,
|
|
@@ -110,10 +115,17 @@ const tokenMapMod = (tokenMap, token) => ({
|
|
|
110
115
|
...tokenMap,
|
|
111
116
|
token
|
|
112
117
|
});
|
|
113
|
-
const getRelatedStateSelector = (
|
|
118
|
+
const getRelatedStateSelector = ({
|
|
119
|
+
inputSelector,
|
|
120
|
+
inputStateSelector,
|
|
121
|
+
commonContainer,
|
|
122
|
+
ownSelectorInContainer = ":where(&&)"
|
|
123
|
+
}) => `${commonContainer}:has(:where(${inputSelector})${inputStateSelector}) ${ownSelectorInContainer}`;
|
|
114
124
|
const splitDimensionsX2 = (dimensions) => {
|
|
115
125
|
const split = dimensions == null ? void 0 : dimensions.trim().split(/\s+/g);
|
|
116
|
-
if (!(split == null ? void 0 : split.length) || !split[0])
|
|
126
|
+
if (!(split == null ? void 0 : split.length) || !split[0]) {
|
|
127
|
+
return {};
|
|
128
|
+
}
|
|
117
129
|
if (split.length > 2) {
|
|
118
130
|
console.warn('Error: splitting dimensions "', dimensions, '" contains incorrect number of entries. Expecting 2, received', split.length);
|
|
119
131
|
return {};
|
|
@@ -125,7 +137,9 @@ const splitDimensionsX2 = (dimensions) => {
|
|
|
125
137
|
};
|
|
126
138
|
const splitDimensionsX4 = (dimensions) => {
|
|
127
139
|
const split = dimensions == null ? void 0 : dimensions.trim().split(/\s+/g);
|
|
128
|
-
if (!(split == null ? void 0 : split.length) || !split[0])
|
|
140
|
+
if (!(split == null ? void 0 : split.length) || !split[0]) {
|
|
141
|
+
return {};
|
|
142
|
+
}
|
|
129
143
|
if (split.length > 4) {
|
|
130
144
|
console.warn('Error: splitting dimensions "', dimensions, '" contains incorrect number of entries. Expecting 1-4, received', split.length);
|
|
131
145
|
return {};
|
|
@@ -24,6 +24,12 @@ export type TokenMap<T extends string = string> = {
|
|
|
24
24
|
attendantCss?: string;
|
|
25
25
|
};
|
|
26
26
|
export type ThemeTokens<T extends string> = Partial<Record<T, unknown>>;
|
|
27
|
+
interface StyleFromTokensParams<T extends string> {
|
|
28
|
+
tokenMaps: TokenMap<T>[];
|
|
29
|
+
tokens: ThemeTokens<T> | undefined;
|
|
30
|
+
fallbackTokens?: ThemeTokens<T> | undefined;
|
|
31
|
+
customData?: unknown;
|
|
32
|
+
}
|
|
27
33
|
/**
|
|
28
34
|
* generates style entries, using tokens and token-to-css map
|
|
29
35
|
* @param tokenMaps - token-to-css map defines token, css property and optional transform function
|
|
@@ -31,7 +37,7 @@ export type ThemeTokens<T extends string> = Partial<Record<T, unknown>>;
|
|
|
31
37
|
* @param fallbackTokens - optional list of fallback tokens. I will be used, if main tokens have falsy value
|
|
32
38
|
* @param customData - optional data, that will be passed to token value transform functions
|
|
33
39
|
*/
|
|
34
|
-
export declare const styleFromTokens: <T extends string>(tokenMaps
|
|
40
|
+
export declare const styleFromTokens: <T extends string>({ tokenMaps, tokens, fallbackTokens, customData }: StyleFromTokensParams<T>) => string[];
|
|
35
41
|
export declare const tokenMaps: Record<string, TokenMap>;
|
|
36
42
|
export declare const tokenMapMod: <T extends string>(tokenMap: TokenMap, token: T) => TokenMap<T>;
|
|
37
43
|
/**
|
|
@@ -39,6 +45,12 @@ export declare const tokenMapMod: <T extends string>(tokenMap: TokenMap, token:
|
|
|
39
45
|
* @param id - original id - any valid unescaped html id
|
|
40
46
|
*/
|
|
41
47
|
export declare const getIdSelector: (id: string) => string;
|
|
48
|
+
interface GetRelatedStateSelectorParams {
|
|
49
|
+
inputSelector: string;
|
|
50
|
+
inputStateSelector: string;
|
|
51
|
+
commonContainer: StyledComponent<never, never> | string;
|
|
52
|
+
ownSelectorInContainer?: string;
|
|
53
|
+
}
|
|
42
54
|
/**
|
|
43
55
|
* create selector, using state of associated input.
|
|
44
56
|
*
|
|
@@ -51,13 +63,13 @@ export declare const getIdSelector: (id: string) => string;
|
|
|
51
63
|
* | Note: we use double && to allow styled-components use unique component class instead of common one
|
|
52
64
|
* @example
|
|
53
65
|
* styled.label`
|
|
54
|
-
* ${() => getRelatedStateSelector(CheckIndicator, ':disabled', CheckboxWrapper)} {
|
|
66
|
+
* ${() => getRelatedStateSelector({ inputSelector: CheckIndicator, inputStateSelector: ':disabled', commonContainer: CheckboxWrapper })} {
|
|
55
67
|
* pointer-events: none;
|
|
56
68
|
* }
|
|
57
69
|
* ....
|
|
58
70
|
* `
|
|
59
71
|
*/
|
|
60
|
-
export declare const getRelatedStateSelector: (inputSelector
|
|
72
|
+
export declare const getRelatedStateSelector: ({ inputSelector, inputStateSelector, commonContainer, ownSelectorInContainer }: GetRelatedStateSelectorParams) => string;
|
|
61
73
|
type DimensionsX2 = {
|
|
62
74
|
start?: string;
|
|
63
75
|
end?: string;
|
|
@@ -3,7 +3,12 @@ const numToUnit = (value = 0, toRem = false) => toRem ? `${pxToRem(value)}rem` :
|
|
|
3
3
|
const calcSize = (size, defaultSize = "", toRem = false) => {
|
|
4
4
|
return typeof size === "number" ? numToUnit(size, toRem) : size || (typeof defaultSize === "number" ? numToUnit(defaultSize, toRem) : defaultSize);
|
|
5
5
|
};
|
|
6
|
-
const styleFromTokens = (
|
|
6
|
+
const styleFromTokens = ({
|
|
7
|
+
tokenMaps: tokenMaps2,
|
|
8
|
+
tokens,
|
|
9
|
+
fallbackTokens,
|
|
10
|
+
customData
|
|
11
|
+
}) => tokenMaps2.map(({
|
|
7
12
|
cssProp,
|
|
8
13
|
token,
|
|
9
14
|
transformValue,
|
|
@@ -108,10 +113,17 @@ const tokenMapMod = (tokenMap, token) => ({
|
|
|
108
113
|
...tokenMap,
|
|
109
114
|
token
|
|
110
115
|
});
|
|
111
|
-
const getRelatedStateSelector = (
|
|
116
|
+
const getRelatedStateSelector = ({
|
|
117
|
+
inputSelector,
|
|
118
|
+
inputStateSelector,
|
|
119
|
+
commonContainer,
|
|
120
|
+
ownSelectorInContainer = ":where(&&)"
|
|
121
|
+
}) => `${commonContainer}:has(:where(${inputSelector})${inputStateSelector}) ${ownSelectorInContainer}`;
|
|
112
122
|
const splitDimensionsX2 = (dimensions) => {
|
|
113
123
|
const split = dimensions == null ? void 0 : dimensions.trim().split(/\s+/g);
|
|
114
|
-
if (!(split == null ? void 0 : split.length) || !split[0])
|
|
124
|
+
if (!(split == null ? void 0 : split.length) || !split[0]) {
|
|
125
|
+
return {};
|
|
126
|
+
}
|
|
115
127
|
if (split.length > 2) {
|
|
116
128
|
console.warn('Error: splitting dimensions "', dimensions, '" contains incorrect number of entries. Expecting 2, received', split.length);
|
|
117
129
|
return {};
|
|
@@ -123,7 +135,9 @@ const splitDimensionsX2 = (dimensions) => {
|
|
|
123
135
|
};
|
|
124
136
|
const splitDimensionsX4 = (dimensions) => {
|
|
125
137
|
const split = dimensions == null ? void 0 : dimensions.trim().split(/\s+/g);
|
|
126
|
-
if (!(split == null ? void 0 : split.length) || !split[0])
|
|
138
|
+
if (!(split == null ? void 0 : split.length) || !split[0]) {
|
|
139
|
+
return {};
|
|
140
|
+
}
|
|
127
141
|
if (split.length > 4) {
|
|
128
142
|
console.warn('Error: splitting dimensions "', dimensions, '" contains incorrect number of entries. Expecting 1-4, received', split.length);
|
|
129
143
|
return {};
|
|
@@ -8,7 +8,9 @@ const useScrollable = (ref) => {
|
|
|
8
8
|
const [scrollable, setScrollable] = React.useState(false);
|
|
9
9
|
React.useEffect(() => {
|
|
10
10
|
const el = ref.current;
|
|
11
|
-
if (!el)
|
|
11
|
+
if (!el) {
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
12
14
|
const update = () => setScrollable(isScrollable(el));
|
|
13
15
|
const resizeObserver = new ResizeObserver(update);
|
|
14
16
|
resizeObserver.observe(el);
|
|
@@ -6,7 +6,9 @@ const useScrollable = (ref) => {
|
|
|
6
6
|
const [scrollable, setScrollable] = useState(false);
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
const el = ref.current;
|
|
9
|
-
if (!el)
|
|
9
|
+
if (!el) {
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
10
12
|
const update = () => setScrollable(isScrollable(el));
|
|
11
13
|
const resizeObserver = new ResizeObserver(update);
|
|
12
14
|
resizeObserver.observe(el);
|
|
@@ -8,8 +8,12 @@ const handleStopPropagation = (e) => e.stopPropagation();
|
|
|
8
8
|
const childrenToString = onlyText.default;
|
|
9
9
|
const combineHandlers = (...handlers) => {
|
|
10
10
|
const validHandlers = handlers.filter((handler) => typeof handler === "function");
|
|
11
|
-
if (!validHandlers.length)
|
|
12
|
-
|
|
11
|
+
if (!validHandlers.length) {
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
if (validHandlers.length === 1) {
|
|
15
|
+
return validHandlers[0];
|
|
16
|
+
}
|
|
13
17
|
return (...params) => validHandlers.forEach((handler) => handler(...params));
|
|
14
18
|
};
|
|
15
19
|
const isFragmentElement = (el) => el.type === React.Fragment;
|
|
@@ -6,8 +6,12 @@ const handleStopPropagation = (e) => e.stopPropagation();
|
|
|
6
6
|
const childrenToString = onlyText;
|
|
7
7
|
const combineHandlers = (...handlers) => {
|
|
8
8
|
const validHandlers = handlers.filter((handler) => typeof handler === "function");
|
|
9
|
-
if (!validHandlers.length)
|
|
10
|
-
|
|
9
|
+
if (!validHandlers.length) {
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
if (validHandlers.length === 1) {
|
|
13
|
+
return validHandlers[0];
|
|
14
|
+
}
|
|
11
15
|
return (...params) => validHandlers.forEach((handler) => handler(...params));
|
|
12
16
|
};
|
|
13
17
|
const isFragmentElement = (el) => el.type === Fragment;
|
package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.cjs
CHANGED
|
@@ -10,11 +10,15 @@ const ValueLabel = ({
|
|
|
10
10
|
const {
|
|
11
11
|
value
|
|
12
12
|
} = InputValue_context.useInputValueApi();
|
|
13
|
-
if (!children || !value)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
if (!children || !value) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
if (typeof children === "string") {
|
|
17
|
+
return jsxRuntime.jsxRuntimeExports.jsx(ValueLabel_style.ValueLabel, {
|
|
18
|
+
component: "span",
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
18
22
|
return React.Children.only(children);
|
|
19
23
|
};
|
|
20
24
|
exports.ValueLabel = ValueLabel;
|
package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.js
CHANGED
|
@@ -8,11 +8,15 @@ const ValueLabel = ({
|
|
|
8
8
|
const {
|
|
9
9
|
value
|
|
10
10
|
} = useInputValueApi();
|
|
11
|
-
if (!children || !value)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
if (!children || !value) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (typeof children === "string") {
|
|
15
|
+
return jsxRuntimeExports.jsx(ValueLabel$1, {
|
|
16
|
+
component: "span",
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
16
20
|
return Children.only(children);
|
|
17
21
|
};
|
|
18
22
|
export {
|