@lobehub/ui 5.19.3 → 5.20.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/base-ui/AutoComplete/AutoComplete.d.mts +8 -0
- package/es/base-ui/AutoComplete/AutoComplete.mjs +91 -0
- package/es/base-ui/AutoComplete/AutoComplete.mjs.map +1 -0
- package/es/base-ui/AutoComplete/index.d.mts +3 -0
- package/es/base-ui/AutoComplete/style.d.mts +12 -0
- package/es/base-ui/AutoComplete/style.mjs +76 -0
- package/es/base-ui/AutoComplete/style.mjs.map +1 -0
- package/es/base-ui/AutoComplete/type.d.mts +40 -0
- package/es/base-ui/Button/style.mjs +4 -3
- package/es/base-ui/Button/style.mjs.map +1 -1
- package/es/base-ui/Checkbox/Checkbox.d.mts +8 -0
- package/es/base-ui/Checkbox/Checkbox.mjs +61 -0
- package/es/base-ui/Checkbox/Checkbox.mjs.map +1 -0
- package/es/base-ui/Checkbox/CheckboxGroup.d.mts +8 -0
- package/es/base-ui/Checkbox/CheckboxGroup.mjs +37 -0
- package/es/base-ui/Checkbox/CheckboxGroup.mjs.map +1 -0
- package/es/base-ui/Checkbox/index.d.mts +4 -0
- package/es/base-ui/Checkbox/style.d.mts +9 -0
- package/es/base-ui/Checkbox/style.mjs +70 -0
- package/es/base-ui/Checkbox/style.mjs.map +1 -0
- package/es/base-ui/Checkbox/type.d.mts +51 -0
- package/es/base-ui/Form/Form.mjs +155 -0
- package/es/base-ui/Form/Form.mjs.map +1 -0
- package/es/base-ui/Form/components/FormDivider.d.mts +8 -0
- package/es/base-ui/Form/components/FormDivider.mjs +19 -0
- package/es/base-ui/Form/components/FormDivider.mjs.map +1 -0
- package/es/base-ui/Form/components/FormField.d.mts +8 -0
- package/es/base-ui/Form/components/FormField.mjs +59 -0
- package/es/base-ui/Form/components/FormField.mjs.map +1 -0
- package/es/base-ui/Form/components/FormFlatGroup.d.mts +8 -0
- package/es/base-ui/Form/components/FormFlatGroup.mjs +20 -0
- package/es/base-ui/Form/components/FormFlatGroup.mjs.map +1 -0
- package/es/base-ui/Form/components/FormFooter.d.mts +8 -0
- package/es/base-ui/Form/components/FormFooter.mjs +20 -0
- package/es/base-ui/Form/components/FormFooter.mjs.map +1 -0
- package/es/base-ui/Form/components/FormGroup.d.mts +8 -0
- package/es/base-ui/Form/components/FormGroup.mjs +87 -0
- package/es/base-ui/Form/components/FormGroup.mjs.map +1 -0
- package/es/base-ui/Form/components/FormSubmitFooter.d.mts +8 -0
- package/es/base-ui/Form/components/FormSubmitFooter.mjs +118 -0
- package/es/base-ui/Form/components/FormSubmitFooter.mjs.map +1 -0
- package/es/base-ui/Form/components/FormTitle.d.mts +8 -0
- package/es/base-ui/Form/components/FormTitle.mjs +42 -0
- package/es/base-ui/Form/components/FormTitle.mjs.map +1 -0
- package/es/base-ui/Form/context.d.mts +6 -0
- package/es/base-ui/Form/context.mjs +15 -0
- package/es/base-ui/Form/context.mjs.map +1 -0
- package/es/base-ui/Form/index.d.mts +25 -0
- package/es/base-ui/Form/index.mjs +24 -0
- package/es/base-ui/Form/index.mjs.map +1 -0
- package/es/base-ui/Form/style.mjs +288 -0
- package/es/base-ui/Form/style.mjs.map +1 -0
- package/es/base-ui/Form/type.d.mts +139 -0
- package/es/base-ui/Input/Input.d.mts +8 -0
- package/es/base-ui/Input/Input.mjs +43 -0
- package/es/base-ui/Input/Input.mjs.map +1 -0
- package/es/base-ui/Input/InputNumber.d.mts +8 -0
- package/es/base-ui/Input/InputNumber.mjs +50 -0
- package/es/base-ui/Input/InputNumber.mjs.map +1 -0
- package/es/base-ui/Input/InputOTP.d.mts +8 -0
- package/es/base-ui/Input/InputOTP.mjs +31 -0
- package/es/base-ui/Input/InputOTP.mjs.map +1 -0
- package/es/base-ui/Input/InputPassword.d.mts +8 -0
- package/es/base-ui/Input/InputPassword.mjs +31 -0
- package/es/base-ui/Input/InputPassword.mjs.map +1 -0
- package/es/base-ui/Input/TextArea.d.mts +8 -0
- package/es/base-ui/Input/TextArea.mjs +43 -0
- package/es/base-ui/Input/TextArea.mjs.map +1 -0
- package/es/base-ui/Input/index.d.mts +7 -0
- package/es/base-ui/Input/style.d.mts +33 -0
- package/es/base-ui/Input/style.mjs +230 -0
- package/es/base-ui/Input/style.mjs.map +1 -0
- package/es/base-ui/Input/type.d.mts +122 -0
- package/es/base-ui/Select/style.mjs +4 -3
- package/es/base-ui/Select/style.mjs.map +1 -1
- package/es/base-ui/Slider/Slider.d.mts +8 -0
- package/es/base-ui/Slider/Slider.mjs +34 -0
- package/es/base-ui/Slider/Slider.mjs.map +1 -0
- package/es/base-ui/Slider/SliderWithInput.d.mts +8 -0
- package/es/base-ui/Slider/SliderWithInput.mjs +64 -0
- package/es/base-ui/Slider/SliderWithInput.mjs.map +1 -0
- package/es/base-ui/Slider/index.d.mts +4 -0
- package/es/base-ui/Slider/style.d.mts +11 -0
- package/es/base-ui/Slider/style.mjs +69 -0
- package/es/base-ui/Slider/style.mjs.map +1 -0
- package/es/base-ui/Slider/type.d.mts +47 -0
- package/es/base-ui/controlSize.d.mts +10 -0
- package/es/base-ui/controlSize.mjs +10 -0
- package/es/base-ui/controlSize.mjs.map +1 -0
- package/es/base-ui/index.d.mts +33 -4
- package/es/base-ui/index.mjs +28 -4
- package/es/eslint/index.mjs +25 -15
- package/es/eslint/index.mjs.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AutoCompleteProps } from "./type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/AutoComplete/AutoComplete.d.ts
|
|
5
|
+
declare const AutoComplete: _$react.NamedExoticComponent<AutoCompleteProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { AutoComplete };
|
|
8
|
+
//# sourceMappingURL=AutoComplete.d.mts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useAppElement } from "../../ThemeProvider/AppElementContext.mjs";
|
|
3
|
+
import Icon from "../../Icon/Icon.mjs";
|
|
4
|
+
import { rootVariants, styles } from "../Input/style.mjs";
|
|
5
|
+
import { styles as styles$1 } from "./style.mjs";
|
|
6
|
+
import { memo, useMemo, useRef } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { cx, useThemeMode } from "antd-style";
|
|
9
|
+
import { XIcon } from "lucide-react";
|
|
10
|
+
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
11
|
+
//#region src/base-ui/AutoComplete/AutoComplete.tsx
|
|
12
|
+
const AutoComplete = memo(({ className, classNames, styles: customStyles, style, variant, shadow, size = "middle", options = [], onChange, onSearch, allowClear, disabled, placeholder, prefix, suffix, emptyText, ...rest }) => {
|
|
13
|
+
const { isDarkMode } = useThemeMode();
|
|
14
|
+
const appElement = useAppElement();
|
|
15
|
+
const anchorRef = useRef(null);
|
|
16
|
+
const mergedVariant = variant || (isDarkMode ? "filled" : "outlined");
|
|
17
|
+
const items = useMemo(() => options.map((option) => typeof option === "string" ? { value: option } : option), [options]);
|
|
18
|
+
return /* @__PURE__ */ jsxs(Autocomplete.Root, {
|
|
19
|
+
openOnInputClick: true,
|
|
20
|
+
disabled,
|
|
21
|
+
itemToStringValue: (item) => item.value,
|
|
22
|
+
items,
|
|
23
|
+
onValueChange: (value) => {
|
|
24
|
+
onChange?.(value);
|
|
25
|
+
onSearch?.(value);
|
|
26
|
+
},
|
|
27
|
+
...rest,
|
|
28
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: cx(rootVariants({
|
|
30
|
+
shadow,
|
|
31
|
+
size,
|
|
32
|
+
variant: mergedVariant
|
|
33
|
+
}), className),
|
|
34
|
+
"data-disabled": disabled ? "" : void 0,
|
|
35
|
+
ref: anchorRef,
|
|
36
|
+
style,
|
|
37
|
+
children: [
|
|
38
|
+
prefix && /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: styles.slot,
|
|
40
|
+
children: prefix
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ jsx(Autocomplete.Input, {
|
|
43
|
+
className: cx(styles.input, classNames?.input),
|
|
44
|
+
placeholder,
|
|
45
|
+
style: customStyles?.input
|
|
46
|
+
}),
|
|
47
|
+
allowClear && /* @__PURE__ */ jsx(Autocomplete.Clear, {
|
|
48
|
+
"aria-label": "Clear",
|
|
49
|
+
className: styles$1.clear,
|
|
50
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
51
|
+
icon: XIcon,
|
|
52
|
+
size: 14
|
|
53
|
+
})
|
|
54
|
+
}),
|
|
55
|
+
suffix && /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: styles.slot,
|
|
57
|
+
children: suffix
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}), /* @__PURE__ */ jsx(Autocomplete.Portal, {
|
|
61
|
+
container: appElement ?? void 0,
|
|
62
|
+
children: /* @__PURE__ */ jsx(Autocomplete.Positioner, {
|
|
63
|
+
anchor: anchorRef,
|
|
64
|
+
className: styles$1.positioner,
|
|
65
|
+
sideOffset: 4,
|
|
66
|
+
children: /* @__PURE__ */ jsxs(Autocomplete.Popup, {
|
|
67
|
+
className: cx(styles$1.popup, classNames?.popup),
|
|
68
|
+
style: customStyles?.popup,
|
|
69
|
+
children: [emptyText && /* @__PURE__ */ jsx(Autocomplete.Empty, {
|
|
70
|
+
className: styles$1.empty,
|
|
71
|
+
children: emptyText
|
|
72
|
+
}), /* @__PURE__ */ jsx(Autocomplete.List, {
|
|
73
|
+
className: styles$1.list,
|
|
74
|
+
children: (item) => /* @__PURE__ */ jsx(Autocomplete.Item, {
|
|
75
|
+
className: cx(styles$1.item, classNames?.item),
|
|
76
|
+
disabled: item.disabled,
|
|
77
|
+
style: customStyles?.item,
|
|
78
|
+
value: item,
|
|
79
|
+
children: item.label ?? item.value
|
|
80
|
+
}, item.value)
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
AutoComplete.displayName = "AutoComplete";
|
|
88
|
+
//#endregion
|
|
89
|
+
export { AutoComplete as default };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=AutoComplete.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoComplete.mjs","names":["inputVariants","inputStyles","styles"],"sources":["../../../src/base-ui/AutoComplete/AutoComplete.tsx"],"sourcesContent":["'use client';\n\nimport { Autocomplete } from '@base-ui/react/autocomplete';\nimport { cx, useThemeMode } from 'antd-style';\nimport { XIcon } from 'lucide-react';\nimport { memo, useMemo, useRef } from 'react';\n\nimport { inputStyles, inputVariants } from '@/base-ui/Input';\nimport Icon from '@/Icon';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles } from './style';\nimport type { AutoCompleteOption, AutoCompleteProps } from './type';\n\nconst AutoComplete = memo<AutoCompleteProps>(\n ({\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n options = [],\n onChange,\n onSearch,\n allowClear,\n disabled,\n placeholder,\n prefix,\n suffix,\n emptyText,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const appElement = useAppElement();\n const anchorRef = useRef<HTMLDivElement>(null);\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n const items = useMemo<AutoCompleteOption[]>(\n () => options.map((option) => (typeof option === 'string' ? { value: option } : option)),\n [options],\n );\n\n return (\n <Autocomplete.Root\n openOnInputClick\n disabled={disabled}\n itemToStringValue={(item) => (item as AutoCompleteOption).value}\n items={items}\n onValueChange={(value) => {\n onChange?.(value);\n onSearch?.(value);\n }}\n {...rest}\n >\n <div\n className={cx(inputVariants({ shadow, size, variant: mergedVariant }), className)}\n data-disabled={disabled ? '' : undefined}\n ref={anchorRef}\n style={style}\n >\n {prefix && <span className={inputStyles.slot}>{prefix}</span>}\n <Autocomplete.Input\n className={cx(inputStyles.input, classNames?.input)}\n placeholder={placeholder}\n style={customStyles?.input}\n />\n {allowClear && (\n <Autocomplete.Clear aria-label={'Clear'} className={styles.clear}>\n <Icon icon={XIcon} size={14} />\n </Autocomplete.Clear>\n )}\n {suffix && <span className={inputStyles.slot}>{suffix}</span>}\n </div>\n <Autocomplete.Portal container={appElement ?? undefined}>\n <Autocomplete.Positioner anchor={anchorRef} className={styles.positioner} sideOffset={4}>\n <Autocomplete.Popup\n className={cx(styles.popup, classNames?.popup)}\n style={customStyles?.popup}\n >\n {emptyText && (\n <Autocomplete.Empty className={styles.empty}>{emptyText}</Autocomplete.Empty>\n )}\n <Autocomplete.List className={styles.list}>\n {(item: AutoCompleteOption) => (\n <Autocomplete.Item\n className={cx(styles.item, classNames?.item)}\n disabled={item.disabled}\n key={item.value}\n style={customStyles?.item}\n value={item}\n >\n {item.label ?? item.value}\n </Autocomplete.Item>\n )}\n </Autocomplete.List>\n </Autocomplete.Popup>\n </Autocomplete.Positioner>\n </Autocomplete.Portal>\n </Autocomplete.Root>\n );\n },\n);\n\nAutoComplete.displayName = 'AutoComplete';\n\nexport default AutoComplete;\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,eAAe,MAClB,EACC,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,UAAU,EAAE,EACZ,UACA,UACA,YACA,UACA,aACA,QACA,QACA,WACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,cAAc;CACrC,MAAM,aAAa,eAAe;CAClC,MAAM,YAAY,OAAuB,KAAK;CAC9C,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,MAAM,QAAQ,cACN,QAAQ,KAAK,WAAY,OAAO,WAAW,WAAW,EAAE,OAAO,QAAQ,GAAG,OAAQ,EACxF,CAAC,QAAQ,CACV;AAED,QACE,qBAAC,aAAa,MAAd;EACE,kBAAA;EACU;EACV,oBAAoB,SAAU,KAA4B;EACnD;EACP,gBAAgB,UAAU;AACxB,cAAW,MAAM;AACjB,cAAW,MAAM;;EAEnB,GAAI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
|
+
item: string;
|
|
6
|
+
list: string;
|
|
7
|
+
popup: string;
|
|
8
|
+
positioner: string;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { styles };
|
|
12
|
+
//# sourceMappingURL=style.d.mts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { styles as styles$1 } from "../DropdownMenu/sharedStyle.mjs";
|
|
2
|
+
import { createStaticStyles } from "antd-style";
|
|
3
|
+
//#region src/base-ui/AutoComplete/style.ts
|
|
4
|
+
const ownStyles = createStaticStyles(({ css, cssVar }) => ({
|
|
5
|
+
clear: css`
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
border: none;
|
|
15
|
+
|
|
16
|
+
color: ${cssVar.colorTextTertiary};
|
|
17
|
+
|
|
18
|
+
background: none;
|
|
19
|
+
outline: none;
|
|
20
|
+
|
|
21
|
+
transition: color 150ms ${cssVar.motionEaseOut};
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
color: ${cssVar.colorText};
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
empty: css`
|
|
28
|
+
cursor: default;
|
|
29
|
+
|
|
30
|
+
&:empty {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
background: transparent;
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
list: css`
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
max-height: min(320px, var(--available-height));
|
|
41
|
+
|
|
42
|
+
&:empty {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
popup: css`
|
|
47
|
+
transform-origin: var(--transform-origin);
|
|
48
|
+
width: var(--anchor-width);
|
|
49
|
+
min-width: 0;
|
|
50
|
+
transition:
|
|
51
|
+
opacity 140ms ${cssVar.motionEaseOut},
|
|
52
|
+
transform 140ms ${cssVar.motionEaseOut};
|
|
53
|
+
|
|
54
|
+
&[data-starting-style],
|
|
55
|
+
&[data-ending-style] {
|
|
56
|
+
transform: scaleY(0.92);
|
|
57
|
+
opacity: 0;
|
|
58
|
+
}
|
|
59
|
+
`
|
|
60
|
+
}));
|
|
61
|
+
const styles = {
|
|
62
|
+
clear: ownStyles.clear,
|
|
63
|
+
empty: [
|
|
64
|
+
styles$1.item,
|
|
65
|
+
styles$1.empty,
|
|
66
|
+
ownStyles.empty
|
|
67
|
+
].join(" "),
|
|
68
|
+
item: styles$1.item,
|
|
69
|
+
list: ownStyles.list,
|
|
70
|
+
popup: [styles$1.popup, ownStyles.popup].join(" "),
|
|
71
|
+
positioner: styles$1.positioner
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { styles };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":["menuStyles"],"sources":["../../../src/base-ui/AutoComplete/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nimport { styles as menuStyles } from '@/base-ui/DropdownMenu/sharedStyle';\n\nconst ownStyles = createStaticStyles(({ css, cssVar }) => ({\n clear: css`\n cursor: pointer;\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n margin: 0;\n padding: 0;\n border: none;\n\n color: ${cssVar.colorTextTertiary};\n\n background: none;\n outline: none;\n\n transition: color 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n color: ${cssVar.colorText};\n }\n `,\n empty: css`\n cursor: default;\n\n &:empty {\n display: none;\n }\n\n &:hover {\n background: transparent;\n }\n `,\n list: css`\n overflow-y: auto;\n max-height: min(320px, var(--available-height));\n\n &:empty {\n display: none;\n }\n `,\n popup: css`\n transform-origin: var(--transform-origin);\n width: var(--anchor-width);\n min-width: 0;\n transition:\n opacity 140ms ${cssVar.motionEaseOut},\n transform 140ms ${cssVar.motionEaseOut};\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: scaleY(0.92);\n opacity: 0;\n }\n `,\n}));\n\nexport const styles = {\n clear: ownStyles.clear,\n empty: [menuStyles.item, menuStyles.empty, ownStyles.empty].join(' '),\n item: menuStyles.item,\n list: ownStyles.list,\n popup: [menuStyles.popup, ownStyles.popup].join(' '),\n positioner: menuStyles.positioner,\n};\n"],"mappings":";;;AAIA,MAAM,YAAY,oBAAoB,EAAE,KAAK,cAAc;CACzD,OAAO,GAAG;;;;;;;;;;;aAWC,OAAO,kBAAkB;;;;;8BAKR,OAAO,cAAc;;;eAGpC,OAAO,UAAU;;;CAG9B,OAAO,GAAG;;;;;;;;;;;CAWV,MAAM,GAAG;;;;;;;;CAQT,OAAO,GAAG;;;;;sBAKU,OAAO,cAAc;wBACnB,OAAO,cAAc;;;;;;;;CAQ5C,EAAE;AAEH,MAAa,SAAS;CACpB,OAAO,UAAU;CACjB,OAAO;EAACA,SAAW;EAAMA,SAAW;EAAO,UAAU;EAAM,CAAC,KAAK,IAAI;CACrE,MAAMA,SAAW;CACjB,MAAM,UAAU;CAChB,OAAO,CAACA,SAAW,OAAO,UAAU,MAAM,CAAC,KAAK,IAAI;CACpD,YAAYA,SAAW;CACxB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { InputProps } from "../Input/type.mjs";
|
|
2
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
3
|
+
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
4
|
+
|
|
5
|
+
//#region src/base-ui/AutoComplete/type.d.ts
|
|
6
|
+
interface AutoCompleteOption {
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
type BaseAutocompleteProps = Omit<ComponentProps<typeof Autocomplete.Root>, 'className' | 'style' | 'render' | 'children' | 'items' | 'onValueChange' | 'mode'>;
|
|
12
|
+
interface AutoCompleteProps extends BaseAutocompleteProps {
|
|
13
|
+
allowClear?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
classNames?: {
|
|
16
|
+
input?: string;
|
|
17
|
+
item?: string;
|
|
18
|
+
popup?: string;
|
|
19
|
+
};
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
emptyText?: ReactNode;
|
|
22
|
+
onChange?: (value: string) => void;
|
|
23
|
+
onSearch?: (value: string) => void;
|
|
24
|
+
options?: (string | AutoCompleteOption)[];
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
prefix?: InputProps['prefix'];
|
|
27
|
+
shadow?: boolean;
|
|
28
|
+
size?: InputProps['size'];
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
styles?: {
|
|
31
|
+
input?: CSSProperties;
|
|
32
|
+
item?: CSSProperties;
|
|
33
|
+
popup?: CSSProperties;
|
|
34
|
+
};
|
|
35
|
+
suffix?: InputProps['suffix'];
|
|
36
|
+
variant?: InputProps['variant'];
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { AutoCompleteOption, AutoCompleteProps };
|
|
40
|
+
//# sourceMappingURL=type.d.mts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { controlHeight } from "../controlSize.mjs";
|
|
1
2
|
import { createStaticStyles } from "antd-style";
|
|
2
3
|
//#region src/base-ui/Button/style.ts
|
|
3
4
|
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
@@ -36,19 +37,19 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
36
37
|
}
|
|
37
38
|
`,
|
|
38
39
|
sizeSmall: css`
|
|
39
|
-
height:
|
|
40
|
+
height: ${controlHeight.small}px;
|
|
40
41
|
padding-inline: 8px;
|
|
41
42
|
border-radius: ${cssVar.borderRadiusSM};
|
|
42
43
|
font-size: 12px;
|
|
43
44
|
`,
|
|
44
45
|
sizeMiddle: css`
|
|
45
|
-
height:
|
|
46
|
+
height: ${controlHeight.middle}px;
|
|
46
47
|
padding-inline: 14px;
|
|
47
48
|
border-radius: ${cssVar.borderRadiusSM};
|
|
48
49
|
font-size: 13px;
|
|
49
50
|
`,
|
|
50
51
|
sizeLarge: css`
|
|
51
|
-
height:
|
|
52
|
+
height: ${controlHeight.large}px;
|
|
52
53
|
padding-inline: 16px;
|
|
53
54
|
border-radius: ${cssVar.borderRadius};
|
|
54
55
|
font-size: 14px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Button/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n base: css`\n cursor: pointer;\n\n display: inline-flex;\n gap: 6px;\n align-items: center;\n justify-content: center;\n\n box-sizing: border-box;\n border: 1px solid ${cssVar.colorBorder};\n\n font-weight: 500;\n line-height: 1;\n text-decoration: none;\n white-space: nowrap;\n\n transition:\n color 160ms cubic-bezier(0.32, 0.72, 0, 1),\n background 160ms cubic-bezier(0.32, 0.72, 0, 1),\n border-color 160ms cubic-bezier(0.32, 0.72, 0, 1),\n box-shadow 160ms cubic-bezier(0.32, 0.72, 0, 1);\n\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBorder};\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n pointer-events: none;\n cursor: not-allowed;\n opacity: 0.5;\n }\n `,\n\n sizeSmall: css`\n height: 24px;\n padding-inline: 8px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 12px;\n `,\n\n sizeMiddle: css`\n height: 32px;\n padding-inline: 14px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 13px;\n `,\n\n sizeLarge: css`\n height: 40px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadius};\n font-size: 14px;\n `,\n\n shapeCircle: css`\n padding-inline: 0;\n border-radius: 50%;\n `,\n\n shapeRound: css`\n border-radius: 999px;\n `,\n\n block: css`\n width: 100%;\n `,\n\n iconEnd: css`\n flex-direction: row-reverse;\n `,\n\n iconOnlySmall: css`\n width: 24px;\n padding-inline: 0;\n `,\n\n iconOnlyMiddle: css`\n width: 32px;\n padding-inline: 0;\n `,\n\n iconOnlyLarge: css`\n width: 40px;\n padding-inline: 0;\n `,\n\n iconBox: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n `,\n\n spinnerSlot: css`\n overflow: hidden;\n\n width: 0;\n margin-inline-end: -6px;\n\n opacity: 0;\n\n transition:\n width 380ms cubic-bezier(0.22, 1, 0.36, 1),\n margin 380ms cubic-bezier(0.22, 1, 0.36, 1),\n opacity 260ms cubic-bezier(0.22, 1, 0.36, 1);\n `,\n\n spinnerSlotEnd: css`\n margin-inline: -6px 0;\n `,\n\n spinnerSlotShow: css`\n width: 12px;\n margin-inline: 0;\n opacity: 1;\n `,\n\n variantDefault: css`\n background: ${cssVar.colorBgContainer};\n\n /* &:hover/&:active included so the anchor form outranks antd's global a:hover/a:active link color */\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryBorder};\n color: ${cssVar.colorPrimaryText};\n }\n `,\n\n variantPrimary: css`\n border-color: ${cssVar.colorPrimary};\n background: ${cssVar.colorPrimary};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorBgLayout};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryHover};\n background: ${cssVar.colorPrimaryHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryActive};\n background: ${cssVar.colorPrimaryActive};\n }\n `,\n\n variantDashed: css`\n border-style: dashed;\n background: ${cssVar.colorBgContainer};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryBorder};\n color: ${cssVar.colorPrimaryText};\n }\n `,\n\n variantFill: css`\n border-color: transparent;\n background: ${cssVar.colorFillTertiary};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFillSecondary};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFill};\n }\n `,\n\n variantText: css`\n border-color: transparent;\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFillSecondary};\n }\n `,\n\n variantLink: css`\n padding-inline: 0;\n border-color: transparent;\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorPrimary};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorPrimaryHover};\n background: transparent;\n }\n `,\n\n dangerOutlined: css`\n border-color: ${cssVar.colorError};\n background: ${cssVar.colorBgContainer};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorBgContainer};\n }\n `,\n\n dangerSolid: css`\n border-color: ${cssVar.colorError};\n background: ${cssVar.colorError};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorBgLayout};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorErrorHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorActive};\n background: ${cssVar.colorErrorActive};\n }\n `,\n\n dangerFill: css`\n border-color: transparent;\n color: ${cssVar.colorError};\n background: ${cssVar.colorErrorBg};\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorErrorBgHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorActive};\n background: ${cssVar.colorErrorBgHover};\n }\n `,\n\n dangerInline: css`\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorHover};\n }\n `,\n\n ghostDefault: css`\n border-color: rgb(255 255 255 / 65%);\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: #fff;\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: #fff;\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n ghostDashed: css`\n border-style: dashed;\n `,\n\n ghostPrimary: css`\n border-color: ${cssVar.colorPrimary};\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorPrimary};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryHover};\n color: ${cssVar.colorPrimaryHover};\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n ghostDanger: css`\n border-color: ${cssVar.colorError};\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n color: ${cssVar.colorErrorHover};\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n spinner: css`\n @keyframes base-button-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n display: inline-block;\n\n width: 12px;\n height: 12px;\n border: 1.5px solid currentcolor;\n border-block-start-color: transparent;\n border-radius: 50%;\n\n animation: base-button-spin 0.6s linear infinite;\n `,\n}));\n"],"mappings":";;AAEA,M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AAO,WAAW;kBACpB,OAAO,iBAAiB;;;;;eAK3B,OAAO,WAAW;;;;sBAIX,OAAO,gBAAgB;eAC9B,OAAO,gBAAgB;oBAClB,OAAO,iBAAiB;;;CAI1C,aAAa,GAAG;oBACE,OAAO,WAAW;kBACpB,OAAO,WAAW;;;;;eAKrB,OAAO,cAAc;;;;sBAId,OAAO,gBAAgB;oBACzB,OAAO,gBAAgB;;;;sBAIrB,OAAO,iBAAiB;oBAC1B,OAAO,iBAAiB;;;CAI1C,YAAY,GAAG;;aAEJ,OAAO,WAAW;kBACb,OAAO,aAAa;;;eAGvB,OAAO,gBAAgB;oBAClB,OAAO,kBAAkB;;;;eAI9B,OAAO,iBAAiB;oBACnB,OAAO,kBAAkB;;;CAI3C,cAAc,GAAG;;;;eAIJ,OAAO,WAAW;;;;eAIlB,OAAO,gBAAgB;;;CAIpC,cAAc,GAAG;;;;;;;;;;;;;;;;;;;CAoBjB,aAAa,GAAG;;;CAIhB,cAAc,GAAG;oBACC,OAAO,aAAa;;;;;;eAMzB,OAAO,aAAa;;;;sBAIb,OAAO,kBAAkB;eAChC,OAAO,kBAAkB;;;;;;;;CAStC,aAAa,GAAG;oBACE,OAAO,WAAW;;;;;;eAMvB,OAAO,WAAW;;;;sBAIX,OAAO,gBAAgB;eAC9B,OAAO,gBAAgB;;;;;;;;CASpC,SAAS,GAAG;;;;;;;;;;;;;;;;;CAiBb,EAAE"}
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Button/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nimport { controlHeight } from '@/base-ui/controlSize';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n base: css`\n cursor: pointer;\n\n display: inline-flex;\n gap: 6px;\n align-items: center;\n justify-content: center;\n\n box-sizing: border-box;\n border: 1px solid ${cssVar.colorBorder};\n\n font-weight: 500;\n line-height: 1;\n text-decoration: none;\n white-space: nowrap;\n\n transition:\n color 160ms cubic-bezier(0.32, 0.72, 0, 1),\n background 160ms cubic-bezier(0.32, 0.72, 0, 1),\n border-color 160ms cubic-bezier(0.32, 0.72, 0, 1),\n box-shadow 160ms cubic-bezier(0.32, 0.72, 0, 1);\n\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBorder};\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n pointer-events: none;\n cursor: not-allowed;\n opacity: 0.5;\n }\n `,\n\n sizeSmall: css`\n height: ${controlHeight.small}px;\n padding-inline: 8px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 12px;\n `,\n\n sizeMiddle: css`\n height: ${controlHeight.middle}px;\n padding-inline: 14px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 13px;\n `,\n\n sizeLarge: css`\n height: ${controlHeight.large}px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadius};\n font-size: 14px;\n `,\n\n shapeCircle: css`\n padding-inline: 0;\n border-radius: 50%;\n `,\n\n shapeRound: css`\n border-radius: 999px;\n `,\n\n block: css`\n width: 100%;\n `,\n\n iconEnd: css`\n flex-direction: row-reverse;\n `,\n\n iconOnlySmall: css`\n width: 24px;\n padding-inline: 0;\n `,\n\n iconOnlyMiddle: css`\n width: 32px;\n padding-inline: 0;\n `,\n\n iconOnlyLarge: css`\n width: 40px;\n padding-inline: 0;\n `,\n\n iconBox: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n `,\n\n spinnerSlot: css`\n overflow: hidden;\n\n width: 0;\n margin-inline-end: -6px;\n\n opacity: 0;\n\n transition:\n width 380ms cubic-bezier(0.22, 1, 0.36, 1),\n margin 380ms cubic-bezier(0.22, 1, 0.36, 1),\n opacity 260ms cubic-bezier(0.22, 1, 0.36, 1);\n `,\n\n spinnerSlotEnd: css`\n margin-inline: -6px 0;\n `,\n\n spinnerSlotShow: css`\n width: 12px;\n margin-inline: 0;\n opacity: 1;\n `,\n\n variantDefault: css`\n background: ${cssVar.colorBgContainer};\n\n /* &:hover/&:active included so the anchor form outranks antd's global a:hover/a:active link color */\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryBorder};\n color: ${cssVar.colorPrimaryText};\n }\n `,\n\n variantPrimary: css`\n border-color: ${cssVar.colorPrimary};\n background: ${cssVar.colorPrimary};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorBgLayout};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryHover};\n background: ${cssVar.colorPrimaryHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryActive};\n background: ${cssVar.colorPrimaryActive};\n }\n `,\n\n variantDashed: css`\n border-style: dashed;\n background: ${cssVar.colorBgContainer};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryBorder};\n color: ${cssVar.colorPrimaryText};\n }\n `,\n\n variantFill: css`\n border-color: transparent;\n background: ${cssVar.colorFillTertiary};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFillSecondary};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFill};\n }\n `,\n\n variantText: css`\n border-color: transparent;\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFillSecondary};\n }\n `,\n\n variantLink: css`\n padding-inline: 0;\n border-color: transparent;\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorPrimary};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorPrimaryHover};\n background: transparent;\n }\n `,\n\n dangerOutlined: css`\n border-color: ${cssVar.colorError};\n background: ${cssVar.colorBgContainer};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorBgContainer};\n }\n `,\n\n dangerSolid: css`\n border-color: ${cssVar.colorError};\n background: ${cssVar.colorError};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorBgLayout};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorErrorHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorActive};\n background: ${cssVar.colorErrorActive};\n }\n `,\n\n dangerFill: css`\n border-color: transparent;\n color: ${cssVar.colorError};\n background: ${cssVar.colorErrorBg};\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorErrorBgHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorActive};\n background: ${cssVar.colorErrorBgHover};\n }\n `,\n\n dangerInline: css`\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorHover};\n }\n `,\n\n ghostDefault: css`\n border-color: rgb(255 255 255 / 65%);\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: #fff;\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: #fff;\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n ghostDashed: css`\n border-style: dashed;\n `,\n\n ghostPrimary: css`\n border-color: ${cssVar.colorPrimary};\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorPrimary};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryHover};\n color: ${cssVar.colorPrimaryHover};\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n ghostDanger: css`\n border-color: ${cssVar.colorError};\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n color: ${cssVar.colorErrorHover};\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n spinner: css`\n @keyframes base-button-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n display: inline-block;\n\n width: 12px;\n height: 12px;\n border: 1.5px solid currentcolor;\n border-block-start-color: transparent;\n border-radius: 50%;\n\n animation: base-button-spin 0.6s linear infinite;\n `,\n}));\n"],"mappings":";;;AAIA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,MAAM,GAAG;;;;;;;;;wBASa,OAAO,YAAY;;;;;;;;;;;;;;;8BAeb,OAAO,mBAAmB;;;;;;;;;;CAWtD,WAAW,GAAG;cACF,cAAc,MAAM;;qBAEb,OAAO,eAAe;;;CAIzC,YAAY,GAAG;cACH,cAAc,OAAO;;qBAEd,OAAO,eAAe;;;CAIzC,WAAW,GAAG;cACF,cAAc,MAAM;;qBAEb,OAAO,aAAa;;;CAIvC,aAAa,GAAG;;;;CAKhB,YAAY,GAAG;;;CAIf,OAAO,GAAG;;;CAIV,SAAS,GAAG;;;CAIZ,eAAe,GAAG;;;;CAKlB,gBAAgB,GAAG;;;;CAKnB,eAAe,GAAG;;;;CAKlB,SAAS,GAAG;;;;;CAMZ,aAAa,GAAG;;;;;;;;;;;;;CAchB,gBAAgB,GAAG;;;CAInB,iBAAiB,GAAG;;;;;CAMpB,gBAAgB,GAAG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;;;;;;;;;;;;;;;;;;;CAoBjB,aAAa,GAAG;;;CAIhB,cAAc,GAAG;oBACC,OAAO,aAAa;;;;;;eAMzB,OAAO,aAAa;;;;sBAIb,OAAO,kBAAkB;eAChC,OAAO,kBAAkB;;;;;;;;CAStC,aAAa,GAAG;oBACE,OAAO,WAAW;;;;;;eAMvB,OAAO,WAAW;;;;sBAIX,OAAO,gBAAgB;eAC9B,OAAO,gBAAgB;;;;;;;;CASpC,SAAS,GAAG;;;;;;;;;;;;;;;;;CAiBb,EAAE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CheckboxProps } from "./type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/Checkbox/Checkbox.d.ts
|
|
5
|
+
declare const Checkbox: _$react.NamedExoticComponent<CheckboxProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Checkbox };
|
|
8
|
+
//# sourceMappingURL=Checkbox.d.mts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Text from "../../Text/Text.mjs";
|
|
3
|
+
import { styles } from "./style.mjs";
|
|
4
|
+
import { memo } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cx } from "antd-style";
|
|
7
|
+
import { CheckIcon, Minus } from "lucide-react";
|
|
8
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
9
|
+
//#region src/base-ui/Checkbox/Checkbox.tsx
|
|
10
|
+
const Checkbox$1 = memo(({ size = 16, shape = "square", backgroundColor, children, className, classNames, styles: customStyles, style, textProps, onChange, disabled, indeterminate, ...rest }) => {
|
|
11
|
+
const boxStyle = {
|
|
12
|
+
borderRadius: shape === "square" ? `max(4px, ${Math.round(size / 4)}px)` : "50%",
|
|
13
|
+
height: size,
|
|
14
|
+
width: size,
|
|
15
|
+
...backgroundColor ? { "--lobe-checkbox-bg": backgroundColor } : {},
|
|
16
|
+
...children ? {} : style,
|
|
17
|
+
...customStyles?.checkbox
|
|
18
|
+
};
|
|
19
|
+
const box = /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
20
|
+
disabled,
|
|
21
|
+
indeterminate,
|
|
22
|
+
style: boxStyle,
|
|
23
|
+
className: cx(styles.root, children ? classNames?.checkbox : className, classNames?.checkbox),
|
|
24
|
+
onCheckedChange: onChange,
|
|
25
|
+
...rest,
|
|
26
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, {
|
|
27
|
+
className: styles.indicator,
|
|
28
|
+
children: indeterminate ? /* @__PURE__ */ jsx(Minus, {
|
|
29
|
+
size,
|
|
30
|
+
strokeWidth: 3,
|
|
31
|
+
style: { transform: `scale(${shape === "square" ? .75 : .66})` }
|
|
32
|
+
}) : /* @__PURE__ */ jsx(CheckIcon, {
|
|
33
|
+
size,
|
|
34
|
+
strokeWidth: 3,
|
|
35
|
+
style: { transform: `scale(${shape === "square" ? .75 : .66})` }
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
if (!children) return box;
|
|
40
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
41
|
+
className: cx(styles.label, className, classNames?.wrapper),
|
|
42
|
+
style: {
|
|
43
|
+
gap: Math.floor(size / 2),
|
|
44
|
+
...style,
|
|
45
|
+
...customStyles?.wrapper
|
|
46
|
+
},
|
|
47
|
+
children: [box, /* @__PURE__ */ jsx(Text, {
|
|
48
|
+
as: "span",
|
|
49
|
+
className: classNames?.text,
|
|
50
|
+
style: customStyles?.text,
|
|
51
|
+
...textProps,
|
|
52
|
+
type: disabled ? "secondary" : textProps?.type,
|
|
53
|
+
children
|
|
54
|
+
})]
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
Checkbox$1.displayName = "Checkbox";
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Checkbox$1 as default };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=Checkbox.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.mjs","names":["Checkbox","BaseCheckbox"],"sources":["../../../src/base-ui/Checkbox/Checkbox.tsx"],"sourcesContent":["'use client';\n\nimport { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';\nimport { cx } from 'antd-style';\nimport { CheckIcon, Minus } from 'lucide-react';\nimport { type CSSProperties, memo } from 'react';\n\nimport Text from '@/Text';\n\nimport { styles } from './style';\nimport type { CheckboxProps } from './type';\n\nconst Checkbox = memo<CheckboxProps>(\n ({\n size = 16,\n shape = 'square',\n backgroundColor,\n children,\n className,\n classNames,\n styles: customStyles,\n style,\n textProps,\n onChange,\n disabled,\n indeterminate,\n ...rest\n }) => {\n const boxStyle: CSSProperties = {\n borderRadius: shape === 'square' ? `max(4px, ${Math.round(size / 4)}px)` : '50%',\n height: size,\n width: size,\n ...(backgroundColor ? { '--lobe-checkbox-bg': backgroundColor } : {}),\n ...(children ? {} : style),\n ...customStyles?.checkbox,\n };\n\n const box = (\n <BaseCheckbox.Root\n disabled={disabled}\n indeterminate={indeterminate}\n style={boxStyle}\n className={cx(\n styles.root,\n children ? classNames?.checkbox : className,\n classNames?.checkbox,\n )}\n onCheckedChange={onChange}\n {...rest}\n >\n <BaseCheckbox.Indicator className={styles.indicator}>\n {indeterminate ? (\n <Minus\n size={size}\n strokeWidth={3}\n style={{ transform: `scale(${shape === 'square' ? 0.75 : 0.66})` }}\n />\n ) : (\n <CheckIcon\n size={size}\n strokeWidth={3}\n style={{ transform: `scale(${shape === 'square' ? 0.75 : 0.66})` }}\n />\n )}\n </BaseCheckbox.Indicator>\n </BaseCheckbox.Root>\n );\n\n if (!children) return box;\n\n return (\n <label\n className={cx(styles.label, className, classNames?.wrapper)}\n style={{ gap: Math.floor(size / 2), ...style, ...customStyles?.wrapper }}\n >\n {box}\n <Text\n as={'span'}\n className={classNames?.text}\n style={customStyles?.text}\n {...textProps}\n type={disabled ? 'secondary' : textProps?.type}\n >\n {children}\n </Text>\n </label>\n );\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
1
|
+
import { CheckboxGroupProps } from "./type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/Checkbox/CheckboxGroup.d.ts
|
|
5
|
+
declare const CheckboxGroup: _$react.NamedExoticComponent<CheckboxGroupProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { CheckboxGroup };
|
|
8
|
+
//# sourceMappingURL=CheckboxGroup.d.mts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Checkbox from "./Checkbox.mjs";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { CheckboxGroup } from "@base-ui/react/checkbox-group";
|
|
6
|
+
//#region src/base-ui/Checkbox/CheckboxGroup.tsx
|
|
7
|
+
const CheckboxGroup$1 = memo(({ options, onChange, gap = 12, horizontal = true, size, shape, textProps, style, ...rest }) => {
|
|
8
|
+
const items = useMemo(() => options.map((option) => typeof option === "string" ? {
|
|
9
|
+
label: option,
|
|
10
|
+
value: option
|
|
11
|
+
} : option), [options]);
|
|
12
|
+
return /* @__PURE__ */ jsx(CheckboxGroup, {
|
|
13
|
+
style: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: horizontal ? "row" : "column",
|
|
16
|
+
flexWrap: "wrap",
|
|
17
|
+
gap,
|
|
18
|
+
...style
|
|
19
|
+
},
|
|
20
|
+
onValueChange: onChange,
|
|
21
|
+
...rest,
|
|
22
|
+
children: items.map((item) => /* @__PURE__ */ jsx(Checkbox, {
|
|
23
|
+
disabled: item.disabled,
|
|
24
|
+
name: item.value,
|
|
25
|
+
shape,
|
|
26
|
+
size,
|
|
27
|
+
textProps,
|
|
28
|
+
value: item.value,
|
|
29
|
+
children: item.label
|
|
30
|
+
}, item.value))
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
CheckboxGroup$1.displayName = "CheckboxGroup";
|
|
34
|
+
//#endregion
|
|
35
|
+
export { CheckboxGroup$1 as default };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=CheckboxGroup.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.mjs","names":["CheckboxGroup","BaseCheckboxGroup"],"sources":["../../../src/base-ui/Checkbox/CheckboxGroup.tsx"],"sourcesContent":["'use client';\n\nimport { CheckboxGroup as BaseCheckboxGroup } from '@base-ui/react/checkbox-group';\nimport { memo, useMemo } from 'react';\n\nimport Checkbox from './Checkbox';\nimport type { CheckboxGroupOption, CheckboxGroupProps } from './type';\n\nconst CheckboxGroup = memo<CheckboxGroupProps>(\n ({ options, onChange, gap = 12, horizontal = true, size, shape, textProps, style, ...rest }) => {\n const items = useMemo<CheckboxGroupOption[]>(\n () =>\n options.map((option) =>\n typeof option === 'string' ? { label: option, value: option } : option,\n ),\n [options],\n );\n\n return (\n <BaseCheckboxGroup\n style={{\n display: 'flex',\n flexDirection: horizontal ? 'row' : 'column',\n flexWrap: 'wrap',\n gap,\n ...style,\n }}\n onValueChange={onChange}\n {...rest}\n >\n {items.map((item) => (\n <Checkbox\n disabled={item.disabled}\n key={item.value}\n name={item.value}\n shape={shape}\n size={size}\n textProps={textProps}\n value={item.value}\n >\n {item.label}\n </Checkbox>\n ))}\n </BaseCheckboxGroup>\n );\n },\n);\n\nCheckboxGroup.displayName = 'CheckboxGroup';\n\nexport default CheckboxGroup;\n"],"mappings":";;;;;;AAQA,MAAMA,kBAAgB,MACnB,EAAE,SAAS,UAAU,MAAM,IAAI,aAAa,MAAM,MAAM,OAAO,WAAW,OAAO,GAAG,WAAW;CAC9F,MAAM,QAAQ,cAEV,QAAQ,KAAK,WACX,OAAO,WAAW,WAAW;EAAE,OAAO;EAAQ,OAAO;EAAQ,GAAG,OACjE,EACH,CAAC,QAAQ,CACV;AAED,QACE,oBAACC,eAAD;EACE,OAAO;GACL,SAAS;GACT,eAAe,aAAa,QAAQ;GACpC,UAAU;GACV;GACA,GAAG;GACJ;EACD,eAAe;EACf,GAAI;YAEH,MAAM,KAAK,SACV,oBAAC,UAAD;GACE,UAAU,KAAK;GAEf,MAAM,KAAK;GACJ;GACD;GACK;GACX,OAAO,KAAK;aAEX,KAAK;GACG,EARJ,KAAK,MAQD,CACX;EACgB,CAAA;EAGzB;AAED,gBAAc,cAAc"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createStaticStyles } from "antd-style";
|
|
2
|
+
//#region src/base-ui/Checkbox/style.ts
|
|
3
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
4
|
+
indicator: css`
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
`,
|
|
9
|
+
label: css`
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
user-select: none;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
|
|
15
|
+
&:has([data-disabled]) {
|
|
16
|
+
cursor: not-allowed;
|
|
17
|
+
}
|
|
18
|
+
`,
|
|
19
|
+
root: css`
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
flex: none;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
|
|
27
|
+
margin: 0;
|
|
28
|
+
padding: 0;
|
|
29
|
+
border: 1px solid ${cssVar.colorBorderSecondary};
|
|
30
|
+
|
|
31
|
+
color: ${cssVar.colorBgLayout};
|
|
32
|
+
|
|
33
|
+
background: ${cssVar.colorBgContainer};
|
|
34
|
+
outline: none;
|
|
35
|
+
|
|
36
|
+
transition:
|
|
37
|
+
background 150ms ${cssVar.motionEaseOut},
|
|
38
|
+
border-color 150ms ${cssVar.motionEaseOut};
|
|
39
|
+
|
|
40
|
+
&:hover:not([data-disabled], [data-checked], [data-indeterminate]) {
|
|
41
|
+
border-color: ${cssVar.colorBorder};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:focus-visible {
|
|
45
|
+
outline: 2px solid ${cssVar.colorPrimaryBorder};
|
|
46
|
+
outline-offset: 1px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&[data-checked],
|
|
50
|
+
&[data-indeterminate] {
|
|
51
|
+
border-color: var(--lobe-checkbox-bg, ${cssVar.colorPrimary});
|
|
52
|
+
background: var(--lobe-checkbox-bg, ${cssVar.colorPrimary});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&[data-disabled] {
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
|
|
58
|
+
border-color: ${cssVar.colorFill};
|
|
59
|
+
|
|
60
|
+
color: ${cssVar.colorText};
|
|
61
|
+
|
|
62
|
+
opacity: 0.25;
|
|
63
|
+
background: ${cssVar.colorFill};
|
|
64
|
+
}
|
|
65
|
+
`
|
|
66
|
+
}));
|
|
67
|
+
//#endregion
|
|
68
|
+
export { styles };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Checkbox/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n indicator: css`\n display: flex;\n align-items: center;\n justify-content: center;\n `,\n label: css`\n cursor: pointer;\n user-select: none;\n display: inline-flex;\n align-items: center;\n\n &:has([data-disabled]) {\n cursor: not-allowed;\n }\n `,\n root: css`\n cursor: pointer;\n\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n margin: 0;\n padding: 0;\n border: 1px solid ${cssVar.colorBorderSecondary};\n\n color: ${cssVar.colorBgLayout};\n\n background: ${cssVar.colorBgContainer};\n outline: none;\n\n transition:\n background 150ms ${cssVar.motionEaseOut},\n border-color 150ms ${cssVar.motionEaseOut};\n\n &:hover:not([data-disabled], [data-checked], [data-indeterminate]) {\n border-color: ${cssVar.colorBorder};\n }\n\n &:focus-visible {\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: 1px;\n }\n\n &[data-checked],\n &[data-indeterminate] {\n border-color: var(--lobe-checkbox-bg, ${cssVar.colorPrimary});\n background: var(--lobe-checkbox-bg, ${cssVar.colorPrimary});\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n\n border-color: ${cssVar.colorFill};\n\n color: ${cssVar.colorText};\n\n opacity: 0.25;\n background: ${cssVar.colorFill};\n }\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,WAAW,GAAG;;;;;CAKd,OAAO,GAAG;;;;;;;;;;CAUV,MAAM,GAAG;;;;;;;;;;wBAUa,OAAO,qBAAqB;;aAEvC,OAAO,cAAc;;kBAEhB,OAAO,iBAAiB;;;;yBAIjB,OAAO,cAAc;2BACnB,OAAO,cAAc;;;sBAG1B,OAAO,YAAY;;;;2BAId,OAAO,mBAAmB;;;;;;8CAMP,OAAO,aAAa;4CACtB,OAAO,aAAa;;;;;;sBAM1C,OAAO,UAAU;;eAExB,OAAO,UAAU;;;oBAGZ,OAAO,UAAU;;;CAGpC,EAAE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FlexboxProps } from "../../Flex/type.mjs";
|
|
2
|
+
import { TextProps } from "../../Text/type.mjs";
|
|
3
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
4
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
5
|
+
import { CheckboxGroup } from "@base-ui/react/checkbox-group";
|
|
6
|
+
|
|
7
|
+
//#region src/base-ui/Checkbox/type.d.ts
|
|
8
|
+
type CheckboxShape = 'square' | 'circle';
|
|
9
|
+
type BaseCheckboxProps = Omit<ComponentProps<typeof Checkbox.Root>, 'className' | 'style' | 'render' | 'children' | 'onCheckedChange'>;
|
|
10
|
+
interface CheckboxProps extends BaseCheckboxProps {
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
classNames?: {
|
|
15
|
+
checkbox?: string;
|
|
16
|
+
text?: string;
|
|
17
|
+
wrapper?: string;
|
|
18
|
+
};
|
|
19
|
+
onChange?: (checked: boolean) => void;
|
|
20
|
+
shape?: CheckboxShape;
|
|
21
|
+
/**
|
|
22
|
+
* Box size in pixels
|
|
23
|
+
* @default 16
|
|
24
|
+
*/
|
|
25
|
+
size?: number;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
styles?: {
|
|
28
|
+
checkbox?: CSSProperties;
|
|
29
|
+
text?: CSSProperties;
|
|
30
|
+
wrapper?: CSSProperties;
|
|
31
|
+
};
|
|
32
|
+
textProps?: Omit<TextProps, 'children' | 'className' | 'style'>;
|
|
33
|
+
}
|
|
34
|
+
interface CheckboxGroupOption {
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
label: ReactNode;
|
|
37
|
+
value: string;
|
|
38
|
+
}
|
|
39
|
+
type BaseCheckboxGroupProps = Omit<ComponentProps<typeof CheckboxGroup>, 'className' | 'style' | 'render' | 'children' | 'onValueChange' | 'onChange'>;
|
|
40
|
+
interface CheckboxGroupProps extends BaseCheckboxGroupProps, Pick<FlexboxProps, 'gap' | 'horizontal'> {
|
|
41
|
+
className?: string;
|
|
42
|
+
onChange?: (value: string[]) => void;
|
|
43
|
+
options: (string | CheckboxGroupOption)[];
|
|
44
|
+
shape?: CheckboxShape;
|
|
45
|
+
size?: number;
|
|
46
|
+
style?: CSSProperties;
|
|
47
|
+
textProps?: CheckboxProps['textProps'];
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { CheckboxGroupOption, CheckboxGroupProps, CheckboxProps, CheckboxShape };
|
|
51
|
+
//# sourceMappingURL=type.d.mts.map
|