@orange-halo/components 2.2.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +565 -328
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +7 -0
- package/dist/base.js.map +1 -1
- package/dist/index.d.ts +2 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/oh-accordion.d.ts +53 -8
- package/dist/oh-accordion.d.ts.map +1 -1
- package/dist/oh-accordion.js +83 -21
- package/dist/oh-accordion.js.map +1 -1
- package/dist/oh-alert.d.ts +26 -8
- package/dist/oh-alert.d.ts.map +1 -1
- package/dist/oh-alert.js +32 -14
- package/dist/oh-alert.js.map +1 -1
- package/dist/oh-badge.d.ts +32 -13
- package/dist/oh-badge.d.ts.map +1 -1
- package/dist/oh-badge.js +35 -16
- package/dist/oh-badge.js.map +1 -1
- package/dist/oh-breadcrumb.d.ts +39 -12
- package/dist/oh-breadcrumb.d.ts.map +1 -1
- package/dist/oh-breadcrumb.js +43 -21
- package/dist/oh-breadcrumb.js.map +1 -1
- package/dist/oh-button.d.ts +50 -24
- package/dist/oh-button.d.ts.map +1 -1
- package/dist/oh-button.js +66 -47
- package/dist/oh-button.js.map +1 -1
- package/dist/oh-card.d.ts +47 -19
- package/dist/oh-card.d.ts.map +1 -1
- package/dist/oh-card.js +110 -82
- package/dist/oh-card.js.map +1 -1
- package/dist/oh-checkbox-group.d.ts +56 -12
- package/dist/oh-checkbox-group.d.ts.map +1 -1
- package/dist/oh-checkbox-group.js +87 -45
- package/dist/oh-checkbox-group.js.map +1 -1
- package/dist/oh-checkbox.d.ts +55 -18
- package/dist/oh-checkbox.d.ts.map +1 -1
- package/dist/oh-checkbox.js +91 -59
- package/dist/oh-checkbox.js.map +1 -1
- package/dist/oh-cluster.d.ts +19 -14
- package/dist/oh-cluster.d.ts.map +1 -1
- package/dist/oh-cluster.js +19 -19
- package/dist/oh-cluster.js.map +1 -1
- package/dist/oh-container.d.ts +19 -16
- package/dist/oh-container.d.ts.map +1 -1
- package/dist/oh-container.js +26 -33
- package/dist/oh-container.js.map +1 -1
- package/dist/oh-drawer.d.ts +36 -14
- package/dist/oh-drawer.d.ts.map +1 -1
- package/dist/oh-drawer.js +57 -26
- package/dist/oh-drawer.js.map +1 -1
- package/dist/oh-footer.d.ts +37 -18
- package/dist/oh-footer.d.ts.map +1 -1
- package/dist/oh-footer.js +38 -19
- package/dist/oh-footer.js.map +1 -1
- package/dist/oh-grid.d.ts +27 -14
- package/dist/oh-grid.d.ts.map +1 -1
- package/dist/oh-grid.js +27 -19
- package/dist/oh-grid.js.map +1 -1
- package/dist/oh-icon.d.ts +21 -5
- package/dist/oh-icon.d.ts.map +1 -1
- package/dist/oh-icon.js +28 -5
- package/dist/oh-icon.js.map +1 -1
- package/dist/oh-input.d.ts +105 -21
- package/dist/oh-input.d.ts.map +1 -1
- package/dist/oh-input.js +207 -68
- package/dist/oh-input.js.map +1 -1
- package/dist/oh-link.d.ts +42 -19
- package/dist/oh-link.d.ts.map +1 -1
- package/dist/oh-link.js +56 -34
- package/dist/oh-link.js.map +1 -1
- package/dist/oh-modal.d.ts +29 -6
- package/dist/oh-modal.d.ts.map +1 -1
- package/dist/oh-modal.js +37 -16
- package/dist/oh-modal.js.map +1 -1
- package/dist/oh-navbar.d.ts +42 -19
- package/dist/oh-navbar.d.ts.map +1 -1
- package/dist/oh-navbar.js +44 -21
- package/dist/oh-navbar.js.map +1 -1
- package/dist/oh-progress.d.ts +26 -7
- package/dist/oh-progress.d.ts.map +1 -1
- package/dist/oh-progress.js +32 -13
- package/dist/oh-progress.js.map +1 -1
- package/dist/oh-radio-group.d.ts +55 -13
- package/dist/oh-radio-group.d.ts.map +1 -1
- package/dist/oh-radio-group.js +84 -44
- package/dist/oh-radio-group.js.map +1 -1
- package/dist/oh-radio.d.ts +56 -18
- package/dist/oh-radio.d.ts.map +1 -1
- package/dist/oh-radio.js +93 -60
- package/dist/oh-radio.js.map +1 -1
- package/dist/oh-select.d.ts +58 -16
- package/dist/oh-select.d.ts.map +1 -1
- package/dist/oh-select.js +72 -36
- package/dist/oh-select.js.map +1 -1
- package/dist/oh-skip-link.d.ts +33 -15
- package/dist/oh-skip-link.d.ts.map +1 -1
- package/dist/oh-skip-link.js +39 -26
- package/dist/oh-skip-link.js.map +1 -1
- package/dist/oh-stack.d.ts +17 -14
- package/dist/oh-stack.d.ts.map +1 -1
- package/dist/oh-stack.js +18 -20
- package/dist/oh-stack.js.map +1 -1
- package/dist/oh-tabs.d.ts +56 -30
- package/dist/oh-tabs.d.ts.map +1 -1
- package/dist/oh-tabs.js +89 -70
- package/dist/oh-tabs.js.map +1 -1
- package/dist/oh-textarea.d.ts +37 -6
- package/dist/oh-textarea.d.ts.map +1 -1
- package/dist/oh-textarea.js +40 -9
- package/dist/oh-textarea.js.map +1 -1
- package/dist/oh-toggle.d.ts +45 -12
- package/dist/oh-toggle.d.ts.map +1 -1
- package/dist/oh-toggle.js +68 -33
- package/dist/oh-toggle.js.map +1 -1
- package/dist/styles/typography.d.ts.map +1 -1
- package/dist/styles/typography.js +1 -2
- package/dist/styles/typography.js.map +1 -1
- package/package.json +3 -7
- package/dist/oh-button.figma.d.ts +0 -2
- package/dist/oh-button.figma.d.ts.map +0 -1
- package/dist/oh-button.figma.js +0 -18
- package/dist/oh-button.figma.js.map +0 -1
- package/dist/oh-checkbox-group.figma.d.ts +0 -2
- package/dist/oh-checkbox-group.figma.d.ts.map +0 -1
- package/dist/oh-checkbox-group.figma.js +0 -24
- package/dist/oh-checkbox-group.figma.js.map +0 -1
- package/dist/oh-hero.d.ts +0 -33
- package/dist/oh-hero.d.ts.map +0 -1
- package/dist/oh-hero.js +0 -248
- package/dist/oh-hero.js.map +0 -1
- package/dist/oh-input.figma.d.ts +0 -2
- package/dist/oh-input.figma.d.ts.map +0 -1
- package/dist/oh-input.figma.js +0 -36
- package/dist/oh-input.figma.js.map +0 -1
- package/dist/oh-radio-group.figma.d.ts +0 -2
- package/dist/oh-radio-group.figma.d.ts.map +0 -1
- package/dist/oh-radio-group.figma.js +0 -22
- package/dist/oh-radio-group.figma.js.map +0 -1
package/dist/oh-icon.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-icon
|
|
3
3
|
*
|
|
4
|
-
* A flexible icon component for the
|
|
4
|
+
* A flexible icon component for the design system.
|
|
5
5
|
* Can render as a standalone icon or as an interactive link.
|
|
6
6
|
*
|
|
7
7
|
* DESIGN DECISIONS:
|
|
8
8
|
* ─────────────────
|
|
9
9
|
* 1. SIZE
|
|
10
|
-
* -
|
|
11
|
-
* - Size variants: sm
|
|
10
|
+
* - With no size, the icon is 1em, so it follows the text around it
|
|
11
|
+
* - Size variants: sm, md, lg, xl (fixed sizes, set in this file; there
|
|
12
|
+
* are no icon size tokens yet)
|
|
12
13
|
*
|
|
13
14
|
* 2. LINK MODE
|
|
14
15
|
* - When `href` is provided, renders as an <a> tag
|
|
@@ -19,8 +20,6 @@
|
|
|
19
20
|
* - Decorative by default (aria-hidden="true")
|
|
20
21
|
* - Provide `label` for meaningful icons
|
|
21
22
|
* - When used as link, label becomes aria-label
|
|
22
|
-
*
|
|
23
|
-
* @element oh-icon
|
|
24
23
|
*/
|
|
25
24
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
26
25
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -158,6 +157,23 @@ const icons = {
|
|
|
158
157
|
path: `M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,
|
|
159
158
|
},
|
|
160
159
|
};
|
|
160
|
+
/**
|
|
161
|
+
* An icon from the system's built-in set, shown on its own, with a label, or as an icon-only link.
|
|
162
|
+
*
|
|
163
|
+
* **Use it for** an icon next to text, an icon that carries meaning on its own (with `label`), or a compact link such as a social profile (`href` + `label`). **Don't use it for** an icon-only button (use `oh-button` with `icon-only`); or for an image or logo (use `<img>`).
|
|
164
|
+
*
|
|
165
|
+
* **Names:** `name` picks the icon: social (`twitter`, `github`, `linkedin`, `instagram`, `youtube`, `facebook`, `email`, `substack`), navigation (`arrow-*`, `chevron-*`, `external-link`), actions (`close`, `plus`, `minus`, `check`, `search`, `menu`, `settings`, `heart`, `sparkle`) and feedback (`info`, `warning`, `error`, `success`). An unknown name renders nothing and logs a warning.
|
|
166
|
+
*
|
|
167
|
+
* **Sizes:** with no `size` the icon is 1em and follows the text; `sm`, `md`, `lg`, `xl` set fixed sizes. **`inverse`:** for icons on an accent-coloured or dark background.
|
|
168
|
+
*
|
|
169
|
+
* **Behaviour:** the icon takes the current text colour. `arrow-left`, `arrow-right`, `chevron-left` and `chevron-right` mirror in right-to-left text, so they keep pointing back and forward along the line. With `href` it renders as a link, with hover, active and focus-visible states; `target="_blank"` adds `rel="noopener noreferrer"`.
|
|
170
|
+
*
|
|
171
|
+
* **Accessibility:** without `label` the icon is decorative (`aria-hidden="true"`). With `label` it's `role="img"` with that name. As a link, `label` is required (it logs a warning without one) and becomes the link's `aria-label`. Focus-visible shows a solid ring in `focus.ringColor` (`color.text.onAccent` when `inverse`).
|
|
172
|
+
*
|
|
173
|
+
* **Look:** set by tokens. The icon is `currentColor`; `inverse` sets `color.text.onAccent`. As a link: `shape.compact` corners, hover moves by `lift.hoverMd` with an `elevation.offset.lg` shadow in `color.border.default` (`color.text.onAccent` when `inverse`); motion uses `motion.snappy` and `motion.easeGentle`, off under `prefers-reduced-motion`.
|
|
174
|
+
*
|
|
175
|
+
* @element oh-icon
|
|
176
|
+
*/
|
|
161
177
|
let OhIcon = class OhIcon extends OhElement {
|
|
162
178
|
constructor() {
|
|
163
179
|
super(...arguments);
|
|
@@ -175,6 +191,12 @@ let OhIcon = class OhIcon extends OhElement {
|
|
|
175
191
|
vertical-align: middle;
|
|
176
192
|
}
|
|
177
193
|
|
|
194
|
+
/* Icons that point along the line (left/right arrows and chevrons)
|
|
195
|
+
mirror in right-to-left text, so "next" still points forward */
|
|
196
|
+
svg.directional {
|
|
197
|
+
transform: scaleX(var(--_oh-dir));
|
|
198
|
+
}
|
|
199
|
+
|
|
178
200
|
svg {
|
|
179
201
|
display: block;
|
|
180
202
|
fill: currentColor;
|
|
@@ -268,6 +290,7 @@ let OhIcon = class OhIcon extends OhElement {
|
|
|
268
290
|
}
|
|
269
291
|
const svg = html `
|
|
270
292
|
<svg
|
|
293
|
+
class=${/-(left|right)$/.test(this.name) ? "directional" : nothing}
|
|
271
294
|
viewBox=${iconData.viewBox}
|
|
272
295
|
fill="currentColor"
|
|
273
296
|
aria-hidden=${this.href ? "true" : this.label ? "false" : "true"}
|
package/dist/oh-icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-icon.js","sourceRoot":"","sources":["../src/oh-icon.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-icon.js","sourceRoot":"","sources":["../src/oh-icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAwClD,iBAAiB;AACjB,MAAM,KAAK,GAAwD;IACjE,uBAAuB;IACvB,OAAO,EAAE;QACP,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,6JAA6J;KACpK;IACD,MAAM,EAAE;QACN,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,ktBAAktB;KACztB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,WA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O,GAAG,CAAC;IACb,CAAC;;AA9DD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACH;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCAC1B;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAC3B;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACZ;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCACX;AAxHL,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAwKlB"}
|
package/dist/oh-input.d.ts
CHANGED
|
@@ -1,41 +1,113 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-input
|
|
3
3
|
*
|
|
4
|
-
* A chunky, inset input field that feels pressed into the page.
|
|
5
|
-
* On focus, it rises to meet you.
|
|
6
|
-
*
|
|
7
4
|
* DESIGN DECISIONS:
|
|
8
5
|
* ─────────────────
|
|
9
|
-
* 1.
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
* 2. INSET SHADOW (PRESSED IN)
|
|
15
|
-
* - Shadow offset to top-left (inset)
|
|
16
|
-
* - Feels pressed into the surface
|
|
17
|
-
* - Opposite of button's outset sticker effect
|
|
6
|
+
* 1. LOOK FROM TOKENS
|
|
7
|
+
* - Border: input.base.borderWidth (stroke.control) in color.border.emphasis
|
|
8
|
+
* - Corners: shape.control (same as oh-button)
|
|
9
|
+
* - Shadow: an inset shadow offset by elevation.offset.md in elevation.color.field
|
|
18
10
|
*
|
|
19
|
-
*
|
|
20
|
-
* - An inset ring in focus.ringColor
|
|
11
|
+
* 2. FOCUS IS A SOLID RING
|
|
12
|
+
* - An inset ring in focus.ringColor inside the border, so focus doesn't
|
|
13
|
+
* shift the layout
|
|
21
14
|
* - Background switches to color.surface.highlight
|
|
22
|
-
* - Clear visual hierarchy
|
|
23
15
|
*
|
|
24
|
-
*
|
|
16
|
+
* 3. A REAL FORM CONTROL
|
|
17
|
+
* - Form-associated, like oh-textarea: its value submits with the form
|
|
18
|
+
* under its name and shows in form.elements, `required` blocks
|
|
19
|
+
* submission, a form reset restores the starting value, and a
|
|
20
|
+
* disabled <fieldset> disables it
|
|
21
|
+
*
|
|
22
|
+
* 4. SUGGESTIONS ARE NATIVE
|
|
23
|
+
* - `suggestions` renders a <datalist> inside the component (a list
|
|
24
|
+
* outside it can't reach an input in the shadow root). The browser
|
|
25
|
+
* draws the list and handles the keyboard and screen readers, so
|
|
26
|
+
* people can still type anything: it suggests, it doesn't restrict
|
|
27
|
+
*
|
|
28
|
+
* 5. ERRORS BEFORE THE FIELD
|
|
29
|
+
* - Error text sits after the label and before the field, with an icon,
|
|
30
|
+
* so it's read before the field is reached. Helper text sits after
|
|
25
31
|
*/
|
|
26
32
|
import { type PropertyValues } from "lit";
|
|
27
33
|
import { OhElement } from "./base.js";
|
|
28
34
|
export type InputType = "text" | "email" | "password" | "search" | "tel" | "url";
|
|
29
35
|
export type InputState = "default" | "hover" | "focus";
|
|
36
|
+
/**
|
|
37
|
+
* A single-line text field that submits with a native form, with optional
|
|
38
|
+
* typing suggestions.
|
|
39
|
+
*
|
|
40
|
+
* **Use it for** short free text: names, email addresses, search terms.
|
|
41
|
+
* **Don't use it for** several lines (use `oh-textarea`) or a choice from a
|
|
42
|
+
* fixed list (use `oh-select`, or `oh-radio-group` for a few options).
|
|
43
|
+
* `suggestions` offers values while still allowing any text.
|
|
44
|
+
*
|
|
45
|
+
* **Types:** `text` (default), `email`, `password`, `search`, `tel`, `url`.
|
|
46
|
+
* One size. **States:** rest, hover, focus, error (set `error-text`),
|
|
47
|
+
* disabled, required.
|
|
48
|
+
*
|
|
49
|
+
* **Behaviour:** form-associated: the value submits under `name`, `required`
|
|
50
|
+
* blocks submission (validity comes from the inner `<input>`), a form reset
|
|
51
|
+
* restores the starting value, and a disabled `<fieldset>` disables it.
|
|
52
|
+
* Fires `oh-input` as the text changes and `oh-change` when it's committed.
|
|
53
|
+
* `suggestions` renders a native `<datalist>`, so the browser handles its
|
|
54
|
+
* keyboard and screen reader support. `autocomplete` is passed to the inner
|
|
55
|
+
* `<input>`.
|
|
56
|
+
*
|
|
57
|
+
* **Accessibility:** always set `label`: it's the field's name. The error
|
|
58
|
+
* shows after the label and before the field, with an icon, and is linked
|
|
59
|
+
* with `aria-describedby` and `aria-invalid`; it's announced (`role="alert"`)
|
|
60
|
+
* only when it appears after first render. Helper text is linked the same
|
|
61
|
+
* way (it's hidden while an error shows). Focus is a solid inset ring.
|
|
62
|
+
* Set `autocomplete` for personal data (WCAG 1.3.5).
|
|
63
|
+
*
|
|
64
|
+
* **Look:** set by tokens — `input.base.borderWidth` (`stroke.control`) in
|
|
65
|
+
* `color.border.emphasis` (border), `shape.control` (corners),
|
|
66
|
+
* `typography.control.*` (type), `input.size.md.minHeight` (height),
|
|
67
|
+
* `elevation.offset.md` and `elevation.color.field` (inset shadow),
|
|
68
|
+
* `color.border.hover` (hover), `focus.ringColor` and
|
|
69
|
+
* `color.surface.highlight` (focus), `color.feedback.error`,
|
|
70
|
+
* `color.feedback.errorSubtle` and `elevation.color.error` (error),
|
|
71
|
+
* `color.surface.disabled`, `color.border.disabled` and
|
|
72
|
+
* `color.text.disabled` (disabled).
|
|
73
|
+
*
|
|
74
|
+
* @element oh-input
|
|
75
|
+
* @fires oh-input - Whenever the text changes: typing, or picking a suggestion. detail: { value, originalEvent }
|
|
76
|
+
* @fires oh-change - When the value is committed (on blur or Enter). detail: { value, originalEvent }
|
|
77
|
+
* @csspart label - The visible label
|
|
78
|
+
* @csspart input - The text field
|
|
79
|
+
* @csspart helper - The helper text, and the error message (which also has the error part)
|
|
80
|
+
* @csspart error - The error message
|
|
81
|
+
*/
|
|
30
82
|
export declare class OhInput extends OhElement {
|
|
83
|
+
static formAssociated: boolean;
|
|
31
84
|
static styles: import("lit").CSSResult[];
|
|
85
|
+
/** The kind of text: text, email, password, search, tel or url */
|
|
32
86
|
type: InputType;
|
|
87
|
+
/** The text in the field */
|
|
33
88
|
value: string;
|
|
89
|
+
/** Example text shown while the field is empty. Not a replacement for the label */
|
|
34
90
|
placeholder: string;
|
|
91
|
+
/** The visible label. Always set one: it names the field */
|
|
35
92
|
label: string;
|
|
93
|
+
/** Help shown under the field and linked to it */
|
|
36
94
|
helperText: string;
|
|
95
|
+
/** Error shown before the field and linked to it. Setting it puts the field in its error state */
|
|
37
96
|
errorText: string;
|
|
97
|
+
/** The name the value is submitted under */
|
|
98
|
+
name: string;
|
|
99
|
+
/** Must be filled in before the form submits */
|
|
38
100
|
required: boolean;
|
|
101
|
+
/** Not editable, and left out of the form's data */
|
|
102
|
+
disabled: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Values offered while typing, shown by the browser as a list under the
|
|
105
|
+
* field. They suggest, they don't restrict: any text is still allowed.
|
|
106
|
+
* Set it as a property (an array of strings) or, in HTML, as a JSON array:
|
|
107
|
+
* suggestions='["Option one","Option two"]'. Browsers also offer the
|
|
108
|
+
* field's autofill history, so set autocomplete="off" to show only these.
|
|
109
|
+
*/
|
|
110
|
+
suggestions: string[];
|
|
39
111
|
/**
|
|
40
112
|
* The input's purpose, for autofill and assistive tech (WCAG 1.3.5):
|
|
41
113
|
* an HTML autocomplete token such as "email", "name" or "tel".
|
|
@@ -43,22 +115,34 @@ export declare class OhInput extends OhElement {
|
|
|
43
115
|
*/
|
|
44
116
|
autocomplete?: string;
|
|
45
117
|
/**
|
|
46
|
-
* Force a visual state (for documentation
|
|
118
|
+
* Force a visual state (for documentation only)
|
|
47
119
|
* Values: 'hover' | 'focus'
|
|
48
120
|
*/
|
|
49
121
|
forceState: InputState;
|
|
50
122
|
private _input;
|
|
51
|
-
private
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
123
|
+
private _internals;
|
|
124
|
+
/** The starting value, restored when the form resets */
|
|
125
|
+
private _defaultValue;
|
|
126
|
+
/** Set when a disabled <fieldset> around it disables it */
|
|
127
|
+
private _formDisabled;
|
|
55
128
|
/**
|
|
56
129
|
* Errors that appear after first render (e.g. on submit) are announced via
|
|
57
130
|
* role="alert". Errors present on page load are only linked with
|
|
58
131
|
* aria-describedby, so they aren't read out unprompted.
|
|
59
132
|
*/
|
|
60
133
|
private _announceError;
|
|
134
|
+
connectedCallback(): void;
|
|
135
|
+
/** The form this field belongs to */
|
|
136
|
+
get form(): HTMLFormElement | null;
|
|
137
|
+
focus(options?: FocusOptions): void;
|
|
138
|
+
blur(): void;
|
|
139
|
+
formResetCallback(): void;
|
|
140
|
+
formDisabledCallback(disabled: boolean): void;
|
|
141
|
+
formStateRestoreCallback(state: string | File | FormData | null): void;
|
|
61
142
|
willUpdate(changed: PropertyValues): void;
|
|
143
|
+
updated(changed: PropertyValues): void;
|
|
144
|
+
private _handleInput;
|
|
145
|
+
private _handleChange;
|
|
62
146
|
render(): import("lit").TemplateResult<1>;
|
|
63
147
|
}
|
|
64
148
|
declare global {
|
package/dist/oh-input.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-input.d.ts","sourceRoot":"","sources":["../src/oh-input.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-input.d.ts","sourceRoot":"","sources":["../src/oh-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,GACR,KAAK,GACL,KAAK,C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