@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.
Files changed (129) hide show
  1. package/cdn/neu.min.js +31 -39
  2. package/custom-elements.json +495 -248
  3. package/dist/components/avatar/avatar.d.ts +0 -3
  4. package/dist/components/avatar/avatar.def.d.ts +0 -3
  5. package/dist/components/avatar/avatar.def.js +4 -18
  6. package/dist/components/avatar/avatar.docs.d.ts +2 -0
  7. package/dist/components/avatar/avatar.docs.js +22 -0
  8. package/dist/components/avatar/avatar.js +7 -1
  9. package/dist/components/badge/badge.d.ts +0 -2
  10. package/dist/components/badge/badge.def.d.ts +0 -2
  11. package/dist/components/badge/badge.def.js +1 -14
  12. package/dist/components/badge/badge.docs.d.ts +2 -0
  13. package/dist/components/badge/badge.docs.js +17 -0
  14. package/dist/components/button/button.def.d.ts +0 -5
  15. package/dist/components/button/button.def.js +3 -25
  16. package/dist/components/button/button.docs.d.ts +2 -0
  17. package/dist/components/button/button.docs.js +29 -0
  18. package/dist/components/button-group/button-group.d.ts +0 -2
  19. package/dist/components/button-group/button-group.def.d.ts +0 -2
  20. package/dist/components/button-group/button-group.def.js +1 -10
  21. package/dist/components/button-group/button-group.docs.d.ts +2 -0
  22. package/dist/components/button-group/button-group.docs.js +13 -0
  23. package/dist/components/checkbox/checkbox.d.ts +1 -5
  24. package/dist/components/checkbox/checkbox.def.d.ts +1 -5
  25. package/dist/components/checkbox/checkbox.def.js +6 -22
  26. package/dist/components/checkbox/checkbox.docs.d.ts +2 -0
  27. package/dist/components/checkbox/checkbox.docs.js +27 -0
  28. package/dist/components/divider/divider.d.ts +0 -1
  29. package/dist/components/divider/divider.def.d.ts +0 -1
  30. package/dist/components/divider/divider.def.js +0 -9
  31. package/dist/components/divider/divider.docs.d.ts +2 -0
  32. package/dist/components/divider/divider.docs.js +12 -0
  33. package/dist/components/icon/icon.d.ts +0 -3
  34. package/dist/components/icon/icon.def.d.ts +0 -3
  35. package/dist/components/icon/icon.def.js +3 -10
  36. package/dist/components/icon/icon.docs.d.ts +2 -0
  37. package/dist/components/icon/icon.docs.js +13 -0
  38. package/dist/components/icon/system-icons.d.ts +1 -1
  39. package/dist/components/icon/system-icons.js +3 -3
  40. package/dist/components/icon-button/icon-button.d.ts +0 -5
  41. package/dist/components/icon-button/icon-button.def.d.ts +0 -5
  42. package/dist/components/icon-button/icon-button.def.js +3 -17
  43. package/dist/components/icon-button/icon-button.docs.d.ts +2 -0
  44. package/dist/components/icon-button/icon-button.docs.js +26 -0
  45. package/dist/components/number-field/number-field.d.ts +0 -5
  46. package/dist/components/number-field/number-field.def.d.ts +0 -10
  47. package/dist/components/number-field/number-field.def.js +5 -27
  48. package/dist/components/number-field/number-field.docs.d.ts +2 -0
  49. package/dist/components/number-field/number-field.docs.js +45 -0
  50. package/dist/components/number-field/number-field.js +2 -2
  51. package/dist/components/number-field/number-field.styles.d.ts +1 -1
  52. package/dist/components/option/option.d.ts +0 -2
  53. package/dist/components/option/option.def.d.ts +0 -2
  54. package/dist/components/option/option.def.js +2 -9
  55. package/dist/components/option/option.docs.d.ts +2 -0
  56. package/dist/components/option/option.docs.js +12 -0
  57. package/dist/components/radio/radio.d.ts +0 -2
  58. package/dist/components/radio/radio.def.d.ts +0 -2
  59. package/dist/components/radio/radio.def.js +2 -15
  60. package/dist/components/radio/radio.docs.d.ts +2 -0
  61. package/dist/components/radio/radio.docs.js +18 -0
  62. package/dist/components/radio-group/radio-group.d.ts +3 -4
  63. package/dist/components/radio-group/radio-group.def.d.ts +0 -4
  64. package/dist/components/radio-group/radio-group.def.js +4 -19
  65. package/dist/components/radio-group/radio-group.docs.d.ts +2 -0
  66. package/dist/components/radio-group/radio-group.docs.js +37 -0
  67. package/dist/components/radio-group/radio-group.js +28 -4
  68. package/dist/components/radio-group/radio-group.styles.d.ts +1 -1
  69. package/dist/components/radio-group/radio-group.styles.js +3 -5
  70. package/dist/components/select/select.d.ts +1 -5
  71. package/dist/components/select/select.def.d.ts +0 -4
  72. package/dist/components/select/select.def.js +5 -29
  73. package/dist/components/select/select.docs.d.ts +2 -0
  74. package/dist/components/select/select.docs.js +65 -0
  75. package/dist/components/select/select.js +16 -10
  76. package/dist/components/select/select.styles.d.ts +1 -1
  77. package/dist/components/select/select.styles.js +1 -5
  78. package/dist/components/shared/field.styles.d.ts +1 -1
  79. package/dist/components/shared/field.styles.js +2 -4
  80. package/dist/components/slider/slider.d.ts +0 -2
  81. package/dist/components/slider/slider.def.d.ts +0 -2
  82. package/dist/components/slider/slider.def.js +2 -24
  83. package/dist/components/slider/slider.docs.d.ts +2 -0
  84. package/dist/components/slider/slider.docs.js +45 -0
  85. package/dist/components/spinner/spinner.d.ts +0 -1
  86. package/dist/components/spinner/spinner.def.d.ts +0 -1
  87. package/dist/components/spinner/spinner.def.js +1 -13
  88. package/dist/components/spinner/spinner.docs.d.ts +2 -0
  89. package/dist/components/spinner/spinner.docs.js +17 -0
  90. package/dist/components/surface/surface.d.ts +0 -4
  91. package/dist/components/surface/surface.def.d.ts +0 -4
  92. package/dist/components/surface/surface.def.js +3 -12
  93. package/dist/components/surface/surface.docs.d.ts +2 -0
  94. package/dist/components/surface/surface.docs.js +15 -0
  95. package/dist/components/switch/switch.d.ts +0 -5
  96. package/dist/components/switch/switch.def.d.ts +0 -5
  97. package/dist/components/switch/switch.def.js +5 -21
  98. package/dist/components/switch/switch.docs.d.ts +2 -0
  99. package/dist/components/switch/switch.docs.js +26 -0
  100. package/dist/components/text-field/text-field.d.ts +0 -6
  101. package/dist/components/text-field/text-field.def.d.ts +0 -12
  102. package/dist/components/text-field/text-field.def.js +5 -30
  103. package/dist/components/text-field/text-field.docs.d.ts +2 -0
  104. package/dist/components/text-field/text-field.docs.js +45 -0
  105. package/dist/components/text-field/text-field.js +2 -2
  106. package/dist/components/text-field/text-field.styles.d.ts +1 -1
  107. package/dist/components/textarea/textarea.d.ts +0 -6
  108. package/dist/components/textarea/textarea.def.d.ts +0 -12
  109. package/dist/components/textarea/textarea.def.js +5 -26
  110. package/dist/components/textarea/textarea.docs.d.ts +2 -0
  111. package/dist/components/textarea/textarea.docs.js +40 -0
  112. package/dist/components/textarea/textarea.styles.d.ts +1 -1
  113. package/dist/components/theme-docs.d.ts +3 -0
  114. package/dist/components/theme-docs.js +8 -0
  115. package/dist/core/define.d.ts +4 -1
  116. package/dist/core/dom.d.ts +4 -0
  117. package/dist/core/dom.js +7 -0
  118. package/dist/core/form-control.js +4 -1
  119. package/dist/core/neu-element.d.ts +2 -2
  120. package/dist/core/neu-element.js +10 -7
  121. package/dist/core/props.d.ts +13 -1
  122. package/dist/core/props.js +13 -3
  123. package/dist/core/styles.d.ts +0 -2
  124. package/dist/core/styles.js +0 -7
  125. package/dist/docs.d.ts +3 -0
  126. package/dist/docs.js +41 -0
  127. package/dist/ssr.d.ts +1 -1
  128. package/dist/ssr.js +1 -1
  129. package/package.json +5 -1
@@ -0,0 +1,45 @@
1
+ import { themeCssProperties } from '../theme-docs.js';
2
+ export const sliderDocs = {
3
+ summary: 'A horizontal slider for a number. The value attribute is the default; the value property is the current value. The valueFormatter property turns the value into the text a screen reader announces.',
4
+ descriptions: {
5
+ value: 'The current number, snapped to the nearest step within the range.',
6
+ min: 'The lowest value of the range.',
7
+ max: 'The highest value of the range.',
8
+ step: 'The distance between allowed values.',
9
+ name: 'The name under which the value is submitted with a form.',
10
+ label: 'Accessible name of the slider.',
11
+ disabled: 'Prevents interaction and leaves the slider out of form submission.',
12
+ defaultValue: 'The value the slider starts with, which a form reset restores; set by the value attribute.',
13
+ valueFormatter: 'Function that turns the value into the text a screen reader announces.',
14
+ },
15
+ events: [
16
+ {
17
+ name: 'input',
18
+ description: 'Fired on every change while the user drags or presses a key.',
19
+ },
20
+ {
21
+ name: 'change',
22
+ description: 'Fired after the user commits a change: on release, or per key.',
23
+ },
24
+ ],
25
+ slots: [],
26
+ parts: [
27
+ { name: 'base', description: 'Wrapper around the track.' },
28
+ { name: 'track', description: 'The inset groove.' },
29
+ { name: 'fill', description: 'The part of the track up to the thumb.' },
30
+ { name: 'thumb', description: 'The raised handle.' },
31
+ ],
32
+ cssProperties: themeCssProperties,
33
+ keyboard: [
34
+ {
35
+ name: 'ArrowRight / ArrowUp',
36
+ description: 'Increases the value by step; left and right swap in right-to-left text.',
37
+ },
38
+ { name: 'ArrowLeft / ArrowDown', description: 'Decreases the value by step.' },
39
+ {
40
+ name: 'PageUp / PageDown',
41
+ description: 'Changes the value by a large step: the larger of step and a tenth of the range.',
42
+ },
43
+ { name: 'Home / End', description: 'Sets the value to min or max.' },
44
+ ],
45
+ };
@@ -9,7 +9,6 @@ export declare class NeuSpinner extends NeuElement {
9
9
  readonly type: "string";
10
10
  readonly default: "md";
11
11
  readonly values: readonly ["sm", "md", "lg"];
12
- readonly reflect: true;
13
12
  };
14
13
  }>;
15
14
  label: string;
@@ -7,6 +7,5 @@ export declare const spinnerDef: import("../../core/define.js").ComponentDef<{
7
7
  readonly type: "string";
8
8
  readonly default: "md";
9
9
  readonly values: readonly ["sm", "md", "lg"];
10
- readonly reflect: true;
11
10
  };
12
11
  }>;
@@ -1,25 +1,13 @@
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 { spinnerStyles } from './spinner.styles.js';
5
4
  export const spinnerDef = defineComponent({
6
5
  tag: 'neu-spinner',
7
6
  props: {
8
7
  label: { type: 'string', default: 'Loading' },
9
- size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'], reflect: true },
8
+ size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
10
9
  },
11
10
  styles: spinnerStyles,
12
11
  // The label is also visually hidden text: a live region announces content, not its name.
13
12
  template: (p) => html `<span part="base" class="base"><span part="track" class="track"></span><span part="indicator" class="indicator"></span><span class="label" data-ref="label">${p.label}</span></span>`,
14
- docs: {
15
- summary: 'A rotating indicator for work in progress.',
16
- events: [],
17
- slots: [],
18
- parts: [
19
- { name: 'base', description: 'The sized wrapper.' },
20
- { name: 'track', description: 'The inset ring behind the indicator.' },
21
- { name: 'indicator', description: 'The rotating arc.' },
22
- ],
23
- cssProperties: themeCssProperties,
24
- },
25
13
  });
@@ -0,0 +1,2 @@
1
+ import type { ComponentDocs } from '../../core/define.js';
2
+ export declare const spinnerDocs: ComponentDocs;
@@ -0,0 +1,17 @@
1
+ import { themeCssProperties } from '../theme-docs.js';
2
+ export const spinnerDocs = {
3
+ summary: 'A rotating indicator for work in progress.',
4
+ descriptions: {
5
+ label: 'Accessible name announced for the spinner; defaults to "Loading".',
6
+ size: 'The spinner size.',
7
+ },
8
+ events: [],
9
+ slots: [],
10
+ parts: [
11
+ { name: 'base', description: 'The sized wrapper.' },
12
+ { name: 'track', description: 'The inset ring behind the indicator.' },
13
+ { name: 'indicator', description: 'The rotating arc.' },
14
+ ],
15
+ cssProperties: themeCssProperties,
16
+ keyboard: [],
17
+ };
@@ -5,25 +5,21 @@ export declare class NeuSurface extends NeuElement {
5
5
  readonly type: "string";
6
6
  readonly default: "raised";
7
7
  readonly values: readonly ["raised", "inset", "flat", "convex", "concave"];
8
- readonly reflect: true;
9
8
  };
10
9
  readonly elevation: {
11
10
  readonly type: "string";
12
11
  readonly default: "md";
13
12
  readonly values: readonly ["sm", "md", "lg"];
14
- readonly reflect: true;
15
13
  };
16
14
  readonly radius: {
17
15
  readonly type: "string";
18
16
  readonly default: "md";
19
17
  readonly values: readonly ["sm", "md", "lg", "full"];
20
- readonly reflect: true;
21
18
  };
22
19
  readonly padding: {
23
20
  readonly type: "string";
24
21
  readonly default: "md";
25
22
  readonly values: readonly ["none", "sm", "md", "lg"];
26
- readonly reflect: true;
27
23
  };
28
24
  }>;
29
25
  shape: 'raised' | 'inset' | 'flat' | 'convex' | 'concave';
@@ -3,24 +3,20 @@ export declare const surfaceDef: import("../../core/define.js").ComponentDef<{
3
3
  readonly type: "string";
4
4
  readonly default: "raised";
5
5
  readonly values: readonly ["raised", "inset", "flat", "convex", "concave"];
6
- readonly reflect: true;
7
6
  };
8
7
  readonly elevation: {
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 radius: {
15
13
  readonly type: "string";
16
14
  readonly default: "md";
17
15
  readonly values: readonly ["sm", "md", "lg", "full"];
18
- readonly reflect: true;
19
16
  };
20
17
  readonly padding: {
21
18
  readonly type: "string";
22
19
  readonly default: "md";
23
20
  readonly values: readonly ["none", "sm", "md", "lg"];
24
- readonly reflect: true;
25
21
  };
26
22
  }>;
@@ -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 { surfaceStyles } from './surface.styles.js';
5
4
  export const surfaceDef = defineComponent({
6
5
  tag: 'neu-surface',
@@ -9,19 +8,11 @@ export const surfaceDef = defineComponent({
9
8
  type: 'string',
10
9
  default: 'raised',
11
10
  values: ['raised', 'inset', 'flat', 'convex', 'concave'],
12
- reflect: true,
13
11
  },
14
- elevation: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'], reflect: true },
15
- radius: { type: 'string', default: 'md', values: ['sm', 'md', 'lg', 'full'], reflect: true },
16
- padding: { type: 'string', default: 'md', values: ['none', 'sm', 'md', 'lg'], reflect: true },
12
+ elevation: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
13
+ radius: { type: 'string', default: 'md', values: ['sm', 'md', 'lg', 'full'] },
14
+ padding: { type: 'string', default: 'md', values: ['none', 'sm', 'md', 'lg'] },
17
15
  },
18
16
  styles: surfaceStyles,
19
17
  template: () => html `<div part="base" class="base"><slot></slot></div>`,
20
- docs: {
21
- summary: 'A neumorphic container with its own shape, elevation, radius and padding.',
22
- events: [],
23
- slots: [{ name: '', description: 'The content of the surface.' }],
24
- parts: [{ name: 'base', description: 'The surface itself.' }],
25
- cssProperties: themeCssProperties,
26
- },
27
18
  });
@@ -0,0 +1,2 @@
1
+ import type { ComponentDocs } from '../../core/define.js';
2
+ export declare const surfaceDocs: ComponentDocs;
@@ -0,0 +1,15 @@
1
+ import { themeCssProperties } from '../theme-docs.js';
2
+ export const surfaceDocs = {
3
+ summary: 'A neumorphic container with its own shape, elevation, radius and padding.',
4
+ descriptions: {
5
+ shape: 'How the surface is lit and curved.',
6
+ elevation: 'How far the surface appears to lift off its background.',
7
+ radius: 'How rounded the corners are.',
8
+ padding: 'The space between the edge and the content.',
9
+ },
10
+ events: [],
11
+ slots: [{ name: '', description: 'The content of the surface.' }],
12
+ parts: [{ name: 'base', description: 'The surface itself.' }],
13
+ cssProperties: themeCssProperties,
14
+ keyboard: [],
15
+ };
@@ -6,26 +6,21 @@ export declare class NeuSwitch extends CheckableElement {
6
6
  };
7
7
  readonly name: {
8
8
  readonly type: "string";
9
- readonly reflect: true;
10
9
  };
11
10
  readonly value: {
12
11
  readonly type: "string";
13
12
  readonly default: "on";
14
- readonly reflect: true;
15
13
  };
16
14
  readonly disabled: {
17
15
  readonly type: "boolean";
18
- readonly reflect: true;
19
16
  };
20
17
  readonly required: {
21
18
  readonly type: "boolean";
22
- readonly reflect: true;
23
19
  };
24
20
  readonly size: {
25
21
  readonly type: "string";
26
22
  readonly default: "md";
27
23
  readonly values: readonly ["sm", "md", "lg"];
28
- readonly reflect: true;
29
24
  };
30
25
  }>;
31
26
  protected readonly anchor = "track";
@@ -4,25 +4,20 @@ export declare const switchDef: import("../../core/define.js").ComponentDef<{
4
4
  };
5
5
  readonly name: {
6
6
  readonly type: "string";
7
- readonly reflect: true;
8
7
  };
9
8
  readonly value: {
10
9
  readonly type: "string";
11
10
  readonly default: "on";
12
- readonly reflect: true;
13
11
  };
14
12
  readonly disabled: {
15
13
  readonly type: "boolean";
16
- readonly reflect: true;
17
14
  };
18
15
  readonly required: {
19
16
  readonly type: "boolean";
20
- readonly reflect: true;
21
17
  };
22
18
  readonly size: {
23
19
  readonly type: "string";
24
20
  readonly default: "md";
25
21
  readonly values: readonly ["sm", "md", "lg"];
26
- readonly reflect: true;
27
22
  };
28
23
  }>;
@@ -1,33 +1,17 @@
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 { switchStyles } from './switch.styles.js';
5
4
  export const switchDef = defineComponent({
6
5
  tag: 'neu-switch',
7
6
  props: {
8
7
  checked: { type: 'boolean' },
9
- name: { type: 'string', reflect: true },
10
- value: { type: 'string', default: 'on', reflect: true },
11
- disabled: { type: 'boolean', reflect: true },
12
- required: { type: 'boolean', reflect: true },
13
- size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'], reflect: true },
8
+ name: { type: 'string' },
9
+ value: { type: 'string', default: 'on' },
10
+ disabled: { type: 'boolean' },
11
+ required: { type: 'boolean' },
12
+ size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
14
13
  },
15
14
  form: { valueProp: 'checked' },
16
15
  styles: switchStyles,
17
16
  template: (p) => html `<span part="base" class="base"><span part="track" class="track${p.checked ? ' on' : ''}" data-ref="track"><span part="thumb" class="thumb"></span></span><span part="label" class="label"><slot></slot></span></span>`,
18
- docs: {
19
- summary: 'An on/off switch. The checked attribute is the default state.',
20
- events: [
21
- { name: 'input', description: 'Fired when the user toggles the switch.' },
22
- { name: 'change', description: 'Fired after input when the user toggles the switch.' },
23
- ],
24
- slots: [{ name: '', description: 'Label; also the accessible name.' }],
25
- parts: [
26
- { name: 'base', description: 'Wrapper around track and label.' },
27
- { name: 'track', description: 'The inset track.' },
28
- { name: 'thumb', description: 'The raised thumb.' },
29
- { name: 'label', description: 'Wrapper around the default slot.' },
30
- ],
31
- cssProperties: themeCssProperties,
32
- },
33
17
  });
@@ -0,0 +1,2 @@
1
+ import type { ComponentDocs } from '../../core/define.js';
2
+ export declare const switchDocs: ComponentDocs;
@@ -0,0 +1,26 @@
1
+ import { themeCssProperties } from '../theme-docs.js';
2
+ export const switchDocs = {
3
+ summary: 'An on/off switch. The checked attribute is the default state.',
4
+ descriptions: {
5
+ checked: 'Whether the switch is currently on.',
6
+ name: 'The name under which the value is submitted with a form.',
7
+ value: 'The value submitted with the form while the switch is on; defaults to "on".',
8
+ disabled: 'Prevents interaction and leaves the switch out of form submission.',
9
+ required: 'Makes the form invalid until the switch is on.',
10
+ size: 'The switch size.',
11
+ defaultChecked: 'Whether the switch starts on, which a form reset restores; set by the checked attribute.',
12
+ },
13
+ events: [
14
+ { name: 'input', description: 'Fired when the user toggles the switch.' },
15
+ { name: 'change', description: 'Fired after input when the user toggles the switch.' },
16
+ ],
17
+ slots: [{ name: '', description: 'Label; also the accessible name.' }],
18
+ parts: [
19
+ { name: 'base', description: 'Wrapper around track and label.' },
20
+ { name: 'track', description: 'The inset track.' },
21
+ { name: 'thumb', description: 'The raised thumb.' },
22
+ { name: 'label', description: 'Wrapper around the default slot.' },
23
+ ],
24
+ cssProperties: themeCssProperties,
25
+ keyboard: [{ name: 'Space / Enter', description: 'Toggles the switch.' }],
26
+ };
@@ -6,14 +6,12 @@ export declare class NeuTextField extends TextControlElement {
6
6
  readonly type: "string";
7
7
  readonly default: "text";
8
8
  readonly values: readonly ["text", "email", "password", "search", "tel", "url"];
9
- readonly reflect: true;
10
9
  };
11
10
  readonly value: {
12
11
  readonly type: "string";
13
12
  };
14
13
  readonly name: {
15
14
  readonly type: "string";
16
- readonly reflect: true;
17
15
  };
18
16
  readonly label: {
19
17
  readonly type: "string";
@@ -29,15 +27,12 @@ export declare class NeuTextField extends TextControlElement {
29
27
  };
30
28
  readonly required: {
31
29
  readonly type: "boolean";
32
- readonly reflect: true;
33
30
  };
34
31
  readonly disabled: {
35
32
  readonly type: "boolean";
36
- readonly reflect: true;
37
33
  };
38
34
  readonly readOnly: {
39
35
  readonly type: "boolean";
40
- readonly reflect: true;
41
36
  readonly attribute: "readonly";
42
37
  };
43
38
  readonly minLength: {
@@ -68,7 +63,6 @@ export declare class NeuTextField extends TextControlElement {
68
63
  readonly type: "string";
69
64
  readonly default: "md";
70
65
  readonly values: readonly ["sm", "md", "lg"];
71
- readonly reflect: true;
72
66
  };
73
67
  }>;
74
68
  static readonly [BLOCKS_IMPLICIT_SUBMIT] = true;
@@ -4,14 +4,12 @@ declare const props: {
4
4
  readonly type: "string";
5
5
  readonly default: "text";
6
6
  readonly values: readonly ["text", "email", "password", "search", "tel", "url"];
7
- readonly reflect: true;
8
7
  };
9
8
  readonly value: {
10
9
  readonly type: "string";
11
10
  };
12
11
  readonly name: {
13
12
  readonly type: "string";
14
- readonly reflect: true;
15
13
  };
16
14
  readonly label: {
17
15
  readonly type: "string";
@@ -27,15 +25,12 @@ declare const props: {
27
25
  };
28
26
  readonly required: {
29
27
  readonly type: "boolean";
30
- readonly reflect: true;
31
28
  };
32
29
  readonly disabled: {
33
30
  readonly type: "boolean";
34
- readonly reflect: true;
35
31
  };
36
32
  readonly readOnly: {
37
33
  readonly type: "boolean";
38
- readonly reflect: true;
39
34
  readonly attribute: "readonly";
40
35
  };
41
36
  readonly minLength: {
@@ -66,7 +61,6 @@ declare const props: {
66
61
  readonly type: "string";
67
62
  readonly default: "md";
68
63
  readonly values: readonly ["sm", "md", "lg"];
69
- readonly reflect: true;
70
64
  };
71
65
  };
72
66
  export type TextFieldProps = InferProps<typeof props>;
@@ -75,14 +69,12 @@ export declare const textFieldDef: import("../../core/define.js").ComponentDef<{
75
69
  readonly type: "string";
76
70
  readonly default: "text";
77
71
  readonly values: readonly ["text", "email", "password", "search", "tel", "url"];
78
- readonly reflect: true;
79
72
  };
80
73
  readonly value: {
81
74
  readonly type: "string";
82
75
  };
83
76
  readonly name: {
84
77
  readonly type: "string";
85
- readonly reflect: true;
86
78
  };
87
79
  readonly label: {
88
80
  readonly type: "string";
@@ -98,15 +90,12 @@ export declare const textFieldDef: import("../../core/define.js").ComponentDef<{
98
90
  };
99
91
  readonly required: {
100
92
  readonly type: "boolean";
101
- readonly reflect: true;
102
93
  };
103
94
  readonly disabled: {
104
95
  readonly type: "boolean";
105
- readonly reflect: true;
106
96
  };
107
97
  readonly readOnly: {
108
98
  readonly type: "boolean";
109
- readonly reflect: true;
110
99
  readonly attribute: "readonly";
111
100
  };
112
101
  readonly minLength: {
@@ -137,7 +126,6 @@ export declare const textFieldDef: import("../../core/define.js").ComponentDef<{
137
126
  readonly type: "string";
138
127
  readonly default: "md";
139
128
  readonly values: readonly ["sm", "md", "lg"];
140
- readonly reflect: true;
141
129
  };
142
130
  }>;
143
131
  export {};
@@ -1,30 +1,28 @@
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 { textFieldStyles } from './text-field.styles.js';
5
4
  const props = {
6
5
  type: {
7
6
  type: 'string',
8
7
  default: 'text',
9
8
  values: ['text', 'email', 'password', 'search', 'tel', 'url'],
10
- reflect: true,
11
9
  },
12
10
  value: { type: 'string' },
13
- name: { type: 'string', reflect: true },
11
+ name: { type: 'string' },
14
12
  label: { type: 'string' },
15
13
  placeholder: { type: 'string' },
16
14
  helpText: { type: 'string' },
17
15
  errorText: { type: 'string' },
18
- required: { type: 'boolean', reflect: true },
19
- disabled: { type: 'boolean', reflect: true },
20
- readOnly: { type: 'boolean', reflect: true, attribute: 'readonly' },
16
+ required: { type: 'boolean' },
17
+ disabled: { type: 'boolean' },
18
+ readOnly: { type: 'boolean', attribute: 'readonly' },
21
19
  minLength: { type: 'number', default: -1, attribute: 'minlength' },
22
20
  maxLength: { type: 'number', default: -1, attribute: 'maxlength' },
23
21
  pattern: { type: 'string' },
24
22
  autocomplete: { type: 'string' },
25
23
  inputMode: { type: 'string', attribute: 'inputmode' },
26
24
  enterKeyHint: { type: 'string', attribute: 'enterkeyhint' },
27
- size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'], reflect: true },
25
+ size: { type: 'string', default: 'md', values: ['sm', 'md', 'lg'] },
28
26
  };
29
27
  /** Attributes of the inner <input> that only appear when set. */
30
28
  function inputAttributes(p) {
@@ -37,27 +35,4 @@ export const textFieldDef = defineComponent({
37
35
  form: { valueProp: 'value' },
38
36
  styles: textFieldStyles,
39
37
  template: (p) => 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"><span part="prefix" class="prefix"><slot name="prefix"></slot></span><input part="input" class="input" id="input" data-ref="input" type="${p.type}" value="${p.value}" aria-describedby="help"${inputAttributes(p)}><span part="suffix" class="suffix"><slot name="suffix"></slot></span></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>`,
40
- docs: {
41
- summary: 'A single-line text input with an inset field. The value attribute is the default value.',
42
- events: [
43
- { name: 'input', description: 'Fired on every edit (the native input event, composed).' },
44
- { name: 'change', description: 'Fired when an edit is committed, usually on blur.' },
45
- ],
46
- slots: [
47
- { name: 'label', description: 'Rich label; replaces the label attribute.' },
48
- { name: 'prefix', description: 'Content before the input, such as an icon.' },
49
- { name: 'suffix', description: 'Content after the input.' },
50
- { name: 'help-text', description: 'Rich help text; replaces the help-text attribute.' },
51
- ],
52
- parts: [
53
- { name: 'base', description: 'Outer wrapper.' },
54
- { name: 'label', description: 'The <label> element.' },
55
- { name: 'control', description: 'The inset field around the input.' },
56
- { name: 'input', description: 'The native <input>.' },
57
- { name: 'prefix', description: 'Wrapper around the prefix slot.' },
58
- { name: 'suffix', description: 'Wrapper around the suffix slot.' },
59
- { name: 'help-text', description: 'Help or error text area.' },
60
- ],
61
- cssProperties: themeCssProperties,
62
- },
63
38
  });
@@ -0,0 +1,2 @@
1
+ import type { ComponentDocs } from '../../core/define.js';
2
+ export declare const textFieldDocs: ComponentDocs;
@@ -0,0 +1,45 @@
1
+ import { themeCssProperties } from '../theme-docs.js';
2
+ export const textFieldDocs = {
3
+ summary: 'A single-line text input with an inset field. The value attribute is the default value.',
4
+ descriptions: {
5
+ type: 'The kind of text the field accepts, which sets its keyboard and masking and drives email, url and tel validation.',
6
+ value: 'The current text as typed or set by script.',
7
+ name: 'The name under which the text is submitted with a form.',
8
+ label: 'Visible label text; the label slot replaces it.',
9
+ placeholder: 'Hint shown while the field is empty.',
10
+ helpText: 'Guidance shown below the field; the help-text slot replaces it.',
11
+ errorText: "Shown in place of the browser's validation message once the field is invalid after user interaction; does not itself make the field invalid.",
12
+ required: 'Makes the form invalid while the field is empty.',
13
+ disabled: 'Prevents interaction and leaves the field out of form submission.',
14
+ readOnly: 'Keeps the text visible and submitted but not editable.',
15
+ minLength: 'The fewest characters the text must have; checked after user edits, like native, not on script-set values.',
16
+ maxLength: 'The most characters the text may have; checked after user edits, like native, not a hard limit on script-set values.',
17
+ pattern: 'A regular expression the whole text must match.',
18
+ autocomplete: "Hint for the browser's autofill, as for the native attribute.",
19
+ inputMode: 'Hint for which virtual keyboard to show.',
20
+ enterKeyHint: "Hint for the label of the virtual keyboard's Enter key.",
21
+ size: 'The field size.',
22
+ defaultValue: 'The text the field starts with, which a form reset restores; set by the value attribute.',
23
+ },
24
+ events: [
25
+ { name: 'input', description: 'Fired on every edit (the native input event, composed).' },
26
+ { name: 'change', description: 'Fired when an edit is committed, usually on blur.' },
27
+ ],
28
+ slots: [
29
+ { name: 'label', description: 'Rich label; replaces the label attribute.' },
30
+ { name: 'prefix', description: 'Content before the input, such as an icon.' },
31
+ { name: 'suffix', description: 'Content after the input.' },
32
+ { name: 'help-text', description: 'Rich help text; replaces the help-text attribute.' },
33
+ ],
34
+ parts: [
35
+ { name: 'base', description: 'Outer wrapper.' },
36
+ { name: 'label', description: 'The <label> element.' },
37
+ { name: 'control', description: 'The inset field around the input.' },
38
+ { name: 'input', description: 'The native <input>.' },
39
+ { name: 'prefix', description: 'Wrapper around the prefix slot.' },
40
+ { name: 'suffix', description: 'Wrapper around the suffix slot.' },
41
+ { name: 'help-text', description: 'Help or error text area.' },
42
+ ],
43
+ cssProperties: themeCssProperties,
44
+ keyboard: [],
45
+ };
@@ -1,4 +1,4 @@
1
- import { afterDispatch, setOptionalAttribute } from '../../core/dom.js';
1
+ import { afterDispatch, composing, setOptionalAttribute } from '../../core/dom.js';
2
2
  import { baseCommitProps, TextControlElement } from '../shared/text-control.js';
3
3
  import { BLOCKS_IMPLICIT_SUBMIT, implicitSubmit } from './implicit-submit.js';
4
4
  import { textFieldDef } from './text-field.def.js';
@@ -21,7 +21,7 @@ export class NeuTextField extends TextControlElement {
21
21
  return probe;
22
22
  }
23
23
  controlKeyDown(event) {
24
- if (event.key !== 'Enter' || event.isComposing)
24
+ if (event.key !== 'Enter' || composing(event))
25
25
  return;
26
26
  // Like a native input: submit once the keydown has finished dispatching, unless a listener
27
27
  // (on the host or further up) cancelled it.
@@ -1 +1 @@
1
- export declare const textFieldStyles = "\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 { display: block; }\n:host(:disabled), :host([disabled]) { cursor: not-allowed; }\n.base { display: flex; flex-direction: column; }\n.label-text, ::slotted([slot='label']) {\n display: block; margin-block-end: 0.375rem;\n font-size: 0.8125rem; font-weight: 600; line-height: 1rem; color: var(--_neu-fg-muted);\n}\n.label-text:empty { display: none; }\n.control {\n display: flex; align-items: center; min-block-size: 2.75rem; padding-inline: 0.875rem;\n border-radius: var(--_neu-r); background: var(--_neu-bg); box-shadow: var(--_neu-inset);\n transition: box-shadow var(--_neu-dur) ease;\n}\n:host([size='sm']) .control { min-block-size: 2.25rem; padding-inline: 0.75rem; box-shadow: var(--_neu-inset-sm); }\n:host([size='lg']) .control { min-block-size: 3.25rem; padding-inline: 1rem; }\n:host(:focus-within) .control { box-shadow: var(--_neu-inset), var(--_neu-focus); }\n:host(:state(user-invalid)) .control {\n box-shadow:\n inset var(--_neu-d) var(--_neu-d) calc(var(--_neu-d) * 2) color-mix(in oklab, var(--_neu-danger) 35%, var(--_neu-sd)),\n inset calc(var(--_neu-d) * -1) calc(var(--_neu-d) * -1) calc(var(--_neu-d) * 2) var(--_neu-sl);\n}\n:host(:disabled) .control, :host([disabled]) .control { box-shadow: var(--_neu-inset-sm); opacity: 0.6; }\n.input {\n flex: 1; min-inline-size: 0; align-self: stretch; padding: 0; border: none; outline: none;\n background: transparent; color: inherit; font: inherit; font-size: 0.9375rem;\n}\n.input::placeholder { color: var(--_neu-fg-muted); opacity: 1; }\n.help { font-size: 0.75rem; color: var(--_neu-fg-muted); }\n.help-text, ::slotted([slot='help-text']) { display: block; margin-block-start: 0.375rem; }\n.help-text:empty { display: none; }\n.error-text { display: none; margin-block-start: 0.375rem; color: var(--_neu-danger); }\n:host(:state(user-invalid)) slot[name='help-text'] { display: none; }\n:host(:state(user-invalid)) .error-text:not(:empty) { display: block; }\n\n.prefix, .suffix { display: inline-flex; }\n::slotted([slot='prefix']) { margin-inline-end: 0.5rem; }\n::slotted([slot='suffix']) { margin-inline-start: 0.5rem; }\n";
1
+ export declare const textFieldStyles = "\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 { display: block; }\n:host(:disabled), :host([disabled]) { cursor: not-allowed; }\n.base { display: flex; flex-direction: column; }\n.label { font-size: 0.8125rem; font-weight: 600; line-height: 1rem; color: var(--_neu-fg-muted); }\n.label-text, ::slotted([slot='label']) { display: block; margin-block-end: 0.375rem; }\n.label-text:empty { display: none; }\n.control {\n display: flex; align-items: center; min-block-size: 2.75rem; padding-inline: 0.875rem;\n border-radius: var(--_neu-r); background: var(--_neu-bg); box-shadow: var(--_neu-inset);\n transition: box-shadow var(--_neu-dur) ease;\n}\n:host([size='sm']) .control { min-block-size: 2.25rem; padding-inline: 0.75rem; box-shadow: var(--_neu-inset-sm); }\n:host([size='lg']) .control { min-block-size: 3.25rem; padding-inline: 1rem; }\n:host(:focus-within) .control { box-shadow: var(--_neu-inset), var(--_neu-focus); }\n:host(:state(user-invalid)) .control {\n box-shadow:\n inset var(--_neu-d) var(--_neu-d) calc(var(--_neu-d) * 2) color-mix(in oklab, var(--_neu-danger) 35%, var(--_neu-sd)),\n inset calc(var(--_neu-d) * -1) calc(var(--_neu-d) * -1) calc(var(--_neu-d) * 2) var(--_neu-sl);\n}\n:host(:disabled) .control, :host([disabled]) .control { box-shadow: var(--_neu-inset-sm); opacity: 0.6; }\n.input {\n flex: 1; min-inline-size: 0; align-self: stretch; padding: 0; border: none; outline: none;\n background: transparent; color: inherit; font: inherit; font-size: 0.9375rem;\n}\n.input::placeholder { color: var(--_neu-fg-muted); opacity: 1; }\n.help { font-size: 0.75rem; color: var(--_neu-fg-muted); }\n.help-text, ::slotted([slot='help-text']) { display: block; margin-block-start: 0.375rem; }\n.help-text:empty { display: none; }\n.error-text { display: none; margin-block-start: 0.375rem; color: var(--_neu-danger); }\n:host(:state(user-invalid)) slot[name='help-text'] { display: none; }\n:host(:state(user-invalid)) .error-text:not(:empty) { display: block; }\n\n.prefix, .suffix { display: inline-flex; }\n::slotted([slot='prefix']) { margin-inline-end: 0.5rem; }\n::slotted([slot='suffix']) { margin-inline-start: 0.5rem; }\n";