@gridui/choice 1.2.1 → 1.2.4

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/README.md CHANGED
@@ -38,3 +38,10 @@ Use [Switch, SwitchGroup and SwitchPanel](docs/switches.md) for independent
38
38
  boolean settings. All three support the `rail` and `state` variants and share
39
39
  native form, reset, cancellation and accessibility behavior. They do not share
40
40
  a selected value or implement radio-style keyboard navigation.
41
+
42
+ ## Structural boundaries
43
+
44
+ SwitchGroup and SwitchPanel keep their outer frame and internal separators at
45
+ full opacity when a setting is disabled, including inherited fieldset disabling.
46
+ Only the setting copy and indicator are dimmed. Standalone Switch retains its
47
+ whole-control disabled appearance.
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
  export type { CheckboxProps } from "./checkbox/checkbox";
8
8
  export { Checkbox } from "./checkbox/checkbox";
9
- export type { SwitchStateLabels, SwitchVariant } from "./shared/switch-presentation";
9
+ export type { SwitchStateLabels, SwitchVariant } from "./shared/switch-options";
10
10
  export type { SwitchProps } from "./switch/switch";
11
11
  export { Switch } from "./switch/switch";
12
12
  export type { SwitchGroupItem, SwitchGroupProps } from "./switch-group/switch-group";
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ var useChoice = (props) => {
49
49
 
50
50
  // src/checkbox/style.ts
51
51
  import { cva } from "class-variance-authority";
52
- var choiceStyles = cva("gridui-u-inline-flex gridui-u-size-5 gridui-u-shrink-0 gridui-u-cursor-pointer gridui-u-items-center gridui-u-justify-center gridui-u-rounded-control gridui-u-border gridui-u-border-control-border gridui-u-bg-background gridui-u-text-foreground gridui-u-align-middle gridui-u-data-[state=checked]:bg-accent-background gridui-u-data-[state=checked]:text-accent-foreground gridui-u-data-[state=indeterminate]:bg-accent-background gridui-u-data-[state=indeterminate]:text-accent-foreground gridui-u-data-disabled:cursor-not-allowed gridui-u-data-disabled:opacity-50 gridui-u-data-readonly:cursor-default gridui-u-aria-invalid:border-danger-foreground");
52
+ var choiceStyles = cva("gridui-u-choice--inline-flex gridui-u-choice--size-5 gridui-u-choice--shrink-0 gridui-u-choice--cursor-pointer gridui-u-choice--items-center gridui-u-choice--justify-center gridui-u-choice--rounded-control gridui-u-choice--border gridui-u-choice--border-control-border gridui-u-choice--bg-background gridui-u-choice--text-foreground gridui-u-choice--align-middle gridui-u-choice--data-[state=checked]:bg-accent-background gridui-u-choice--data-[state=checked]:text-accent-foreground gridui-u-choice--data-[state=indeterminate]:bg-accent-background gridui-u-choice--data-[state=indeterminate]:text-accent-foreground gridui-u-choice--data-disabled:cursor-not-allowed gridui-u-choice--data-disabled:opacity-50 gridui-u-choice--data-readonly:cursor-default gridui-u-choice--aria-invalid:border-danger-foreground");
53
53
 
54
54
  // src/checkbox/checkbox.tsx
55
55
  import { cn } from "@gridui/style-utils";
@@ -118,7 +118,7 @@ var Checkbox = (props) => {
118
118
  {
119
119
  ref: input,
120
120
  type: "checkbox",
121
- className: "gridui-u-sr-only",
121
+ className: "gridui-u-choice--sr-only",
122
122
  tabIndex: -1,
123
123
  "aria-hidden": "true",
124
124
  name,
@@ -205,7 +205,7 @@ var SwitchControl = (props) => {
205
205
  {
206
206
  ref: input,
207
207
  type: "checkbox",
208
- className: "gridui-u-sr-only",
208
+ className: "gridui-u-choice--sr-only",
209
209
  tabIndex: -1,
210
210
  "aria-hidden": "true",
211
211
  name,
@@ -245,7 +245,7 @@ var SwitchIndicator = (props) => {
245
245
  return /* @__PURE__ */ jsx3(
246
246
  "span",
247
247
  {
248
- className: "gridui-switch-indicator gridui-u-type-caption",
248
+ className: "gridui-switch-indicator gridui-u-choice--type-caption",
249
249
  "data-variant": variant,
250
250
  "data-state": checked ? "checked" : "unchecked",
251
251
  "aria-hidden": "true",
@@ -280,7 +280,7 @@ var SwitchIndicator = (props) => {
280
280
 
281
281
  // src/switch/style.ts
282
282
  import { cva as cva2 } from "class-variance-authority";
283
- var switchStyles = cva2("gridui-switch gridui-u-inline-flex gridui-u-w-fit gridui-u-max-w-full gridui-u-min-h-gridui-control gridui-u-min-w-gridui-control gridui-u-shrink-0 gridui-u-items-center gridui-u-justify-center gridui-u-border-0 gridui-u-bg-transparent gridui-u-p-0 gridui-u-align-middle gridui-u-rounded-control");
283
+ var switchStyles = cva2("gridui-switch gridui-u-choice--inline-flex gridui-u-choice--w-fit gridui-u-choice--max-w-full gridui-u-choice--min-h-gridui-control gridui-u-choice--min-w-gridui-control gridui-u-choice--shrink-0 gridui-u-choice--items-center gridui-u-choice--justify-center gridui-u-choice--border-0 gridui-u-choice--bg-transparent gridui-u-choice--p-0 gridui-u-choice--align-middle gridui-u-choice--rounded-control");
284
284
 
285
285
  // src/switch/switch.tsx
286
286
  import { cn as cn3 } from "@gridui/style-utils";
@@ -339,7 +339,7 @@ var SwitchSetting = (props) => {
339
339
  "span",
340
340
  {
341
341
  id: labelId,
342
- className: "gridui-u-type-ui",
342
+ className: "gridui-u-choice--type-ui",
343
343
  children: label
344
344
  }
345
345
  ),
@@ -347,7 +347,7 @@ var SwitchSetting = (props) => {
347
347
  "span",
348
348
  {
349
349
  id: descriptionId,
350
- className: "gridui-switch-setting-description gridui-u-type-supporting",
350
+ className: "gridui-switch-setting-description gridui-u-choice--type-supporting",
351
351
  children: description
352
352
  }
353
353
  )
@@ -389,7 +389,7 @@ var SwitchGroup = (props) => {
389
389
  legend !== void 0 && legend !== null && /* @__PURE__ */ jsx6(
390
390
  "legend",
391
391
  {
392
- className: "gridui-switch-group-legend gridui-u-type-ui",
392
+ className: "gridui-switch-group-legend gridui-u-choice--type-ui",
393
393
  children: legend
394
394
  }
395
395
  ),
@@ -455,11 +455,11 @@ var ToggleGroupContext = createContext("standard");
455
455
 
456
456
  // src/toggle-group/style.ts
457
457
  import { cva as cva3 } from "class-variance-authority";
458
- var toggleGroupStyles = cva3("gridui-toggle-group gridui-u-inline-flex gridui-u-max-w-full gridui-u-flex-wrap gridui-u-gap-px gridui-u-border gridui-u-border-border gridui-u-bg-border gridui-u-data-[orientation=vertical]:flex-col", {
458
+ var toggleGroupStyles = cva3("gridui-toggle-group gridui-u-choice--inline-flex gridui-u-choice--max-w-full gridui-u-choice--flex-wrap gridui-u-choice--gap-px gridui-u-choice--border gridui-u-choice--border-border gridui-u-choice--bg-border gridui-u-choice--data-[orientation=vertical]:flex-col", {
459
459
  variants: {
460
460
  layout: {
461
461
  standard: "",
462
- cells: "gridui-u-grid gridui-u-w-full gridui-u-grid-flow-col gridui-u-auto-cols-fr gridui-u-data-[orientation=vertical]:grid-flow-row gridui-u-data-[orientation=vertical]:auto-rows-fr gridui-u-data-[orientation=vertical]:grid-cols-1"
462
+ cells: "gridui-u-choice--grid gridui-u-choice--w-full gridui-u-choice--grid-flow-col gridui-u-choice--auto-cols-fr gridui-u-choice--data-[orientation=vertical]:grid-flow-row gridui-u-choice--data-[orientation=vertical]:auto-rows-fr gridui-u-choice--data-[orientation=vertical]:grid-cols-1"
463
463
  }
464
464
  },
465
465
  defaultVariants: { layout: "standard" }
@@ -505,11 +505,11 @@ var ToggleGroup = (props) => {
505
505
 
506
506
  // src/toggle-group-item/style.ts
507
507
  import { cva as cva4 } from "class-variance-authority";
508
- var toggleStyles = cva4("gridui-u-min-h-gridui-control gridui-u-cursor-pointer gridui-u-border-0 gridui-u-bg-background gridui-u-px-gridui-16 gridui-u-py-gridui-8 gridui-u-text-foreground gridui-u-type-ui gridui-u-data-[state=on]:bg-brand-tint gridui-u-data-[state=on]:text-foreground gridui-u-data-disabled:cursor-not-allowed gridui-u-data-disabled:opacity-50", {
508
+ var toggleStyles = cva4("gridui-u-choice--min-h-gridui-control gridui-u-choice--cursor-pointer gridui-u-choice--border-0 gridui-u-choice--bg-background gridui-u-choice--px-gridui-16 gridui-u-choice--py-gridui-8 gridui-u-choice--text-foreground gridui-u-choice--type-ui gridui-u-choice--data-[state=on]:bg-brand-tint gridui-u-choice--data-[state=on]:text-foreground gridui-u-choice--data-disabled:cursor-not-allowed gridui-u-choice--data-disabled:opacity-50", {
509
509
  variants: {
510
510
  layout: {
511
- standard: "",
512
- cells: "gridui-u-w-full gridui-u-min-w-0 gridui-u-whitespace-normal gridui-u-wrap-anywhere gridui-u-border-x-0 gridui-u-border-t-0 gridui-u-border-solid gridui-u-border-transparent gridui-u-px-gridui-8 gridui-u-py-gridui-16 gridui-u-text-center gridui-u-data-[orientation=horizontal]:border-b-2 gridui-u-data-[orientation=vertical]:border-b-0 gridui-u-data-[orientation=vertical]:border-r-2 gridui-u-rtl:data-[orientation=vertical]:border-r-0 gridui-u-rtl:data-[orientation=vertical]:border-l-2 gridui-u-data-[state=on]:font-medium"
511
+ standard: "gridui-u-choice--grow gridui-u-choice--basis-auto gridui-u-choice--min-w-0 gridui-u-choice--max-w-full gridui-u-choice--whitespace-normal gridui-u-choice--wrap-anywhere",
512
+ cells: "gridui-u-choice--w-full gridui-u-choice--min-w-0 gridui-u-choice--whitespace-normal gridui-u-choice--wrap-anywhere gridui-u-choice--border-x-0 gridui-u-choice--border-t-0 gridui-u-choice--border-solid gridui-u-choice--border-transparent gridui-u-choice--px-gridui-8 gridui-u-choice--py-gridui-16 gridui-u-choice--text-center gridui-u-choice--data-[orientation=horizontal]:border-b-2 gridui-u-choice--data-[orientation=vertical]:border-b-0 gridui-u-choice--data-[orientation=vertical]:border-r-2 gridui-u-choice--rtl:data-[orientation=vertical]:border-r-0 gridui-u-choice--rtl:data-[orientation=vertical]:border-l-2 gridui-u-choice--data-[state=on]:font-medium"
513
513
  }
514
514
  },
515
515
  defaultVariants: {
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/shared/use-choice.ts", "../src/checkbox/style.ts", "../src/checkbox/checkbox.tsx", "../src/shared/switch-control.tsx", "../src/shared/switch-indicator.tsx", "../src/switch/style.ts", "../src/switch/switch.tsx", "../src/shared/switch-setting.tsx", "../src/switch-group/switch-group.tsx", "../src/switch-panel/switch-panel.tsx", "../src/shared/context.ts", "../src/toggle-group/style.ts", "../src/toggle-group/toggle-group.tsx", "../src/toggle-group-item/style.ts", "../src/toggle-group-item/toggle-group-item.tsx"],
4
- "sourcesContent": ["/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Use Choice\n */\n\nimport { focusInvalidControl, useFormReset } from \"@gridui/form\";\nimport { type ChangeDetails, changeDetails } from \"@gridui/interaction\";\nimport { type ComponentPropsWithRef, type Ref, type SyntheticEvent, useImperativeHandle, useRef, useState } from \"react\";\n\nexport type ChoiceProps = Omit<ComponentPropsWithRef<\"button\">, \"children\" | \"onChange\" | \"defaultChecked\"> & {\n readonly checked?: boolean | undefined;\n readonly defaultChecked?: boolean | undefined;\n readonly readOnly?: boolean | undefined;\n readonly required?: boolean | undefined;\n readonly uncheckedValue?: string | undefined;\n readonly inputRef?: Ref<HTMLInputElement> | undefined;\n readonly onCheckedChange?: ((checked: boolean, details: ChangeDetails) => void) | undefined;\n};\n\nexport const useChoice = (props: ChoiceProps) => {\n const { checked, defaultChecked = false, onCheckedChange, readOnly, disabled, inputRef, form } = props;\n const [\n local,\n setLocal,\n ] = useState(defaultChecked);\n const input = useRef<HTMLInputElement>(null);\n const control = useRef<HTMLButtonElement>(null);\n const initial = useRef(defaultChecked);\n useImperativeHandle(props.ref, () => {\n return control.current as HTMLButtonElement;\n });\n useImperativeHandle(inputRef, () => {\n return input.current as HTMLInputElement;\n });\n useFormReset(input, () => {\n if (checked === undefined) {\n setLocal(initial.current);\n }\n }, form);\n const current = checked ?? local;\n const invalid = (event: SyntheticEvent<HTMLInputElement>) => {\n focusInvalidControl(event, () => {\n control.current?.focus();\n });\n };\n const change = (next: boolean, event: Event) => {\n if (readOnly || disabled || input.current?.matches(\":disabled\")) {\n return;\n }\n const details = changeDetails(event);\n onCheckedChange?.(next, details);\n if (!details.isCanceled && checked === undefined) {\n setLocal(next);\n }\n };\n return {\n current,\n input,\n control,\n change,\n invalid,\n };\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Checkbox\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const choiceStyles = cva(\"gridui-u-inline-flex gridui-u-size-5 gridui-u-shrink-0 gridui-u-cursor-pointer gridui-u-items-center gridui-u-justify-center gridui-u-rounded-control gridui-u-border gridui-u-border-control-border gridui-u-bg-background gridui-u-text-foreground gridui-u-align-middle gridui-u-data-[state=checked]:bg-accent-background gridui-u-data-[state=checked]:text-accent-foreground gridui-u-data-[state=indeterminate]:bg-accent-background gridui-u-data-[state=indeterminate]:text-accent-foreground gridui-u-data-disabled:cursor-not-allowed gridui-u-data-disabled:opacity-50 gridui-u-data-readonly:cursor-default gridui-u-aria-invalid:border-danger-foreground\");\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Checkbox\n * @description Checkbox\n */\n\nimport { type ChoiceProps, useChoice } from \"../shared/use-choice\";\nimport { choiceStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-checkbox\";\nimport { Check, Minus } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type CheckboxProps = ChoiceProps & {\n readonly indeterminate?: boolean | undefined;\n};\n\nexport const Checkbox: FC<CheckboxProps> = (props: CheckboxProps) => {\n const { className, indeterminate, inputRef, onCheckedChange, checked, defaultChecked,\n readOnly, uncheckedValue, name, value = \"on\", form, required, onClick, ...restProps } = props;\n const { current, input, control, change, invalid } = useChoice({\n ...props,\n inputRef,\n onCheckedChange,\n checked,\n defaultChecked,\n });\n return (<>\n <Primitive.Root\n {...restProps}\n ref={control}\n checked={indeterminate ? \"indeterminate\" : current}\n aria-required={required}\n aria-readonly={readOnly}\n data-readonly={readOnly ? \"\" : undefined}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n change(indeterminate ? true : !current, event.nativeEvent);\n }\n event.preventDefault();\n }}\n className={cn(choiceStyles(), className)}\n >\n <Primitive.Indicator>\n {indeterminate ? (<Minus\n size={16}\n aria-hidden=\"true\"\n />) : (<Check\n size={16}\n aria-hidden=\"true\"\n />)}\n </Primitive.Indicator>\n </Primitive.Root>\n <input\n ref={input}\n type=\"checkbox\"\n className=\"gridui-u-sr-only\"\n tabIndex={-1}\n aria-hidden=\"true\"\n name={name}\n value={value}\n form={form}\n required={required}\n disabled={props.disabled}\n checked={current}\n readOnly={readOnly}\n onInvalid={invalid}\n onChange={(event) => {\n change(event.target.checked, event.nativeEvent);\n }}\n />\n {!current && uncheckedValue !== undefined && (<input\n type=\"hidden\"\n name={name}\n form={form}\n value={uncheckedValue}\n disabled={props.disabled}\n />)}\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Switch Control\n */\n\nimport { type ChoiceProps, useChoice } from \"./use-choice\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC, ReactNode } from \"react\";\n\nexport type SwitchControlProps = ChoiceProps & {\n readonly children: (checked: boolean) => ReactNode;\n};\n\nexport const SwitchControl: FC<SwitchControlProps> = (props: SwitchControlProps) => {\n const { children, className, inputRef, onCheckedChange, checked, defaultChecked,\n readOnly, uncheckedValue, name, value = \"on\", form, required, onClick, type = \"button\", ...restProps } = props;\n const { current, input, control, change, invalid } = useChoice({\n ...props,\n inputRef,\n onCheckedChange,\n checked,\n defaultChecked,\n });\n return (<>\n <button\n {...restProps}\n ref={control}\n type={type}\n role=\"switch\"\n aria-checked={current}\n data-state={current ? \"checked\" : \"unchecked\"}\n data-disabled={props.disabled ? \"\" : undefined}\n aria-required={required}\n aria-readonly={readOnly}\n data-readonly={readOnly ? \"\" : undefined}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n change(!current, event.nativeEvent);\n }\n event.preventDefault();\n }}\n className={cn(\"gridui-switch-control\", className)}\n >\n {children(current)}\n </button>\n <input\n ref={input}\n type=\"checkbox\"\n className=\"gridui-u-sr-only\"\n tabIndex={-1}\n aria-hidden=\"true\"\n name={name}\n value={value}\n form={form}\n required={required}\n disabled={props.disabled}\n checked={current}\n readOnly={readOnly}\n onInvalid={invalid}\n onChange={(event) => {\n change(event.target.checked, event.nativeEvent);\n }}\n />\n {!current && uncheckedValue !== undefined && (<input\n type=\"hidden\"\n name={name}\n form={form}\n value={uncheckedValue}\n disabled={props.disabled}\n />)}\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Switch Indicator\n */\n\nimport type { SwitchPresentationProps } from \"./switch-presentation\";\nimport { Check, Minus } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type SwitchIndicatorProps = SwitchPresentationProps & {\n readonly checked: boolean;\n};\n\nexport const SwitchIndicator: FC<SwitchIndicatorProps> = (props: SwitchIndicatorProps) => {\n const { checked, variant = \"rail\", stateLabels = {\n checked: \"On\",\n unchecked: \"Off\",\n } } = props;\n return (<span\n className=\"gridui-switch-indicator gridui-u-type-caption\"\n data-variant={variant}\n data-state={checked ? \"checked\" : \"unchecked\"}\n aria-hidden=\"true\"\n >\n {variant === \"rail\" ? (<span\n className=\"gridui-switch-thumb\"\n />) : (<>\n {checked ? (<Check\n className=\"gridui-switch-state-icon\"\n />) : (<Minus\n className=\"gridui-switch-state-icon\"\n />)}\n <span\n className=\"gridui-switch-state-label\"\n >\n {checked ? stateLabels.checked : stateLabels.unchecked}\n </span>\n </>)}\n </span>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Switch\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const switchStyles = cva(\"gridui-switch gridui-u-inline-flex gridui-u-w-fit gridui-u-max-w-full gridui-u-min-h-gridui-control gridui-u-min-w-gridui-control gridui-u-shrink-0 gridui-u-items-center gridui-u-justify-center gridui-u-border-0 gridui-u-bg-transparent gridui-u-p-0 gridui-u-align-middle gridui-u-rounded-control\");\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Switch\n * @description Switch\n */\n\nimport { SwitchControl } from \"../shared/switch-control\";\nimport { SwitchIndicator } from \"../shared/switch-indicator\";\nimport type { SwitchPresentationProps } from \"../shared/switch-presentation\";\nimport type { ChoiceProps } from \"../shared/use-choice\";\nimport { switchStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC } from \"react\";\n\nexport type SwitchProps = ChoiceProps & SwitchPresentationProps;\n\nexport const Switch: FC<SwitchProps> = (props: SwitchProps) => {\n const { variant, stateLabels, className, ...restProps } = props;\n return (<SwitchControl\n {...restProps}\n className={cn(switchStyles(), className)}\n >\n {(checked) => {\n return (<SwitchIndicator\n checked={checked}\n variant={variant}\n stateLabels={stateLabels}\n />);\n }}\n </SwitchControl>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Switch Setting\n */\n\nimport type { SwitchProps } from \"../switch/switch\";\nimport { SwitchControl } from \"./switch-control\";\nimport { SwitchIndicator } from \"./switch-indicator\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type FC, type ReactNode, useId } from \"react\";\n\nexport type SwitchSettingProps = {\n readonly control: SwitchProps;\n readonly label: ReactNode;\n readonly description?: ReactNode;\n};\n\nexport const SwitchSetting: FC<SwitchSettingProps> = (props: SwitchSettingProps) => {\n const { control, label, description } = props;\n const { variant, stateLabels, className, ...controlProps } = control;\n const id = useId();\n const labelId = `${id}-label`;\n const descriptionId = `${id}-description`;\n const hasDescription = description !== undefined && description !== null;\n const describedBy = [\n controlProps[\"aria-describedby\"],\n hasDescription ? descriptionId : undefined,\n ].filter(Boolean).join(\" \") || undefined;\n return (<SwitchControl\n {...controlProps}\n className={cn(\"gridui-switch-setting\", className)}\n aria-labelledby={controlProps[\"aria-labelledby\"] ?? (controlProps[\"aria-label\"] ? undefined : labelId)}\n aria-describedby={describedBy}\n >\n {(checked) => {\n return (<>\n <span\n className=\"gridui-switch-setting-copy\"\n >\n <span\n id={labelId}\n className=\"gridui-u-type-ui\"\n >\n {label}\n </span>\n {hasDescription && (<span\n id={descriptionId}\n className=\"gridui-switch-setting-description gridui-u-type-supporting\"\n >\n {description}\n </span>)}\n </span>\n <span\n className=\"gridui-switch-setting-end\"\n >\n <SwitchIndicator\n checked={checked}\n variant={variant}\n stateLabels={stateLabels}\n />\n </span>\n </>);\n }}\n </SwitchControl>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace SwitchGroup\n * @description Switch Group\n */\n\nimport type { SwitchPresentationProps } from \"../shared/switch-presentation\";\nimport { SwitchSetting } from \"../shared/switch-setting\";\nimport type { SwitchProps } from \"../switch/switch\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC, ReactNode } from \"react\";\n\nexport type SwitchGroupItem = SwitchProps & {\n /** Stable item identity and native control ID. */\n readonly id: string;\n readonly label: ReactNode;\n readonly description?: ReactNode;\n};\n\nexport type SwitchGroupProps = Omit<ComponentPropsWithRef<\"fieldset\">, \"children\"> & SwitchPresentationProps & {\n readonly items: readonly SwitchGroupItem[];\n readonly legend?: ReactNode;\n readonly density?: \"compact\" | \"comfortable\";\n};\n\nexport const SwitchGroup: FC<SwitchGroupProps> = (props: SwitchGroupProps) => {\n const { items, legend, density = \"compact\", variant, stateLabels, className, ...restProps } = props;\n return (<fieldset\n {...restProps}\n className={cn(\"gridui-switch-group\", className)}\n data-density={density}\n >\n {legend !== undefined && legend !== null && (<legend\n className=\"gridui-switch-group-legend gridui-u-type-ui\"\n >\n {legend}\n </legend>)}\n {items.map((item) => {\n const { label, description, ...control } = item;\n return (<SwitchSetting\n key={item.id}\n label={label}\n description={description}\n control={{\n ...control,\n variant: item.variant ?? variant,\n stateLabels: item.stateLabels ?? stateLabels,\n }}\n />);\n })}\n </fieldset>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace SwitchPanel\n * @description Switch Panel\n */\n\nimport { SwitchSetting } from \"../shared/switch-setting\";\nimport type { SwitchProps } from \"../switch/switch\";\nimport { cn } from \"@gridui/style-utils\";\nimport { Children, type ComponentPropsWithRef, type FC, type ReactNode } from \"react\";\n\nexport type SwitchPanelProps = ComponentPropsWithRef<\"div\"> & {\n readonly label: ReactNode;\n readonly description?: ReactNode;\n /** State, form attributes, accessible overrides and ref for the switch button. */\n readonly control: SwitchProps;\n};\n\nexport const SwitchPanel: FC<SwitchPanelProps> = (props: SwitchPanelProps) => {\n const { label, description, control, children, className, ...restProps } = props;\n const hasContent = Children.toArray(children).some((child) => {\n return child !== \"\";\n });\n return (<div\n {...restProps}\n className={cn(\"gridui-switch-panel\", className)}\n >\n <SwitchSetting\n label={label}\n description={description}\n control={control}\n />\n {hasContent && (<div\n className=\"gridui-switch-panel-content\"\n >\n {children}\n </div>)}\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Context\n */\n\nimport { createContext } from \"react\";\n\nexport const ToggleGroupContext = createContext<\"standard\" | \"cells\">(\"standard\");\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace ToggleGroup\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const toggleGroupStyles = cva(\"gridui-toggle-group gridui-u-inline-flex gridui-u-max-w-full gridui-u-flex-wrap gridui-u-gap-px gridui-u-border gridui-u-border-border gridui-u-bg-border gridui-u-data-[orientation=vertical]:flex-col\", {\n variants: {\n layout: {\n standard: \"\",\n cells: \"gridui-u-grid gridui-u-w-full gridui-u-grid-flow-col gridui-u-auto-cols-fr gridui-u-data-[orientation=vertical]:grid-flow-row gridui-u-data-[orientation=vertical]:auto-rows-fr gridui-u-data-[orientation=vertical]:grid-cols-1\",\n },\n },\n defaultVariants: { layout: \"standard\" },\n});\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace ToggleGroup\n * @description Toggle Group\n */\n\nimport { ToggleGroupContext } from \"../shared/context\";\nimport { toggleGroupStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-toggle-group\";\nimport { type ComponentPropsWithRef, type FC, useState } from \"react\";\n\nexport type ToggleGroupProps = Omit<ComponentPropsWithRef<typeof Primitive.Root>, \"type\" | \"value\" | \"defaultValue\" | \"onValueChange\" | \"loop\"> & {\n readonly multiple?: boolean | undefined;\n readonly value?: string[] | undefined;\n readonly defaultValue?: string[] | undefined;\n readonly onValueChange?: ((value: string[]) => void) | undefined;\n readonly loopFocus?: boolean | undefined;\n readonly layout?: \"standard\" | \"cells\" | undefined;\n};\n\nexport const ToggleGroup: FC<ToggleGroupProps> = (props: ToggleGroupProps) => {\n const { className, multiple, value, defaultValue, onValueChange, loopFocus = true, layout = \"standard\", ...restProps } = props;\n const [\n local,\n setLocal,\n ] = useState(defaultValue ?? []);\n const current = value ?? local;\n return (<ToggleGroupContext.Provider\n value={layout}\n >\n <Primitive.Root\n {...restProps}\n loop={loopFocus}\n className={cn(toggleGroupStyles({ layout }), className)}\n data-layout={layout}\n type=\"multiple\"\n value={multiple ? current : current.slice(-1)}\n onValueChange={(next) => {\n const selected = multiple ? next : next.slice(-1);\n if (value === undefined) {\n setLocal(selected);\n }\n onValueChange?.(selected);\n }}\n />\n </ToggleGroupContext.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace ToggleGroupItem\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const toggleStyles = cva(\"gridui-u-min-h-gridui-control gridui-u-cursor-pointer gridui-u-border-0 gridui-u-bg-background gridui-u-px-gridui-16 gridui-u-py-gridui-8 gridui-u-text-foreground gridui-u-type-ui gridui-u-data-[state=on]:bg-brand-tint gridui-u-data-[state=on]:text-foreground gridui-u-data-disabled:cursor-not-allowed gridui-u-data-disabled:opacity-50\", {\n variants: {\n layout: {\n standard: \"\",\n cells: \"gridui-u-w-full gridui-u-min-w-0 gridui-u-whitespace-normal gridui-u-wrap-anywhere gridui-u-border-x-0 gridui-u-border-t-0 gridui-u-border-solid gridui-u-border-transparent gridui-u-px-gridui-8 gridui-u-py-gridui-16 gridui-u-text-center gridui-u-data-[orientation=horizontal]:border-b-2 gridui-u-data-[orientation=vertical]:border-b-0 gridui-u-data-[orientation=vertical]:border-r-2 gridui-u-rtl:data-[orientation=vertical]:border-r-0 gridui-u-rtl:data-[orientation=vertical]:border-l-2 gridui-u-data-[state=on]:font-medium\",\n },\n },\n defaultVariants: {\n layout: \"standard\",\n },\n});\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace ToggleGroupItem\n * @description Toggle Group Item\n */\n\nimport { ToggleGroupContext } from \"../shared/context\";\nimport { toggleStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-toggle-group\";\nimport { type ComponentPropsWithRef, type FC, useContext } from \"react\";\n\nexport type ToggleGroupItemProps = ComponentPropsWithRef<typeof Primitive.Item>;\n\nexport const ToggleGroupItem: FC<ToggleGroupItemProps> = (props: ToggleGroupItemProps) => {\n const { className, ...restProps } = props;\n const layout = useContext(ToggleGroupContext);\n return (<Primitive.Item\n {...restProps}\n className={cn(toggleStyles({ layout }), className)}\n />);\n};\n"],
5
- "mappings": ";AAOA,SAAS,qBAAqB,oBAAoB;AAClD,SAA6B,qBAAqB;AAClD,SAAoE,qBAAqB,QAAQ,gBAAgB;AAY1G,IAAM,YAAY,CAAC,UAAuB;AAC7C,QAAM,EAAE,SAAS,iBAAiB,OAAO,iBAAiB,UAAU,UAAU,UAAU,KAAK,IAAI;AACjG,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,cAAc;AAC3B,QAAM,QAAQ,OAAyB,IAAI;AAC3C,QAAM,UAAU,OAA0B,IAAI;AAC9C,QAAM,UAAU,OAAO,cAAc;AACrC,sBAAoB,MAAM,KAAK,MAAM;AACjC,WAAO,QAAQ;AAAA,EACnB,CAAC;AACD,sBAAoB,UAAU,MAAM;AAChC,WAAO,MAAM;AAAA,EACjB,CAAC;AACD,eAAa,OAAO,MAAM;AACtB,QAAI,YAAY,QAAW;AACvB,eAAS,QAAQ,OAAO;AAAA,IAC5B;AAAA,EACJ,GAAG,IAAI;AACP,QAAM,UAAU,WAAW;AAC3B,QAAM,UAAU,CAAC,UAA4C;AACzD,wBAAoB,OAAO,MAAM;A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ACN,QAAQ;AAAA,MACJ,UAAU;AAAA,MACV,OAAO;AAAA,IACX;AAAA,EACJ;AAAA,EACA,iBAAiB;AAAA,IACb,QAAQ;AAAA,EACZ;AACJ,CAAC;;;ACVD,SAAS,MAAAC,WAAU;AACnB,YAAYC,gBAAe;AAC3B,SAA8C,kBAAkB;AAOpD,gBAAAC,YAAA;AAHL,IAAM,kBAA4C,CAAC,UAAgC;AACtF,QAAM,EAAE,WAAW,GAAG,UAAU,IAAI;AACpC,QAAM,SAAS,WAAW,kBAAkB;AAC5C,SAAQ,gBAAAA;AAAA,IAAW;AAAA,IAAV;AAAA,MACJ,GAAG;AAAA,MACJ,WAAWF,IAAG,aAAa,EAAE,OAAO,CAAC,GAAG,SAAS;AAAA;AAAA,EACrD;AACJ;",
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Use Choice\n */\n\nimport { focusInvalidControl, useFormReset } from \"@gridui/form\";\nimport { type ChangeDetails, changeDetails } from \"@gridui/interaction\";\nimport { type ComponentPropsWithRef, type Ref, type SyntheticEvent, useImperativeHandle, useRef, useState } from \"react\";\n\nexport type ChoiceProps = Omit<ComponentPropsWithRef<\"button\">, \"children\" | \"onChange\" | \"defaultChecked\"> & {\n readonly checked?: boolean | undefined;\n readonly defaultChecked?: boolean | undefined;\n readonly readOnly?: boolean | undefined;\n readonly required?: boolean | undefined;\n readonly uncheckedValue?: string | undefined;\n readonly inputRef?: Ref<HTMLInputElement> | undefined;\n readonly onCheckedChange?: ((checked: boolean, details: ChangeDetails) => void) | undefined;\n};\n\nexport const useChoice = (props: ChoiceProps) => {\n const { checked, defaultChecked = false, onCheckedChange, readOnly, disabled, inputRef, form } = props;\n const [\n local,\n setLocal,\n ] = useState(defaultChecked);\n const input = useRef<HTMLInputElement>(null);\n const control = useRef<HTMLButtonElement>(null);\n const initial = useRef(defaultChecked);\n useImperativeHandle(props.ref, () => {\n return control.current as HTMLButtonElement;\n });\n useImperativeHandle(inputRef, () => {\n return input.current as HTMLInputElement;\n });\n useFormReset(input, () => {\n if (checked === undefined) {\n setLocal(initial.current);\n }\n }, form);\n const current = checked ?? local;\n const invalid = (event: SyntheticEvent<HTMLInputElement>) => {\n focusInvalidControl(event, () => {\n control.current?.focus();\n });\n };\n const change = (next: boolean, event: Event) => {\n if (readOnly || disabled || input.current?.matches(\":disabled\")) {\n return;\n }\n const details = changeDetails(event);\n onCheckedChange?.(next, details);\n if (!details.isCanceled && checked === undefined) {\n setLocal(next);\n }\n };\n return {\n current,\n input,\n control,\n change,\n invalid,\n };\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Checkbox\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const choiceStyles = cva(\"gridui-u-choice--inline-flex gridui-u-choice--size-5 gridui-u-choice--shrink-0 gridui-u-choice--cursor-pointer gridui-u-choice--items-center gridui-u-choice--justify-center gridui-u-choice--rounded-control gridui-u-choice--border gridui-u-choice--border-control-border gridui-u-choice--bg-background gridui-u-choice--text-foreground gridui-u-choice--align-middle gridui-u-choice--data-[state=checked]:bg-accent-background gridui-u-choice--data-[state=checked]:text-accent-foreground gridui-u-choice--data-[state=indeterminate]:bg-accent-background gridui-u-choice--data-[state=indeterminate]:text-accent-foreground gridui-u-choice--data-disabled:cursor-not-allowed gridui-u-choice--data-disabled:opacity-50 gridui-u-choice--data-readonly:cursor-default gridui-u-choice--aria-invalid:border-danger-foreground\");\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Checkbox\n * @description Checkbox\n */\n\nimport { type ChoiceProps, useChoice } from \"../shared/use-choice\";\nimport { choiceStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-checkbox\";\nimport { Check, Minus } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type CheckboxProps = ChoiceProps & {\n readonly indeterminate?: boolean | undefined;\n};\n\nexport const Checkbox: FC<CheckboxProps> = (props: CheckboxProps) => {\n const { className, indeterminate, inputRef, onCheckedChange, checked, defaultChecked,\n readOnly, uncheckedValue, name, value = \"on\", form, required, onClick, ...restProps } = props;\n const { current, input, control, change, invalid } = useChoice({\n ...props,\n inputRef,\n onCheckedChange,\n checked,\n defaultChecked,\n });\n return (<>\n <Primitive.Root\n {...restProps}\n ref={control}\n checked={indeterminate ? \"indeterminate\" : current}\n aria-required={required}\n aria-readonly={readOnly}\n data-readonly={readOnly ? \"\" : undefined}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n change(indeterminate ? true : !current, event.nativeEvent);\n }\n event.preventDefault();\n }}\n className={cn(choiceStyles(), className)}\n >\n <Primitive.Indicator>\n {indeterminate ? (<Minus\n size={16}\n aria-hidden=\"true\"\n />) : (<Check\n size={16}\n aria-hidden=\"true\"\n />)}\n </Primitive.Indicator>\n </Primitive.Root>\n <input\n ref={input}\n type=\"checkbox\"\n className=\"gridui-u-choice--sr-only\"\n tabIndex={-1}\n aria-hidden=\"true\"\n name={name}\n value={value}\n form={form}\n required={required}\n disabled={props.disabled}\n checked={current}\n readOnly={readOnly}\n onInvalid={invalid}\n onChange={(event) => {\n change(event.target.checked, event.nativeEvent);\n }}\n />\n {!current && uncheckedValue !== undefined && (<input\n type=\"hidden\"\n name={name}\n form={form}\n value={uncheckedValue}\n disabled={props.disabled}\n />)}\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Switch Control\n */\n\nimport { type ChoiceProps, useChoice } from \"./use-choice\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC, ReactNode } from \"react\";\n\nexport type SwitchControlProps = ChoiceProps & {\n readonly children: (checked: boolean) => ReactNode;\n};\n\nexport const SwitchControl: FC<SwitchControlProps> = (props: SwitchControlProps) => {\n const { children, className, inputRef, onCheckedChange, checked, defaultChecked,\n readOnly, uncheckedValue, name, value = \"on\", form, required, onClick, type = \"button\", ...restProps } = props;\n const { current, input, control, change, invalid } = useChoice({\n ...props,\n inputRef,\n onCheckedChange,\n checked,\n defaultChecked,\n });\n return (<>\n <button\n {...restProps}\n ref={control}\n type={type}\n role=\"switch\"\n aria-checked={current}\n data-state={current ? \"checked\" : \"unchecked\"}\n data-disabled={props.disabled ? \"\" : undefined}\n aria-required={required}\n aria-readonly={readOnly}\n data-readonly={readOnly ? \"\" : undefined}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n change(!current, event.nativeEvent);\n }\n event.preventDefault();\n }}\n className={cn(\"gridui-switch-control\", className)}\n >\n {children(current)}\n </button>\n <input\n ref={input}\n type=\"checkbox\"\n className=\"gridui-u-choice--sr-only\"\n tabIndex={-1}\n aria-hidden=\"true\"\n name={name}\n value={value}\n form={form}\n required={required}\n disabled={props.disabled}\n checked={current}\n readOnly={readOnly}\n onInvalid={invalid}\n onChange={(event) => {\n change(event.target.checked, event.nativeEvent);\n }}\n />\n {!current && uncheckedValue !== undefined && (<input\n type=\"hidden\"\n name={name}\n form={form}\n value={uncheckedValue}\n disabled={props.disabled}\n />)}\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Switch Indicator\n */\n\nimport type { SwitchPresentationProps } from \"./switch-options\";\nimport { Check, Minus } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type SwitchIndicatorProps = SwitchPresentationProps & {\n readonly checked: boolean;\n};\n\nexport const SwitchIndicator: FC<SwitchIndicatorProps> = (props: SwitchIndicatorProps) => {\n const { checked, variant = \"rail\", stateLabels = {\n checked: \"On\",\n unchecked: \"Off\",\n } } = props;\n return (<span\n className=\"gridui-switch-indicator gridui-u-choice--type-caption\"\n data-variant={variant}\n data-state={checked ? \"checked\" : \"unchecked\"}\n aria-hidden=\"true\"\n >\n {variant === \"rail\" ? (<span\n className=\"gridui-switch-thumb\"\n />) : (<>\n {checked ? (<Check\n className=\"gridui-switch-state-icon\"\n />) : (<Minus\n className=\"gridui-switch-state-icon\"\n />)}\n <span\n className=\"gridui-switch-state-label\"\n >\n {checked ? stateLabels.checked : stateLabels.unchecked}\n </span>\n </>)}\n </span>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Switch\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const switchStyles = cva(\"gridui-switch gridui-u-choice--inline-flex gridui-u-choice--w-fit gridui-u-choice--max-w-full gridui-u-choice--min-h-gridui-control gridui-u-choice--min-w-gridui-control gridui-u-choice--shrink-0 gridui-u-choice--items-center gridui-u-choice--justify-center gridui-u-choice--border-0 gridui-u-choice--bg-transparent gridui-u-choice--p-0 gridui-u-choice--align-middle gridui-u-choice--rounded-control\");\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Switch\n * @description Switch\n */\n\nimport { SwitchControl } from \"../shared/switch-control\";\nimport { SwitchIndicator } from \"../shared/switch-indicator\";\nimport type { SwitchOptions } from \"../shared/switch-options\";\nimport { switchStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC } from \"react\";\n\nexport type SwitchProps = SwitchOptions;\n\nexport const Switch: FC<SwitchProps> = (props: SwitchProps) => {\n const { variant, stateLabels, className, ...restProps } = props;\n return (<SwitchControl\n {...restProps}\n className={cn(switchStyles(), className)}\n >\n {(checked) => {\n return (<SwitchIndicator\n checked={checked}\n variant={variant}\n stateLabels={stateLabels}\n />);\n }}\n </SwitchControl>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Switch Setting\n */\n\nimport { SwitchControl } from \"./switch-control\";\nimport { SwitchIndicator } from \"./switch-indicator\";\nimport type { SwitchSettingOptions } from \"./switch-options\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type FC, useId } from \"react\";\n\nexport type SwitchSettingProps = SwitchSettingOptions;\n\nexport const SwitchSetting: FC<SwitchSettingProps> = (props: SwitchSettingProps) => {\n const { control, label, description } = props;\n const { variant, stateLabels, className, ...controlProps } = control;\n const id = useId();\n const labelId = `${id}-label`;\n const descriptionId = `${id}-description`;\n const hasDescription = description !== undefined && description !== null;\n const describedBy = [\n controlProps[\"aria-describedby\"],\n hasDescription ? descriptionId : undefined,\n ].filter(Boolean).join(\" \") || undefined;\n return (<SwitchControl\n {...controlProps}\n className={cn(\"gridui-switch-setting\", className)}\n aria-labelledby={controlProps[\"aria-labelledby\"] ?? (controlProps[\"aria-label\"] ? undefined : labelId)}\n aria-describedby={describedBy}\n >\n {(checked) => {\n return (<>\n <span\n className=\"gridui-switch-setting-copy\"\n >\n <span\n id={labelId}\n className=\"gridui-u-choice--type-ui\"\n >\n {label}\n </span>\n {hasDescription && (<span\n id={descriptionId}\n className=\"gridui-switch-setting-description gridui-u-choice--type-supporting\"\n >\n {description}\n </span>)}\n </span>\n <span\n className=\"gridui-switch-setting-end\"\n >\n <SwitchIndicator\n checked={checked}\n variant={variant}\n stateLabels={stateLabels}\n />\n </span>\n </>);\n }}\n </SwitchControl>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace SwitchGroup\n * @description Switch Group\n */\n\nimport type { SwitchOptions, SwitchPresentationProps, SwitchSettingCopy } from \"../shared/switch-options\";\nimport { SwitchSetting } from \"../shared/switch-setting\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC, ReactNode } from \"react\";\n\nexport type SwitchGroupItem = SwitchOptions & SwitchSettingCopy & {\n /** Stable item identity and native control ID. */\n readonly id: string;\n};\n\nexport type SwitchGroupProps = Omit<ComponentPropsWithRef<\"fieldset\">, \"children\"> & SwitchPresentationProps & {\n readonly items: readonly SwitchGroupItem[];\n readonly legend?: ReactNode;\n readonly density?: \"compact\" | \"comfortable\";\n};\n\nexport const SwitchGroup: FC<SwitchGroupProps> = (props: SwitchGroupProps) => {\n const { items, legend, density = \"compact\", variant, stateLabels, className, ...restProps } = props;\n return (<fieldset\n {...restProps}\n className={cn(\"gridui-switch-group\", className)}\n data-density={density}\n >\n {legend !== undefined && legend !== null && (<legend\n className=\"gridui-switch-group-legend gridui-u-choice--type-ui\"\n >\n {legend}\n </legend>)}\n {items.map((item) => {\n const { label, description, ...control } = item;\n return (<SwitchSetting\n key={item.id}\n label={label}\n description={description}\n control={{\n ...control,\n variant: item.variant ?? variant,\n stateLabels: item.stateLabels ?? stateLabels,\n }}\n />);\n })}\n </fieldset>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace SwitchPanel\n * @description Switch Panel\n */\n\nimport type { SwitchSettingOptions } from \"../shared/switch-options\";\nimport { SwitchSetting } from \"../shared/switch-setting\";\nimport { cn } from \"@gridui/style-utils\";\nimport { Children, type ComponentPropsWithRef, type FC } from \"react\";\n\nexport type SwitchPanelProps = ComponentPropsWithRef<\"div\"> & SwitchSettingOptions;\n\nexport const SwitchPanel: FC<SwitchPanelProps> = (props: SwitchPanelProps) => {\n const { label, description, control, children, className, ...restProps } = props;\n const hasContent = Children.toArray(children).some((child) => {\n return child !== \"\";\n });\n return (<div\n {...restProps}\n className={cn(\"gridui-switch-panel\", className)}\n >\n <SwitchSetting\n label={label}\n description={description}\n control={control}\n />\n {hasContent && (<div\n className=\"gridui-switch-panel-content\"\n >\n {children}\n </div>)}\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace Shared\n * @description Context\n */\n\nimport { createContext } from \"react\";\n\nexport const ToggleGroupContext = createContext<\"standard\" | \"cells\">(\"standard\");\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace ToggleGroup\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const toggleGroupStyles = cva(\"gridui-toggle-group gridui-u-choice--inline-flex gridui-u-choice--max-w-full gridui-u-choice--flex-wrap gridui-u-choice--gap-px gridui-u-choice--border gridui-u-choice--border-border gridui-u-choice--bg-border gridui-u-choice--data-[orientation=vertical]:flex-col\", {\n variants: {\n layout: {\n standard: \"\",\n cells: \"gridui-u-choice--grid gridui-u-choice--w-full gridui-u-choice--grid-flow-col gridui-u-choice--auto-cols-fr gridui-u-choice--data-[orientation=vertical]:grid-flow-row gridui-u-choice--data-[orientation=vertical]:auto-rows-fr gridui-u-choice--data-[orientation=vertical]:grid-cols-1\",\n },\n },\n defaultVariants: { layout: \"standard\" },\n});\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace ToggleGroup\n * @description Toggle Group\n */\n\nimport { ToggleGroupContext } from \"../shared/context\";\nimport { toggleGroupStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-toggle-group\";\nimport { type ComponentPropsWithRef, type FC, useState } from \"react\";\n\nexport type ToggleGroupProps = Omit<ComponentPropsWithRef<typeof Primitive.Root>, \"type\" | \"value\" | \"defaultValue\" | \"onValueChange\" | \"loop\"> & {\n readonly multiple?: boolean | undefined;\n readonly value?: string[] | undefined;\n readonly defaultValue?: string[] | undefined;\n readonly onValueChange?: ((value: string[]) => void) | undefined;\n readonly loopFocus?: boolean | undefined;\n readonly layout?: \"standard\" | \"cells\" | undefined;\n};\n\nexport const ToggleGroup: FC<ToggleGroupProps> = (props: ToggleGroupProps) => {\n const { className, multiple, value, defaultValue, onValueChange, loopFocus = true, layout = \"standard\", ...restProps } = props;\n const [\n local,\n setLocal,\n ] = useState(defaultValue ?? []);\n const current = value ?? local;\n return (<ToggleGroupContext.Provider\n value={layout}\n >\n <Primitive.Root\n {...restProps}\n loop={loopFocus}\n className={cn(toggleGroupStyles({ layout }), className)}\n data-layout={layout}\n type=\"multiple\"\n value={multiple ? current : current.slice(-1)}\n onValueChange={(next) => {\n const selected = multiple ? next : next.slice(-1);\n if (value === undefined) {\n setLocal(selected);\n }\n onValueChange?.(selected);\n }}\n />\n </ToggleGroupContext.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace ToggleGroupItem\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const toggleStyles = cva(\"gridui-u-choice--min-h-gridui-control gridui-u-choice--cursor-pointer gridui-u-choice--border-0 gridui-u-choice--bg-background gridui-u-choice--px-gridui-16 gridui-u-choice--py-gridui-8 gridui-u-choice--text-foreground gridui-u-choice--type-ui gridui-u-choice--data-[state=on]:bg-brand-tint gridui-u-choice--data-[state=on]:text-foreground gridui-u-choice--data-disabled:cursor-not-allowed gridui-u-choice--data-disabled:opacity-50\", {\n variants: {\n layout: {\n standard: \"gridui-u-choice--grow gridui-u-choice--basis-auto gridui-u-choice--min-w-0 gridui-u-choice--max-w-full gridui-u-choice--whitespace-normal gridui-u-choice--wrap-anywhere\",\n cells: \"gridui-u-choice--w-full gridui-u-choice--min-w-0 gridui-u-choice--whitespace-normal gridui-u-choice--wrap-anywhere gridui-u-choice--border-x-0 gridui-u-choice--border-t-0 gridui-u-choice--border-solid gridui-u-choice--border-transparent gridui-u-choice--px-gridui-8 gridui-u-choice--py-gridui-16 gridui-u-choice--text-center gridui-u-choice--data-[orientation=horizontal]:border-b-2 gridui-u-choice--data-[orientation=vertical]:border-b-0 gridui-u-choice--data-[orientation=vertical]:border-r-2 gridui-u-choice--rtl:data-[orientation=vertical]:border-r-0 gridui-u-choice--rtl:data-[orientation=vertical]:border-l-2 gridui-u-choice--data-[state=on]:font-medium\",\n },\n },\n defaultVariants: {\n layout: \"standard\",\n },\n});\n", "/**\n * @author WMXPY\n * @package Choice\n * @namespace ToggleGroupItem\n * @description Toggle Group Item\n */\n\nimport { ToggleGroupContext } from \"../shared/context\";\nimport { toggleStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-toggle-group\";\nimport { type ComponentPropsWithRef, type FC, useContext } from \"react\";\n\nexport type ToggleGroupItemProps = ComponentPropsWithRef<typeof Primitive.Item>;\n\nexport const ToggleGroupItem: FC<ToggleGroupItemProps> = (props: ToggleGroupItemProps) => {\n const { className, ...restProps } = props;\n const layout = useContext(ToggleGroupContext);\n return (<Primitive.Item\n {...restProps}\n className={cn(toggleStyles({ layout }), className)}\n />);\n};\n"],
5
+ "mappings": ";AAOA,SAAS,qBAAqB,oBAAoB;AAClD,SAA6B,qBAAqB;AAClD,SAAoE,qB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n", "jsx", "jsxs", "cva", "cn", "Primitive", "useState", "jsx", "cva", "cn", "Primitive", "jsx"]
7
7
  }
@@ -4,7 +4,7 @@
4
4
  * @namespace Shared
5
5
  * @description Switch Indicator
6
6
  */
7
- import type { SwitchPresentationProps } from "./switch-presentation";
7
+ import type { SwitchPresentationProps } from "./switch-options";
8
8
  import type { FC } from "react";
9
9
  export type SwitchIndicatorProps = SwitchPresentationProps & {
10
10
  readonly checked: boolean;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Choice
4
+ * @namespace Shared
5
+ * @description Switch Options
6
+ */
7
+ import type { ChoiceProps } from "./use-choice";
8
+ import type { ReactNode } from "react";
9
+ export type SwitchVariant = "rail" | "state";
10
+ export type SwitchStateLabels = {
11
+ readonly checked: string;
12
+ readonly unchecked: string;
13
+ };
14
+ export type SwitchPresentationProps = {
15
+ readonly variant?: SwitchVariant | undefined;
16
+ /** Visible state words; the accessible name must describe the setting. */
17
+ readonly stateLabels?: SwitchStateLabels | undefined;
18
+ };
19
+ export type SwitchOptions = ChoiceProps & SwitchPresentationProps;
20
+ export type SwitchSettingCopy = {
21
+ readonly label: ReactNode;
22
+ readonly description?: ReactNode;
23
+ };
24
+ export type SwitchSettingOptions = SwitchSettingCopy & {
25
+ /** State, form attributes, accessible overrides and ref for the switch button. */
26
+ readonly control: SwitchOptions;
27
+ };
@@ -4,11 +4,7 @@
4
4
  * @namespace Shared
5
5
  * @description Switch Setting
6
6
  */
7
- import type { SwitchProps } from "../switch/switch";
8
- import { type FC, type ReactNode } from "react";
9
- export type SwitchSettingProps = {
10
- readonly control: SwitchProps;
11
- readonly label: ReactNode;
12
- readonly description?: ReactNode;
13
- };
7
+ import type { SwitchSettingOptions } from "./switch-options";
8
+ import { type FC } from "react";
9
+ export type SwitchSettingProps = SwitchSettingOptions;
14
10
  export declare const SwitchSetting: FC<SwitchSettingProps>;
package/dist/styles.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
4
  @layer theme {
@@ -8,7 +8,7 @@
8
8
  }
9
9
  }
10
10
  @layer utilities {
11
- .gridui-u-sr-only {
11
+ .gridui-u-choice--sr-only {
12
12
  position: absolute;
13
13
  width: 1px;
14
14
  height: 1px;
@@ -19,204 +19,210 @@
19
19
  white-space: nowrap;
20
20
  border-width: 0;
21
21
  }
22
- .gridui-u-grid {
22
+ .gridui-u-choice--grid {
23
23
  display: grid;
24
24
  }
25
- .gridui-u-inline-flex {
25
+ .gridui-u-choice--inline-flex {
26
26
  display: inline-flex;
27
27
  }
28
- .gridui-u-size-5 {
28
+ .gridui-u-choice--size-5 {
29
29
  width: calc(var(--spacing) * 5);
30
30
  height: calc(var(--spacing) * 5);
31
31
  }
32
- .gridui-u-min-h-gridui-control {
32
+ .gridui-u-choice--min-h-gridui-control {
33
33
  min-height: var(--gridui-control-min-height);
34
34
  }
35
- .gridui-u-w-fit {
35
+ .gridui-u-choice--w-fit {
36
36
  width: fit-content;
37
37
  }
38
- .gridui-u-w-full {
38
+ .gridui-u-choice--w-full {
39
39
  width: 100%;
40
40
  }
41
- .gridui-u-max-w-full {
41
+ .gridui-u-choice--max-w-full {
42
42
  max-width: 100%;
43
43
  }
44
- .gridui-u-min-w-0 {
44
+ .gridui-u-choice--min-w-0 {
45
45
  min-width: 0px;
46
46
  }
47
- .gridui-u-min-w-gridui-control {
47
+ .gridui-u-choice--min-w-gridui-control {
48
48
  min-width: var(--gridui-control-min-height);
49
49
  }
50
- .gridui-u-shrink-0 {
50
+ .gridui-u-choice--shrink-0 {
51
51
  flex-shrink: 0;
52
52
  }
53
- .gridui-u-cursor-pointer {
53
+ .gridui-u-choice--grow {
54
+ flex-grow: 1;
55
+ }
56
+ .gridui-u-choice--basis-auto {
57
+ flex-basis: auto;
58
+ }
59
+ .gridui-u-choice--cursor-pointer {
54
60
  cursor: pointer;
55
61
  }
56
- .gridui-u-auto-cols-fr {
62
+ .gridui-u-choice--auto-cols-fr {
57
63
  grid-auto-columns: minmax(0, 1fr);
58
64
  }
59
- .gridui-u-grid-flow-col {
65
+ .gridui-u-choice--grid-flow-col {
60
66
  grid-auto-flow: column;
61
67
  }
62
- .gridui-u-flex-wrap {
68
+ .gridui-u-choice--flex-wrap {
63
69
  flex-wrap: wrap;
64
70
  }
65
- .gridui-u-items-center {
71
+ .gridui-u-choice--items-center {
66
72
  align-items: center;
67
73
  }
68
- .gridui-u-justify-center {
74
+ .gridui-u-choice--justify-center {
69
75
  justify-content: center;
70
76
  }
71
- .gridui-u-gap-px {
77
+ .gridui-u-choice--gap-px {
72
78
  gap: 1px;
73
79
  }
74
- .gridui-u-rounded-control {
80
+ .gridui-u-choice--rounded-control {
75
81
  border-radius: var(--gridui-control-radius);
76
82
  }
77
- .gridui-u-border {
83
+ .gridui-u-choice--border {
78
84
  border-style: var(--tw-border-style);
79
85
  border-width: 1px;
80
86
  }
81
- .gridui-u-border-0 {
87
+ .gridui-u-choice--border-0 {
82
88
  border-style: var(--tw-border-style);
83
89
  border-width: 0px;
84
90
  }
85
- .gridui-u-border-x-0 {
91
+ .gridui-u-choice--border-x-0 {
86
92
  border-inline-style: var(--tw-border-style);
87
93
  border-inline-width: 0px;
88
94
  }
89
- .gridui-u-border-t-0 {
95
+ .gridui-u-choice--border-t-0 {
90
96
  border-top-style: var(--tw-border-style);
91
97
  border-top-width: 0px;
92
98
  }
93
- .gridui-u-border-solid {
99
+ .gridui-u-choice--border-solid {
94
100
  --tw-border-style: solid;
95
101
  border-style: solid;
96
102
  }
97
- .gridui-u-border-border {
103
+ .gridui-u-choice--border-border {
98
104
  border-color: var(--gridui-border);
99
105
  }
100
- .gridui-u-border-control-border {
106
+ .gridui-u-choice--border-control-border {
101
107
  border-color: var(--gridui-control-border);
102
108
  }
103
- .gridui-u-border-transparent {
109
+ .gridui-u-choice--border-transparent {
104
110
  border-color: transparent;
105
111
  }
106
- .gridui-u-bg-background {
112
+ .gridui-u-choice--bg-background {
107
113
  background-color: var(--gridui-background);
108
114
  }
109
- .gridui-u-bg-border {
115
+ .gridui-u-choice--bg-border {
110
116
  background-color: var(--gridui-border);
111
117
  }
112
- .gridui-u-bg-transparent {
118
+ .gridui-u-choice--bg-transparent {
113
119
  background-color: transparent;
114
120
  }
115
- .gridui-u-p-0 {
121
+ .gridui-u-choice--p-0 {
116
122
  padding: 0px;
117
123
  }
118
- .gridui-u-px-gridui-8 {
124
+ .gridui-u-choice--px-gridui-8 {
119
125
  padding-inline: var(--gridui-space-8);
120
126
  }
121
- .gridui-u-px-gridui-16 {
127
+ .gridui-u-choice--px-gridui-16 {
122
128
  padding-inline: var(--gridui-space-16);
123
129
  }
124
- .gridui-u-py-gridui-8 {
130
+ .gridui-u-choice--py-gridui-8 {
125
131
  padding-block: var(--gridui-space-8);
126
132
  }
127
- .gridui-u-py-gridui-16 {
133
+ .gridui-u-choice--py-gridui-16 {
128
134
  padding-block: var(--gridui-space-16);
129
135
  }
130
- .gridui-u-text-center {
136
+ .gridui-u-choice--text-center {
131
137
  text-align: center;
132
138
  }
133
- .gridui-u-align-middle {
139
+ .gridui-u-choice--align-middle {
134
140
  vertical-align: middle;
135
141
  }
136
- .gridui-u-type-caption {
142
+ .gridui-u-choice--type-caption {
137
143
  font: var(--gridui-type-caption);
138
144
  letter-spacing: normal;
139
145
  }
140
- .gridui-u-type-supporting {
146
+ .gridui-u-choice--type-supporting {
141
147
  font: var(--gridui-type-supporting);
142
148
  letter-spacing: normal;
143
149
  }
144
- .gridui-u-type-ui {
150
+ .gridui-u-choice--type-ui {
145
151
  font: var(--gridui-type-ui);
146
152
  letter-spacing: normal;
147
153
  }
148
- .gridui-u-wrap-anywhere {
154
+ .gridui-u-choice--wrap-anywhere {
149
155
  overflow-wrap: anywhere;
150
156
  }
151
- .gridui-u-whitespace-normal {
157
+ .gridui-u-choice--whitespace-normal {
152
158
  white-space: normal;
153
159
  }
154
- .gridui-u-text-foreground {
160
+ .gridui-u-choice--text-foreground {
155
161
  color: var(--gridui-foreground);
156
162
  }
157
- .gridui-u-aria-invalid\:border-danger-foreground[aria-invalid="true"] {
163
+ .gridui-u-choice--aria-invalid\:border-danger-foreground[aria-invalid="true"] {
158
164
  border-color: var(--gridui-danger-foreground);
159
165
  }
160
- .gridui-u-data-disabled\:cursor-not-allowed[data-disabled] {
166
+ .gridui-u-choice--data-disabled\:cursor-not-allowed[data-disabled] {
161
167
  cursor: not-allowed;
162
168
  }
163
- .gridui-u-data-disabled\:opacity-50[data-disabled] {
169
+ .gridui-u-choice--data-disabled\:opacity-50[data-disabled] {
164
170
  opacity: 50%;
165
171
  }
166
- .gridui-u-data-readonly\:cursor-default[data-readonly] {
172
+ .gridui-u-choice--data-readonly\:cursor-default[data-readonly] {
167
173
  cursor: default;
168
174
  }
169
- .gridui-u-data-\[orientation\=horizontal\]\:border-b-2[data-orientation="horizontal"] {
175
+ .gridui-u-choice--data-\[orientation\=horizontal\]\:border-b-2[data-orientation="horizontal"] {
170
176
  border-bottom-style: var(--tw-border-style);
171
177
  border-bottom-width: 2px;
172
178
  }
173
- .gridui-u-data-\[orientation\=vertical\]\:grid-flow-row[data-orientation="vertical"] {
179
+ .gridui-u-choice--data-\[orientation\=vertical\]\:grid-flow-row[data-orientation="vertical"] {
174
180
  grid-auto-flow: row;
175
181
  }
176
- .gridui-u-data-\[orientation\=vertical\]\:auto-rows-fr[data-orientation="vertical"] {
182
+ .gridui-u-choice--data-\[orientation\=vertical\]\:auto-rows-fr[data-orientation="vertical"] {
177
183
  grid-auto-rows: minmax(0, 1fr);
178
184
  }
179
- .gridui-u-data-\[orientation\=vertical\]\:grid-cols-1[data-orientation="vertical"] {
185
+ .gridui-u-choice--data-\[orientation\=vertical\]\:grid-cols-1[data-orientation="vertical"] {
180
186
  grid-template-columns: repeat(1, minmax(0, 1fr));
181
187
  }
182
- .gridui-u-data-\[orientation\=vertical\]\:flex-col[data-orientation="vertical"] {
188
+ .gridui-u-choice--data-\[orientation\=vertical\]\:flex-col[data-orientation="vertical"] {
183
189
  flex-direction: column;
184
190
  }
185
- .gridui-u-data-\[orientation\=vertical\]\:border-r-2[data-orientation="vertical"] {
191
+ .gridui-u-choice--data-\[orientation\=vertical\]\:border-r-2[data-orientation="vertical"] {
186
192
  border-right-style: var(--tw-border-style);
187
193
  border-right-width: 2px;
188
194
  }
189
- .gridui-u-data-\[orientation\=vertical\]\:border-b-0[data-orientation="vertical"] {
195
+ .gridui-u-choice--data-\[orientation\=vertical\]\:border-b-0[data-orientation="vertical"] {
190
196
  border-bottom-style: var(--tw-border-style);
191
197
  border-bottom-width: 0px;
192
198
  }
193
- .gridui-u-data-\[state\=checked\]\:bg-accent-background[data-state="checked"] {
199
+ .gridui-u-choice--data-\[state\=checked\]\:bg-accent-background[data-state="checked"] {
194
200
  background-color: var(--gridui-accent-background);
195
201
  }
196
- .gridui-u-data-\[state\=checked\]\:text-accent-foreground[data-state="checked"] {
202
+ .gridui-u-choice--data-\[state\=checked\]\:text-accent-foreground[data-state="checked"] {
197
203
  color: var(--gridui-accent-foreground);
198
204
  }
199
- .gridui-u-data-\[state\=indeterminate\]\:bg-accent-background[data-state="indeterminate"] {
205
+ .gridui-u-choice--data-\[state\=indeterminate\]\:bg-accent-background[data-state="indeterminate"] {
200
206
  background-color: var(--gridui-accent-background);
201
207
  }
202
- .gridui-u-data-\[state\=indeterminate\]\:text-accent-foreground[data-state="indeterminate"] {
208
+ .gridui-u-choice--data-\[state\=indeterminate\]\:text-accent-foreground[data-state="indeterminate"] {
203
209
  color: var(--gridui-accent-foreground);
204
210
  }
205
- .gridui-u-data-\[state\=on\]\:bg-brand-tint[data-state="on"] {
211
+ .gridui-u-choice--data-\[state\=on\]\:bg-brand-tint[data-state="on"] {
206
212
  background-color: var(--gridui-brand-tint);
207
213
  }
208
- .gridui-u-data-\[state\=on\]\:font-medium[data-state="on"] {
214
+ .gridui-u-choice--data-\[state\=on\]\:font-medium[data-state="on"] {
209
215
  --tw-font-weight: var(--font-weight-medium);
210
216
  font-weight: var(--font-weight-medium);
211
217
  }
212
- .gridui-u-data-\[state\=on\]\:text-foreground[data-state="on"] {
218
+ .gridui-u-choice--data-\[state\=on\]\:text-foreground[data-state="on"] {
213
219
  color: var(--gridui-foreground);
214
220
  }
215
- .gridui-u-rtl\:data-\[orientation\=vertical\]\:border-r-0:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
221
+ .gridui-u-choice--rtl\:data-\[orientation\=vertical\]\:border-r-0:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
216
222
  border-right-style: var(--tw-border-style);
217
223
  border-right-width: 0px;
218
224
  }
219
- .gridui-u-rtl\:data-\[orientation\=vertical\]\:border-l-2:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
225
+ .gridui-u-choice--rtl\:data-\[orientation\=vertical\]\:border-l-2:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
220
226
  border-left-style: var(--tw-border-style);
221
227
  border-left-width: 2px;
222
228
  }
@@ -232,7 +238,6 @@
232
238
  }
233
239
  .gridui-switch-control:disabled {
234
240
  cursor: not-allowed;
235
- opacity: 0.5;
236
241
  }
237
242
  .gridui-switch-control[data-readonly] {
238
243
  cursor: default;
@@ -326,6 +331,9 @@
326
331
  flex-shrink: 0;
327
332
  max-width: 45%;
328
333
  }
334
+ .gridui-switch-control:disabled:not(.gridui-switch-setting), .gridui-switch-setting:disabled > .gridui-switch-setting-copy, .gridui-switch-setting:disabled > .gridui-switch-setting-end > .gridui-switch-indicator {
335
+ opacity: 0.5;
336
+ }
329
337
  @media (prefers-reduced-motion: reduce) {
330
338
  .gridui-switch-indicator, .gridui-switch-thumb {
331
339
  transition: none;
@@ -4,8 +4,7 @@
4
4
  * @namespace Switch
5
5
  * @description Switch
6
6
  */
7
- import type { SwitchPresentationProps } from "../shared/switch-presentation";
8
- import type { ChoiceProps } from "../shared/use-choice";
7
+ import type { SwitchOptions } from "../shared/switch-options";
9
8
  import type { FC } from "react";
10
- export type SwitchProps = ChoiceProps & SwitchPresentationProps;
9
+ export type SwitchProps = SwitchOptions;
11
10
  export declare const Switch: FC<SwitchProps>;
@@ -4,14 +4,11 @@
4
4
  * @namespace SwitchGroup
5
5
  * @description Switch Group
6
6
  */
7
- import type { SwitchPresentationProps } from "../shared/switch-presentation";
8
- import type { SwitchProps } from "../switch/switch";
7
+ import type { SwitchOptions, SwitchPresentationProps, SwitchSettingCopy } from "../shared/switch-options";
9
8
  import type { ComponentPropsWithRef, FC, ReactNode } from "react";
10
- export type SwitchGroupItem = SwitchProps & {
9
+ export type SwitchGroupItem = SwitchOptions & SwitchSettingCopy & {
11
10
  /** Stable item identity and native control ID. */
12
11
  readonly id: string;
13
- readonly label: ReactNode;
14
- readonly description?: ReactNode;
15
12
  };
16
13
  export type SwitchGroupProps = Omit<ComponentPropsWithRef<"fieldset">, "children"> & SwitchPresentationProps & {
17
14
  readonly items: readonly SwitchGroupItem[];
@@ -4,12 +4,7 @@
4
4
  * @namespace SwitchPanel
5
5
  * @description Switch Panel
6
6
  */
7
- import type { SwitchProps } from "../switch/switch";
8
- import { type ComponentPropsWithRef, type FC, type ReactNode } from "react";
9
- export type SwitchPanelProps = ComponentPropsWithRef<"div"> & {
10
- readonly label: ReactNode;
11
- readonly description?: ReactNode;
12
- /** State, form attributes, accessible overrides and ref for the switch button. */
13
- readonly control: SwitchProps;
14
- };
7
+ import type { SwitchSettingOptions } from "../shared/switch-options";
8
+ import { type ComponentPropsWithRef, type FC } from "react";
9
+ export type SwitchPanelProps = ComponentPropsWithRef<"div"> & SwitchSettingOptions;
15
10
  export declare const SwitchPanel: FC<SwitchPanelProps>;
@@ -0,0 +1,104 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "@gridui/choice",
4
+ "version": "1.2.4",
5
+ "category": "core",
6
+ "description": "GridUI React choice",
7
+ "usage": "Core family. Public components: `Checkbox`, `Switch`, `SwitchGroup`, `SwitchPanel`, `ToggleGroup`, and `ToggleGroupItem`. Each exports its named Props contract. Switch presentation types and `SwitchGroupItem` describe their supported configuration.",
8
+ "documentation": [
9
+ "README.md",
10
+ "docs/switches.md",
11
+ "docs/tabs-and-choices.md"
12
+ ],
13
+ "exports": [
14
+ {
15
+ "name": "Checkbox",
16
+ "kind": "component",
17
+ "importPath": "@gridui/choice"
18
+ },
19
+ {
20
+ "name": "CheckboxProps",
21
+ "kind": "type",
22
+ "importPath": "@gridui/choice"
23
+ },
24
+ {
25
+ "name": "Switch",
26
+ "kind": "component",
27
+ "importPath": "@gridui/choice"
28
+ },
29
+ {
30
+ "name": "SwitchGroup",
31
+ "kind": "component",
32
+ "importPath": "@gridui/choice"
33
+ },
34
+ {
35
+ "name": "SwitchGroupItem",
36
+ "kind": "type",
37
+ "importPath": "@gridui/choice"
38
+ },
39
+ {
40
+ "name": "SwitchGroupProps",
41
+ "kind": "type",
42
+ "importPath": "@gridui/choice"
43
+ },
44
+ {
45
+ "name": "SwitchPanel",
46
+ "kind": "component",
47
+ "importPath": "@gridui/choice"
48
+ },
49
+ {
50
+ "name": "SwitchPanelProps",
51
+ "kind": "type",
52
+ "importPath": "@gridui/choice"
53
+ },
54
+ {
55
+ "name": "SwitchProps",
56
+ "kind": "type",
57
+ "importPath": "@gridui/choice"
58
+ },
59
+ {
60
+ "name": "SwitchStateLabels",
61
+ "kind": "type",
62
+ "importPath": "@gridui/choice"
63
+ },
64
+ {
65
+ "name": "SwitchVariant",
66
+ "kind": "type",
67
+ "importPath": "@gridui/choice"
68
+ },
69
+ {
70
+ "name": "ToggleGroup",
71
+ "kind": "component",
72
+ "importPath": "@gridui/choice"
73
+ },
74
+ {
75
+ "name": "ToggleGroupItem",
76
+ "kind": "component",
77
+ "importPath": "@gridui/choice"
78
+ },
79
+ {
80
+ "name": "ToggleGroupItemProps",
81
+ "kind": "type",
82
+ "importPath": "@gridui/choice"
83
+ },
84
+ {
85
+ "name": "ToggleGroupProps",
86
+ "kind": "type",
87
+ "importPath": "@gridui/choice"
88
+ }
89
+ ],
90
+ "styles": [
91
+ "@gridui/theme/styles.css",
92
+ "@gridui/form/styles.css",
93
+ "@gridui/choice/styles.css"
94
+ ],
95
+ "examples": [
96
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/checkbox.stories.tsx",
97
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/choices.stories.tsx",
98
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-control.stories.tsx",
99
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-group.stories.tsx",
100
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-panel.stories.tsx",
101
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch.stories.tsx",
102
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/toggle-group.stories.tsx"
103
+ ]
104
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/choice",
3
- "version": "1.2.1",
3
+ "version": "1.2.4",
4
4
  "description": "GridUI React choice",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -27,20 +27,20 @@
27
27
  "react-dom": "^19.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@gridui/form": "^3.0.0",
31
- "@gridui/interaction": "^1.1.2",
32
- "@gridui/style-utils": "^2.2.0",
33
- "@gridui/theme": "^2.5.1",
30
+ "@gridui/form": "^4.0.0",
31
+ "@gridui/interaction": "^1.2.1",
32
+ "@gridui/style-utils": "^3.0.0",
33
+ "@gridui/theme": "^2.5.3",
34
34
  "@radix-ui/react-checkbox": "1.4.1",
35
35
  "@radix-ui/react-toggle-group": "1.2.1",
36
36
  "class-variance-authority": "0.7.1",
37
- "lucide-react": "1.68.0"
37
+ "lucide-react": "1.70.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@gridui-internal/configuration": "0.0.0-internal",
41
- "@gridui/button": "3.1.0",
41
+ "@gridui/button": "4.0.0",
42
42
  "@jest/globals": "30.5.2",
43
- "@storybook/react-vite": "10.6.5",
43
+ "@storybook/react-vite": "10.6.6",
44
44
  "@types/jest": "30.0.0",
45
45
  "@types/node": "26.6.6",
46
46
  "@types/react": "19.3.0",
@@ -1,16 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @package Choice
4
- * @namespace Shared
5
- * @description Switch Presentation
6
- */
7
- export type SwitchVariant = "rail" | "state";
8
- export type SwitchStateLabels = {
9
- readonly checked: string;
10
- readonly unchecked: string;
11
- };
12
- export type SwitchPresentationProps = {
13
- readonly variant?: SwitchVariant | undefined;
14
- /** Visible state words; the accessible name must describe the setting. */
15
- readonly stateLabels?: SwitchStateLabels | undefined;
16
- };