@pathscale/ui 2.12.0 → 3.1.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/dist/components/auth-field-group/AuthFieldGroup.css +11 -3
- package/dist/components/button/Button.css +4 -4
- package/dist/components/card/Card.generated.d.ts +21 -2
- 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/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/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.js +17 -40
- package/dist/components/grid/Grid.generated.js +3 -3
- package/dist/components/input/Input.css +5 -3
- package/dist/components/input/Input.generated.js +6 -3
- 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.generated.js +14 -11
- package/dist/components/radio/Radio.generated.d.ts +26 -2
- package/dist/components/radio/Radio.generated.js +9 -5
- 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/text/Text.generated.js +2 -6
- package/dist/components/text/Text.recipe.d.ts +17 -5
- package/dist/components/text/Text.recipe.js +7 -13
- 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/data/createMutation.d.ts +7 -6
- package/dist/hooks/data/createMutation.js +12 -3
- package/dist/hooks/data/createQuery.d.ts +31 -6
- package/dist/hooks/data/createQuery.js +21 -4
- package/dist/hooks/data/createQuery.test.js +41 -14
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/layouts.manifest.json +1 -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/styles/base/index.css +42 -0
- package/package.json +3 -3
|
@@ -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;
|
|
@@ -1,43 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly accent: "switch--flavor-accent";
|
|
16
|
-
readonly destructive: "switch--flavor-destructive";
|
|
17
|
-
readonly success: "switch--flavor-success";
|
|
18
|
-
readonly warning: "switch--flavor-warning";
|
|
19
|
-
readonly info: "switch--flavor-info";
|
|
20
|
-
};
|
|
21
|
-
readonly size: {
|
|
22
|
-
readonly sm: "switch--sm";
|
|
23
|
-
readonly md: "switch--md";
|
|
24
|
-
readonly lg: "switch--lg";
|
|
25
|
-
};
|
|
26
|
-
readonly flag: {
|
|
27
|
-
readonly disabled: "switch--disabled";
|
|
28
|
-
};
|
|
29
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Presentation, owned here rather than assembled in the component.
|
|
3
|
+
*
|
|
4
|
+
* The recipe declared nine empty slots while `Switch.layout.tsx` kept a
|
|
5
|
+
* `CLASSES` table and built the root's class with `twMerge` over base, size,
|
|
6
|
+
* flavor and a disabled flag. The slot names it declared did not match what the
|
|
7
|
+
* component rendered either -- `label` and `switch` were never used, and the
|
|
8
|
+
* classes lived somewhere else entirely.
|
|
9
|
+
*
|
|
10
|
+
* `flavor` and `size` are call-site props. `disabled` is computed from
|
|
11
|
+
* `props.disabled`, `props.state` and the enclosing group, so it is `state`:
|
|
12
|
+
* the compiler mirrors it to `data-disabled`, which is what the component was
|
|
13
|
+
* already setting by hand alongside the class.
|
|
14
|
+
*/
|
|
30
15
|
export declare const componentRecipe: import("solid-layouts/solid-2").Recipe<{
|
|
31
16
|
readonly component: "switch";
|
|
17
|
+
readonly element: "label";
|
|
32
18
|
readonly slots: {
|
|
33
|
-
readonly
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
readonly
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
readonly
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
readonly root: {
|
|
20
|
+
readonly base: "switch";
|
|
21
|
+
};
|
|
22
|
+
readonly input: {
|
|
23
|
+
readonly base: "switch__input";
|
|
24
|
+
};
|
|
25
|
+
readonly control: {
|
|
26
|
+
readonly base: "switch__control";
|
|
27
|
+
};
|
|
28
|
+
readonly thumb: {
|
|
29
|
+
readonly base: "switch__thumb";
|
|
30
|
+
};
|
|
31
|
+
readonly icon: {
|
|
32
|
+
readonly base: "switch__icon";
|
|
33
|
+
};
|
|
34
|
+
readonly content: {
|
|
35
|
+
readonly base: "switch__content";
|
|
36
|
+
};
|
|
37
|
+
readonly label: {
|
|
38
|
+
readonly slot: "label";
|
|
39
|
+
};
|
|
40
|
+
readonly description: {
|
|
41
|
+
readonly base: "switch__description";
|
|
42
|
+
readonly slot: "description";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly props: {
|
|
46
|
+
readonly flavor: {
|
|
47
|
+
readonly neutral: "switch--flavor-neutral";
|
|
48
|
+
readonly primary: "switch--flavor-primary";
|
|
49
|
+
readonly secondary: "switch--flavor-secondary";
|
|
50
|
+
readonly accent: "switch--flavor-accent";
|
|
51
|
+
readonly destructive: "switch--flavor-destructive";
|
|
52
|
+
readonly success: "switch--flavor-success";
|
|
53
|
+
readonly warning: "switch--flavor-warning";
|
|
54
|
+
readonly info: "switch--flavor-info";
|
|
55
|
+
};
|
|
56
|
+
readonly size: {
|
|
57
|
+
readonly sm: "switch--sm";
|
|
58
|
+
readonly md: "switch--md";
|
|
59
|
+
readonly lg: "switch--lg";
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly defaults: {
|
|
63
|
+
readonly flavor: "accent";
|
|
64
|
+
readonly size: "md";
|
|
42
65
|
};
|
|
43
66
|
}>;
|
|
@@ -1,97 +1,117 @@
|
|
|
1
1
|
import { recipe } from "../../lib/layouts/index.js";
|
|
2
|
-
const CLASSES = {
|
|
3
|
-
base: "switch",
|
|
4
|
-
slot: {
|
|
5
|
-
input: "switch__input",
|
|
6
|
-
control: "switch__control",
|
|
7
|
-
thumb: "switch__thumb",
|
|
8
|
-
icon: "switch__icon",
|
|
9
|
-
content: "switch__content",
|
|
10
|
-
description: "switch__description"
|
|
11
|
-
},
|
|
12
|
-
flavor: {
|
|
13
|
-
neutral: "switch--flavor-neutral",
|
|
14
|
-
primary: "switch--flavor-primary",
|
|
15
|
-
secondary: "switch--flavor-secondary",
|
|
16
|
-
accent: "switch--flavor-accent",
|
|
17
|
-
destructive: "switch--flavor-destructive",
|
|
18
|
-
success: "switch--flavor-success",
|
|
19
|
-
warning: "switch--flavor-warning",
|
|
20
|
-
info: "switch--flavor-info"
|
|
21
|
-
},
|
|
22
|
-
size: {
|
|
23
|
-
sm: "switch--sm",
|
|
24
|
-
md: "switch--md",
|
|
25
|
-
lg: "switch--lg"
|
|
26
|
-
},
|
|
27
|
-
flag: {
|
|
28
|
-
disabled: "switch--disabled"
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
2
|
const componentRecipe = recipe({
|
|
32
3
|
component: "switch",
|
|
4
|
+
element: "label",
|
|
33
5
|
slots: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
6
|
+
root: {
|
|
7
|
+
base: "switch"
|
|
8
|
+
},
|
|
9
|
+
input: {
|
|
10
|
+
base: "switch__input"
|
|
11
|
+
},
|
|
12
|
+
control: {
|
|
13
|
+
base: "switch__control"
|
|
14
|
+
},
|
|
15
|
+
thumb: {
|
|
16
|
+
base: "switch__thumb"
|
|
17
|
+
},
|
|
18
|
+
icon: {
|
|
19
|
+
base: "switch__icon"
|
|
20
|
+
},
|
|
21
|
+
content: {
|
|
22
|
+
base: "switch__content"
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
slot: "label"
|
|
26
|
+
},
|
|
27
|
+
description: {
|
|
28
|
+
base: "switch__description",
|
|
29
|
+
slot: "description"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
flavor: {
|
|
34
|
+
neutral: "switch--flavor-neutral",
|
|
35
|
+
primary: "switch--flavor-primary",
|
|
36
|
+
secondary: "switch--flavor-secondary",
|
|
37
|
+
accent: "switch--flavor-accent",
|
|
38
|
+
destructive: "switch--flavor-destructive",
|
|
39
|
+
success: "switch--flavor-success",
|
|
40
|
+
warning: "switch--flavor-warning",
|
|
41
|
+
info: "switch--flavor-info"
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
sm: "switch--sm",
|
|
45
|
+
md: "switch--md",
|
|
46
|
+
lg: "switch--lg"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaults: {
|
|
50
|
+
flavor: "accent",
|
|
51
|
+
size: "md"
|
|
43
52
|
},
|
|
44
53
|
_layouts: {
|
|
45
54
|
slots: {
|
|
46
|
-
description: {
|
|
47
|
-
base: "",
|
|
48
|
-
axes: {}
|
|
49
|
-
},
|
|
50
|
-
label: {
|
|
51
|
-
base: "",
|
|
52
|
-
axes: {}
|
|
53
|
-
},
|
|
54
55
|
root: {
|
|
55
|
-
base: "",
|
|
56
|
+
base: "switch",
|
|
57
|
+
axes: {
|
|
58
|
+
flavor: {
|
|
59
|
+
neutral: "switch--flavor-neutral",
|
|
60
|
+
primary: "switch--flavor-primary",
|
|
61
|
+
secondary: "switch--flavor-secondary",
|
|
62
|
+
accent: "switch--flavor-accent",
|
|
63
|
+
destructive: "switch--flavor-destructive",
|
|
64
|
+
success: "switch--flavor-success",
|
|
65
|
+
warning: "switch--flavor-warning",
|
|
66
|
+
info: "switch--flavor-info"
|
|
67
|
+
},
|
|
68
|
+
size: {
|
|
69
|
+
sm: "switch--sm",
|
|
70
|
+
md: "switch--md",
|
|
71
|
+
lg: "switch--lg"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
input: {
|
|
76
|
+
base: "switch__input",
|
|
56
77
|
axes: {}
|
|
57
78
|
},
|
|
58
|
-
|
|
59
|
-
base: "",
|
|
79
|
+
control: {
|
|
80
|
+
base: "switch__control",
|
|
60
81
|
axes: {}
|
|
61
82
|
},
|
|
62
|
-
|
|
63
|
-
base: "",
|
|
83
|
+
thumb: {
|
|
84
|
+
base: "switch__thumb",
|
|
64
85
|
axes: {}
|
|
65
86
|
},
|
|
66
|
-
|
|
67
|
-
base: "",
|
|
87
|
+
icon: {
|
|
88
|
+
base: "switch__icon",
|
|
68
89
|
axes: {}
|
|
69
90
|
},
|
|
70
|
-
|
|
71
|
-
base: "",
|
|
91
|
+
content: {
|
|
92
|
+
base: "switch__content",
|
|
72
93
|
axes: {}
|
|
73
94
|
},
|
|
74
|
-
|
|
95
|
+
label: {
|
|
75
96
|
base: "",
|
|
76
97
|
axes: {}
|
|
77
98
|
},
|
|
78
|
-
|
|
79
|
-
base: "",
|
|
99
|
+
description: {
|
|
100
|
+
base: "switch__description",
|
|
80
101
|
axes: {}
|
|
81
102
|
}
|
|
82
103
|
},
|
|
83
104
|
stateKeys: [],
|
|
84
105
|
slotIds: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"switch-thumb": 8
|
|
106
|
+
root: 6,
|
|
107
|
+
input: 4,
|
|
108
|
+
control: 1,
|
|
109
|
+
thumb: 7,
|
|
110
|
+
icon: 3,
|
|
111
|
+
content: 0,
|
|
112
|
+
label: 5,
|
|
113
|
+
description: 2
|
|
94
114
|
}
|
|
95
115
|
}
|
|
96
116
|
});
|
|
97
|
-
export {
|
|
117
|
+
export { componentRecipe };
|
|
@@ -2,18 +2,14 @@ import { insert, mergeProps, spread, template } from "@solidjs/web";
|
|
|
2
2
|
import { defineComponent } from "solid-layouts/solid-2/application-boundary";
|
|
3
3
|
import "./Text.css";
|
|
4
4
|
import { omit } from "solid-js";
|
|
5
|
-
import {
|
|
6
|
-
import { CLASSES, componentRecipe } from "./Text.recipe.js";
|
|
5
|
+
import { componentRecipe } from "./Text.recipe.js";
|
|
7
6
|
var _tmpl$ = /*#__PURE__*/ template("<span>");
|
|
8
7
|
const __solidLayoutTextRoot = (_stable, p)=>{
|
|
9
8
|
const others = omit(p, "children", "class", "dataTheme", "style", "size", "variant", "weight", "transform", "tracking", "leading", "family");
|
|
10
9
|
const size = ()=>p.size ?? "base";
|
|
11
10
|
const variant = ()=>p.variant ?? "default";
|
|
12
11
|
var _el$ = _tmpl$();
|
|
13
|
-
spread(_el$, mergeProps(others, ()=>
|
|
14
|
-
class: twMerge(CLASSES.base, p.class)
|
|
15
|
-
}), {
|
|
16
|
-
"data-slot": "text",
|
|
12
|
+
spread(_el$, mergeProps(others, ()=>_stable.slot.root, {
|
|
17
13
|
get ["data-size"] () {
|
|
18
14
|
return size();
|
|
19
15
|
},
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The root class, owned here.
|
|
3
|
+
*
|
|
4
|
+
* Text's presentation axes stay `data-*` attributes rather than becoming recipe
|
|
5
|
+
* `props`, and deliberately: `Text.css` selects on `[data-size]`, `[data-variant]`
|
|
6
|
+
* and the rest, so turning them into recipe props would emit classes nothing
|
|
7
|
+
* styles. Recipe `props` map a value to a class; these map a value to an
|
|
8
|
+
* attribute, which is what `state` is for -- except these are set at the call
|
|
9
|
+
* site, not computed.
|
|
10
|
+
*
|
|
11
|
+
* So the only thing that was manual here is the base class, and that is what
|
|
12
|
+
* moves: the layout spreads `{...slot.root}` instead of calling `twMerge`.
|
|
13
|
+
*/
|
|
4
14
|
export declare const componentRecipe: import("solid-layouts/solid-2").Recipe<{
|
|
5
15
|
readonly component: "text";
|
|
16
|
+
readonly element: "span";
|
|
6
17
|
readonly slots: {
|
|
7
|
-
readonly root: {
|
|
8
|
-
|
|
18
|
+
readonly root: {
|
|
19
|
+
readonly base: "text";
|
|
20
|
+
};
|
|
9
21
|
};
|
|
10
22
|
}>;
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
import { recipe } from "../../lib/layouts/index.js";
|
|
2
|
-
const CLASSES = {
|
|
3
|
-
base: "text"
|
|
4
|
-
};
|
|
5
2
|
const componentRecipe = recipe({
|
|
6
3
|
component: "text",
|
|
4
|
+
element: "span",
|
|
7
5
|
slots: {
|
|
8
|
-
root: {
|
|
9
|
-
|
|
6
|
+
root: {
|
|
7
|
+
base: "text"
|
|
8
|
+
}
|
|
10
9
|
},
|
|
11
10
|
_layouts: {
|
|
12
11
|
slots: {
|
|
13
12
|
root: {
|
|
14
|
-
base: "",
|
|
15
|
-
axes: {}
|
|
16
|
-
},
|
|
17
|
-
text: {
|
|
18
|
-
base: "",
|
|
13
|
+
base: "text",
|
|
19
14
|
axes: {}
|
|
20
15
|
}
|
|
21
16
|
},
|
|
22
17
|
stateKeys: [],
|
|
23
18
|
slotIds: {
|
|
24
|
-
root: 0
|
|
25
|
-
text: 1
|
|
19
|
+
root: 0
|
|
26
20
|
}
|
|
27
21
|
}
|
|
28
22
|
});
|
|
29
|
-
export {
|
|
23
|
+
export { componentRecipe };
|