@intlayer/design-system 8.7.11-canary.0 → 8.7.12
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/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +1 -1
- package/dist/esm/components/SwitchSelector/index.mjs +56 -22
- package/dist/esm/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/esm/hooks/useAuth/useOAuth2.mjs +1 -1
- package/dist/esm/hooks/useAuth/useSession.mjs +1 -1
- package/dist/esm/hooks/useItemSelector.mjs +8 -3
- package/dist/esm/hooks/useItemSelector.mjs.map +1 -1
- package/dist/types/components/Badge/index.d.ts +2 -2
- package/dist/types/components/Button/Button.d.ts +5 -5
- package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts +1 -1
- package/dist/types/components/Command/index.d.ts +1 -1
- package/dist/types/components/Container/index.d.ts +6 -6
- package/dist/types/components/Input/Checkbox.d.ts +3 -3
- package/dist/types/components/Input/Input.d.ts +1 -1
- package/dist/types/components/Link/Link.d.ts +3 -3
- package/dist/types/components/Pagination/Pagination.d.ts +1 -1
- package/dist/types/components/SwitchSelector/index.d.ts +7 -2
- package/dist/types/components/SwitchSelector/index.d.ts.map +1 -1
- package/dist/types/components/Tab/Tab.d.ts +1 -1
- package/dist/types/components/TabSelector/TabSelector.d.ts +1 -1
- package/dist/types/components/Tag/index.d.ts +3 -3
- package/dist/types/components/Toaster/Toast.d.ts +1 -1
- package/package.json +14 -14
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Button, ButtonColor, ButtonTextAlign, ButtonVariant } from "../../Button/Button.mjs";
|
|
2
2
|
import { Accordion } from "../../Accordion/Accordion.mjs";
|
|
3
3
|
import { getIsEditableSection } from "../getIsEditableSection.mjs";
|
|
4
|
-
import { internationalization } from "@intlayer/config/built";
|
|
5
4
|
import { ChevronRight, Plus } from "lucide-react";
|
|
6
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { internationalization } from "@intlayer/config/built";
|
|
7
7
|
import { useIntlayer } from "react-intlayer";
|
|
8
8
|
import { useEditedContentActions, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
9
9
|
import { getContentNodeByKeyPath, getEmptyNode, getNodeType } from "@intlayer/core/dictionaryManipulator";
|
|
@@ -24,7 +24,7 @@ let SwitchSelectorColor = /* @__PURE__ */ function(SwitchSelectorColor) {
|
|
|
24
24
|
SwitchSelectorColor["TEXT"] = "text";
|
|
25
25
|
return SwitchSelectorColor;
|
|
26
26
|
}({});
|
|
27
|
-
const switchSelectorVariant = cva("flex w-fit cursor-pointer
|
|
27
|
+
const switchSelectorVariant = cva("flex h-fit w-fit cursor-pointer gap-2 border-[1.3px] p-[1.5px]", {
|
|
28
28
|
variants: {
|
|
29
29
|
color: {
|
|
30
30
|
[`primary`]: "border-primary text-primary",
|
|
@@ -35,6 +35,10 @@ const switchSelectorVariant = cva("flex w-fit cursor-pointer flex-row gap-2 roun
|
|
|
35
35
|
[`dark`]: "border-neutral-800 text-neutral-800",
|
|
36
36
|
[`text`]: "border-text text-text"
|
|
37
37
|
},
|
|
38
|
+
orientation: {
|
|
39
|
+
horizontal: "flex-row rounded-full",
|
|
40
|
+
vertical: "flex-col rounded-2xl"
|
|
41
|
+
},
|
|
38
42
|
disabled: {
|
|
39
43
|
true: "cursor-not-allowed opacity-50",
|
|
40
44
|
false: ""
|
|
@@ -42,6 +46,7 @@ const switchSelectorVariant = cva("flex w-fit cursor-pointer flex-row gap-2 roun
|
|
|
42
46
|
},
|
|
43
47
|
defaultVariants: {
|
|
44
48
|
color: `primary`,
|
|
49
|
+
orientation: "horizontal",
|
|
45
50
|
disabled: false
|
|
46
51
|
}
|
|
47
52
|
});
|
|
@@ -51,23 +56,41 @@ let SwitchSelectorSize = /* @__PURE__ */ function(SwitchSelectorSize) {
|
|
|
51
56
|
SwitchSelectorSize["LG"] = "lg";
|
|
52
57
|
return SwitchSelectorSize;
|
|
53
58
|
}({});
|
|
54
|
-
const choiceVariant = cva("z-1 w-full
|
|
55
|
-
variants: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const choiceVariant = cva("z-1 w-full cursor-pointer font-medium text-sm transition-all duration-300 ease-in-out aria-selected:cursor-default data-[indicator=true]:text-text-opposite motion-reduce:transition-none", {
|
|
60
|
+
variants: {
|
|
61
|
+
size: {
|
|
62
|
+
[`sm`]: "px-2 py-1 text-xs",
|
|
63
|
+
[`md`]: "p-2 text-sm",
|
|
64
|
+
[`lg`]: "p-4 text-base"
|
|
65
|
+
},
|
|
66
|
+
orientation: {
|
|
67
|
+
horizontal: "flex-1",
|
|
68
|
+
vertical: ""
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
defaultVariants: {
|
|
72
|
+
size: `md`,
|
|
73
|
+
orientation: "horizontal"
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const indicatorVariant = cva("absolute z-0 transition-all duration-300 ease-in-out motion-reduce:transition-none", {
|
|
77
|
+
variants: {
|
|
78
|
+
color: {
|
|
79
|
+
[`primary`]: "bg-primary data-[indicator=true]:text-text",
|
|
80
|
+
[`secondary`]: "bg-secondary data-[indicator=true]:text-text",
|
|
81
|
+
[`destructive`]: "bg-destructive data-[indicator=true]:text-text",
|
|
82
|
+
[`neutral`]: "bg-neutral data-[indicator=true]:text-white",
|
|
83
|
+
[`light`]: "bg-white data-[indicator=true]:text-black",
|
|
84
|
+
[`dark`]: "bg-neutral-800 data-[indicator=true]:text-white",
|
|
85
|
+
[`text`]: "bg-text data-[indicator=true]:text-text-opposite"
|
|
86
|
+
},
|
|
87
|
+
orientation: {
|
|
88
|
+
horizontal: "top-0 h-full w-auto rounded-full",
|
|
89
|
+
vertical: "left-0 h-auto w-full rounded-xl"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
defaultVariants: { orientation: "horizontal" }
|
|
61
93
|
});
|
|
62
|
-
const indicatorVariant = cva("absolute top-0 z-0 h-full w-auto rounded-full transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none", { variants: { color: {
|
|
63
|
-
[`primary`]: "bg-primary data-[indicator=true]:text-text",
|
|
64
|
-
[`secondary`]: "bg-secondary data-[indicator=true]:text-text",
|
|
65
|
-
[`destructive`]: "bg-destructive data-[indicator=true]:text-text",
|
|
66
|
-
[`neutral`]: "bg-neutral data-[indicator=true]:text-white",
|
|
67
|
-
[`light`]: "bg-white data-[indicator=true]:text-black",
|
|
68
|
-
[`dark`]: "bg-neutral-800 data-[indicator=true]:text-white",
|
|
69
|
-
[`text`]: "bg-text data-[indicator=true]:text-text-opposite"
|
|
70
|
-
} } });
|
|
71
94
|
/**
|
|
72
95
|
*
|
|
73
96
|
* Component that allows the user to select one of the provided choices.
|
|
@@ -85,12 +108,16 @@ const indicatorVariant = cva("absolute top-0 z-0 h-full w-auto rounded-full tran
|
|
|
85
108
|
* />
|
|
86
109
|
* ```
|
|
87
110
|
*/
|
|
88
|
-
const SwitchSelector = ({ choices = defaultChoices, value, defaultValue, onChange, color = "primary", size = "md", className, itemClassName, hoverable = true, disabled = false }) => {
|
|
111
|
+
const SwitchSelector = ({ choices = defaultChoices, value, defaultValue, onChange, color = "primary", size = "md", className, itemClassName, hoverable = true, disabled = false, orientation = "horizontal" }) => {
|
|
89
112
|
const [valueState, setValue] = useState(value ?? defaultValue ?? choices[0].value);
|
|
90
113
|
const [hoveredIndex, setHoveredIndex] = useState(null);
|
|
91
114
|
const optionsRefs = useRef([]);
|
|
92
115
|
const indicatorRef = useRef(null);
|
|
93
|
-
const { choiceIndicatorPosition } = useItemSelector(optionsRefs, {
|
|
116
|
+
const { choiceIndicatorPosition } = useItemSelector(optionsRefs, {
|
|
117
|
+
selector: (el) => el.getAttribute("data-indicator") === "true",
|
|
118
|
+
isHoverable: false,
|
|
119
|
+
orientation
|
|
120
|
+
});
|
|
94
121
|
const selectedIndex = choices.findIndex((choice) => choice.value === valueState);
|
|
95
122
|
const indicatorIndex = hoverable && hoveredIndex !== null ? hoveredIndex : selectedIndex;
|
|
96
123
|
const handleChange = (newValue) => {
|
|
@@ -105,12 +132,13 @@ const SwitchSelector = ({ choices = defaultChoices, value, defaultValue, onChang
|
|
|
105
132
|
className: switchSelectorVariant({
|
|
106
133
|
color,
|
|
107
134
|
disabled,
|
|
135
|
+
orientation,
|
|
108
136
|
className
|
|
109
137
|
}),
|
|
110
138
|
role: "tablist",
|
|
111
139
|
"aria-disabled": disabled ? "true" : void 0,
|
|
112
140
|
children: /* @__PURE__ */ jsxs("div", {
|
|
113
|
-
className: "relative flex
|
|
141
|
+
className: cn("relative flex w-full items-center justify-center", orientation === "horizontal" ? "h-full flex-row" : "h-fit flex-col"),
|
|
114
142
|
children: [choices.map((choice, index) => {
|
|
115
143
|
const { content, value, ...buttonProps } = choice;
|
|
116
144
|
const isKeyOfKey = typeof value === "string" || typeof value === "number";
|
|
@@ -118,7 +146,10 @@ const SwitchSelector = ({ choices = defaultChoices, value, defaultValue, onChang
|
|
|
118
146
|
const isIndicatorOwner = index === indicatorIndex;
|
|
119
147
|
return /* @__PURE__ */ createElement("button", {
|
|
120
148
|
...buttonProps,
|
|
121
|
-
className: cn(choiceVariant({
|
|
149
|
+
className: cn(choiceVariant({
|
|
150
|
+
size,
|
|
151
|
+
orientation
|
|
152
|
+
}), disabled && "cursor-not-allowed", itemClassName),
|
|
122
153
|
key: isKeyOfKey ? value : index,
|
|
123
154
|
role: "tab",
|
|
124
155
|
onClick: () => handleChange(value),
|
|
@@ -133,7 +164,10 @@ const SwitchSelector = ({ choices = defaultChoices, value, defaultValue, onChang
|
|
|
133
164
|
onMouseLeave: () => !disabled && setHoveredIndex(null)
|
|
134
165
|
}, content);
|
|
135
166
|
}), choiceIndicatorPosition && /* @__PURE__ */ jsx("div", {
|
|
136
|
-
className: cn(indicatorVariant({
|
|
167
|
+
className: cn(indicatorVariant({
|
|
168
|
+
color,
|
|
169
|
+
orientation
|
|
170
|
+
})),
|
|
137
171
|
style: choiceIndicatorPosition,
|
|
138
172
|
ref: indicatorRef
|
|
139
173
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/SwitchSelector/index.tsx"],"sourcesContent":["'use client';\n\nimport { useItemSelector } from '@hooks/useItemSelector';\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n type HTMLAttributes,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nexport type SwitchSelectorChoice<T = boolean> = {\n content: ReactNode;\n value: T;\n} & HTMLAttributes<HTMLButtonElement>;\nexport type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];\n\nconst defaultChoices: SwitchSelectorChoices<boolean> = [\n { content: 'Off', value: false },\n { content: 'On', value: true },\n];\n\nexport type SwitchSelectorProps<T = boolean> = {\n choices?: SwitchSelectorChoices<T>;\n value?: T;\n defaultValue?: T;\n onChange?: (choice: T) => void;\n className?: string;\n itemClassName?: string;\n hoverable?: boolean;\n disabled?: boolean;\n} & VariantProps<typeof switchSelectorVariant> &\n VariantProps<typeof choiceVariant>;\n\nexport enum SwitchSelectorColor {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n DESTRUCTIVE = 'destructive',\n NEUTRAL = 'neutral',\n LIGHT = 'light',\n DARK = 'dark',\n TEXT = 'text',\n}\n\nconst switchSelectorVariant = cva(\n 'flex w-fit cursor-pointer flex-row gap-2 rounded-full border-[1.3px] p-[1.5px]',\n {\n variants: {\n color: {\n [`${SwitchSelectorColor.PRIMARY}`]: 'border-primary text-primary',\n [`${SwitchSelectorColor.SECONDARY}`]: 'border-secondary text-secondary',\n [`${SwitchSelectorColor.DESTRUCTIVE}`]:\n 'border-destructive bg-destructive text-destructive',\n [`${SwitchSelectorColor.NEUTRAL}`]: 'border-neutral text-neutral',\n [`${SwitchSelectorColor.LIGHT}`]: 'border-white text-white',\n [`${SwitchSelectorColor.DARK}`]: 'border-neutral-800 text-neutral-800',\n [`${SwitchSelectorColor.TEXT}`]: 'border-text text-text',\n },\n disabled: {\n true: 'cursor-not-allowed opacity-50',\n false: '',\n },\n },\n defaultVariants: {\n color: `${SwitchSelectorColor.PRIMARY}`,\n disabled: false,\n },\n }\n);\n\nexport enum SwitchSelectorSize {\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n}\n\nconst choiceVariant = cva(\n 'z-1 w-full flex-1 cursor-pointer font-medium text-sm transition-all duration-300 ease-in-out aria-selected:cursor-default data-[indicator=true]:text-text-opposite motion-reduce:transition-none',\n {\n variants: {\n size: {\n [`${SwitchSelectorSize.SM}`]: 'px-2 py-1 text-xs',\n [`${SwitchSelectorSize.MD}`]: 'p-2 text-sm',\n [`${SwitchSelectorSize.LG}`]: 'p-4 text-base',\n },\n },\n defaultVariants: {\n size: `${SwitchSelectorSize.MD}`,\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute top-0 z-0 h-full w-auto rounded-full transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n [`${SwitchSelectorColor.PRIMARY}`]:\n 'bg-primary data-[indicator=true]:text-text',\n [`${SwitchSelectorColor.SECONDARY}`]:\n 'bg-secondary data-[indicator=true]:text-text',\n [`${SwitchSelectorColor.DESTRUCTIVE}`]:\n 'bg-destructive data-[indicator=true]:text-text',\n [`${SwitchSelectorColor.NEUTRAL}`]:\n 'bg-neutral data-[indicator=true]:text-white',\n [`${SwitchSelectorColor.LIGHT}`]:\n 'bg-white data-[indicator=true]:text-black',\n [`${SwitchSelectorColor.DARK}`]:\n 'bg-neutral-800 data-[indicator=true]:text-white',\n [`${SwitchSelectorColor.TEXT}`]:\n 'bg-text data-[indicator=true]:text-text-opposite',\n },\n },\n }\n);\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <SwitchSelector\n * choices={[\n * { content: 'Option 1', value: 'option1' },\n * { content: 'Option 2', value: 'option2' },\n * { content: 'Option 3', value: 'option3' },\n * ]}\n * value=\"option1\"\n * onChange={(choice) => console.log(choice)}\n * />\n * ```\n */\nexport const SwitchSelector = <T,>({\n choices = defaultChoices as SwitchSelectorChoices<T>,\n value,\n defaultValue,\n onChange,\n color = SwitchSelectorColor.PRIMARY,\n size = SwitchSelectorSize.MD,\n className,\n itemClassName,\n hoverable = true,\n disabled = false,\n}: SwitchSelectorProps<T>) => {\n const [valueState, setValue] = useState<T>(\n value ?? defaultValue ?? choices[0].value\n );\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\n\n const optionsRefs = useRef<HTMLButtonElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(optionsRefs, {\n isHoverable: hoverable,\n });\n\n const selectedIndex = choices.findIndex(\n (choice) => choice.value === valueState\n );\n\n // The indicator follows hover if hoverable, otherwise the selected option\n const indicatorIndex =\n hoverable && hoveredIndex !== null ? hoveredIndex : selectedIndex;\n\n const handleChange = (newValue: T) => {\n setValue(newValue);\n onChange?.(newValue);\n };\n\n useEffect(() => {\n if (value === undefined) return;\n setValue(value);\n }, [value]);\n\n return (\n <div\n className={switchSelectorVariant({\n color,\n disabled,\n className,\n })}\n role=\"tablist\"\n aria-disabled={disabled ? 'true' : undefined}\n >\n <div className=\"relative flex size-full flex-row items-center justify-center\">\n {choices.map((choice, index) => {\n const { content, value, ...buttonProps } = choice;\n\n const isKeyOfKey =\n typeof value === 'string' || typeof value === 'number';\n\n const isSelected = index === selectedIndex;\n const isIndicatorOwner = index === indicatorIndex;\n\n return (\n <button\n {...buttonProps}\n className={cn(\n choiceVariant({\n size,\n }),\n disabled && 'cursor-not-allowed',\n itemClassName\n )}\n key={isKeyOfKey ? value : index}\n role=\"tab\"\n onClick={() => handleChange(value)}\n aria-selected={isSelected ? 'true' : undefined}\n data-indicator={isIndicatorOwner ? 'true' : undefined}\n disabled={disabled || isSelected}\n tabIndex={isSelected ? 0 : -1}\n ref={(el) => {\n optionsRefs.current[index] = el!;\n }}\n onMouseEnter={() => !disabled && setHoveredIndex(index)}\n onMouseLeave={() => !disabled && setHoveredIndex(null)}\n >\n {content}\n </button>\n );\n })}\n\n {choiceIndicatorPosition && (\n <div\n className={cn(\n indicatorVariant({\n color,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAmBA,MAAM,iBAAiD,CACrD;CAAE,SAAS;CAAO,OAAO;CAAO,EAChC;CAAE,SAAS;CAAM,OAAO;CAAM,CAC/B;AAcD,IAAY,sBAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;KACD;AAED,MAAM,wBAAwB,IAC5B,kFACA;CACE,UAAU;EACR,OAAO;IACJ,YAAmC;IACnC,cAAqC;IACrC,gBACC;IACD,YAAmC;IACnC,UAAiC;IACjC,SAAgC;IAChC,SAAgC;GAClC;EACD,UAAU;GACR,MAAM;GACN,OAAO;GACR;EACF;CACD,iBAAiB;EACf,OAAO;EACP,UAAU;EACX;CACF,CACF;AAED,IAAY,qBAAL;AACL;AACA;AACA;;KACD;AAED,MAAM,gBAAgB,IACpB,oMACA;CACE,UAAU,EACR,MAAM;GACH,OAA6B;GAC7B,OAA6B;GAC7B,OAA6B;EAC/B,EACF;CACD,iBAAiB,EACf,MAAM,MACP;CACF,CACF;AAED,MAAM,mBAAmB,IACvB,gIACA,EACE,UAAU,EACR,OAAO;EACJ,YACC;EACD,cACC;EACD,gBACC;EACD,YACC;EACD,UACC;EACD,SACC;EACD,SACC;CACH,EACF,EACF,CACF;;;;;;;;;;;;;;;;;;AAmBD,MAAa,kBAAsB,EACjC,UAAU,gBACV,OACA,cACA,UACA,mBACA,aACA,WACA,eACA,YAAY,MACZ,WAAW,YACiB;CAC5B,MAAM,CAAC,YAAY,YAAY,SAC7B,SAAS,gBAAgB,QAAQ,GAAG,MACrC;CACD,MAAM,CAAC,cAAc,mBAAmB,SAA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"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/SwitchSelector/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ItemSelectorOrientation,\n useItemSelector,\n} from '@hooks/useItemSelector';\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n type HTMLAttributes,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nexport type SwitchSelectorChoice<T = boolean> = {\n content: ReactNode;\n value: T;\n} & HTMLAttributes<HTMLButtonElement>;\nexport type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];\n\nconst defaultChoices: SwitchSelectorChoices<boolean> = [\n { content: 'Off', value: false },\n { content: 'On', value: true },\n];\n\nexport type SwitchSelectorProps<T = boolean> = {\n choices?: SwitchSelectorChoices<T>;\n value?: T;\n defaultValue?: T;\n onChange?: (choice: T) => void;\n className?: string;\n itemClassName?: string;\n hoverable?: boolean;\n disabled?: boolean;\n orientation?: ItemSelectorOrientation;\n} & VariantProps<typeof switchSelectorVariant> &\n VariantProps<typeof choiceVariant>;\n\nexport enum SwitchSelectorColor {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n DESTRUCTIVE = 'destructive',\n NEUTRAL = 'neutral',\n LIGHT = 'light',\n DARK = 'dark',\n TEXT = 'text',\n}\n\nconst switchSelectorVariant = cva(\n 'flex h-fit w-fit cursor-pointer gap-2 border-[1.3px] p-[1.5px]',\n {\n variants: {\n color: {\n [`${SwitchSelectorColor.PRIMARY}`]: 'border-primary text-primary',\n [`${SwitchSelectorColor.SECONDARY}`]: 'border-secondary text-secondary',\n [`${SwitchSelectorColor.DESTRUCTIVE}`]:\n 'border-destructive bg-destructive text-destructive',\n [`${SwitchSelectorColor.NEUTRAL}`]: 'border-neutral text-neutral',\n [`${SwitchSelectorColor.LIGHT}`]: 'border-white text-white',\n [`${SwitchSelectorColor.DARK}`]: 'border-neutral-800 text-neutral-800',\n [`${SwitchSelectorColor.TEXT}`]: 'border-text text-text',\n },\n orientation: {\n horizontal: 'flex-row rounded-full',\n vertical: 'flex-col rounded-2xl',\n },\n disabled: {\n true: 'cursor-not-allowed opacity-50',\n false: '',\n },\n },\n defaultVariants: {\n color: `${SwitchSelectorColor.PRIMARY}`,\n orientation: 'horizontal',\n disabled: false,\n },\n }\n);\n\nexport enum SwitchSelectorSize {\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n}\n\nconst choiceVariant = cva(\n 'z-1 w-full cursor-pointer font-medium text-sm transition-all duration-300 ease-in-out aria-selected:cursor-default data-[indicator=true]:text-text-opposite motion-reduce:transition-none',\n {\n variants: {\n size: {\n [`${SwitchSelectorSize.SM}`]: 'px-2 py-1 text-xs',\n [`${SwitchSelectorSize.MD}`]: 'p-2 text-sm',\n [`${SwitchSelectorSize.LG}`]: 'p-4 text-base',\n },\n orientation: {\n horizontal: 'flex-1',\n vertical: '',\n },\n },\n defaultVariants: {\n size: `${SwitchSelectorSize.MD}`,\n orientation: 'horizontal',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute z-0 transition-all duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n [`${SwitchSelectorColor.PRIMARY}`]:\n 'bg-primary data-[indicator=true]:text-text',\n [`${SwitchSelectorColor.SECONDARY}`]:\n 'bg-secondary data-[indicator=true]:text-text',\n [`${SwitchSelectorColor.DESTRUCTIVE}`]:\n 'bg-destructive data-[indicator=true]:text-text',\n [`${SwitchSelectorColor.NEUTRAL}`]:\n 'bg-neutral data-[indicator=true]:text-white',\n [`${SwitchSelectorColor.LIGHT}`]:\n 'bg-white data-[indicator=true]:text-black',\n [`${SwitchSelectorColor.DARK}`]:\n 'bg-neutral-800 data-[indicator=true]:text-white',\n [`${SwitchSelectorColor.TEXT}`]:\n 'bg-text data-[indicator=true]:text-text-opposite',\n },\n orientation: {\n horizontal: 'top-0 h-full w-auto rounded-full',\n vertical: 'left-0 h-auto w-full rounded-xl',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n }\n);\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <SwitchSelector\n * choices={[\n * { content: 'Option 1', value: 'option1' },\n * { content: 'Option 2', value: 'option2' },\n * { content: 'Option 3', value: 'option3' },\n * ]}\n * value=\"option1\"\n * onChange={(choice) => console.log(choice)}\n * />\n * ```\n */\nexport const SwitchSelector = <T,>({\n choices = defaultChoices as SwitchSelectorChoices<T>,\n value,\n defaultValue,\n onChange,\n color = SwitchSelectorColor.PRIMARY,\n size = SwitchSelectorSize.MD,\n className,\n itemClassName,\n hoverable = true,\n disabled = false,\n orientation = 'horizontal',\n}: SwitchSelectorProps<T>) => {\n const [valueState, setValue] = useState<T>(\n value ?? defaultValue ?? choices[0].value\n );\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\n\n const optionsRefs = useRef<HTMLButtonElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition } = useItemSelector(optionsRefs, {\n selector: (el) => el.getAttribute('data-indicator') === 'true',\n isHoverable: false,\n orientation,\n });\n\n const selectedIndex = choices.findIndex(\n (choice) => choice.value === valueState\n );\n\n // The indicator follows hover if hoverable, otherwise the selected option\n const indicatorIndex =\n hoverable && hoveredIndex !== null ? hoveredIndex : selectedIndex;\n\n const handleChange = (newValue: T) => {\n setValue(newValue);\n onChange?.(newValue);\n };\n\n useEffect(() => {\n if (value === undefined) return;\n setValue(value);\n }, [value]);\n\n return (\n <div\n className={switchSelectorVariant({\n color,\n disabled,\n orientation,\n className,\n })}\n role=\"tablist\"\n aria-disabled={disabled ? 'true' : undefined}\n >\n <div\n className={cn(\n 'relative flex w-full items-center justify-center',\n orientation === 'horizontal' ? 'h-full flex-row' : 'h-fit flex-col'\n )}\n >\n {choices.map((choice, index) => {\n const { content, value, ...buttonProps } = choice;\n\n const isKeyOfKey =\n typeof value === 'string' || typeof value === 'number';\n\n const isSelected = index === selectedIndex;\n const isIndicatorOwner = index === indicatorIndex;\n\n return (\n <button\n {...buttonProps}\n className={cn(\n choiceVariant({\n size,\n orientation,\n }),\n disabled && 'cursor-not-allowed',\n itemClassName\n )}\n key={isKeyOfKey ? value : index}\n role=\"tab\"\n onClick={() => handleChange(value)}\n aria-selected={isSelected ? 'true' : undefined}\n data-indicator={isIndicatorOwner ? 'true' : undefined}\n disabled={disabled || isSelected}\n tabIndex={isSelected ? 0 : -1}\n ref={(el) => {\n optionsRefs.current[index] = el!;\n }}\n onMouseEnter={() => !disabled && setHoveredIndex(index)}\n onMouseLeave={() => !disabled && setHoveredIndex(null)}\n >\n {content}\n </button>\n );\n })}\n\n {choiceIndicatorPosition && (\n <div\n className={cn(\n indicatorVariant({\n color,\n orientation,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAsBA,MAAM,iBAAiD,CACrD;CAAE,SAAS;CAAO,OAAO;CAAO,EAChC;CAAE,SAAS;CAAM,OAAO;CAAM,CAC/B;AAeD,IAAY,sBAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;KACD;AAED,MAAM,wBAAwB,IAC5B,kEACA;CACE,UAAU;EACR,OAAO;IACJ,YAAmC;IACnC,cAAqC;IACrC,gBACC;IACD,YAAmC;IACnC,UAAiC;IACjC,SAAgC;IAChC,SAAgC;GAClC;EACD,aAAa;GACX,YAAY;GACZ,UAAU;GACX;EACD,UAAU;GACR,MAAM;GACN,OAAO;GACR;EACF;CACD,iBAAiB;EACf,OAAO;EACP,aAAa;EACb,UAAU;EACX;CACF,CACF;AAED,IAAY,qBAAL;AACL;AACA;AACA;;KACD;AAED,MAAM,gBAAgB,IACpB,6LACA;CACE,UAAU;EACR,MAAM;IACH,OAA6B;IAC7B,OAA6B;IAC7B,OAA6B;GAC/B;EACD,aAAa;GACX,YAAY;GACZ,UAAU;GACX;EACF;CACD,iBAAiB;EACf,MAAM;EACN,aAAa;EACd;CACF,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AAU;IAC7B,MAAM,mBAAmB,UAAU;AAEnC,WACE,8BAAC,UAAD;KACE,GAAI;KACJ,WAAW,GACT,cAAc;MACZ;MACA;MACD,CAAC,EACF,YAAY,sBACZ,cACD;KACD,KAAK,aAAa,QAAQ;KAC1B,MAAK;KACL,eAAe,aAAa,MAAM;KAClC,iBAAe,aAAa,SAAS;KACrC,kBAAgB,mBAAmB,SAAS;KAC5C,UAAU,YAAY;KACtB,UAAU,aAAa,IAAI;KAC3B,MAAM,OAAO;AACX,kBAAY,QAAQ,SAAS;;KAE/B,oBAAoB,CAAC,YAAY,gBAAgB,MAAM;KACvD,oBAAoB,CAAC,YAAY,gBAAgB,KAAK;KAG/C,EADN,QACM;KAEX,EAED,2BACC,oBAAC,OAAD;IACE,WAAW,GACT,iBAAiB;KACf;KACA;KACD,CAAC,CACH;IACD,OAAO;IACP,KAAK;IACL,EAEA;;EACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import configuration from "@intlayer/config/built";
|
|
4
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
import configuration from "@intlayer/config/built";
|
|
5
5
|
import { useConfiguration } from "@intlayer/editor-react";
|
|
6
6
|
import { getOAuthAPI } from "@intlayer/api";
|
|
7
7
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { getAuthAPI } from "../../libs/auth.mjs";
|
|
4
4
|
import { useQueryClient } from "../reactQuery.mjs";
|
|
5
|
-
import configuration from "@intlayer/config/built";
|
|
6
5
|
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import configuration from "@intlayer/config/built";
|
|
7
7
|
import { useConfiguration } from "@intlayer/editor-react";
|
|
8
8
|
|
|
9
9
|
//#region src/hooks/useAuth/useSession.ts
|
|
@@ -72,14 +72,18 @@ const useItemSelector = (optionsRefs, { selector = selectorDefault, isHoverable
|
|
|
72
72
|
optionsRefs.current.forEach((option) => {
|
|
73
73
|
if (option) {
|
|
74
74
|
const observer = new MutationObserver((mutations) => {
|
|
75
|
-
for (const mutation of mutations) if (mutation.type === "attributes" && mutation.attributeName === "aria-selected") {
|
|
75
|
+
for (const mutation of mutations) if (mutation.type === "attributes" && (mutation.attributeName === "aria-selected" || mutation.attributeName === "data-active" || mutation.attributeName === "data-indicator")) {
|
|
76
76
|
calculatePosition();
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
observer.observe(option, {
|
|
81
81
|
attributes: true,
|
|
82
|
-
attributeFilter: [
|
|
82
|
+
attributeFilter: [
|
|
83
|
+
"aria-selected",
|
|
84
|
+
"data-active",
|
|
85
|
+
"data-indicator"
|
|
86
|
+
]
|
|
83
87
|
});
|
|
84
88
|
mutationObservers.push(observer);
|
|
85
89
|
}
|
|
@@ -133,7 +137,8 @@ const useItemSelector = (optionsRefs, { selector = selectorDefault, isHoverable
|
|
|
133
137
|
selector,
|
|
134
138
|
hoveredItem,
|
|
135
139
|
itemsLength,
|
|
136
|
-
orientation
|
|
140
|
+
orientation,
|
|
141
|
+
isHoverable
|
|
137
142
|
]);
|
|
138
143
|
return {
|
|
139
144
|
choiceIndicatorPosition,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemSelector.mjs","names":[],"sources":["../../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { type RefObject, useEffect, useRef, useState } from 'react';\n\nexport type ItemSelectorOrientation = 'horizontal' | 'vertical';\n\ntype HorizontalStyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\ntype VerticalStyleState = {\n top: number;\n height: number;\n opacity: number;\n};\n\ntype StyleState = HorizontalStyleState | VerticalStyleState;\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\ntype Options = {\n selector?: (option: HTMLElement, index: number) => boolean;\n isHoverable?: boolean;\n orientation?: ItemSelectorOrientation;\n};\n\nexport const useItemSelector = (\n optionsRefs: RefObject<HTMLElement[]>,\n {\n selector = selectorDefault,\n isHoverable = false,\n orientation = 'horizontal',\n }: Options = {\n selector: selectorDefault,\n isHoverable: false,\n orientation: 'horizontal',\n }\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const lastPositionRef = useRef<StyleState | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n // Clear any pending hide timeout when hovering over an item\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n // Keep previous position but set opacity to 0\n if (orientation === 'vertical') {\n setChoiceIndicatorPosition((prev) => {\n const verticalPrev = prev as VerticalStyleState | null;\n const newPosition: VerticalStyleState = {\n top: verticalPrev?.top ?? 0,\n height: verticalPrev?.height ?? 0,\n opacity: 0,\n };\n lastPositionRef.current = newPosition;\n return newPosition;\n });\n } else {\n setChoiceIndicatorPosition((prev) => {\n const horizontalPrev = prev as HorizontalStyleState | null;\n const newPosition: HorizontalStyleState = {\n left: horizontalPrev?.left ?? 0,\n width: horizontalPrev?.width ?? 0,\n opacity: 0,\n };\n lastPositionRef.current = newPosition;\n return newPosition;\n });\n }\n return;\n }\n\n if (orientation === 'vertical') {\n const top = targetElement.offsetTop;\n const height = targetElement.offsetHeight;\n\n const newPosition = {\n top,\n height,\n opacity: 1,\n };\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n } else {\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n const newPosition = {\n left,\n width,\n opacity: 1,\n };\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n };\n\n useEffect(() => {\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-selected'\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n // Clear any existing timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Keep the indicator at its current position for 150ms\n // before removing the hovered item\n hideTimeoutRef.current = setTimeout(() => {\n setHoveredItem(null);\n }, 150); // 150ms delay before hiding\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [optionsRefs
|
|
1
|
+
{"version":3,"file":"useItemSelector.mjs","names":[],"sources":["../../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { type RefObject, useEffect, useRef, useState } from 'react';\n\nexport type ItemSelectorOrientation = 'horizontal' | 'vertical';\n\ntype HorizontalStyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\ntype VerticalStyleState = {\n top: number;\n height: number;\n opacity: number;\n};\n\ntype StyleState = HorizontalStyleState | VerticalStyleState;\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\ntype Options = {\n selector?: (option: HTMLElement, index: number) => boolean;\n isHoverable?: boolean;\n orientation?: ItemSelectorOrientation;\n};\n\nexport const useItemSelector = (\n optionsRefs: RefObject<HTMLElement[]>,\n {\n selector = selectorDefault,\n isHoverable = false,\n orientation = 'horizontal',\n }: Options = {\n selector: selectorDefault,\n isHoverable: false,\n orientation: 'horizontal',\n }\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const lastPositionRef = useRef<StyleState | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n // Clear any pending hide timeout when hovering over an item\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n // Keep previous position but set opacity to 0\n if (orientation === 'vertical') {\n setChoiceIndicatorPosition((prev) => {\n const verticalPrev = prev as VerticalStyleState | null;\n const newPosition: VerticalStyleState = {\n top: verticalPrev?.top ?? 0,\n height: verticalPrev?.height ?? 0,\n opacity: 0,\n };\n lastPositionRef.current = newPosition;\n return newPosition;\n });\n } else {\n setChoiceIndicatorPosition((prev) => {\n const horizontalPrev = prev as HorizontalStyleState | null;\n const newPosition: HorizontalStyleState = {\n left: horizontalPrev?.left ?? 0,\n width: horizontalPrev?.width ?? 0,\n opacity: 0,\n };\n lastPositionRef.current = newPosition;\n return newPosition;\n });\n }\n return;\n }\n\n if (orientation === 'vertical') {\n const top = targetElement.offsetTop;\n const height = targetElement.offsetHeight;\n\n const newPosition = {\n top,\n height,\n opacity: 1,\n };\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n } else {\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n const newPosition = {\n left,\n width,\n opacity: 1,\n };\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n };\n\n useEffect(() => {\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n (mutation.attributeName === 'aria-selected' ||\n mutation.attributeName === 'data-active' ||\n mutation.attributeName === 'data-indicator')\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected', 'data-active', 'data-indicator'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n // Clear any existing timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Keep the indicator at its current position for 150ms\n // before removing the hovered item\n hideTimeoutRef.current = setTimeout(() => {\n setHoveredItem(null);\n }, 150); // 150ms delay before hiding\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [\n optionsRefs,\n selector,\n hoveredItem,\n itemsLength,\n orientation,\n isHoverable,\n ]);\n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ACF;AAGJ,eAAa;AAEX,OAAI,eAAe,QACjB,cAAa,eAAe,QAAQ;AAItC,UAAO,oBAAoB,UAAU,kBAAkB;AACvD,UAAO,oBAAoB,oBAAoB,kBAAkB;AAGjE,qBAAkB,SAAS,aAAa;AACtC,aAAS,YAAY;KACrB;AAGF,mBAAgB,SAAS,aAAa;AACpC,aAAS,YAAY;KACrB;AAGF,eAAY,QAAQ,SAAS,WAAW;AACtC,YAAQ,oBAAoB,cAAc,iBAAiB;AAC3D,YAAQ,oBAAoB,cAAc,iBAAiB;KAC3D;;IAEH;EACD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QAAO;EAAE;EAAyB;EAAmB;EAAa"}
|
|
@@ -43,9 +43,9 @@ declare enum BadgeSize {
|
|
|
43
43
|
* @description Defines the styling variants for different badge combinations
|
|
44
44
|
*/
|
|
45
45
|
declare const badgeVariants: (props?: {
|
|
46
|
-
color?: "text" | "
|
|
46
|
+
color?: "text" | "error" | "custom" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "success";
|
|
47
47
|
variant?: "none" | "default" | "hoverable" | "outline";
|
|
48
|
-
size?: "
|
|
48
|
+
size?: "lg" | "md" | "sm";
|
|
49
49
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
50
50
|
/**
|
|
51
51
|
* Badge component props interface
|
|
@@ -60,11 +60,11 @@ declare enum ButtonTextAlign {
|
|
|
60
60
|
* Enhanced button variants with improved accessibility and focus states
|
|
61
61
|
*/
|
|
62
62
|
declare const buttonVariants: (props?: {
|
|
63
|
-
size?: "
|
|
64
|
-
color?: "text" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "text-inverse" | "
|
|
65
|
-
roundedSize?: "
|
|
66
|
-
variant?: "
|
|
67
|
-
textAlign?: "left" | "
|
|
63
|
+
size?: "lg" | "md" | "sm" | "xl" | "icon-sm" | "icon-md" | "icon-lg" | "icon-xl";
|
|
64
|
+
color?: "text" | "error" | "custom" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "text-inverse" | "success" | "card" | "current";
|
|
65
|
+
roundedSize?: "lg" | "none" | "md" | "sm" | "xl" | "2xl" | "3xl" | "full" | "4xl" | "5xl";
|
|
66
|
+
variant?: "none" | "default" | "input" | "invisible-link" | "hoverable" | "link" | "outline" | "fade";
|
|
67
|
+
textAlign?: "left" | "right" | "center";
|
|
68
68
|
isFullWidth?: boolean;
|
|
69
69
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
70
70
|
/**
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
//#region src/components/CollapsibleTable/CollapsibleTable.d.ts
|
|
6
6
|
declare const collapsibleTableVariants: (props?: {
|
|
7
7
|
size?: "sm" | "md" | "lg" | "xl" | "full";
|
|
8
|
-
variant?: "default" | "
|
|
8
|
+
variant?: "default" | "ghost" | "dark" | "outlined";
|
|
9
9
|
spacing?: "none" | "sm" | "md" | "lg" | "auto";
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
11
11
|
interface CollapsibleTableProps extends Omit<HTMLAttributes<HTMLElement>, 'title'>, VariantProps<typeof collapsibleTableVariants> {
|
|
@@ -29,7 +29,7 @@ declare const Command: {
|
|
|
29
29
|
ref?: React.Ref<HTMLInputElement>;
|
|
30
30
|
} & {
|
|
31
31
|
asChild?: boolean;
|
|
32
|
-
}, "key" | keyof _$react.InputHTMLAttributes<HTMLInputElement
|
|
32
|
+
}, "key" | "asChild" | keyof _$react.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
|
|
33
33
|
value?: string;
|
|
34
34
|
onValueChange?: (search: string) => void;
|
|
35
35
|
} & _$react.RefAttributes<HTMLInputElement>>;
|
|
@@ -8,13 +8,13 @@ import { VariantProps } from "class-variance-authority";
|
|
|
8
8
|
* Provides flexible styling options for background, padding, borders, and layout
|
|
9
9
|
*/
|
|
10
10
|
declare const containerVariants: (props?: {
|
|
11
|
-
roundedSize?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "
|
|
12
|
-
transparency?: "none" | "
|
|
11
|
+
roundedSize?: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "full";
|
|
12
|
+
transparency?: "none" | "sm" | "md" | "lg" | "xl" | "full" | "xs";
|
|
13
13
|
padding?: "none" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
14
|
-
separator?: "
|
|
15
|
-
border?: "
|
|
16
|
-
borderColor?: "
|
|
17
|
-
background?: "
|
|
14
|
+
separator?: "without" | "x" | "y" | "both";
|
|
15
|
+
border?: "none" | "with";
|
|
16
|
+
borderColor?: "primary" | "secondary" | "neutral" | "card" | "text" | "error" | "warning" | "success";
|
|
17
|
+
background?: "none" | "with" | "hoverable";
|
|
18
18
|
gap?: "none" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
19
19
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
20
20
|
/** Available rounded corner sizes for the container */
|
|
@@ -5,9 +5,9 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
//#region src/components/Input/Checkbox.d.ts
|
|
6
6
|
declare const checkboxVariants: (props?: {
|
|
7
7
|
variant?: "default";
|
|
8
|
-
size?: "
|
|
9
|
-
color?: "
|
|
10
|
-
validationStyleEnabled?: "
|
|
8
|
+
size?: "sm" | "md" | "lg" | "xs";
|
|
9
|
+
color?: "primary" | "secondary" | "neutral" | "text" | "error" | "success" | "destructive" | "custom" | "dark" | "light";
|
|
10
|
+
validationStyleEnabled?: "disabled" | "enabled";
|
|
11
11
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
12
12
|
declare enum CheckboxSize {
|
|
13
13
|
XS = "xs",
|
|
@@ -6,7 +6,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
6
6
|
declare const inputVariants: (props?: {
|
|
7
7
|
variant?: "default" | "invisible";
|
|
8
8
|
size?: "sm" | "md" | "lg";
|
|
9
|
-
validationStyleEnabled?: "
|
|
9
|
+
validationStyleEnabled?: "disabled" | "enabled";
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
11
11
|
declare enum InputVariant {
|
|
12
12
|
DEFAULT = "default",
|
|
@@ -54,9 +54,9 @@ declare enum LinkUnderlined {
|
|
|
54
54
|
}
|
|
55
55
|
declare const linkVariants: (props?: {
|
|
56
56
|
variant?: "default" | "invisible-link" | "button" | "button-outlined" | "hoverable";
|
|
57
|
-
roundedSize?: "
|
|
58
|
-
color?: "text" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "text-inverse" | "
|
|
59
|
-
size?: "
|
|
57
|
+
roundedSize?: "lg" | "none" | "md" | "sm" | "xl" | "2xl" | "3xl" | "full";
|
|
58
|
+
color?: "text" | "error" | "custom" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark" | "text-inverse" | "success";
|
|
59
|
+
size?: "lg" | "md" | "custom" | "sm" | "xl";
|
|
60
60
|
underlined?: boolean | LinkUnderlined.DEFAULT;
|
|
61
61
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
62
62
|
type LinkProps = DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> & VariantProps<typeof linkVariants> & {
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
//#region src/components/Pagination/Pagination.d.ts
|
|
6
6
|
declare const paginationVariants: (props?: {
|
|
7
7
|
size?: "sm" | "md" | "lg";
|
|
8
|
-
color?: "
|
|
8
|
+
color?: "primary" | "secondary" | "neutral" | "text" | "destructive";
|
|
9
9
|
variant?: "default" | "bordered" | "ghost";
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
11
11
|
declare enum PaginationSize {
|
|
@@ -2,6 +2,7 @@ import { HTMLAttributes, ReactNode } from "react";
|
|
|
2
2
|
import * as _$class_variance_authority_types0 from "class-variance-authority/types";
|
|
3
3
|
import { VariantProps } from "class-variance-authority";
|
|
4
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import { ItemSelectorOrientation } from "@hooks/useItemSelector";
|
|
5
6
|
|
|
6
7
|
//#region src/components/SwitchSelector/index.d.ts
|
|
7
8
|
type SwitchSelectorChoice<T = boolean> = {
|
|
@@ -18,6 +19,7 @@ type SwitchSelectorProps<T = boolean> = {
|
|
|
18
19
|
itemClassName?: string;
|
|
19
20
|
hoverable?: boolean;
|
|
20
21
|
disabled?: boolean;
|
|
22
|
+
orientation?: ItemSelectorOrientation;
|
|
21
23
|
} & VariantProps<typeof switchSelectorVariant> & VariantProps<typeof choiceVariant>;
|
|
22
24
|
declare enum SwitchSelectorColor {
|
|
23
25
|
PRIMARY = "primary",
|
|
@@ -30,6 +32,7 @@ declare enum SwitchSelectorColor {
|
|
|
30
32
|
}
|
|
31
33
|
declare const switchSelectorVariant: (props?: {
|
|
32
34
|
color?: "text" | "primary" | "secondary" | "destructive" | "neutral" | "light" | "dark";
|
|
35
|
+
orientation?: "horizontal" | "vertical";
|
|
33
36
|
disabled?: boolean;
|
|
34
37
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
35
38
|
declare enum SwitchSelectorSize {
|
|
@@ -38,7 +41,8 @@ declare enum SwitchSelectorSize {
|
|
|
38
41
|
LG = "lg"
|
|
39
42
|
}
|
|
40
43
|
declare const choiceVariant: (props?: {
|
|
41
|
-
size?: "
|
|
44
|
+
size?: "lg" | "md" | "sm";
|
|
45
|
+
orientation?: "horizontal" | "vertical";
|
|
42
46
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
43
47
|
/**
|
|
44
48
|
*
|
|
@@ -67,7 +71,8 @@ declare const SwitchSelector: <T>({
|
|
|
67
71
|
className,
|
|
68
72
|
itemClassName,
|
|
69
73
|
hoverable,
|
|
70
|
-
disabled
|
|
74
|
+
disabled,
|
|
75
|
+
orientation
|
|
71
76
|
}: SwitchSelectorProps<T>) => _$react_jsx_runtime0.JSX.Element;
|
|
72
77
|
//#endregion
|
|
73
78
|
export { SwitchSelector, SwitchSelectorChoice, SwitchSelectorChoices, SwitchSelectorColor, SwitchSelectorProps, SwitchSelectorSize };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/components/SwitchSelector/index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/components/SwitchSelector/index.tsx"],"mappings":";;;;;;;KAgBY,oBAAA;EACV,OAAA,EAAS,SAAA;EACT,KAAA,EAAO,CAAA;AAAA,IACL,cAAA,CAAe,iBAAA;AAAA,KACP,qBAAA,MAA2B,oBAAA,CAAqB,CAAA;AAAA,KAOhD,mBAAA;EACV,OAAA,GAAU,qBAAA,CAAsB,CAAA;EAChC,KAAA,GAAQ,CAAA;EACR,YAAA,GAAe,CAAA;EACf,QAAA,IAAY,MAAA,EAAQ,CAAA;EACpB,SAAA;EACA,aAAA;EACA,SAAA;EACA,QAAA;EACA,WAAA,GAAc,uBAAA;AAAA,IACZ,YAAA,QAAoB,qBAAA,IACtB,YAAA,QAAoB,aAAA;AAAA,aAEV,mBAAA;EACV,OAAA;EACA,SAAA;EACA,WAAA;EACA,OAAA;EACA,KAAA;EACA,IAAA;EACA,IAAA;AAAA;AAAA,cAGI,qBAAA,GAAqB,KAAA;;;;IA6B1B,iCAAA,CAAA,SAAA;AAAA,aAEW,kBAAA;EACV,EAAA;EACA,EAAA;EACA,EAAA;AAAA;AAAA,cAGI,aAAA,GAAa,KAAA;;;IAmBlB,iCAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;cAkDY,cAAA;EAAsB,OAAA;EAAA,KAAA;EAAA,YAAA;EAAA,QAAA;EAAA,KAAA;EAAA,IAAA;EAAA,SAAA;EAAA,aAAA;EAAA,SAAA;EAAA,QAAA;EAAA;AAAA,GAYhC,mBAAA,CAAoB,CAAA,MAAE,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -5,7 +5,7 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/Tab/Tab.d.ts
|
|
7
7
|
declare const tabContainerVariant: (props?: {
|
|
8
|
-
background?: "
|
|
8
|
+
background?: "without" | "with";
|
|
9
9
|
variant?: "default" | "bordered" | "ghost";
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
11
11
|
type TabProps = HTMLAttributes<HTMLDivElement> & VariantProps<typeof tabContainerVariant> & {
|
|
@@ -15,7 +15,7 @@ declare enum TabSelectorColor {
|
|
|
15
15
|
TEXT = "text"
|
|
16
16
|
}
|
|
17
17
|
declare const tabSelectorVariant: (props?: {
|
|
18
|
-
color?: "
|
|
18
|
+
color?: "primary" | "secondary" | "neutral" | "text" | "destructive" | "dark" | "light";
|
|
19
19
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
20
20
|
type TabSelectorItemProps = HTMLAttributes<HTMLElement> & {
|
|
21
21
|
key: string | number;
|
|
@@ -185,9 +185,9 @@ declare enum TagBackground {
|
|
|
185
185
|
WITH = "with"
|
|
186
186
|
}
|
|
187
187
|
declare const containerVariants: (props?: {
|
|
188
|
-
roundedSize?: "
|
|
189
|
-
color?: "text" | "
|
|
190
|
-
size?: "
|
|
188
|
+
roundedSize?: "lg" | "none" | "md" | "sm" | "xl" | "2xl" | "3xl" | "full";
|
|
189
|
+
color?: "text" | "error" | "primary" | "neutral" | "success" | "warning" | "blue" | "yellow" | "green" | "red" | "orange" | "purple" | "pink" | "brown" | "gray" | "black" | "white";
|
|
190
|
+
size?: "lg" | "md" | "sm" | "xl" | "xs";
|
|
191
191
|
border?: "none" | "with";
|
|
192
192
|
background?: "none" | "with";
|
|
193
193
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
@@ -25,7 +25,7 @@ declare const ToastViewport: FC<ComponentProps<typeof ToastPrimitives.Viewport>>
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
declare const toastVariants: (props?: {
|
|
28
|
-
variant?: "error" | "
|
|
28
|
+
variant?: "error" | "success" | "default";
|
|
29
29
|
} & _$class_variance_authority_types0.ClassProp) => string;
|
|
30
30
|
/**
|
|
31
31
|
* Toast Component
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/design-system",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Intlayer design system, including UI components used in the Intlayer editor, website, and visual editor/CMS.",
|
|
6
6
|
"keywords": [
|
|
@@ -421,12 +421,12 @@
|
|
|
421
421
|
"dependencies": {
|
|
422
422
|
"@better-auth/passkey": "1.6.9",
|
|
423
423
|
"@better-auth/sso": "1.6.9",
|
|
424
|
-
"@intlayer/api": "8.7.
|
|
425
|
-
"@intlayer/config": "8.7.
|
|
426
|
-
"@intlayer/core": "8.7.
|
|
427
|
-
"@intlayer/dictionaries-entry": "8.7.
|
|
428
|
-
"@intlayer/editor-react": "8.7.
|
|
429
|
-
"@intlayer/types": "8.7.
|
|
424
|
+
"@intlayer/api": "8.7.12",
|
|
425
|
+
"@intlayer/config": "8.7.12",
|
|
426
|
+
"@intlayer/core": "8.7.12",
|
|
427
|
+
"@intlayer/dictionaries-entry": "8.7.12",
|
|
428
|
+
"@intlayer/editor-react": "8.7.12",
|
|
429
|
+
"@intlayer/types": "8.7.12",
|
|
430
430
|
"@radix-ui/react-dialog": "1.1.15",
|
|
431
431
|
"@radix-ui/react-select": "2.2.6",
|
|
432
432
|
"@radix-ui/react-slot": "1.2.4",
|
|
@@ -435,12 +435,12 @@
|
|
|
435
435
|
"better-auth": "1.6.9",
|
|
436
436
|
"class-variance-authority": "0.7.1",
|
|
437
437
|
"cmdk": "1.1.1",
|
|
438
|
-
"react-intlayer": "8.7.
|
|
438
|
+
"react-intlayer": "8.7.12",
|
|
439
439
|
"rollup-preserve-directives": "1.1.3",
|
|
440
440
|
"zod": "4.3.6"
|
|
441
441
|
},
|
|
442
442
|
"devDependencies": {
|
|
443
|
-
"@intlayer/backend": "8.7.
|
|
443
|
+
"@intlayer/backend": "8.7.12",
|
|
444
444
|
"@shikijs/transformers": "4.0.2",
|
|
445
445
|
"@storybook/addon-a11y": "8.6.14",
|
|
446
446
|
"@storybook/addon-essentials": "8.6.14",
|
|
@@ -470,7 +470,7 @@
|
|
|
470
470
|
"@utils/ts-config-types": "1.0.4",
|
|
471
471
|
"clsx": "2.1.1",
|
|
472
472
|
"fast-glob": "3.3.3",
|
|
473
|
-
"intlayer": "8.7.
|
|
473
|
+
"intlayer": "8.7.12",
|
|
474
474
|
"rimraf": "6.1.3",
|
|
475
475
|
"shiki": "4.0.2",
|
|
476
476
|
"storybook": "8.6.17",
|
|
@@ -478,26 +478,26 @@
|
|
|
478
478
|
"tsdown": "0.21.10",
|
|
479
479
|
"typescript": "6.0.3",
|
|
480
480
|
"vite": "8.0.10",
|
|
481
|
-
"vite-intlayer": "8.7.
|
|
481
|
+
"vite-intlayer": "8.7.12",
|
|
482
482
|
"vite-plugin-dts": "4.5.4",
|
|
483
483
|
"vitest": "4.1.5"
|
|
484
484
|
},
|
|
485
485
|
"peerDependencies": {
|
|
486
486
|
"@better-fetch/fetch": "1.1.21",
|
|
487
487
|
"@hookform/resolvers": "5.2.2",
|
|
488
|
-
"@intlayer/backend": "8.7.
|
|
488
|
+
"@intlayer/backend": "8.7.12",
|
|
489
489
|
"@monaco-editor/react": "4.7.0",
|
|
490
490
|
"@shikijs/transformers": "4.0.2",
|
|
491
491
|
"@tanstack/react-query": "5.100.6",
|
|
492
492
|
"@tanstack/react-query-devtools": "5.100.6",
|
|
493
493
|
"framer-motion": "12.38.0",
|
|
494
494
|
"fuse.js": "7.3.0",
|
|
495
|
-
"intlayer": "8.7.
|
|
495
|
+
"intlayer": "8.7.12",
|
|
496
496
|
"lucide-react": "1.12.0",
|
|
497
497
|
"react": ">=16.0.0",
|
|
498
498
|
"react-dom": ">=16.0.0",
|
|
499
499
|
"react-hook-form": "7.74.0",
|
|
500
|
-
"react-intlayer": "8.7.
|
|
500
|
+
"react-intlayer": "8.7.12",
|
|
501
501
|
"shiki": "4.0.2",
|
|
502
502
|
"tailwindcss": "4.2.4"
|
|
503
503
|
},
|