@neumorphism-ui/elements 1.0.0-next.2 → 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/cdn/neu.min.js +31 -39
- package/custom-elements.json +495 -248
- 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.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-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 +1 -5
- package/dist/components/checkbox/checkbox.def.d.ts +1 -5
- package/dist/components/checkbox/checkbox.def.js +6 -22
- package/dist/components/checkbox/checkbox.docs.d.ts +2 -0
- package/dist/components/checkbox/checkbox.docs.js +27 -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 +1 -1
- package/dist/components/icon/system-icons.js +3 -3
- 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 +0 -5
- package/dist/components/number-field/number-field.def.d.ts +0 -10
- package/dist/components/number-field/number-field.def.js +5 -27
- 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 +2 -2
- package/dist/components/number-field/number-field.styles.d.ts +1 -1
- package/dist/components/option/option.d.ts +0 -2
- package/dist/components/option/option.def.d.ts +0 -2
- package/dist/components/option/option.def.js +2 -9
- package/dist/components/option/option.docs.d.ts +2 -0
- package/dist/components/option/option.docs.js +12 -0
- package/dist/components/radio/radio.d.ts +0 -2
- package/dist/components/radio/radio.def.d.ts +0 -2
- package/dist/components/radio/radio.def.js +2 -15
- package/dist/components/radio/radio.docs.d.ts +2 -0
- package/dist/components/radio/radio.docs.js +18 -0
- package/dist/components/radio-group/radio-group.d.ts +3 -4
- package/dist/components/radio-group/radio-group.def.d.ts +0 -4
- package/dist/components/radio-group/radio-group.def.js +4 -19
- 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 +28 -4
- package/dist/components/radio-group/radio-group.styles.d.ts +1 -1
- package/dist/components/radio-group/radio-group.styles.js +3 -5
- package/dist/components/select/select.d.ts +1 -5
- package/dist/components/select/select.def.d.ts +0 -4
- package/dist/components/select/select.def.js +5 -29
- 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 +16 -10
- package/dist/components/select/select.styles.d.ts +1 -1
- package/dist/components/select/select.styles.js +1 -5
- package/dist/components/shared/field.styles.d.ts +1 -1
- package/dist/components/shared/field.styles.js +2 -4
- package/dist/components/slider/slider.d.ts +0 -2
- package/dist/components/slider/slider.def.d.ts +0 -2
- package/dist/components/slider/slider.def.js +2 -24
- package/dist/components/slider/slider.docs.d.ts +2 -0
- package/dist/components/slider/slider.docs.js +45 -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 +0 -5
- 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/text-field/text-field.d.ts +0 -6
- 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 +2 -2
- package/dist/components/text-field/text-field.styles.d.ts +1 -1
- package/dist/components/textarea/textarea.d.ts +0 -6
- package/dist/components/textarea/textarea.def.d.ts +0 -12
- package/dist/components/textarea/textarea.def.js +5 -26
- package/dist/components/textarea/textarea.docs.d.ts +2 -0
- package/dist/components/textarea/textarea.docs.js +40 -0
- package/dist/components/textarea/textarea.styles.d.ts +1 -1
- package/dist/components/theme-docs.d.ts +3 -0
- package/dist/components/theme-docs.js +8 -0
- package/dist/core/define.d.ts +4 -1
- package/dist/core/dom.d.ts +4 -0
- package/dist/core/dom.js +7 -0
- package/dist/core/form-control.js +4 -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/docs.d.ts +3 -0
- package/dist/docs.js +41 -0
- package/dist/ssr.d.ts +1 -1
- package/dist/ssr.js +1 -1
- package/package.json +5 -1
|
@@ -3,7 +3,6 @@ export declare class NeuAvatar extends NeuElement {
|
|
|
3
3
|
static def: import("../../ssr.js").ComponentDef<{
|
|
4
4
|
readonly src: {
|
|
5
5
|
readonly type: "string";
|
|
6
|
-
readonly reflect: true;
|
|
7
6
|
};
|
|
8
7
|
readonly label: {
|
|
9
8
|
readonly type: "string";
|
|
@@ -15,13 +14,11 @@ export declare class NeuAvatar extends NeuElement {
|
|
|
15
14
|
readonly type: "string";
|
|
16
15
|
readonly default: "md";
|
|
17
16
|
readonly values: readonly ["sm", "md", "lg"];
|
|
18
|
-
readonly reflect: true;
|
|
19
17
|
};
|
|
20
18
|
readonly shape: {
|
|
21
19
|
readonly type: "string";
|
|
22
20
|
readonly default: "circle";
|
|
23
21
|
readonly values: readonly ["circle", "rounded"];
|
|
24
|
-
readonly reflect: true;
|
|
25
22
|
};
|
|
26
23
|
}>;
|
|
27
24
|
src: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const avatarDef: import("../../core/define.js").ComponentDef<{
|
|
2
2
|
readonly src: {
|
|
3
3
|
readonly type: "string";
|
|
4
|
-
readonly reflect: true;
|
|
5
4
|
};
|
|
6
5
|
readonly label: {
|
|
7
6
|
readonly type: "string";
|
|
@@ -13,12 +12,10 @@ export declare const avatarDef: import("../../core/define.js").ComponentDef<{
|
|
|
13
12
|
readonly type: "string";
|
|
14
13
|
readonly default: "md";
|
|
15
14
|
readonly values: readonly ["sm", "md", "lg"];
|
|
16
|
-
readonly reflect: true;
|
|
17
15
|
};
|
|
18
16
|
readonly shape: {
|
|
19
17
|
readonly type: "string";
|
|
20
18
|
readonly default: "circle";
|
|
21
19
|
readonly values: readonly ["circle", "rounded"];
|
|
22
|
-
readonly reflect: true;
|
|
23
20
|
};
|
|
24
21
|
}>;
|
|
@@ -1,33 +1,19 @@
|
|
|
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 { avatarStyles } from './avatar.styles.js';
|
|
6
5
|
export const avatarDef = defineComponent({
|
|
7
6
|
tag: 'neu-avatar',
|
|
8
7
|
props: {
|
|
9
|
-
src: { type: 'string'
|
|
8
|
+
src: { type: 'string' },
|
|
10
9
|
label: { type: 'string' },
|
|
11
10
|
initials: { type: 'string' },
|
|
12
|
-
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg']
|
|
13
|
-
shape: { type: 'string', default: 'circle', values: ['circle', 'rounded']
|
|
11
|
+
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
|
|
12
|
+
shape: { type: 'string', default: 'circle', values: ['circle', 'rounded'] },
|
|
14
13
|
},
|
|
15
14
|
styles: avatarStyles,
|
|
16
15
|
template: (p) => {
|
|
17
|
-
const show = p.src ? 'image' : p.initials ? 'initials' : 'icon';
|
|
16
|
+
const show = p.src ? 'image' : p.initials.trim() ? 'initials' : 'icon';
|
|
18
17
|
return html `<span part="base" class="base" data-ref="base" data-show="${show}"><img part="image" class="image" data-ref="image" alt=""${p.src ? html ` src="${p.src}"` : ''}><span part="initials" class="initials" data-ref="initials">${p.initials}</span><span part="icon" class="icon">${unsafeHTML(systemIconSvg('user') ?? '')}</span></span>`;
|
|
19
18
|
},
|
|
20
|
-
docs: {
|
|
21
|
-
summary: 'A user picture that falls back to initials, then to a generic user icon. With `label` it is an image named by it; without, it is decorative and hidden from assistive technology.',
|
|
22
|
-
events: [],
|
|
23
|
-
slots: [],
|
|
24
|
-
parts: [
|
|
25
|
-
{ name: 'base', description: 'The sized, raised wrapper.' },
|
|
26
|
-
{ name: 'image', description: 'The picture.' },
|
|
27
|
-
{ name: 'initials', description: 'The initials shown when there is no picture.' },
|
|
28
|
-
{ name: 'icon', description: 'Wrapper around the fallback user icon.' },
|
|
29
|
-
{ name: 'svg', description: 'The rendered fallback SVG element.' },
|
|
30
|
-
],
|
|
31
|
-
cssProperties: themeCssProperties,
|
|
32
|
-
},
|
|
33
19
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { themeCssProperties } from '../theme-docs.js';
|
|
2
|
+
export const avatarDocs = {
|
|
3
|
+
summary: 'A user picture that falls back to initials, then to a generic user icon. With `label` it is an image named by it; without, it is decorative and hidden from assistive technology.',
|
|
4
|
+
descriptions: {
|
|
5
|
+
src: 'URL of the picture; when it is missing, empty or fails to load, the initials or the icon show instead.',
|
|
6
|
+
label: 'Accessible name that turns the avatar into an image; without it the avatar is decorative.',
|
|
7
|
+
initials: "Text shown when there is no picture, such as a person's initials.",
|
|
8
|
+
size: 'The avatar size.',
|
|
9
|
+
shape: 'The outline of the avatar.',
|
|
10
|
+
},
|
|
11
|
+
events: [],
|
|
12
|
+
slots: [],
|
|
13
|
+
parts: [
|
|
14
|
+
{ name: 'base', description: 'The sized, raised wrapper.' },
|
|
15
|
+
{ name: 'image', description: 'The picture.' },
|
|
16
|
+
{ name: 'initials', description: 'The initials shown when there is no picture.' },
|
|
17
|
+
{ name: 'icon', description: 'Wrapper around the fallback user icon.' },
|
|
18
|
+
{ name: 'svg', description: 'The rendered fallback SVG element.' },
|
|
19
|
+
],
|
|
20
|
+
cssProperties: themeCssProperties,
|
|
21
|
+
keyboard: [],
|
|
22
|
+
};
|
|
@@ -13,6 +13,8 @@ export class NeuAvatar extends NeuElement {
|
|
|
13
13
|
if (!img)
|
|
14
14
|
return;
|
|
15
15
|
img.addEventListener('error', () => this.setBroken(true));
|
|
16
|
+
// A load after an error (a stale one, from the previous src) means the current image is fine.
|
|
17
|
+
img.addEventListener('load', () => this.setBroken(false));
|
|
16
18
|
// The error event may have fired before this element upgraded; it will not fire again. An SVG
|
|
17
19
|
// without intrinsic size is not caught here: browsers give it a 300x150 (or viewBox) size.
|
|
18
20
|
if (img.hasAttribute('src') && img.complete && img.naturalWidth === 0)
|
|
@@ -45,7 +47,11 @@ export class NeuAvatar extends NeuElement {
|
|
|
45
47
|
base.dataset.show = show;
|
|
46
48
|
}
|
|
47
49
|
showing() {
|
|
48
|
-
return this.props.src && !this.broken
|
|
50
|
+
return this.props.src && !this.broken
|
|
51
|
+
? 'image'
|
|
52
|
+
: String(this.props.initials).trim()
|
|
53
|
+
? 'initials'
|
|
54
|
+
: 'icon';
|
|
49
55
|
}
|
|
50
56
|
setBroken(broken) {
|
|
51
57
|
if (this.broken === broken)
|
|
@@ -5,11 +5,9 @@ export declare class NeuBadge extends NeuElement {
|
|
|
5
5
|
readonly type: "string";
|
|
6
6
|
readonly default: "neutral";
|
|
7
7
|
readonly values: readonly ["neutral", "accent", "success", "warning", "danger"];
|
|
8
|
-
readonly reflect: true;
|
|
9
8
|
};
|
|
10
9
|
readonly pill: {
|
|
11
10
|
readonly type: "boolean";
|
|
12
|
-
readonly reflect: true;
|
|
13
11
|
};
|
|
14
12
|
}>;
|
|
15
13
|
variant: 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
|
|
@@ -3,10 +3,8 @@ export declare const badgeDef: import("../../core/define.js").ComponentDef<{
|
|
|
3
3
|
readonly type: "string";
|
|
4
4
|
readonly default: "neutral";
|
|
5
5
|
readonly values: readonly ["neutral", "accent", "success", "warning", "danger"];
|
|
6
|
-
readonly reflect: true;
|
|
7
6
|
};
|
|
8
7
|
readonly pill: {
|
|
9
8
|
readonly type: "boolean";
|
|
10
|
-
readonly reflect: true;
|
|
11
9
|
};
|
|
12
10
|
}>;
|
|
@@ -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 { badgeStyles } from './badge.styles.js';
|
|
5
4
|
export const badgeDef = defineComponent({
|
|
6
5
|
tag: 'neu-badge',
|
|
@@ -9,21 +8,9 @@ export const badgeDef = defineComponent({
|
|
|
9
8
|
type: 'string',
|
|
10
9
|
default: 'neutral',
|
|
11
10
|
values: ['neutral', 'accent', 'success', 'warning', 'danger'],
|
|
12
|
-
reflect: true,
|
|
13
11
|
},
|
|
14
|
-
pill: { type: 'boolean'
|
|
12
|
+
pill: { type: 'boolean' },
|
|
15
13
|
},
|
|
16
14
|
styles: badgeStyles,
|
|
17
15
|
template: () => html `<span part="base" class="base"><slot></slot></span>`,
|
|
18
|
-
docs: {
|
|
19
|
-
summary: 'A small raised label for status or counts.',
|
|
20
|
-
events: [],
|
|
21
|
-
slots: [{ name: '', description: 'The badge text.' }],
|
|
22
|
-
parts: [{ name: 'base', description: 'The badge itself.' }],
|
|
23
|
-
cssProperties: [
|
|
24
|
-
...themeCssProperties,
|
|
25
|
-
{ name: '--neu-success', description: 'Colour of the success variant.' },
|
|
26
|
-
{ name: '--neu-warning', description: 'Colour of the warning variant.' },
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
16
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { themeCssProperties } from '../theme-docs.js';
|
|
2
|
+
export const badgeDocs = {
|
|
3
|
+
summary: 'A small raised label for status or counts.',
|
|
4
|
+
descriptions: {
|
|
5
|
+
variant: "The colour that conveys the badge's meaning.",
|
|
6
|
+
pill: 'Rounds the badge into a capsule shape.',
|
|
7
|
+
},
|
|
8
|
+
events: [],
|
|
9
|
+
slots: [{ name: '', description: 'The badge text.' }],
|
|
10
|
+
parts: [{ name: 'base', description: 'The badge itself.' }],
|
|
11
|
+
cssProperties: [
|
|
12
|
+
...themeCssProperties,
|
|
13
|
+
{ name: '--neu-success', description: 'Colour of the success variant.' },
|
|
14
|
+
{ name: '--neu-warning', description: 'Colour of the warning variant.' },
|
|
15
|
+
],
|
|
16
|
+
keyboard: [],
|
|
17
|
+
};
|
|
@@ -3,26 +3,21 @@ export declare const buttonDef: import("../../core/define.js").ComponentDef<{
|
|
|
3
3
|
readonly type: "string";
|
|
4
4
|
readonly default: "default";
|
|
5
5
|
readonly values: readonly ["default", "primary", "flat"];
|
|
6
|
-
readonly reflect: true;
|
|
7
6
|
};
|
|
8
7
|
readonly size: {
|
|
9
8
|
readonly type: "string";
|
|
10
9
|
readonly default: "md";
|
|
11
10
|
readonly values: readonly ["sm", "md", "lg"];
|
|
12
|
-
readonly reflect: true;
|
|
13
11
|
};
|
|
14
12
|
readonly disabled: {
|
|
15
13
|
readonly type: "boolean";
|
|
16
|
-
readonly reflect: true;
|
|
17
14
|
};
|
|
18
15
|
readonly loading: {
|
|
19
16
|
readonly type: "boolean";
|
|
20
|
-
readonly reflect: true;
|
|
21
17
|
};
|
|
22
18
|
readonly type: {
|
|
23
19
|
readonly type: "string";
|
|
24
20
|
readonly default: "button";
|
|
25
21
|
readonly values: readonly ["button", "submit", "reset"];
|
|
26
|
-
readonly reflect: true;
|
|
27
22
|
};
|
|
28
23
|
}>;
|
|
@@ -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 { buttonStyles } from './button.styles.js';
|
|
5
4
|
export const buttonDef = defineComponent({
|
|
6
5
|
tag: 'neu-button',
|
|
@@ -9,37 +8,16 @@ export const buttonDef = defineComponent({
|
|
|
9
8
|
type: 'string',
|
|
10
9
|
default: 'default',
|
|
11
10
|
values: ['default', 'primary', 'flat'],
|
|
12
|
-
reflect: true,
|
|
13
11
|
},
|
|
14
|
-
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg']
|
|
15
|
-
disabled: { type: 'boolean'
|
|
16
|
-
loading: { type: 'boolean'
|
|
12
|
+
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
|
|
13
|
+
disabled: { type: 'boolean' },
|
|
14
|
+
loading: { type: 'boolean' },
|
|
17
15
|
type: {
|
|
18
16
|
type: 'string',
|
|
19
17
|
default: 'button',
|
|
20
18
|
values: ['button', 'submit', 'reset'],
|
|
21
|
-
reflect: true,
|
|
22
19
|
},
|
|
23
20
|
},
|
|
24
21
|
styles: buttonStyles,
|
|
25
22
|
template: () => html `<span part="base" class="base"><span part="prefix" class="prefix"><slot name="prefix"></slot></span><span part="label" class="label"><slot></slot></span><span part="suffix" class="suffix"><slot name="suffix"></slot></span><span part="spinner" class="spinner" aria-hidden="true"></span></span>`,
|
|
26
|
-
docs: {
|
|
27
|
-
summary: 'A raised button. Use variant="primary" for the main action of a view.',
|
|
28
|
-
events: [
|
|
29
|
-
{ name: 'click', description: 'Fired on activation; never while disabled or loading.' },
|
|
30
|
-
],
|
|
31
|
-
slots: [
|
|
32
|
-
{ name: '', description: 'Button label.' },
|
|
33
|
-
{ name: 'prefix', description: 'Content before the label, such as an icon.' },
|
|
34
|
-
{ name: 'suffix', description: 'Content after the label.' },
|
|
35
|
-
],
|
|
36
|
-
parts: [
|
|
37
|
-
{ name: 'base', description: 'The raised surface.' },
|
|
38
|
-
{ name: 'label', description: 'Wrapper around the default slot.' },
|
|
39
|
-
{ name: 'prefix', description: 'Wrapper around the prefix slot.' },
|
|
40
|
-
{ name: 'suffix', description: 'Wrapper around the suffix slot.' },
|
|
41
|
-
{ name: 'spinner', description: 'Spinner shown while loading.' },
|
|
42
|
-
],
|
|
43
|
-
cssProperties: themeCssProperties,
|
|
44
|
-
},
|
|
45
23
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { themeCssProperties } from '../theme-docs.js';
|
|
2
|
+
export const buttonDocs = {
|
|
3
|
+
summary: 'A raised button. Use variant="primary" for the main action of a view.',
|
|
4
|
+
descriptions: {
|
|
5
|
+
variant: 'The visual emphasis of the button.',
|
|
6
|
+
size: 'The button size.',
|
|
7
|
+
disabled: 'Prevents interaction and dims the button.',
|
|
8
|
+
loading: 'Shows a spinner and blocks activation while work is in progress.',
|
|
9
|
+
type: 'What the button does inside a form; defaults to "button", which does nothing.',
|
|
10
|
+
},
|
|
11
|
+
events: [{ name: 'click', description: 'Fired on activation; never while disabled or loading.' }],
|
|
12
|
+
slots: [
|
|
13
|
+
{ name: '', description: 'Button label.' },
|
|
14
|
+
{ name: 'prefix', description: 'Content before the label, such as an icon.' },
|
|
15
|
+
{ name: 'suffix', description: 'Content after the label.' },
|
|
16
|
+
],
|
|
17
|
+
parts: [
|
|
18
|
+
{ name: 'base', description: 'The raised surface.' },
|
|
19
|
+
{ name: 'label', description: 'Wrapper around the default slot.' },
|
|
20
|
+
{ name: 'prefix', description: 'Wrapper around the prefix slot.' },
|
|
21
|
+
{ name: 'suffix', description: 'Wrapper around the suffix slot.' },
|
|
22
|
+
{ name: 'spinner', description: 'Spinner shown while loading.' },
|
|
23
|
+
],
|
|
24
|
+
cssProperties: themeCssProperties,
|
|
25
|
+
keyboard: [
|
|
26
|
+
{ name: 'Enter', description: 'Activates the button on keydown.' },
|
|
27
|
+
{ name: 'Space', description: 'Activates the button on keyup, like a native button.' },
|
|
28
|
+
],
|
|
29
|
+
};
|
|
@@ -3,13 +3,11 @@ export declare class NeuButtonGroup extends NeuElement {
|
|
|
3
3
|
static def: import("../../ssr.js").ComponentDef<{
|
|
4
4
|
readonly label: {
|
|
5
5
|
readonly type: "string";
|
|
6
|
-
readonly reflect: true;
|
|
7
6
|
};
|
|
8
7
|
readonly orientation: {
|
|
9
8
|
readonly type: "string";
|
|
10
9
|
readonly default: "horizontal";
|
|
11
10
|
readonly values: readonly ["horizontal", "vertical"];
|
|
12
|
-
readonly reflect: true;
|
|
13
11
|
};
|
|
14
12
|
}>;
|
|
15
13
|
label: string;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export declare const buttonGroupDef: import("../../core/define.js").ComponentDef<{
|
|
2
2
|
readonly label: {
|
|
3
3
|
readonly type: "string";
|
|
4
|
-
readonly reflect: true;
|
|
5
4
|
};
|
|
6
5
|
readonly orientation: {
|
|
7
6
|
readonly type: "string";
|
|
8
7
|
readonly default: "horizontal";
|
|
9
8
|
readonly values: readonly ["horizontal", "vertical"];
|
|
10
|
-
readonly reflect: true;
|
|
11
9
|
};
|
|
12
10
|
}>;
|
|
@@ -1,25 +1,16 @@
|
|
|
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 { buttonGroupStyles } from './button-group.styles.js';
|
|
5
4
|
export const buttonGroupDef = defineComponent({
|
|
6
5
|
tag: 'neu-button-group',
|
|
7
6
|
props: {
|
|
8
|
-
label: { type: 'string'
|
|
7
|
+
label: { type: 'string' },
|
|
9
8
|
orientation: {
|
|
10
9
|
type: 'string',
|
|
11
10
|
default: 'horizontal',
|
|
12
11
|
values: ['horizontal', 'vertical'],
|
|
13
|
-
reflect: true,
|
|
14
12
|
},
|
|
15
13
|
},
|
|
16
14
|
styles: buttonGroupStyles,
|
|
17
15
|
template: () => html `<span part="base" class="base"><slot></slot></span>`,
|
|
18
|
-
docs: {
|
|
19
|
-
summary: 'Merges adjacent buttons into one raised block.',
|
|
20
|
-
events: [],
|
|
21
|
-
slots: [{ name: '', description: 'neu-button and neu-icon-button elements.' }],
|
|
22
|
-
parts: [{ name: 'base', description: 'The raised wrapper around the buttons.' }],
|
|
23
|
-
cssProperties: themeCssProperties,
|
|
24
|
-
},
|
|
25
16
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { themeCssProperties } from '../theme-docs.js';
|
|
2
|
+
export const buttonGroupDocs = {
|
|
3
|
+
summary: 'Merges adjacent buttons into one raised block.',
|
|
4
|
+
descriptions: {
|
|
5
|
+
label: 'Accessible name of the group, announced by assistive technology.',
|
|
6
|
+
orientation: 'The direction the buttons are laid out in.',
|
|
7
|
+
},
|
|
8
|
+
events: [],
|
|
9
|
+
slots: [{ name: '', description: 'neu-button and neu-icon-button elements.' }],
|
|
10
|
+
parts: [{ name: 'base', description: 'The raised wrapper around the buttons.' }],
|
|
11
|
+
cssProperties: themeCssProperties,
|
|
12
|
+
keyboard: [],
|
|
13
|
+
};
|
|
@@ -6,29 +6,25 @@ export declare class NeuCheckbox extends CheckableElement {
|
|
|
6
6
|
};
|
|
7
7
|
readonly indeterminate: {
|
|
8
8
|
readonly type: "boolean";
|
|
9
|
+
readonly reflect: false;
|
|
9
10
|
};
|
|
10
11
|
readonly name: {
|
|
11
12
|
readonly type: "string";
|
|
12
|
-
readonly reflect: true;
|
|
13
13
|
};
|
|
14
14
|
readonly value: {
|
|
15
15
|
readonly type: "string";
|
|
16
16
|
readonly default: "on";
|
|
17
|
-
readonly reflect: true;
|
|
18
17
|
};
|
|
19
18
|
readonly disabled: {
|
|
20
19
|
readonly type: "boolean";
|
|
21
|
-
readonly reflect: true;
|
|
22
20
|
};
|
|
23
21
|
readonly required: {
|
|
24
22
|
readonly type: "boolean";
|
|
25
|
-
readonly reflect: true;
|
|
26
23
|
};
|
|
27
24
|
readonly size: {
|
|
28
25
|
readonly type: "string";
|
|
29
26
|
readonly default: "md";
|
|
30
27
|
readonly values: readonly ["sm", "md", "lg"];
|
|
31
|
-
readonly reflect: true;
|
|
32
28
|
};
|
|
33
29
|
}>;
|
|
34
30
|
/** Only Space toggles, like a native checkbox. */
|
|
@@ -4,28 +4,24 @@ export declare const checkboxDef: import("../../core/define.js").ComponentDef<{
|
|
|
4
4
|
};
|
|
5
5
|
readonly indeterminate: {
|
|
6
6
|
readonly type: "boolean";
|
|
7
|
+
readonly reflect: false;
|
|
7
8
|
};
|
|
8
9
|
readonly name: {
|
|
9
10
|
readonly type: "string";
|
|
10
|
-
readonly reflect: true;
|
|
11
11
|
};
|
|
12
12
|
readonly value: {
|
|
13
13
|
readonly type: "string";
|
|
14
14
|
readonly default: "on";
|
|
15
|
-
readonly reflect: true;
|
|
16
15
|
};
|
|
17
16
|
readonly disabled: {
|
|
18
17
|
readonly type: "boolean";
|
|
19
|
-
readonly reflect: true;
|
|
20
18
|
};
|
|
21
19
|
readonly required: {
|
|
22
20
|
readonly type: "boolean";
|
|
23
|
-
readonly reflect: true;
|
|
24
21
|
};
|
|
25
22
|
readonly size: {
|
|
26
23
|
readonly type: "string";
|
|
27
24
|
readonly default: "md";
|
|
28
25
|
readonly values: readonly ["sm", "md", "lg"];
|
|
29
|
-
readonly reflect: true;
|
|
30
26
|
};
|
|
31
27
|
}>;
|
|
@@ -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 { checkBody, minusBody, svgWrap } from '../icon/system-icons.js';
|
|
5
4
|
import { checkboxStyles } from './checkbox.styles.js';
|
|
6
5
|
const checkSvg = unsafeHTML(svgWrap(checkBody));
|
|
@@ -9,29 +8,14 @@ export const checkboxDef = defineComponent({
|
|
|
9
8
|
tag: 'neu-checkbox',
|
|
10
9
|
props: {
|
|
11
10
|
checked: { type: 'boolean' },
|
|
12
|
-
indeterminate: { type: 'boolean' },
|
|
13
|
-
name: { type: 'string'
|
|
14
|
-
value: { type: 'string', default: 'on'
|
|
15
|
-
disabled: { type: 'boolean'
|
|
16
|
-
required: { type: 'boolean'
|
|
17
|
-
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg']
|
|
11
|
+
indeterminate: { type: 'boolean', reflect: false },
|
|
12
|
+
name: { type: 'string' },
|
|
13
|
+
value: { type: 'string', default: 'on' },
|
|
14
|
+
disabled: { type: 'boolean' },
|
|
15
|
+
required: { type: 'boolean' },
|
|
16
|
+
size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
|
|
18
17
|
},
|
|
19
18
|
form: { valueProp: 'checked' },
|
|
20
19
|
styles: checkboxStyles,
|
|
21
20
|
template: (p) => html `<span part="base" class="base"><span part="control" class="control${p.checked ? ' on' : ''}${p.indeterminate ? ' mixed' : ''}" data-ref="control"><span part="indicator" class="indicator">${checkSvg}${minusSvg}</span></span><span part="label" class="label"><slot></slot></span></span>`,
|
|
22
|
-
docs: {
|
|
23
|
-
summary: 'A checkbox. The checked attribute is the default state; indeterminate is a property whose attribute only sets the initial state.',
|
|
24
|
-
events: [
|
|
25
|
-
{ name: 'input', description: 'Fired when the user toggles the checkbox.' },
|
|
26
|
-
{ name: 'change', description: 'Fired after input when the user toggles the checkbox.' },
|
|
27
|
-
],
|
|
28
|
-
slots: [{ name: '', description: 'Label; also the accessible name.' }],
|
|
29
|
-
parts: [
|
|
30
|
-
{ name: 'base', description: 'Wrapper around control and label.' },
|
|
31
|
-
{ name: 'control', description: 'The inset box.' },
|
|
32
|
-
{ name: 'indicator', description: 'The check or minus mark.' },
|
|
33
|
-
{ name: 'label', description: 'Wrapper around the default slot.' },
|
|
34
|
-
],
|
|
35
|
-
cssProperties: themeCssProperties,
|
|
36
|
-
},
|
|
37
21
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { themeCssProperties } from '../theme-docs.js';
|
|
2
|
+
export const checkboxDocs = {
|
|
3
|
+
summary: 'A checkbox. The checked attribute is the default state; indeterminate is a property that the attribute also sets.',
|
|
4
|
+
descriptions: {
|
|
5
|
+
checked: 'Whether the checkbox is currently checked.',
|
|
6
|
+
indeterminate: 'Shows the mixed state; the attribute is observed, so changing it later also sets the property.',
|
|
7
|
+
name: 'The name under which the value is submitted with a form.',
|
|
8
|
+
value: 'The value submitted with the form while the checkbox is checked; defaults to "on".',
|
|
9
|
+
disabled: 'Prevents interaction and leaves the checkbox out of form submission.',
|
|
10
|
+
required: 'Makes the form invalid until the checkbox is checked.',
|
|
11
|
+
size: 'The checkbox size.',
|
|
12
|
+
defaultChecked: 'Whether the checkbox starts checked, which a form reset restores; set by the checked attribute.',
|
|
13
|
+
},
|
|
14
|
+
events: [
|
|
15
|
+
{ name: 'input', description: 'Fired when the user toggles the checkbox.' },
|
|
16
|
+
{ name: 'change', description: 'Fired after input when the user toggles the checkbox.' },
|
|
17
|
+
],
|
|
18
|
+
slots: [{ name: '', description: 'Label; also the accessible name.' }],
|
|
19
|
+
parts: [
|
|
20
|
+
{ name: 'base', description: 'Wrapper around control and label.' },
|
|
21
|
+
{ name: 'control', description: 'The inset box.' },
|
|
22
|
+
{ name: 'indicator', description: 'The check or minus mark.' },
|
|
23
|
+
{ name: 'label', description: 'Wrapper around the default slot.' },
|
|
24
|
+
],
|
|
25
|
+
cssProperties: themeCssProperties,
|
|
26
|
+
keyboard: [{ name: 'Space', description: 'Toggles the checkbox.' }],
|
|
27
|
+
};
|
|
@@ -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
|
}>;
|