@neumorphism-ui/elements 1.0.0-next.1 → 1.0.0-next.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/README.md +12 -1
- package/cdn/neu.min.js +176 -51
- package/custom-elements.json +2555 -358
- package/dist/all.d.ts +8 -0
- package/dist/all.js +8 -0
- package/dist/checkbox.d.ts +3 -0
- package/dist/checkbox.js +4 -0
- package/dist/components/avatar/avatar.d.ts +0 -3
- package/dist/components/avatar/avatar.def.d.ts +0 -3
- package/dist/components/avatar/avatar.def.js +4 -18
- package/dist/components/avatar/avatar.docs.d.ts +2 -0
- package/dist/components/avatar/avatar.docs.js +22 -0
- package/dist/components/avatar/avatar.js +7 -1
- package/dist/components/badge/badge.d.ts +0 -2
- package/dist/components/badge/badge.def.d.ts +0 -2
- package/dist/components/badge/badge.def.js +1 -14
- package/dist/components/badge/badge.docs.d.ts +2 -0
- package/dist/components/badge/badge.docs.js +17 -0
- package/dist/components/button/button.d.ts +0 -2
- package/dist/components/button/button.def.d.ts +0 -5
- package/dist/components/button/button.def.js +3 -25
- package/dist/components/button/button.docs.d.ts +2 -0
- package/dist/components/button/button.docs.js +29 -0
- package/dist/components/button/button.js +3 -36
- package/dist/components/button-group/button-group.d.ts +0 -2
- package/dist/components/button-group/button-group.def.d.ts +0 -2
- package/dist/components/button-group/button-group.def.js +1 -10
- package/dist/components/button-group/button-group.docs.d.ts +2 -0
- package/dist/components/button-group/button-group.docs.js +13 -0
- package/dist/components/checkbox/checkbox.d.ts +40 -0
- package/dist/components/checkbox/checkbox.def.d.ts +27 -0
- package/dist/components/checkbox/checkbox.def.js +21 -0
- package/dist/components/checkbox/checkbox.docs.d.ts +2 -0
- package/dist/components/checkbox/checkbox.docs.js +27 -0
- package/dist/components/checkbox/checkbox.js +40 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.styles.js +28 -0
- package/dist/components/divider/divider.d.ts +0 -1
- package/dist/components/divider/divider.def.d.ts +0 -1
- package/dist/components/divider/divider.def.js +0 -9
- package/dist/components/divider/divider.docs.d.ts +2 -0
- package/dist/components/divider/divider.docs.js +12 -0
- package/dist/components/icon/icon.d.ts +0 -3
- package/dist/components/icon/icon.def.d.ts +0 -3
- package/dist/components/icon/icon.def.js +3 -10
- package/dist/components/icon/icon.docs.d.ts +2 -0
- package/dist/components/icon/icon.docs.js +13 -0
- package/dist/components/icon/system-icons.d.ts +10 -0
- package/dist/components/icon/system-icons.js +22 -11
- package/dist/components/icon-button/icon-button.d.ts +0 -5
- package/dist/components/icon-button/icon-button.def.d.ts +0 -5
- package/dist/components/icon-button/icon-button.def.js +3 -17
- package/dist/components/icon-button/icon-button.docs.d.ts +2 -0
- package/dist/components/icon-button/icon-button.docs.js +26 -0
- package/dist/components/number-field/number-field.d.ts +79 -0
- package/dist/components/number-field/number-field.def.d.ts +115 -0
- package/dist/components/number-field/number-field.def.js +40 -0
- package/dist/components/number-field/number-field.docs.d.ts +2 -0
- package/dist/components/number-field/number-field.docs.js +45 -0
- package/dist/components/number-field/number-field.js +121 -0
- package/dist/components/number-field/number-field.styles.d.ts +1 -0
- package/dist/components/number-field/number-field.styles.js +15 -0
- package/dist/components/option/option-data.d.ts +8 -0
- package/dist/components/option/option-data.js +12 -0
- package/dist/components/option/option.d.ts +17 -0
- package/dist/components/option/option.def.d.ts +8 -0
- package/dist/components/option/option.def.js +12 -0
- package/dist/components/option/option.docs.d.ts +2 -0
- package/dist/components/option/option.docs.js +12 -0
- package/dist/components/option/option.js +17 -0
- package/dist/components/option/option.styles.d.ts +2 -0
- package/dist/components/option/option.styles.js +5 -0
- package/dist/components/radio/radio-link.d.ts +11 -0
- package/dist/components/radio/radio-link.js +5 -0
- package/dist/components/radio/radio.d.ts +27 -0
- package/dist/components/radio/radio.def.d.ts +9 -0
- package/dist/components/radio/radio.def.js +12 -0
- package/dist/components/radio/radio.docs.d.ts +2 -0
- package/dist/components/radio/radio.docs.js +18 -0
- package/dist/components/radio/radio.js +43 -0
- package/dist/components/radio/radio.styles.d.ts +1 -0
- package/dist/components/radio/radio.styles.js +21 -0
- package/dist/components/radio-group/radio-group.d.ts +76 -0
- package/dist/components/radio-group/radio-group.def.d.ts +36 -0
- package/dist/components/radio-group/radio-group.def.js +40 -0
- package/dist/components/radio-group/radio-group.docs.d.ts +2 -0
- package/dist/components/radio-group/radio-group.docs.js +37 -0
- package/dist/components/radio-group/radio-group.js +208 -0
- package/dist/components/radio-group/radio-group.styles.d.ts +1 -0
- package/dist/components/radio-group/radio-group.styles.js +13 -0
- package/dist/components/select/select.d.ts +115 -0
- package/dist/components/select/select.def.d.ts +34 -0
- package/dist/components/select/select.def.js +35 -0
- package/dist/components/select/select.docs.d.ts +2 -0
- package/dist/components/select/select.docs.js +65 -0
- package/dist/components/select/select.js +391 -0
- package/dist/components/select/select.styles.d.ts +1 -0
- package/dist/components/select/select.styles.js +35 -0
- package/dist/components/shared/checkable.d.ts +45 -0
- package/dist/components/shared/checkable.js +108 -0
- package/dist/components/shared/field.styles.d.ts +1 -0
- package/dist/components/shared/field.styles.js +34 -0
- package/dist/components/shared/press.d.ts +7 -0
- package/dist/components/shared/press.js +42 -0
- package/dist/components/shared/step.d.ts +2 -0
- package/dist/components/shared/step.js +2 -0
- package/dist/components/shared/text-control.d.ts +72 -0
- package/dist/components/shared/text-control.js +191 -0
- package/dist/components/slider/slider.d.ts +67 -0
- package/dist/components/slider/slider.def.d.ts +37 -0
- package/dist/components/slider/slider.def.js +54 -0
- package/dist/components/slider/slider.docs.d.ts +2 -0
- package/dist/components/slider/slider.docs.js +45 -0
- package/dist/components/slider/slider.js +170 -0
- package/dist/components/slider/slider.styles.d.ts +1 -0
- package/dist/components/slider/slider.styles.js +16 -0
- package/dist/components/spinner/spinner.d.ts +0 -1
- package/dist/components/spinner/spinner.def.d.ts +0 -1
- package/dist/components/spinner/spinner.def.js +1 -13
- package/dist/components/spinner/spinner.docs.d.ts +2 -0
- package/dist/components/spinner/spinner.docs.js +17 -0
- package/dist/components/surface/surface.d.ts +0 -4
- package/dist/components/surface/surface.def.d.ts +0 -4
- package/dist/components/surface/surface.def.js +3 -12
- package/dist/components/surface/surface.docs.d.ts +2 -0
- package/dist/components/surface/surface.docs.js +15 -0
- package/dist/components/switch/switch.d.ts +4 -35
- package/dist/components/switch/switch.def.d.ts +0 -5
- package/dist/components/switch/switch.def.js +5 -21
- package/dist/components/switch/switch.docs.d.ts +2 -0
- package/dist/components/switch/switch.docs.js +26 -0
- package/dist/components/switch/switch.js +5 -117
- package/dist/components/text-field/implicit-submit.d.ts +5 -0
- package/dist/components/text-field/implicit-submit.js +8 -3
- package/dist/components/text-field/text-field.d.ts +9 -42
- package/dist/components/text-field/text-field.def.d.ts +0 -12
- package/dist/components/text-field/text-field.def.js +5 -30
- package/dist/components/text-field/text-field.docs.d.ts +2 -0
- package/dist/components/text-field/text-field.docs.js +45 -0
- package/dist/components/text-field/text-field.js +21 -178
- package/dist/components/text-field/text-field.styles.d.ts +1 -1
- package/dist/components/text-field/text-field.styles.js +2 -35
- package/dist/components/textarea/textarea.d.ts +92 -0
- package/dist/components/textarea/textarea.def.d.ts +127 -0
- package/dist/components/textarea/textarea.def.js +44 -0
- package/dist/components/textarea/textarea.docs.d.ts +2 -0
- package/dist/components/textarea/textarea.docs.js +40 -0
- package/dist/components/textarea/textarea.js +101 -0
- package/dist/components/textarea/textarea.styles.d.ts +1 -0
- package/dist/components/textarea/textarea.styles.js +9 -0
- package/dist/components/theme-docs.d.ts +3 -0
- package/dist/components/theme-docs.js +8 -0
- package/dist/core/define.d.ts +20 -2
- package/dist/core/dom.d.ts +4 -0
- package/dist/core/dom.js +7 -0
- package/dist/core/form-control.js +6 -1
- package/dist/core/neu-element.d.ts +2 -2
- package/dist/core/neu-element.js +10 -7
- package/dist/core/props.d.ts +13 -1
- package/dist/core/props.js +13 -3
- package/dist/core/styles.d.ts +0 -2
- package/dist/core/styles.js +0 -7
- package/dist/core/validation.d.ts +6 -2
- package/dist/core/validation.js +15 -8
- package/dist/docs.d.ts +3 -0
- package/dist/docs.js +41 -0
- package/dist/number-field.d.ts +3 -0
- package/dist/number-field.js +4 -0
- package/dist/option.d.ts +3 -0
- package/dist/option.js +4 -0
- package/dist/radio-group.d.ts +4 -0
- package/dist/radio-group.js +6 -0
- package/dist/radio.d.ts +3 -0
- package/dist/radio.js +4 -0
- package/dist/select.d.ts +3 -0
- package/dist/select.js +4 -0
- package/dist/slider.d.ts +3 -0
- package/dist/slider.js +4 -0
- package/dist/ssr.d.ts +10 -6
- package/dist/ssr.js +26 -6
- package/dist/textarea.d.ts +3 -0
- package/dist/textarea.js +4 -0
- package/package.json +45 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CheckableElement } from '../shared/checkable.js';
|
|
2
|
+
import { checkboxDef } from './checkbox.def.js';
|
|
3
|
+
export class NeuCheckbox extends CheckableElement {
|
|
4
|
+
static def = checkboxDef;
|
|
5
|
+
/** Only Space toggles, like a native checkbox. */
|
|
6
|
+
static enter = 'none';
|
|
7
|
+
anchor = 'control';
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.internals.role = 'checkbox';
|
|
11
|
+
}
|
|
12
|
+
ariaCheckedValue() {
|
|
13
|
+
return this.props.indeterminate === true ? 'mixed' : super.ariaCheckedValue();
|
|
14
|
+
}
|
|
15
|
+
/** Native: a click on an indeterminate box toggles checked and clears indeterminate. */
|
|
16
|
+
flip() {
|
|
17
|
+
const mixed = this.props.indeterminate === true;
|
|
18
|
+
if (!mixed)
|
|
19
|
+
return super.flip();
|
|
20
|
+
const checked = this.checked;
|
|
21
|
+
this.setProp('indeterminate', false);
|
|
22
|
+
this.checked = !checked;
|
|
23
|
+
return () => {
|
|
24
|
+
this.setProp('indeterminate', true);
|
|
25
|
+
this.checked = checked;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
paint() {
|
|
29
|
+
const mixed = this.props.indeterminate === true;
|
|
30
|
+
const control = this.ref('control');
|
|
31
|
+
control?.classList.toggle('on', this.checked);
|
|
32
|
+
control?.classList.toggle('mixed', mixed);
|
|
33
|
+
this.toggleState('indeterminate', mixed);
|
|
34
|
+
}
|
|
35
|
+
update(changed) {
|
|
36
|
+
super.update(changed);
|
|
37
|
+
if (changed.has('indeterminate'))
|
|
38
|
+
this.sync();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkboxStyles = "\n:host {\n --_neu-bg: var(--neu-bg, #e0e5ec);\n --_neu-accent-c: var(--neu-accent, #6d5dfc);\n --_neu-d: var(--neu-distance, 6px);\n --_neu-k: var(--neu-intensity, 1);\n --_neu-r: var(--neu-radius, 12px);\n --_neu-danger: var(--neu-danger, #e5484d);\n --_neu-dur: var(--neu-duration, 150ms);\n --_neu-sd: var(--neu-shadow-dark, color-mix(in oklab, var(--_neu-bg), black min(100%, calc(var(--_neu-shade, 18%) * var(--_neu-k)))));\n --_neu-sl: var(--neu-shadow-light, color-mix(in oklab, var(--_neu-bg), white min(100%, calc(var(--_neu-light, 100%) * var(--_neu-k)))));\n --_neu-fg: var(--neu-fg, color-mix(in oklab, var(--_neu-bg), var(--_neu-ink, black) var(--_neu-fg-mix, 32%)));\n --_neu-fg-muted: var(--neu-fg-muted, color-mix(in oklab, var(--_neu-bg), var(--_neu-ink, black) var(--_neu-fg-muted-mix, 18%)));\n --_neu-accent-soft: color-mix(in oklab, var(--_neu-accent-c) 25%, var(--_neu-bg));\n --_neu-focus: 0 0 0 3px color-mix(in oklab, var(--_neu-accent-c) 45%, transparent);\n --_neu-raised: var(--_neu-d) var(--_neu-d) calc(var(--_neu-d) * 2) var(--_neu-sd), calc(var(--_neu-d) * -1) calc(var(--_neu-d) * -1) calc(var(--_neu-d) * 2) var(--_neu-sl);\n --_neu-raised-sm: calc(var(--_neu-d) * 0.5) calc(var(--_neu-d) * 0.5) var(--_neu-d) var(--_neu-sd), calc(var(--_neu-d) * -0.5) calc(var(--_neu-d) * -0.5) var(--_neu-d) var(--_neu-sl);\n --_neu-inset: inset var(--_neu-d) var(--_neu-d) calc(var(--_neu-d) * 2) var(--_neu-sd), inset calc(var(--_neu-d) * -1) calc(var(--_neu-d) * -1) calc(var(--_neu-d) * 2) var(--_neu-sl);\n --_neu-inset-sm: inset calc(var(--_neu-d) * 0.5) calc(var(--_neu-d) * 0.5) var(--_neu-d) var(--_neu-sd), inset calc(var(--_neu-d) * -0.5) calc(var(--_neu-d) * -0.5) var(--_neu-d) var(--_neu-sl);\n font-family: var(--neu-font);\n color: var(--_neu-fg);\n -webkit-tap-highlight-color: transparent;\n}\n:host(:not(:defined)) { visibility: inherit !important; min-block-size: auto !important; }\n:host([hidden]) { display: none !important; }\n:host(:focus) { outline: none; }\n*, *::before, *::after { box-sizing: border-box; }\n\n:host {\n display: inline-flex; vertical-align: middle; cursor: pointer; user-select: none;\n --_neu-box: 1.25rem;\n}\n:host([size='sm']) { --_neu-box: 1rem; }\n:host([size='lg']) { --_neu-box: 1.5rem; }\n:host(:disabled), :host([disabled]) { cursor: not-allowed; }\n.base { display: inline-flex; align-items: center; gap: 0.625rem; }\n.control {\n display: inline-flex; align-items: center; justify-content: center; flex: none;\n inline-size: var(--_neu-box); block-size: var(--_neu-box);\n border-radius: calc(var(--_neu-r) * 0.4); background: var(--_neu-bg); box-shadow: var(--_neu-inset-sm);\n color: var(--_neu-accent-c);\n transition: background-color var(--_neu-dur) ease, box-shadow var(--_neu-dur) ease;\n}\n.control.on, .control.mixed { background: var(--_neu-accent-soft); }\n.indicator { display: inline-flex; inline-size: 80%; block-size: 80%; opacity: 0; }\n.control.on .indicator, .control.mixed .indicator { opacity: 1; }\n.indicator svg { inline-size: 100%; block-size: 100%; }\n.indicator svg:last-child, .control.mixed .indicator svg:first-child { display: none; }\n.control.mixed .indicator svg:last-child { display: block; }\n:host(:focus-visible) .control { box-shadow: var(--_neu-inset-sm), var(--_neu-focus); }\n:host(:disabled) .base, :host([disabled]) .base { opacity: 0.55; }\n:host(:state(user-invalid)) .control { box-shadow: var(--_neu-inset-sm), 0 0 0 2px color-mix(in oklab, var(--_neu-danger) 55%, transparent); }\n.label { color: var(--_neu-fg); }\n";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { hostTheme } from '../../core/styles.js';
|
|
2
|
+
export const checkboxStyles = `${hostTheme}
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex; vertical-align: middle; cursor: pointer; user-select: none;
|
|
5
|
+
--_neu-box: 1.25rem;
|
|
6
|
+
}
|
|
7
|
+
:host([size='sm']) { --_neu-box: 1rem; }
|
|
8
|
+
:host([size='lg']) { --_neu-box: 1.5rem; }
|
|
9
|
+
:host(:disabled), :host([disabled]) { cursor: not-allowed; }
|
|
10
|
+
.base { display: inline-flex; align-items: center; gap: 0.625rem; }
|
|
11
|
+
.control {
|
|
12
|
+
display: inline-flex; align-items: center; justify-content: center; flex: none;
|
|
13
|
+
inline-size: var(--_neu-box); block-size: var(--_neu-box);
|
|
14
|
+
border-radius: calc(var(--_neu-r) * 0.4); background: var(--_neu-bg); box-shadow: var(--_neu-inset-sm);
|
|
15
|
+
color: var(--_neu-accent-c);
|
|
16
|
+
transition: background-color var(--_neu-dur) ease, box-shadow var(--_neu-dur) ease;
|
|
17
|
+
}
|
|
18
|
+
.control.on, .control.mixed { background: var(--_neu-accent-soft); }
|
|
19
|
+
.indicator { display: inline-flex; inline-size: 80%; block-size: 80%; opacity: 0; }
|
|
20
|
+
.control.on .indicator, .control.mixed .indicator { opacity: 1; }
|
|
21
|
+
.indicator svg { inline-size: 100%; block-size: 100%; }
|
|
22
|
+
.indicator svg:last-child, .control.mixed .indicator svg:first-child { display: none; }
|
|
23
|
+
.control.mixed .indicator svg:last-child { display: block; }
|
|
24
|
+
:host(:focus-visible) .control { box-shadow: var(--_neu-inset-sm), var(--_neu-focus); }
|
|
25
|
+
:host(:disabled) .base, :host([disabled]) .base { opacity: 0.55; }
|
|
26
|
+
:host(:state(user-invalid)) .control { box-shadow: var(--_neu-inset-sm), 0 0 0 2px color-mix(in oklab, var(--_neu-danger) 55%, transparent); }
|
|
27
|
+
.label { color: var(--_neu-fg); }
|
|
28
|
+
`;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineComponent } from '../../core/define.js';
|
|
2
2
|
import { html } from '../../core/html.js';
|
|
3
|
-
import { themeCssProperties } from '../../core/styles.js';
|
|
4
3
|
import { dividerStyles } from './divider.styles.js';
|
|
5
4
|
export const dividerDef = defineComponent({
|
|
6
5
|
tag: 'neu-divider',
|
|
@@ -9,16 +8,8 @@ export const dividerDef = defineComponent({
|
|
|
9
8
|
type: 'string',
|
|
10
9
|
default: 'horizontal',
|
|
11
10
|
values: ['horizontal', 'vertical'],
|
|
12
|
-
reflect: true,
|
|
13
11
|
},
|
|
14
12
|
},
|
|
15
13
|
styles: dividerStyles,
|
|
16
14
|
template: () => html `<span part="base" class="base"></span>`,
|
|
17
|
-
docs: {
|
|
18
|
-
summary: 'A thin engraved line that separates content.',
|
|
19
|
-
events: [],
|
|
20
|
-
slots: [],
|
|
21
|
-
parts: [{ name: 'base', description: 'The engraved line.' }],
|
|
22
|
-
cssProperties: themeCssProperties,
|
|
23
|
-
},
|
|
24
15
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { themeCssProperties } from '../theme-docs.js';
|
|
2
|
+
export const dividerDocs = {
|
|
3
|
+
summary: 'A thin engraved line that separates content.',
|
|
4
|
+
descriptions: {
|
|
5
|
+
orientation: 'The direction the line runs in.',
|
|
6
|
+
},
|
|
7
|
+
events: [],
|
|
8
|
+
slots: [],
|
|
9
|
+
parts: [{ name: 'base', description: 'The engraved line.' }],
|
|
10
|
+
cssProperties: themeCssProperties,
|
|
11
|
+
keyboard: [],
|
|
12
|
+
};
|
|
@@ -3,16 +3,13 @@ export declare class NeuIcon extends NeuElement {
|
|
|
3
3
|
static def: import("../../ssr.js").ComponentDef<{
|
|
4
4
|
readonly name: {
|
|
5
5
|
readonly type: "string";
|
|
6
|
-
readonly reflect: true;
|
|
7
6
|
};
|
|
8
7
|
readonly library: {
|
|
9
8
|
readonly type: "string";
|
|
10
9
|
readonly default: "system";
|
|
11
|
-
readonly reflect: true;
|
|
12
10
|
};
|
|
13
11
|
readonly label: {
|
|
14
12
|
readonly type: "string";
|
|
15
|
-
readonly reflect: true;
|
|
16
13
|
};
|
|
17
14
|
}>;
|
|
18
15
|
name: string;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
export declare const iconDef: import("../../core/define.js").ComponentDef<{
|
|
2
2
|
readonly name: {
|
|
3
3
|
readonly type: "string";
|
|
4
|
-
readonly reflect: true;
|
|
5
4
|
};
|
|
6
5
|
readonly library: {
|
|
7
6
|
readonly type: "string";
|
|
8
7
|
readonly default: "system";
|
|
9
|
-
readonly reflect: true;
|
|
10
8
|
};
|
|
11
9
|
readonly label: {
|
|
12
10
|
readonly type: "string";
|
|
13
|
-
readonly reflect: true;
|
|
14
11
|
};
|
|
15
12
|
}>;
|
|
@@ -5,20 +5,13 @@ import { systemIconSvg } from './system-icons.js';
|
|
|
5
5
|
export const iconDef = defineComponent({
|
|
6
6
|
tag: 'neu-icon',
|
|
7
7
|
props: {
|
|
8
|
-
name: { type: 'string'
|
|
9
|
-
library: { type: 'string', default: 'system'
|
|
10
|
-
label: { type: 'string'
|
|
8
|
+
name: { type: 'string' },
|
|
9
|
+
library: { type: 'string', default: 'system' },
|
|
10
|
+
label: { type: 'string' },
|
|
11
11
|
},
|
|
12
12
|
styles: iconStyles,
|
|
13
13
|
template: (p) => {
|
|
14
14
|
const svg = p.library === 'system' ? systemIconSvg(p.name) : undefined;
|
|
15
15
|
return html `<span class="box" data-ref="box">${svg === undefined ? '' : unsafeHTML(svg)}</span>`;
|
|
16
16
|
},
|
|
17
|
-
docs: {
|
|
18
|
-
summary: 'A vector icon from the built-in set or a registered icon library.',
|
|
19
|
-
events: [],
|
|
20
|
-
slots: [],
|
|
21
|
-
parts: [{ name: 'svg', description: 'The rendered SVG element.' }],
|
|
22
|
-
cssProperties: [],
|
|
23
|
-
},
|
|
24
17
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const iconDocs = {
|
|
2
|
+
summary: 'A vector icon from the built-in set or a registered icon library.',
|
|
3
|
+
descriptions: {
|
|
4
|
+
name: 'The name of the icon to show.',
|
|
5
|
+
library: 'The icon library to take the icon from; defaults to the built-in system set.',
|
|
6
|
+
label: 'Accessible name that turns the icon into an image; without it the icon is decorative.',
|
|
7
|
+
},
|
|
8
|
+
events: [],
|
|
9
|
+
slots: [],
|
|
10
|
+
parts: [{ name: 'svg', description: 'The rendered SVG element.' }],
|
|
11
|
+
cssProperties: [],
|
|
12
|
+
keyboard: [],
|
|
13
|
+
};
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
export declare const checkBody = "<path d=\"M5 12.5l4.5 4.5L19 7.5\"/>";
|
|
2
|
+
export declare const chevronDownBody = "<path d=\"M6 9l6 6 6-6\"/>";
|
|
3
|
+
export declare const chevronUpBody = "<path d=\"M6 15l6-6 6 6\"/>";
|
|
4
|
+
export declare const plusBody = "<path d=\"M12 5v14M5 12h14\"/>";
|
|
5
|
+
export declare const minusBody = "<path d=\"M5 12h14\"/>";
|
|
6
|
+
export declare const xBody = "<path d=\"M6 6l12 12M18 6L6 18\"/>";
|
|
7
|
+
export declare const alertCircleBody = "<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 7.5v5.5M12 16.5h.01\"/>";
|
|
8
|
+
export declare const userBody = "<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M4 20c0-4 3.6-6 8-6s8 2 8 6\"/>";
|
|
9
|
+
/** The SVG element around an icon body. DOM-free. */
|
|
10
|
+
export declare function svgWrap(body: string, part?: string): string;
|
|
1
11
|
/** The built-in icon as an SVG string, or undefined for an unknown name. DOM-free. */
|
|
2
12
|
export declare function systemIconSvg(name: string): string | undefined;
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
+
// Each body is its own export, so a component that needs one icon bundles only that icon.
|
|
2
|
+
export const checkBody = '<path d="M5 12.5l4.5 4.5L19 7.5"/>';
|
|
3
|
+
export const chevronDownBody = '<path d="M6 9l6 6 6-6"/>';
|
|
4
|
+
export const chevronUpBody = '<path d="M6 15l6-6 6 6"/>';
|
|
5
|
+
export const plusBody = '<path d="M12 5v14M5 12h14"/>';
|
|
6
|
+
export const minusBody = '<path d="M5 12h14"/>';
|
|
7
|
+
export const xBody = '<path d="M6 6l12 12M18 6L6 18"/>';
|
|
8
|
+
export const alertCircleBody = '<circle cx="12" cy="12" r="9"/><path d="M12 7.5v5.5M12 16.5h.01"/>';
|
|
9
|
+
export const userBody = '<circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6"/>';
|
|
1
10
|
const BODIES = {
|
|
2
|
-
check:
|
|
3
|
-
'chevron-down':
|
|
4
|
-
'chevron-up':
|
|
5
|
-
plus:
|
|
6
|
-
minus:
|
|
7
|
-
x:
|
|
8
|
-
'alert-circle':
|
|
9
|
-
user:
|
|
11
|
+
check: checkBody,
|
|
12
|
+
'chevron-down': chevronDownBody,
|
|
13
|
+
'chevron-up': chevronUpBody,
|
|
14
|
+
plus: plusBody,
|
|
15
|
+
minus: minusBody,
|
|
16
|
+
x: xBody,
|
|
17
|
+
'alert-circle': alertCircleBody,
|
|
18
|
+
user: userBody,
|
|
10
19
|
};
|
|
20
|
+
/** The SVG element around an icon body. DOM-free. */
|
|
21
|
+
export function svgWrap(body, part) {
|
|
22
|
+
return `<svg${part ? ` part="${part}"` : ''} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${body}</svg>`;
|
|
23
|
+
}
|
|
11
24
|
/** The built-in icon as an SVG string, or undefined for an unknown name. DOM-free. */
|
|
12
25
|
export function systemIconSvg(name) {
|
|
13
26
|
const body = Object.hasOwn(BODIES, name) ? BODIES[name] : undefined;
|
|
14
|
-
|
|
15
|
-
return undefined;
|
|
16
|
-
return `<svg part="svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${body}</svg>`;
|
|
27
|
+
return body === undefined ? undefined : svgWrap(body, 'svg');
|
|
17
28
|
}
|
|
@@ -15,29 +15,24 @@ export declare class NeuIconButton extends NeuButton {
|
|
|
15
15
|
readonly type: "string";
|
|
16
16
|
readonly default: "circle";
|
|
17
17
|
readonly values: readonly ["circle", "square"];
|
|
18
|
-
readonly reflect: true;
|
|
19
18
|
};
|
|
20
19
|
readonly variant: {
|
|
21
20
|
readonly type: "string";
|
|
22
21
|
readonly default: "default";
|
|
23
22
|
readonly values: readonly ["default", "primary", "flat"];
|
|
24
|
-
readonly reflect: true;
|
|
25
23
|
};
|
|
26
24
|
readonly size: {
|
|
27
25
|
readonly type: "string";
|
|
28
26
|
readonly default: "md";
|
|
29
27
|
readonly values: readonly ["sm", "md", "lg"];
|
|
30
|
-
readonly reflect: true;
|
|
31
28
|
};
|
|
32
29
|
readonly disabled: {
|
|
33
30
|
readonly type: "boolean";
|
|
34
|
-
readonly reflect: true;
|
|
35
31
|
};
|
|
36
32
|
readonly type: {
|
|
37
33
|
readonly type: "string";
|
|
38
34
|
readonly default: "button";
|
|
39
35
|
readonly values: readonly ["button", "submit", "reset"];
|
|
40
|
-
readonly reflect: true;
|
|
41
36
|
};
|
|
42
37
|
}>;
|
|
43
38
|
icon: string;
|
|
@@ -13,28 +13,23 @@ export declare const iconButtonDef: import("../../core/define.js").ComponentDef<
|
|
|
13
13
|
readonly type: "string";
|
|
14
14
|
readonly default: "circle";
|
|
15
15
|
readonly values: readonly ["circle", "square"];
|
|
16
|
-
readonly reflect: true;
|
|
17
16
|
};
|
|
18
17
|
readonly variant: {
|
|
19
18
|
readonly type: "string";
|
|
20
19
|
readonly default: "default";
|
|
21
20
|
readonly values: readonly ["default", "primary", "flat"];
|
|
22
|
-
readonly reflect: true;
|
|
23
21
|
};
|
|
24
22
|
readonly size: {
|
|
25
23
|
readonly type: "string";
|
|
26
24
|
readonly default: "md";
|
|
27
25
|
readonly values: readonly ["sm", "md", "lg"];
|
|
28
|
-
readonly reflect: true;
|
|
29
26
|
};
|
|
30
27
|
readonly disabled: {
|
|
31
28
|
readonly type: "boolean";
|
|
32
|
-
readonly reflect: true;
|
|
33
29
|
};
|
|
34
30
|
readonly type: {
|
|
35
31
|
readonly type: "string";
|
|
36
32
|
readonly default: "button";
|
|
37
33
|
readonly values: readonly ["button", "submit", "reset"];
|
|
38
|
-
readonly reflect: true;
|
|
39
34
|
};
|
|
40
35
|
}>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineComponent } from '../../core/define.js';
|
|
2
2
|
import { html, unsafeHTML } from '../../core/html.js';
|
|
3
|
-
import { themeCssProperties } from '../../core/styles.js';
|
|
4
3
|
import { systemIconSvg } from '../icon/system-icons.js';
|
|
5
4
|
import { iconButtonStyles } from './icon-button.styles.js';
|
|
6
5
|
export const iconButtonDef = defineComponent({
|
|
@@ -9,20 +8,18 @@ export const iconButtonDef = defineComponent({
|
|
|
9
8
|
icon: { type: 'string' },
|
|
10
9
|
library: { type: 'string', default: 'system' },
|
|
11
10
|
label: { type: 'string' },
|
|
12
|
-
shape: { type: 'string', default: 'circle', values: ['circle', 'square']
|
|
11
|
+
shape: { type: 'string', default: 'circle', values: ['circle', 'square'] },
|
|
13
12
|
variant: {
|
|
14
13
|
type: 'string',
|
|
15
14
|
default: 'default',
|
|
16
15
|
values: ['default', 'primary', 'flat'],
|
|
17
|
-
reflect: true,
|
|
18
16
|
},
|
|
19
|
-
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg']
|
|
20
|
-
disabled: { type: 'boolean'
|
|
17
|
+
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
|
|
18
|
+
disabled: { type: 'boolean' },
|
|
21
19
|
type: {
|
|
22
20
|
type: 'string',
|
|
23
21
|
default: 'button',
|
|
24
22
|
values: ['button', 'submit', 'reset'],
|
|
25
|
-
reflect: true,
|
|
26
23
|
},
|
|
27
24
|
},
|
|
28
25
|
styles: iconButtonStyles,
|
|
@@ -30,15 +27,4 @@ export const iconButtonDef = defineComponent({
|
|
|
30
27
|
const svg = p.library === 'system' ? systemIconSvg(p.icon) : undefined;
|
|
31
28
|
return html `<span part="base" class="base"><span part="icon" class="icon" data-ref="icon">${svg === undefined ? '' : unsafeHTML(svg)}</span></span>`;
|
|
32
29
|
},
|
|
33
|
-
docs: {
|
|
34
|
-
summary: 'A raised button that shows an icon instead of a label. Name it with label.',
|
|
35
|
-
events: [{ name: 'click', description: 'Fired on activation; never while disabled.' }],
|
|
36
|
-
slots: [],
|
|
37
|
-
parts: [
|
|
38
|
-
{ name: 'base', description: 'The raised surface.' },
|
|
39
|
-
{ name: 'icon', description: 'Wrapper around the icon.' },
|
|
40
|
-
{ name: 'svg', description: 'The rendered SVG element.' },
|
|
41
|
-
],
|
|
42
|
-
cssProperties: themeCssProperties,
|
|
43
|
-
},
|
|
44
30
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { themeCssProperties } from '../theme-docs.js';
|
|
2
|
+
export const iconButtonDocs = {
|
|
3
|
+
summary: 'A raised button that shows an icon instead of a label. Name it with label.',
|
|
4
|
+
descriptions: {
|
|
5
|
+
icon: 'The name of the icon to show.',
|
|
6
|
+
library: 'The icon library to take the icon from; defaults to the built-in system set.',
|
|
7
|
+
label: 'Accessible name of the button, since it has no visible text.',
|
|
8
|
+
shape: 'The outline of the button.',
|
|
9
|
+
variant: 'The visual emphasis of the button.',
|
|
10
|
+
size: 'The button size.',
|
|
11
|
+
disabled: 'Prevents interaction and dims the button.',
|
|
12
|
+
type: 'What the button does inside a form; defaults to "button", which does nothing.',
|
|
13
|
+
},
|
|
14
|
+
events: [{ name: 'click', description: 'Fired on activation; never while disabled.' }],
|
|
15
|
+
slots: [],
|
|
16
|
+
parts: [
|
|
17
|
+
{ name: 'base', description: 'The raised surface.' },
|
|
18
|
+
{ name: 'icon', description: 'Wrapper around the icon.' },
|
|
19
|
+
{ name: 'svg', description: 'The rendered SVG element.' },
|
|
20
|
+
],
|
|
21
|
+
cssProperties: themeCssProperties,
|
|
22
|
+
keyboard: [
|
|
23
|
+
{ name: 'Enter', description: 'Activates the button on keydown.' },
|
|
24
|
+
{ name: 'Space', description: 'Activates the button on keyup, like a native button.' },
|
|
25
|
+
],
|
|
26
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { TextControlElement } from '../shared/text-control.js';
|
|
2
|
+
import { BLOCKS_IMPLICIT_SUBMIT } from '../text-field/implicit-submit.js';
|
|
3
|
+
export declare class NeuNumberField extends TextControlElement {
|
|
4
|
+
static def: import("../../ssr.js").ComponentDef<{
|
|
5
|
+
readonly value: {
|
|
6
|
+
readonly type: "string";
|
|
7
|
+
};
|
|
8
|
+
readonly min: {
|
|
9
|
+
readonly type: "number";
|
|
10
|
+
readonly default: number;
|
|
11
|
+
};
|
|
12
|
+
readonly max: {
|
|
13
|
+
readonly type: "number";
|
|
14
|
+
readonly default: number;
|
|
15
|
+
};
|
|
16
|
+
readonly step: {
|
|
17
|
+
readonly type: "number";
|
|
18
|
+
readonly default: 1;
|
|
19
|
+
};
|
|
20
|
+
readonly name: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
};
|
|
23
|
+
readonly label: {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
};
|
|
26
|
+
readonly placeholder: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
};
|
|
29
|
+
readonly helpText: {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
};
|
|
32
|
+
readonly errorText: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
};
|
|
35
|
+
readonly required: {
|
|
36
|
+
readonly type: "boolean";
|
|
37
|
+
};
|
|
38
|
+
readonly disabled: {
|
|
39
|
+
readonly type: "boolean";
|
|
40
|
+
};
|
|
41
|
+
readonly readOnly: {
|
|
42
|
+
readonly type: "boolean";
|
|
43
|
+
readonly attribute: "readonly";
|
|
44
|
+
};
|
|
45
|
+
readonly size: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly default: "md";
|
|
48
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
49
|
+
};
|
|
50
|
+
readonly incrementLabel: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly default: "Increase";
|
|
53
|
+
};
|
|
54
|
+
readonly decrementLabel: {
|
|
55
|
+
readonly type: "string";
|
|
56
|
+
readonly default: "Decrease";
|
|
57
|
+
};
|
|
58
|
+
}>;
|
|
59
|
+
static readonly [BLOCKS_IMPLICIT_SUBMIT] = true;
|
|
60
|
+
static extraProperties: string[];
|
|
61
|
+
min: number;
|
|
62
|
+
max: number;
|
|
63
|
+
step: number;
|
|
64
|
+
size: 'sm' | 'md' | 'lg';
|
|
65
|
+
incrementLabel: string;
|
|
66
|
+
decrementLabel: string;
|
|
67
|
+
protected readonly commitProps: string[];
|
|
68
|
+
private get np();
|
|
69
|
+
get valueAsNumber(): number;
|
|
70
|
+
set valueAsNumber(next: number);
|
|
71
|
+
/** The limits and step a native input of this field carries. */
|
|
72
|
+
private constrain;
|
|
73
|
+
protected probe(value: string): HTMLInputElement;
|
|
74
|
+
/** Moves the value, then reports it like a finished native edit: input (composed), then change. */
|
|
75
|
+
private move;
|
|
76
|
+
protected rendered(): void;
|
|
77
|
+
protected controlKeyDown(event: KeyboardEvent): void;
|
|
78
|
+
protected update(changed: ReadonlySet<string>): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { InferProps } from '../../core/props.js';
|
|
2
|
+
declare const props: {
|
|
3
|
+
readonly value: {
|
|
4
|
+
readonly type: "string";
|
|
5
|
+
};
|
|
6
|
+
readonly min: {
|
|
7
|
+
readonly type: "number";
|
|
8
|
+
readonly default: number;
|
|
9
|
+
};
|
|
10
|
+
readonly max: {
|
|
11
|
+
readonly type: "number";
|
|
12
|
+
readonly default: number;
|
|
13
|
+
};
|
|
14
|
+
readonly step: {
|
|
15
|
+
readonly type: "number";
|
|
16
|
+
readonly default: 1;
|
|
17
|
+
};
|
|
18
|
+
readonly name: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
};
|
|
21
|
+
readonly label: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
};
|
|
24
|
+
readonly placeholder: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
};
|
|
27
|
+
readonly helpText: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
};
|
|
30
|
+
readonly errorText: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
33
|
+
readonly required: {
|
|
34
|
+
readonly type: "boolean";
|
|
35
|
+
};
|
|
36
|
+
readonly disabled: {
|
|
37
|
+
readonly type: "boolean";
|
|
38
|
+
};
|
|
39
|
+
readonly readOnly: {
|
|
40
|
+
readonly type: "boolean";
|
|
41
|
+
readonly attribute: "readonly";
|
|
42
|
+
};
|
|
43
|
+
readonly size: {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
readonly default: "md";
|
|
46
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
47
|
+
};
|
|
48
|
+
readonly incrementLabel: {
|
|
49
|
+
readonly type: "string";
|
|
50
|
+
readonly default: "Increase";
|
|
51
|
+
};
|
|
52
|
+
readonly decrementLabel: {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
readonly default: "Decrease";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type NumberFieldProps = InferProps<typeof props>;
|
|
58
|
+
/** iOS has no minus key on the decimal keypad: ask for it only when negatives are out of range. */
|
|
59
|
+
export declare const decimalPad: (min: number) => boolean;
|
|
60
|
+
export declare const numberFieldDef: import("../../core/define.js").ComponentDef<{
|
|
61
|
+
readonly value: {
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
};
|
|
64
|
+
readonly min: {
|
|
65
|
+
readonly type: "number";
|
|
66
|
+
readonly default: number;
|
|
67
|
+
};
|
|
68
|
+
readonly max: {
|
|
69
|
+
readonly type: "number";
|
|
70
|
+
readonly default: number;
|
|
71
|
+
};
|
|
72
|
+
readonly step: {
|
|
73
|
+
readonly type: "number";
|
|
74
|
+
readonly default: 1;
|
|
75
|
+
};
|
|
76
|
+
readonly name: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
};
|
|
79
|
+
readonly label: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
};
|
|
82
|
+
readonly placeholder: {
|
|
83
|
+
readonly type: "string";
|
|
84
|
+
};
|
|
85
|
+
readonly helpText: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
};
|
|
88
|
+
readonly errorText: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
};
|
|
91
|
+
readonly required: {
|
|
92
|
+
readonly type: "boolean";
|
|
93
|
+
};
|
|
94
|
+
readonly disabled: {
|
|
95
|
+
readonly type: "boolean";
|
|
96
|
+
};
|
|
97
|
+
readonly readOnly: {
|
|
98
|
+
readonly type: "boolean";
|
|
99
|
+
readonly attribute: "readonly";
|
|
100
|
+
};
|
|
101
|
+
readonly size: {
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
readonly default: "md";
|
|
104
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
105
|
+
};
|
|
106
|
+
readonly incrementLabel: {
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
readonly default: "Increase";
|
|
109
|
+
};
|
|
110
|
+
readonly decrementLabel: {
|
|
111
|
+
readonly type: "string";
|
|
112
|
+
readonly default: "Decrease";
|
|
113
|
+
};
|
|
114
|
+
}>;
|
|
115
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineComponent } from '../../core/define.js';
|
|
2
|
+
import { html, unsafeHTML } from '../../core/html.js';
|
|
3
|
+
import { minusBody, plusBody, svgWrap } from '../icon/system-icons.js';
|
|
4
|
+
import { stepUnit } from '../shared/step.js';
|
|
5
|
+
import { numberFieldStyles } from './number-field.styles.js';
|
|
6
|
+
const props = {
|
|
7
|
+
value: { type: 'string' },
|
|
8
|
+
min: { type: 'number', default: Number.NaN },
|
|
9
|
+
max: { type: 'number', default: Number.NaN },
|
|
10
|
+
step: { type: 'number', default: 1 },
|
|
11
|
+
name: { type: 'string' },
|
|
12
|
+
label: { type: 'string' },
|
|
13
|
+
placeholder: { type: 'string' },
|
|
14
|
+
helpText: { type: 'string' },
|
|
15
|
+
errorText: { type: 'string' },
|
|
16
|
+
required: { type: 'boolean' },
|
|
17
|
+
disabled: { type: 'boolean' },
|
|
18
|
+
readOnly: { type: 'boolean', attribute: 'readonly' },
|
|
19
|
+
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
|
|
20
|
+
incrementLabel: { type: 'string', default: 'Increase' },
|
|
21
|
+
decrementLabel: { type: 'string', default: 'Decrease' },
|
|
22
|
+
};
|
|
23
|
+
/** iOS has no minus key on the decimal keypad: ask for it only when negatives are out of range. */
|
|
24
|
+
export const decimalPad = (min) => Number.isFinite(min) && min >= 0;
|
|
25
|
+
/** Attributes of the inner <input> that only appear when set. */
|
|
26
|
+
function inputAttributes(p) {
|
|
27
|
+
return html `${decimalPad(p.min) ? html ` inputmode="decimal"` : ''}${Number.isFinite(p.min) ? html ` min="${p.min}"` : ''}${Number.isFinite(p.max) ? html ` max="${p.max}"` : ''}${p.placeholder ? html ` placeholder="${p.placeholder}"` : ''}${p.required ? html ` required` : ''}${p.disabled ? html ` disabled` : ''}${p.readOnly ? html ` readonly` : ''}`;
|
|
28
|
+
}
|
|
29
|
+
const icon = (body) => unsafeHTML(svgWrap(body));
|
|
30
|
+
export const numberFieldDef = defineComponent({
|
|
31
|
+
tag: 'neu-number-field',
|
|
32
|
+
props,
|
|
33
|
+
delegatesFocus: true,
|
|
34
|
+
form: { valueProp: 'value' },
|
|
35
|
+
styles: numberFieldStyles,
|
|
36
|
+
template: (p) => {
|
|
37
|
+
const off = p.disabled || p.readOnly ? html ` disabled` : '';
|
|
38
|
+
return html `<div part="base" class="base"><label part="label" class="label" for="input"><slot name="label"><span class="label-text" data-ref="label-text">${p.label}</span></slot></label><div part="control" class="control"><button part="decrement" class="step" type="button" tabindex="-1" aria-label="${p.decrementLabel}" data-ref="decrement"${off}>${icon(minusBody)}</button><input part="input" class="input" id="input" data-ref="input" type="number" value="${p.value}" step="${stepUnit(p.step)}" aria-describedby="help"${inputAttributes(p)}><button part="increment" class="step" type="button" tabindex="-1" aria-label="${p.incrementLabel}" data-ref="increment"${off}>${icon(plusBody)}</button></div><div part="help-text" class="help" id="help"><slot name="help-text"><span class="help-text" data-ref="help-text">${p.helpText}</span></slot><span class="error-text" data-ref="error-text">${p.errorText}</span></div></div>`;
|
|
39
|
+
},
|
|
40
|
+
});
|