@telia/teddy 0.0.61 → 0.0.63

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.
Files changed (93) hide show
  1. package/dist/components/breadcrumbs/breadcrumbs-link.d.ts +1 -1
  2. package/dist/components/breadcrumbs/index.d.ts +1 -1
  3. package/dist/components/card/card-illustration.d.ts +1 -1
  4. package/dist/components/card/card-link.d.ts +1 -1
  5. package/dist/components/card/index.d.ts +2 -2
  6. package/dist/components/checkbox/checkbox-group-item.cjs +58 -0
  7. package/dist/components/checkbox/checkbox-group-item.d.ts +13 -0
  8. package/dist/components/checkbox/checkbox-group-item.js +58 -0
  9. package/dist/components/checkbox/checkbox-group-label.cjs +33 -0
  10. package/dist/components/checkbox/checkbox-group-label.d.ts +8 -0
  11. package/dist/components/checkbox/checkbox-group-label.js +33 -0
  12. package/dist/components/checkbox/checkbox-group-list.cjs +37 -0
  13. package/dist/components/checkbox/checkbox-group-list.d.ts +38 -0
  14. package/dist/components/checkbox/checkbox-group-list.js +37 -0
  15. package/dist/components/checkbox/checkbox-group.cjs +125 -0
  16. package/dist/components/checkbox/checkbox-group.d.ts +67 -0
  17. package/dist/components/checkbox/checkbox-group.js +125 -0
  18. package/dist/components/checkbox/checkbox-indicator.cjs +37 -0
  19. package/dist/components/checkbox/checkbox-indicator.d.ts +6 -0
  20. package/dist/components/checkbox/checkbox-indicator.js +20 -0
  21. package/dist/components/checkbox/checkbox-label.cjs +27 -0
  22. package/dist/components/checkbox/checkbox-label.d.ts +10 -0
  23. package/dist/components/checkbox/checkbox-label.js +27 -0
  24. package/dist/components/checkbox/checkbox-trigger.cjs +33 -0
  25. package/dist/components/checkbox/checkbox-trigger.d.ts +6 -0
  26. package/dist/components/checkbox/checkbox-trigger.js +16 -0
  27. package/dist/components/checkbox/index.cjs +26 -0
  28. package/dist/components/checkbox/index.d.ts +96 -0
  29. package/dist/components/checkbox/index.js +26 -0
  30. package/dist/components/chip/chip-indicator.d.ts +1 -1
  31. package/dist/components/chip/index.d.ts +1 -1
  32. package/dist/components/expandable-card/expandable-card-button.d.ts +2 -2
  33. package/dist/components/expandable-card/index.d.ts +3 -3
  34. package/dist/components/field-error-text/field-error-text.cjs +1 -0
  35. package/dist/components/field-error-text/field-error-text.js +1 -0
  36. package/dist/components/flex/flex.d.ts +1 -1
  37. package/dist/components/index.cjs +5 -4
  38. package/dist/components/index.d.ts +1 -0
  39. package/dist/components/index.js +5 -4
  40. package/dist/components/list/index.d.ts +4 -4
  41. package/dist/components/list/list.d.ts +4 -4
  42. package/dist/components/modal/modal.cjs +1 -2
  43. package/dist/components/modal/modal.js +1 -2
  44. package/dist/components/navigation-menu/global-navigation/global-navigation-desktop-simplified.cjs +2 -3
  45. package/dist/components/navigation-menu/global-navigation/global-navigation-desktop-simplified.js +2 -3
  46. package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.cjs +2 -3
  47. package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.js +1 -2
  48. package/dist/components/navigation-menu/global-navigation/global-navigation-mobile-simplified.cjs +2 -3
  49. package/dist/components/navigation-menu/global-navigation/global-navigation-mobile-simplified.js +2 -3
  50. package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.cjs +2 -3
  51. package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.js +2 -3
  52. package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.cjs +12 -682
  53. package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.js +12 -682
  54. package/dist/components/navigation-menu/global-navigation/global-navigation-root.cjs +4 -5
  55. package/dist/components/navigation-menu/global-navigation/global-navigation-root.js +4 -5
  56. package/dist/components/navigation-menu/global-navigation/global-navigation-search-field.cjs +2 -2
  57. package/dist/components/navigation-menu/global-navigation/global-navigation-search-field.js +2 -2
  58. package/dist/components/navigation-menu/global-navigation/global-navigation-search.cjs +2 -3
  59. package/dist/components/navigation-menu/global-navigation/global-navigation-search.js +2 -3
  60. package/dist/components/navigation-menu/global-navigation/global-navigation-shopping-cart.cjs +2 -3
  61. package/dist/components/navigation-menu/global-navigation/global-navigation-shopping-cart.js +2 -3
  62. package/dist/components/navigation-menu/global-navigation/index.cjs +2 -2
  63. package/dist/components/navigation-menu/global-navigation/index.js +1 -1
  64. package/dist/components/navigation-menu/index.cjs +3 -4
  65. package/dist/components/navigation-menu/index.js +2 -3
  66. package/dist/components/navigation-menu/navigation-menu.cjs +56 -436
  67. package/dist/components/navigation-menu/navigation-menu.d.ts +9 -1
  68. package/dist/components/navigation-menu/navigation-menu.js +56 -419
  69. package/dist/components/notabene/notabene-icon.d.ts +1 -1
  70. package/dist/components/notification/notification.d.ts +1 -1
  71. package/dist/components/radio-card-group/radio-card-group-content.cjs +1 -2
  72. package/dist/components/radio-card-group/radio-card-group-content.js +1 -2
  73. package/dist/components/radio-card-group/radio-card-group-item-body.cjs +1 -2
  74. package/dist/components/radio-card-group/radio-card-group-item-body.js +1 -2
  75. package/dist/components/radio-card-group/radio-card-group-item-title.cjs +1135 -51
  76. package/dist/components/radio-card-group/radio-card-group-item-title.js +1146 -63
  77. package/dist/components/radio-card-group/radio-card-group-item.cjs +1 -2
  78. package/dist/components/radio-card-group/radio-card-group-item.js +1 -2
  79. package/dist/components/scroll-area/index.d.ts +2 -2
  80. package/dist/components/scroll-area/scroll-area-button.d.ts +2 -2
  81. package/dist/components/tabs/index.d.ts +2 -2
  82. package/dist/components/tabs/tabs-scroll-button.d.ts +2 -2
  83. package/dist/components/text-field/index.d.ts +2 -2
  84. package/dist/components/text-field/text-field-button.d.ts +2 -2
  85. package/dist/components/toggle/toggle.d.ts +1 -1
  86. package/dist/components/tooltip/index.d.ts +1 -1
  87. package/dist/main.cjs +5 -4
  88. package/dist/main.js +5 -4
  89. package/dist/style.css +1364 -1253
  90. package/dist/utils/generate-styling/grid.d.ts +24 -24
  91. package/dist/utils/generate-styling/index.d.ts +16 -16
  92. package/dist/utils/generate-styling/util.d.ts +2 -2
  93. package/package.json +2 -1
@@ -9,7 +9,7 @@ export declare const Link: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.
9
9
  disableVisited?: boolean | undefined;
10
10
  ensureTargetArea?: boolean | undefined;
11
11
  silent?: boolean | undefined;
12
- variant: "navigation" | "text" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
12
+ variant: "text" | "navigation" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
13
13
  } & React.RefAttributes<HTMLAnchorElement>, "ref">, "variant"> & {
14
14
  home?: boolean | undefined;
15
15
  } & React.RefAttributes<HTMLAnchorElement>>;
@@ -15,7 +15,7 @@ export declare const Breadcrumbs: import('react').ForwardRefExoticComponent<Omit
15
15
  disableVisited?: boolean | undefined;
16
16
  ensureTargetArea?: boolean | undefined;
17
17
  silent?: boolean | undefined;
18
- variant: "navigation" | "text" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
18
+ variant: "text" | "navigation" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
19
19
  } & import('react').RefAttributes<HTMLAnchorElement>, "ref">, "variant"> & {
20
20
  home?: boolean | undefined;
21
21
  } & import('react').RefAttributes<HTMLAnchorElement>>;
@@ -9,7 +9,7 @@ export type IllustrationProps = React.ComponentPropsWithoutRef<'div'> & {
9
9
  /** The illustration for the card */
10
10
  export declare const Illustration: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
11
11
  /** The inset allows make the image bleed out to the edges */
12
- inset?: "all" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top" | "bottom" | "left" | "right" | "top-right-left" | "bottom-left-right" | "top-bottom" | "left-right" | undefined;
12
+ inset?: "all" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-right-left" | "bottom-left-right" | "top-bottom" | "left-right" | undefined;
13
13
  rounded?: boolean | undefined;
14
14
  } & React.RefAttributes<HTMLDivElement>>;
15
15
  export {};
@@ -7,5 +7,5 @@ export declare const Link: React.ForwardRefExoticComponent<Omit<Omit<React.Detai
7
7
  disableVisited?: boolean | undefined;
8
8
  ensureTargetArea?: boolean | undefined;
9
9
  silent?: boolean | undefined;
10
- variant: "navigation" | "text" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
10
+ variant: "text" | "navigation" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
11
11
  } & React.RefAttributes<HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
@@ -13,7 +13,7 @@ export declare const Card: import('react').ForwardRefExoticComponent<RootProps &
13
13
  Button: import('react').ForwardRefExoticComponent<import('..').ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
14
14
  Content: import('react').ForwardRefExoticComponent<ContentProps & import('react').RefAttributes<HTMLDivElement>>;
15
15
  Illustration: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
16
- inset?: "all" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top" | "bottom" | "left" | "right" | "top-right-left" | "bottom-left-right" | "top-bottom" | "left-right" | undefined;
16
+ inset?: "all" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-right-left" | "bottom-left-right" | "top-bottom" | "left-right" | undefined;
17
17
  rounded?: boolean | undefined;
18
18
  } & import('react').RefAttributes<HTMLDivElement>>;
19
19
  Line: import('react').ForwardRefExoticComponent<LineProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -22,7 +22,7 @@ export declare const Card: import('react').ForwardRefExoticComponent<RootProps &
22
22
  disableVisited?: boolean | undefined;
23
23
  ensureTargetArea?: boolean | undefined;
24
24
  silent?: boolean | undefined;
25
- variant: "navigation" | "text" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
25
+ variant: "text" | "navigation" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
26
26
  } & import('react').RefAttributes<HTMLAnchorElement>, "ref"> & import('react').RefAttributes<HTMLAnchorElement>>;
27
27
  Slot: import('react').ForwardRefExoticComponent<SlotProps & import('react').RefAttributes<HTMLDivElement>>;
28
28
  Footer: import('react').ForwardRefExoticComponent<FooterProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const components_checkbox_checkboxLabel = require("./checkbox-label.cjs");
6
+ const components_checkbox_checkboxTrigger = require("./checkbox-trigger.cjs");
7
+ const components_checkbox_checkboxGroup = require("./checkbox-group.cjs");
8
+ const components_flex_flex = require("../flex/flex.cjs");
9
+ const tokens_spacing_variables = require("../../tokens/spacing/variables.cjs");
10
+ const components_checkbox_checkboxGroupList = require("./checkbox-group-list.cjs");
11
+ const Item = React.forwardRef(
12
+ ({ children, value, ...props }, forwardedRef) => {
13
+ const rootContext = React.useContext(components_checkbox_checkboxGroup.CheckboxGroupContext);
14
+ const listContext = React.useContext(components_checkbox_checkboxGroupList.ListContext);
15
+ const isRegistered = React.useRef(false);
16
+ const fallbackId = React.useId();
17
+ const id = props.id || fallbackId;
18
+ if (!rootContext) {
19
+ throw new Error("CheckboxGroup.Item must be used within a CheckboxGroup");
20
+ }
21
+ const isDisabled = rootContext.disabled || props.disabled;
22
+ const checked = rootContext.isSelected(value);
23
+ const isIndeterminate = rootContext.isIndeterminate(value);
24
+ const childrenNodes = rootContext.getChildren(value);
25
+ const isParent = childrenNodes.length > 0;
26
+ const ariaControls = isParent ? childrenNodes.map((child) => child.id) : void 0;
27
+ React.useEffect(() => {
28
+ if (listContext.parentValue && !isRegistered.current) {
29
+ rootContext.registerChild({ value, parentValue: listContext.parentValue, id });
30
+ isRegistered.current = true;
31
+ }
32
+ }, [listContext.parentValue, value, rootContext, id]);
33
+ return /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { direction: "column", ml: `calc(${listContext.level - 1} * ${tokens_spacing_variables.teddySpacing250})`, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(components_checkbox_checkboxLabel.Label, { ref: forwardedRef, ...props, children: [
34
+ /* @__PURE__ */ jsxRuntime.jsx(
35
+ components_checkbox_checkboxTrigger.Trigger,
36
+ {
37
+ name: rootContext.name,
38
+ disabled: isDisabled,
39
+ required: rootContext.required,
40
+ checked: isIndeterminate ? "indeterminate" : checked,
41
+ onCheckedChange: () => {
42
+ if (listContext.parentValue) {
43
+ rootContext.toggleItem(value);
44
+ } else {
45
+ rootContext.toggleParent(value);
46
+ }
47
+ },
48
+ id,
49
+ "aria-checked": isIndeterminate ? "mixed" : checked,
50
+ "aria-controls": ariaControls == null ? void 0 : ariaControls.join(" ")
51
+ }
52
+ ),
53
+ children
54
+ ] }) }) });
55
+ }
56
+ );
57
+ Item.displayName = "CheckboxGroup.Item";
58
+ exports.Item = Item;
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { LabelProps } from './checkbox-label';
3
+
4
+ export type ItemProps = Omit<LabelProps, 'checked' | 'defaultChecked' | 'onCheckedChange'> & {
5
+ value: string;
6
+ disabled?: boolean;
7
+ children?: React.ReactNode;
8
+ };
9
+ export declare const Item: React.ForwardRefExoticComponent<Omit<LabelProps, "defaultChecked" | "checked" | "onCheckedChange"> & {
10
+ value: string;
11
+ disabled?: boolean | undefined;
12
+ children?: React.ReactNode;
13
+ } & React.RefAttributes<HTMLLabelElement>>;
@@ -0,0 +1,58 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React__default, { useContext, useRef, useId, useEffect } from "react";
3
+ import { Label } from "./checkbox-label.js";
4
+ import { Trigger } from "./checkbox-trigger.js";
5
+ import { CheckboxGroupContext } from "./checkbox-group.js";
6
+ import { Flex } from "../flex/flex.js";
7
+ import { teddySpacing250 } from "../../tokens/spacing/variables.js";
8
+ import { ListContext } from "./checkbox-group-list.js";
9
+ const Item = React__default.forwardRef(
10
+ ({ children, value, ...props }, forwardedRef) => {
11
+ const rootContext = useContext(CheckboxGroupContext);
12
+ const listContext = useContext(ListContext);
13
+ const isRegistered = useRef(false);
14
+ const fallbackId = useId();
15
+ const id = props.id || fallbackId;
16
+ if (!rootContext) {
17
+ throw new Error("CheckboxGroup.Item must be used within a CheckboxGroup");
18
+ }
19
+ const isDisabled = rootContext.disabled || props.disabled;
20
+ const checked = rootContext.isSelected(value);
21
+ const isIndeterminate = rootContext.isIndeterminate(value);
22
+ const childrenNodes = rootContext.getChildren(value);
23
+ const isParent = childrenNodes.length > 0;
24
+ const ariaControls = isParent ? childrenNodes.map((child) => child.id) : void 0;
25
+ useEffect(() => {
26
+ if (listContext.parentValue && !isRegistered.current) {
27
+ rootContext.registerChild({ value, parentValue: listContext.parentValue, id });
28
+ isRegistered.current = true;
29
+ }
30
+ }, [listContext.parentValue, value, rootContext, id]);
31
+ return /* @__PURE__ */ jsx(Flex, { direction: "column", ml: `calc(${listContext.level - 1} * ${teddySpacing250})`, asChild: true, children: /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Label, { ref: forwardedRef, ...props, children: [
32
+ /* @__PURE__ */ jsx(
33
+ Trigger,
34
+ {
35
+ name: rootContext.name,
36
+ disabled: isDisabled,
37
+ required: rootContext.required,
38
+ checked: isIndeterminate ? "indeterminate" : checked,
39
+ onCheckedChange: () => {
40
+ if (listContext.parentValue) {
41
+ rootContext.toggleItem(value);
42
+ } else {
43
+ rootContext.toggleParent(value);
44
+ }
45
+ },
46
+ id,
47
+ "aria-checked": isIndeterminate ? "mixed" : checked,
48
+ "aria-controls": ariaControls == null ? void 0 : ariaControls.join(" ")
49
+ }
50
+ ),
51
+ children
52
+ ] }) }) });
53
+ }
54
+ );
55
+ Item.displayName = "CheckboxGroup.Item";
56
+ export {
57
+ Item
58
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const components_checkbox_checkboxGroup = require("./checkbox-group.cjs");
6
+ const clsx = require("clsx");
7
+ const components_checkbox_checkboxLabel = require("./checkbox-label.cjs");
8
+ const components_label_label = require("../label/label.cjs");
9
+ const components_text_text = require("../text/text.cjs");
10
+ const GroupLabel = React.forwardRef((props, forwardedRef) => {
11
+ const rootContext = React.useContext(components_checkbox_checkboxGroup.CheckboxGroupContext);
12
+ const fallbackId = React.useId();
13
+ const id = props.id || fallbackId;
14
+ const classes = clsx([components_checkbox_checkboxLabel.styles[`${components_checkbox_checkboxLabel.rootClassName}__label`]], props.className);
15
+ React.useEffect(() => {
16
+ rootContext == null ? void 0 : rootContext.setLabelId(id);
17
+ }, [id, rootContext]);
18
+ return /* @__PURE__ */ jsxRuntime.jsx(
19
+ components_label_label.Label,
20
+ {
21
+ asChild: true,
22
+ disabled: rootContext == null ? void 0 : rootContext.disabled,
23
+ isRequired: rootContext == null ? void 0 : rootContext.required,
24
+ ...props,
25
+ className: classes,
26
+ id: rootContext == null ? void 0 : rootContext.labelId,
27
+ ref: forwardedRef,
28
+ children: /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { children: props.children })
29
+ }
30
+ );
31
+ });
32
+ GroupLabel.displayName = "GroupLabel";
33
+ exports.GroupLabel = GroupLabel;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { Label } from '../label';
3
+
4
+ export type GroupLabelProps = React.ComponentPropsWithoutRef<typeof Label>;
5
+ export declare const GroupLabel: React.ForwardRefExoticComponent<Omit<Omit<import('@radix-ui/react-label').LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & {
6
+ disabled?: boolean | undefined;
7
+ isRequired?: boolean | undefined;
8
+ } & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
@@ -0,0 +1,33 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React__default, { useId } from "react";
3
+ import { CheckboxGroupContext } from "./checkbox-group.js";
4
+ import clsx from "clsx";
5
+ import { s as styles, rootClassName } from "./checkbox-label.js";
6
+ import { Label } from "../label/label.js";
7
+ import { Text } from "../text/text.js";
8
+ const GroupLabel = React__default.forwardRef((props, forwardedRef) => {
9
+ const rootContext = React__default.useContext(CheckboxGroupContext);
10
+ const fallbackId = useId();
11
+ const id = props.id || fallbackId;
12
+ const classes = clsx([styles[`${rootClassName}__label`]], props.className);
13
+ React__default.useEffect(() => {
14
+ rootContext == null ? void 0 : rootContext.setLabelId(id);
15
+ }, [id, rootContext]);
16
+ return /* @__PURE__ */ jsx(
17
+ Label,
18
+ {
19
+ asChild: true,
20
+ disabled: rootContext == null ? void 0 : rootContext.disabled,
21
+ isRequired: rootContext == null ? void 0 : rootContext.required,
22
+ ...props,
23
+ className: classes,
24
+ id: rootContext == null ? void 0 : rootContext.labelId,
25
+ ref: forwardedRef,
26
+ children: /* @__PURE__ */ jsx(Text, { children: props.children })
27
+ }
28
+ );
29
+ });
30
+ GroupLabel.displayName = "GroupLabel";
31
+ export {
32
+ GroupLabel
33
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const components_flex_flex = require("../flex/flex.cjs");
6
+ const components_checkbox_checkboxGroup = require("./checkbox-group.cjs");
7
+ const ListContext = React.createContext({
8
+ parentValue: void 0,
9
+ level: 0
10
+ });
11
+ const List = React.forwardRef((props, forwardedRef) => {
12
+ const { children, parentValue, ...rest } = props;
13
+ const rootContext = React.useContext(components_checkbox_checkboxGroup.CheckboxGroupContext);
14
+ const listContext = React.useContext(ListContext);
15
+ const level = typeof listContext.level === "number" ? listContext.level + 1 : 0;
16
+ return /* @__PURE__ */ jsxRuntime.jsx(ListContext.Provider, { value: { parentValue, level }, children: /* @__PURE__ */ jsxRuntime.jsx(
17
+ components_flex_flex.Flex,
18
+ {
19
+ asChild: true,
20
+ role: "group",
21
+ "aria-labelledby": rootContext == null ? void 0 : rootContext.labelId,
22
+ align: "start",
23
+ direction: (rootContext == null ? void 0 : rootContext.direction) || "column",
24
+ dir: (rootContext == null ? void 0 : rootContext.direction) || "column",
25
+ gapX: "200",
26
+ gapY: "50",
27
+ m: "0",
28
+ p: "0",
29
+ ...rest,
30
+ ref: forwardedRef,
31
+ children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children })
32
+ }
33
+ ) });
34
+ });
35
+ List.displayName = "List";
36
+ exports.List = List;
37
+ exports.ListContext = ListContext;
@@ -0,0 +1,38 @@
1
+ import { default as React } from 'react';
2
+ import { Flex } from '../flex';
3
+
4
+ export type ListProps = Omit<React.ComponentPropsWithoutRef<typeof Flex>, 'as' | 'asChild'> & {
5
+ parentValue?: string;
6
+ };
7
+ export declare const ListContext: React.Context<{
8
+ parentValue: string | undefined;
9
+ level: number;
10
+ }>;
11
+ declare const List: React.ForwardRefExoticComponent<Omit<Omit<import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
12
+ display?: import('../../utils/generate-styling').DisplayChildren | undefined;
13
+ } & import('../../utils/generate-styling/gap').GapProps & {
14
+ align?: import('../../utils/generate-styling/align').Align | undefined;
15
+ justify?: import('../../utils/generate-styling/justify').Justify | undefined;
16
+ } & import('../../utils/generate-styling/flex').FlexLayout & {
17
+ asChild: true;
18
+ as?: undefined;
19
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
20
+ display?: import('../../utils/generate-styling').DisplayChildren | undefined;
21
+ } & import('../../utils/generate-styling/gap').GapProps & {
22
+ align?: import('../../utils/generate-styling/align').Align | undefined;
23
+ justify?: import('../../utils/generate-styling/justify').Justify | undefined;
24
+ } & import('../../utils/generate-styling/flex').FlexLayout & {
25
+ as?: "span" | undefined;
26
+ asChild?: false | undefined;
27
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
28
+ display?: import('../../utils/generate-styling').DisplayChildren | undefined;
29
+ } & import('../../utils/generate-styling/gap').GapProps & {
30
+ align?: import('../../utils/generate-styling/align').Align | undefined;
31
+ justify?: import('../../utils/generate-styling/justify').Justify | undefined;
32
+ } & import('../../utils/generate-styling/flex').FlexLayout & {
33
+ as: "div";
34
+ asChild?: false | undefined;
35
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "as" | "asChild"> & {
36
+ parentValue?: string | undefined;
37
+ } & React.RefAttributes<HTMLDivElement>>;
38
+ export { List };
@@ -0,0 +1,37 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React__default from "react";
3
+ import { Flex } from "../flex/flex.js";
4
+ import { CheckboxGroupContext } from "./checkbox-group.js";
5
+ const ListContext = React__default.createContext({
6
+ parentValue: void 0,
7
+ level: 0
8
+ });
9
+ const List = React__default.forwardRef((props, forwardedRef) => {
10
+ const { children, parentValue, ...rest } = props;
11
+ const rootContext = React__default.useContext(CheckboxGroupContext);
12
+ const listContext = React__default.useContext(ListContext);
13
+ const level = typeof listContext.level === "number" ? listContext.level + 1 : 0;
14
+ return /* @__PURE__ */ jsx(ListContext.Provider, { value: { parentValue, level }, children: /* @__PURE__ */ jsx(
15
+ Flex,
16
+ {
17
+ asChild: true,
18
+ role: "group",
19
+ "aria-labelledby": rootContext == null ? void 0 : rootContext.labelId,
20
+ align: "start",
21
+ direction: (rootContext == null ? void 0 : rootContext.direction) || "column",
22
+ dir: (rootContext == null ? void 0 : rootContext.direction) || "column",
23
+ gapX: "200",
24
+ gapY: "50",
25
+ m: "0",
26
+ p: "0",
27
+ ...rest,
28
+ ref: forwardedRef,
29
+ children: /* @__PURE__ */ jsx("ul", { children })
30
+ }
31
+ ) });
32
+ });
33
+ List.displayName = "List";
34
+ export {
35
+ List,
36
+ ListContext
37
+ };
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const components_flex_flex = require("../flex/flex.cjs");
6
+ const reactUseControllableState = require("@radix-ui/react-use-controllable-state");
7
+ const Group = React.forwardRef(
8
+ ({
9
+ children,
10
+ direction = "column",
11
+ name,
12
+ required = false,
13
+ disabled = false,
14
+ defaultValue,
15
+ as = "div",
16
+ asChild = false,
17
+ value: controlledValue,
18
+ onValueChange,
19
+ ...props
20
+ }, forwardRef) => {
21
+ const [value = [], setValue] = reactUseControllableState.useControllableState({
22
+ prop: controlledValue,
23
+ defaultProp: defaultValue || [],
24
+ onChange: onValueChange
25
+ });
26
+ const [labelId, setLabelId] = React.useState(void 0);
27
+ const [checkboxHierarchy, setCheckboxHierarchy] = React.useState([]);
28
+ const getChildren = React.useCallback(
29
+ (parentValue) => checkboxHierarchy.filter((node) => node.parentValue === parentValue),
30
+ [checkboxHierarchy]
31
+ );
32
+ const toggleItem = React.useCallback(
33
+ (itemValue) => {
34
+ setValue((prev) => {
35
+ var _a;
36
+ const newValue = (prev == null ? void 0 : prev.includes(itemValue)) ? prev.filter((v) => v !== itemValue) : [...prev || [], itemValue];
37
+ const parent = (_a = checkboxHierarchy.find((node) => node.value === itemValue)) == null ? void 0 : _a.parentValue;
38
+ if (parent) {
39
+ const siblings = getChildren(parent);
40
+ const allSiblingsSelected = siblings.every((sibling) => newValue.includes(sibling.value));
41
+ return allSiblingsSelected ? [...newValue, parent] : newValue.filter((v) => v !== parent);
42
+ }
43
+ return newValue;
44
+ });
45
+ },
46
+ [setValue, checkboxHierarchy, getChildren]
47
+ );
48
+ const toggleParent = React.useCallback(
49
+ (parentValue) => {
50
+ setValue((prev) => {
51
+ const children2 = getChildren(parentValue);
52
+ const allChildrenSelected = children2.every((child) => prev == null ? void 0 : prev.includes(child.value));
53
+ const parentSelected = prev == null ? void 0 : prev.includes(parentValue);
54
+ if (allChildrenSelected && parentSelected) {
55
+ return prev == null ? void 0 : prev.filter((v) => v !== parentValue && !children2.some((child) => child.value === v));
56
+ } else {
57
+ return [.../* @__PURE__ */ new Set([...prev || [], parentValue, ...children2.map((child) => child.value)])];
58
+ }
59
+ });
60
+ },
61
+ [setValue, getChildren]
62
+ );
63
+ const isSelected = React.useCallback((itemValue) => (value == null ? void 0 : value.includes(itemValue)) || false, [value]);
64
+ const isIndeterminate = React.useCallback(
65
+ (parentValue) => {
66
+ const children2 = getChildren(parentValue);
67
+ if (children2.length === 0)
68
+ return false;
69
+ const selectedChildren = children2.filter((child) => (value == null ? void 0 : value.includes(child.value)) || false);
70
+ return selectedChildren.length > 0 && selectedChildren.length < children2.length;
71
+ },
72
+ [getChildren, value]
73
+ );
74
+ const registerChild = React.useCallback((node) => {
75
+ setCheckboxHierarchy((prev) => [...prev, node]);
76
+ }, []);
77
+ const contextValue = React.useMemo(
78
+ () => ({
79
+ name,
80
+ required,
81
+ disabled,
82
+ direction,
83
+ value,
84
+ toggleItem,
85
+ toggleParent,
86
+ isSelected,
87
+ isIndeterminate,
88
+ registerChild,
89
+ labelId,
90
+ setLabelId,
91
+ getChildren
92
+ }),
93
+ [
94
+ name,
95
+ required,
96
+ disabled,
97
+ direction,
98
+ value,
99
+ toggleItem,
100
+ toggleParent,
101
+ isSelected,
102
+ isIndeterminate,
103
+ registerChild,
104
+ labelId,
105
+ setLabelId,
106
+ getChildren
107
+ ]
108
+ );
109
+ return /* @__PURE__ */ jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
110
+ components_flex_flex.Flex,
111
+ {
112
+ direction: "column",
113
+ ref: forwardRef,
114
+ "data-disabled": disabled ? "" : void 0,
115
+ ...asChild ? { asChild: true } : { as },
116
+ ...props,
117
+ children
118
+ }
119
+ ) });
120
+ }
121
+ );
122
+ const CheckboxGroupContext = React.createContext(void 0);
123
+ Group.displayName = "CheckboxGroup";
124
+ exports.CheckboxGroupContext = CheckboxGroupContext;
125
+ exports.Group = Group;
@@ -0,0 +1,67 @@
1
+ import { default as React } from 'react';
2
+ import { Flex } from '../flex';
3
+
4
+ export type GroupProps = Omit<React.ComponentPropsWithoutRef<typeof Flex>, 'direction' | 'value' | 'onValueChange' | 'defaultValue'> & {
5
+ name?: string;
6
+ required?: boolean;
7
+ disabled?: boolean;
8
+ defaultValue?: string[];
9
+ value?: string[];
10
+ direction?: 'row' | 'column';
11
+ onValueChange?: (value: string[]) => void;
12
+ };
13
+ export declare const Group: React.ForwardRefExoticComponent<Omit<Omit<import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
14
+ display?: import('../../utils/generate-styling').DisplayChildren | undefined;
15
+ } & import('../../utils/generate-styling/gap').GapProps & {
16
+ align?: import('../../utils/generate-styling/align').Align | undefined;
17
+ justify?: import('../../utils/generate-styling/justify').Justify | undefined;
18
+ } & import('../../utils/generate-styling/flex').FlexLayout & {
19
+ asChild: true;
20
+ as?: undefined;
21
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
22
+ display?: import('../../utils/generate-styling').DisplayChildren | undefined;
23
+ } & import('../../utils/generate-styling/gap').GapProps & {
24
+ align?: import('../../utils/generate-styling/align').Align | undefined;
25
+ justify?: import('../../utils/generate-styling/justify').Justify | undefined;
26
+ } & import('../../utils/generate-styling/flex').FlexLayout & {
27
+ as?: "span" | undefined;
28
+ asChild?: false | undefined;
29
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
30
+ display?: import('../../utils/generate-styling').DisplayChildren | undefined;
31
+ } & import('../../utils/generate-styling/gap').GapProps & {
32
+ align?: import('../../utils/generate-styling/align').Align | undefined;
33
+ justify?: import('../../utils/generate-styling/justify').Justify | undefined;
34
+ } & import('../../utils/generate-styling/flex').FlexLayout & {
35
+ as: "div";
36
+ asChild?: false | undefined;
37
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "defaultValue" | "direction" | "value" | "onValueChange"> & {
38
+ name?: string | undefined;
39
+ required?: boolean | undefined;
40
+ disabled?: boolean | undefined;
41
+ defaultValue?: string[] | undefined;
42
+ value?: string[] | undefined;
43
+ direction?: "row" | "column" | undefined;
44
+ onValueChange?: ((value: string[]) => void) | undefined;
45
+ } & React.RefAttributes<HTMLDivElement>>;
46
+ type CheckboxNode = {
47
+ value: string;
48
+ parentValue?: string;
49
+ id: string;
50
+ };
51
+ type CheckboxGroupContextValue = {
52
+ name?: string;
53
+ required: boolean;
54
+ disabled: boolean;
55
+ value: string[];
56
+ direction: 'row' | 'column';
57
+ toggleItem: (itemValue: string) => void;
58
+ toggleParent: (parentValue: string) => void;
59
+ isSelected: (value: string) => boolean;
60
+ isIndeterminate: (value: string) => boolean;
61
+ registerChild: (item: CheckboxNode) => void;
62
+ labelId: string | undefined;
63
+ setLabelId: (id: string) => void;
64
+ getChildren: (parentValue: string) => CheckboxNode[];
65
+ };
66
+ export declare const CheckboxGroupContext: React.Context<CheckboxGroupContextValue | undefined>;
67
+ export {};