solid-uix 0.5.0 → 0.5.2
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 +1 -7
- package/dist/main.css +269 -1
- package/dist/main.d.ts +79 -0
- package/dist/main.js +348 -246
- package/dist/main.jsx +386 -0
- package/package.json +11 -10
- package/dist/main.js.map +0 -1
- package/dist/ssr/main.js +0 -395
- package/dist/ssr/main.js.map +0 -1
- package/dist/types/button/button.d.ts +0 -4
- package/dist/types/button/button.types.d.ts +0 -4
- package/dist/types/checkbox/checkbox.d.ts +0 -2
- package/dist/types/checkbox/checkbox.stories.d.ts +0 -29
- package/dist/types/checkbox/checkbox.types.d.ts +0 -5
- package/dist/types/dialog/dialog.d.ts +0 -11
- package/dist/types/dialog/dialog.types.d.ts +0 -17
- package/dist/types/dialog/provider/context.d.ts +0 -3
- package/dist/types/dialog/provider/context.types.d.ts +0 -14
- package/dist/types/dialog/provider/provider.d.ts +0 -2
- package/dist/types/dialog/provider/provider.types.d.ts +0 -7
- package/dist/types/field/field.context.d.ts +0 -3
- package/dist/types/field/field.d.ts +0 -6
- package/dist/types/field/field.types.d.ts +0 -19
- package/dist/types/link/link.d.ts +0 -2
- package/dist/types/link/link.stories.d.ts +0 -48
- package/dist/types/link/link.types.d.ts +0 -6
- package/dist/types/list/list.d.ts +0 -5
- package/dist/types/list/list.types.d.ts +0 -3
- package/dist/types/main.d.ts +0 -13
- package/dist/types/select/select.d.ts +0 -5
- package/dist/types/select/select.types.d.ts +0 -5
- package/dist/types/text_area/text_area.d.ts +0 -2
- package/dist/types/text_area/text_area.stories.d.ts +0 -38
- package/dist/types/text_area/text_area.types.d.ts +0 -4
- package/dist/types/text_input/text_input.d.ts +0 -2
- package/dist/types/text_input/text_input.stories.d.ts +0 -30
- package/dist/types/text_input/text_input.types.d.ts +0 -4
- package/dist/types/utils/cls.d.ts +0 -3
- package/dist/types/utils/message.d.ts +0 -7
- package/dist/types/utils/noop.d.ts +0 -4
- package/dist/types/utils/string.d.ts +0 -1
package/dist/main.js
CHANGED
|
@@ -1,324 +1,426 @@
|
|
|
1
|
-
import { template
|
|
2
|
-
import { mergeProps
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { template, spread, mergeProps as mergeProps$1, insert, memo, setAttribute, effect, className, createComponent, use } from 'solid-js/web';
|
|
2
|
+
import { createContext, mergeProps, splitProps, createUniqueId, useContext, createSignal, createMemo, createEffect, children, Show } from 'solid-js';
|
|
3
|
+
import sx from './button.module.css';
|
|
4
|
+
export { default as buttonSx } from './button.module.css';
|
|
5
|
+
import sx2 from './link.module.css';
|
|
6
|
+
import sx3 from './checkbox.module.css';
|
|
7
|
+
import sx4 from './text_input.module.css';
|
|
8
|
+
import sx5 from './dialog.module.css';
|
|
9
|
+
import sx6 from './field.module.css';
|
|
10
|
+
|
|
11
|
+
// src/main.ts
|
|
12
|
+
|
|
13
|
+
// src/utils/cls.ts
|
|
14
|
+
var cls = (...classes) => {
|
|
15
|
+
return classes.filter(Boolean).join(" ");
|
|
8
16
|
};
|
|
9
|
-
var
|
|
10
|
-
|
|
17
|
+
var _tmpl$ = /* @__PURE__ */ template(`<button type=button>`);
|
|
18
|
+
var defaultProps = {
|
|
11
19
|
variant: "solid"
|
|
12
|
-
}
|
|
13
|
-
|
|
20
|
+
};
|
|
21
|
+
var Button = (props) => {
|
|
22
|
+
const merged = mergeProps(defaultProps, props);
|
|
23
|
+
const [local, rest] = splitProps(merged, ["class", "variant"]);
|
|
14
24
|
return (() => {
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
get class() {
|
|
18
|
-
return
|
|
25
|
+
var _el$ = _tmpl$();
|
|
26
|
+
spread(_el$, mergeProps$1(rest, {
|
|
27
|
+
get ["class"]() {
|
|
28
|
+
return cls(sx.button, local.class, local.variant === "solid" && sx.solid, local.variant === "outlined" && sx.outlined);
|
|
19
29
|
}
|
|
20
|
-
}),
|
|
30
|
+
}), false, true);
|
|
31
|
+
insert(_el$, () => rest.children);
|
|
32
|
+
return _el$;
|
|
21
33
|
})();
|
|
22
|
-
}, Z = "_link_yqbjv_1", ee = "_underline_yqbjv_14", te = "_secondary_yqbjv_18", re = "_disabled_yqbjv_22", D = {
|
|
23
|
-
link: Z,
|
|
24
|
-
underline: ee,
|
|
25
|
-
secondary: te,
|
|
26
|
-
disabled: re
|
|
27
34
|
};
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
const [
|
|
35
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<a>`);
|
|
36
|
+
var Link = (props) => {
|
|
37
|
+
const [local, rest] = splitProps(props, ["class", "reset", "disabled", "color", "underline"]);
|
|
31
38
|
return (() => {
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
get class() {
|
|
35
|
-
return
|
|
39
|
+
var _el$ = _tmpl$2();
|
|
40
|
+
spread(_el$, mergeProps$1(rest, {
|
|
41
|
+
get ["class"]() {
|
|
42
|
+
return cls(!local.reset && sx2.link, local.class, local.disabled && sx2.disabled, local.color === "secondary" && sx2.secondary, local.underline === "always" && sx2.underline);
|
|
36
43
|
},
|
|
37
|
-
get "aria-disabled"() {
|
|
38
|
-
return
|
|
44
|
+
get ["aria-disabled"]() {
|
|
45
|
+
return local.disabled;
|
|
39
46
|
}
|
|
40
|
-
}),
|
|
47
|
+
}), false, true);
|
|
48
|
+
insert(_el$, () => rest.children);
|
|
49
|
+
return _el$;
|
|
41
50
|
})();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/utils/message.ts
|
|
54
|
+
var isError = (message) => {
|
|
55
|
+
return message.level === "error";
|
|
56
|
+
};
|
|
57
|
+
var getMessageIds = (messages) => {
|
|
58
|
+
if (!messages.length) {
|
|
59
|
+
return void 0;
|
|
60
|
+
}
|
|
61
|
+
return messages.map((message) => message.id).join(" ");
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// src/utils/noop.ts
|
|
65
|
+
var noop = () => {
|
|
66
|
+
};
|
|
67
|
+
var noopAccessor = (value) => {
|
|
68
|
+
return () => value;
|
|
69
|
+
};
|
|
70
|
+
var noopSetter = () => {
|
|
71
|
+
return () => {
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/field/field.context.tsx
|
|
76
|
+
var defaultValue = {
|
|
54
77
|
fieldId: void 0,
|
|
55
|
-
error:
|
|
56
|
-
ariaDescribedBy:
|
|
57
|
-
ariaErrorMessage:
|
|
58
|
-
setMessage:
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
error: noopAccessor(false),
|
|
79
|
+
ariaDescribedBy: noopAccessor(void 0),
|
|
80
|
+
ariaErrorMessage: noopAccessor(void 0),
|
|
81
|
+
setMessage: noop
|
|
82
|
+
};
|
|
83
|
+
var FieldContext = createContext(defaultValue, {});
|
|
84
|
+
var useFieldContext = () => {
|
|
85
|
+
return useContext(FieldContext);
|
|
86
|
+
};
|
|
87
|
+
var FieldProvider = (props) => {
|
|
88
|
+
const fieldId = createUniqueId();
|
|
89
|
+
const [messages, setMessages] = createSignal([]);
|
|
90
|
+
const error = createMemo(() => {
|
|
91
|
+
return props.error;
|
|
92
|
+
});
|
|
93
|
+
const ariaDescribedBy = createMemo(() => {
|
|
94
|
+
return getMessageIds(messages());
|
|
95
|
+
});
|
|
96
|
+
const ariaErrorMessage = createMemo(() => {
|
|
97
|
+
return getMessageIds(messages().filter(isError));
|
|
98
|
+
});
|
|
99
|
+
const setMessage = (message) => {
|
|
100
|
+
setMessages((prev) => [...prev, message]);
|
|
62
101
|
};
|
|
63
|
-
return
|
|
102
|
+
return createComponent(FieldContext.Provider, {
|
|
64
103
|
value: {
|
|
65
|
-
fieldId
|
|
66
|
-
error
|
|
67
|
-
setMessage
|
|
68
|
-
ariaDescribedBy
|
|
69
|
-
ariaErrorMessage
|
|
104
|
+
fieldId,
|
|
105
|
+
error,
|
|
106
|
+
setMessage,
|
|
107
|
+
ariaDescribedBy,
|
|
108
|
+
ariaErrorMessage
|
|
70
109
|
},
|
|
71
110
|
get children() {
|
|
72
|
-
return
|
|
111
|
+
return props.children;
|
|
73
112
|
}
|
|
74
113
|
});
|
|
75
114
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
115
|
+
|
|
116
|
+
// src/checkbox/checkbox.tsx
|
|
117
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<span><input><span>`);
|
|
118
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<label>`);
|
|
119
|
+
var Checkbox = (props) => {
|
|
120
|
+
const [local, rest] = splitProps(props, ["label", "error", "class"]);
|
|
121
|
+
const context = useFieldContext();
|
|
122
|
+
const id = createUniqueId();
|
|
79
123
|
return (() => {
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
id:
|
|
83
|
-
type: "checkbox",
|
|
84
|
-
get class() {
|
|
85
|
-
return
|
|
124
|
+
var _el$ = _tmpl$3(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
125
|
+
spread(_el$2, mergeProps$1(rest, {
|
|
126
|
+
"id": id,
|
|
127
|
+
"type": "checkbox",
|
|
128
|
+
get ["class"]() {
|
|
129
|
+
return sx3.input;
|
|
86
130
|
},
|
|
87
|
-
get "aria-describedby"() {
|
|
88
|
-
return
|
|
131
|
+
get ["aria-describedby"]() {
|
|
132
|
+
return context.ariaDescribedBy();
|
|
89
133
|
},
|
|
90
|
-
get "aria-invalid"() {
|
|
91
|
-
return
|
|
134
|
+
get ["aria-invalid"]() {
|
|
135
|
+
return context.error() || !!local.error;
|
|
92
136
|
},
|
|
93
|
-
get "aria-errormessage"() {
|
|
94
|
-
return
|
|
137
|
+
get ["aria-errormessage"]() {
|
|
138
|
+
return context.ariaErrorMessage();
|
|
95
139
|
}
|
|
96
|
-
}),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
140
|
+
}), false, false);
|
|
141
|
+
insert(_el$, (() => {
|
|
142
|
+
var _c$ = memo(() => !!local.label);
|
|
143
|
+
return () => _c$() && (() => {
|
|
144
|
+
var _el$4 = _tmpl$22();
|
|
145
|
+
setAttribute(_el$4, "for", id);
|
|
146
|
+
insert(_el$4, () => local.label);
|
|
147
|
+
effect(() => className(_el$4, sx3.label));
|
|
148
|
+
return _el$4;
|
|
101
149
|
})();
|
|
102
|
-
})(), null)
|
|
103
|
-
|
|
104
|
-
|
|
150
|
+
})(), null);
|
|
151
|
+
effect((_p$) => {
|
|
152
|
+
var _v$ = cls(sx3.checkbox, local.class, rest.disabled && sx3.disabled), _v$2 = sx3.indicator;
|
|
153
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
154
|
+
_v$2 !== _p$.t && className(_el$3, _p$.t = _v$2);
|
|
155
|
+
return _p$;
|
|
105
156
|
}, {
|
|
106
157
|
e: void 0,
|
|
107
158
|
t: void 0
|
|
108
|
-
})
|
|
159
|
+
});
|
|
160
|
+
return _el$;
|
|
109
161
|
})();
|
|
110
|
-
}, be = "_input_vvaje_1", ve = {
|
|
111
|
-
input: be
|
|
112
162
|
};
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
const [
|
|
163
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<input>`);
|
|
164
|
+
var TextInput = (props) => {
|
|
165
|
+
const [local, rest] = splitProps(props, ["error", "class"]);
|
|
166
|
+
const context = useFieldContext();
|
|
116
167
|
return (() => {
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
get class() {
|
|
120
|
-
return
|
|
168
|
+
var _el$ = _tmpl$4();
|
|
169
|
+
spread(_el$, mergeProps$1(rest, {
|
|
170
|
+
get ["class"]() {
|
|
171
|
+
return cls(sx4.input, local.class);
|
|
121
172
|
},
|
|
122
173
|
get id() {
|
|
123
|
-
return
|
|
174
|
+
return context.fieldId;
|
|
124
175
|
},
|
|
125
|
-
get "aria-describedby"() {
|
|
126
|
-
return
|
|
176
|
+
get ["aria-describedby"]() {
|
|
177
|
+
return context.ariaDescribedBy();
|
|
127
178
|
},
|
|
128
|
-
get "aria-invalid"() {
|
|
129
|
-
return
|
|
179
|
+
get ["aria-invalid"]() {
|
|
180
|
+
return context.error() || !!local.error;
|
|
130
181
|
},
|
|
131
|
-
get "aria-errormessage"() {
|
|
132
|
-
return
|
|
182
|
+
get ["aria-errormessage"]() {
|
|
183
|
+
return context.ariaErrorMessage();
|
|
133
184
|
}
|
|
134
|
-
}),
|
|
185
|
+
}), false, false);
|
|
186
|
+
return _el$;
|
|
135
187
|
})();
|
|
136
|
-
}
|
|
188
|
+
};
|
|
189
|
+
var defaultValue2 = {
|
|
137
190
|
setDialogRef() {
|
|
138
191
|
},
|
|
139
|
-
ariaLabelledBy:
|
|
140
|
-
ariaDescribedBy:
|
|
141
|
-
setTitleId:
|
|
142
|
-
setDescriptionId:
|
|
143
|
-
openDialog:
|
|
144
|
-
closeDialog:
|
|
145
|
-
onOpenChange:
|
|
146
|
-
onBeforeClose:
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
192
|
+
ariaLabelledBy: noopAccessor(void 0),
|
|
193
|
+
ariaDescribedBy: noopAccessor(void 0),
|
|
194
|
+
setTitleId: noopSetter(),
|
|
195
|
+
setDescriptionId: noopSetter(),
|
|
196
|
+
openDialog: noop,
|
|
197
|
+
closeDialog: noop,
|
|
198
|
+
onOpenChange: noop,
|
|
199
|
+
onBeforeClose: noop
|
|
200
|
+
};
|
|
201
|
+
var DialogContext = createContext(defaultValue2);
|
|
202
|
+
var useDialogContext = () => {
|
|
203
|
+
return useContext(DialogContext);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// src/dialog/provider/provider.tsx
|
|
207
|
+
var DialogProvider = (props) => {
|
|
208
|
+
let dialogRef;
|
|
209
|
+
const setDialogRef = (element) => {
|
|
210
|
+
dialogRef = element;
|
|
155
211
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
212
|
+
const [ariaLabelledBy, setTitleId] = createSignal();
|
|
213
|
+
const [ariaDescribedBy, setDescriptionId] = createSignal();
|
|
214
|
+
const isOpen = createMemo(() => {
|
|
215
|
+
return props.isOpen;
|
|
216
|
+
});
|
|
217
|
+
const openDialog = () => {
|
|
218
|
+
dialogRef?.showModal();
|
|
219
|
+
props.onOpenChange?.(true);
|
|
220
|
+
};
|
|
221
|
+
const closeDialog = () => {
|
|
222
|
+
dialogRef?.requestClose();
|
|
223
|
+
};
|
|
224
|
+
createEffect(() => {
|
|
225
|
+
if (isOpen()) {
|
|
226
|
+
openDialog();
|
|
227
|
+
} else {
|
|
228
|
+
closeDialog();
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
return createComponent(DialogContext.Provider, {
|
|
159
232
|
get value() {
|
|
160
233
|
return {
|
|
161
|
-
ariaLabelledBy
|
|
162
|
-
ariaDescribedBy
|
|
163
|
-
setDialogRef
|
|
164
|
-
setTitleId
|
|
165
|
-
setDescriptionId
|
|
166
|
-
openDialog
|
|
167
|
-
closeDialog
|
|
168
|
-
onOpenChange:
|
|
169
|
-
onBeforeClose:
|
|
234
|
+
ariaLabelledBy,
|
|
235
|
+
ariaDescribedBy,
|
|
236
|
+
setDialogRef,
|
|
237
|
+
setTitleId,
|
|
238
|
+
setDescriptionId,
|
|
239
|
+
openDialog,
|
|
240
|
+
closeDialog,
|
|
241
|
+
onOpenChange: props.onOpenChange,
|
|
242
|
+
onBeforeClose: props.onBeforeClose
|
|
170
243
|
};
|
|
171
244
|
},
|
|
172
245
|
get children() {
|
|
173
|
-
return
|
|
246
|
+
return props.children;
|
|
174
247
|
}
|
|
175
248
|
});
|
|
176
|
-
}, he = "_dialog_1klsa_1", xe = "_title_1klsa_16", pe = "_description_1klsa_26", ye = "_actions_1klsa_37", I = {
|
|
177
|
-
dialog: he,
|
|
178
|
-
title: xe,
|
|
179
|
-
description: pe,
|
|
180
|
-
actions: ye
|
|
181
249
|
};
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
const
|
|
250
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<dialog>`);
|
|
251
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<h2>`);
|
|
252
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<p>`);
|
|
253
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div>`);
|
|
254
|
+
var Dialog = (props) => {
|
|
255
|
+
return createComponent(DialogProvider, mergeProps$1(props, {
|
|
256
|
+
get children() {
|
|
257
|
+
return props.children;
|
|
258
|
+
}
|
|
259
|
+
}));
|
|
260
|
+
};
|
|
261
|
+
var Trigger = (props) => {
|
|
262
|
+
const context = useDialogContext();
|
|
263
|
+
const child = children(() => props.children);
|
|
264
|
+
createEffect(() => {
|
|
265
|
+
const element = child();
|
|
266
|
+
if (element instanceof HTMLElement) {
|
|
267
|
+
element.onclick = context.openDialog;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
return memo(child);
|
|
271
|
+
};
|
|
272
|
+
var Content = (props) => {
|
|
273
|
+
const context = useDialogContext();
|
|
195
274
|
return (() => {
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
275
|
+
var _el$ = _tmpl$5();
|
|
276
|
+
use((element) => {
|
|
277
|
+
props.ref = element;
|
|
278
|
+
context.setDialogRef(element);
|
|
279
|
+
}, _el$);
|
|
280
|
+
spread(_el$, mergeProps$1(props, {
|
|
281
|
+
get ["class"]() {
|
|
282
|
+
return cls(sx5.dialog, props.class);
|
|
202
283
|
},
|
|
203
|
-
get "aria-labelledby"() {
|
|
204
|
-
return
|
|
284
|
+
get ["aria-labelledby"]() {
|
|
285
|
+
return context.ariaLabelledBy();
|
|
205
286
|
},
|
|
206
|
-
get "aria-describedby"() {
|
|
207
|
-
return
|
|
287
|
+
get ["aria-describedby"]() {
|
|
288
|
+
return context.ariaDescribedBy();
|
|
208
289
|
},
|
|
209
|
-
onClose: () =>
|
|
290
|
+
"onClose": () => context.onOpenChange?.(false),
|
|
210
291
|
get onCancel() {
|
|
211
|
-
return
|
|
292
|
+
return context.onBeforeClose;
|
|
212
293
|
}
|
|
213
|
-
}),
|
|
294
|
+
}), false, true);
|
|
295
|
+
insert(_el$, () => props.children);
|
|
296
|
+
return _el$;
|
|
214
297
|
})();
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
298
|
+
};
|
|
299
|
+
var Title = (props) => {
|
|
300
|
+
const context = useDialogContext();
|
|
301
|
+
const titleId = createUniqueId();
|
|
302
|
+
context.setTitleId(titleId);
|
|
303
|
+
return (() => {
|
|
304
|
+
var _el$2 = _tmpl$23();
|
|
305
|
+
spread(_el$2, mergeProps$1(props, {
|
|
306
|
+
"id": titleId,
|
|
307
|
+
get ["class"]() {
|
|
308
|
+
return cls(sx5.title, props.class);
|
|
223
309
|
}
|
|
224
|
-
}),
|
|
310
|
+
}), false, true);
|
|
311
|
+
insert(_el$2, () => props.children);
|
|
312
|
+
return _el$2;
|
|
225
313
|
})();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
314
|
+
};
|
|
315
|
+
var Description = (props) => {
|
|
316
|
+
const context = useDialogContext();
|
|
317
|
+
const descriptionId = createUniqueId();
|
|
318
|
+
context.setDescriptionId(descriptionId);
|
|
319
|
+
return (() => {
|
|
320
|
+
var _el$3 = _tmpl$32();
|
|
321
|
+
spread(_el$3, mergeProps$1(props, {
|
|
322
|
+
"id": descriptionId,
|
|
323
|
+
get ["class"]() {
|
|
324
|
+
return cls(sx5.description, props.class);
|
|
234
325
|
}
|
|
235
|
-
}),
|
|
326
|
+
}), false, true);
|
|
327
|
+
insert(_el$3, () => props.children);
|
|
328
|
+
return _el$3;
|
|
236
329
|
})();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return u(t, c(e, {
|
|
246
|
-
get class() {
|
|
247
|
-
return _(I.actions, e.class);
|
|
330
|
+
};
|
|
331
|
+
var Close = (props) => {
|
|
332
|
+
const context = useDialogContext();
|
|
333
|
+
const child = children(() => props.children);
|
|
334
|
+
createEffect(() => {
|
|
335
|
+
const element = child();
|
|
336
|
+
if (element instanceof HTMLElement) {
|
|
337
|
+
element.onclick = context.closeDialog;
|
|
248
338
|
}
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
339
|
+
});
|
|
340
|
+
return memo(child);
|
|
341
|
+
};
|
|
342
|
+
var Actions = (props) => {
|
|
343
|
+
return (() => {
|
|
344
|
+
var _el$4 = _tmpl$42();
|
|
345
|
+
spread(_el$4, mergeProps$1(props, {
|
|
346
|
+
get ["class"]() {
|
|
347
|
+
return cls(sx5.actions, props.class);
|
|
348
|
+
}
|
|
349
|
+
}), false, true);
|
|
350
|
+
insert(_el$4, () => props.children);
|
|
351
|
+
return _el$4;
|
|
352
|
+
})();
|
|
262
353
|
};
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
354
|
+
Dialog.Trigger = Trigger;
|
|
355
|
+
Dialog.Content = Content;
|
|
356
|
+
Dialog.Title = Title;
|
|
357
|
+
Dialog.Description = Description;
|
|
358
|
+
Dialog.Close = Close;
|
|
359
|
+
Dialog.Actions = Actions;
|
|
360
|
+
var _tmpl$6 = /* @__PURE__ */ template(`<div>`);
|
|
361
|
+
var _tmpl$24 = /* @__PURE__ */ template(`<label>`);
|
|
362
|
+
var _tmpl$33 = /* @__PURE__ */ template(`<p>`);
|
|
363
|
+
var Field = (props) => {
|
|
364
|
+
const [local, rest] = splitProps(props, ["class", "error"]);
|
|
365
|
+
return createComponent(FieldProvider, {
|
|
267
366
|
get error() {
|
|
268
|
-
return !!
|
|
367
|
+
return !!local.error;
|
|
269
368
|
},
|
|
270
369
|
get children() {
|
|
271
|
-
var
|
|
272
|
-
|
|
273
|
-
get class() {
|
|
274
|
-
return
|
|
370
|
+
var _el$ = _tmpl$6();
|
|
371
|
+
spread(_el$, mergeProps$1(rest, {
|
|
372
|
+
get ["class"]() {
|
|
373
|
+
return cls(sx6.field, local.class);
|
|
275
374
|
}
|
|
276
|
-
}),
|
|
375
|
+
}), false, true);
|
|
376
|
+
insert(_el$, () => props.children);
|
|
377
|
+
return _el$;
|
|
277
378
|
}
|
|
278
379
|
});
|
|
279
|
-
}
|
|
280
|
-
|
|
380
|
+
};
|
|
381
|
+
var FieldLabel = (props) => {
|
|
382
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
383
|
+
const context = useFieldContext();
|
|
281
384
|
return (() => {
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
get for() {
|
|
285
|
-
return
|
|
385
|
+
var _el$2 = _tmpl$24();
|
|
386
|
+
spread(_el$2, mergeProps$1(rest, {
|
|
387
|
+
get ["for"]() {
|
|
388
|
+
return context.fieldId;
|
|
286
389
|
},
|
|
287
|
-
get class() {
|
|
288
|
-
return
|
|
390
|
+
get ["class"]() {
|
|
391
|
+
return cls(sx6.label, local.class);
|
|
289
392
|
}
|
|
290
|
-
}),
|
|
393
|
+
}), false, true);
|
|
394
|
+
insert(_el$2, () => rest.children);
|
|
395
|
+
return _el$2;
|
|
291
396
|
})();
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
397
|
+
};
|
|
398
|
+
var FieldMessage = (props) => {
|
|
399
|
+
const [local, rest] = splitProps(props, ["class", "level"]);
|
|
400
|
+
const context = useFieldContext();
|
|
401
|
+
const messageId = createUniqueId();
|
|
402
|
+
context.setMessage({
|
|
403
|
+
level: local.level || "info",
|
|
404
|
+
id: messageId
|
|
405
|
+
});
|
|
406
|
+
return createComponent(Show, {
|
|
298
407
|
get when() {
|
|
299
|
-
return
|
|
408
|
+
return rest.children;
|
|
300
409
|
},
|
|
301
410
|
get children() {
|
|
302
|
-
var
|
|
303
|
-
|
|
304
|
-
id:
|
|
305
|
-
get class() {
|
|
306
|
-
return
|
|
411
|
+
var _el$3 = _tmpl$33();
|
|
412
|
+
spread(_el$3, mergeProps$1(rest, {
|
|
413
|
+
"id": messageId,
|
|
414
|
+
get ["class"]() {
|
|
415
|
+
return cls(sx6.message, local.class, local.level === "error" && sx6.error);
|
|
307
416
|
}
|
|
308
|
-
}),
|
|
417
|
+
}), false, true);
|
|
418
|
+
insert(_el$3, () => rest.children);
|
|
419
|
+
return _el$3;
|
|
309
420
|
}
|
|
310
421
|
});
|
|
311
422
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
Ge as Checkbox,
|
|
317
|
-
v as Dialog,
|
|
318
|
-
V as Field,
|
|
319
|
-
ze as Link,
|
|
320
|
-
Je as TextInput,
|
|
321
|
-
T as buttonSx,
|
|
322
|
-
_ as cls
|
|
323
|
-
};
|
|
324
|
-
//# sourceMappingURL=main.js.map
|
|
423
|
+
Field.Label = FieldLabel;
|
|
424
|
+
Field.Message = FieldMessage;
|
|
425
|
+
|
|
426
|
+
export { Button, Checkbox, Dialog, Field, Link, TextInput, cls };
|