@lobehub/ui 6.2.0 → 6.3.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/es/Accordion/style.d.mts +1 -1
- package/es/Text/style.d.mts +3 -3
- package/es/ToggleGroup/ToggleGroup.d.mts +1 -1
- package/es/ToggleGroup/ToggleGroup.mjs +18 -9
- package/es/ToggleGroup/ToggleGroup.mjs.map +1 -1
- package/es/ToggleGroup/atoms.mjs +16 -4
- package/es/ToggleGroup/atoms.mjs.map +1 -1
- package/es/ToggleGroup/style.d.mts +36 -2
- package/es/ToggleGroup/style.mjs +42 -2
- package/es/ToggleGroup/style.mjs.map +1 -1
- package/es/ToggleGroup/type.d.mts +21 -5
- package/es/eslint/index.d.mts +1 -1
- package/es/node_modules/.pnpm/{eslint@10.12.0_jiti@2.6.1_supports-color@10.2.2 → eslint@10.13.0_jiti@2.6.1_supports-color@10.2.2}/node_modules/eslint/lib/types/index.d.mts +1 -1
- package/es/style.css +4 -0
- package/package.json +1 -1
package/es/Accordion/style.d.mts
CHANGED
package/es/Text/style.d.mts
CHANGED
|
@@ -14,13 +14,13 @@ export declare const textStyles: {
|
|
|
14
14
|
text: string;
|
|
15
15
|
disabled: string;
|
|
16
16
|
danger: string;
|
|
17
|
+
success: string;
|
|
18
|
+
info: string;
|
|
19
|
+
warning: string;
|
|
17
20
|
delete: string;
|
|
18
21
|
ellipsis: string;
|
|
19
22
|
italic: string;
|
|
20
23
|
underline: string;
|
|
21
|
-
success: string;
|
|
22
|
-
warning: string;
|
|
23
|
-
info: string;
|
|
24
24
|
ellipsisMulti: string;
|
|
25
25
|
secondary: string;
|
|
26
26
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ToggleGroupProps } from "./type.mjs";
|
|
2
2
|
//#region src/ToggleGroup/ToggleGroup.d.ts
|
|
3
3
|
declare const ToggleGroup: {
|
|
4
|
-
<Value extends string = string>(
|
|
4
|
+
<Value extends string = string>(props: ToggleGroupProps<Value>): import("react").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
//#endregion
|
|
@@ -6,29 +6,38 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import clsx$1 from "clsx";
|
|
7
7
|
//#region src/ToggleGroup/ToggleGroup.tsx
|
|
8
8
|
const normalizeOption = (option) => typeof option === "string" ? { value: option } : option;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const toValueArray = (value) => {
|
|
10
|
+
if (value === void 0) return [];
|
|
11
|
+
return Array.isArray(value) ? value : [value];
|
|
12
|
+
};
|
|
13
|
+
const ToggleGroup = (props) => {
|
|
14
|
+
const { className, classNames, defaultValue, disabled = false, multiple = false, onChange, options, ref, size = "middle", style, styles: customStyles, value, variant = multiple ? "segmented" : "outlined" } = props;
|
|
15
|
+
const [innerValues, setInnerValues] = useControlledState(toValueArray(defaultValue), {
|
|
16
|
+
defaultValue: toValueArray(defaultValue),
|
|
12
17
|
onChange: (next) => {
|
|
13
|
-
if (
|
|
18
|
+
if (multiple) {
|
|
19
|
+
onChange?.(next);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (next[0] !== void 0) onChange?.(next[0]);
|
|
14
23
|
},
|
|
15
|
-
value
|
|
24
|
+
value: value === void 0 ? void 0 : toValueArray(value)
|
|
16
25
|
});
|
|
17
26
|
const normalizedOptions = useMemo(() => (options ?? []).map((o) => normalizeOption(o)), [options]);
|
|
18
|
-
const groupValue = useMemo(() => innerValue != null ? [innerValue] : [], [innerValue]);
|
|
19
27
|
return /* @__PURE__ */ jsx(ToggleGroupRoot, {
|
|
20
28
|
className: clsx$1(classNames?.root, className),
|
|
21
29
|
disabled,
|
|
30
|
+
multiple,
|
|
22
31
|
ref,
|
|
23
32
|
style: {
|
|
24
33
|
...style,
|
|
25
34
|
...customStyles?.root
|
|
26
35
|
},
|
|
27
|
-
value:
|
|
36
|
+
value: innerValues,
|
|
28
37
|
variant,
|
|
29
38
|
onValueChange: (next) => {
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
if (!multiple && next.length === 0) return;
|
|
40
|
+
setInnerValues(next);
|
|
32
41
|
},
|
|
33
42
|
children: normalizedOptions.map((opt) => /* @__PURE__ */ jsxs(ToggleGroupItem, {
|
|
34
43
|
"aria-label": typeof opt.label === "string" ? opt.label : opt.title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleGroup.mjs","names":["clsx"],"sources":["../../src/ToggleGroup/ToggleGroup.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useMemo } from 'react';\n\nimport { useControlledState } from '@/hooks/useControlledState';\n\nimport {\n ToggleGroupItem,\n ToggleGroupItemIcon,\n ToggleGroupItemLabel,\n ToggleGroupRoot,\n} from './atoms';\nimport type {
|
|
1
|
+
{"version":3,"file":"ToggleGroup.mjs","names":["clsx"],"sources":["../../src/ToggleGroup/ToggleGroup.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { type CSSProperties, type Ref, useMemo } from 'react';\n\nimport { useControlledState } from '@/hooks/useControlledState';\n\nimport {\n ToggleGroupItem,\n ToggleGroupItemIcon,\n ToggleGroupItemLabel,\n ToggleGroupRoot,\n} from './atoms';\nimport type {\n ToggleGroupClassNames,\n ToggleGroupOption,\n ToggleGroupProps,\n ToggleGroupSize,\n ToggleGroupStyles,\n ToggleGroupVariant,\n} from './type';\n\nconst normalizeOption = <Value extends string>(\n option: ToggleGroupOption<Value> | Value,\n): ToggleGroupOption<Value> => (typeof option === 'string' ? { value: option } : option);\n\nconst toValueArray = <Value extends string>(value?: Value | Value[]): Value[] => {\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n};\n\ninterface InternalProps<Value extends string = string> {\n className?: string;\n classNames?: ToggleGroupClassNames;\n defaultValue?: Value | Value[];\n disabled?: boolean;\n multiple?: boolean;\n onChange?: (value: Value | Value[]) => void;\n options?: (ToggleGroupOption<Value> | Value)[];\n ref?: Ref<HTMLDivElement>;\n size?: ToggleGroupSize;\n style?: CSSProperties;\n styles?: ToggleGroupStyles;\n value?: Value | Value[];\n variant?: ToggleGroupVariant;\n}\n\nconst ToggleGroup = <Value extends string = string>(props: ToggleGroupProps<Value>) => {\n const {\n className,\n classNames,\n defaultValue,\n disabled = false,\n multiple = false,\n onChange,\n options,\n ref,\n size = 'middle',\n style,\n styles: customStyles,\n value,\n variant = multiple ? 'segmented' : 'outlined',\n } = props as InternalProps<Value>;\n\n const [innerValues, setInnerValues] = useControlledState<Value[]>(toValueArray(defaultValue), {\n defaultValue: toValueArray(defaultValue),\n onChange: (next) => {\n if (multiple) {\n onChange?.(next);\n return;\n }\n if (next[0] !== undefined) onChange?.(next[0]);\n },\n value: value === undefined ? undefined : toValueArray(value),\n });\n\n const normalizedOptions = useMemo(\n () => (options ?? []).map((o) => normalizeOption<Value>(o)),\n [options],\n );\n\n return (\n <ToggleGroupRoot<Value>\n className={clsx(classNames?.root, className)}\n disabled={disabled}\n multiple={multiple}\n ref={ref}\n style={{ ...style, ...customStyles?.root }}\n value={innerValues}\n variant={variant}\n onValueChange={(next) => {\n // In single mode the pressed item is locked: Base UI reports an empty\n // array when it is clicked again, which must not clear the selection.\n if (!multiple && next.length === 0) return;\n setInnerValues(next);\n }}\n >\n {normalizedOptions.map((opt) => (\n <ToggleGroupItem<Value>\n aria-label={typeof opt.label === 'string' ? opt.label : opt.title}\n className={clsx(classNames?.item, opt.className)}\n disabled={disabled || opt.disabled}\n key={opt.value}\n size={size}\n style={customStyles?.item}\n title={opt.title}\n value={opt.value}\n variant={variant}\n >\n {opt.icon != null && (\n <ToggleGroupItemIcon className={classNames?.itemIcon} style={customStyles?.itemIcon}>\n {opt.icon}\n </ToggleGroupItemIcon>\n )}\n {opt.label != null && (\n <ToggleGroupItemLabel className={classNames?.itemLabel} style={customStyles?.itemLabel}>\n {opt.label}\n </ToggleGroupItemLabel>\n )}\n </ToggleGroupItem>\n ))}\n </ToggleGroupRoot>\n );\n};\n\nToggleGroup.displayName = 'ToggleGroup';\n\nexport default ToggleGroup;\n"],"mappings":";;;;;;;AAsBA,MAAM,mBACJ,WAC8B,OAAO,WAAW,WAAW,EAAE,OAAO,OAAO,IAAI;AAEjF,MAAM,gBAAsC,UAAqC;CAC/E,IAAI,UAAU,KAAA,GAAW,OAAO,CAAC;CACjC,OAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAC9C;AAkBA,MAAM,eAA8C,UAAmC;CACrF,MAAM,EACJ,WACA,YACA,cACA,WAAW,OACX,WAAW,OACX,UACA,SACA,KACA,OAAO,UACP,OACA,QAAQ,cACR,OACA,UAAU,WAAW,cAAc,eACjC;CAEJ,MAAM,CAAC,aAAa,kBAAkB,mBAA4B,aAAa,YAAY,GAAG;EAC5F,cAAc,aAAa,YAAY;EACvC,WAAW,SAAS;GAClB,IAAI,UAAU;IACZ,WAAW,IAAI;IACf;GACF;GACA,IAAI,KAAK,OAAO,KAAA,GAAW,WAAW,KAAK,EAAE;EAC/C;EACA,OAAO,UAAU,KAAA,IAAY,KAAA,IAAY,aAAa,KAAK;CAC7D,CAAC;CAED,MAAM,oBAAoB,eACjB,WAAW,CAAC,EAAA,CAAG,KAAK,MAAM,gBAAuB,CAAC,CAAC,GAC1D,CAAC,OAAO,CACV;CAEA,OACE,oBAAC,iBAAD;EACE,WAAWA,OAAK,YAAY,MAAM,SAAS;EACjC;EACA;EACL;EACL,OAAO;GAAE,GAAG;GAAO,GAAG,cAAc;EAAK;EACzC,OAAO;EACE;EACT,gBAAgB,SAAS;GAGvB,IAAI,CAAC,YAAY,KAAK,WAAW,GAAG;GACpC,eAAe,IAAI;EACrB;EAEC,UAAA,kBAAkB,KAAK,QACtB,qBAAC,iBAAD;GACE,cAAY,OAAO,IAAI,UAAU,WAAW,IAAI,QAAQ,IAAI;GAC5D,WAAWA,OAAK,YAAY,MAAM,IAAI,SAAS;GAC/C,UAAU,YAAY,IAAI;GAEpB;GACN,OAAO,cAAc;GACrB,OAAO,IAAI;GACX,OAAO,IAAI;GACF;GATX,UAAA,CAWG,IAAI,QAAQ,QACX,oBAAC,qBAAD;IAAqB,WAAW,YAAY;IAAU,OAAO,cAAc;IACxE,UAAA,IAAI;GACc,CAAA,GAEtB,IAAI,SAAS,QACZ,oBAAC,sBAAD;IAAsB,WAAW,YAAY;IAAW,OAAO,cAAc;IAC1E,UAAA,IAAI;GACe,CAAA,CAET;EAjBV,GAAA,IAAI,KAiBM,CAClB;CACc,CAAA;AAErB;AAEA,YAAY,cAAc"}
|
package/es/ToggleGroup/atoms.mjs
CHANGED
|
@@ -11,30 +11,42 @@ import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
|
11
11
|
//#region src/ToggleGroup/atoms.tsx
|
|
12
12
|
const rootVariantStyles = {
|
|
13
13
|
borderless: styles.rootBorderless,
|
|
14
|
-
outlined: styles.rootOutlined
|
|
14
|
+
outlined: styles.rootOutlined,
|
|
15
|
+
segmented: styles.rootSegmented
|
|
15
16
|
};
|
|
16
17
|
const itemSizeStyles = {
|
|
17
18
|
middle: styles.itemMiddle,
|
|
18
19
|
small: styles.itemSmall
|
|
19
20
|
};
|
|
21
|
+
const itemSegmentedSizeStyles = {
|
|
22
|
+
middle: styles.itemSegmentedMiddle,
|
|
23
|
+
small: styles.itemSegmentedSmall
|
|
24
|
+
};
|
|
20
25
|
const itemVariantStyles = {
|
|
21
|
-
borderless:
|
|
22
|
-
outlined: [
|
|
26
|
+
borderless: [styles.itemTone],
|
|
27
|
+
outlined: [
|
|
28
|
+
toggleGroupItemMarker,
|
|
29
|
+
styles.itemOutlined,
|
|
30
|
+
styles.itemTone
|
|
31
|
+
],
|
|
32
|
+
segmented: [styles.itemSegmented, styles.itemSegmentedTone]
|
|
23
33
|
};
|
|
24
34
|
const ToggleGroupRoot = ({ className, variant = "outlined", ...rest }) => {
|
|
25
35
|
return /* @__PURE__ */ jsx(ToggleGroup, {
|
|
26
36
|
className: styleProps([styles.root, rootVariantStyles[variant]], className).className,
|
|
37
|
+
"data-variant": variant,
|
|
27
38
|
...rest
|
|
28
39
|
});
|
|
29
40
|
};
|
|
30
41
|
ToggleGroupRoot.displayName = "ToggleGroupRoot";
|
|
31
42
|
const ToggleGroupItem = ({ className, size = "middle", variant = "outlined", ...rest }) => {
|
|
43
|
+
const sizeStyle = variant === "segmented" ? itemSegmentedSizeStyles[size] : itemSizeStyles[size];
|
|
32
44
|
return /* @__PURE__ */ jsx(Toggle, {
|
|
33
45
|
...rest,
|
|
34
46
|
className: styleProps([
|
|
35
47
|
styles.item,
|
|
36
48
|
focusRing.info,
|
|
37
|
-
|
|
49
|
+
sizeStyle,
|
|
38
50
|
itemVariantStyles[variant]
|
|
39
51
|
], className).className
|
|
40
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atoms.mjs","names":["BaseUIToggleGroup","BaseUIToggle","clsx"],"sources":["../../src/ToggleGroup/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Toggle as BaseUIToggle } from '@base-ui/react/toggle';\nimport { ToggleGroup as BaseUIToggleGroup } from '@base-ui/react/toggle-group';\nimport * as stylex from '@stylexjs/stylex';\nimport clsx from 'clsx';\nimport { type ComponentProps, type CSSProperties, type FC, type ReactNode } from 'react';\n\nimport { focusRing } from '@/styles/stylex/focusRing';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { toggleGroupItemMarker } from './marker.stylex';\nimport { styles } from './style';\nimport type { ToggleGroupSize, ToggleGroupVariant } from './type';\n\nconst rootVariantStyles = {
|
|
1
|
+
{"version":3,"file":"atoms.mjs","names":["BaseUIToggleGroup","BaseUIToggle","clsx"],"sources":["../../src/ToggleGroup/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Toggle as BaseUIToggle } from '@base-ui/react/toggle';\nimport { ToggleGroup as BaseUIToggleGroup } from '@base-ui/react/toggle-group';\nimport * as stylex from '@stylexjs/stylex';\nimport clsx from 'clsx';\nimport { type ComponentProps, type CSSProperties, type FC, type ReactNode } from 'react';\n\nimport { focusRing } from '@/styles/stylex/focusRing';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { toggleGroupItemMarker } from './marker.stylex';\nimport { styles } from './style';\nimport type { ToggleGroupSize, ToggleGroupVariant } from './type';\n\nconst rootVariantStyles = {\n borderless: styles.rootBorderless,\n outlined: styles.rootOutlined,\n segmented: styles.rootSegmented,\n};\n\nconst itemSizeStyles = { middle: styles.itemMiddle, small: styles.itemSmall };\n\nconst itemSegmentedSizeStyles = {\n middle: styles.itemSegmentedMiddle,\n small: styles.itemSegmentedSmall,\n};\n\nconst itemVariantStyles = {\n borderless: [styles.itemTone],\n outlined: [toggleGroupItemMarker, styles.itemOutlined, styles.itemTone],\n segmented: [styles.itemSegmented, styles.itemSegmentedTone],\n};\n\nexport type ToggleGroupRootProps<Value extends string = string> = Omit<\n ComponentProps<typeof BaseUIToggleGroup<Value>>,\n 'className' | 'render'\n> & {\n className?: string;\n variant?: ToggleGroupVariant;\n};\n\nexport const ToggleGroupRoot = <Value extends string = string>({\n className,\n variant = 'outlined',\n ...rest\n}: ToggleGroupRootProps<Value>) => {\n return (\n <BaseUIToggleGroup<Value>\n className={styleProps([styles.root, rootVariantStyles[variant]], className).className}\n data-variant={variant}\n {...rest}\n />\n );\n};\n\nToggleGroupRoot.displayName = 'ToggleGroupRoot';\n\nexport type ToggleGroupItemProps<Value extends string = string> = Omit<\n ComponentProps<typeof BaseUIToggle<Value>>,\n 'className' | 'render'\n> & {\n className?: string;\n size?: ToggleGroupSize;\n variant?: ToggleGroupVariant;\n};\n\nexport const ToggleGroupItem = <Value extends string = string>({\n className,\n size = 'middle',\n variant = 'outlined',\n ...rest\n}: ToggleGroupItemProps<Value>) => {\n const sizeStyle = variant === 'segmented' ? itemSegmentedSizeStyles[size] : itemSizeStyles[size];\n\n return (\n <BaseUIToggle<Value>\n {...rest}\n className={\n styleProps([styles.item, focusRing.info, sizeStyle, itemVariantStyles[variant]], className)\n .className\n }\n />\n );\n};\n\nToggleGroupItem.displayName = 'ToggleGroupItem';\n\ninterface SimpleSpanProps {\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nexport const ToggleGroupItemIcon: FC<SimpleSpanProps> = ({ children, className, style }) => (\n <span {...styleProps(styles.itemIcon, className, style)}>{children}</span>\n);\nToggleGroupItemIcon.displayName = 'ToggleGroupItemIcon';\n\nexport const ToggleGroupItemLabel: FC<SimpleSpanProps> = ({ children, className, style }) => (\n <span {...styleProps(styles.itemLabel, clsx('toggle-group-item-label', className), style)}>\n {children}\n </span>\n);\nToggleGroupItemLabel.displayName = 'ToggleGroupItemLabel';\n\nexport const toggleGroupStyles = Object.fromEntries(\n Object.entries(styles).map(([key, value]) => [key, stylex.props(value).className ?? '']),\n) as Record<keyof typeof styles, string>;\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,oBAAoB;CACxB,YAAY,OAAO;CACnB,UAAU,OAAO;CACjB,WAAW,OAAO;AACpB;AACA,MAAM,iBAAiB;CACrB,QAAQ,OAAO;CACf,OAAO,OAAO;AAChB;AACA,MAAM,0BAA0B;CAC9B,QAAQ,OAAO;CACf,OAAO,OAAO;AAChB;AACA,MAAM,oBAAoB;CACxB,YAAY,CAAC,OAAO,QAAQ;CAC5B,UAAU;EAAC;EAAuB,OAAO;EAAc,OAAO;CAAQ;CACtE,WAAW,CAAC,OAAO,eAAe,OAAO,iBAAiB;AAC5D;AAKA,MAAa,mBAAmD,EAC9D,WACA,UAAU,YACV,GAAG,WAC8B;CACjC,OAAO,oBAACA,aAAD;EAA0B,WAAW,WAAW,CAAC,OAAO,MAAM,kBAAkB,QAAQ,GAAG,SAAS,CAAC,CAAC;EAAW,gBAAc;EAAS,GAAI;CAAO,CAAA;AAC5J;AACA,gBAAgB,cAAc;AAM9B,MAAa,mBAAmD,EAC9D,WACA,OAAO,UACP,UAAU,YACV,GAAG,WAC8B;CACjC,MAAM,YAAY,YAAY,cAAc,wBAAwB,QAAQ,eAAe;CAC3F,OAAO,oBAACC,QAAD;EAAqB,GAAI;EAAM,WAAW,WAAW;GAAC,OAAO;GAAM,UAAU;GAAM;GAAW,kBAAkB;EAAQ,GAAG,SAAS,CAAC,CAAC;CAAY,CAAA;AAC3J;AACA,gBAAgB,cAAc;AAM9B,MAAa,uBAA4C,EACvD,UACA,WACA,YACI,oBAAC,QAAD;CAAM,GAAI,WAAW,OAAO,UAAU,WAAW,KAAK;CAAI;AAAe,CAAA;AAC/E,oBAAoB,cAAc;AAClC,MAAa,wBAA6C,EACxD,UACA,WACA,YACI,oBAAC,QAAD;CAAM,GAAI,WAAW,OAAO,WAAWC,OAAK,2BAA2B,SAAS,GAAG,KAAK;CACzF;AACG,CAAA;AACR,qBAAqB,cAAc;AACnC,MAAa,oBAAoB,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,OAAO,MAAM,KAAK,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC"}
|
|
@@ -11,8 +11,6 @@ export declare const styles: Readonly<{
|
|
|
11
11
|
readonly outline: stylex.StyleXClassNameFor<"outline", "none">;
|
|
12
12
|
readonly transition: stylex.StyleXClassNameFor<"transition", `background 120ms ${string}, color 120ms ${string}`>;
|
|
13
13
|
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
14
|
-
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
15
|
-
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
16
14
|
readonly cursor: stylex.StyleXClassNameFor<"cursor", "pointer" | "not-allowed">;
|
|
17
15
|
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
|
|
18
16
|
readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
|
|
@@ -40,10 +38,34 @@ export declare const styles: Readonly<{
|
|
|
40
38
|
readonly borderInlineStartStyle: stylex.StyleXClassNameFor<"borderInlineStartStyle", "solid" | null>;
|
|
41
39
|
readonly borderInlineStartWidth: stylex.StyleXClassNameFor<"borderInlineStartWidth", 1 | null>;
|
|
42
40
|
}>;
|
|
41
|
+
readonly itemSegmented: Readonly<{
|
|
42
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
43
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
44
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", 500>;
|
|
45
|
+
readonly position: stylex.StyleXClassNameFor<"position", "relative">;
|
|
46
|
+
}>;
|
|
47
|
+
readonly itemSegmentedMiddle: Readonly<{
|
|
48
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", 12>;
|
|
49
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", 13>;
|
|
50
|
+
readonly height: stylex.StyleXClassNameFor<"height", 32>;
|
|
51
|
+
}>;
|
|
52
|
+
readonly itemSegmentedSmall: Readonly<{
|
|
53
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", 10>;
|
|
54
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", 12>;
|
|
55
|
+
readonly height: stylex.StyleXClassNameFor<"height", 26>;
|
|
56
|
+
}>;
|
|
57
|
+
readonly itemSegmentedTone: Readonly<{
|
|
58
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
59
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
60
|
+
}>;
|
|
43
61
|
readonly itemSmall: Readonly<{
|
|
44
62
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", 6>;
|
|
45
63
|
readonly height: stylex.StyleXClassNameFor<"height", 24>;
|
|
46
64
|
}>;
|
|
65
|
+
readonly itemTone: Readonly<{
|
|
66
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
67
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
68
|
+
}>;
|
|
47
69
|
readonly root: Readonly<{
|
|
48
70
|
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
49
71
|
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
|
|
@@ -58,6 +80,18 @@ export declare const styles: Readonly<{
|
|
|
58
80
|
readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", 1>;
|
|
59
81
|
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
60
82
|
}>;
|
|
83
|
+
readonly rootSegmented: Readonly<{
|
|
84
|
+
readonly padding: stylex.StyleXClassNameFor<"padding", 3>;
|
|
85
|
+
readonly borderColor: stylex.StyleXClassNameFor<"borderColor", string>;
|
|
86
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
87
|
+
readonly borderStyle: stylex.StyleXClassNameFor<"borderStyle", "solid">;
|
|
88
|
+
readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", 1>;
|
|
89
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", 4>;
|
|
90
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
91
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
92
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
93
|
+
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
|
|
94
|
+
}>;
|
|
61
95
|
}>;
|
|
62
96
|
//#endregion
|
|
63
97
|
//# sourceMappingURL=style.d.mts.map
|
package/es/ToggleGroup/style.mjs
CHANGED
|
@@ -10,8 +10,6 @@ const styles = {
|
|
|
10
10
|
kI3sdo: "lb1a2a7pz",
|
|
11
11
|
kmkexE: "lb1whbijk",
|
|
12
12
|
kGNEyG: "lb6s0dn4",
|
|
13
|
-
kWkggS: "lbjbqb8w lb1rjvrxj lb1d0xo12 lb1rbaw9i lb1hhsbb9",
|
|
14
|
-
kMwMTN: "lb53gy9q lb530zvf lb2poks1 lb1uh4nfb",
|
|
15
13
|
kkrTdU: "lb1ypdohk lb5ezrf1",
|
|
16
14
|
k1xSpc: "lb3nfvp2",
|
|
17
15
|
kmuXW: "lb2lah0s",
|
|
@@ -44,11 +42,40 @@ const styles = {
|
|
|
44
42
|
k2ei4v: "lb1wutzi2",
|
|
45
43
|
$$css: true
|
|
46
44
|
},
|
|
45
|
+
itemSegmented: {
|
|
46
|
+
kaIpWk: "lb1sbi92r",
|
|
47
|
+
kB7OPa: "lb9f619",
|
|
48
|
+
k63SB2: "lbk50ysn",
|
|
49
|
+
kVAEAm: "lb1n2onr6",
|
|
50
|
+
$$css: true
|
|
51
|
+
},
|
|
52
|
+
itemSegmentedMiddle: {
|
|
53
|
+
kg3NbH: "lbaope02",
|
|
54
|
+
kGuDYH: "lb4z9k3i",
|
|
55
|
+
kZKoxP: "lb10w6t97",
|
|
56
|
+
$$css: true
|
|
57
|
+
},
|
|
58
|
+
itemSegmentedSmall: {
|
|
59
|
+
kg3NbH: "lb1awh872",
|
|
60
|
+
kGuDYH: "lbfifm61",
|
|
61
|
+
kZKoxP: "lbd7y6wv",
|
|
62
|
+
$$css: true
|
|
63
|
+
},
|
|
64
|
+
itemSegmentedTone: {
|
|
65
|
+
kWkggS: "lbjbqb8w lb14mr86t",
|
|
66
|
+
kMwMTN: "lbc77et8 lb3fdyxb lb2poks1 lb1y4fyfr",
|
|
67
|
+
$$css: true
|
|
68
|
+
},
|
|
47
69
|
itemSmall: {
|
|
48
70
|
kg3NbH: "lb1xijbu4",
|
|
49
71
|
kZKoxP: "lbxk0z11",
|
|
50
72
|
$$css: true
|
|
51
73
|
},
|
|
74
|
+
itemTone: {
|
|
75
|
+
kWkggS: "lbjbqb8w lb1rjvrxj lb1d0xo12 lb1rbaw9i lb1hhsbb9",
|
|
76
|
+
kMwMTN: "lb53gy9q lb530zvf lb2poks1 lb1uh4nfb",
|
|
77
|
+
$$css: true
|
|
78
|
+
},
|
|
52
79
|
root: {
|
|
53
80
|
kGNEyG: "lb6s0dn4",
|
|
54
81
|
k1xSpc: "lb3nfvp2",
|
|
@@ -65,6 +92,19 @@ const styles = {
|
|
|
65
92
|
kMzoRj: "lbmkeg23",
|
|
66
93
|
kVQacm: "lbb3r6kr",
|
|
67
94
|
$$css: true
|
|
95
|
+
},
|
|
96
|
+
rootSegmented: {
|
|
97
|
+
kmVPX3: "lb9ms5i6",
|
|
98
|
+
kVAM5u: "lb1g3whta",
|
|
99
|
+
kaIpWk: "lb1ndkxwp",
|
|
100
|
+
ksu8eU: "lb1y0btm7",
|
|
101
|
+
kMzoRj: "lbmkeg23",
|
|
102
|
+
kOIVth: "lb1jnr06f",
|
|
103
|
+
kGNEyG: "lb6s0dn4",
|
|
104
|
+
kWkggS: "lb41ilrr",
|
|
105
|
+
kB7OPa: "lb9f619",
|
|
106
|
+
k1xSpc: "lb3nfvp2",
|
|
107
|
+
$$css: true
|
|
68
108
|
}
|
|
69
109
|
};
|
|
70
110
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.mjs","names":[],"sources":["../../src/ToggleGroup/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nimport { toggleGroupItemMarker } from './marker.stylex';\n\nexport const styles = stylex.create({\n item: {\n font: 'inherit',\n borderColor: 'currentcolor',\n borderRadius: cssVar.borderRadius,\n borderStyle: 'none',\n borderWidth: 0,\n gap: 4,\n outline: 'none',\n transition: `background 120ms ${cssVar.motionEaseOut}, color 120ms ${cssVar.motionEaseOut}`,\n alignItems: 'center',\n
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../src/ToggleGroup/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nimport { toggleGroupItemMarker } from './marker.stylex';\n\nexport const styles = stylex.create({\n item: {\n font: 'inherit',\n borderColor: 'currentcolor',\n borderRadius: cssVar.borderRadius,\n borderStyle: 'none',\n borderWidth: 0,\n gap: 4,\n outline: 'none',\n transition: `background 120ms ${cssVar.motionEaseOut}, color 120ms ${cssVar.motionEaseOut}`,\n alignItems: 'center',\n cursor: { 'default': 'pointer', ':is([data-disabled])': 'not-allowed' },\n display: 'inline-flex',\n flexShrink: 0,\n fontSize: 12,\n justifyContent: 'center',\n userSelect: 'none',\n whiteSpace: 'nowrap',\n },\n itemIcon: {\n alignItems: 'center',\n display: 'inline-flex',\n flexShrink: 0,\n },\n itemLabel: {\n alignItems: 'center',\n display: 'inline-flex',\n },\n itemMiddle: {\n paddingInline: 8,\n height: 28,\n },\n itemOutlined: {\n borderRadius: 0,\n borderInlineStartColor: {\n default: null,\n [stylex.when.siblingBefore(':is(*)', toggleGroupItemMarker)]: cssVar.colorBorderSecondary,\n },\n borderInlineStartStyle: {\n default: null,\n [stylex.when.siblingBefore(':is(*)', toggleGroupItemMarker)]: 'solid',\n },\n borderInlineStartWidth: {\n default: null,\n [stylex.when.siblingBefore(':is(*)', toggleGroupItemMarker)]: 1,\n },\n },\n itemSegmented: {\n borderRadius: cssVar.borderRadius,\n boxSizing: 'border-box',\n fontWeight: 500,\n position: 'relative',\n },\n itemSegmentedMiddle: {\n paddingInline: 12,\n fontSize: 13,\n height: 32,\n },\n itemSegmentedSmall: {\n paddingInline: 10,\n fontSize: 12,\n height: 26,\n },\n itemSegmentedTone: {\n backgroundColor: {\n 'default': 'transparent',\n ':is([data-pressed])': cssVar.colorBgElevated,\n },\n color: {\n 'default': cssVar.colorTextSecondary,\n ':hover:not([data-disabled]):not([data-pressed])': cssVar.colorText,\n ':is([data-disabled])': cssVar.colorTextDisabled,\n ':is([data-pressed]):not([data-disabled])': cssVar.colorText,\n },\n },\n itemSmall: {\n paddingInline: 6,\n height: 24,\n },\n itemTone: {\n backgroundColor: {\n 'default': 'transparent',\n ':hover:not([data-disabled]):not([data-pressed])': cssVar.colorFillSecondary,\n ':is([data-pressed]):hover:not([data-disabled])': cssVar.colorFill,\n ':is([data-pressed]):is([data-disabled])': cssVar.colorFillSecondary,\n ':is([data-pressed]):not(:hover)': cssVar.colorFillSecondary,\n },\n color: {\n 'default': cssVar.colorTextTertiary,\n ':hover:not([data-disabled])': cssVar.colorTextSecondary,\n ':is([data-disabled])': cssVar.colorTextDisabled,\n ':is([data-pressed]):not(:hover):not([data-disabled])': cssVar.colorText,\n },\n },\n root: {\n alignItems: 'center',\n display: 'inline-flex',\n },\n rootBorderless: {\n gap: 2,\n },\n rootOutlined: {\n borderColor: cssVar.colorBorderSecondary,\n borderRadius: cssVar.borderRadius,\n borderStyle: 'solid',\n borderWidth: 1,\n overflow: 'hidden',\n },\n rootSegmented: {\n padding: 3,\n borderColor: cssVar.colorFillQuaternary,\n borderRadius: cssVar.borderRadiusLG,\n borderStyle: 'solid',\n borderWidth: 1,\n gap: 4,\n alignItems: 'center',\n backgroundColor: cssVar.colorBgLayout,\n boxSizing: 'border-box',\n display: 'inline-flex',\n },\n});\n"],"mappings":";AAKA,MAAa,SAAS;CACpB,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,OAAO;CACT;CACA,WAAW;EACT,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,cAAc;EACZ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,eAAe;EACb,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,qBAAqB;EACnB,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,oBAAoB;EAClB,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,mBAAmB;EACjB,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,WAAW;EACT,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,OAAO;CACT;CACA,cAAc;EACZ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,eAAe;EACb,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode, Ref } from "react";
|
|
2
2
|
//#region src/ToggleGroup/type.d.ts
|
|
3
3
|
export type ToggleGroupSize = 'middle' | 'small';
|
|
4
|
-
export type ToggleGroupVariant = 'borderless' | 'outlined';
|
|
4
|
+
export type ToggleGroupVariant = 'borderless' | 'outlined' | 'segmented';
|
|
5
5
|
export interface ToggleGroupClassNames {
|
|
6
6
|
item?: string;
|
|
7
7
|
itemIcon?: string;
|
|
@@ -22,19 +22,35 @@ export interface ToggleGroupOption<Value extends string = string> {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
value: Value;
|
|
24
24
|
}
|
|
25
|
-
export interface
|
|
25
|
+
export interface ToggleGroupBaseProps<Value extends string = string> {
|
|
26
26
|
className?: string;
|
|
27
27
|
classNames?: ToggleGroupClassNames;
|
|
28
|
-
defaultValue?: Value;
|
|
29
28
|
disabled?: boolean;
|
|
30
|
-
onChange?: (value: Value) => void;
|
|
31
29
|
options?: (ToggleGroupOption<Value> | Value)[];
|
|
32
30
|
ref?: Ref<HTMLDivElement>;
|
|
33
31
|
size?: ToggleGroupSize;
|
|
34
32
|
style?: CSSProperties;
|
|
35
33
|
styles?: ToggleGroupStyles;
|
|
36
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Visual style of the group.
|
|
36
|
+
* - outlined (default) - joined group with 1px dividers
|
|
37
|
+
* - borderless - detached action buttons
|
|
38
|
+
* - segmented - Segmented-like container with detached pill items, pairs with multiple
|
|
39
|
+
*/
|
|
37
40
|
variant?: ToggleGroupVariant;
|
|
38
41
|
}
|
|
42
|
+
export interface ToggleGroupSingleProps<Value extends string = string> extends ToggleGroupBaseProps<Value> {
|
|
43
|
+
defaultValue?: Value;
|
|
44
|
+
multiple?: false;
|
|
45
|
+
onChange?: (value: Value) => void;
|
|
46
|
+
value?: Value;
|
|
47
|
+
}
|
|
48
|
+
export interface ToggleGroupMultipleProps<Value extends string = string> extends ToggleGroupBaseProps<Value> {
|
|
49
|
+
defaultValue?: Value[];
|
|
50
|
+
multiple: true;
|
|
51
|
+
onChange?: (value: Value[]) => void;
|
|
52
|
+
value?: Value[];
|
|
53
|
+
}
|
|
54
|
+
export type ToggleGroupProps<Value extends string = string> = ToggleGroupSingleProps<Value> | ToggleGroupMultipleProps<Value>;
|
|
39
55
|
//#endregion
|
|
40
56
|
//# sourceMappingURL=type.d.mts.map
|
package/es/eslint/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Rule } from "../node_modules/.pnpm/eslint@10.
|
|
1
|
+
import { Rule } from "../node_modules/.pnpm/eslint@10.13.0_jiti@2.6.1_supports-color@10.2.2/node_modules/eslint/lib/types/index.mjs";
|
|
2
2
|
//#region src/eslint/index.d.ts
|
|
3
3
|
export declare const restrictedImports: {
|
|
4
4
|
rules: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArrowFunctionExpression, AssignmentExpression, BaseNode, CatchClause, ClassDeclaration, ClassExpression, Comment, Expression, ForInStatement, ForOfStatement, FunctionDeclaration, FunctionExpression, Identifier, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, Node as Node$1, Position, Program, SourceLocation as SourceLocation$1, VariableDeclaration, VariableDeclarator } from "../../../../../@types_estree@1.0.9/node_modules/@types/estree/index.mjs";
|
|
2
2
|
import { BaseConfig, ConfigObject, ConfigOverride, DeprecatedInfo, EcmaVersion as EcmaVersion$1, EnvironmentConfig, GlobalAccess, GlobalsConfig, HasRules, JavaScriptSourceType, LanguageOptions, LegacyConfigObject, LintMessage as LintMessage$1, LintSuggestion, LinterOptionsConfig, ObjectMetaProperties, Plugin as Plugin$1, Processor, ProcessorFile as ProcessorFile$1, RuleConfig, RuleContext as RuleContext$1, RuleDefinition, RuleFixer, RuleTextEdit, RuleTextEditor, RulesConfig, RulesMeta, Severity, SeverityLevel, SeverityName, SourceRange, SuggestedEdit, SuggestedEditBase, SuggestionMessage, TextSourceCode, TraversalStep, ViolationLocation, ViolationMessage, ViolationReport, ViolationReportBase } from "../../../../../@eslint_core@1.2.1/node_modules/@eslint/core/dist/esm/types.mjs";
|
|
3
3
|
import { CustomRuleVisitorWithExit } from "../../../../../@eslint_plugin-kit@0.7.3/node_modules/@eslint/plugin-kit/dist/cjs/index.mjs";
|
|
4
|
-
//#region node_modules/.pnpm/eslint@10.
|
|
4
|
+
//#region node_modules/.pnpm/eslint@10.13.0_jiti@2.6.1_supports-color@10.2.2/node_modules/eslint/lib/types/index.d.ts
|
|
5
5
|
//------------------------------------------------------------------------------
|
|
6
6
|
// Exports
|
|
7
7
|
//------------------------------------------------------------------------------
|
package/es/style.css
CHANGED
|
@@ -8573,6 +8573,10 @@
|
|
|
8573
8573
|
background-color: var(--lobe-checkbox-bg, var(--lobe-color-primary));
|
|
8574
8574
|
}
|
|
8575
8575
|
|
|
8576
|
+
.lb14mr86t[data-pressed] {
|
|
8577
|
+
background-color: var(--lobe-color-bg-elevated);
|
|
8578
|
+
}
|
|
8579
|
+
|
|
8576
8580
|
.lb1ca5mm0:hover:not(:active) {
|
|
8577
8581
|
background-color: var(--lobe-color-error-hover);
|
|
8578
8582
|
}
|