@pathscale/ui 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/dist/components/accordion/Accordion.css +24 -1
- package/dist/components/alert/Alert.css +11 -1
- package/dist/components/auth-field-group/AuthFieldGroup.css +11 -3
- package/dist/components/button/Button.css +37 -10
- package/dist/components/calendar/Calendar.generated.d.ts +19 -2
- package/dist/components/calendar/Calendar.generated.js +30 -23
- package/dist/components/calendar/index.d.ts +1 -1
- package/dist/components/card/Card.generated.d.ts +38 -2
- package/dist/components/card/Card.generated.js +99 -45
- package/dist/components/card/Card.interactions.d.ts +70 -0
- package/dist/components/card/Card.interactions.js +19 -0
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.generated.d.ts +23 -2
- package/dist/components/checkbox/Checkbox.generated.js +14 -6
- package/dist/components/collapsible/Collapsible.css +17 -1
- package/dist/components/color-wheel-flower/ColorWheelFlower.generated.d.ts +8 -0
- package/dist/components/color-wheel-flower/ColorWheelFlower.generated.js +14 -1
- package/dist/components/color-wheel-flower/colorWheelFlowerContext.d.ts +9 -2
- package/dist/components/color-wheel-flower/colorWheelFlowerContext.js +2 -4
- package/dist/components/connection-settings/ConnectionSettings.css +76 -0
- package/dist/components/connection-settings/ConnectionSettings.generated.d.ts +45 -0
- package/dist/components/connection-settings/ConnectionSettings.generated.js +300 -0
- package/dist/components/connection-settings/ConnectionSettings.recipe.d.ts +54 -0
- package/dist/components/connection-settings/ConnectionSettings.recipe.js +111 -0
- package/dist/components/connection-settings/index.d.ts +2 -0
- package/dist/components/connection-settings/index.js +1 -0
- package/dist/components/date-picker/DatePicker.generated.d.ts +3 -1
- package/dist/components/date-picker/DatePicker.generated.js +8 -5
- package/dist/components/date-range-picker/DateRangePicker.generated.d.ts +3 -1
- package/dist/components/date-range-picker/DateRangePicker.generated.js +9 -6
- package/dist/components/dialog/Dialog.generated.js +17 -79
- package/dist/components/drawer/Drawer.a11y.d.ts +1 -3
- package/dist/components/drawer/Drawer.a11y.js +2 -30
- package/dist/components/drawer/Drawer.generated.d.ts +24 -0
- package/dist/components/drawer/Drawer.generated.js +65 -58
- package/dist/components/grid/Grid.generated.js +3 -3
- package/dist/components/icon/Icon.generated.d.ts +15 -0
- package/dist/components/icon/Icon.generated.js +11 -2
- package/dist/components/immersive-landing/ImmersiveLanding.css +1 -1
- package/dist/components/immersive-landing/components/CookieConsent.interactions.d.ts +24 -0
- package/dist/components/immersive-landing/components/CookieConsent.interactions.js +2 -0
- package/dist/components/immersive-landing/components/CookieConsent.js +52 -47
- package/dist/components/immersive-landing/components/FirefoxPWABanner.js +10 -10
- package/dist/components/immersive-landing/types.d.ts +15 -0
- package/dist/components/input/Input.css +5 -3
- package/dist/components/input/Input.generated.js +6 -3
- package/dist/components/language-switcher/LanguageSwitcher.generated.js +1 -1
- package/dist/components/live-chat/LiveChatPanel.generated.js +2 -6
- package/dist/components/live-chat/LiveChatPanel.interactions.d.ts +21 -0
- package/dist/components/live-chat/LiveChatPanel.interactions.js +10 -0
- package/dist/components/password-field/PasswordField.generated.d.ts +9 -1
- package/dist/components/password-field/PasswordField.generated.js +2 -2
- package/dist/components/password-field/PasswordField.interactions.d.ts +2 -2
- package/dist/components/password-field/PasswordField.interactions.js +2 -2
- package/dist/components/popover/Popover.a11y.d.ts +47 -0
- package/dist/components/popover/Popover.a11y.js +19 -0
- package/dist/components/popover/Popover.generated.d.ts +26 -0
- package/dist/components/popover/Popover.generated.js +119 -46
- package/dist/components/radio/Radio.generated.d.ts +26 -2
- package/dist/components/radio/Radio.generated.js +9 -5
- package/dist/components/range-calendar/RangeCalendar.generated.d.ts +3 -1
- package/dist/components/range-calendar/RangeCalendar.generated.js +4 -1
- package/dist/components/select/Select.generated.js +5 -0
- package/dist/components/slider/Slider.generated.d.ts +14 -1
- package/dist/components/slider/Slider.generated.js +3 -2
- package/dist/components/switch/Switch.css +0 -3
- package/dist/components/switch/Switch.generated.d.ts +23 -2
- package/dist/components/switch/Switch.generated.js +21 -44
- package/dist/components/switch/Switch.recipe.d.ts +61 -38
- package/dist/components/switch/Switch.recipe.js +88 -68
- package/dist/components/table/MobileListView.generated.js +1 -1
- package/dist/components/text/Text.generated.d.ts +26 -1
- package/dist/components/text/Text.generated.js +14 -13
- package/dist/components/text/Text.recipe.d.ts +17 -5
- package/dist/components/text/Text.recipe.js +7 -13
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/theme-color-picker/ThemeColorPicker.generated.js +1 -1
- package/dist/hooks/connection/createConnectionSettings.d.ts +128 -0
- package/dist/hooks/connection/createConnectionSettings.js +211 -0
- package/dist/hooks/connection/index.d.ts +2 -0
- package/dist/hooks/connection/index.js +1 -0
- package/dist/hooks/date/date.names.d.ts +107 -0
- package/dist/hooks/date/date.names.js +74 -0
- package/dist/hooks/date/date.utils.d.ts +11 -1
- package/dist/hooks/date/date.utils.js +3 -6
- package/dist/hooks/date/index.d.ts +1 -0
- package/dist/hooks/date/index.js +1 -0
- package/dist/hooks/date/useCalendarState.d.ts +12 -5
- package/dist/hooks/date/useCalendarState.js +7 -19
- package/dist/hooks/form/createForm.d.ts +4 -4
- package/dist/hooks/form/createForm.js +7 -9
- package/dist/index.d.ts +8 -4
- package/dist/index.js +3 -1
- package/dist/layouts.manifest.json +4 -1
- package/dist/lib/focus.d.ts +31 -0
- package/dist/lib/focus.js +39 -0
- package/dist/lib/overlay.d.ts +94 -0
- package/dist/lib/overlay.js +72 -0
- package/dist/purge-manifest.json +14427 -15269
- package/dist/responsive-classes.txt +450 -0
- package/dist/styles/base/index.css +42 -0
- package/package.json +11 -6
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Portal, createComponent, insert, mergeProps, ref, spread, template } from "@solidjs/web";
|
|
1
|
+
import { Dynamic, Portal, createComponent, insert, memo, mergeProps, ref, spread, template } from "@solidjs/web";
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./Popover.css";
|
|
4
4
|
import { Show, createContext, createMemo, createSignal, createTrackedEffect, omit, onSettled, useContext } from "solid-js";
|
|
5
5
|
import { twMerge } from "../../lib/twMerge.js";
|
|
6
|
+
import { registerOverlay } from "../../lib/overlay.js";
|
|
6
7
|
import "../_shared/material.css";
|
|
7
8
|
import { applyBooleanStateRequest } from "../_shared/controlledState.js";
|
|
8
9
|
import { createOverlayPosition } from "../_shared/overlayPosition.js";
|
|
10
|
+
import { asAriaName, resolvePopoverDialogName } from "./Popover.a11y.js";
|
|
9
11
|
import { CLASSES, componentRecipe } from "./Popover.recipe.js";
|
|
10
12
|
var _tmpl$ = /*#__PURE__*/ template("<div>"), _tmpl$2 = /*#__PURE__*/ template("<button>"), _tmpl$3 = /*#__PURE__*/ template('<svg aria-hidden=true data-slot=popover-arrow-svg height=12 viewBox="0 0 12 12"width=12><path d="M0 0C5.48483 8 6.5 8 12 0Z"fill=currentColor>'), _tmpl$4 = /*#__PURE__*/ template("<span>"), _tmpl$5 = /*#__PURE__*/ template("<h3>");
|
|
11
13
|
const PopoverContext = createContext(null);
|
|
@@ -22,6 +24,8 @@ const __solidLayoutPopoverRoot = (_stable, p)=>{
|
|
|
22
24
|
const [triggerId] = createSignal(`popover-trigger-${Math.random().toString(36).slice(2, 8)}`);
|
|
23
25
|
const [contentId] = createSignal(`popover-content-${Math.random().toString(36).slice(2, 8)}`);
|
|
24
26
|
const [resolvedPlacement, setResolvedPlacement] = createSignal(p.placement ?? "bottom");
|
|
27
|
+
const [dialogLabel, setDialogLabel] = createSignal();
|
|
28
|
+
const [dialogLabelledBy, setDialogLabelledBy] = createSignal();
|
|
25
29
|
const isControlled = createMemo(()=>void 0 !== p.open);
|
|
26
30
|
const isOpen = createMemo(()=>isControlled() ? Boolean(p.open) : internalOpen());
|
|
27
31
|
const setIsOpen = (next, options)=>{
|
|
@@ -52,20 +56,22 @@ const __solidLayoutPopoverRoot = (_stable, p)=>{
|
|
|
52
56
|
focusTrigger: false
|
|
53
57
|
});
|
|
54
58
|
};
|
|
55
|
-
const handleKeyDown = (event)=>{
|
|
56
|
-
if (!isOpen()) return;
|
|
57
|
-
if (false === p.closeOnEscape) return;
|
|
58
|
-
if ("Escape" !== event.key) return;
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
setIsOpen(false, {
|
|
61
|
-
focusTrigger: true
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
59
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
65
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
66
60
|
return ()=>{
|
|
67
61
|
document.removeEventListener("pointerdown", handlePointerDown);
|
|
68
|
-
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
createTrackedEffect(()=>{
|
|
65
|
+
if (!isOpen()) return;
|
|
66
|
+
const releaseOverlay = registerOverlay({
|
|
67
|
+
dismissable: ()=>false !== p.closeOnEscape,
|
|
68
|
+
dismiss: ()=>setIsOpen(false, {
|
|
69
|
+
focusTrigger: true
|
|
70
|
+
}),
|
|
71
|
+
element: ()=>contentRef() ?? void 0
|
|
72
|
+
});
|
|
73
|
+
return ()=>{
|
|
74
|
+
releaseOverlay();
|
|
69
75
|
};
|
|
70
76
|
});
|
|
71
77
|
const ctx = {
|
|
@@ -83,7 +89,11 @@ const __solidLayoutPopoverRoot = (_stable, p)=>{
|
|
|
83
89
|
triggerId,
|
|
84
90
|
contentId,
|
|
85
91
|
offset,
|
|
86
|
-
onInteractOutside: p.onInteractOutside
|
|
92
|
+
onInteractOutside: p.onInteractOutside,
|
|
93
|
+
dialogLabel,
|
|
94
|
+
setDialogLabel,
|
|
95
|
+
dialogLabelledBy,
|
|
96
|
+
setDialogLabelledBy
|
|
87
97
|
};
|
|
88
98
|
return createComponent(PopoverContext, {
|
|
89
99
|
value: ctx,
|
|
@@ -124,7 +134,7 @@ const PopoverRoot = defineComponent({
|
|
|
124
134
|
]
|
|
125
135
|
});
|
|
126
136
|
const __solidLayoutPopoverTrigger = (_stable, p)=>{
|
|
127
|
-
const others = omit(p, "children", "class", "dataTheme", "style", "type", "onClick", "onKeyDown");
|
|
137
|
+
const others = omit(p, "children", "class", "dataTheme", "style", "type", "onClick", "onKeyDown", "as");
|
|
128
138
|
const ctx = usePopoverContext();
|
|
129
139
|
const handleClick = (event)=>{
|
|
130
140
|
if ("function" == typeof p.onClick) p.onClick(event);
|
|
@@ -141,44 +151,88 @@ const __solidLayoutPopoverTrigger = (_stable, p)=>{
|
|
|
141
151
|
});
|
|
142
152
|
}
|
|
143
153
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
get type () {
|
|
148
|
-
return p.type ?? "button";
|
|
149
|
-
},
|
|
150
|
-
get id () {
|
|
151
|
-
return ctx.triggerId();
|
|
152
|
-
}
|
|
153
|
-
}, ()=>({
|
|
154
|
-
class: twMerge(CLASSES.slot.trigger, p.class)
|
|
155
|
-
}), {
|
|
156
|
-
"data-slot": "popover-trigger",
|
|
157
|
-
get ["data-theme"] () {
|
|
158
|
-
return p.dataTheme;
|
|
159
|
-
},
|
|
160
|
-
get style () {
|
|
161
|
-
return p.style;
|
|
162
|
-
},
|
|
163
|
-
"aria-haspopup": "dialog",
|
|
164
|
-
get ["aria-expanded"] () {
|
|
165
|
-
return ctx.isOpen() ? "true" : "false";
|
|
154
|
+
return createComponent(Show, {
|
|
155
|
+
get when () {
|
|
156
|
+
return p.as;
|
|
166
157
|
},
|
|
167
|
-
get
|
|
168
|
-
|
|
158
|
+
get fallback () {
|
|
159
|
+
var _el$2 = _tmpl$2();
|
|
160
|
+
ref(()=>(el)=>ctx.setTriggerRef(el), _el$2);
|
|
161
|
+
spread(_el$2, mergeProps(others, {
|
|
162
|
+
get type () {
|
|
163
|
+
return p.type ?? "button";
|
|
164
|
+
},
|
|
165
|
+
get id () {
|
|
166
|
+
return ctx.triggerId();
|
|
167
|
+
}
|
|
168
|
+
}, ()=>({
|
|
169
|
+
class: twMerge(CLASSES.slot.trigger, p.class)
|
|
170
|
+
}), {
|
|
171
|
+
"data-slot": "popover-trigger",
|
|
172
|
+
get ["data-theme"] () {
|
|
173
|
+
return p.dataTheme;
|
|
174
|
+
},
|
|
175
|
+
get style () {
|
|
176
|
+
return p.style;
|
|
177
|
+
},
|
|
178
|
+
"aria-haspopup": "dialog",
|
|
179
|
+
get ["aria-expanded"] () {
|
|
180
|
+
return ctx.isOpen() ? "true" : "false";
|
|
181
|
+
},
|
|
182
|
+
get ["aria-controls"] () {
|
|
183
|
+
return ctx.isOpen() ? ctx.contentId() : void 0;
|
|
184
|
+
},
|
|
185
|
+
onClick: handleClick,
|
|
186
|
+
onKeyDown: handleKeyDown
|
|
187
|
+
}), true);
|
|
188
|
+
insert(_el$2, ()=>p.children);
|
|
189
|
+
return _el$2;
|
|
169
190
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
191
|
+
get children () {
|
|
192
|
+
return createComponent(Dynamic, mergeProps({
|
|
193
|
+
get component () {
|
|
194
|
+
return p.as;
|
|
195
|
+
}
|
|
196
|
+
}, others, {
|
|
197
|
+
ref: (el)=>ctx.setTriggerRef(el),
|
|
198
|
+
get type () {
|
|
199
|
+
return p.type ?? "button";
|
|
200
|
+
},
|
|
201
|
+
get id () {
|
|
202
|
+
return ctx.triggerId();
|
|
203
|
+
},
|
|
204
|
+
get ["class"] () {
|
|
205
|
+
return p.class;
|
|
206
|
+
},
|
|
207
|
+
get ["data-theme"] () {
|
|
208
|
+
return p.dataTheme;
|
|
209
|
+
},
|
|
210
|
+
get style () {
|
|
211
|
+
return p.style;
|
|
212
|
+
},
|
|
213
|
+
"aria-haspopup": "dialog",
|
|
214
|
+
get ["aria-expanded"] () {
|
|
215
|
+
return ctx.isOpen() ? "true" : "false";
|
|
216
|
+
},
|
|
217
|
+
get ["aria-controls"] () {
|
|
218
|
+
return memo(()=>!!ctx.isOpen())() ? ctx.contentId() : void 0;
|
|
219
|
+
},
|
|
220
|
+
onClick: handleClick,
|
|
221
|
+
onKeyDown: handleKeyDown,
|
|
222
|
+
get children () {
|
|
223
|
+
return p.children;
|
|
224
|
+
}
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
});
|
|
175
228
|
};
|
|
176
229
|
const PopoverTrigger = defineComponent({
|
|
177
230
|
recipe: componentRecipe,
|
|
178
231
|
layout: __solidLayoutPopoverTrigger,
|
|
179
232
|
embedded: true,
|
|
180
233
|
behaviour: [
|
|
181
|
-
"children"
|
|
234
|
+
"children",
|
|
235
|
+
"as"
|
|
182
236
|
]
|
|
183
237
|
});
|
|
184
238
|
const __solidLayoutPopoverContent = (_stable, p)=>{
|
|
@@ -197,6 +251,13 @@ const __solidLayoutPopoverContent = (_stable, p)=>{
|
|
|
197
251
|
createTrackedEffect(()=>{
|
|
198
252
|
ctx.setPlacement(overlayPosition.placement());
|
|
199
253
|
});
|
|
254
|
+
const dialogName = ()=>resolvePopoverDialogName({
|
|
255
|
+
contentLabel: asAriaName(p["aria-label"]),
|
|
256
|
+
contentLabelledBy: asAriaName(p["aria-labelledby"]),
|
|
257
|
+
dialogLabel: ctx.dialogLabel(),
|
|
258
|
+
dialogLabelledBy: ctx.dialogLabelledBy(),
|
|
259
|
+
triggerId: ctx.triggerRef() ? ctx.triggerId() : void 0
|
|
260
|
+
});
|
|
200
261
|
const style = ()=>{
|
|
201
262
|
const overlayStyle = overlayPosition.style();
|
|
202
263
|
if ("string" == typeof p.style) return [
|
|
@@ -244,8 +305,11 @@ const __solidLayoutPopoverContent = (_stable, p)=>{
|
|
|
244
305
|
get style () {
|
|
245
306
|
return style();
|
|
246
307
|
},
|
|
308
|
+
get ["aria-label"] () {
|
|
309
|
+
return dialogName()["aria-label"];
|
|
310
|
+
},
|
|
247
311
|
get ["aria-labelledby"] () {
|
|
248
|
-
return
|
|
312
|
+
return dialogName()["aria-labelledby"];
|
|
249
313
|
},
|
|
250
314
|
get ["aria-hidden"] () {
|
|
251
315
|
return ctx.isOpen() ? "false" : "true";
|
|
@@ -269,7 +333,16 @@ const PopoverContent = defineComponent({
|
|
|
269
333
|
]
|
|
270
334
|
});
|
|
271
335
|
const __solidLayoutPopoverDialog = (_stable, p)=>{
|
|
272
|
-
const others = omit(p, "children", "class", "dataTheme", "style");
|
|
336
|
+
const others = omit(p, "children", "class", "dataTheme", "style", "aria-label", "aria-labelledby");
|
|
337
|
+
const ctx = usePopoverContext();
|
|
338
|
+
createTrackedEffect(()=>{
|
|
339
|
+
ctx.setDialogLabel(asAriaName(p["aria-label"]));
|
|
340
|
+
return ()=>ctx.setDialogLabel(void 0);
|
|
341
|
+
});
|
|
342
|
+
createTrackedEffect(()=>{
|
|
343
|
+
ctx.setDialogLabelledBy(asAriaName(p["aria-labelledby"]));
|
|
344
|
+
return ()=>ctx.setDialogLabelledBy(void 0);
|
|
345
|
+
});
|
|
273
346
|
var _el$4 = _tmpl$();
|
|
274
347
|
spread(_el$4, mergeProps(others, ()=>({
|
|
275
348
|
class: twMerge(CLASSES.slot.dialog, p.class)
|
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
import type { Component as __LayoutComponent } from "solid-js";
|
|
2
2
|
import "./Radio.css";
|
|
3
3
|
import type { JSX } from "@solidjs/web";
|
|
4
|
-
import type {
|
|
5
|
-
export type RadioProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "type" | "children"> & UIBaseProps & {
|
|
4
|
+
import type { Issue, State, UIBaseProps } from "../vocabulary";
|
|
5
|
+
export type RadioProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "type" | "children" | "onChange"> & UIBaseProps & {
|
|
6
6
|
children?: JSX.Element;
|
|
7
7
|
description?: JSX.Element;
|
|
8
8
|
indicator?: JSX.Element;
|
|
9
9
|
state?: State;
|
|
10
10
|
issues?: Issue[];
|
|
11
|
+
/**
|
|
12
|
+
* Whether this radio is now the selected one.
|
|
13
|
+
*
|
|
14
|
+
* **Breaking in 3.1**, and the last control left out of it. Switch and
|
|
15
|
+
* Checkbox were changed to report their new value here while Radio was
|
|
16
|
+
* still handing over an `Event`, which is the inconsistency the change
|
|
17
|
+
* existed to remove -- swapping one control for another quietly changed
|
|
18
|
+
* what the handler received.
|
|
19
|
+
*
|
|
20
|
+
* A radio only ever reports `true`: deselection happens by another radio
|
|
21
|
+
* in the group being chosen, and that one reports itself. Reach for
|
|
22
|
+
* `RadioGroup`'s `onChange` when the question is which value is selected.
|
|
23
|
+
*
|
|
24
|
+
* The native handler is {@link onNativeChange}, and it is still where you
|
|
25
|
+
* call `preventDefault()`.
|
|
26
|
+
*/
|
|
27
|
+
onChange?: (checked: boolean) => void;
|
|
28
|
+
/**
|
|
29
|
+
* The underlying `change` event, before the selection is applied.
|
|
30
|
+
*
|
|
31
|
+
* This is the veto: `preventDefault()` here leaves the group as it was and
|
|
32
|
+
* suppresses {@link onChange}.
|
|
33
|
+
*/
|
|
34
|
+
onNativeChange?: JSX.EventHandlerUnion<HTMLInputElement, Event>;
|
|
11
35
|
};
|
|
12
36
|
declare const Radio: __LayoutComponent<RadioProps>;
|
|
13
37
|
export default Radio;
|
|
@@ -4,8 +4,8 @@ import "./Radio.css";
|
|
|
4
4
|
import { Show, omit, useContext } from "solid-js";
|
|
5
5
|
import { twMerge } from "../../lib/twMerge.js";
|
|
6
6
|
import { RadioGroupContext } from "../radio-group/context.js";
|
|
7
|
-
import { CLASSES, componentRecipe } from "./Radio.recipe.js";
|
|
8
7
|
import { resolveState } from "../vocabulary.js";
|
|
8
|
+
import { CLASSES, componentRecipe } from "./Radio.recipe.js";
|
|
9
9
|
var _tmpl$ = /*#__PURE__*/ template("<span data-slot=label>"), _tmpl$2 = /*#__PURE__*/ template("<span>"), _tmpl$3 = /*#__PURE__*/ template("<span><!><!>"), _tmpl$4 = /*#__PURE__*/ template("<label><input><span><span>");
|
|
10
10
|
const invokeEventHandler = (handler, event)=>{
|
|
11
11
|
if ("function" == typeof handler) return void handler(event);
|
|
@@ -13,7 +13,7 @@ const invokeEventHandler = (handler, event)=>{
|
|
|
13
13
|
};
|
|
14
14
|
const __solidLayoutRadio = (_stable, p)=>{
|
|
15
15
|
const group = useContext(RadioGroupContext);
|
|
16
|
-
const others = omit(p, "class", "children", "description", "indicator", "state", "issues", "disabled", "checked", "value", "name", "onChange", "dataTheme", "aria-invalid");
|
|
16
|
+
const others = omit(p, "class", "children", "description", "indicator", "state", "issues", "disabled", "checked", "value", "name", "onChange", "onNativeChange", "dataTheme", "aria-invalid");
|
|
17
17
|
const value = ()=>null != p.value ? String(p.value) : void 0;
|
|
18
18
|
const isGrouped = ()=>Boolean(group && void 0 !== value());
|
|
19
19
|
const isSelected = ()=>isGrouped() ? group?.value() === value() : Boolean(p.checked);
|
|
@@ -23,9 +23,11 @@ const __solidLayoutRadio = (_stable, p)=>{
|
|
|
23
23
|
const ariaInvalid = ()=>p["aria-invalid"] ?? (isInvalid() ? true : void 0);
|
|
24
24
|
const hasContent = ()=>null != p.children || null != p.description;
|
|
25
25
|
const handleChange = (event)=>{
|
|
26
|
-
invokeEventHandler(p.
|
|
26
|
+
invokeEventHandler(p.onNativeChange, event);
|
|
27
27
|
if (event.defaultPrevented) return;
|
|
28
|
-
|
|
28
|
+
const checked = event.currentTarget.checked;
|
|
29
|
+
if (checked && group && void 0 !== value()) group.selectValue(value(), event);
|
|
30
|
+
p.onChange?.(checked);
|
|
29
31
|
};
|
|
30
32
|
var _el$ = _tmpl$4(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild;
|
|
31
33
|
spread(_el$, mergeProps(()=>({
|
|
@@ -133,7 +135,9 @@ const Radio = defineComponent({
|
|
|
133
135
|
"description",
|
|
134
136
|
"indicator",
|
|
135
137
|
"state",
|
|
136
|
-
"issues"
|
|
138
|
+
"issues",
|
|
139
|
+
"onChange",
|
|
140
|
+
"onNativeChange"
|
|
137
141
|
]
|
|
138
142
|
});
|
|
139
143
|
const Radio_generated = Radio;
|
|
@@ -2,7 +2,7 @@ import type { Component as __LayoutComponent } from "solid-js";
|
|
|
2
2
|
import "./RangeCalendar.css";
|
|
3
3
|
import type { JSX } from "@solidjs/web";
|
|
4
4
|
import { type ControlledDateRangeValue } from "../../hooks/date";
|
|
5
|
-
import { type CalendarWeekdayFormat } from "../calendar";
|
|
5
|
+
import { type CalendarWeekdayFormat, type DateNames } from "../calendar";
|
|
6
6
|
import type { UIBaseProps, State } from "../vocabulary";
|
|
7
7
|
export type RangeCalendarValue = ControlledDateRangeValue;
|
|
8
8
|
type RangeCalendarBaseProps = {
|
|
@@ -10,6 +10,8 @@ type RangeCalendarBaseProps = {
|
|
|
10
10
|
defaultValue?: RangeCalendarValue;
|
|
11
11
|
onChange?: (value: RangeCalendarValue) => void;
|
|
12
12
|
locale?: string;
|
|
13
|
+
/** Month and weekday names for a language other than English. See `Calendar`. */
|
|
14
|
+
dateNames?: DateNames;
|
|
13
15
|
weekdayFormat?: CalendarWeekdayFormat;
|
|
14
16
|
minValue?: Date;
|
|
15
17
|
maxValue?: Date;
|
|
@@ -8,7 +8,7 @@ import calendar from "../calendar/index.js";
|
|
|
8
8
|
import { CLASSES, componentRecipe } from "./RangeCalendar.recipe.js";
|
|
9
9
|
var _tmpl$ = /*#__PURE__*/ template("<div>");
|
|
10
10
|
const __solidLayoutRangeCalendar = (_stable, p)=>{
|
|
11
|
-
const others = omit(p, "class", "dataTheme", "style", "ref", "value", "defaultValue", "onChange", "locale", "weekdayFormat", "minValue", "maxValue", "isDateUnavailable", "showOutsideDays", "state", "disabled", "onDaySelect", "onDayHover");
|
|
11
|
+
const others = omit(p, "class", "dataTheme", "style", "ref", "value", "defaultValue", "onChange", "locale", "dateNames", "weekdayFormat", "minValue", "maxValue", "isDateUnavailable", "showOutsideDays", "state", "disabled", "onDaySelect", "onDayHover");
|
|
12
12
|
const isDisabled = createMemo(()=>Boolean("disabled" === p.state) || Boolean(p.disabled));
|
|
13
13
|
const rangeSelection = useRangeSelection({
|
|
14
14
|
value: ()=>p.value,
|
|
@@ -63,6 +63,9 @@ const __solidLayoutRangeCalendar = (_stable, p)=>{
|
|
|
63
63
|
get locale () {
|
|
64
64
|
return p.locale;
|
|
65
65
|
},
|
|
66
|
+
get dateNames () {
|
|
67
|
+
return p.dateNames;
|
|
68
|
+
},
|
|
66
69
|
get weekdayFormat () {
|
|
67
70
|
return p.weekdayFormat;
|
|
68
71
|
},
|
|
@@ -58,7 +58,12 @@ const __solidLayoutSelectRoot = (_stable, p)=>{
|
|
|
58
58
|
const open = ()=>void 0 !== p.open ? Boolean(p.open) : internalOpen();
|
|
59
59
|
const placement = ()=>p.placement ?? "bottom";
|
|
60
60
|
const autoFlip = ()=>p.autoFlip ?? true;
|
|
61
|
+
const assertOneControlSource = ()=>{
|
|
62
|
+
if (void 0 !== p.selectedKeys && void 0 !== p.value) throw new Error("Select received both `value` and `selectedKeys`. They are competing control sources; pass exactly one. Use `selectedKeys` for multiple selection, `value` for single.");
|
|
63
|
+
if (void 0 !== p.defaultSelectedKeys && void 0 !== p.defaultValue) throw new Error("Select received both `defaultValue` and `defaultSelectedKeys`. Pass exactly one.");
|
|
64
|
+
};
|
|
61
65
|
const selectedKeys = createMemo(()=>{
|
|
66
|
+
assertOneControlSource();
|
|
62
67
|
const controlledValue = void 0 !== p.selectedKeys ? p.selectedKeys : p.value;
|
|
63
68
|
if (void 0 !== controlledValue) return normalizeSelection(selectionMode(), controlledValue);
|
|
64
69
|
return normalizeSelection(selectionMode(), internalSelectedKeys());
|
|
@@ -18,6 +18,19 @@ type SliderBaseProps = {
|
|
|
18
18
|
class?: string;
|
|
19
19
|
style?: JSX.CSSProperties;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Pass-through is div attributes, because that is what this renders.
|
|
23
|
+
*
|
|
24
|
+
* It declared `JSX.InputHTMLAttributes<HTMLInputElement>` and there is no
|
|
25
|
+
* `<input>` anywhere in the component: the semantic element is a `div` with
|
|
26
|
+
* `role="slider"`, and the value comes from `aria-valuenow`. So the type
|
|
27
|
+
* offered `min`, `max`, `step`, `form`, `checked` and the rest of the input
|
|
28
|
+
* surface, none of which had anywhere to go — on top of nothing being
|
|
29
|
+
* forwarded at all, which is the reason this was noticed.
|
|
30
|
+
*
|
|
31
|
+
* Narrowed to the element that exists. `min`/`max`/`step` remain as this
|
|
32
|
+
* component's own props above, where they are actually read.
|
|
33
|
+
*/
|
|
34
|
+
export type SliderProps = SliderBaseProps & UIBaseProps & Omit<JSX.HTMLAttributes<HTMLDivElement>, keyof SliderBaseProps>;
|
|
22
35
|
declare const Slider: __LayoutComponent<SliderProps>;
|
|
23
36
|
export default Slider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent, insert, mergeProps, ref, spread, template } from "@solidjs/web";
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./Slider.css";
|
|
4
|
-
import { Show, createSignal, createUniqueId } from "solid-js";
|
|
4
|
+
import { Show, createSignal, createUniqueId, omit } from "solid-js";
|
|
5
5
|
import { twMerge } from "../../lib/twMerge.js";
|
|
6
6
|
import { createSliderInteractionHandlers } from "./Slider.interactions.js";
|
|
7
7
|
import { CLASSES, componentRecipe } from "./Slider.recipe.js";
|
|
@@ -16,6 +16,7 @@ function snapToStep(val, min, max, step) {
|
|
|
16
16
|
const __solidLayoutSlider = (_stable, p)=>{
|
|
17
17
|
let trackRef;
|
|
18
18
|
let thumbRef;
|
|
19
|
+
const others = omit(p, "label", "value", "onChange", "onChangeEnd", "min", "max", "step", "disabled", "formatValue", "size", "dataTheme", "class", "style", "id", "aria-label");
|
|
19
20
|
const min = ()=>p.min ?? 0;
|
|
20
21
|
const max = ()=>p.max ?? 100;
|
|
21
22
|
const step = ()=>p.step ?? 1;
|
|
@@ -189,7 +190,7 @@ const __solidLayoutSlider = (_stable, p)=>{
|
|
|
189
190
|
}), false);
|
|
190
191
|
var _ref$2 = thumbRef;
|
|
191
192
|
"function" == typeof _ref$2 || Array.isArray(_ref$2) ? ref(()=>_ref$2, _el$6) : thumbRef = _el$6;
|
|
192
|
-
spread(_el$6, mergeProps({
|
|
193
|
+
spread(_el$6, mergeProps(others, {
|
|
193
194
|
get id () {
|
|
194
195
|
return p.id;
|
|
195
196
|
}
|
|
@@ -219,13 +219,11 @@
|
|
|
219
219
|
|
|
220
220
|
/* ── Disabled state ── */
|
|
221
221
|
|
|
222
|
-
.switch--disabled,
|
|
223
222
|
.switch[data-disabled="true"] {
|
|
224
223
|
cursor: not-allowed;
|
|
225
224
|
opacity: 0.55;
|
|
226
225
|
}
|
|
227
226
|
|
|
228
|
-
.switch--disabled .switch__thumb,
|
|
229
227
|
.switch[data-disabled="true"] .switch__thumb {
|
|
230
228
|
background-color: color-mix(
|
|
231
229
|
in oklab,
|
|
@@ -234,7 +232,6 @@
|
|
|
234
232
|
);
|
|
235
233
|
}
|
|
236
234
|
|
|
237
|
-
.switch--disabled[data-selected="true"] .switch__thumb,
|
|
238
235
|
.switch[data-disabled="true"][data-selected="true"] .switch__thumb {
|
|
239
236
|
opacity: 0.4;
|
|
240
237
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Component as __LayoutComponent } from "solid-js";
|
|
2
2
|
import "./Switch.css";
|
|
3
3
|
import type { JSX } from "@solidjs/web";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Flavor, State, UIBaseProps } from "../vocabulary";
|
|
5
5
|
export type ToggleColor = "default" | "accent" | "success" | "warning" | "danger";
|
|
6
6
|
export type ToggleSize = "sm" | "md" | "lg";
|
|
7
|
-
export type ToggleProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "type" | "children" | "color"> & UIBaseProps & {
|
|
7
|
+
export type ToggleProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "type" | "children" | "color" | "onChange"> & UIBaseProps & {
|
|
8
8
|
defaultChecked?: boolean;
|
|
9
9
|
children?: JSX.Element;
|
|
10
10
|
description?: JSX.Element;
|
|
@@ -12,6 +12,27 @@ export type ToggleProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "type"
|
|
|
12
12
|
state?: State;
|
|
13
13
|
flavor?: Flavor;
|
|
14
14
|
size?: ToggleSize;
|
|
15
|
+
/**
|
|
16
|
+
* The new checked state.
|
|
17
|
+
*
|
|
18
|
+
* **Breaking in 3.1.** This used to be the input's native `onChange`, so it
|
|
19
|
+
* handed you an `Event` while `Slider`, `RadioGroup` and `CheckboxGroup`
|
|
20
|
+
* handed you a value. One name meant two things depending on which control
|
|
21
|
+
* you reached for, which made swapping one field for another quietly
|
|
22
|
+
* dangerous. Every control in the library now reports its new value here.
|
|
23
|
+
*
|
|
24
|
+
* The native handler has not gone away: it is {@link onNativeChange}, and
|
|
25
|
+
* it is still where you call `preventDefault()`.
|
|
26
|
+
*/
|
|
27
|
+
onChange?: (checked: boolean) => void;
|
|
28
|
+
/**
|
|
29
|
+
* The underlying `change` event, before the toggle is applied.
|
|
30
|
+
*
|
|
31
|
+
* This is the veto: `preventDefault()` here leaves the switch as it was and
|
|
32
|
+
* suppresses {@link onChange}. Reach for it when you need the event itself;
|
|
33
|
+
* for the value, use `onChange`.
|
|
34
|
+
*/
|
|
35
|
+
onNativeChange?: JSX.EventHandlerUnion<HTMLInputElement, Event>;
|
|
15
36
|
};
|
|
16
37
|
declare const Switch: __LayoutComponent<ToggleProps>;
|
|
17
38
|
export default Switch;
|
|
@@ -2,36 +2,32 @@ import { createComponent, insert, mergeProps, spread, template } from "@solidjs/
|
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./Switch.css";
|
|
4
4
|
import { Show, createSignal, omit } from "solid-js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
var _tmpl$ = /*#__PURE__*/ template("<span>"), _tmpl$2 = /*#__PURE__*/ template("<span data-slot=label>"), _tmpl$3 = /*#__PURE__*/ template("<span><!><!>"), _tmpl$4 = /*#__PURE__*/ template("<label><input><span><span>");
|
|
5
|
+
import { componentRecipe } from "./Switch.recipe.js";
|
|
6
|
+
var _tmpl$ = /*#__PURE__*/ template("<span>"), _tmpl$2 = /*#__PURE__*/ template("<span><!><!>"), _tmpl$3 = /*#__PURE__*/ template("<label><input><span><span>");
|
|
8
7
|
const invokeEventHandler = (handler, event)=>{
|
|
9
8
|
if ("function" == typeof handler) return void handler(event);
|
|
10
9
|
if (Array.isArray(handler) && "function" == typeof handler[0]) handler[0](handler[1], event);
|
|
11
10
|
};
|
|
12
11
|
const __solidLayoutSwitch = (_stable, p)=>{
|
|
13
|
-
const others = omit(p, "class", "children", "description", "icon", "state", "flavor", "size", "checked", "defaultChecked", "disabled", "onChange", "dataTheme");
|
|
12
|
+
const others = omit(p, "class", "onNativeChange", "children", "description", "icon", "state", "flavor", "size", "checked", "defaultChecked", "disabled", "onChange", "dataTheme");
|
|
14
13
|
const [internalSelected, setInternalSelected] = createSignal(Boolean(p.defaultChecked));
|
|
15
14
|
const isControlled = ()=>void 0 !== p.checked;
|
|
16
15
|
const isSelected = ()=>isControlled() ? Boolean(p.checked) : internalSelected();
|
|
17
16
|
const isDisabled = ()=>Boolean("disabled" === p.state) || Boolean(p.disabled);
|
|
18
|
-
const color = ()=>p.flavor ?? "accent";
|
|
19
|
-
const size = ()=>p.size ?? "md";
|
|
20
17
|
const hasContent = ()=>null != p.children || null != p.description;
|
|
21
18
|
const handleChange = (event)=>{
|
|
22
|
-
invokeEventHandler(p.
|
|
19
|
+
invokeEventHandler(p.onNativeChange, event);
|
|
23
20
|
if (event.defaultPrevented) return;
|
|
24
21
|
if (isDisabled()) return;
|
|
25
|
-
|
|
22
|
+
const checked = event.currentTarget.checked;
|
|
23
|
+
if (!isControlled()) setInternalSelected(checked);
|
|
24
|
+
p.onChange?.(checked);
|
|
26
25
|
};
|
|
27
|
-
var _el$ = _tmpl$
|
|
28
|
-
spread(_el$, mergeProps(()=>
|
|
29
|
-
class: twMerge(CLASSES.base, CLASSES.size[size()], CLASSES.flavor[color()] ?? `switch--flavor-${color()}`, isDisabled() && CLASSES.flag.disabled, p.class)
|
|
30
|
-
}), {
|
|
26
|
+
var _el$ = _tmpl$3(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild;
|
|
27
|
+
spread(_el$, mergeProps(()=>_stable.slot.root, {
|
|
31
28
|
get ["data-theme"] () {
|
|
32
29
|
return p.dataTheme;
|
|
33
30
|
},
|
|
34
|
-
"data-slot": "switch",
|
|
35
31
|
get ["data-selected"] () {
|
|
36
32
|
return isSelected() ? "true" : "false";
|
|
37
33
|
},
|
|
@@ -45,10 +41,7 @@ const __solidLayoutSwitch = (_stable, p)=>{
|
|
|
45
41
|
spread(_el$2, mergeProps(others, {
|
|
46
42
|
type: "checkbox",
|
|
47
43
|
role: "switch"
|
|
48
|
-
}, ()=>
|
|
49
|
-
class: CLASSES.slot.input
|
|
50
|
-
}), {
|
|
51
|
-
"data-slot": "switch-input",
|
|
44
|
+
}, ()=>_stable.slot.input, {
|
|
52
45
|
get checked () {
|
|
53
46
|
return isSelected();
|
|
54
47
|
},
|
|
@@ -57,28 +50,17 @@ const __solidLayoutSwitch = (_stable, p)=>{
|
|
|
57
50
|
},
|
|
58
51
|
onChange: handleChange
|
|
59
52
|
}), false);
|
|
60
|
-
spread(_el$3, mergeProps(()=>
|
|
61
|
-
class: CLASSES.slot.control
|
|
62
|
-
}), {
|
|
63
|
-
"data-slot": "switch-control",
|
|
53
|
+
spread(_el$3, mergeProps(()=>_stable.slot.control, {
|
|
64
54
|
"aria-hidden": "true"
|
|
65
55
|
}), true);
|
|
66
|
-
spread(_el$4, mergeProps(()=>
|
|
67
|
-
class: CLASSES.slot.thumb
|
|
68
|
-
}), {
|
|
69
|
-
"data-slot": "switch-thumb"
|
|
70
|
-
}), true);
|
|
56
|
+
spread(_el$4, mergeProps(()=>_stable.slot.thumb), true);
|
|
71
57
|
insert(_el$4, createComponent(Show, {
|
|
72
58
|
get when () {
|
|
73
59
|
return p.icon;
|
|
74
60
|
},
|
|
75
61
|
get children () {
|
|
76
62
|
var _el$5 = _tmpl$();
|
|
77
|
-
spread(_el$5, mergeProps(()=>
|
|
78
|
-
class: CLASSES.slot.icon
|
|
79
|
-
}), {
|
|
80
|
-
"data-slot": "switch-icon"
|
|
81
|
-
}), true);
|
|
63
|
+
spread(_el$5, mergeProps(()=>_stable.slot.icon), true);
|
|
82
64
|
insert(_el$5, ()=>p.icon);
|
|
83
65
|
return _el$5;
|
|
84
66
|
}
|
|
@@ -88,18 +70,15 @@ const __solidLayoutSwitch = (_stable, p)=>{
|
|
|
88
70
|
return hasContent();
|
|
89
71
|
},
|
|
90
72
|
get children () {
|
|
91
|
-
var _el$6 = _tmpl$
|
|
92
|
-
spread(_el$6, mergeProps(()=>
|
|
93
|
-
class: CLASSES.slot.content
|
|
94
|
-
}), {
|
|
95
|
-
"data-slot": "switch-content"
|
|
96
|
-
}), true);
|
|
73
|
+
var _el$6 = _tmpl$2(), _el$9 = _el$6.firstChild, _el$0 = _el$9.nextSibling;
|
|
74
|
+
spread(_el$6, mergeProps(()=>_stable.slot.content), true);
|
|
97
75
|
insert(_el$6, createComponent(Show, {
|
|
98
76
|
get when () {
|
|
99
77
|
return p.children;
|
|
100
78
|
},
|
|
101
79
|
get children () {
|
|
102
|
-
var _el$7 = _tmpl$
|
|
80
|
+
var _el$7 = _tmpl$();
|
|
81
|
+
spread(_el$7, mergeProps(()=>_stable.slot.label), true);
|
|
103
82
|
insert(_el$7, ()=>p.children);
|
|
104
83
|
return _el$7;
|
|
105
84
|
}
|
|
@@ -110,11 +89,7 @@ const __solidLayoutSwitch = (_stable, p)=>{
|
|
|
110
89
|
},
|
|
111
90
|
get children () {
|
|
112
91
|
var _el$8 = _tmpl$();
|
|
113
|
-
spread(_el$8, mergeProps(()=>
|
|
114
|
-
class: CLASSES.slot.description
|
|
115
|
-
}), {
|
|
116
|
-
"data-slot": "description"
|
|
117
|
-
}), true);
|
|
92
|
+
spread(_el$8, mergeProps(()=>_stable.slot.description), true);
|
|
118
93
|
insert(_el$8, ()=>p.description);
|
|
119
94
|
return _el$8;
|
|
120
95
|
}
|
|
@@ -135,7 +110,9 @@ const Switch = defineComponent({
|
|
|
135
110
|
"icon",
|
|
136
111
|
"state",
|
|
137
112
|
"flavor",
|
|
138
|
-
"size"
|
|
113
|
+
"size",
|
|
114
|
+
"onChange",
|
|
115
|
+
"onNativeChange"
|
|
139
116
|
]
|
|
140
117
|
});
|
|
141
118
|
const Switch_generated = Switch;
|