solid-uix 0.4.0 → 0.5.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/README.md +16 -2
- package/dist/main.css +269 -1
- package/dist/main.d.ts +77 -9
- package/dist/main.js +362 -565
- package/dist/main.jsx +386 -0
- package/package.json +11 -9
- package/dist/button/button.d.ts +0 -2
- package/dist/button/button.types.d.ts +0 -4
- package/dist/checkbox/checkbox.d.ts +0 -2
- package/dist/checkbox/checkbox.stories.d.ts +0 -29
- package/dist/checkbox/checkbox.types.d.ts +0 -5
- package/dist/dialog/dialog.d.ts +0 -11
- package/dist/dialog/dialog.types.d.ts +0 -17
- package/dist/dialog/provider/context.d.ts +0 -3
- package/dist/dialog/provider/context.types.d.ts +0 -14
- package/dist/dialog/provider/provider.d.ts +0 -2
- package/dist/dialog/provider/provider.types.d.ts +0 -7
- package/dist/field/field.context.d.ts +0 -3
- package/dist/field/field.d.ts +0 -6
- package/dist/field/field.types.d.ts +0 -19
- package/dist/list/list.d.ts +0 -5
- package/dist/list/list.types.d.ts +0 -3
- package/dist/main.umd.cjs +0 -1
- package/dist/select/select.d.ts +0 -5
- package/dist/select/select.types.d.ts +0 -5
- package/dist/text_input/text_input.d.ts +0 -2
- package/dist/text_input/text_input.types.d.ts +0 -4
- package/dist/utils/cls.d.ts +0 -3
- package/dist/utils/message.d.ts +0 -7
- package/dist/utils/noop.d.ts +0 -4
- package/dist/utils/string.d.ts +0 -1
package/dist/main.jsx
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
// src/utils/cls.ts
|
|
2
|
+
var cls = (...classes) => {
|
|
3
|
+
return classes.filter(Boolean).join(" ");
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// src/button/button.tsx
|
|
7
|
+
import { mergeProps, splitProps } from "solid-js";
|
|
8
|
+
|
|
9
|
+
// src/button/button.module.css
|
|
10
|
+
var button_default = {
|
|
11
|
+
button: "button_button",
|
|
12
|
+
solid: "button_solid",
|
|
13
|
+
outlined: "button_outlined",
|
|
14
|
+
link: "button_link"
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/button/button.tsx
|
|
18
|
+
var defaultProps = {
|
|
19
|
+
variant: "solid"
|
|
20
|
+
};
|
|
21
|
+
var Button = (props) => {
|
|
22
|
+
const merged = mergeProps(defaultProps, props);
|
|
23
|
+
const [local, rest] = splitProps(merged, ["class", "variant"]);
|
|
24
|
+
return <button
|
|
25
|
+
type="button"
|
|
26
|
+
{...rest}
|
|
27
|
+
class={cls(
|
|
28
|
+
button_default.button,
|
|
29
|
+
local.class,
|
|
30
|
+
local.variant === "solid" && button_default.solid,
|
|
31
|
+
local.variant === "outlined" && button_default.outlined
|
|
32
|
+
)}
|
|
33
|
+
>
|
|
34
|
+
{rest.children}
|
|
35
|
+
</button>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/link/link.module.css
|
|
39
|
+
var link_default = {
|
|
40
|
+
link: "link_link",
|
|
41
|
+
underline: "link_underline",
|
|
42
|
+
secondary: "link_secondary",
|
|
43
|
+
disabled: "link_disabled"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/link/link.tsx
|
|
47
|
+
import { splitProps as splitProps2 } from "solid-js";
|
|
48
|
+
var Link = (props) => {
|
|
49
|
+
const [local, rest] = splitProps2(props, ["class", "reset", "disabled", "color", "underline"]);
|
|
50
|
+
return <a
|
|
51
|
+
{...rest}
|
|
52
|
+
class={cls(
|
|
53
|
+
!local.reset && link_default.link,
|
|
54
|
+
local.class,
|
|
55
|
+
local.disabled && link_default.disabled,
|
|
56
|
+
local.color === "secondary" && link_default.secondary,
|
|
57
|
+
local.underline === "always" && link_default.underline
|
|
58
|
+
)}
|
|
59
|
+
aria-disabled={local.disabled}
|
|
60
|
+
>
|
|
61
|
+
{rest.children}
|
|
62
|
+
</a>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/checkbox/checkbox.tsx
|
|
66
|
+
import { createUniqueId as createUniqueId2, splitProps as splitProps3 } from "solid-js";
|
|
67
|
+
|
|
68
|
+
// src/checkbox/checkbox.module.css
|
|
69
|
+
var checkbox_default = {
|
|
70
|
+
checkbox: "checkbox_checkbox",
|
|
71
|
+
input: "checkbox_input",
|
|
72
|
+
indicator: "checkbox_indicator",
|
|
73
|
+
label: "checkbox_label",
|
|
74
|
+
disabled: "checkbox_disabled"
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/field/field.context.tsx
|
|
78
|
+
import { createContext, createMemo, createSignal, createUniqueId, useContext } from "solid-js";
|
|
79
|
+
|
|
80
|
+
// src/utils/message.ts
|
|
81
|
+
var isError = (message) => {
|
|
82
|
+
return message.level === "error";
|
|
83
|
+
};
|
|
84
|
+
var getMessageIds = (messages) => {
|
|
85
|
+
if (!messages.length) {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
return messages.map((message) => message.id).join(" ");
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/utils/noop.ts
|
|
92
|
+
var noop = () => {
|
|
93
|
+
};
|
|
94
|
+
var noopAccessor = (value) => {
|
|
95
|
+
return () => value;
|
|
96
|
+
};
|
|
97
|
+
var noopSetter = () => {
|
|
98
|
+
return () => {
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/field/field.context.tsx
|
|
103
|
+
var defaultValue = {
|
|
104
|
+
fieldId: void 0,
|
|
105
|
+
error: noopAccessor(false),
|
|
106
|
+
ariaDescribedBy: noopAccessor(void 0),
|
|
107
|
+
ariaErrorMessage: noopAccessor(void 0),
|
|
108
|
+
setMessage: noop
|
|
109
|
+
};
|
|
110
|
+
var FieldContext = createContext(defaultValue, {});
|
|
111
|
+
var useFieldContext = () => {
|
|
112
|
+
return useContext(FieldContext);
|
|
113
|
+
};
|
|
114
|
+
var FieldProvider = (props) => {
|
|
115
|
+
const fieldId = createUniqueId();
|
|
116
|
+
const [messages, setMessages] = createSignal([]);
|
|
117
|
+
const error = createMemo(() => {
|
|
118
|
+
return props.error;
|
|
119
|
+
});
|
|
120
|
+
const ariaDescribedBy = createMemo(() => {
|
|
121
|
+
return getMessageIds(messages());
|
|
122
|
+
});
|
|
123
|
+
const ariaErrorMessage = createMemo(() => {
|
|
124
|
+
return getMessageIds(messages().filter(isError));
|
|
125
|
+
});
|
|
126
|
+
const setMessage = (message) => {
|
|
127
|
+
setMessages((prev) => [...prev, message]);
|
|
128
|
+
};
|
|
129
|
+
return <FieldContext.Provider
|
|
130
|
+
value={{
|
|
131
|
+
fieldId,
|
|
132
|
+
error,
|
|
133
|
+
setMessage,
|
|
134
|
+
ariaDescribedBy,
|
|
135
|
+
ariaErrorMessage
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
{props.children}
|
|
139
|
+
</FieldContext.Provider>;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// src/checkbox/checkbox.tsx
|
|
143
|
+
var Checkbox = (props) => {
|
|
144
|
+
const [local, rest] = splitProps3(props, ["label", "error", "class"]);
|
|
145
|
+
const context = useFieldContext();
|
|
146
|
+
const id = createUniqueId2();
|
|
147
|
+
return <span class={cls(checkbox_default.checkbox, local.class, rest.disabled && checkbox_default.disabled)}>
|
|
148
|
+
<input
|
|
149
|
+
{...rest}
|
|
150
|
+
id={id}
|
|
151
|
+
type="checkbox"
|
|
152
|
+
class={checkbox_default.input}
|
|
153
|
+
aria-describedby={context.ariaDescribedBy()}
|
|
154
|
+
aria-invalid={context.error() || !!local.error}
|
|
155
|
+
aria-errormessage={context.ariaErrorMessage()}
|
|
156
|
+
/>
|
|
157
|
+
<span class={checkbox_default.indicator} />
|
|
158
|
+
|
|
159
|
+
{local.label && <label for={id} class={checkbox_default.label}>
|
|
160
|
+
{local.label}
|
|
161
|
+
</label>}
|
|
162
|
+
</span>;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// src/text_input/text_input.tsx
|
|
166
|
+
import { splitProps as splitProps4 } from "solid-js";
|
|
167
|
+
|
|
168
|
+
// src/text_input/text_input.module.css
|
|
169
|
+
var text_input_default = {
|
|
170
|
+
input: "text_input_input"
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/text_input/text_input.tsx
|
|
174
|
+
var TextInput = (props) => {
|
|
175
|
+
const [local, rest] = splitProps4(props, ["error", "class"]);
|
|
176
|
+
const context = useFieldContext();
|
|
177
|
+
return <input
|
|
178
|
+
{...rest}
|
|
179
|
+
class={cls(text_input_default.input, local.class)}
|
|
180
|
+
id={context.fieldId}
|
|
181
|
+
aria-describedby={context.ariaDescribedBy()}
|
|
182
|
+
aria-invalid={context.error() || !!local.error}
|
|
183
|
+
aria-errormessage={context.ariaErrorMessage()}
|
|
184
|
+
/>;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// src/dialog/dialog.tsx
|
|
188
|
+
import { children, createEffect as createEffect2, createUniqueId as createUniqueId3 } from "solid-js";
|
|
189
|
+
|
|
190
|
+
// src/dialog/provider/provider.tsx
|
|
191
|
+
import { createEffect, createMemo as createMemo2, createSignal as createSignal2 } from "solid-js";
|
|
192
|
+
|
|
193
|
+
// src/dialog/provider/context.ts
|
|
194
|
+
import { createContext as createContext2, useContext as useContext2 } from "solid-js";
|
|
195
|
+
var defaultValue2 = {
|
|
196
|
+
setDialogRef() {
|
|
197
|
+
},
|
|
198
|
+
ariaLabelledBy: noopAccessor(void 0),
|
|
199
|
+
ariaDescribedBy: noopAccessor(void 0),
|
|
200
|
+
setTitleId: noopSetter(),
|
|
201
|
+
setDescriptionId: noopSetter(),
|
|
202
|
+
openDialog: noop,
|
|
203
|
+
closeDialog: noop,
|
|
204
|
+
onOpenChange: noop,
|
|
205
|
+
onBeforeClose: noop
|
|
206
|
+
};
|
|
207
|
+
var DialogContext = createContext2(defaultValue2);
|
|
208
|
+
var useDialogContext = () => {
|
|
209
|
+
return useContext2(DialogContext);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/dialog/provider/provider.tsx
|
|
213
|
+
var DialogProvider = (props) => {
|
|
214
|
+
let dialogRef;
|
|
215
|
+
const setDialogRef = (element) => {
|
|
216
|
+
dialogRef = element;
|
|
217
|
+
};
|
|
218
|
+
const [ariaLabelledBy, setTitleId] = createSignal2();
|
|
219
|
+
const [ariaDescribedBy, setDescriptionId] = createSignal2();
|
|
220
|
+
const isOpen = createMemo2(() => {
|
|
221
|
+
return props.isOpen;
|
|
222
|
+
});
|
|
223
|
+
const openDialog = () => {
|
|
224
|
+
dialogRef?.showModal();
|
|
225
|
+
props.onOpenChange?.(true);
|
|
226
|
+
};
|
|
227
|
+
const closeDialog = () => {
|
|
228
|
+
dialogRef?.requestClose();
|
|
229
|
+
};
|
|
230
|
+
createEffect(() => {
|
|
231
|
+
if (isOpen()) {
|
|
232
|
+
openDialog();
|
|
233
|
+
} else {
|
|
234
|
+
closeDialog();
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
return <DialogContext.Provider
|
|
238
|
+
value={{
|
|
239
|
+
ariaLabelledBy,
|
|
240
|
+
ariaDescribedBy,
|
|
241
|
+
setDialogRef,
|
|
242
|
+
setTitleId,
|
|
243
|
+
setDescriptionId,
|
|
244
|
+
openDialog,
|
|
245
|
+
closeDialog,
|
|
246
|
+
onOpenChange: props.onOpenChange,
|
|
247
|
+
onBeforeClose: props.onBeforeClose
|
|
248
|
+
}}
|
|
249
|
+
>
|
|
250
|
+
{props.children}
|
|
251
|
+
</DialogContext.Provider>;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// src/dialog/dialog.module.css
|
|
255
|
+
var dialog_default = {
|
|
256
|
+
dialog: "dialog_dialog",
|
|
257
|
+
title: "dialog_title",
|
|
258
|
+
description: "dialog_description",
|
|
259
|
+
actions: "dialog_actions"
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// src/dialog/dialog.tsx
|
|
263
|
+
var Dialog = (props) => {
|
|
264
|
+
return <DialogProvider {...props}>{props.children}</DialogProvider>;
|
|
265
|
+
};
|
|
266
|
+
var Trigger = (props) => {
|
|
267
|
+
const context = useDialogContext();
|
|
268
|
+
const child = children(() => props.children);
|
|
269
|
+
createEffect2(() => {
|
|
270
|
+
const element = child();
|
|
271
|
+
if (element instanceof HTMLElement) {
|
|
272
|
+
element.onclick = context.openDialog;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
return <>{child()}</>;
|
|
276
|
+
};
|
|
277
|
+
var Content = (props) => {
|
|
278
|
+
const context = useDialogContext();
|
|
279
|
+
return <dialog
|
|
280
|
+
{...props}
|
|
281
|
+
ref={(element) => {
|
|
282
|
+
props.ref = element;
|
|
283
|
+
context.setDialogRef(element);
|
|
284
|
+
}}
|
|
285
|
+
class={cls(dialog_default.dialog, props.class)}
|
|
286
|
+
aria-labelledby={context.ariaLabelledBy()}
|
|
287
|
+
aria-describedby={context.ariaDescribedBy()}
|
|
288
|
+
onClose={() => context.onOpenChange?.(false)}
|
|
289
|
+
onCancel={context.onBeforeClose}
|
|
290
|
+
>
|
|
291
|
+
{props.children}
|
|
292
|
+
</dialog>;
|
|
293
|
+
};
|
|
294
|
+
var Title = (props) => {
|
|
295
|
+
const context = useDialogContext();
|
|
296
|
+
const titleId = createUniqueId3();
|
|
297
|
+
context.setTitleId(titleId);
|
|
298
|
+
return <h2 {...props} id={titleId} class={cls(dialog_default.title, props.class)}>
|
|
299
|
+
{props.children}
|
|
300
|
+
</h2>;
|
|
301
|
+
};
|
|
302
|
+
var Description = (props) => {
|
|
303
|
+
const context = useDialogContext();
|
|
304
|
+
const descriptionId = createUniqueId3();
|
|
305
|
+
context.setDescriptionId(descriptionId);
|
|
306
|
+
return <p {...props} id={descriptionId} class={cls(dialog_default.description, props.class)}>
|
|
307
|
+
{props.children}
|
|
308
|
+
</p>;
|
|
309
|
+
};
|
|
310
|
+
var Close = (props) => {
|
|
311
|
+
const context = useDialogContext();
|
|
312
|
+
const child = children(() => props.children);
|
|
313
|
+
createEffect2(() => {
|
|
314
|
+
const element = child();
|
|
315
|
+
if (element instanceof HTMLElement) {
|
|
316
|
+
element.onclick = context.closeDialog;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
return <>{child()}</>;
|
|
320
|
+
};
|
|
321
|
+
var Actions = (props) => {
|
|
322
|
+
return <div {...props} class={cls(dialog_default.actions, props.class)}>
|
|
323
|
+
{props.children}
|
|
324
|
+
</div>;
|
|
325
|
+
};
|
|
326
|
+
Dialog.Trigger = Trigger;
|
|
327
|
+
Dialog.Content = Content;
|
|
328
|
+
Dialog.Title = Title;
|
|
329
|
+
Dialog.Description = Description;
|
|
330
|
+
Dialog.Close = Close;
|
|
331
|
+
Dialog.Actions = Actions;
|
|
332
|
+
|
|
333
|
+
// src/field/field.tsx
|
|
334
|
+
import { createUniqueId as createUniqueId4, Show, splitProps as splitProps5 } from "solid-js";
|
|
335
|
+
|
|
336
|
+
// src/field/field.module.css
|
|
337
|
+
var field_default = {
|
|
338
|
+
field: "field_field",
|
|
339
|
+
label: "field_label",
|
|
340
|
+
message: "field_message",
|
|
341
|
+
error: "field_error"
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
// src/field/field.tsx
|
|
345
|
+
var Field = (props) => {
|
|
346
|
+
const [local, rest] = splitProps5(props, ["class", "error"]);
|
|
347
|
+
return <FieldProvider error={!!local.error}>
|
|
348
|
+
<div {...rest} class={cls(field_default.field, local.class)}>
|
|
349
|
+
{props.children}
|
|
350
|
+
</div>
|
|
351
|
+
</FieldProvider>;
|
|
352
|
+
};
|
|
353
|
+
var FieldLabel = (props) => {
|
|
354
|
+
const [local, rest] = splitProps5(props, ["class"]);
|
|
355
|
+
const context = useFieldContext();
|
|
356
|
+
return <label {...rest} for={context.fieldId} class={cls(field_default.label, local.class)}>
|
|
357
|
+
{rest.children}
|
|
358
|
+
</label>;
|
|
359
|
+
};
|
|
360
|
+
var FieldMessage = (props) => {
|
|
361
|
+
const [local, rest] = splitProps5(props, ["class", "level"]);
|
|
362
|
+
const context = useFieldContext();
|
|
363
|
+
const messageId = createUniqueId4();
|
|
364
|
+
context.setMessage({ level: local.level || "info", id: messageId });
|
|
365
|
+
return <Show when={rest.children}>
|
|
366
|
+
<p
|
|
367
|
+
{...rest}
|
|
368
|
+
id={messageId}
|
|
369
|
+
class={cls(field_default.message, local.class, local.level === "error" && field_default.error)}
|
|
370
|
+
>
|
|
371
|
+
{rest.children}
|
|
372
|
+
</p>
|
|
373
|
+
</Show>;
|
|
374
|
+
};
|
|
375
|
+
Field.Label = FieldLabel;
|
|
376
|
+
Field.Message = FieldMessage;
|
|
377
|
+
export {
|
|
378
|
+
Button,
|
|
379
|
+
Checkbox,
|
|
380
|
+
Dialog,
|
|
381
|
+
Field,
|
|
382
|
+
Link,
|
|
383
|
+
TextInput,
|
|
384
|
+
button_default as buttonSx,
|
|
385
|
+
cls
|
|
386
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-uix",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "dist/main.js",
|
|
6
6
|
"module": "./dist/main.js",
|
|
7
7
|
"types": "./dist/main.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"types": "./dist/main.d.ts",
|
|
11
|
+
"solid": "./dist/main.jsx",
|
|
12
|
+
"default": "./dist/main.js"
|
|
12
13
|
},
|
|
13
|
-
"./
|
|
14
|
-
"import": "./dist/main.css"
|
|
15
|
-
"require": "./dist/main.css"
|
|
14
|
+
"./css": {
|
|
15
|
+
"import": "./dist/main.css"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
@@ -28,15 +28,17 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@solidjs/testing-library": "^0.8.10",
|
|
30
30
|
"@testing-library/user-event": "^14.6.1",
|
|
31
|
+
"@types/node": "^24.9.2",
|
|
32
|
+
"esbuild-plugin-solid": "^0.6.0",
|
|
31
33
|
"happy-dom": "^17.4.4",
|
|
34
|
+
"tsup": "^8.3.5",
|
|
32
35
|
"typescript": "~5.7.2",
|
|
33
36
|
"vite": "^6.0.11",
|
|
34
|
-
"vite-plugin-dts": "^4.5.0",
|
|
35
37
|
"vite-plugin-solid": "^2.11.6",
|
|
36
38
|
"vitest": "^3.1.1"
|
|
37
39
|
},
|
|
38
40
|
"scripts": {
|
|
39
|
-
"build": "tsc &&
|
|
41
|
+
"build": "tsc --project tsconfig.build.json && tsup",
|
|
40
42
|
"test": "vitest run",
|
|
41
43
|
"start": "cd src-storybook && npm start"
|
|
42
44
|
},
|
package/dist/button/button.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
title: string;
|
|
3
|
-
component: (props: import('./checkbox.types').CheckboxProps) => import("solid-js").JSX.Element;
|
|
4
|
-
parameters: {
|
|
5
|
-
layout: string;
|
|
6
|
-
};
|
|
7
|
-
tags: string[];
|
|
8
|
-
argTypes: {};
|
|
9
|
-
args: {
|
|
10
|
-
label: string;
|
|
11
|
-
disabled: boolean;
|
|
12
|
-
error: boolean;
|
|
13
|
-
onChange: import('storybook/test').Mock<(...args: any[]) => any>;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
|
17
|
-
export declare const Default: {
|
|
18
|
-
args: {};
|
|
19
|
-
};
|
|
20
|
-
export declare const Disabled: {
|
|
21
|
-
args: {
|
|
22
|
-
disabled: boolean;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export declare const Error: {
|
|
26
|
-
args: {
|
|
27
|
-
error: boolean;
|
|
28
|
-
};
|
|
29
|
-
};
|
package/dist/dialog/dialog.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ParentProps } from 'solid-js';
|
|
2
|
-
import { DialogActionsProps, DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogProps, DialogTitleProps } from './dialog.types';
|
|
3
|
-
export declare const Dialog: {
|
|
4
|
-
(props: DialogProps): import("solid-js").JSX.Element;
|
|
5
|
-
Trigger: (props: ParentProps) => import("solid-js").JSX.Element;
|
|
6
|
-
Content: (props: DialogContentProps) => import("solid-js").JSX.Element;
|
|
7
|
-
Title: (props: DialogTitleProps) => import("solid-js").JSX.Element;
|
|
8
|
-
Description: (props: DialogDescriptionProps) => import("solid-js").JSX.Element;
|
|
9
|
-
Close: (props: DialogCloseProps) => import("solid-js").JSX.Element;
|
|
10
|
-
Actions: (props: DialogActionsProps) => import("solid-js").JSX.Element;
|
|
11
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { JSX, ParentProps } from 'solid-js';
|
|
2
|
-
export type OnOpenChange = (isOpen: boolean) => void;
|
|
3
|
-
/**
|
|
4
|
-
* Use event.preventDefault() to prevent dialog close
|
|
5
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/cancel_event
|
|
6
|
-
*/
|
|
7
|
-
export type OnBeforeClose = (event: Event) => void;
|
|
8
|
-
export type DialogProps = ParentProps & {
|
|
9
|
-
isOpen?: boolean;
|
|
10
|
-
onOpenChange?: OnOpenChange;
|
|
11
|
-
onBeforeClose?: OnBeforeClose;
|
|
12
|
-
};
|
|
13
|
-
export type DialogContentProps = JSX.DialogHtmlAttributes<HTMLDialogElement>;
|
|
14
|
-
export type DialogTitleProps = JSX.HTMLAttributes<HTMLHeadingElement>;
|
|
15
|
-
export type DialogDescriptionProps = JSX.HTMLAttributes<HTMLParagraphElement>;
|
|
16
|
-
export type DialogCloseProps = ParentProps;
|
|
17
|
-
export type DialogActionsProps = JSX.HTMLAttributes<HTMLDivElement>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Accessor, Setter } from 'solid-js';
|
|
2
|
-
import { OnBeforeClose, OnOpenChange } from '../dialog.types';
|
|
3
|
-
export type SetDialogRef = (element: HTMLDialogElement) => void;
|
|
4
|
-
export type DialogContextValue = {
|
|
5
|
-
setDialogRef: SetDialogRef;
|
|
6
|
-
ariaLabelledBy: Accessor<string | undefined>;
|
|
7
|
-
ariaDescribedBy: Accessor<string | undefined>;
|
|
8
|
-
setTitleId: Setter<string | undefined>;
|
|
9
|
-
setDescriptionId: Setter<string | undefined>;
|
|
10
|
-
openDialog(): void;
|
|
11
|
-
closeDialog(): void;
|
|
12
|
-
onOpenChange?: OnOpenChange;
|
|
13
|
-
onBeforeClose?: OnBeforeClose;
|
|
14
|
-
};
|
package/dist/field/field.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FieldLabelProps, FieldMessageProps, FieldProps } from './field.types';
|
|
2
|
-
export declare const Field: {
|
|
3
|
-
(props: FieldProps): import("solid-js").JSX.Element;
|
|
4
|
-
Label: (props: FieldLabelProps) => import("solid-js").JSX.Element;
|
|
5
|
-
Message: (props: FieldMessageProps) => import("solid-js").JSX.Element;
|
|
6
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Accessor, JSX, ParentProps } from 'solid-js';
|
|
2
|
-
import { Message, MessageLevel } from '../utils/message';
|
|
3
|
-
export type FieldProps = JSX.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
-
error?: string | boolean;
|
|
5
|
-
};
|
|
6
|
-
export type FieldProviderProps = ParentProps & {
|
|
7
|
-
error: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type FieldLabelProps = JSX.LabelHTMLAttributes<HTMLLabelElement>;
|
|
10
|
-
export type FieldMessageProps = JSX.HTMLAttributes<HTMLParagraphElement> & {
|
|
11
|
-
level?: MessageLevel;
|
|
12
|
-
};
|
|
13
|
-
export type FieldContextValue = {
|
|
14
|
-
error: Accessor<boolean>;
|
|
15
|
-
fieldId: string;
|
|
16
|
-
ariaDescribedBy: Accessor<string | undefined>;
|
|
17
|
-
ariaErrorMessage: Accessor<string | undefined>;
|
|
18
|
-
setMessage(message: Message): void;
|
|
19
|
-
};
|
package/dist/list/list.d.ts
DELETED
package/dist/main.umd.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(h,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("solid-js")):typeof define=="function"&&define.amd?define(["exports","solid-js"],c):(h=typeof globalThis<"u"?globalThis:h||self,c(h["solid-uix"]={},h.solid))})(this,function(h,c){"use strict";const K=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],X=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline",...K]),Y=new Set(["innerHTML","textContent","innerText","children"]),Q=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),W=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function Z(n,e){const t=W[n];return typeof t=="object"?t[e]?t.$:void 0:t}const z=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),j=n=>c.createMemo(()=>n());function J(n,e,t){let i=t.length,r=e.length,o=i,a=0,s=0,l=e[r-1].nextSibling,f=null;for(;a<r||s<o;){if(e[a]===t[s]){a++,s++;continue}for(;e[r-1]===t[o-1];)r--,o--;if(r===a){const d=o<i?s?t[s-1].nextSibling:t[o-s]:l;for(;s<o;)n.insertBefore(t[s++],d)}else if(o===s)for(;a<r;)(!f||!f.has(e[a]))&&e[a].remove(),a++;else if(e[a]===t[o-1]&&t[s]===e[r-1]){const d=e[--r].nextSibling;n.insertBefore(t[s++],e[a++].nextSibling),n.insertBefore(t[--o],d),e[r]=t[o]}else{if(!f){f=new Map;let g=s;for(;g<o;)f.set(t[g],g++)}const d=f.get(e[a]);if(d!=null)if(s<d&&d<o){let g=a,u=1,C;for(;++g<r&&g<o&&!((C=f.get(e[g]))==null||C!==d+u);)u++;if(u>d-s){const p=e[a];for(;s<d;)n.insertBefore(t[s++],p)}else n.replaceChild(t[s++],e[a++])}else a++;else e[a++].remove()}}}const k="_$DX_DELEGATE";function y(n,e,t,i){let r;const o=()=>{const s=document.createElement("template");return s.innerHTML=n,s.content.firstChild},a=()=>(r||(r=o())).cloneNode(!0);return a.cloneNode=a,a}function ee(n,e=window.document){const t=e[k]||(e[k]=new Set);for(let i=0,r=n.length;i<r;i++){const o=n[i];t.has(o)||(t.add(o),e.addEventListener(o,le))}}function M(n,e,t){E(n)||(t==null?n.removeAttribute(e):n.setAttribute(e,t))}function te(n,e,t){E(n)||(t?n.setAttribute(e,""):n.removeAttribute(e))}function w(n,e){E(n)||(e==null?n.removeAttribute("class"):n.className=e)}function ne(n,e,t,i){if(i)Array.isArray(t)?(n[`$$${e}`]=t[0],n[`$$${e}Data`]=t[1]):n[`$$${e}`]=t;else if(Array.isArray(t)){const r=t[0];n.addEventListener(e,t[0]=o=>r.call(n,t[1],o))}else n.addEventListener(e,t,typeof t!="function"&&t)}function ie(n,e,t={}){const i=Object.keys(e||{}),r=Object.keys(t);let o,a;for(o=0,a=r.length;o<a;o++){const s=r[o];!s||s==="undefined"||e[s]||(R(n,s,!1),delete t[s])}for(o=0,a=i.length;o<a;o++){const s=i[o],l=!!e[s];!s||s==="undefined"||t[s]===l||!l||(R(n,s,!0),t[s]=l)}return t}function re(n,e,t){if(!e)return t?M(n,"style"):e;const i=n.style;if(typeof e=="string")return i.cssText=e;typeof t=="string"&&(i.cssText=t=void 0),t||(t={}),e||(e={});let r,o;for(o in t)e[o]==null&&i.removeProperty(o),delete t[o];for(o in e)r=e[o],r!==t[o]&&(i.setProperty(o,r),t[o]=r);return t}function m(n,e={},t,i){const r={};return i||c.createRenderEffect(()=>r.children=T(n,e.children,r.children)),c.createRenderEffect(()=>typeof e.ref=="function"&&F(e.ref,n)),c.createRenderEffect(()=>se(n,e,t,!0,r,!0)),r}function F(n,e,t){return c.untrack(()=>n(e,t))}function b(n,e,t,i){if(t!==void 0&&!i&&(i=[]),typeof e!="function")return T(n,e,i,t);c.createRenderEffect(r=>T(n,e(),r,t),i)}function se(n,e,t,i,r={},o=!1){e||(e={});for(const a in r)if(!(a in e)){if(a==="children")continue;r[a]=U(n,a,null,r[a],t,o,e)}for(const a in e){if(a==="children")continue;const s=e[a];r[a]=U(n,a,s,r[a],t,o,e)}}function E(n){return!!c.sharedConfig.context&&!c.sharedConfig.done&&(!n||n.isConnected)}function oe(n){return n.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function R(n,e,t){const i=e.trim().split(/\s+/);for(let r=0,o=i.length;r<o;r++)n.classList.toggle(i[r],t)}function U(n,e,t,i,r,o,a){let s,l,f,d,g;if(e==="style")return re(n,t,i);if(e==="classList")return ie(n,t,i);if(t===i)return i;if(e==="ref")o||t(n);else if(e.slice(0,3)==="on:"){const u=e.slice(3);i&&n.removeEventListener(u,i,typeof i!="function"&&i),t&&n.addEventListener(u,t,typeof t!="function"&&t)}else if(e.slice(0,10)==="oncapture:"){const u=e.slice(10);i&&n.removeEventListener(u,i,!0),t&&n.addEventListener(u,t,!0)}else if(e.slice(0,2)==="on"){const u=e.slice(2).toLowerCase(),C=z.has(u);if(!C&&i){const p=Array.isArray(i)?i[0]:i;n.removeEventListener(u,p)}(C||t)&&(ne(n,u,t,C),C&&ee([u]))}else if(e.slice(0,5)==="attr:")M(n,e.slice(5),t);else if(e.slice(0,5)==="bool:")te(n,e.slice(5),t);else if((g=e.slice(0,5)==="prop:")||(f=Y.has(e))||(d=Z(e,n.tagName))||(l=X.has(e))||(s=n.nodeName.includes("-")||"is"in a)){if(g)e=e.slice(5),l=!0;else if(E(n))return t;e==="class"||e==="className"?w(n,t):s&&!l&&!f?n[oe(e)]=t:n[d||e]=t}else M(n,Q[e]||e,t);return t}function le(n){if(c.sharedConfig.registry&&c.sharedConfig.events&&c.sharedConfig.events.find(([l,f])=>f===n))return;let e=n.target;const t=`$$${n.type}`,i=n.target,r=n.currentTarget,o=l=>Object.defineProperty(n,"target",{configurable:!0,value:l}),a=()=>{const l=e[t];if(l&&!e.disabled){const f=e[`${t}Data`];if(f!==void 0?l.call(e,f,n):l.call(e,n),n.cancelBubble)return}return e.host&&typeof e.host!="string"&&!e.host._$host&&e.contains(n.target)&&o(e.host),!0},s=()=>{for(;a()&&(e=e._$host||e.parentNode||e.host););};if(Object.defineProperty(n,"currentTarget",{configurable:!0,get(){return e||document}}),c.sharedConfig.registry&&!c.sharedConfig.done&&(c.sharedConfig.done=_$HY.done=!0),n.composedPath){const l=n.composedPath();o(l[0]);for(let f=0;f<l.length-2&&(e=l[f],!!a());f++){if(e._$host){e=e._$host,s();break}if(e.parentNode===r)break}}else s();o(i)}function T(n,e,t,i,r){const o=E(n);if(o){!t&&(t=[...n.childNodes]);let l=[];for(let f=0;f<t.length;f++){const d=t[f];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():l.push(d)}t=l}for(;typeof t=="function";)t=t();if(e===t)return t;const a=typeof e,s=i!==void 0;if(n=s&&t[0]&&t[0].parentNode||n,a==="string"||a==="number"){if(o||a==="number"&&(e=e.toString(),e===t))return t;if(s){let l=t[0];l&&l.nodeType===3?l.data!==e&&(l.data=e):l=document.createTextNode(e),t=x(n,t,i,l)}else t!==""&&typeof t=="string"?t=n.firstChild.data=e:t=n.textContent=e}else if(e==null||a==="boolean"){if(o)return t;t=x(n,t,i)}else{if(a==="function")return c.createRenderEffect(()=>{let l=e();for(;typeof l=="function";)l=l();t=T(n,l,t,i)}),()=>t;if(Array.isArray(e)){const l=[],f=t&&Array.isArray(t);if(B(l,e,t,r))return c.createRenderEffect(()=>t=T(n,l,t,i,!0)),()=>t;if(o){if(!l.length)return t;if(i===void 0)return t=[...n.childNodes];let d=l[0];if(d.parentNode!==n)return t;const g=[d];for(;(d=d.nextSibling)!==i;)g.push(d);return t=g}if(l.length===0){if(t=x(n,t,i),s)return t}else f?t.length===0?V(n,l,i):J(n,t,l):(t&&x(n),V(n,l));t=l}else if(e.nodeType){if(o&&e.parentNode)return t=s?[e]:e;if(Array.isArray(t)){if(s)return t=x(n,t,i,e);x(n,t,null,e)}else t==null||t===""||!n.firstChild?n.appendChild(e):n.replaceChild(e,n.firstChild);t=e}}return t}function B(n,e,t,i){let r=!1;for(let o=0,a=e.length;o<a;o++){let s=e[o],l=t&&t[n.length],f;if(!(s==null||s===!0||s===!1))if((f=typeof s)=="object"&&s.nodeType)n.push(s);else if(Array.isArray(s))r=B(n,s,l)||r;else if(f==="function")if(i){for(;typeof s=="function";)s=s();r=B(n,Array.isArray(s)?s:[s],Array.isArray(l)?l:[l])||r}else n.push(s),r=!0;else{const d=String(s);l&&l.nodeType===3&&l.data===d?n.push(l):n.push(document.createTextNode(d))}}return r}function V(n,e,t=null){for(let i=0,r=e.length;i<r;i++)n.insertBefore(e[i],t)}function x(n,e,t,i){if(t===void 0)return n.textContent="";const r=i||document.createTextNode("");if(e.length){let o=!1;for(let a=e.length-1;a>=0;a--){const s=e[a];if(r!==s){const l=s.parentNode===n;!o&&!a?l?n.replaceChild(r,s):n.insertBefore(r,t):l&&s.remove()}else o=!0}}else n.insertBefore(r,t);return[r]}const ce={button:"_button_12jrf_1"},_=(...n)=>n.filter(Boolean).join(" ");var ae=y("<button type=button>");const fe=n=>{const[e,t]=c.splitProps(n,["variant"]);return(()=>{var i=ae();return m(i,c.mergeProps(t,{get class(){return _(ce.button,t.class,e.variant||"solid")}}),!1,!0),b(i,()=>n.children),i})()},A={checkbox:"_checkbox_1npj4_1",input:"_input_1npj4_8",indicator:"_indicator_1npj4_18",label:"_label_1npj4_37",disabled:"_disabled_1npj4_46"};var de=y("<span><input><span>"),ue=y("<label>");const ge=n=>{const[e,t]=c.splitProps(n,["label","error","class"]),i=c.createUniqueId();return(()=>{var r=de(),o=r.firstChild,a=o.nextSibling;return m(o,c.mergeProps(t,{id:i,type:"checkbox",get class(){return A.input},get"aria-invalid"(){return!!e.error}}),!1,!1),b(r,(()=>{var s=j(()=>!!e.label);return()=>s()&&(()=>{var l=ue();return M(l,"for",i),b(l,()=>e.label),c.createRenderEffect(()=>w(l,A.label)),l})()})(),null),c.createRenderEffect(s=>{var l=_(A.checkbox,e.class,t.disabled&&A.disabled),f=A.indicator;return l!==s.e&&w(r,s.e=l),f!==s.t&&w(a,s.t=f),s},{e:void 0,t:void 0}),r})()},he=n=>n.level==="error",q=n=>{if(n.length)return n.map(e=>e.id).join(" ")},P=()=>{},D=n=>()=>n,H=()=>()=>{},ye={fieldId:"",error:D(!1),ariaDescribedBy:D(void 0),ariaErrorMessage:D(void 0),setMessage:P},v=c.createContext(ye,{}),S=()=>c.useContext(v),me=n=>{const e=c.createUniqueId(),[t,i]=c.createSignal([]),r=c.createMemo(()=>n.error),o=c.createMemo(()=>q(t())),a=c.createMemo(()=>q(t().filter(he))),s=l=>{i(f=>[...f,l])};return c.createComponent(v.Provider,{value:{fieldId:e,error:r,setMessage:s,ariaDescribedBy:o,ariaErrorMessage:a},get children(){return n.children}})},be={input:"_input_1nlce_1"};var _e=y("<input>");const $e=n=>{const[e,t]=c.splitProps(n,["error","class"]),i=S();return(()=>{var r=_e();return m(r,c.mergeProps(t,{get class(){return _(be.input,e.class)},get id(){return i.fieldId},get"aria-describedby"(){return i.ariaDescribedBy()},get"aria-invalid"(){return i.error()||!!e.error},get"aria-errormessage"(){return i.ariaErrorMessage()}}),!1,!1),r})()},Ce={setDialogRef(){},ariaLabelledBy:D(void 0),ariaDescribedBy:D(void 0),setTitleId:H(),setDescriptionId:H(),openDialog:P,closeDialog:P,onOpenChange:P,onBeforeClose:P},G=c.createContext(Ce),I=()=>c.useContext(G),xe=n=>{let e;const t=d=>{e=d},[i,r]=c.createSignal(),[o,a]=c.createSignal(),s=c.createMemo(()=>n.isOpen),l=()=>{var d;e==null||e.showModal(),(d=n.onOpenChange)==null||d.call(n,!0)},f=()=>{e==null||e.requestClose()};return c.createEffect(()=>{s()?l():f()}),c.createComponent(G.Provider,{get value(){return{ariaLabelledBy:i,ariaDescribedBy:o,setDialogRef:t,setTitleId:r,setDescriptionId:a,openDialog:l,closeDialog:f,onOpenChange:n.onOpenChange,onBeforeClose:n.onBeforeClose}},get children(){return n.children}})},L={dialog:"_dialog_1klsa_1",title:"_title_1klsa_16",description:"_description_1klsa_26",actions:"_actions_1klsa_37"};var Ee=y("<dialog>"),Te=y("<h2>"),Ae=y("<p>"),Pe=y("<div>");const $=n=>c.createComponent(xe,c.mergeProps(n,{get children(){return n.children}})),De=n=>{const e=I(),t=c.children(()=>n.children);return c.createEffect(()=>{const i=t();i instanceof HTMLElement&&(i.onclick=e.openDialog)}),j(t)},Ie=n=>{const e=I();return(()=>{var t=Ee();return F(i=>{n.ref=i,e.setDialogRef(i)},t),m(t,c.mergeProps(n,{get class(){return _(L.dialog,n.class)},get"aria-labelledby"(){return e.ariaLabelledBy()},get"aria-describedby"(){return e.ariaDescribedBy()},onClose:()=>{var i;return(i=e.onOpenChange)==null?void 0:i.call(e,!1)},get onCancel(){return e.onBeforeClose}}),!1,!0),b(t,()=>n.children),t})()},Me=n=>{const e=I(),t=c.createUniqueId();return e.setTitleId(t),(()=>{var i=Te();return m(i,c.mergeProps(n,{id:t,get class(){return _(L.title,n.class)}}),!1,!0),b(i,()=>n.children),i})()},we=n=>{const e=I(),t=c.createUniqueId();return e.setDescriptionId(t),(()=>{var i=Ae();return m(i,c.mergeProps(n,{id:t,get class(){return _(L.description,n.class)}}),!1,!0),b(i,()=>n.children),i})()},Le=n=>{const e=I(),t=c.children(()=>n.children);return c.createEffect(()=>{const i=t();i instanceof HTMLElement&&(i.onclick=e.closeDialog)}),j(t)},Ne=n=>(()=>{var e=Pe();return m(e,c.mergeProps(n,{get class(){return _(L.actions,n.class)}}),!1,!0),b(e,()=>n.children),e})();$.Trigger=De,$.Content=Ie,$.Title=Me,$.Description=we,$.Close=Le,$.Actions=Ne;const N={field:"_field_1ijme_1",label:"_label_1ijme_7",message:"_message_1ijme_19",error:"_error_1ijme_31"};var je=y("<div>"),Be=y("<label>"),Se=y("<p>");const O=n=>{const[e,t]=c.splitProps(n,["class","error"]);return c.createComponent(me,{get error(){return!!e.error},get children(){var i=je();return m(i,c.mergeProps(t,{get class(){return _(N.field,e.class)}}),!1,!0),b(i,()=>n.children),i}})},Oe=n=>{const[e,t]=c.splitProps(n,["class"]),i=S();return(()=>{var r=Be();return m(r,c.mergeProps(t,{get for(){return i.fieldId},get class(){return _(N.label,e.class)}}),!1,!0),b(r,()=>t.children),r})()},pe=n=>{const[e,t]=c.splitProps(n,["class","level"]),i=S(),r=c.createUniqueId();return i.setMessage({level:e.level||"info",id:r}),c.createComponent(c.Show,{get when(){return t.children},get children(){var o=Se();return m(o,c.mergeProps(t,{id:r,get class(){return _(N.message,e.class,e.level==="error"&&N.error)}}),!1,!0),b(o,()=>t.children),o}})};O.Label=Oe,O.Message=pe,h.Button=fe,h.Checkbox=ge,h.Dialog=$,h.Field=O,h.TextInput=$e,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
package/dist/select/select.d.ts
DELETED
package/dist/utils/cls.d.ts
DELETED
package/dist/utils/message.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type MessageLevel = "info" | "warning" | "error";
|
|
2
|
-
export type Message = {
|
|
3
|
-
level: MessageLevel;
|
|
4
|
-
id: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const isError: (message: Message) => boolean;
|
|
7
|
-
export declare const getMessageIds: (messages: Message[]) => string | undefined;
|