@gridui/choice 1.2.3 → 1.2.5

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,12 @@ 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.
48
+
49
+ [Component reference](docs/reference/README.md) contains focused API pages for each public component.
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 gridui-u-choice--forced-colors:data-[state=on]:forced-color-adjust-none gridui-u-choice--forced-colors:data-[state=on]:bg-[Highlight] gridui-u-choice--forced-colors:data-[state=on]:text-[HighlightText] gridui-u-choice--forced-colors:outline-[CanvasText]", {
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;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,uBAAS,QAAQ;AAAA,YACrB;AACA,4BAAgB,QAAQ;AAAA,UAC5B;AAAA;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;;;ACzCA,SAAS,OAAAI,YAAW;AAEb,IAAM,eAAeA,KAAI,mVAAmV;AAAA,EAC/W,UAAU;AAAA,IACN,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 gridui-u-choice--forced-colors:data-[state=on]:forced-color-adjust-none gridui-u-choice--forced-colors:data-[state=on]:bg-[Highlight] gridui-u-choice--forced-colors:data-[state=on]:text-[HighlightText] gridui-u-choice--forced-colors:outline-[CanvasText]\", {\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,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;AAC7B,cAAQ,SAAS,MAAM;AAAA,IAC3B,CAAC;AAAA,EACL;AACA,QAAM,SAAS,CAAC,MAAe,UAAiB;AAC5C,QAAI,YAAY,YAAY,MAAM,SAAS,QAAQ,WAAW,GAAG;AAC7D;AAAA,IACJ;AACA,UAAM,UAAU,cAAc,KAAK;AACnC,sBAAkB,MAAM,OAAO;AAC/B,QAAI,CAAC,QAAQ,cAAc,YAAY,QAAW;AAC9C,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AE,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;",
6
6
  "names": ["cn", "Fragment", "jsx", "jsxs", "Check", "Minus", "Fragment", "jsx", "jsxs", "cva", "cn", "jsx", "cn", "Fragment", "jsx", "jsxs", "cn", "jsx", "jsxs", "cn", "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>;