@lobehub/ui 5.19.3 → 5.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Markdown/SyntaxMarkdown/CachedMarkdown.mjs +3 -2
- package/es/Markdown/SyntaxMarkdown/CachedMarkdown.mjs.map +1 -1
- package/es/Markdown/plugins/rehypeStreamAnimated.mjs.map +1 -1
- package/es/ThemeProvider/GlobalStyle/global.mjs +3 -2
- package/es/ThemeProvider/GlobalStyle/global.mjs.map +1 -1
- package/es/ThemeProvider/ThemeProvider.mjs +1 -1
- package/es/ThemeProvider/ThemeProvider.mjs.map +1 -1
- 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 +6 -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/es/node_modules/@types/hast/index.d.mts +642 -0
- package/package.json +4 -3
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { staticStylish } from "../../styles/theme/customStylishStatic.mjs";
|
|
2
|
+
import { controlHeight } from "../controlSize.mjs";
|
|
3
|
+
import { createStaticStyles } from "antd-style";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
//#region src/base-ui/Input/style.ts
|
|
6
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
7
|
+
borderless: css`
|
|
8
|
+
border: 1px solid transparent;
|
|
9
|
+
background: none;
|
|
10
|
+
`,
|
|
11
|
+
filled: css`
|
|
12
|
+
border: 1px solid transparent;
|
|
13
|
+
background: ${cssVar.colorFillTertiary};
|
|
14
|
+
|
|
15
|
+
&:hover:not(:focus-within, [data-disabled]) {
|
|
16
|
+
background: ${cssVar.colorFillSecondary};
|
|
17
|
+
}
|
|
18
|
+
`,
|
|
19
|
+
input: css`
|
|
20
|
+
flex: 1;
|
|
21
|
+
|
|
22
|
+
min-width: 0;
|
|
23
|
+
padding: 0;
|
|
24
|
+
border: none;
|
|
25
|
+
|
|
26
|
+
font: inherit;
|
|
27
|
+
color: inherit;
|
|
28
|
+
|
|
29
|
+
appearance: none;
|
|
30
|
+
background: transparent;
|
|
31
|
+
outline: none;
|
|
32
|
+
|
|
33
|
+
&::placeholder {
|
|
34
|
+
color: ${cssVar.colorTextPlaceholder};
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
invalid: css`
|
|
38
|
+
&:has([data-invalid]) {
|
|
39
|
+
border-color: ${cssVar.colorError};
|
|
40
|
+
|
|
41
|
+
&:focus-within {
|
|
42
|
+
border-color: ${cssVar.colorError};
|
|
43
|
+
box-shadow: 0 0 0 2px ${cssVar.colorErrorBg};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
outlined: css`
|
|
48
|
+
border: 1px solid ${cssVar.colorBorderSecondary};
|
|
49
|
+
background: ${cssVar.colorBgContainer};
|
|
50
|
+
|
|
51
|
+
&:hover:not(:focus-within, [data-disabled]) {
|
|
52
|
+
border-color: ${cssVar.colorBorder};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:focus-within {
|
|
56
|
+
border-color: ${cssVar.colorPrimary};
|
|
57
|
+
box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBg};
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
root: css`
|
|
61
|
+
cursor: text;
|
|
62
|
+
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
gap: 8px;
|
|
65
|
+
align-items: center;
|
|
66
|
+
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
width: 100%;
|
|
69
|
+
padding-inline: 12px;
|
|
70
|
+
border-radius: ${cssVar.borderRadius};
|
|
71
|
+
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
color: ${cssVar.colorText};
|
|
74
|
+
|
|
75
|
+
transition:
|
|
76
|
+
background 150ms ${cssVar.motionEaseOut},
|
|
77
|
+
border-color 150ms ${cssVar.motionEaseOut},
|
|
78
|
+
box-shadow 150ms ${cssVar.motionEaseOut};
|
|
79
|
+
|
|
80
|
+
&[data-disabled],
|
|
81
|
+
&:has(:disabled) {
|
|
82
|
+
cursor: not-allowed;
|
|
83
|
+
color: ${cssVar.colorTextQuaternary};
|
|
84
|
+
opacity: 0.66;
|
|
85
|
+
}
|
|
86
|
+
`,
|
|
87
|
+
shadow: staticStylish.shadow,
|
|
88
|
+
sizeLarge: css`
|
|
89
|
+
height: ${controlHeight.large}px;
|
|
90
|
+
border-radius: ${cssVar.borderRadiusLG};
|
|
91
|
+
font-size: 16px;
|
|
92
|
+
`,
|
|
93
|
+
sizeMiddle: css`
|
|
94
|
+
height: ${controlHeight.middle}px;
|
|
95
|
+
`,
|
|
96
|
+
sizeSmall: css`
|
|
97
|
+
height: ${controlHeight.small}px;
|
|
98
|
+
padding-inline: 8px;
|
|
99
|
+
border-radius: ${cssVar.borderRadiusSM};
|
|
100
|
+
font-size: 12px;
|
|
101
|
+
`,
|
|
102
|
+
numberControl: css`
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
|
|
105
|
+
display: flex;
|
|
106
|
+
flex: 1;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
|
|
110
|
+
margin: 0;
|
|
111
|
+
padding: 0;
|
|
112
|
+
border: none;
|
|
113
|
+
|
|
114
|
+
color: ${cssVar.colorTextTertiary};
|
|
115
|
+
|
|
116
|
+
background: none;
|
|
117
|
+
outline: none;
|
|
118
|
+
|
|
119
|
+
transition: color 150ms ${cssVar.motionEaseOut};
|
|
120
|
+
|
|
121
|
+
&:hover:not(:disabled) {
|
|
122
|
+
color: ${cssVar.colorText};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&:disabled {
|
|
126
|
+
cursor: not-allowed;
|
|
127
|
+
opacity: 0.4;
|
|
128
|
+
}
|
|
129
|
+
`,
|
|
130
|
+
numberControls: css`
|
|
131
|
+
display: flex;
|
|
132
|
+
flex: none;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
align-self: stretch;
|
|
135
|
+
|
|
136
|
+
width: 22px;
|
|
137
|
+
margin-inline-end: -8px;
|
|
138
|
+
border-inline-start: 1px solid ${cssVar.colorBorderSecondary};
|
|
139
|
+
`,
|
|
140
|
+
numberInput: css`
|
|
141
|
+
font-variant-numeric: tabular-nums;
|
|
142
|
+
`,
|
|
143
|
+
otpCell: css`
|
|
144
|
+
flex: none;
|
|
145
|
+
width: ${controlHeight.middle}px;
|
|
146
|
+
padding-inline: 0;
|
|
147
|
+
text-align: center;
|
|
148
|
+
`,
|
|
149
|
+
otpRoot: css`
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
gap: 8px;
|
|
152
|
+
align-items: center;
|
|
153
|
+
`,
|
|
154
|
+
passwordToggle: css`
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
|
|
161
|
+
margin: 0;
|
|
162
|
+
padding: 0;
|
|
163
|
+
border: none;
|
|
164
|
+
|
|
165
|
+
color: ${cssVar.colorTextTertiary};
|
|
166
|
+
|
|
167
|
+
background: none;
|
|
168
|
+
outline: none;
|
|
169
|
+
|
|
170
|
+
transition: color 150ms ${cssVar.motionEaseOut};
|
|
171
|
+
|
|
172
|
+
&:hover {
|
|
173
|
+
color: ${cssVar.colorText};
|
|
174
|
+
}
|
|
175
|
+
`,
|
|
176
|
+
slot: css`
|
|
177
|
+
display: inline-flex;
|
|
178
|
+
flex: none;
|
|
179
|
+
align-items: center;
|
|
180
|
+
color: ${cssVar.colorTextTertiary};
|
|
181
|
+
`,
|
|
182
|
+
textarea: css`
|
|
183
|
+
height: auto;
|
|
184
|
+
padding-block: 8px;
|
|
185
|
+
|
|
186
|
+
textarea {
|
|
187
|
+
resize: none;
|
|
188
|
+
min-height: calc(1.5em * var(--textarea-min-rows, 2));
|
|
189
|
+
max-height: var(--textarea-max-height, none);
|
|
190
|
+
line-height: 1.5;
|
|
191
|
+
}
|
|
192
|
+
`,
|
|
193
|
+
textareaAutoSize: css`
|
|
194
|
+
textarea {
|
|
195
|
+
field-sizing: content;
|
|
196
|
+
}
|
|
197
|
+
`,
|
|
198
|
+
textareaResize: css`
|
|
199
|
+
textarea {
|
|
200
|
+
resize: vertical;
|
|
201
|
+
}
|
|
202
|
+
`
|
|
203
|
+
}));
|
|
204
|
+
const rootVariants = cva([styles.root, styles.invalid], {
|
|
205
|
+
defaultVariants: {
|
|
206
|
+
shadow: false,
|
|
207
|
+
size: "middle",
|
|
208
|
+
variant: "outlined"
|
|
209
|
+
},
|
|
210
|
+
variants: {
|
|
211
|
+
shadow: {
|
|
212
|
+
false: null,
|
|
213
|
+
true: styles.shadow
|
|
214
|
+
},
|
|
215
|
+
size: {
|
|
216
|
+
large: styles.sizeLarge,
|
|
217
|
+
middle: styles.sizeMiddle,
|
|
218
|
+
small: styles.sizeSmall
|
|
219
|
+
},
|
|
220
|
+
variant: {
|
|
221
|
+
borderless: styles.borderless,
|
|
222
|
+
filled: styles.filled,
|
|
223
|
+
outlined: styles.outlined
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
//#endregion
|
|
228
|
+
export { rootVariants, styles };
|
|
229
|
+
|
|
230
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../../src/base-ui/Input/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { controlHeight } from '@/base-ui/controlSize';\nimport { lobeStaticStylish } from '@/styles';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n borderless: css`\n border: 1px solid transparent;\n background: none;\n `,\n filled: css`\n border: 1px solid transparent;\n background: ${cssVar.colorFillTertiary};\n\n &:hover:not(:focus-within, [data-disabled]) {\n background: ${cssVar.colorFillSecondary};\n }\n `,\n input: css`\n flex: 1;\n\n min-width: 0;\n padding: 0;\n border: none;\n\n font: inherit;\n color: inherit;\n\n appearance: none;\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: ${cssVar.colorTextPlaceholder};\n }\n `,\n invalid: css`\n &:has([data-invalid]) {\n border-color: ${cssVar.colorError};\n\n &:focus-within {\n border-color: ${cssVar.colorError};\n box-shadow: 0 0 0 2px ${cssVar.colorErrorBg};\n }\n }\n `,\n outlined: css`\n border: 1px solid ${cssVar.colorBorderSecondary};\n background: ${cssVar.colorBgContainer};\n\n &:hover:not(:focus-within, [data-disabled]) {\n border-color: ${cssVar.colorBorder};\n }\n\n &:focus-within {\n border-color: ${cssVar.colorPrimary};\n box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBg};\n }\n `,\n root: css`\n cursor: text;\n\n display: inline-flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: 100%;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadius};\n\n font-size: 14px;\n color: ${cssVar.colorText};\n\n transition:\n background 150ms ${cssVar.motionEaseOut},\n border-color 150ms ${cssVar.motionEaseOut},\n box-shadow 150ms ${cssVar.motionEaseOut};\n\n &[data-disabled],\n &:has(:disabled) {\n cursor: not-allowed;\n color: ${cssVar.colorTextQuaternary};\n opacity: 0.66;\n }\n `,\n shadow: lobeStaticStylish.shadow,\n sizeLarge: css`\n height: ${controlHeight.large}px;\n border-radius: ${cssVar.borderRadiusLG};\n font-size: 16px;\n `,\n sizeMiddle: css`\n height: ${controlHeight.middle}px;\n `,\n sizeSmall: css`\n height: ${controlHeight.small}px;\n padding-inline: 8px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 12px;\n `,\n numberControl: css`\n cursor: pointer;\n\n display: flex;\n flex: 1;\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:not(:disabled) {\n color: ${cssVar.colorText};\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n `,\n numberControls: css`\n display: flex;\n flex: none;\n flex-direction: column;\n align-self: stretch;\n\n width: 22px;\n margin-inline-end: -8px;\n border-inline-start: 1px solid ${cssVar.colorBorderSecondary};\n `,\n numberInput: css`\n font-variant-numeric: tabular-nums;\n `,\n otpCell: css`\n flex: none;\n width: ${controlHeight.middle}px;\n padding-inline: 0;\n text-align: center;\n `,\n otpRoot: css`\n display: inline-flex;\n gap: 8px;\n align-items: center;\n `,\n passwordToggle: 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 slot: css`\n display: inline-flex;\n flex: none;\n align-items: center;\n color: ${cssVar.colorTextTertiary};\n `,\n textarea: css`\n height: auto;\n padding-block: 8px;\n\n textarea {\n resize: none;\n min-height: calc(1.5em * var(--textarea-min-rows, 2));\n max-height: var(--textarea-max-height, none);\n line-height: 1.5;\n }\n `,\n textareaAutoSize: css`\n textarea {\n field-sizing: content;\n }\n `,\n textareaResize: css`\n textarea {\n resize: vertical;\n }\n `,\n}));\n\nexport const rootVariants = cva([styles.root, styles.invalid], {\n defaultVariants: {\n shadow: false,\n size: 'middle',\n variant: 'outlined',\n },\n variants: {\n shadow: {\n false: null,\n true: styles.shadow,\n },\n size: {\n large: styles.sizeLarge,\n middle: styles.sizeMiddle,\n small: styles.sizeSmall,\n },\n variant: {\n borderless: styles.borderless,\n filled: styles.filled,\n outlined: styles.outlined,\n },\n },\n});\n"],"mappings":";;;;;AAMA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,YAAY,GAAG;;;;CAIf,QAAQ,GAAG;;kBAEK,OAAO,kBAAkB;;;oBAGvB,OAAO,mBAAmB;;;CAG5C,OAAO,GAAG;;;;;;;;;;;;;;;eAeG,OAAO,qBAAqB;;;CAGzC,SAAS,GAAG;;sBAEQ,OAAO,WAAW;;;wBAGhB,OAAO,WAAW;gCACV,OAAO,aAAa;;;;CAIlD,UAAU,GAAG;wBACS,OAAO,qBAAqB;kBAClC,OAAO,iBAAiB;;;sBAGpB,OAAO,YAAY;;;;sBAInB,OAAO,aAAa;8BACZ,OAAO,eAAe;;;CAGlD,MAAM,GAAG;;;;;;;;;;qBAUU,OAAO,aAAa;;;aAG5B,OAAO,UAAU;;;yBAGL,OAAO,cAAc;2BACnB,OAAO,cAAc;yBACvB,OAAO,cAAc;;;;;eAK/B,OAAO,oBAAoB;;;;CAIxC,QAAQA,cAAkB;CAC1B,WAAW,GAAG;cACF,cAAc,MAAM;qBACb,OAAO,eAAe;;;CAGzC,YAAY,GAAG;cACH,cAAc,OAAO;;CAEjC,WAAW,GAAG;cACF,cAAc,MAAM;;qBAEb,OAAO,eAAe;;;CAGzC,eAAe,GAAG;;;;;;;;;;;;aAYP,OAAO,kBAAkB;;;;;8BAKR,OAAO,cAAc;;;eAGpC,OAAO,UAAU;;;;;;;;CAQ9B,gBAAgB,GAAG;;;;;;;;qCAQgB,OAAO,qBAAqB;;CAE/D,aAAa,GAAG;;;CAGhB,SAAS,GAAG;;aAED,cAAc,OAAO;;;;CAIhC,SAAS,GAAG;;;;;CAKZ,gBAAgB,GAAG;;;;;;;;;;;aAWR,OAAO,kBAAkB;;;;;8BAKR,OAAO,cAAc;;;eAGpC,OAAO,UAAU;;;CAG9B,MAAM,GAAG;;;;aAIE,OAAO,kBAAkB;;CAEpC,UAAU,GAAG;;;;;;;;;;;CAWb,kBAAkB,GAAG;;;;;CAKrB,gBAAgB,GAAG;;;;;CAKpB,EAAE;AAEH,MAAa,eAAe,IAAI,CAAC,OAAO,MAAM,OAAO,QAAQ,EAAE;CAC7D,iBAAiB;EACf,QAAQ;EACR,MAAM;EACN,SAAS;EACV;CACD,UAAU;EACR,QAAQ;GACN,OAAO;GACP,MAAM,OAAO;GACd;EACD,MAAM;GACJ,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,OAAO,OAAO;GACf;EACD,SAAS;GACP,YAAY,OAAO;GACnB,QAAQ,OAAO;GACf,UAAU,OAAO;GAClB;EACF;CACF,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { CSSProperties, ComponentProps, ReactNode, Ref } from "react";
|
|
2
|
+
import { Input } from "@base-ui/react/input";
|
|
3
|
+
import { NumberField } from "@base-ui/react/number-field";
|
|
4
|
+
import { OTPField } from "@base-ui/react/otp-field";
|
|
5
|
+
|
|
6
|
+
//#region src/base-ui/Input/type.d.ts
|
|
7
|
+
type InputVariant = 'filled' | 'outlined' | 'borderless';
|
|
8
|
+
type InputSize = 'small' | 'middle' | 'large';
|
|
9
|
+
interface InputClassNames {
|
|
10
|
+
input?: string;
|
|
11
|
+
prefix?: string;
|
|
12
|
+
suffix?: string;
|
|
13
|
+
}
|
|
14
|
+
interface InputStyles {
|
|
15
|
+
input?: CSSProperties;
|
|
16
|
+
prefix?: CSSProperties;
|
|
17
|
+
suffix?: CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
type BaseInputProps = Omit<ComponentProps<typeof Input>, 'size' | 'prefix' | 'render' | 'className' | 'style'>;
|
|
20
|
+
interface InputProps extends BaseInputProps {
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Custom class names for each part
|
|
24
|
+
*/
|
|
25
|
+
classNames?: InputClassNames;
|
|
26
|
+
/**
|
|
27
|
+
* Prefix node rendered before the input
|
|
28
|
+
*/
|
|
29
|
+
prefix?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Reference to the input element
|
|
32
|
+
*/
|
|
33
|
+
ref?: Ref<HTMLInputElement>;
|
|
34
|
+
/**
|
|
35
|
+
* Apply lobe shadow style
|
|
36
|
+
*/
|
|
37
|
+
shadow?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Size of the input
|
|
40
|
+
* @default 'middle'
|
|
41
|
+
*/
|
|
42
|
+
size?: InputSize;
|
|
43
|
+
style?: CSSProperties;
|
|
44
|
+
/**
|
|
45
|
+
* Custom styles for each part
|
|
46
|
+
*/
|
|
47
|
+
styles?: InputStyles;
|
|
48
|
+
/**
|
|
49
|
+
* Suffix node rendered after the input
|
|
50
|
+
*/
|
|
51
|
+
suffix?: ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Visual variant, defaults to `filled` in dark mode and `outlined` in light mode
|
|
54
|
+
*/
|
|
55
|
+
variant?: InputVariant;
|
|
56
|
+
}
|
|
57
|
+
interface InputPasswordProps extends Omit<InputProps, 'type'> {
|
|
58
|
+
/**
|
|
59
|
+
* Show the eye toggle button
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
visibilityToggle?: boolean;
|
|
63
|
+
}
|
|
64
|
+
type BaseNumberFieldProps = Omit<ComponentProps<typeof NumberField.Root>, 'className' | 'style' | 'render' | 'onValueChange' | 'children'>;
|
|
65
|
+
interface InputNumberProps extends BaseNumberFieldProps {
|
|
66
|
+
/**
|
|
67
|
+
* Change value on wheel scrub
|
|
68
|
+
*/
|
|
69
|
+
changeOnWheel?: boolean;
|
|
70
|
+
className?: string;
|
|
71
|
+
classNames?: Pick<InputClassNames, 'input'>;
|
|
72
|
+
/**
|
|
73
|
+
* Show increment/decrement buttons
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
controls?: boolean;
|
|
77
|
+
onChange?: (value: number | null) => void;
|
|
78
|
+
placeholder?: string;
|
|
79
|
+
ref?: Ref<HTMLInputElement>;
|
|
80
|
+
shadow?: boolean;
|
|
81
|
+
size?: InputSize;
|
|
82
|
+
style?: CSSProperties;
|
|
83
|
+
styles?: Pick<InputStyles, 'input'>;
|
|
84
|
+
variant?: InputVariant;
|
|
85
|
+
}
|
|
86
|
+
type BaseOTPFieldProps = Omit<ComponentProps<typeof OTPField.Root>, 'className' | 'style' | 'render' | 'onValueChange' | 'children' | 'length'>;
|
|
87
|
+
interface InputOTPProps extends BaseOTPFieldProps {
|
|
88
|
+
className?: string;
|
|
89
|
+
classNames?: Pick<InputClassNames, 'input'>;
|
|
90
|
+
/**
|
|
91
|
+
* Number of cells
|
|
92
|
+
* @default 6
|
|
93
|
+
*/
|
|
94
|
+
length?: number;
|
|
95
|
+
onChange?: (value: string) => void;
|
|
96
|
+
shadow?: boolean;
|
|
97
|
+
size?: InputSize;
|
|
98
|
+
style?: CSSProperties;
|
|
99
|
+
styles?: Pick<InputStyles, 'input'>;
|
|
100
|
+
variant?: InputVariant;
|
|
101
|
+
}
|
|
102
|
+
type TextAreaAutoSize = boolean | {
|
|
103
|
+
maxRows?: number;
|
|
104
|
+
minRows?: number;
|
|
105
|
+
};
|
|
106
|
+
interface TextAreaProps extends Omit<ComponentProps<'textarea'>, 'prefix'>, Pick<InputProps, 'shadow' | 'variant'> {
|
|
107
|
+
/**
|
|
108
|
+
* Auto grow with content, optionally bounded by minRows/maxRows
|
|
109
|
+
*/
|
|
110
|
+
autoSize?: TextAreaAutoSize;
|
|
111
|
+
classNames?: Pick<InputClassNames, 'input'>;
|
|
112
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
113
|
+
/**
|
|
114
|
+
* Allow manual resize
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
resize?: boolean;
|
|
118
|
+
styles?: Pick<InputStyles, 'input'>;
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { InputClassNames, InputNumberProps, InputOTPProps, InputPasswordProps, InputProps, InputSize, InputStyles, InputVariant, TextAreaAutoSize, TextAreaProps };
|
|
122
|
+
//# sourceMappingURL=type.d.mts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { staticStylish } from "../../styles/theme/customStylishStatic.mjs";
|
|
2
|
+
import { controlHeight } from "../controlSize.mjs";
|
|
2
3
|
import { createStaticStyles, cx } from "antd-style";
|
|
3
4
|
import { cva } from "class-variance-authority";
|
|
4
5
|
//#region src/base-ui/Select/style.ts
|
|
@@ -251,7 +252,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
251
252
|
}
|
|
252
253
|
`,
|
|
253
254
|
triggerLarge: css`
|
|
254
|
-
min-height:
|
|
255
|
+
min-height: ${controlHeight.large}px;
|
|
255
256
|
padding-block: 6px;
|
|
256
257
|
padding-inline: 12px;
|
|
257
258
|
|
|
@@ -259,7 +260,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
259
260
|
line-height: 24px;
|
|
260
261
|
`,
|
|
261
262
|
triggerMiddle: css`
|
|
262
|
-
min-height:
|
|
263
|
+
min-height: ${controlHeight.middle}px;
|
|
263
264
|
padding-block: 4px;
|
|
264
265
|
padding-inline: 11px;
|
|
265
266
|
|
|
@@ -267,7 +268,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
267
268
|
line-height: 20px;
|
|
268
269
|
`,
|
|
269
270
|
triggerSmall: css`
|
|
270
|
-
min-height:
|
|
271
|
+
min-height: ${controlHeight.small}px;
|
|
271
272
|
padding-block: 0;
|
|
272
273
|
padding-inline: 8px;
|
|
273
274
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../../src/base-ui/Select/style.ts"],"sourcesContent":["import { createStaticStyles, cx } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n arrow: css`\n display: flex;\n width: 12px;\n height: 6px;\n\n & > svg {\n width: 100%;\n height: 100%;\n }\n `,\n borderless: cx(\n lobeStaticStylish.variantBorderless,\n css`\n --lobe-select-open-bg: ${cssVar.colorFillTertiary};\n --lobe-select-readonly-bg: color-mix(in srgb, ${cssVar.colorFillTertiary} 70%, transparent);\n --lobe-select-disabled-bg: color-mix(in srgb, ${cssVar.colorFillTertiary} 55%, transparent);\n `,\n ),\n clear: css`\n display: inline-flex;\n align-items: center;\n\n color: ${cssVar.colorTextTertiary};\n\n opacity: 0;\n\n transition: opacity 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n color: ${cssVar.colorTextSecondary};\n }\n `,\n empty: css``,\n filled: cx(\n lobeStaticStylish.variantFilled,\n css`\n --lobe-select-open-bg: ${cssVar.colorFillSecondary};\n --lobe-select-readonly-bg: color-mix(in srgb, ${cssVar.colorFillTertiary} 70%, transparent);\n --lobe-select-disabled-bg: color-mix(in srgb, ${cssVar.colorFillTertiary} 55%, transparent);\n `,\n ),\n group: css``,\n groupLabel: css``,\n icon: css`\n display: inline-flex;\n align-items: center;\n transition: transform 150ms ${cssVar.motionEaseOut};\n\n &[data-popup-open] {\n transform: rotate(180deg);\n }\n `,\n item: css``,\n itemBoldSelected: css`\n &[data-selected] {\n font-weight: 600;\n }\n `,\n itemIndicator: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n margin-inline-start: auto;\n padding-inline-start: 8px;\n\n color: ${cssVar.colorPrimary};\n `,\n itemText: css``,\n list: css`\n overflow-y: auto;\n flex: 1;\n\n min-height: 0;\n max-height: var(--lobe-select-available-height, var(--available-height));\n padding-block: 0;\n `,\n outlined: cx(\n lobeStaticStylish.variantOutlined,\n css`\n --lobe-select-open-bg: ${cssVar.colorFillTertiary};\n --lobe-select-readonly-bg: color-mix(in srgb, ${cssVar.colorBgContainer} 75%, transparent);\n --lobe-select-disabled-bg: color-mix(in srgb, ${cssVar.colorBgContainer} 60%, transparent);\n `,\n ),\n popup: css`\n --lobe-select-available-height: min(\n var(--available-height),\n var(--lobe-select-popup-max-height, var(--available-height))\n );\n\n transform-origin: var(--transform-origin);\n\n display: flex;\n flex-direction: column;\n\n box-sizing: border-box;\n\n transition:\n opacity 150ms ${cssVar.motionEaseOut},\n transform 150ms ${cssVar.motionEaseOut};\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: scaleY(0.92);\n opacity: 0;\n }\n `,\n positioner: css`\n z-index: 1100;\n outline: none;\n `,\n prefix: css`\n display: inline-flex;\n align-items: center;\n color: ${cssVar.colorTextSecondary};\n `,\n scrollArrow: css`\n cursor: default;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n height: 16px;\n\n color: ${cssVar.colorTextSecondary};\n\n background: ${cssVar.colorBgElevated};\n `,\n search: css`\n cursor: text;\n\n display: flex;\n align-items: center;\n\n min-height: 36px;\n margin-inline: -4px;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-end: 1px solid ${cssVar.colorFillSecondary};\n `,\n searchInput: css`\n flex: 1;\n\n min-width: 0;\n padding-block: 0;\n padding-inline: 4px;\n border: 0;\n\n font-size: 14px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: ${cssVar.colorTextPlaceholder};\n }\n `,\n shadow: lobeStaticStylish.shadow,\n suffix: css`\n display: inline-flex;\n gap: 6px;\n align-items: center;\n color: ${cssVar.colorTextSecondary};\n `,\n tag: css`\n display: inline-flex;\n align-items: center;\n\n max-width: 100%;\n padding-block: 0;\n padding-inline: 6px;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 12px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n background: ${cssVar.colorFillTertiary};\n `,\n tags: css`\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n align-items: center;\n `,\n trigger: css`\n cursor: pointer;\n user-select: none;\n\n display: inline-flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: 100%;\n border: 1px solid transparent;\n border-radius: ${cssVar.borderRadius};\n\n font-family: inherit;\n color: ${cssVar.colorText};\n\n background: transparent;\n outline: none;\n\n transition: all 150ms ${cssVar.motionEaseOut};\n\n &:not([data-disabled], [data-readonly])[data-popup-open],\n &:not([data-disabled], [data-readonly])[data-open],\n &:not([data-disabled], [data-readonly])[data-state='open'],\n &:not([data-disabled], [data-readonly])[aria-expanded='true'] {\n background: var(--lobe-select-open-bg, ${cssVar.colorFillTertiary});\n }\n\n &:focus-visible {\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: 1px;\n }\n\n &:hover [data-role='lobe-select-clear'] {\n opacity: 1;\n }\n\n &[data-placeholder] [data-role='lobe-select-clear'] {\n pointer-events: none;\n opacity: 0;\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n background: var(--lobe-select-disabled-bg, transparent);\n\n &:hover {\n background: var(--lobe-select-disabled-bg, transparent);\n }\n }\n\n &[data-readonly] {\n cursor: default;\n color: ${cssVar.colorTextSecondary};\n background: var(--lobe-select-readonly-bg, transparent);\n\n &:hover {\n background: var(--lobe-select-readonly-bg, transparent);\n }\n }\n\n &[data-disabled] [data-role='lobe-select-clear'] {\n pointer-events: none;\n opacity: 0;\n }\n `,\n triggerLarge: css`\n min-height:
|
|
1
|
+
{"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../../src/base-ui/Select/style.ts"],"sourcesContent":["import { createStaticStyles, cx } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { controlHeight } from '@/base-ui/controlSize';\nimport { lobeStaticStylish } from '@/styles';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n arrow: css`\n display: flex;\n width: 12px;\n height: 6px;\n\n & > svg {\n width: 100%;\n height: 100%;\n }\n `,\n borderless: cx(\n lobeStaticStylish.variantBorderless,\n css`\n --lobe-select-open-bg: ${cssVar.colorFillTertiary};\n --lobe-select-readonly-bg: color-mix(in srgb, ${cssVar.colorFillTertiary} 70%, transparent);\n --lobe-select-disabled-bg: color-mix(in srgb, ${cssVar.colorFillTertiary} 55%, transparent);\n `,\n ),\n clear: css`\n display: inline-flex;\n align-items: center;\n\n color: ${cssVar.colorTextTertiary};\n\n opacity: 0;\n\n transition: opacity 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n color: ${cssVar.colorTextSecondary};\n }\n `,\n empty: css``,\n filled: cx(\n lobeStaticStylish.variantFilled,\n css`\n --lobe-select-open-bg: ${cssVar.colorFillSecondary};\n --lobe-select-readonly-bg: color-mix(in srgb, ${cssVar.colorFillTertiary} 70%, transparent);\n --lobe-select-disabled-bg: color-mix(in srgb, ${cssVar.colorFillTertiary} 55%, transparent);\n `,\n ),\n group: css``,\n groupLabel: css``,\n icon: css`\n display: inline-flex;\n align-items: center;\n transition: transform 150ms ${cssVar.motionEaseOut};\n\n &[data-popup-open] {\n transform: rotate(180deg);\n }\n `,\n item: css``,\n itemBoldSelected: css`\n &[data-selected] {\n font-weight: 600;\n }\n `,\n itemIndicator: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n margin-inline-start: auto;\n padding-inline-start: 8px;\n\n color: ${cssVar.colorPrimary};\n `,\n itemText: css``,\n list: css`\n overflow-y: auto;\n flex: 1;\n\n min-height: 0;\n max-height: var(--lobe-select-available-height, var(--available-height));\n padding-block: 0;\n `,\n outlined: cx(\n lobeStaticStylish.variantOutlined,\n css`\n --lobe-select-open-bg: ${cssVar.colorFillTertiary};\n --lobe-select-readonly-bg: color-mix(in srgb, ${cssVar.colorBgContainer} 75%, transparent);\n --lobe-select-disabled-bg: color-mix(in srgb, ${cssVar.colorBgContainer} 60%, transparent);\n `,\n ),\n popup: css`\n --lobe-select-available-height: min(\n var(--available-height),\n var(--lobe-select-popup-max-height, var(--available-height))\n );\n\n transform-origin: var(--transform-origin);\n\n display: flex;\n flex-direction: column;\n\n box-sizing: border-box;\n\n transition:\n opacity 150ms ${cssVar.motionEaseOut},\n transform 150ms ${cssVar.motionEaseOut};\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: scaleY(0.92);\n opacity: 0;\n }\n `,\n positioner: css`\n z-index: 1100;\n outline: none;\n `,\n prefix: css`\n display: inline-flex;\n align-items: center;\n color: ${cssVar.colorTextSecondary};\n `,\n scrollArrow: css`\n cursor: default;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n height: 16px;\n\n color: ${cssVar.colorTextSecondary};\n\n background: ${cssVar.colorBgElevated};\n `,\n search: css`\n cursor: text;\n\n display: flex;\n align-items: center;\n\n min-height: 36px;\n margin-inline: -4px;\n padding-block: 8px;\n padding-inline: 12px;\n border-block-end: 1px solid ${cssVar.colorFillSecondary};\n `,\n searchInput: css`\n flex: 1;\n\n min-width: 0;\n padding-block: 0;\n padding-inline: 4px;\n border: 0;\n\n font-size: 14px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: ${cssVar.colorTextPlaceholder};\n }\n `,\n shadow: lobeStaticStylish.shadow,\n suffix: css`\n display: inline-flex;\n gap: 6px;\n align-items: center;\n color: ${cssVar.colorTextSecondary};\n `,\n tag: css`\n display: inline-flex;\n align-items: center;\n\n max-width: 100%;\n padding-block: 0;\n padding-inline: 6px;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 12px;\n line-height: 20px;\n color: ${cssVar.colorText};\n\n background: ${cssVar.colorFillTertiary};\n `,\n tags: css`\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n align-items: center;\n `,\n trigger: css`\n cursor: pointer;\n user-select: none;\n\n display: inline-flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: 100%;\n border: 1px solid transparent;\n border-radius: ${cssVar.borderRadius};\n\n font-family: inherit;\n color: ${cssVar.colorText};\n\n background: transparent;\n outline: none;\n\n transition: all 150ms ${cssVar.motionEaseOut};\n\n &:not([data-disabled], [data-readonly])[data-popup-open],\n &:not([data-disabled], [data-readonly])[data-open],\n &:not([data-disabled], [data-readonly])[data-state='open'],\n &:not([data-disabled], [data-readonly])[aria-expanded='true'] {\n background: var(--lobe-select-open-bg, ${cssVar.colorFillTertiary});\n }\n\n &:focus-visible {\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: 1px;\n }\n\n &:hover [data-role='lobe-select-clear'] {\n opacity: 1;\n }\n\n &[data-placeholder] [data-role='lobe-select-clear'] {\n pointer-events: none;\n opacity: 0;\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n background: var(--lobe-select-disabled-bg, transparent);\n\n &:hover {\n background: var(--lobe-select-disabled-bg, transparent);\n }\n }\n\n &[data-readonly] {\n cursor: default;\n color: ${cssVar.colorTextSecondary};\n background: var(--lobe-select-readonly-bg, transparent);\n\n &:hover {\n background: var(--lobe-select-readonly-bg, transparent);\n }\n }\n\n &[data-disabled] [data-role='lobe-select-clear'] {\n pointer-events: none;\n opacity: 0;\n }\n `,\n triggerLarge: css`\n min-height: ${controlHeight.large}px;\n padding-block: 6px;\n padding-inline: 12px;\n\n font-size: 16px;\n line-height: 24px;\n `,\n triggerMiddle: css`\n min-height: ${controlHeight.middle}px;\n padding-block: 4px;\n padding-inline: 11px;\n\n font-size: 14px;\n line-height: 20px;\n `,\n triggerSmall: css`\n min-height: ${controlHeight.small}px;\n padding-block: 0;\n padding-inline: 8px;\n\n font-size: 12px;\n line-height: 18px;\n `,\n value: css`\n display: flex;\n flex: 1;\n flex-wrap: wrap;\n gap: 4px;\n align-items: center;\n\n min-width: 0;\n\n color: inherit;\n\n &[data-placeholder] {\n color: ${cssVar.colorTextPlaceholder};\n }\n `,\n valueText: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n}));\n\nexport const triggerVariants = cva(styles.trigger, {\n defaultVariants: {\n shadow: false,\n size: 'middle',\n variant: 'outlined',\n },\n variants: {\n shadow: {\n false: null,\n true: styles.shadow,\n },\n size: {\n large: styles.triggerLarge,\n middle: styles.triggerMiddle,\n small: styles.triggerSmall,\n },\n variant: {\n borderless: styles.borderless,\n filled: styles.filled,\n outlined: styles.outlined,\n },\n },\n});\n"],"mappings":";;;;;AAMA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,OAAO,GAAG;;;;;;;;;;CAUV,YAAY,GACVA,cAAkB,mBAClB,GAAG;+BACwB,OAAO,kBAAkB;sDACF,OAAO,kBAAkB;sDACzB,OAAO,kBAAkB;MAE5E;CACD,OAAO,GAAG;;;;aAIC,OAAO,kBAAkB;;;;gCAIN,OAAO,cAAc;;;eAGtC,OAAO,mBAAmB;;;CAGvC,OAAO,GAAG;CACV,QAAQ,GACNA,cAAkB,eAClB,GAAG;+BACwB,OAAO,mBAAmB;sDACH,OAAO,kBAAkB;sDACzB,OAAO,kBAAkB;MAE5E;CACD,OAAO,GAAG;CACV,YAAY,GAAG;CACf,MAAM,GAAG;;;kCAGuB,OAAO,cAAc;;;;;;CAMrD,MAAM,GAAG;CACT,kBAAkB,GAAG;;;;;CAKrB,eAAe,GAAG;;;;;;;;aAQP,OAAO,aAAa;;CAE/B,UAAU,GAAG;CACb,MAAM,GAAG;;;;;;;;CAQT,UAAU,GACRA,cAAkB,iBAClB,GAAG;+BACwB,OAAO,kBAAkB;sDACF,OAAO,iBAAiB;sDACxB,OAAO,iBAAiB;MAE3E;CACD,OAAO,GAAG;;;;;;;;;;;;;;sBAcU,OAAO,cAAc;wBACnB,OAAO,cAAc;;;;;;;;CAQ3C,YAAY,GAAG;;;;CAIf,QAAQ,GAAG;;;aAGA,OAAO,mBAAmB;;CAErC,aAAa,GAAG;;;;;;;;;aASL,OAAO,mBAAmB;;kBAErB,OAAO,gBAAgB;;CAEvC,QAAQ,GAAG;;;;;;;;;;kCAUqB,OAAO,mBAAmB;;CAE1D,aAAa,GAAG;;;;;;;;;;aAUL,OAAO,UAAU;;;;;;eAMf,OAAO,qBAAqB;;;CAGzC,QAAQA,cAAkB;CAC1B,QAAQ,GAAG;;;;aAIA,OAAO,mBAAmB;;CAErC,KAAK,GAAG;;;;;;;qBAOW,OAAO,eAAe;;;;aAI9B,OAAO,UAAU;;kBAEZ,OAAO,kBAAkB;;CAEzC,MAAM,GAAG;;;;;;CAMT,SAAS,GAAG;;;;;;;;;;;qBAWO,OAAO,aAAa;;;aAG5B,OAAO,UAAU;;;;;4BAKF,OAAO,cAAc;;;;;;+CAMF,OAAO,kBAAkB;;;;2BAI7C,OAAO,mBAAmB;;;;;;;;;;;;;;;eAetC,OAAO,kBAAkB;;;;;;;;;;eAUzB,OAAO,mBAAmB;;;;;;;;;;;;;CAavC,cAAc,GAAG;kBACD,cAAc,MAAM;;;;;;;CAOpC,eAAe,GAAG;kBACF,cAAc,OAAO;;;;;;;CAOrC,cAAc,GAAG;kBACD,cAAc,MAAM;;;;;;;CAOpC,OAAO,GAAG;;;;;;;;;;;;eAYG,OAAO,qBAAqB;;;CAGzC,WAAW,GAAG;;;;;CAKf,EAAE;AAEH,MAAa,kBAAkB,IAAI,OAAO,SAAS;CACjD,iBAAiB;EACf,QAAQ;EACR,MAAM;EACN,SAAS;EACV;CACD,UAAU;EACR,QAAQ;GACN,OAAO;GACP,MAAM,OAAO;GACd;EACD,MAAM;GACJ,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,OAAO,OAAO;GACf;EACD,SAAS;GACP,YAAY,OAAO;GACnB,QAAQ,OAAO;GACf,UAAU,OAAO;GAClB;EACF;CACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { styles } from "./style.mjs";
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cx } from "antd-style";
|
|
6
|
+
import { Slider } from "@base-ui/react/slider";
|
|
7
|
+
//#region src/base-ui/Slider/Slider.tsx
|
|
8
|
+
const Slider$1 = memo(({ className, classNames, styles: customStyles, style, onChange, onChangeComplete, ...rest }) => /* @__PURE__ */ jsx(Slider.Root, {
|
|
9
|
+
className: cx(styles.root, className),
|
|
10
|
+
style,
|
|
11
|
+
onValueChange: (value) => onChange?.(value),
|
|
12
|
+
onValueCommitted: (value) => onChangeComplete?.(value),
|
|
13
|
+
...rest,
|
|
14
|
+
children: /* @__PURE__ */ jsx(Slider.Control, {
|
|
15
|
+
className: cx(styles.control, classNames?.control),
|
|
16
|
+
style: customStyles?.control,
|
|
17
|
+
children: /* @__PURE__ */ jsxs(Slider.Track, {
|
|
18
|
+
className: cx(styles.track, classNames?.track),
|
|
19
|
+
style: customStyles?.track,
|
|
20
|
+
children: [/* @__PURE__ */ jsx(Slider.Indicator, {
|
|
21
|
+
className: cx(styles.indicator, classNames?.indicator),
|
|
22
|
+
style: customStyles?.indicator
|
|
23
|
+
}), /* @__PURE__ */ jsx(Slider.Thumb, {
|
|
24
|
+
className: cx(styles.thumb, classNames?.thumb),
|
|
25
|
+
style: customStyles?.thumb
|
|
26
|
+
})]
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
}));
|
|
30
|
+
Slider$1.displayName = "Slider";
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Slider$1 as default };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=Slider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.mjs","names":["Slider","BaseSlider"],"sources":["../../../src/base-ui/Slider/Slider.tsx"],"sourcesContent":["'use client';\n\nimport { Slider as BaseSlider } from '@base-ui/react/slider';\nimport { cx } from 'antd-style';\nimport { memo } from 'react';\n\nimport { styles } from './style';\nimport type { SliderProps } from './type';\n\nconst Slider = memo<SliderProps>(\n ({ className, classNames, styles: customStyles, style, onChange, onChangeComplete, ...rest }) => (\n <BaseSlider.Root\n className={cx(styles.root, className)}\n style={style}\n onValueChange={(value) => onChange?.(value as number)}\n onValueCommitted={(value) => onChangeComplete?.(value as number)}\n {...rest}\n >\n <BaseSlider.Control\n className={cx(styles.control, classNames?.control)}\n style={customStyles?.control}\n >\n <BaseSlider.Track\n className={cx(styles.track, classNames?.track)}\n style={customStyles?.track}\n >\n <BaseSlider.Indicator\n className={cx(styles.indicator, classNames?.indicator)}\n style={customStyles?.indicator}\n />\n <BaseSlider.Thumb\n className={cx(styles.thumb, classNames?.thumb)}\n style={customStyles?.thumb}\n />\n </BaseSlider.Track>\n </BaseSlider.Control>\n </BaseSlider.Root>\n ),\n);\n\nSlider.displayName = 'Slider';\n\nexport default Slider;\n"],"mappings":";;;;;;;AASA,MAAMA,WAAS,MACZ,EAAE,WAAW,YAAY,QAAQ,cAAc,OAAO,UAAU,kBAAkB,GAAG,WACpF,oBAACC,OAAW,MAAZ;CACE,WAAW,GAAG,OAAO,MAAM,UAAU;CAC9B;CACP,gBAAgB,UAAU,WAAW,MAAgB;CACrD,mBAAmB,UAAU,mBAAmB,MAAgB;CAChE,GAAI;WAEJ,oBAACA,OAAW,SAAZ;EACE,WAAW,GAAG,OAAO,SAAS,YAAY,QAAQ;EAClD,OAAO,cAAc;YAErB,qBAACA,OAAW,OAAZ;GACE,WAAW,GAAG,OAAO,OAAO,YAAY,MAAM;GAC9C,OAAO,cAAc;aAFvB,CAIE,oBAACA,OAAW,WAAZ;IACE,WAAW,GAAG,OAAO,WAAW,YAAY,UAAU;IACtD,OAAO,cAAc;IACrB,CAAA,EACF,oBAACA,OAAW,OAAZ;IACE,WAAW,GAAG,OAAO,OAAO,YAAY,MAAM;IAC9C,OAAO,cAAc;IACrB,CAAA,CACe;;EACA,CAAA;CACL,CAAA,CAErB;AAED,SAAO,cAAc"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SliderWithInputProps } from "./type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/Slider/SliderWithInput.d.ts
|
|
5
|
+
declare const SliderWithInput: _$react.NamedExoticComponent<SliderWithInputProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { SliderWithInput };
|
|
8
|
+
//# sourceMappingURL=SliderWithInput.d.mts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import FlexBasic_default from "../../Flex/FlexBasic.mjs";
|
|
3
|
+
import InputNumber from "../Input/InputNumber.mjs";
|
|
4
|
+
import Slider from "./Slider.mjs";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { isNull } from "es-toolkit/compat";
|
|
8
|
+
//#region src/base-ui/Slider/SliderWithInput.tsx
|
|
9
|
+
const SliderWithInput = memo(({ step, value, onChange, max, min, defaultValue, size, controls, gap = 16, style, className, classNames, styles: customStyles, disabled, unlimitedInput = false, changeOnWheel, shadow, variant, ...rest }) => {
|
|
10
|
+
const handleChange = (next) => {
|
|
11
|
+
if (isNull(next) || Number.isNaN(next)) return;
|
|
12
|
+
onChange?.(next);
|
|
13
|
+
};
|
|
14
|
+
const { slider: sliderClassName, input: inputClassName, ...sliderPartClassNames } = classNames || {};
|
|
15
|
+
const { slider: sliderStyle, input: inputStyle, ...sliderPartStyles } = customStyles || {};
|
|
16
|
+
return /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
17
|
+
horizontal: true,
|
|
18
|
+
align: "center",
|
|
19
|
+
className,
|
|
20
|
+
gap,
|
|
21
|
+
style,
|
|
22
|
+
children: [/* @__PURE__ */ jsx(Slider, {
|
|
23
|
+
className: sliderClassName,
|
|
24
|
+
classNames: sliderPartClassNames,
|
|
25
|
+
defaultValue,
|
|
26
|
+
disabled,
|
|
27
|
+
max,
|
|
28
|
+
min,
|
|
29
|
+
step,
|
|
30
|
+
style: {
|
|
31
|
+
flex: 1,
|
|
32
|
+
...sliderStyle
|
|
33
|
+
},
|
|
34
|
+
styles: sliderPartStyles,
|
|
35
|
+
value,
|
|
36
|
+
onChange: handleChange,
|
|
37
|
+
...rest
|
|
38
|
+
}), /* @__PURE__ */ jsx(InputNumber, {
|
|
39
|
+
changeOnWheel,
|
|
40
|
+
className: inputClassName,
|
|
41
|
+
controls: size !== "small" && controls !== false,
|
|
42
|
+
defaultValue,
|
|
43
|
+
disabled,
|
|
44
|
+
max: unlimitedInput ? void 0 : max,
|
|
45
|
+
min,
|
|
46
|
+
shadow,
|
|
47
|
+
size,
|
|
48
|
+
step: step === void 0 || Number.isNaN(step) ? void 0 : step,
|
|
49
|
+
value,
|
|
50
|
+
variant,
|
|
51
|
+
style: {
|
|
52
|
+
flex: "none",
|
|
53
|
+
width: size === "small" ? 48 : 88,
|
|
54
|
+
...inputStyle
|
|
55
|
+
},
|
|
56
|
+
onChange: handleChange
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
SliderWithInput.displayName = "SliderWithInput";
|
|
61
|
+
//#endregion
|
|
62
|
+
export { SliderWithInput as default };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=SliderWithInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliderWithInput.mjs","names":["Flexbox"],"sources":["../../../src/base-ui/Slider/SliderWithInput.tsx"],"sourcesContent":["'use client';\n\nimport { isNull } from 'es-toolkit/compat';\nimport { memo } from 'react';\n\nimport { InputNumber } from '@/base-ui/Input';\nimport { Flexbox } from '@/Flex';\n\nimport Slider from './Slider';\nimport type { SliderWithInputProps } from './type';\n\nconst SliderWithInput = memo<SliderWithInputProps>(\n ({\n step,\n value,\n onChange,\n max,\n min,\n defaultValue,\n size,\n controls,\n gap = 16,\n style,\n className,\n classNames,\n styles: customStyles,\n disabled,\n unlimitedInput = false,\n changeOnWheel,\n shadow,\n variant,\n ...rest\n }) => {\n const handleChange = (next: number | null) => {\n if (isNull(next) || Number.isNaN(next)) return;\n onChange?.(next);\n };\n\n const {\n slider: sliderClassName,\n input: inputClassName,\n ...sliderPartClassNames\n } = classNames || {};\n const { slider: sliderStyle, input: inputStyle, ...sliderPartStyles } = customStyles || {};\n\n return (\n <Flexbox horizontal align={'center'} className={className} gap={gap} style={style}>\n <Slider\n className={sliderClassName}\n classNames={sliderPartClassNames}\n defaultValue={defaultValue}\n disabled={disabled}\n max={max}\n min={min}\n step={step}\n style={{ flex: 1, ...sliderStyle }}\n styles={sliderPartStyles}\n value={value}\n onChange={handleChange}\n {...rest}\n />\n <InputNumber\n changeOnWheel={changeOnWheel}\n className={inputClassName}\n controls={size !== 'small' && controls !== false}\n defaultValue={defaultValue}\n disabled={disabled}\n max={unlimitedInput ? undefined : max}\n min={min}\n shadow={shadow}\n size={size}\n step={step === undefined || Number.isNaN(step) ? undefined : step}\n value={value}\n variant={variant}\n style={{\n flex: 'none',\n width: size === 'small' ? 48 : 88,\n ...inputStyle,\n }}\n onChange={handleChange}\n />\n </Flexbox>\n );\n },\n);\n\nSliderWithInput.displayName = 'SliderWithInput';\n\nexport default SliderWithInput;\n"],"mappings":";;;;;;;;AAWA,MAAM,kBAAkB,MACrB,EACC,MACA,OACA,UACA,KACA,KACA,cACA,MACA,UACA,MAAM,IACN,OACA,WACA,YACA,QAAQ,cACR,UACA,iBAAiB,OACjB,eACA,QACA,SACA,GAAG,WACC;CACJ,MAAM,gBAAgB,SAAwB;AAC5C,MAAI,OAAO,KAAK,IAAI,OAAO,MAAM,KAAK,CAAE;AACxC,aAAW,KAAK;;CAGlB,MAAM,EACJ,QAAQ,iBACR,OAAO,gBACP,GAAG,yBACD,cAAc,EAAE;CACpB,MAAM,EAAE,QAAQ,aAAa,OAAO,YAAY,GAAG,qBAAqB,gBAAgB,EAAE;AAE1F,QACE,qBAACA,mBAAD;EAAS,YAAA;EAAW,OAAO;EAAqB;EAAgB;EAAY;YAA5E,CACE,oBAAC,QAAD;GACE,WAAW;GACX,YAAY;GACE;GACJ;GACL;GACA;GACC;GACN,OAAO;IAAE,MAAM;IAAG,GAAG;IAAa;GAClC,QAAQ;GACD;GACP,UAAU;GACV,GAAI;GACJ,CAAA,EACF,oBAAC,aAAD;GACiB;GACf,WAAW;GACX,UAAU,SAAS,WAAW,aAAa;GAC7B;GACJ;GACV,KAAK,iBAAiB,KAAA,IAAY;GAC7B;GACG;GACF;GACN,MAAM,SAAS,KAAA,KAAa,OAAO,MAAM,KAAK,GAAG,KAAA,IAAY;GACtD;GACE;GACT,OAAO;IACL,MAAM;IACN,OAAO,SAAS,UAAU,KAAK;IAC/B,GAAG;IACJ;GACD,UAAU;GACV,CAAA,CACM;;EAGf;AAED,gBAAgB,cAAc"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createStaticStyles } from "antd-style";
|
|
2
|
+
//#region src/base-ui/Slider/style.ts
|
|
3
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
4
|
+
control: css`
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 20px;
|
|
9
|
+
`,
|
|
10
|
+
indicator: css`
|
|
11
|
+
border-radius: inherit;
|
|
12
|
+
background: ${cssVar.colorPrimary};
|
|
13
|
+
|
|
14
|
+
[data-disabled] & {
|
|
15
|
+
background: ${cssVar.colorTextQuaternary};
|
|
16
|
+
}
|
|
17
|
+
`,
|
|
18
|
+
root: css`
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
width: 100%;
|
|
22
|
+
|
|
23
|
+
&[data-disabled] {
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
thumb: css`
|
|
28
|
+
width: 14px;
|
|
29
|
+
height: 14px;
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
|
|
32
|
+
background: ${cssVar.colorBgContainer};
|
|
33
|
+
box-shadow:
|
|
34
|
+
0 0 0 1px ${cssVar.colorBorder},
|
|
35
|
+
0 1px 2px rgb(0 0 0 / 12%),
|
|
36
|
+
0 2px 6px rgb(0 30 80 / 12%);
|
|
37
|
+
|
|
38
|
+
transition: box-shadow 150ms ${cssVar.motionEaseOut};
|
|
39
|
+
|
|
40
|
+
&:hover:not([data-disabled] *) {
|
|
41
|
+
box-shadow:
|
|
42
|
+
0 0 0 1px ${cssVar.colorPrimary},
|
|
43
|
+
0 1px 2px rgb(0 0 0 / 12%),
|
|
44
|
+
0 3px 8px rgb(0 30 80 / 18%);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:focus-visible {
|
|
48
|
+
outline: 2px solid ${cssVar.colorPrimaryBorder};
|
|
49
|
+
outline-offset: 1px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[data-dragging] & {
|
|
53
|
+
box-shadow:
|
|
54
|
+
0 0 0 1px ${cssVar.colorPrimary},
|
|
55
|
+
0 1px 2px rgb(0 0 0 / 12%),
|
|
56
|
+
0 3px 8px rgb(0 30 80 / 18%);
|
|
57
|
+
}
|
|
58
|
+
`,
|
|
59
|
+
track: css`
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 4px;
|
|
62
|
+
border-radius: 100px;
|
|
63
|
+
background: ${cssVar.colorFillSecondary};
|
|
64
|
+
`
|
|
65
|
+
}));
|
|
66
|
+
//#endregion
|
|
67
|
+
export { styles };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Slider/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n control: css`\n display: flex;\n align-items: center;\n width: 100%;\n height: 20px;\n `,\n indicator: css`\n border-radius: inherit;\n background: ${cssVar.colorPrimary};\n\n [data-disabled] & {\n background: ${cssVar.colorTextQuaternary};\n }\n `,\n root: css`\n display: flex;\n align-items: center;\n width: 100%;\n\n &[data-disabled] {\n cursor: not-allowed;\n }\n `,\n thumb: css`\n width: 14px;\n height: 14px;\n border-radius: 50%;\n\n background: ${cssVar.colorBgContainer};\n box-shadow:\n 0 0 0 1px ${cssVar.colorBorder},\n 0 1px 2px rgb(0 0 0 / 12%),\n 0 2px 6px rgb(0 30 80 / 12%);\n\n transition: box-shadow 150ms ${cssVar.motionEaseOut};\n\n &:hover:not([data-disabled] *) {\n box-shadow:\n 0 0 0 1px ${cssVar.colorPrimary},\n 0 1px 2px rgb(0 0 0 / 12%),\n 0 3px 8px rgb(0 30 80 / 18%);\n }\n\n &:focus-visible {\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: 1px;\n }\n\n [data-dragging] & {\n box-shadow:\n 0 0 0 1px ${cssVar.colorPrimary},\n 0 1px 2px rgb(0 0 0 / 12%),\n 0 3px 8px rgb(0 30 80 / 18%);\n }\n `,\n track: css`\n width: 100%;\n height: 4px;\n border-radius: 100px;\n background: ${cssVar.colorFillSecondary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,SAAS,GAAG;;;;;;CAMZ,WAAW,GAAG;;kBAEE,OAAO,aAAa;;;oBAGlB,OAAO,oBAAoB;;;CAG7C,MAAM,GAAG;;;;;;;;;CAST,OAAO,GAAG;;;;;kBAKM,OAAO,iBAAiB;;kBAExB,OAAO,YAAY;;;;mCAIF,OAAO,cAAc;;;;oBAIpC,OAAO,aAAa;;;;;;2BAMb,OAAO,mBAAmB;;;;;;oBAMjC,OAAO,aAAa;;;;;CAKtC,OAAO,GAAG;;;;kBAIM,OAAO,mBAAmB;;CAE3C,EAAE"}
|