@gridui/choice 1.2.6 → 1.4.0
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 +16 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +3 -3
- package/dist/shared/switch-control.d.ts +6 -0
- package/dist/shared/switch-indicator.d.ts +6 -0
- package/dist/styled.js +3 -0
- package/dist/styles.css +114 -9
- package/dist/styles.local.css +457 -0
- package/docs/catalog.json +3 -3
- package/docs/reference/toggle-group.md +4 -4
- package/package.json +16 -11
package/README.md
CHANGED
|
@@ -3,10 +3,20 @@
|
|
|
3
3
|
Core family. Public components: `Checkbox`, `Switch`, `SwitchGroup`, `SwitchPanel`, `ToggleGroup`, and `ToggleGroupItem`. Each exports its named Props contract. Switch presentation types and `SwitchGroupItem` describe their supported configuration.
|
|
4
4
|
|
|
5
5
|
Import components from `@gridui/choice` and load `@gridui/choice/styles.css` after Theme.
|
|
6
|
-
|
|
6
|
+
Applications own routes, labels, state persistence, and branding.
|
|
7
7
|
|
|
8
8
|
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/choice/.changeset/history).
|
|
9
9
|
|
|
10
|
+
## Styles
|
|
11
|
+
|
|
12
|
+
Load Theme once. Use `@gridui/choice/styled` for automatic component CSS in
|
|
13
|
+
CSS-aware bundlers, or keep the CSS-free root import and load `@gridui/choice/styles.css`.
|
|
14
|
+
Both entries expose the same root API. The standalone stylesheet includes component
|
|
15
|
+
dependency styles; Theme/reset remain separate. See the
|
|
16
|
+
[integration guide](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/integration.md)
|
|
17
|
+
for static HTML loading, SSR limits, and avoiding duplicate CSS.
|
|
18
|
+
|
|
19
|
+
|
|
10
20
|
## Full-width choice cells
|
|
11
21
|
|
|
12
22
|
`ToggleGroup layout="cells"` uses equal-width tracks, shared seams, wrapping
|
|
@@ -47,3 +57,8 @@ Only the setting copy and indicator are dimmed. Standalone Switch retains its
|
|
|
47
57
|
whole-control disabled appearance.
|
|
48
58
|
|
|
49
59
|
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
|
60
|
+
|
|
61
|
+
Shared animation policy and tempo come from `MotionConfig` in `@gridui/motion`.
|
|
62
|
+
Disabled or reduced-motion policy settles decoration without disabling interaction.
|
|
63
|
+
See the [motion guide](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/motion)
|
|
64
|
+
for CSS scopes, portal behavior, and specialized timing contracts.
|
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-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-
|
|
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-status-danger-border");
|
|
53
53
|
|
|
54
54
|
// src/checkbox/checkbox.tsx
|
|
55
55
|
import { cn } from "@gridui/style-utils";
|
|
@@ -148,9 +148,11 @@ var Checkbox = (props) => {
|
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
// src/shared/switch-control.tsx
|
|
151
|
+
import { useMotionStyle } from "@gridui/motion/policy";
|
|
151
152
|
import { cn as cn2 } from "@gridui/style-utils";
|
|
152
153
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
153
154
|
var SwitchControl = (props) => {
|
|
155
|
+
const motionStyle = useMotionStyle();
|
|
154
156
|
const {
|
|
155
157
|
children,
|
|
156
158
|
className,
|
|
@@ -197,6 +199,7 @@ var SwitchControl = (props) => {
|
|
|
197
199
|
event.preventDefault();
|
|
198
200
|
},
|
|
199
201
|
className: cn2("gridui-switch-control", className),
|
|
202
|
+
style: { ...props.style, ...motionStyle },
|
|
200
203
|
children: children(current)
|
|
201
204
|
}
|
|
202
205
|
),
|
|
@@ -235,9 +238,11 @@ var SwitchControl = (props) => {
|
|
|
235
238
|
};
|
|
236
239
|
|
|
237
240
|
// src/shared/switch-indicator.tsx
|
|
241
|
+
import { useMotionStyle as useMotionStyle2 } from "@gridui/motion/policy";
|
|
238
242
|
import { Check as Check2, Minus as Minus2 } from "lucide-react";
|
|
239
243
|
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
240
244
|
var SwitchIndicator = (props) => {
|
|
245
|
+
const motionStyle = useMotionStyle2();
|
|
241
246
|
const { checked, variant = "rail", stateLabels = {
|
|
242
247
|
checked: "On",
|
|
243
248
|
unchecked: "Off"
|
|
@@ -249,6 +254,7 @@ var SwitchIndicator = (props) => {
|
|
|
249
254
|
"data-variant": variant,
|
|
250
255
|
"data-state": checked ? "checked" : "unchecked",
|
|
251
256
|
"aria-hidden": "true",
|
|
257
|
+
style: motionStyle,
|
|
252
258
|
children: variant === "rail" ? /* @__PURE__ */ jsx3(
|
|
253
259
|
"span",
|
|
254
260
|
{
|
|
@@ -505,7 +511,7 @@ var ToggleGroup = (props) => {
|
|
|
505
511
|
|
|
506
512
|
// src/toggle-group-item/style.ts
|
|
507
513
|
import { cva as cva4 } from "class-variance-authority";
|
|
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-
|
|
514
|
+
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-selection-background 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
515
|
variants: {
|
|
510
516
|
layout: {
|
|
511
517
|
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",
|
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-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,eAAS,IAAI;AAAA,IACjB;AAAA,EACJ;AACA,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;;;ACzDA,SAAS,WAAW;AAEb,IAAM,eAAe,IAAI,
|
|
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"]
|
|
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-status-danger-border\");\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 { useMotionStyle } from \"@gridui/motion/policy\";\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 motionStyle = useMotionStyle();\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 style={{ ...(props.style), ...motionStyle }}\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 { useMotionStyle } from \"@gridui/motion/policy\";\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 motionStyle = useMotionStyle();\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 style={motionStyle}\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-selection-background 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,YA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rD;AACJ;",
|
|
6
|
+
"names": ["cn", "Fragment", "jsx", "jsxs", "useMotionStyle", "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/styled.js
ADDED
package/dist/styles.css
CHANGED
|
@@ -1,3 +1,105 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--spacing: 0.25rem;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@layer utilities {
|
|
10
|
+
.gridui-u-form--sr-only {
|
|
11
|
+
position: absolute;
|
|
12
|
+
width: 1px;
|
|
13
|
+
height: 1px;
|
|
14
|
+
padding: 0;
|
|
15
|
+
margin: -1px;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
clip-path: inset(50%);
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
border-width: 0;
|
|
20
|
+
}
|
|
21
|
+
.gridui-u-form--m-0 {
|
|
22
|
+
margin: 0px;
|
|
23
|
+
}
|
|
24
|
+
.gridui-u-form--flex {
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
.gridui-u-form--grid {
|
|
28
|
+
display: grid;
|
|
29
|
+
}
|
|
30
|
+
.gridui-u-form--min-w-0 {
|
|
31
|
+
min-width: 0px;
|
|
32
|
+
}
|
|
33
|
+
.gridui-u-form--flex-1 {
|
|
34
|
+
flex: 1;
|
|
35
|
+
}
|
|
36
|
+
.gridui-u-form--basis-48 {
|
|
37
|
+
flex-basis: calc(var(--spacing) * 48);
|
|
38
|
+
}
|
|
39
|
+
.gridui-u-form--grid-cols-2 {
|
|
40
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
41
|
+
}
|
|
42
|
+
.gridui-u-form--flex-wrap {
|
|
43
|
+
flex-wrap: wrap;
|
|
44
|
+
}
|
|
45
|
+
.gridui-u-form--items-end {
|
|
46
|
+
align-items: flex-end;
|
|
47
|
+
}
|
|
48
|
+
.gridui-u-form--gap-gridui-8 {
|
|
49
|
+
gap: var(--gridui-space-8);
|
|
50
|
+
}
|
|
51
|
+
.gridui-u-form--gap-gridui-16 {
|
|
52
|
+
gap: var(--gridui-space-16);
|
|
53
|
+
}
|
|
54
|
+
.gridui-u-form--border-0 {
|
|
55
|
+
border-style: var(--tw-border-style);
|
|
56
|
+
border-width: 0px;
|
|
57
|
+
}
|
|
58
|
+
.gridui-u-form--p-0 {
|
|
59
|
+
padding: 0px;
|
|
60
|
+
}
|
|
61
|
+
.gridui-u-form--type-supporting {
|
|
62
|
+
font: var(--gridui-type-supporting);
|
|
63
|
+
font-family: var(--gridui-font-body);
|
|
64
|
+
letter-spacing: normal;
|
|
65
|
+
}
|
|
66
|
+
.gridui-u-form--wrap-anywhere {
|
|
67
|
+
overflow-wrap: anywhere;
|
|
68
|
+
}
|
|
69
|
+
.gridui-u-form--text-muted {
|
|
70
|
+
color: var(--gridui-muted);
|
|
71
|
+
}
|
|
72
|
+
.gridui-u-form--data-\[invalid\=\'true\'\]\:text-status-danger-text[data-invalid='true'] {
|
|
73
|
+
color: var(--gridui-status-danger-text);
|
|
74
|
+
}
|
|
75
|
+
:is(.gridui-u-form--\*\:data-\[span\=\'full\'\]\:col-span-full > *)[data-span='full'] {
|
|
76
|
+
grid-column: 1 / -1;
|
|
77
|
+
}
|
|
78
|
+
.gridui-u-form--\[\&\>legend\]\:mb-gridui-24 > legend {
|
|
79
|
+
margin-bottom: var(--gridui-space-24);
|
|
80
|
+
}
|
|
81
|
+
.gridui-u-form--\[\&\>legend\]\:p-0 > legend {
|
|
82
|
+
padding: 0px;
|
|
83
|
+
}
|
|
84
|
+
@media (max-width:24rem) {
|
|
85
|
+
.gridui-u-form--\[\@media\(max-width\:24rem\)\]\:grid-cols-\[1fr\] {
|
|
86
|
+
grid-template-columns: 1fr;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
@property --tw-border-style {
|
|
91
|
+
syntax: "*";
|
|
92
|
+
inherits: false;
|
|
93
|
+
initial-value: solid;
|
|
94
|
+
}
|
|
95
|
+
@layer properties {
|
|
96
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
97
|
+
*, ::before, ::after, ::backdrop {
|
|
98
|
+
--tw-border-style: solid;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
1
103
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
104
|
@layer properties;
|
|
3
105
|
@layer theme, base, components, utilities;
|
|
@@ -141,14 +243,17 @@
|
|
|
141
243
|
}
|
|
142
244
|
.gridui-u-choice--type-caption {
|
|
143
245
|
font: var(--gridui-type-caption);
|
|
246
|
+
font-family: var(--gridui-font-body);
|
|
144
247
|
letter-spacing: normal;
|
|
145
248
|
}
|
|
146
249
|
.gridui-u-choice--type-supporting {
|
|
147
250
|
font: var(--gridui-type-supporting);
|
|
251
|
+
font-family: var(--gridui-font-body);
|
|
148
252
|
letter-spacing: normal;
|
|
149
253
|
}
|
|
150
254
|
.gridui-u-choice--type-ui {
|
|
151
255
|
font: var(--gridui-type-ui);
|
|
256
|
+
font-family: var(--gridui-font-body);
|
|
152
257
|
letter-spacing: normal;
|
|
153
258
|
}
|
|
154
259
|
.gridui-u-choice--wrap-anywhere {
|
|
@@ -160,8 +265,8 @@
|
|
|
160
265
|
.gridui-u-choice--text-foreground {
|
|
161
266
|
color: var(--gridui-foreground);
|
|
162
267
|
}
|
|
163
|
-
.gridui-u-choice--aria-invalid\:border-danger-
|
|
164
|
-
border-color: var(--gridui-danger-
|
|
268
|
+
.gridui-u-choice--aria-invalid\:border-status-danger-border[aria-invalid="true"] {
|
|
269
|
+
border-color: var(--gridui-status-danger-border);
|
|
165
270
|
}
|
|
166
271
|
.gridui-u-choice--data-disabled\:cursor-not-allowed[data-disabled] {
|
|
167
272
|
cursor: not-allowed;
|
|
@@ -208,8 +313,8 @@
|
|
|
208
313
|
.gridui-u-choice--data-\[state\=indeterminate\]\:text-accent-foreground[data-state="indeterminate"] {
|
|
209
314
|
color: var(--gridui-accent-foreground);
|
|
210
315
|
}
|
|
211
|
-
.gridui-u-choice--data-\[state\=on\]\:bg-
|
|
212
|
-
background-color: var(--gridui-
|
|
316
|
+
.gridui-u-choice--data-\[state\=on\]\:bg-selection-background[data-state="on"] {
|
|
317
|
+
background-color: var(--gridui-selection-background);
|
|
213
318
|
}
|
|
214
319
|
.gridui-u-choice--data-\[state\=on\]\:font-medium[data-state="on"] {
|
|
215
320
|
--tw-font-weight: var(--font-weight-medium);
|
|
@@ -269,11 +374,11 @@
|
|
|
269
374
|
background: var(--gridui-background);
|
|
270
375
|
color: var(--gridui-foreground);
|
|
271
376
|
pointer-events: none;
|
|
272
|
-
transition: background-color var(--gridui-motion-duration-quick), border-color var(--gridui-motion-duration-quick);
|
|
377
|
+
transition: var(--gridui-motion-transition, background-color calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)), border-color calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)));
|
|
273
378
|
}
|
|
274
379
|
.gridui-switch-indicator[data-state="checked"] {
|
|
275
380
|
border-color: var(--gridui-accent-background);
|
|
276
|
-
background: var(--gridui-
|
|
381
|
+
background: var(--gridui-selection-background);
|
|
277
382
|
}
|
|
278
383
|
.gridui-switch-thumb {
|
|
279
384
|
flex-shrink: 0;
|
|
@@ -282,7 +387,7 @@
|
|
|
282
387
|
margin-inline-start: 0;
|
|
283
388
|
border-radius: var(--gridui-control-radius);
|
|
284
389
|
background: var(--gridui-muted);
|
|
285
|
-
transition: margin-inline-start var(--gridui-motion-duration-quick) var(--gridui-motion-ease-out);
|
|
390
|
+
transition: var(--gridui-motion-transition, margin-inline-start calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
|
|
286
391
|
}
|
|
287
392
|
.gridui-switch-indicator[data-state="checked"] .gridui-switch-thumb {
|
|
288
393
|
margin-inline-start: max(0px, calc(100% - var(--_gridui-switch-thumb-size)));
|
|
@@ -313,7 +418,7 @@
|
|
|
313
418
|
overflow-wrap: anywhere;
|
|
314
419
|
}
|
|
315
420
|
.gridui-switch-control[aria-invalid="true"] .gridui-switch-indicator {
|
|
316
|
-
border-color: var(--gridui-danger-
|
|
421
|
+
border-color: var(--gridui-status-danger-border);
|
|
317
422
|
}
|
|
318
423
|
.gridui-switch-setting {
|
|
319
424
|
display: flex;
|
|
@@ -427,7 +532,7 @@
|
|
|
427
532
|
border: 0;
|
|
428
533
|
}
|
|
429
534
|
.gridui-switch-panel > .gridui-switch-setting[aria-invalid="true"] {
|
|
430
|
-
box-shadow: inset 0 0 0 1px var(--gridui-danger-
|
|
535
|
+
box-shadow: inset 0 0 0 1px var(--gridui-status-danger-border);
|
|
431
536
|
}
|
|
432
537
|
.gridui-switch-panel-content {
|
|
433
538
|
box-sizing: border-box;
|
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--spacing: 0.25rem;
|
|
7
|
+
--font-weight-medium: 500;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
@layer utilities {
|
|
11
|
+
.gridui-u-choice--sr-only {
|
|
12
|
+
position: absolute;
|
|
13
|
+
width: 1px;
|
|
14
|
+
height: 1px;
|
|
15
|
+
padding: 0;
|
|
16
|
+
margin: -1px;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
clip-path: inset(50%);
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
border-width: 0;
|
|
21
|
+
}
|
|
22
|
+
.gridui-u-choice--grid {
|
|
23
|
+
display: grid;
|
|
24
|
+
}
|
|
25
|
+
.gridui-u-choice--inline-flex {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
}
|
|
28
|
+
.gridui-u-choice--size-5 {
|
|
29
|
+
width: calc(var(--spacing) * 5);
|
|
30
|
+
height: calc(var(--spacing) * 5);
|
|
31
|
+
}
|
|
32
|
+
.gridui-u-choice--min-h-gridui-control {
|
|
33
|
+
min-height: var(--gridui-control-min-height);
|
|
34
|
+
}
|
|
35
|
+
.gridui-u-choice--w-fit {
|
|
36
|
+
width: fit-content;
|
|
37
|
+
}
|
|
38
|
+
.gridui-u-choice--w-full {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
.gridui-u-choice--max-w-full {
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
}
|
|
44
|
+
.gridui-u-choice--min-w-0 {
|
|
45
|
+
min-width: 0px;
|
|
46
|
+
}
|
|
47
|
+
.gridui-u-choice--min-w-gridui-control {
|
|
48
|
+
min-width: var(--gridui-control-min-height);
|
|
49
|
+
}
|
|
50
|
+
.gridui-u-choice--shrink-0 {
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
}
|
|
53
|
+
.gridui-u-choice--grow {
|
|
54
|
+
flex-grow: 1;
|
|
55
|
+
}
|
|
56
|
+
.gridui-u-choice--basis-auto {
|
|
57
|
+
flex-basis: auto;
|
|
58
|
+
}
|
|
59
|
+
.gridui-u-choice--cursor-pointer {
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
}
|
|
62
|
+
.gridui-u-choice--auto-cols-fr {
|
|
63
|
+
grid-auto-columns: minmax(0, 1fr);
|
|
64
|
+
}
|
|
65
|
+
.gridui-u-choice--grid-flow-col {
|
|
66
|
+
grid-auto-flow: column;
|
|
67
|
+
}
|
|
68
|
+
.gridui-u-choice--flex-wrap {
|
|
69
|
+
flex-wrap: wrap;
|
|
70
|
+
}
|
|
71
|
+
.gridui-u-choice--items-center {
|
|
72
|
+
align-items: center;
|
|
73
|
+
}
|
|
74
|
+
.gridui-u-choice--justify-center {
|
|
75
|
+
justify-content: center;
|
|
76
|
+
}
|
|
77
|
+
.gridui-u-choice--gap-px {
|
|
78
|
+
gap: 1px;
|
|
79
|
+
}
|
|
80
|
+
.gridui-u-choice--rounded-control {
|
|
81
|
+
border-radius: var(--gridui-control-radius);
|
|
82
|
+
}
|
|
83
|
+
.gridui-u-choice--border {
|
|
84
|
+
border-style: var(--tw-border-style);
|
|
85
|
+
border-width: 1px;
|
|
86
|
+
}
|
|
87
|
+
.gridui-u-choice--border-0 {
|
|
88
|
+
border-style: var(--tw-border-style);
|
|
89
|
+
border-width: 0px;
|
|
90
|
+
}
|
|
91
|
+
.gridui-u-choice--border-x-0 {
|
|
92
|
+
border-inline-style: var(--tw-border-style);
|
|
93
|
+
border-inline-width: 0px;
|
|
94
|
+
}
|
|
95
|
+
.gridui-u-choice--border-t-0 {
|
|
96
|
+
border-top-style: var(--tw-border-style);
|
|
97
|
+
border-top-width: 0px;
|
|
98
|
+
}
|
|
99
|
+
.gridui-u-choice--border-solid {
|
|
100
|
+
--tw-border-style: solid;
|
|
101
|
+
border-style: solid;
|
|
102
|
+
}
|
|
103
|
+
.gridui-u-choice--border-border {
|
|
104
|
+
border-color: var(--gridui-border);
|
|
105
|
+
}
|
|
106
|
+
.gridui-u-choice--border-control-border {
|
|
107
|
+
border-color: var(--gridui-control-border);
|
|
108
|
+
}
|
|
109
|
+
.gridui-u-choice--border-transparent {
|
|
110
|
+
border-color: transparent;
|
|
111
|
+
}
|
|
112
|
+
.gridui-u-choice--bg-background {
|
|
113
|
+
background-color: var(--gridui-background);
|
|
114
|
+
}
|
|
115
|
+
.gridui-u-choice--bg-border {
|
|
116
|
+
background-color: var(--gridui-border);
|
|
117
|
+
}
|
|
118
|
+
.gridui-u-choice--bg-transparent {
|
|
119
|
+
background-color: transparent;
|
|
120
|
+
}
|
|
121
|
+
.gridui-u-choice--p-0 {
|
|
122
|
+
padding: 0px;
|
|
123
|
+
}
|
|
124
|
+
.gridui-u-choice--px-gridui-8 {
|
|
125
|
+
padding-inline: var(--gridui-space-8);
|
|
126
|
+
}
|
|
127
|
+
.gridui-u-choice--px-gridui-16 {
|
|
128
|
+
padding-inline: var(--gridui-space-16);
|
|
129
|
+
}
|
|
130
|
+
.gridui-u-choice--py-gridui-8 {
|
|
131
|
+
padding-block: var(--gridui-space-8);
|
|
132
|
+
}
|
|
133
|
+
.gridui-u-choice--py-gridui-16 {
|
|
134
|
+
padding-block: var(--gridui-space-16);
|
|
135
|
+
}
|
|
136
|
+
.gridui-u-choice--text-center {
|
|
137
|
+
text-align: center;
|
|
138
|
+
}
|
|
139
|
+
.gridui-u-choice--align-middle {
|
|
140
|
+
vertical-align: middle;
|
|
141
|
+
}
|
|
142
|
+
.gridui-u-choice--type-caption {
|
|
143
|
+
font: var(--gridui-type-caption);
|
|
144
|
+
font-family: var(--gridui-font-body);
|
|
145
|
+
letter-spacing: normal;
|
|
146
|
+
}
|
|
147
|
+
.gridui-u-choice--type-supporting {
|
|
148
|
+
font: var(--gridui-type-supporting);
|
|
149
|
+
font-family: var(--gridui-font-body);
|
|
150
|
+
letter-spacing: normal;
|
|
151
|
+
}
|
|
152
|
+
.gridui-u-choice--type-ui {
|
|
153
|
+
font: var(--gridui-type-ui);
|
|
154
|
+
font-family: var(--gridui-font-body);
|
|
155
|
+
letter-spacing: normal;
|
|
156
|
+
}
|
|
157
|
+
.gridui-u-choice--wrap-anywhere {
|
|
158
|
+
overflow-wrap: anywhere;
|
|
159
|
+
}
|
|
160
|
+
.gridui-u-choice--whitespace-normal {
|
|
161
|
+
white-space: normal;
|
|
162
|
+
}
|
|
163
|
+
.gridui-u-choice--text-foreground {
|
|
164
|
+
color: var(--gridui-foreground);
|
|
165
|
+
}
|
|
166
|
+
.gridui-u-choice--aria-invalid\:border-status-danger-border[aria-invalid="true"] {
|
|
167
|
+
border-color: var(--gridui-status-danger-border);
|
|
168
|
+
}
|
|
169
|
+
.gridui-u-choice--data-disabled\:cursor-not-allowed[data-disabled] {
|
|
170
|
+
cursor: not-allowed;
|
|
171
|
+
}
|
|
172
|
+
.gridui-u-choice--data-disabled\:opacity-50[data-disabled] {
|
|
173
|
+
opacity: 50%;
|
|
174
|
+
}
|
|
175
|
+
.gridui-u-choice--data-readonly\:cursor-default[data-readonly] {
|
|
176
|
+
cursor: default;
|
|
177
|
+
}
|
|
178
|
+
.gridui-u-choice--data-\[orientation\=horizontal\]\:border-b-2[data-orientation="horizontal"] {
|
|
179
|
+
border-bottom-style: var(--tw-border-style);
|
|
180
|
+
border-bottom-width: 2px;
|
|
181
|
+
}
|
|
182
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:grid-flow-row[data-orientation="vertical"] {
|
|
183
|
+
grid-auto-flow: row;
|
|
184
|
+
}
|
|
185
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:auto-rows-fr[data-orientation="vertical"] {
|
|
186
|
+
grid-auto-rows: minmax(0, 1fr);
|
|
187
|
+
}
|
|
188
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:grid-cols-1[data-orientation="vertical"] {
|
|
189
|
+
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
190
|
+
}
|
|
191
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:flex-col[data-orientation="vertical"] {
|
|
192
|
+
flex-direction: column;
|
|
193
|
+
}
|
|
194
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:border-r-2[data-orientation="vertical"] {
|
|
195
|
+
border-right-style: var(--tw-border-style);
|
|
196
|
+
border-right-width: 2px;
|
|
197
|
+
}
|
|
198
|
+
.gridui-u-choice--data-\[orientation\=vertical\]\:border-b-0[data-orientation="vertical"] {
|
|
199
|
+
border-bottom-style: var(--tw-border-style);
|
|
200
|
+
border-bottom-width: 0px;
|
|
201
|
+
}
|
|
202
|
+
.gridui-u-choice--data-\[state\=checked\]\:bg-accent-background[data-state="checked"] {
|
|
203
|
+
background-color: var(--gridui-accent-background);
|
|
204
|
+
}
|
|
205
|
+
.gridui-u-choice--data-\[state\=checked\]\:text-accent-foreground[data-state="checked"] {
|
|
206
|
+
color: var(--gridui-accent-foreground);
|
|
207
|
+
}
|
|
208
|
+
.gridui-u-choice--data-\[state\=indeterminate\]\:bg-accent-background[data-state="indeterminate"] {
|
|
209
|
+
background-color: var(--gridui-accent-background);
|
|
210
|
+
}
|
|
211
|
+
.gridui-u-choice--data-\[state\=indeterminate\]\:text-accent-foreground[data-state="indeterminate"] {
|
|
212
|
+
color: var(--gridui-accent-foreground);
|
|
213
|
+
}
|
|
214
|
+
.gridui-u-choice--data-\[state\=on\]\:bg-selection-background[data-state="on"] {
|
|
215
|
+
background-color: var(--gridui-selection-background);
|
|
216
|
+
}
|
|
217
|
+
.gridui-u-choice--data-\[state\=on\]\:font-medium[data-state="on"] {
|
|
218
|
+
--tw-font-weight: var(--font-weight-medium);
|
|
219
|
+
font-weight: var(--font-weight-medium);
|
|
220
|
+
}
|
|
221
|
+
.gridui-u-choice--data-\[state\=on\]\:text-foreground[data-state="on"] {
|
|
222
|
+
color: var(--gridui-foreground);
|
|
223
|
+
}
|
|
224
|
+
.gridui-u-choice--rtl\:data-\[orientation\=vertical\]\:border-r-0:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
|
|
225
|
+
border-right-style: var(--tw-border-style);
|
|
226
|
+
border-right-width: 0px;
|
|
227
|
+
}
|
|
228
|
+
.gridui-u-choice--rtl\:data-\[orientation\=vertical\]\:border-l-2:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)[data-orientation="vertical"] {
|
|
229
|
+
border-left-style: var(--tw-border-style);
|
|
230
|
+
border-left-width: 2px;
|
|
231
|
+
}
|
|
232
|
+
@media (forced-colors: active) {
|
|
233
|
+
.gridui-u-choice--forced-colors\:outline-\[CanvasText\] {
|
|
234
|
+
outline-color: CanvasText;
|
|
235
|
+
}
|
|
236
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:bg-\[Highlight\][data-state="on"] {
|
|
237
|
+
background-color: Highlight;
|
|
238
|
+
}
|
|
239
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:text-\[HighlightText\][data-state="on"] {
|
|
240
|
+
color: HighlightText;
|
|
241
|
+
}
|
|
242
|
+
.gridui-u-choice--forced-colors\:data-\[state\=on\]\:forced-color-adjust-none[data-state="on"] {
|
|
243
|
+
forced-color-adjust: none;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
@layer components {
|
|
248
|
+
.gridui-switch-control, .gridui-switch-indicator, .gridui-switch-setting-copy, .gridui-switch-setting-end {
|
|
249
|
+
box-sizing: border-box;
|
|
250
|
+
}
|
|
251
|
+
.gridui-switch-control {
|
|
252
|
+
color: var(--gridui-foreground);
|
|
253
|
+
border-radius: var(--gridui-control-radius);
|
|
254
|
+
cursor: pointer;
|
|
255
|
+
}
|
|
256
|
+
.gridui-switch-control:disabled {
|
|
257
|
+
cursor: not-allowed;
|
|
258
|
+
}
|
|
259
|
+
.gridui-switch-control[data-readonly] {
|
|
260
|
+
cursor: default;
|
|
261
|
+
}
|
|
262
|
+
.gridui-switch-indicator {
|
|
263
|
+
--_gridui-switch-thumb-size: 1.125rem;
|
|
264
|
+
display: inline-flex;
|
|
265
|
+
flex-shrink: 0;
|
|
266
|
+
align-items: center;
|
|
267
|
+
width: 3rem;
|
|
268
|
+
height: 1.625rem;
|
|
269
|
+
padding: var(--gridui-space-2);
|
|
270
|
+
border: 1px solid var(--gridui-control-border);
|
|
271
|
+
border-radius: var(--gridui-control-radius);
|
|
272
|
+
background: var(--gridui-background);
|
|
273
|
+
color: var(--gridui-foreground);
|
|
274
|
+
pointer-events: none;
|
|
275
|
+
transition: var(--gridui-motion-transition, background-color calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)), border-color calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)));
|
|
276
|
+
}
|
|
277
|
+
.gridui-switch-indicator[data-state="checked"] {
|
|
278
|
+
border-color: var(--gridui-accent-background);
|
|
279
|
+
background: var(--gridui-selection-background);
|
|
280
|
+
}
|
|
281
|
+
.gridui-switch-thumb {
|
|
282
|
+
flex-shrink: 0;
|
|
283
|
+
width: var(--_gridui-switch-thumb-size);
|
|
284
|
+
height: var(--_gridui-switch-thumb-size);
|
|
285
|
+
margin-inline-start: 0;
|
|
286
|
+
border-radius: var(--gridui-control-radius);
|
|
287
|
+
background: var(--gridui-muted);
|
|
288
|
+
transition: var(--gridui-motion-transition, margin-inline-start calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
|
|
289
|
+
}
|
|
290
|
+
.gridui-switch-indicator[data-state="checked"] .gridui-switch-thumb {
|
|
291
|
+
margin-inline-start: max(0px, calc(100% - var(--_gridui-switch-thumb-size)));
|
|
292
|
+
background: var(--gridui-accent-background);
|
|
293
|
+
}
|
|
294
|
+
.gridui-switch-indicator[data-variant="state"] {
|
|
295
|
+
justify-content: center;
|
|
296
|
+
gap: var(--gridui-space-4);
|
|
297
|
+
width: max-content;
|
|
298
|
+
min-width: min(4.5rem, 100%);
|
|
299
|
+
max-width: 100%;
|
|
300
|
+
height: auto;
|
|
301
|
+
min-height: 2rem;
|
|
302
|
+
padding: var(--gridui-space-4) var(--gridui-space-8);
|
|
303
|
+
}
|
|
304
|
+
.gridui-switch-indicator[data-variant="state"][data-state="checked"] {
|
|
305
|
+
color: var(--gridui-accent-foreground);
|
|
306
|
+
background: var(--gridui-accent-background);
|
|
307
|
+
}
|
|
308
|
+
.gridui-switch-state-icon {
|
|
309
|
+
flex-shrink: 0;
|
|
310
|
+
width: var(--gridui-icon-size);
|
|
311
|
+
height: var(--gridui-icon-size);
|
|
312
|
+
}
|
|
313
|
+
.gridui-switch-state-label {
|
|
314
|
+
min-width: 0;
|
|
315
|
+
text-align: center;
|
|
316
|
+
overflow-wrap: anywhere;
|
|
317
|
+
}
|
|
318
|
+
.gridui-switch-control[aria-invalid="true"] .gridui-switch-indicator {
|
|
319
|
+
border-color: var(--gridui-status-danger-border);
|
|
320
|
+
}
|
|
321
|
+
.gridui-switch-setting {
|
|
322
|
+
display: flex;
|
|
323
|
+
align-items: center;
|
|
324
|
+
justify-content: space-between;
|
|
325
|
+
gap: var(--gridui-space-16);
|
|
326
|
+
width: 100%;
|
|
327
|
+
min-width: 0;
|
|
328
|
+
min-height: var(--gridui-control-min-height);
|
|
329
|
+
padding: var(--gridui-space-12) var(--gridui-space-16);
|
|
330
|
+
border: 0;
|
|
331
|
+
background: var(--gridui-background);
|
|
332
|
+
text-align: start;
|
|
333
|
+
}
|
|
334
|
+
.gridui-switch-setting-copy {
|
|
335
|
+
display: grid;
|
|
336
|
+
gap: var(--gridui-space-4);
|
|
337
|
+
flex: 1;
|
|
338
|
+
min-width: 0;
|
|
339
|
+
overflow-wrap: anywhere;
|
|
340
|
+
}
|
|
341
|
+
.gridui-switch-setting-description {
|
|
342
|
+
color: var(--gridui-muted);
|
|
343
|
+
}
|
|
344
|
+
.gridui-switch-setting-end {
|
|
345
|
+
display: flex;
|
|
346
|
+
align-items: center;
|
|
347
|
+
justify-content: center;
|
|
348
|
+
flex-shrink: 0;
|
|
349
|
+
max-width: 45%;
|
|
350
|
+
}
|
|
351
|
+
.gridui-switch-control:disabled:not(.gridui-switch-setting), .gridui-switch-setting:disabled > .gridui-switch-setting-copy, .gridui-switch-setting:disabled > .gridui-switch-setting-end > .gridui-switch-indicator {
|
|
352
|
+
opacity: 0.5;
|
|
353
|
+
}
|
|
354
|
+
@media (forced-colors: active) {
|
|
355
|
+
.gridui-switch-thumb {
|
|
356
|
+
background: CanvasText;
|
|
357
|
+
forced-color-adjust: none;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
@media (prefers-reduced-motion: reduce) {
|
|
361
|
+
.gridui-switch-indicator, .gridui-switch-thumb {
|
|
362
|
+
transition: none;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
.gridui-switch-group {
|
|
366
|
+
box-sizing: border-box;
|
|
367
|
+
min-width: 0;
|
|
368
|
+
margin: 0;
|
|
369
|
+
padding: 0;
|
|
370
|
+
border: 1px solid var(--gridui-border);
|
|
371
|
+
border-radius: var(--gridui-control-radius);
|
|
372
|
+
}
|
|
373
|
+
.gridui-switch-group-legend {
|
|
374
|
+
margin-inline: var(--gridui-space-8);
|
|
375
|
+
padding-inline: var(--gridui-space-8);
|
|
376
|
+
color: var(--gridui-foreground);
|
|
377
|
+
}
|
|
378
|
+
.gridui-switch-group > .gridui-switch-setting ~ .gridui-switch-setting {
|
|
379
|
+
border-block-start: 1px solid var(--gridui-border);
|
|
380
|
+
}
|
|
381
|
+
.gridui-switch-group[data-density="compact"] > .gridui-switch-setting {
|
|
382
|
+
min-height: 3.75rem;
|
|
383
|
+
padding-block: var(--gridui-space-8);
|
|
384
|
+
}
|
|
385
|
+
.gridui-switch-group[data-density="comfortable"] > .gridui-switch-setting {
|
|
386
|
+
min-height: 4.75rem;
|
|
387
|
+
padding-block: var(--gridui-space-16);
|
|
388
|
+
}
|
|
389
|
+
.gridui-switch-panel {
|
|
390
|
+
box-sizing: border-box;
|
|
391
|
+
min-width: 0;
|
|
392
|
+
border: 1px solid var(--gridui-border);
|
|
393
|
+
border-radius: var(--gridui-control-radius);
|
|
394
|
+
background: var(--gridui-background);
|
|
395
|
+
color: var(--gridui-foreground);
|
|
396
|
+
}
|
|
397
|
+
.gridui-switch-panel > .gridui-switch-setting {
|
|
398
|
+
align-items: stretch;
|
|
399
|
+
gap: 0;
|
|
400
|
+
min-height: 5rem;
|
|
401
|
+
padding: 0;
|
|
402
|
+
}
|
|
403
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-copy {
|
|
404
|
+
align-content: center;
|
|
405
|
+
padding: var(--gridui-space-16);
|
|
406
|
+
}
|
|
407
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end {
|
|
408
|
+
width: 6rem;
|
|
409
|
+
border-inline-start: 1px solid var(--gridui-border);
|
|
410
|
+
background: var(--gridui-surface);
|
|
411
|
+
}
|
|
412
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end > .gridui-switch-indicator[data-variant="rail"] {
|
|
413
|
+
position: relative;
|
|
414
|
+
border-color: transparent;
|
|
415
|
+
background: transparent;
|
|
416
|
+
}
|
|
417
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end > .gridui-switch-indicator[data-variant="rail"]::before {
|
|
418
|
+
content: "";
|
|
419
|
+
position: absolute;
|
|
420
|
+
inset-inline: var(--gridui-space-2);
|
|
421
|
+
height: 1px;
|
|
422
|
+
background: var(--gridui-control-border);
|
|
423
|
+
}
|
|
424
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end > .gridui-switch-indicator > .gridui-switch-thumb {
|
|
425
|
+
position: relative;
|
|
426
|
+
}
|
|
427
|
+
.gridui-switch-panel > .gridui-switch-setting > .gridui-switch-setting-end > .gridui-switch-indicator[data-variant="state"] {
|
|
428
|
+
align-self: stretch;
|
|
429
|
+
width: 100%;
|
|
430
|
+
border: 0;
|
|
431
|
+
}
|
|
432
|
+
.gridui-switch-panel > .gridui-switch-setting[aria-invalid="true"] {
|
|
433
|
+
box-shadow: inset 0 0 0 1px var(--gridui-status-danger-border);
|
|
434
|
+
}
|
|
435
|
+
.gridui-switch-panel-content {
|
|
436
|
+
box-sizing: border-box;
|
|
437
|
+
padding: var(--gridui-space-16);
|
|
438
|
+
border-block-start: 1px solid var(--gridui-border);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
@property --tw-border-style {
|
|
442
|
+
syntax: "*";
|
|
443
|
+
inherits: false;
|
|
444
|
+
initial-value: solid;
|
|
445
|
+
}
|
|
446
|
+
@property --tw-font-weight {
|
|
447
|
+
syntax: "*";
|
|
448
|
+
inherits: false;
|
|
449
|
+
}
|
|
450
|
+
@layer properties {
|
|
451
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
452
|
+
*, ::before, ::after, ::backdrop {
|
|
453
|
+
--tw-border-style: solid;
|
|
454
|
+
--tw-font-weight: initial;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
package/docs/catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/choice",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"category": "core",
|
|
6
6
|
"description": "GridUI React choice",
|
|
7
7
|
"usage": "Core family. Public components: `Checkbox`, `Switch`, `SwitchGroup`, `SwitchPanel`, `ToggleGroup`, and `ToggleGroupItem`. Each exports its named Props contract. Switch presentation types and `SwitchGroupItem` describe their supported configuration.",
|
|
@@ -99,17 +99,17 @@
|
|
|
99
99
|
"@gridui/form/styles.css",
|
|
100
100
|
"@gridui/choice/styles.css"
|
|
101
101
|
],
|
|
102
|
+
"styledImport": "@gridui/choice/styled",
|
|
102
103
|
"examples": [
|
|
103
104
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/boolean-settings.mdx",
|
|
104
105
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/checkboxes.mdx",
|
|
106
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/getting-started.mdx",
|
|
105
107
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/settings-panels.mdx",
|
|
106
108
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/toggle-selections.mdx",
|
|
107
109
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/checkbox.stories.tsx",
|
|
108
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/choices.stories.tsx",
|
|
109
110
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-control.stories.tsx",
|
|
110
111
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-group.stories.tsx",
|
|
111
112
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch-panel.stories.tsx",
|
|
112
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/switch.stories.tsx",
|
|
113
113
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/choice/stories/toggle-group.stories.tsx"
|
|
114
114
|
]
|
|
115
115
|
}
|
|
@@ -69,16 +69,16 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
|
|
|
69
69
|
|
|
70
70
|
Whether the group is disabled from user interaction.
|
|
71
71
|
|
|
72
|
+
### orientation
|
|
73
|
+
|
|
74
|
+
``("vertical" | "horizontal") | undefined`` · Optional
|
|
75
|
+
|
|
72
76
|
### rovingFocus
|
|
73
77
|
|
|
74
78
|
``boolean | undefined`` · Optional
|
|
75
79
|
|
|
76
80
|
Whether the group should maintain roving focus of its buttons.
|
|
77
81
|
|
|
78
|
-
### orientation
|
|
79
|
-
|
|
80
|
-
``("vertical" | "horizontal") | undefined`` · Optional
|
|
81
|
-
|
|
82
82
|
### multiple
|
|
83
83
|
|
|
84
84
|
``boolean | undefined`` · Optional
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/choice",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "GridUI React choice",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -10,14 +10,19 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"sideEffects": [
|
|
13
|
-
"**/*.css"
|
|
13
|
+
"**/*.css",
|
|
14
|
+
"./dist/styled.js"
|
|
14
15
|
],
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
17
18
|
"types": "./dist/index.d.ts",
|
|
18
19
|
"import": "./dist/index.js"
|
|
19
20
|
},
|
|
20
|
-
"./styles.css": "./dist/styles.css"
|
|
21
|
+
"./styles.css": "./dist/styles.css",
|
|
22
|
+
"./styled": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/styled.js"
|
|
25
|
+
}
|
|
21
26
|
},
|
|
22
27
|
"publishConfig": {
|
|
23
28
|
"access": "public"
|
|
@@ -27,20 +32,21 @@
|
|
|
27
32
|
"react-dom": "^19.2.0"
|
|
28
33
|
},
|
|
29
34
|
"dependencies": {
|
|
30
|
-
"@gridui/form": "^4.
|
|
31
|
-
"@gridui/interaction": "^1.
|
|
35
|
+
"@gridui/form": "^4.2.0",
|
|
36
|
+
"@gridui/interaction": "^1.3.0",
|
|
37
|
+
"@gridui/motion": "^1.0.2",
|
|
32
38
|
"@gridui/style-utils": "^4.0.0",
|
|
33
|
-
"@gridui/theme": "^
|
|
39
|
+
"@gridui/theme": "^4.0.0",
|
|
34
40
|
"@radix-ui/react-checkbox": "1.4.1",
|
|
35
41
|
"@radix-ui/react-toggle-group": "1.2.1",
|
|
36
42
|
"class-variance-authority": "0.7.1",
|
|
37
|
-
"lucide-react": "1.
|
|
43
|
+
"lucide-react": "1.72.0"
|
|
38
44
|
},
|
|
39
45
|
"devDependencies": {
|
|
40
46
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
41
|
-
"@gridui/button": "
|
|
47
|
+
"@gridui/button": "5.2.0",
|
|
42
48
|
"@jest/globals": "30.5.2",
|
|
43
|
-
"@storybook/react-vite": "10.6.
|
|
49
|
+
"@storybook/react-vite": "10.6.7",
|
|
44
50
|
"@types/jest": "30.0.0",
|
|
45
51
|
"@types/node": "26.6.6",
|
|
46
52
|
"@types/react": "19.3.0",
|
|
@@ -53,7 +59,6 @@
|
|
|
53
59
|
"scripts": {
|
|
54
60
|
"build": "node ../../scripts/compilation/package.ts",
|
|
55
61
|
"compile": "tsc --project tsconfig.json",
|
|
56
|
-
"test": "jest"
|
|
57
|
-
"coverage": "jest --coverage"
|
|
62
|
+
"test": "jest"
|
|
58
63
|
}
|
|
59
64
|
}
|