@proyecto-viviana/solidaria-components 0.0.2 → 0.0.3
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/dist/index.d.ts +532 -19
- package/dist/index.js +46 -46
- package/dist/index.jsx +1201 -0
- package/package.json +7 -5
- package/dist/Button.d.ts +0 -49
- package/dist/Button.d.ts.map +0 -1
- package/dist/Checkbox.d.ts +0 -97
- package/dist/Checkbox.d.ts.map +0 -1
- package/dist/Link.d.ts +0 -52
- package/dist/Link.d.ts.map +0 -1
- package/dist/ProgressBar.d.ts +0 -45
- package/dist/ProgressBar.d.ts.map +0 -1
- package/dist/RadioGroup.d.ts +0 -99
- package/dist/RadioGroup.d.ts.map +0 -1
- package/dist/Separator.d.ts +0 -37
- package/dist/Separator.d.ts.map +0 -1
- package/dist/Switch.d.ts +0 -63
- package/dist/Switch.d.ts.map +0 -1
- package/dist/TextField.d.ts +0 -85
- package/dist/TextField.d.ts.map +0 -1
- package/dist/VisuallyHidden.d.ts +0 -18
- package/dist/VisuallyHidden.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -76
- package/dist/utils.d.ts.map +0 -1
package/dist/index.jsx
ADDED
|
@@ -0,0 +1,1201 @@
|
|
|
1
|
+
// src/utils.tsx
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
useContext,
|
|
5
|
+
createMemo
|
|
6
|
+
} from "solid-js";
|
|
7
|
+
function useRenderProps(props, values) {
|
|
8
|
+
return createMemo(() => {
|
|
9
|
+
const currentValues = values();
|
|
10
|
+
const { children, class: className, style, defaultClassName = "" } = props;
|
|
11
|
+
const resolvedChildren = typeof children === "function" ? children(currentValues) : children;
|
|
12
|
+
const resolvedClass = typeof className === "function" ? className(currentValues) : className ?? defaultClassName;
|
|
13
|
+
const resolvedStyle = typeof style === "function" ? style(currentValues) : style;
|
|
14
|
+
return {
|
|
15
|
+
children: resolvedChildren,
|
|
16
|
+
class: resolvedClass,
|
|
17
|
+
style: resolvedStyle
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function dataAttr(value) {
|
|
22
|
+
return value ? "" : void 0;
|
|
23
|
+
}
|
|
24
|
+
function createDataAttributes(values) {
|
|
25
|
+
const result = {};
|
|
26
|
+
for (const [key, value] of Object.entries(values)) {
|
|
27
|
+
if (typeof value === "boolean") {
|
|
28
|
+
result[`data-${camelToKebab(key)}`] = value ? "" : void 0;
|
|
29
|
+
} else if (value !== void 0) {
|
|
30
|
+
result[`data-${camelToKebab(key)}`] = value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
function camelToKebab(str) {
|
|
36
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
37
|
+
}
|
|
38
|
+
function removeDataAttributes(props) {
|
|
39
|
+
const result = {};
|
|
40
|
+
for (const [key, value] of Object.entries(props)) {
|
|
41
|
+
if (!key.startsWith("data-")) {
|
|
42
|
+
result[key] = value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
function filterDOMProps(props, options = {}) {
|
|
48
|
+
const { global = false } = options;
|
|
49
|
+
const result = {};
|
|
50
|
+
const globalAttrs = /* @__PURE__ */ new Set([
|
|
51
|
+
"id",
|
|
52
|
+
"class",
|
|
53
|
+
"style",
|
|
54
|
+
"tabIndex",
|
|
55
|
+
"role",
|
|
56
|
+
"title",
|
|
57
|
+
"lang",
|
|
58
|
+
"dir",
|
|
59
|
+
"hidden",
|
|
60
|
+
"draggable",
|
|
61
|
+
"accessKey",
|
|
62
|
+
"contentEditable",
|
|
63
|
+
"spellcheck"
|
|
64
|
+
]);
|
|
65
|
+
const ariaAttrs = /^aria-/;
|
|
66
|
+
const dataAttrs = /^data-/;
|
|
67
|
+
const eventHandlers = /^on[A-Z]/;
|
|
68
|
+
for (const [key, value] of Object.entries(props)) {
|
|
69
|
+
if (global && globalAttrs.has(key) || ariaAttrs.test(key) || dataAttrs.test(key) || eventHandlers.test(key)) {
|
|
70
|
+
result[key] = value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/VisuallyHidden.tsx
|
|
77
|
+
import { splitProps } from "solid-js";
|
|
78
|
+
import { Dynamic } from "solid-js/web";
|
|
79
|
+
var visuallyHiddenStyles = {
|
|
80
|
+
border: "0",
|
|
81
|
+
clip: "rect(0 0 0 0)",
|
|
82
|
+
"clip-path": "inset(50%)",
|
|
83
|
+
height: "1px",
|
|
84
|
+
margin: "-1px",
|
|
85
|
+
overflow: "hidden",
|
|
86
|
+
padding: "0",
|
|
87
|
+
position: "absolute",
|
|
88
|
+
width: "1px",
|
|
89
|
+
"white-space": "nowrap"
|
|
90
|
+
};
|
|
91
|
+
function VisuallyHidden(props) {
|
|
92
|
+
const [local, others] = splitProps(props, ["elementType", "children", "isFocusable"]);
|
|
93
|
+
const elementType = () => local.elementType ?? "span";
|
|
94
|
+
return <Dynamic
|
|
95
|
+
component={elementType()}
|
|
96
|
+
style={visuallyHiddenStyles}
|
|
97
|
+
{...others}
|
|
98
|
+
>
|
|
99
|
+
{local.children}
|
|
100
|
+
</Dynamic>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/Button.tsx
|
|
104
|
+
import {
|
|
105
|
+
createContext as createContext2,
|
|
106
|
+
createMemo as createMemo2,
|
|
107
|
+
splitProps as splitProps2
|
|
108
|
+
} from "solid-js";
|
|
109
|
+
import {
|
|
110
|
+
createButton,
|
|
111
|
+
createFocusRing,
|
|
112
|
+
createHover
|
|
113
|
+
} from "@proyecto-viviana/solidaria";
|
|
114
|
+
var ButtonContext = createContext2(null);
|
|
115
|
+
function Button(props) {
|
|
116
|
+
const [local, ariaProps] = splitProps2(props, [
|
|
117
|
+
"children",
|
|
118
|
+
"class",
|
|
119
|
+
"style",
|
|
120
|
+
"slot"
|
|
121
|
+
]);
|
|
122
|
+
const resolveDisabled = () => {
|
|
123
|
+
const disabled = ariaProps.isDisabled;
|
|
124
|
+
if (typeof disabled === "function") {
|
|
125
|
+
return disabled();
|
|
126
|
+
}
|
|
127
|
+
return !!disabled;
|
|
128
|
+
};
|
|
129
|
+
const buttonAria = createButton({
|
|
130
|
+
...ariaProps,
|
|
131
|
+
get isDisabled() {
|
|
132
|
+
return resolveDisabled();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
136
|
+
const { isHovered, hoverProps } = createHover({
|
|
137
|
+
get isDisabled() {
|
|
138
|
+
return resolveDisabled();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const renderValues = createMemo2(() => ({
|
|
142
|
+
isHovered: isHovered(),
|
|
143
|
+
isPressed: buttonAria.isPressed(),
|
|
144
|
+
isFocused: isFocused(),
|
|
145
|
+
isFocusVisible: isFocusVisible(),
|
|
146
|
+
isDisabled: resolveDisabled()
|
|
147
|
+
}));
|
|
148
|
+
const renderProps = useRenderProps(
|
|
149
|
+
{
|
|
150
|
+
children: local.children,
|
|
151
|
+
class: local.class,
|
|
152
|
+
style: local.style,
|
|
153
|
+
defaultClassName: "solidaria-Button"
|
|
154
|
+
},
|
|
155
|
+
renderValues
|
|
156
|
+
);
|
|
157
|
+
const domProps = createMemo2(() => {
|
|
158
|
+
const filtered = filterDOMProps(ariaProps, { global: true });
|
|
159
|
+
return filtered;
|
|
160
|
+
});
|
|
161
|
+
const cleanButtonProps = () => {
|
|
162
|
+
const { ref: _ref1, ...rest } = buttonAria.buttonProps;
|
|
163
|
+
return rest;
|
|
164
|
+
};
|
|
165
|
+
const cleanFocusProps = () => {
|
|
166
|
+
const { ref: _ref2, ...rest } = focusProps;
|
|
167
|
+
return rest;
|
|
168
|
+
};
|
|
169
|
+
const cleanHoverProps = () => {
|
|
170
|
+
const { ref: _ref3, ...rest } = hoverProps;
|
|
171
|
+
return rest;
|
|
172
|
+
};
|
|
173
|
+
return <button
|
|
174
|
+
{...domProps()}
|
|
175
|
+
{...cleanButtonProps()}
|
|
176
|
+
{...cleanFocusProps()}
|
|
177
|
+
{...cleanHoverProps()}
|
|
178
|
+
class={renderProps().class}
|
|
179
|
+
style={renderProps().style}
|
|
180
|
+
data-pressed={buttonAria.isPressed() || void 0}
|
|
181
|
+
data-hovered={isHovered() || void 0}
|
|
182
|
+
data-focused={isFocused() || void 0}
|
|
183
|
+
data-focus-visible={isFocusVisible() || void 0}
|
|
184
|
+
data-disabled={resolveDisabled() || void 0}
|
|
185
|
+
>
|
|
186
|
+
{renderProps().children}
|
|
187
|
+
</button>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// src/Switch.tsx
|
|
191
|
+
import {
|
|
192
|
+
createContext as createContext3,
|
|
193
|
+
createMemo as createMemo3,
|
|
194
|
+
splitProps as splitProps3
|
|
195
|
+
} from "solid-js";
|
|
196
|
+
import {
|
|
197
|
+
createSwitch,
|
|
198
|
+
createFocusRing as createFocusRing2,
|
|
199
|
+
createHover as createHover2
|
|
200
|
+
} from "@proyecto-viviana/solidaria";
|
|
201
|
+
import { createToggleState } from "@proyecto-viviana/solid-stately";
|
|
202
|
+
var ToggleSwitchContext = createContext3(null);
|
|
203
|
+
function ToggleSwitch(props) {
|
|
204
|
+
let inputRef = null;
|
|
205
|
+
const [local, ariaProps] = splitProps3(props, [
|
|
206
|
+
"children",
|
|
207
|
+
"class",
|
|
208
|
+
"style",
|
|
209
|
+
"slot"
|
|
210
|
+
]);
|
|
211
|
+
const state = createToggleState({
|
|
212
|
+
get isSelected() {
|
|
213
|
+
return ariaProps.isSelected;
|
|
214
|
+
},
|
|
215
|
+
get defaultSelected() {
|
|
216
|
+
return ariaProps.defaultSelected;
|
|
217
|
+
},
|
|
218
|
+
get onChange() {
|
|
219
|
+
return ariaProps.onChange;
|
|
220
|
+
},
|
|
221
|
+
get isReadOnly() {
|
|
222
|
+
return ariaProps.isReadOnly;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
const switchAria = createSwitch(
|
|
226
|
+
() => ({
|
|
227
|
+
...ariaProps,
|
|
228
|
+
children: typeof local.children === "function" ? true : local.children
|
|
229
|
+
}),
|
|
230
|
+
state,
|
|
231
|
+
() => inputRef
|
|
232
|
+
);
|
|
233
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing2();
|
|
234
|
+
const { isHovered, hoverProps } = createHover2({
|
|
235
|
+
get isDisabled() {
|
|
236
|
+
return ariaProps.isDisabled || ariaProps.isReadOnly;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
const renderValues = createMemo3(() => ({
|
|
240
|
+
isSelected: switchAria.isSelected(),
|
|
241
|
+
isHovered: isHovered(),
|
|
242
|
+
isPressed: switchAria.isPressed(),
|
|
243
|
+
isFocused: isFocused(),
|
|
244
|
+
isFocusVisible: isFocusVisible(),
|
|
245
|
+
isDisabled: switchAria.isDisabled,
|
|
246
|
+
isReadOnly: switchAria.isReadOnly,
|
|
247
|
+
state
|
|
248
|
+
}));
|
|
249
|
+
const renderProps = useRenderProps(
|
|
250
|
+
{
|
|
251
|
+
children: local.children,
|
|
252
|
+
class: local.class,
|
|
253
|
+
style: local.style,
|
|
254
|
+
defaultClassName: "solidaria-ToggleSwitch"
|
|
255
|
+
},
|
|
256
|
+
renderValues
|
|
257
|
+
);
|
|
258
|
+
const domProps = createMemo3(() => {
|
|
259
|
+
const filtered = filterDOMProps(ariaProps, { global: true });
|
|
260
|
+
delete filtered.id;
|
|
261
|
+
delete filtered.onClick;
|
|
262
|
+
return filtered;
|
|
263
|
+
});
|
|
264
|
+
const cleanLabelProps = () => {
|
|
265
|
+
const { ref: _ref1, ...rest } = switchAria.labelProps;
|
|
266
|
+
return rest;
|
|
267
|
+
};
|
|
268
|
+
const cleanHoverProps = () => {
|
|
269
|
+
const { ref: _ref2, ...rest } = hoverProps;
|
|
270
|
+
return rest;
|
|
271
|
+
};
|
|
272
|
+
const cleanInputProps = () => {
|
|
273
|
+
const { ref: _ref3, ...rest } = switchAria.inputProps;
|
|
274
|
+
return rest;
|
|
275
|
+
};
|
|
276
|
+
const cleanFocusProps = () => {
|
|
277
|
+
const { ref: _ref4, ...rest } = focusProps;
|
|
278
|
+
return rest;
|
|
279
|
+
};
|
|
280
|
+
return <label
|
|
281
|
+
{...domProps()}
|
|
282
|
+
{...cleanLabelProps()}
|
|
283
|
+
{...cleanHoverProps()}
|
|
284
|
+
class={renderProps().class}
|
|
285
|
+
style={renderProps().style}
|
|
286
|
+
data-selected={switchAria.isSelected() || void 0}
|
|
287
|
+
data-pressed={switchAria.isPressed() || void 0}
|
|
288
|
+
data-hovered={isHovered() || void 0}
|
|
289
|
+
data-focused={isFocused() || void 0}
|
|
290
|
+
data-focus-visible={isFocusVisible() || void 0}
|
|
291
|
+
data-disabled={switchAria.isDisabled || void 0}
|
|
292
|
+
data-readonly={switchAria.isReadOnly || void 0}
|
|
293
|
+
>
|
|
294
|
+
<VisuallyHidden>
|
|
295
|
+
<input
|
|
296
|
+
ref={(el) => inputRef = el}
|
|
297
|
+
{...cleanInputProps()}
|
|
298
|
+
{...cleanFocusProps()}
|
|
299
|
+
/>
|
|
300
|
+
</VisuallyHidden>
|
|
301
|
+
{renderProps().children}
|
|
302
|
+
</label>;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// src/Checkbox.tsx
|
|
306
|
+
import {
|
|
307
|
+
createContext as createContext4,
|
|
308
|
+
useContext as useContext2,
|
|
309
|
+
createMemo as createMemo4,
|
|
310
|
+
splitProps as splitProps4
|
|
311
|
+
} from "solid-js";
|
|
312
|
+
import {
|
|
313
|
+
createCheckbox,
|
|
314
|
+
createCheckboxGroup,
|
|
315
|
+
createCheckboxGroupItem,
|
|
316
|
+
createFocusRing as createFocusRing3,
|
|
317
|
+
createHover as createHover3
|
|
318
|
+
} from "@proyecto-viviana/solidaria";
|
|
319
|
+
import {
|
|
320
|
+
createToggleState as createToggleState2,
|
|
321
|
+
createCheckboxGroupState
|
|
322
|
+
} from "@proyecto-viviana/solid-stately";
|
|
323
|
+
var CheckboxGroupContext = createContext4(null);
|
|
324
|
+
var CheckboxGroupStateContext = createContext4(null);
|
|
325
|
+
var CheckboxContext = createContext4(null);
|
|
326
|
+
function CheckboxGroup(props) {
|
|
327
|
+
const [local, ariaProps] = splitProps4(props, [
|
|
328
|
+
"children",
|
|
329
|
+
"class",
|
|
330
|
+
"style",
|
|
331
|
+
"slot"
|
|
332
|
+
]);
|
|
333
|
+
const state = createCheckboxGroupState({
|
|
334
|
+
get value() {
|
|
335
|
+
return ariaProps.value;
|
|
336
|
+
},
|
|
337
|
+
get defaultValue() {
|
|
338
|
+
return ariaProps.defaultValue;
|
|
339
|
+
},
|
|
340
|
+
get onChange() {
|
|
341
|
+
return ariaProps.onChange;
|
|
342
|
+
},
|
|
343
|
+
get isDisabled() {
|
|
344
|
+
return ariaProps.isDisabled;
|
|
345
|
+
},
|
|
346
|
+
get isReadOnly() {
|
|
347
|
+
return ariaProps.isReadOnly;
|
|
348
|
+
},
|
|
349
|
+
get isRequired() {
|
|
350
|
+
return ariaProps.isRequired;
|
|
351
|
+
},
|
|
352
|
+
get isInvalid() {
|
|
353
|
+
return ariaProps.isInvalid;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
const groupAria = createCheckboxGroup(() => ariaProps, state);
|
|
357
|
+
const renderValues = createMemo4(() => ({
|
|
358
|
+
isDisabled: state.isDisabled,
|
|
359
|
+
isReadOnly: state.isReadOnly,
|
|
360
|
+
isRequired: ariaProps.isRequired ?? false,
|
|
361
|
+
isInvalid: groupAria.isInvalid,
|
|
362
|
+
state
|
|
363
|
+
}));
|
|
364
|
+
const renderProps = useRenderProps(
|
|
365
|
+
{
|
|
366
|
+
children: local.children,
|
|
367
|
+
class: local.class,
|
|
368
|
+
style: local.style,
|
|
369
|
+
defaultClassName: "solidaria-CheckboxGroup"
|
|
370
|
+
},
|
|
371
|
+
renderValues
|
|
372
|
+
);
|
|
373
|
+
const domProps = createMemo4(() => filterDOMProps(ariaProps, { global: true }));
|
|
374
|
+
const cleanGroupProps = () => {
|
|
375
|
+
const { ref: _ref, ...rest } = groupAria.groupProps;
|
|
376
|
+
return rest;
|
|
377
|
+
};
|
|
378
|
+
return <CheckboxGroupStateContext.Provider value={state}>
|
|
379
|
+
<div
|
|
380
|
+
{...domProps()}
|
|
381
|
+
{...cleanGroupProps()}
|
|
382
|
+
class={renderProps().class}
|
|
383
|
+
style={renderProps().style}
|
|
384
|
+
data-disabled={state.isDisabled || void 0}
|
|
385
|
+
data-readonly={state.isReadOnly || void 0}
|
|
386
|
+
data-required={ariaProps.isRequired || void 0}
|
|
387
|
+
data-invalid={groupAria.isInvalid || void 0}
|
|
388
|
+
>
|
|
389
|
+
{renderProps().children}
|
|
390
|
+
</div>
|
|
391
|
+
</CheckboxGroupStateContext.Provider>;
|
|
392
|
+
}
|
|
393
|
+
function Checkbox(props) {
|
|
394
|
+
let inputRef = null;
|
|
395
|
+
const [local, ariaProps] = splitProps4(props, [
|
|
396
|
+
"children",
|
|
397
|
+
"class",
|
|
398
|
+
"style",
|
|
399
|
+
"slot",
|
|
400
|
+
"isIndeterminate"
|
|
401
|
+
]);
|
|
402
|
+
const groupState = useContext2(CheckboxGroupStateContext);
|
|
403
|
+
let isSelected;
|
|
404
|
+
let isPressed;
|
|
405
|
+
let isDisabled;
|
|
406
|
+
let isReadOnly;
|
|
407
|
+
let isInvalid;
|
|
408
|
+
let labelProps;
|
|
409
|
+
let inputProps;
|
|
410
|
+
if (groupState) {
|
|
411
|
+
const itemAria = createCheckboxGroupItem(
|
|
412
|
+
() => ({
|
|
413
|
+
...ariaProps,
|
|
414
|
+
value: ariaProps.value ?? "",
|
|
415
|
+
children: typeof local.children === "function" ? true : local.children
|
|
416
|
+
}),
|
|
417
|
+
groupState,
|
|
418
|
+
() => inputRef
|
|
419
|
+
);
|
|
420
|
+
isSelected = itemAria.isSelected;
|
|
421
|
+
isPressed = itemAria.isPressed;
|
|
422
|
+
isDisabled = itemAria.isDisabled;
|
|
423
|
+
isReadOnly = itemAria.isReadOnly;
|
|
424
|
+
isInvalid = itemAria.isInvalid;
|
|
425
|
+
labelProps = itemAria.labelProps;
|
|
426
|
+
inputProps = itemAria.inputProps;
|
|
427
|
+
} else {
|
|
428
|
+
const state = createToggleState2({
|
|
429
|
+
get isSelected() {
|
|
430
|
+
return ariaProps.isSelected;
|
|
431
|
+
},
|
|
432
|
+
get defaultSelected() {
|
|
433
|
+
return ariaProps.defaultSelected;
|
|
434
|
+
},
|
|
435
|
+
get onChange() {
|
|
436
|
+
return ariaProps.onChange;
|
|
437
|
+
},
|
|
438
|
+
get isReadOnly() {
|
|
439
|
+
return ariaProps.isReadOnly;
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
const checkboxAria = createCheckbox(
|
|
443
|
+
() => ({
|
|
444
|
+
...ariaProps,
|
|
445
|
+
isIndeterminate: local.isIndeterminate,
|
|
446
|
+
children: typeof local.children === "function" ? true : local.children
|
|
447
|
+
}),
|
|
448
|
+
state,
|
|
449
|
+
() => inputRef
|
|
450
|
+
);
|
|
451
|
+
isSelected = checkboxAria.isSelected;
|
|
452
|
+
isPressed = checkboxAria.isPressed;
|
|
453
|
+
isDisabled = checkboxAria.isDisabled;
|
|
454
|
+
isReadOnly = checkboxAria.isReadOnly;
|
|
455
|
+
isInvalid = checkboxAria.isInvalid;
|
|
456
|
+
labelProps = checkboxAria.labelProps;
|
|
457
|
+
inputProps = checkboxAria.inputProps;
|
|
458
|
+
}
|
|
459
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing3();
|
|
460
|
+
const { isHovered, hoverProps } = createHover3({
|
|
461
|
+
get isDisabled() {
|
|
462
|
+
return isDisabled || isReadOnly;
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
const renderValues = createMemo4(() => ({
|
|
466
|
+
isSelected: isSelected(),
|
|
467
|
+
isIndeterminate: local.isIndeterminate ?? false,
|
|
468
|
+
isHovered: isHovered(),
|
|
469
|
+
isPressed: isPressed(),
|
|
470
|
+
isFocused: isFocused(),
|
|
471
|
+
isFocusVisible: isFocusVisible(),
|
|
472
|
+
isDisabled,
|
|
473
|
+
isReadOnly,
|
|
474
|
+
isInvalid,
|
|
475
|
+
isRequired: ariaProps.isRequired ?? false
|
|
476
|
+
}));
|
|
477
|
+
const renderProps = useRenderProps(
|
|
478
|
+
{
|
|
479
|
+
children: local.children,
|
|
480
|
+
class: local.class,
|
|
481
|
+
style: local.style,
|
|
482
|
+
defaultClassName: "solidaria-Checkbox"
|
|
483
|
+
},
|
|
484
|
+
renderValues
|
|
485
|
+
);
|
|
486
|
+
const domProps = createMemo4(() => {
|
|
487
|
+
const filtered = filterDOMProps(ariaProps, { global: true });
|
|
488
|
+
delete filtered.id;
|
|
489
|
+
delete filtered.onClick;
|
|
490
|
+
return filtered;
|
|
491
|
+
});
|
|
492
|
+
const cleanLabelProps = () => {
|
|
493
|
+
const { ref: _ref1, ...rest } = labelProps;
|
|
494
|
+
return rest;
|
|
495
|
+
};
|
|
496
|
+
const cleanHoverProps = () => {
|
|
497
|
+
const { ref: _ref2, ...rest } = hoverProps;
|
|
498
|
+
return rest;
|
|
499
|
+
};
|
|
500
|
+
const cleanInputProps = () => {
|
|
501
|
+
const { ref: _ref3, ...rest } = inputProps;
|
|
502
|
+
return rest;
|
|
503
|
+
};
|
|
504
|
+
const cleanFocusProps = () => {
|
|
505
|
+
const { ref: _ref4, ...rest } = focusProps;
|
|
506
|
+
return rest;
|
|
507
|
+
};
|
|
508
|
+
return <label
|
|
509
|
+
{...domProps()}
|
|
510
|
+
{...cleanLabelProps()}
|
|
511
|
+
{...cleanHoverProps()}
|
|
512
|
+
class={renderProps().class}
|
|
513
|
+
style={renderProps().style}
|
|
514
|
+
data-selected={isSelected() || void 0}
|
|
515
|
+
data-indeterminate={local.isIndeterminate || void 0}
|
|
516
|
+
data-pressed={isPressed() || void 0}
|
|
517
|
+
data-hovered={isHovered() || void 0}
|
|
518
|
+
data-focused={isFocused() || void 0}
|
|
519
|
+
data-focus-visible={isFocusVisible() || void 0}
|
|
520
|
+
data-disabled={isDisabled || void 0}
|
|
521
|
+
data-readonly={isReadOnly || void 0}
|
|
522
|
+
data-invalid={isInvalid || void 0}
|
|
523
|
+
data-required={ariaProps.isRequired || void 0}
|
|
524
|
+
>
|
|
525
|
+
<VisuallyHidden>
|
|
526
|
+
<input
|
|
527
|
+
ref={(el) => inputRef = el}
|
|
528
|
+
{...cleanInputProps()}
|
|
529
|
+
{...cleanFocusProps()}
|
|
530
|
+
/>
|
|
531
|
+
</VisuallyHidden>
|
|
532
|
+
{renderProps().children}
|
|
533
|
+
</label>;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// src/RadioGroup.tsx
|
|
537
|
+
import {
|
|
538
|
+
createContext as createContext5,
|
|
539
|
+
useContext as useContext3,
|
|
540
|
+
createMemo as createMemo5,
|
|
541
|
+
splitProps as splitProps5
|
|
542
|
+
} from "solid-js";
|
|
543
|
+
import {
|
|
544
|
+
createRadio,
|
|
545
|
+
createRadioGroup,
|
|
546
|
+
createFocusRing as createFocusRing4,
|
|
547
|
+
createHover as createHover4
|
|
548
|
+
} from "@proyecto-viviana/solidaria";
|
|
549
|
+
import {
|
|
550
|
+
createRadioGroupState
|
|
551
|
+
} from "@proyecto-viviana/solid-stately";
|
|
552
|
+
var RadioGroupContext = createContext5(null);
|
|
553
|
+
var RadioGroupStateContext = createContext5(null);
|
|
554
|
+
var RadioContext = createContext5(null);
|
|
555
|
+
function RadioGroup(props) {
|
|
556
|
+
const [local, ariaProps] = splitProps5(props, [
|
|
557
|
+
"children",
|
|
558
|
+
"class",
|
|
559
|
+
"style",
|
|
560
|
+
"slot"
|
|
561
|
+
]);
|
|
562
|
+
const state = createRadioGroupState({
|
|
563
|
+
get value() {
|
|
564
|
+
return props.value;
|
|
565
|
+
},
|
|
566
|
+
get defaultValue() {
|
|
567
|
+
return props.defaultValue;
|
|
568
|
+
},
|
|
569
|
+
get onChange() {
|
|
570
|
+
return props.onChange;
|
|
571
|
+
},
|
|
572
|
+
get isDisabled() {
|
|
573
|
+
return props.isDisabled;
|
|
574
|
+
},
|
|
575
|
+
get isReadOnly() {
|
|
576
|
+
return props.isReadOnly;
|
|
577
|
+
},
|
|
578
|
+
get isRequired() {
|
|
579
|
+
return props.isRequired;
|
|
580
|
+
},
|
|
581
|
+
get isInvalid() {
|
|
582
|
+
return props.isInvalid;
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
const groupAria = createRadioGroup(() => ariaProps, state);
|
|
586
|
+
const renderValues = createMemo5(() => ({
|
|
587
|
+
orientation: ariaProps.orientation ?? "vertical",
|
|
588
|
+
isDisabled: state.isDisabled,
|
|
589
|
+
isReadOnly: state.isReadOnly,
|
|
590
|
+
isRequired: state.isRequired,
|
|
591
|
+
isInvalid: groupAria.isInvalid,
|
|
592
|
+
state
|
|
593
|
+
}));
|
|
594
|
+
const renderProps = useRenderProps(
|
|
595
|
+
{
|
|
596
|
+
children: local.children,
|
|
597
|
+
class: local.class,
|
|
598
|
+
style: local.style,
|
|
599
|
+
defaultClassName: "solidaria-RadioGroup"
|
|
600
|
+
},
|
|
601
|
+
renderValues
|
|
602
|
+
);
|
|
603
|
+
const domProps = createMemo5(() => filterDOMProps(ariaProps, { global: true }));
|
|
604
|
+
const cleanGroupProps = () => {
|
|
605
|
+
const { ref: _ref, ...rest } = groupAria.radioGroupProps;
|
|
606
|
+
return rest;
|
|
607
|
+
};
|
|
608
|
+
return <RadioGroupStateContext.Provider value={state}>
|
|
609
|
+
<div
|
|
610
|
+
{...domProps()}
|
|
611
|
+
{...cleanGroupProps()}
|
|
612
|
+
class={renderProps().class}
|
|
613
|
+
style={renderProps().style}
|
|
614
|
+
data-orientation={ariaProps.orientation ?? "vertical"}
|
|
615
|
+
data-disabled={state.isDisabled || void 0}
|
|
616
|
+
data-readonly={state.isReadOnly || void 0}
|
|
617
|
+
data-required={state.isRequired || void 0}
|
|
618
|
+
data-invalid={groupAria.isInvalid || void 0}
|
|
619
|
+
>
|
|
620
|
+
{renderProps().children}
|
|
621
|
+
</div>
|
|
622
|
+
</RadioGroupStateContext.Provider>;
|
|
623
|
+
}
|
|
624
|
+
function RadioImpl(props) {
|
|
625
|
+
let inputRef = null;
|
|
626
|
+
const { radioProps, state } = props;
|
|
627
|
+
const [local, ariaProps] = splitProps5(radioProps, [
|
|
628
|
+
"children",
|
|
629
|
+
"class",
|
|
630
|
+
"style",
|
|
631
|
+
"slot"
|
|
632
|
+
]);
|
|
633
|
+
const radioAria = createRadio(
|
|
634
|
+
() => ({
|
|
635
|
+
...ariaProps,
|
|
636
|
+
children: typeof local.children === "function" ? true : local.children
|
|
637
|
+
}),
|
|
638
|
+
state,
|
|
639
|
+
() => inputRef
|
|
640
|
+
);
|
|
641
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing4();
|
|
642
|
+
const { isHovered, hoverProps } = createHover4({
|
|
643
|
+
get isDisabled() {
|
|
644
|
+
return radioAria.isDisabled || state.isReadOnly;
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
const renderValues = createMemo5(() => ({
|
|
648
|
+
isSelected: radioAria.isSelected(),
|
|
649
|
+
isHovered: isHovered(),
|
|
650
|
+
isPressed: radioAria.isPressed(),
|
|
651
|
+
isFocused: isFocused(),
|
|
652
|
+
isFocusVisible: isFocusVisible(),
|
|
653
|
+
isDisabled: radioAria.isDisabled,
|
|
654
|
+
isReadOnly: state.isReadOnly,
|
|
655
|
+
isInvalid: state.isInvalid,
|
|
656
|
+
isRequired: state.isRequired
|
|
657
|
+
}));
|
|
658
|
+
const renderProps = useRenderProps(
|
|
659
|
+
{
|
|
660
|
+
children: local.children,
|
|
661
|
+
class: local.class,
|
|
662
|
+
style: local.style,
|
|
663
|
+
defaultClassName: "solidaria-Radio"
|
|
664
|
+
},
|
|
665
|
+
renderValues
|
|
666
|
+
);
|
|
667
|
+
const domProps = createMemo5(() => {
|
|
668
|
+
const filtered = filterDOMProps(ariaProps, { global: true });
|
|
669
|
+
delete filtered.id;
|
|
670
|
+
delete filtered.onClick;
|
|
671
|
+
return filtered;
|
|
672
|
+
});
|
|
673
|
+
const cleanLabelProps = () => {
|
|
674
|
+
const { ref: _ref1, ...rest } = radioAria.labelProps;
|
|
675
|
+
return rest;
|
|
676
|
+
};
|
|
677
|
+
const cleanHoverProps = () => {
|
|
678
|
+
const { ref: _ref2, ...rest } = hoverProps;
|
|
679
|
+
return rest;
|
|
680
|
+
};
|
|
681
|
+
const cleanInputProps = () => {
|
|
682
|
+
const { ref: _ref3, ...rest } = radioAria.inputProps;
|
|
683
|
+
return rest;
|
|
684
|
+
};
|
|
685
|
+
const cleanFocusProps = () => {
|
|
686
|
+
const { ref: _ref4, ...rest } = focusProps;
|
|
687
|
+
return rest;
|
|
688
|
+
};
|
|
689
|
+
return <label
|
|
690
|
+
{...domProps()}
|
|
691
|
+
{...cleanLabelProps()}
|
|
692
|
+
{...cleanHoverProps()}
|
|
693
|
+
class={renderProps().class}
|
|
694
|
+
style={renderProps().style}
|
|
695
|
+
data-selected={radioAria.isSelected() || void 0}
|
|
696
|
+
data-pressed={radioAria.isPressed() || void 0}
|
|
697
|
+
data-hovered={isHovered() || void 0}
|
|
698
|
+
data-focused={isFocused() || void 0}
|
|
699
|
+
data-focus-visible={isFocusVisible() || void 0}
|
|
700
|
+
data-disabled={radioAria.isDisabled || void 0}
|
|
701
|
+
data-readonly={state.isReadOnly || void 0}
|
|
702
|
+
data-invalid={state.isInvalid || void 0}
|
|
703
|
+
data-required={state.isRequired || void 0}
|
|
704
|
+
>
|
|
705
|
+
<VisuallyHidden>
|
|
706
|
+
<input
|
|
707
|
+
ref={(el) => inputRef = el}
|
|
708
|
+
{...cleanInputProps()}
|
|
709
|
+
{...cleanFocusProps()}
|
|
710
|
+
/>
|
|
711
|
+
</VisuallyHidden>
|
|
712
|
+
{renderProps().children}
|
|
713
|
+
</label>;
|
|
714
|
+
}
|
|
715
|
+
function Radio(props) {
|
|
716
|
+
return (() => {
|
|
717
|
+
const state = useContext3(RadioGroupStateContext);
|
|
718
|
+
if (!state) {
|
|
719
|
+
throw new Error("Radio must be used within a RadioGroup");
|
|
720
|
+
}
|
|
721
|
+
return <RadioImpl radioProps={props} state={state} />;
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// src/TextField.tsx
|
|
726
|
+
import {
|
|
727
|
+
createContext as createContext6,
|
|
728
|
+
useContext as useContext4,
|
|
729
|
+
createMemo as createMemo6,
|
|
730
|
+
splitProps as splitProps6
|
|
731
|
+
} from "solid-js";
|
|
732
|
+
import {
|
|
733
|
+
createTextField,
|
|
734
|
+
createFocusRing as createFocusRing5,
|
|
735
|
+
createHover as createHover5
|
|
736
|
+
} from "@proyecto-viviana/solidaria";
|
|
737
|
+
import { createTextFieldState } from "@proyecto-viviana/solid-stately";
|
|
738
|
+
var TextFieldContext = createContext6(null);
|
|
739
|
+
function Label(props) {
|
|
740
|
+
const context = useContext4(TextFieldContext);
|
|
741
|
+
const mergedProps = () => {
|
|
742
|
+
if (context) {
|
|
743
|
+
const { ref: _ref, ...contextLabelProps } = context.labelProps;
|
|
744
|
+
return { ...contextLabelProps, ...props };
|
|
745
|
+
}
|
|
746
|
+
return props;
|
|
747
|
+
};
|
|
748
|
+
return <label {...mergedProps()}>{props.children}</label>;
|
|
749
|
+
}
|
|
750
|
+
function Input(props) {
|
|
751
|
+
const context = useContext4(TextFieldContext);
|
|
752
|
+
const mergedProps = () => {
|
|
753
|
+
if (context) {
|
|
754
|
+
const { ref: _ref, ...contextInputProps } = context.inputProps;
|
|
755
|
+
return { ...contextInputProps, ...props };
|
|
756
|
+
}
|
|
757
|
+
return props;
|
|
758
|
+
};
|
|
759
|
+
return <input {...mergedProps()} />;
|
|
760
|
+
}
|
|
761
|
+
function TextArea(props) {
|
|
762
|
+
const context = useContext4(TextFieldContext);
|
|
763
|
+
const mergedProps = () => {
|
|
764
|
+
if (context) {
|
|
765
|
+
const { ref: _ref, type: _type, ...contextInputProps } = context.inputProps;
|
|
766
|
+
return { ...contextInputProps, ...props };
|
|
767
|
+
}
|
|
768
|
+
return props;
|
|
769
|
+
};
|
|
770
|
+
return <textarea {...mergedProps()} />;
|
|
771
|
+
}
|
|
772
|
+
function TextField(props) {
|
|
773
|
+
const [local, ariaProps] = splitProps6(props, [
|
|
774
|
+
"children",
|
|
775
|
+
"class",
|
|
776
|
+
"style",
|
|
777
|
+
"slot"
|
|
778
|
+
]);
|
|
779
|
+
const state = createTextFieldState({
|
|
780
|
+
get value() {
|
|
781
|
+
return ariaProps.value;
|
|
782
|
+
},
|
|
783
|
+
get defaultValue() {
|
|
784
|
+
return ariaProps.defaultValue;
|
|
785
|
+
},
|
|
786
|
+
get onChange() {
|
|
787
|
+
return ariaProps.onChange;
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
const textFieldAria = createTextField(() => ({
|
|
791
|
+
...ariaProps,
|
|
792
|
+
value: state.value(),
|
|
793
|
+
onChange: state.setValue
|
|
794
|
+
}));
|
|
795
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing5();
|
|
796
|
+
const { isHovered, hoverProps } = createHover5({
|
|
797
|
+
get isDisabled() {
|
|
798
|
+
return ariaProps.isDisabled;
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
const renderValues = createMemo6(() => ({
|
|
802
|
+
isDisabled: ariaProps.isDisabled || false,
|
|
803
|
+
isInvalid: textFieldAria.isInvalid,
|
|
804
|
+
isReadOnly: ariaProps.isReadOnly || false,
|
|
805
|
+
isRequired: ariaProps.isRequired || false,
|
|
806
|
+
isHovered: isHovered(),
|
|
807
|
+
isFocused: isFocused(),
|
|
808
|
+
isFocusVisible: isFocusVisible()
|
|
809
|
+
}));
|
|
810
|
+
const renderProps = useRenderProps(
|
|
811
|
+
{
|
|
812
|
+
children: local.children,
|
|
813
|
+
class: local.class,
|
|
814
|
+
style: local.style,
|
|
815
|
+
defaultClassName: "solidaria-TextField"
|
|
816
|
+
},
|
|
817
|
+
renderValues
|
|
818
|
+
);
|
|
819
|
+
const domProps = createMemo6(() => {
|
|
820
|
+
const filtered = filterDOMProps(ariaProps, { global: true });
|
|
821
|
+
delete filtered.id;
|
|
822
|
+
return filtered;
|
|
823
|
+
});
|
|
824
|
+
const cleanHoverProps = () => {
|
|
825
|
+
const { ref: _ref, ...rest } = hoverProps;
|
|
826
|
+
return rest;
|
|
827
|
+
};
|
|
828
|
+
const contextValue = {
|
|
829
|
+
labelProps: textFieldAria.labelProps,
|
|
830
|
+
inputProps: { ...textFieldAria.inputProps, ...focusProps },
|
|
831
|
+
descriptionProps: textFieldAria.descriptionProps,
|
|
832
|
+
errorMessageProps: textFieldAria.errorMessageProps,
|
|
833
|
+
isInvalid: textFieldAria.isInvalid
|
|
834
|
+
};
|
|
835
|
+
return <TextFieldContext.Provider value={contextValue}>
|
|
836
|
+
<div
|
|
837
|
+
{...domProps()}
|
|
838
|
+
{...cleanHoverProps()}
|
|
839
|
+
class={renderProps().class}
|
|
840
|
+
style={renderProps().style}
|
|
841
|
+
data-disabled={ariaProps.isDisabled || void 0}
|
|
842
|
+
data-invalid={textFieldAria.isInvalid || void 0}
|
|
843
|
+
data-readonly={ariaProps.isReadOnly || void 0}
|
|
844
|
+
data-required={ariaProps.isRequired || void 0}
|
|
845
|
+
data-hovered={isHovered() || void 0}
|
|
846
|
+
data-focused={isFocused() || void 0}
|
|
847
|
+
data-focus-visible={isFocusVisible() || void 0}
|
|
848
|
+
>
|
|
849
|
+
{renderProps().children}
|
|
850
|
+
</div>
|
|
851
|
+
</TextFieldContext.Provider>;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// src/Link.tsx
|
|
855
|
+
import {
|
|
856
|
+
createContext as createContext7,
|
|
857
|
+
createMemo as createMemo7,
|
|
858
|
+
splitProps as splitProps7
|
|
859
|
+
} from "solid-js";
|
|
860
|
+
import { Dynamic as Dynamic2 } from "solid-js/web";
|
|
861
|
+
import {
|
|
862
|
+
createLink,
|
|
863
|
+
createFocusRing as createFocusRing6,
|
|
864
|
+
createHover as createHover6
|
|
865
|
+
} from "@proyecto-viviana/solidaria";
|
|
866
|
+
var LinkContext = createContext7(null);
|
|
867
|
+
function Link(props) {
|
|
868
|
+
const [local, ariaProps] = splitProps7(props, [
|
|
869
|
+
"children",
|
|
870
|
+
"class",
|
|
871
|
+
"style",
|
|
872
|
+
"slot",
|
|
873
|
+
"onHoverStart",
|
|
874
|
+
"onHoverEnd",
|
|
875
|
+
"onHoverChange"
|
|
876
|
+
]);
|
|
877
|
+
const elementType = () => {
|
|
878
|
+
if (ariaProps.href && !ariaProps.isDisabled) {
|
|
879
|
+
return "a";
|
|
880
|
+
}
|
|
881
|
+
return "span";
|
|
882
|
+
};
|
|
883
|
+
const linkAria = createLink({
|
|
884
|
+
get elementType() {
|
|
885
|
+
return elementType();
|
|
886
|
+
},
|
|
887
|
+
get isDisabled() {
|
|
888
|
+
return ariaProps.isDisabled;
|
|
889
|
+
},
|
|
890
|
+
get href() {
|
|
891
|
+
return ariaProps.href;
|
|
892
|
+
},
|
|
893
|
+
get target() {
|
|
894
|
+
return ariaProps.target;
|
|
895
|
+
},
|
|
896
|
+
get rel() {
|
|
897
|
+
return ariaProps.rel;
|
|
898
|
+
},
|
|
899
|
+
get onPress() {
|
|
900
|
+
return ariaProps.onPress;
|
|
901
|
+
},
|
|
902
|
+
get onPressStart() {
|
|
903
|
+
return ariaProps.onPressStart;
|
|
904
|
+
},
|
|
905
|
+
get onPressEnd() {
|
|
906
|
+
return ariaProps.onPressEnd;
|
|
907
|
+
},
|
|
908
|
+
get onClick() {
|
|
909
|
+
return ariaProps.onClick;
|
|
910
|
+
},
|
|
911
|
+
get onFocus() {
|
|
912
|
+
return ariaProps.onFocus;
|
|
913
|
+
},
|
|
914
|
+
get onBlur() {
|
|
915
|
+
return ariaProps.onBlur;
|
|
916
|
+
},
|
|
917
|
+
get onFocusChange() {
|
|
918
|
+
return ariaProps.onFocusChange;
|
|
919
|
+
},
|
|
920
|
+
get onKeyDown() {
|
|
921
|
+
return ariaProps.onKeyDown;
|
|
922
|
+
},
|
|
923
|
+
get onKeyUp() {
|
|
924
|
+
return ariaProps.onKeyUp;
|
|
925
|
+
},
|
|
926
|
+
get autoFocus() {
|
|
927
|
+
return ariaProps.autoFocus;
|
|
928
|
+
},
|
|
929
|
+
get "aria-current"() {
|
|
930
|
+
return ariaProps["aria-current"];
|
|
931
|
+
},
|
|
932
|
+
get "aria-label"() {
|
|
933
|
+
return ariaProps["aria-label"];
|
|
934
|
+
},
|
|
935
|
+
get "aria-labelledby"() {
|
|
936
|
+
return ariaProps["aria-labelledby"];
|
|
937
|
+
},
|
|
938
|
+
get "aria-describedby"() {
|
|
939
|
+
return ariaProps["aria-describedby"];
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing6();
|
|
943
|
+
const { isHovered, hoverProps } = createHover6({
|
|
944
|
+
get isDisabled() {
|
|
945
|
+
return ariaProps.isDisabled ?? false;
|
|
946
|
+
},
|
|
947
|
+
get onHoverStart() {
|
|
948
|
+
return local.onHoverStart;
|
|
949
|
+
},
|
|
950
|
+
get onHoverEnd() {
|
|
951
|
+
return local.onHoverEnd;
|
|
952
|
+
},
|
|
953
|
+
get onHoverChange() {
|
|
954
|
+
return local.onHoverChange;
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
const renderValues = createMemo7(() => ({
|
|
958
|
+
isCurrent: !!ariaProps["aria-current"],
|
|
959
|
+
isHovered: isHovered(),
|
|
960
|
+
isPressed: linkAria.isPressed(),
|
|
961
|
+
isFocused: isFocused(),
|
|
962
|
+
isFocusVisible: isFocusVisible(),
|
|
963
|
+
isDisabled: ariaProps.isDisabled ?? false
|
|
964
|
+
}));
|
|
965
|
+
const renderProps = useRenderProps(
|
|
966
|
+
{
|
|
967
|
+
children: local.children,
|
|
968
|
+
class: local.class,
|
|
969
|
+
style: local.style,
|
|
970
|
+
defaultClassName: "solidaria-Link"
|
|
971
|
+
},
|
|
972
|
+
renderValues
|
|
973
|
+
);
|
|
974
|
+
const domProps = createMemo7(() => filterDOMProps(ariaProps, { global: true }));
|
|
975
|
+
const cleanLinkProps = () => {
|
|
976
|
+
const { ref: _ref1, ...rest } = linkAria.linkProps;
|
|
977
|
+
return rest;
|
|
978
|
+
};
|
|
979
|
+
const cleanHoverProps = () => {
|
|
980
|
+
const { ref: _ref2, ...rest } = hoverProps;
|
|
981
|
+
return rest;
|
|
982
|
+
};
|
|
983
|
+
const cleanFocusProps = () => {
|
|
984
|
+
const { ref: _ref3, ...rest } = focusProps;
|
|
985
|
+
return rest;
|
|
986
|
+
};
|
|
987
|
+
return <Dynamic2
|
|
988
|
+
component={elementType()}
|
|
989
|
+
{...domProps()}
|
|
990
|
+
{...cleanLinkProps()}
|
|
991
|
+
{...cleanHoverProps()}
|
|
992
|
+
{...cleanFocusProps()}
|
|
993
|
+
class={renderProps().class}
|
|
994
|
+
style={renderProps().style}
|
|
995
|
+
data-hovered={isHovered() || void 0}
|
|
996
|
+
data-pressed={linkAria.isPressed() || void 0}
|
|
997
|
+
data-focused={isFocused() || void 0}
|
|
998
|
+
data-focus-visible={isFocusVisible() || void 0}
|
|
999
|
+
data-current={!!ariaProps["aria-current"] || void 0}
|
|
1000
|
+
data-disabled={ariaProps.isDisabled || void 0}
|
|
1001
|
+
>
|
|
1002
|
+
{renderProps().children}
|
|
1003
|
+
</Dynamic2>;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// src/ProgressBar.tsx
|
|
1007
|
+
import {
|
|
1008
|
+
createContext as createContext8,
|
|
1009
|
+
createMemo as createMemo8,
|
|
1010
|
+
splitProps as splitProps8
|
|
1011
|
+
} from "solid-js";
|
|
1012
|
+
import {
|
|
1013
|
+
createProgressBar
|
|
1014
|
+
} from "@proyecto-viviana/solidaria";
|
|
1015
|
+
var ProgressBarContext = createContext8(null);
|
|
1016
|
+
function clamp(value, min, max) {
|
|
1017
|
+
return Math.min(Math.max(value, min), max);
|
|
1018
|
+
}
|
|
1019
|
+
function ProgressBar(props) {
|
|
1020
|
+
const [local, ariaProps] = splitProps8(props, [
|
|
1021
|
+
"children",
|
|
1022
|
+
"class",
|
|
1023
|
+
"style",
|
|
1024
|
+
"slot"
|
|
1025
|
+
]);
|
|
1026
|
+
const value = () => ariaProps.value ?? 0;
|
|
1027
|
+
const minValue = () => ariaProps.minValue ?? 0;
|
|
1028
|
+
const maxValue = () => ariaProps.maxValue ?? 100;
|
|
1029
|
+
const isIndeterminate = () => ariaProps.isIndeterminate ?? false;
|
|
1030
|
+
const progressAria = createProgressBar({
|
|
1031
|
+
get value() {
|
|
1032
|
+
return ariaProps.value;
|
|
1033
|
+
},
|
|
1034
|
+
get minValue() {
|
|
1035
|
+
return ariaProps.minValue;
|
|
1036
|
+
},
|
|
1037
|
+
get maxValue() {
|
|
1038
|
+
return ariaProps.maxValue;
|
|
1039
|
+
},
|
|
1040
|
+
get valueLabel() {
|
|
1041
|
+
return ariaProps.valueLabel;
|
|
1042
|
+
},
|
|
1043
|
+
get isIndeterminate() {
|
|
1044
|
+
return ariaProps.isIndeterminate;
|
|
1045
|
+
},
|
|
1046
|
+
get formatOptions() {
|
|
1047
|
+
return ariaProps.formatOptions;
|
|
1048
|
+
},
|
|
1049
|
+
get label() {
|
|
1050
|
+
return ariaProps.label;
|
|
1051
|
+
},
|
|
1052
|
+
get "aria-label"() {
|
|
1053
|
+
return ariaProps["aria-label"];
|
|
1054
|
+
},
|
|
1055
|
+
get "aria-labelledby"() {
|
|
1056
|
+
return ariaProps["aria-labelledby"];
|
|
1057
|
+
},
|
|
1058
|
+
get "aria-describedby"() {
|
|
1059
|
+
return ariaProps["aria-describedby"];
|
|
1060
|
+
},
|
|
1061
|
+
get "aria-details"() {
|
|
1062
|
+
return ariaProps["aria-details"];
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
const percentage = createMemo8(() => {
|
|
1066
|
+
if (isIndeterminate()) {
|
|
1067
|
+
return void 0;
|
|
1068
|
+
}
|
|
1069
|
+
const clampedValue = clamp(value(), minValue(), maxValue());
|
|
1070
|
+
return (clampedValue - minValue()) / (maxValue() - minValue()) * 100;
|
|
1071
|
+
});
|
|
1072
|
+
const valueText = createMemo8(() => {
|
|
1073
|
+
return progressAria.progressBarProps["aria-valuetext"];
|
|
1074
|
+
});
|
|
1075
|
+
const renderValues = createMemo8(() => ({
|
|
1076
|
+
percentage: percentage(),
|
|
1077
|
+
valueText: valueText(),
|
|
1078
|
+
isIndeterminate: isIndeterminate()
|
|
1079
|
+
}));
|
|
1080
|
+
const renderProps = useRenderProps(
|
|
1081
|
+
{
|
|
1082
|
+
children: local.children,
|
|
1083
|
+
class: local.class,
|
|
1084
|
+
style: local.style,
|
|
1085
|
+
defaultClassName: "solidaria-ProgressBar"
|
|
1086
|
+
},
|
|
1087
|
+
renderValues
|
|
1088
|
+
);
|
|
1089
|
+
const domProps = createMemo8(() => filterDOMProps(ariaProps, { global: true }));
|
|
1090
|
+
return <div
|
|
1091
|
+
{...domProps()}
|
|
1092
|
+
{...progressAria.progressBarProps}
|
|
1093
|
+
class={renderProps().class}
|
|
1094
|
+
style={renderProps().style}
|
|
1095
|
+
slot={local.slot}
|
|
1096
|
+
>
|
|
1097
|
+
{renderProps().children}
|
|
1098
|
+
</div>;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
// src/Separator.tsx
|
|
1102
|
+
import {
|
|
1103
|
+
createContext as createContext9,
|
|
1104
|
+
createMemo as createMemo9,
|
|
1105
|
+
splitProps as splitProps9
|
|
1106
|
+
} from "solid-js";
|
|
1107
|
+
import { Dynamic as Dynamic3 } from "solid-js/web";
|
|
1108
|
+
import {
|
|
1109
|
+
createSeparator
|
|
1110
|
+
} from "@proyecto-viviana/solidaria";
|
|
1111
|
+
var SeparatorContext = createContext9(null);
|
|
1112
|
+
function Separator(props) {
|
|
1113
|
+
const [local, ariaProps] = splitProps9(props, [
|
|
1114
|
+
"class",
|
|
1115
|
+
"style",
|
|
1116
|
+
"slot"
|
|
1117
|
+
]);
|
|
1118
|
+
const elementType = createMemo9(() => {
|
|
1119
|
+
let element = ariaProps.elementType || "hr";
|
|
1120
|
+
if (element === "hr" && ariaProps.orientation === "vertical") {
|
|
1121
|
+
element = "div";
|
|
1122
|
+
}
|
|
1123
|
+
return element;
|
|
1124
|
+
});
|
|
1125
|
+
const separatorAria = createSeparator({
|
|
1126
|
+
get orientation() {
|
|
1127
|
+
return ariaProps.orientation;
|
|
1128
|
+
},
|
|
1129
|
+
get elementType() {
|
|
1130
|
+
return elementType();
|
|
1131
|
+
},
|
|
1132
|
+
get "aria-label"() {
|
|
1133
|
+
return ariaProps["aria-label"];
|
|
1134
|
+
},
|
|
1135
|
+
get "aria-labelledby"() {
|
|
1136
|
+
return ariaProps["aria-labelledby"];
|
|
1137
|
+
},
|
|
1138
|
+
get id() {
|
|
1139
|
+
return ariaProps.id;
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
const renderValues = createMemo9(() => ({
|
|
1143
|
+
orientation: ariaProps.orientation ?? "horizontal"
|
|
1144
|
+
}));
|
|
1145
|
+
const resolvedClass = createMemo9(() => {
|
|
1146
|
+
const cls = local.class;
|
|
1147
|
+
if (typeof cls === "function") {
|
|
1148
|
+
return cls(renderValues());
|
|
1149
|
+
}
|
|
1150
|
+
return cls ?? "solidaria-Separator";
|
|
1151
|
+
});
|
|
1152
|
+
const resolvedStyle = createMemo9(() => {
|
|
1153
|
+
const style = local.style;
|
|
1154
|
+
if (typeof style === "function") {
|
|
1155
|
+
return style(renderValues());
|
|
1156
|
+
}
|
|
1157
|
+
return style;
|
|
1158
|
+
});
|
|
1159
|
+
const domProps = createMemo9(() => filterDOMProps(ariaProps, { global: true }));
|
|
1160
|
+
return <Dynamic3
|
|
1161
|
+
component={elementType()}
|
|
1162
|
+
{...domProps()}
|
|
1163
|
+
{...separatorAria.separatorProps}
|
|
1164
|
+
class={resolvedClass()}
|
|
1165
|
+
style={resolvedStyle()}
|
|
1166
|
+
slot={local.slot}
|
|
1167
|
+
/>;
|
|
1168
|
+
}
|
|
1169
|
+
export {
|
|
1170
|
+
Button,
|
|
1171
|
+
ButtonContext,
|
|
1172
|
+
Checkbox,
|
|
1173
|
+
CheckboxContext,
|
|
1174
|
+
CheckboxGroup,
|
|
1175
|
+
CheckboxGroupContext,
|
|
1176
|
+
CheckboxGroupStateContext,
|
|
1177
|
+
Input,
|
|
1178
|
+
Label,
|
|
1179
|
+
Link,
|
|
1180
|
+
LinkContext,
|
|
1181
|
+
ProgressBar,
|
|
1182
|
+
ProgressBarContext,
|
|
1183
|
+
Radio,
|
|
1184
|
+
RadioContext,
|
|
1185
|
+
RadioGroup,
|
|
1186
|
+
RadioGroupContext,
|
|
1187
|
+
RadioGroupStateContext,
|
|
1188
|
+
Separator,
|
|
1189
|
+
SeparatorContext,
|
|
1190
|
+
TextArea,
|
|
1191
|
+
TextField,
|
|
1192
|
+
TextFieldContext,
|
|
1193
|
+
ToggleSwitch,
|
|
1194
|
+
ToggleSwitchContext,
|
|
1195
|
+
VisuallyHidden,
|
|
1196
|
+
createDataAttributes,
|
|
1197
|
+
dataAttr,
|
|
1198
|
+
filterDOMProps,
|
|
1199
|
+
removeDataAttributes,
|
|
1200
|
+
useRenderProps
|
|
1201
|
+
};
|