@gridui/choice 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/styles.css +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -325,7 +325,7 @@ var SwitchSetting = (props) => {
|
|
|
325
325
|
SwitchControl,
|
|
326
326
|
{
|
|
327
327
|
...controlProps,
|
|
328
|
-
className: cn4("gridui-switch-setting
|
|
328
|
+
className: cn4("gridui-switch-setting", className),
|
|
329
329
|
"aria-labelledby": controlProps["aria-labelledby"] ?? (controlProps["aria-label"] ? void 0 : labelId),
|
|
330
330
|
"aria-describedby": describedBy,
|
|
331
331
|
children: (checked) => {
|
|
@@ -505,7 +505,7 @@ 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-
|
|
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", {
|
|
509
509
|
variants: {
|
|
510
510
|
layout: {
|
|
511
511
|
standard: "",
|
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 gridui-focus-contained\", 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-focus-contained 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;AAC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kC,aAAa;AA0B3B,qBAAAC,WAIA,OAAAC,MAHJ,QAAAC,aADI;AAlBb,IAAM,gBAAwC,CAAC,UAA8B;AAChF,QAAM,EAAE,SAAS,OAAO,YAAY,IAAI;AACxC,QAAM,EAAE,SAAS,aAAa,WAAW,GAAG,aAAa,IAAI;AAC7D,QAAM,KAAK,MAAM;AACjB,QAAM,UAAU,GAAG,EAAE;AACrB,QAAM,gBAAgB,GAAG,EAAE;AAC3B,QAAM,iBAAiB,gBAAgB,UAAa,gBAAgB;AACpE,QAAM,cAAc;AAAA,IAChB,aAAa,kBAAkB;AAAA,IAC/B,iBAAiB,gBAAgB;AAAA,EACrC,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAC/B,SAAQ,gBAAAD;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,WAAWF,IAAG,
|
|
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;AACj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AA,UACI,GAAG;AAAA,UACJ,MAAM;AAAA,UACN,WAAWH,IAAG,kBAAkB,EAAE,OAAO,CAAC,GAAG,SAAS;AAAA,UACtD,eAAa;AAAA,UACb,MAAK;AAAA,UACL,OAAO,WAAW,UAAU,QAAQ,MAAM,EAAE;AAAA,UAC5C,eAAe,CAAC,SAAS;AACrB,kBAAM,WAAW,WAAW,OAAO,KAAK,MAAM,EAAE;AAChD,gBAAI,UAAU,QAAW;AACrB,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;",
|
|
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
|
}
|
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer theme {
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
inherits: false;
|
|
418
418
|
}
|
|
419
419
|
@layer properties {
|
|
420
|
-
@supports ((-webkit-hyphens: none) and (not (margin-trim:
|
|
420
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
421
421
|
*, ::before, ::after, ::backdrop {
|
|
422
422
|
--tw-border-style: solid;
|
|
423
423
|
--tw-font-weight: initial;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/choice",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "GridUI React choice",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"@gridui/form": "^3.0.0",
|
|
31
31
|
"@gridui/interaction": "^1.1.2",
|
|
32
32
|
"@gridui/style-utils": "^2.2.0",
|
|
33
|
-
"@gridui/theme": "^2.5.
|
|
33
|
+
"@gridui/theme": "^2.5.1",
|
|
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.
|
|
37
|
+
"lucide-react": "1.68.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
41
|
-
"@gridui/button": "3.0
|
|
41
|
+
"@gridui/button": "3.1.0",
|
|
42
42
|
"@jest/globals": "30.5.2",
|
|
43
43
|
"@storybook/react-vite": "10.6.5",
|
|
44
44
|
"@types/jest": "30.0.0",
|