@orange-halo/components 2.0.0 → 2.2.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 +3551 -73
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -2
- package/dist/base.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/oh-accordion.d.ts.map +1 -1
- package/dist/oh-accordion.js +38 -30
- package/dist/oh-accordion.js.map +1 -1
- package/dist/oh-alert.d.ts.map +1 -1
- package/dist/oh-alert.js +74 -32
- package/dist/oh-alert.js.map +1 -1
- package/dist/oh-badge.d.ts.map +1 -1
- package/dist/oh-badge.js +3 -3
- package/dist/oh-badge.js.map +1 -1
- package/dist/oh-breadcrumb.d.ts.map +1 -1
- package/dist/oh-breadcrumb.js +39 -20
- package/dist/oh-breadcrumb.js.map +1 -1
- package/dist/oh-button.d.ts +1 -1
- package/dist/oh-button.d.ts.map +1 -1
- package/dist/oh-button.figma.js +1 -3
- package/dist/oh-button.figma.js.map +1 -1
- package/dist/oh-button.js +83 -51
- package/dist/oh-button.js.map +1 -1
- package/dist/oh-card.d.ts.map +1 -1
- package/dist/oh-card.js +48 -57
- package/dist/oh-card.js.map +1 -1
- package/dist/oh-checkbox-group.d.ts.map +1 -1
- package/dist/oh-checkbox-group.figma.js +1 -1
- package/dist/oh-checkbox-group.figma.js.map +1 -1
- package/dist/oh-checkbox-group.js +46 -23
- package/dist/oh-checkbox-group.js.map +1 -1
- package/dist/oh-checkbox.d.ts +2 -2
- package/dist/oh-checkbox.d.ts.map +1 -1
- package/dist/oh-checkbox.js +56 -29
- package/dist/oh-checkbox.js.map +1 -1
- package/dist/oh-drawer.d.ts.map +1 -1
- package/dist/oh-drawer.js +21 -10
- package/dist/oh-drawer.js.map +1 -1
- package/dist/oh-footer.d.ts +5 -0
- package/dist/oh-footer.d.ts.map +1 -1
- package/dist/oh-footer.js +5 -0
- package/dist/oh-footer.js.map +1 -1
- package/dist/oh-grid.d.ts.map +1 -1
- package/dist/oh-grid.js +1 -2
- package/dist/oh-grid.js.map +1 -1
- package/dist/oh-hero.d.ts +5 -0
- package/dist/oh-hero.d.ts.map +1 -1
- package/dist/oh-hero.js +8 -1
- package/dist/oh-hero.js.map +1 -1
- package/dist/oh-icon.d.ts.map +1 -1
- package/dist/oh-icon.js +7 -5
- package/dist/oh-icon.js.map +1 -1
- package/dist/oh-input.d.ts +11 -6
- package/dist/oh-input.d.ts.map +1 -1
- package/dist/oh-input.figma.js +2 -2
- package/dist/oh-input.figma.js.map +1 -1
- package/dist/oh-input.js +38 -21
- package/dist/oh-input.js.map +1 -1
- package/dist/oh-link.d.ts.map +1 -1
- package/dist/oh-link.js +59 -32
- package/dist/oh-link.js.map +1 -1
- package/dist/oh-modal.d.ts +8 -2
- package/dist/oh-modal.d.ts.map +1 -1
- package/dist/oh-modal.js +60 -30
- package/dist/oh-modal.js.map +1 -1
- package/dist/oh-navbar.d.ts.map +1 -1
- package/dist/oh-navbar.js +2 -1
- package/dist/oh-navbar.js.map +1 -1
- package/dist/oh-progress.d.ts.map +1 -1
- package/dist/oh-progress.js +5 -3
- package/dist/oh-progress.js.map +1 -1
- package/dist/oh-radio-group.d.ts.map +1 -1
- package/dist/oh-radio-group.js +58 -27
- package/dist/oh-radio-group.js.map +1 -1
- package/dist/oh-radio.d.ts +1 -1
- package/dist/oh-radio.d.ts.map +1 -1
- package/dist/oh-radio.js +57 -29
- package/dist/oh-radio.js.map +1 -1
- package/dist/oh-select.d.ts +3 -2
- package/dist/oh-select.d.ts.map +1 -1
- package/dist/oh-select.js +88 -48
- package/dist/oh-select.js.map +1 -1
- package/dist/oh-skip-link.d.ts.map +1 -1
- package/dist/oh-skip-link.js +8 -10
- package/dist/oh-skip-link.js.map +1 -1
- package/dist/oh-tabs.d.ts.map +1 -1
- package/dist/oh-tabs.js +34 -25
- package/dist/oh-tabs.js.map +1 -1
- package/dist/oh-textarea.d.ts +98 -0
- package/dist/oh-textarea.d.ts.map +1 -0
- package/dist/oh-textarea.js +370 -0
- package/dist/oh-textarea.js.map +1 -0
- package/dist/oh-toggle.d.ts.map +1 -1
- package/dist/oh-toggle.js +29 -14
- package/dist/oh-toggle.js.map +1 -1
- package/dist/styles/typography.js +5 -5
- package/package.json +15 -4
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* oh-textarea
|
|
3
|
+
*
|
|
4
|
+
* A multi-line text field for messages, comments and feedback. The same
|
|
5
|
+
* chunky, inset field as oh-input, and the first OHDS control that takes
|
|
6
|
+
* part in a native <form>.
|
|
7
|
+
*
|
|
8
|
+
* DESIGN DECISIONS:
|
|
9
|
+
* ─────────────────
|
|
10
|
+
* 1. SAME FAMILY AS oh-input
|
|
11
|
+
* - Thick border (stroke.control), inset shadow, shape.control corners
|
|
12
|
+
* - Focus thickens the border inward with an inset ring in
|
|
13
|
+
* focus.ringColor; background switches to color.surface.highlight
|
|
14
|
+
*
|
|
15
|
+
* 2. ON THE GRID
|
|
16
|
+
* - Line height is 1.5 times the text size, rounded up to the brand's
|
|
17
|
+
* grid (grid.unit), so every line of a long message sits on it
|
|
18
|
+
*
|
|
19
|
+
* 3. A REAL FORM CONTROL
|
|
20
|
+
* - Form-associated: its value submits with the form under its name,
|
|
21
|
+
* `required` blocks submission with the browser's own message, a
|
|
22
|
+
* form reset restores the starting text, and a disabled <fieldset>
|
|
23
|
+
* disables it
|
|
24
|
+
*
|
|
25
|
+
* 4. ERRORS BEFORE THE FIELD
|
|
26
|
+
* - Error text sits after the label and before the field, with an icon,
|
|
27
|
+
* so it's read before the field is reached. Helper text sits after
|
|
28
|
+
*/
|
|
29
|
+
import { type PropertyValues } from "lit";
|
|
30
|
+
import { OhElement } from "./base.js";
|
|
31
|
+
/**
|
|
32
|
+
* A multi-line text field that submits with a native form.
|
|
33
|
+
*
|
|
34
|
+
* @element oh-textarea
|
|
35
|
+
* @fires oh-input - On every keystroke. detail: { value, originalEvent }
|
|
36
|
+
* @fires oh-change - When the value is committed (on blur). detail: { value, originalEvent }
|
|
37
|
+
* @csspart label - The visible label
|
|
38
|
+
* @csspart textarea - The text field
|
|
39
|
+
* @csspart helper - The helper text
|
|
40
|
+
* @csspart error - The error message
|
|
41
|
+
*/
|
|
42
|
+
export declare class OhTextarea extends OhElement {
|
|
43
|
+
static formAssociated: boolean;
|
|
44
|
+
static styles: import("lit").CSSResult[];
|
|
45
|
+
/** The visible label. Always set one: it names the field. */
|
|
46
|
+
label: string;
|
|
47
|
+
/** The text in the field */
|
|
48
|
+
value: string;
|
|
49
|
+
/** Example text shown while the field is empty. Not a replacement for the label */
|
|
50
|
+
placeholder: string;
|
|
51
|
+
/** Help shown under the field and linked to it */
|
|
52
|
+
helperText: string;
|
|
53
|
+
/** Error shown before the field and linked to it. Setting it puts the field in its error state */
|
|
54
|
+
errorText: string;
|
|
55
|
+
/** The name the value is submitted under */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Must be filled in before the form submits */
|
|
58
|
+
required: boolean;
|
|
59
|
+
/** Not editable, and left out of the form's data */
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
/** Visible lines of text before the field scrolls (people can drag it taller) */
|
|
62
|
+
rows: number;
|
|
63
|
+
/** Longest allowed text, in characters */
|
|
64
|
+
maxlength?: number;
|
|
65
|
+
/** The field's purpose for autofill and assistive tech (WCAG 1.3.5), e.g. "street-address" */
|
|
66
|
+
autocomplete?: string;
|
|
67
|
+
private _textarea;
|
|
68
|
+
private _internals;
|
|
69
|
+
/** The starting text, restored when the form resets */
|
|
70
|
+
private _defaultValue;
|
|
71
|
+
/** Set when a disabled <fieldset> around it disables it */
|
|
72
|
+
private _formDisabled;
|
|
73
|
+
/**
|
|
74
|
+
* Errors that appear after first render (e.g. on submit) are announced via
|
|
75
|
+
* role="alert". Errors present on page load are only linked with
|
|
76
|
+
* aria-describedby, so they aren't read out unprompted.
|
|
77
|
+
*/
|
|
78
|
+
private _announceError;
|
|
79
|
+
connectedCallback(): void;
|
|
80
|
+
/** The form this field belongs to */
|
|
81
|
+
get form(): HTMLFormElement | null;
|
|
82
|
+
focus(options?: FocusOptions): void;
|
|
83
|
+
blur(): void;
|
|
84
|
+
formResetCallback(): void;
|
|
85
|
+
formDisabledCallback(disabled: boolean): void;
|
|
86
|
+
formStateRestoreCallback(state: string | File | FormData | null): void;
|
|
87
|
+
willUpdate(changed: PropertyValues): void;
|
|
88
|
+
updated(changed: PropertyValues): void;
|
|
89
|
+
private _handleInput;
|
|
90
|
+
private _handleChange;
|
|
91
|
+
render(): import("lit").TemplateResult<1>;
|
|
92
|
+
}
|
|
93
|
+
declare global {
|
|
94
|
+
interface HTMLElementTagNameMap {
|
|
95
|
+
"oh-textarea": OhTextarea;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=oh-textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oh-textarea.d.ts","sourceRoot":"","sources":["../src/oh-textarea.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD;;;;;;;;;;GAUG;AACH,qBACa,UAAW,SAAQ,SAAS;IACvC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,4BA4HpB;IAEF,6DAA6D;IAE7D,KAAK,SAAM;IAEX,4BAA4B;IAE5B,KAAK,SAAM;IAEX,mFAAmF;IAEnF,WAAW,SAAM;IAEjB,kDAAkD;IAElD,UAAU,SAAM;IAEhB,kGAAkG;IAElG,SAAS,SAAM;IAEf,4CAA4C;IAE5C,IAAI,SAAM;IAEV,gDAAgD;IAEhD,QAAQ,UAAS;IAEjB,oDAAoD;IAEpD,QAAQ,UAAS;IAEjB,iFAAiF;IAEjF,IAAI,SAAK;IAET,0CAA0C;IAE1C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,8FAA8F;IAE9F,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,OAAO,CAAC,SAAS,CAAuB;IAExC,OAAO,CAAC,UAAU,CAA0B;IAE5C,uDAAuD;IACvD,OAAO,CAAC,aAAa,CAAM;IAE3B,2DAA2D;IAE3D,OAAO,CAAC,aAAa,CAAS;IAE9B;;;;OAIG;IAEH,OAAO,CAAC,cAAc,CAAS;IAE/B,iBAAiB;IAKjB,qCAAqC;IACrC,IAAI,IAAI,2BAEP;IAED,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B,IAAI;IAIJ,iBAAiB;IAIjB,oBAAoB,CAAC,QAAQ,EAAE,OAAO;IAItC,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI;IAI/D,UAAU,CAAC,OAAO,EAAE,cAAc;IAMlC,OAAO,CAAC,OAAO,EAAE,cAAc;IAe/B,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,aAAa;IAIrB,MAAM;CAsEP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* oh-textarea
|
|
3
|
+
*
|
|
4
|
+
* A multi-line text field for messages, comments and feedback. The same
|
|
5
|
+
* chunky, inset field as oh-input, and the first OHDS control that takes
|
|
6
|
+
* part in a native <form>.
|
|
7
|
+
*
|
|
8
|
+
* DESIGN DECISIONS:
|
|
9
|
+
* ─────────────────
|
|
10
|
+
* 1. SAME FAMILY AS oh-input
|
|
11
|
+
* - Thick border (stroke.control), inset shadow, shape.control corners
|
|
12
|
+
* - Focus thickens the border inward with an inset ring in
|
|
13
|
+
* focus.ringColor; background switches to color.surface.highlight
|
|
14
|
+
*
|
|
15
|
+
* 2. ON THE GRID
|
|
16
|
+
* - Line height is 1.5 times the text size, rounded up to the brand's
|
|
17
|
+
* grid (grid.unit), so every line of a long message sits on it
|
|
18
|
+
*
|
|
19
|
+
* 3. A REAL FORM CONTROL
|
|
20
|
+
* - Form-associated: its value submits with the form under its name,
|
|
21
|
+
* `required` blocks submission with the browser's own message, a
|
|
22
|
+
* form reset restores the starting text, and a disabled <fieldset>
|
|
23
|
+
* disables it
|
|
24
|
+
*
|
|
25
|
+
* 4. ERRORS BEFORE THE FIELD
|
|
26
|
+
* - Error text sits after the label and before the field, with an icon,
|
|
27
|
+
* so it's read before the field is reached. Helper text sits after
|
|
28
|
+
*/
|
|
29
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
30
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
31
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
32
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
33
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
34
|
+
};
|
|
35
|
+
import { html, css, nothing } from "lit";
|
|
36
|
+
import { customElement, property, query, state } from "lit/decorators.js";
|
|
37
|
+
import { OhElement, baseStyles } from "./base.js";
|
|
38
|
+
/**
|
|
39
|
+
* A multi-line text field that submits with a native form.
|
|
40
|
+
*
|
|
41
|
+
* @element oh-textarea
|
|
42
|
+
* @fires oh-input - On every keystroke. detail: { value, originalEvent }
|
|
43
|
+
* @fires oh-change - When the value is committed (on blur). detail: { value, originalEvent }
|
|
44
|
+
* @csspart label - The visible label
|
|
45
|
+
* @csspart textarea - The text field
|
|
46
|
+
* @csspart helper - The helper text
|
|
47
|
+
* @csspart error - The error message
|
|
48
|
+
*/
|
|
49
|
+
let OhTextarea = class OhTextarea extends OhElement {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(...arguments);
|
|
52
|
+
/** The visible label. Always set one: it names the field. */
|
|
53
|
+
this.label = "";
|
|
54
|
+
/** The text in the field */
|
|
55
|
+
this.value = "";
|
|
56
|
+
/** Example text shown while the field is empty. Not a replacement for the label */
|
|
57
|
+
this.placeholder = "";
|
|
58
|
+
/** Help shown under the field and linked to it */
|
|
59
|
+
this.helperText = "";
|
|
60
|
+
/** Error shown before the field and linked to it. Setting it puts the field in its error state */
|
|
61
|
+
this.errorText = "";
|
|
62
|
+
/** The name the value is submitted under */
|
|
63
|
+
this.name = "";
|
|
64
|
+
/** Must be filled in before the form submits */
|
|
65
|
+
this.required = false;
|
|
66
|
+
/** Not editable, and left out of the form's data */
|
|
67
|
+
this.disabled = false;
|
|
68
|
+
/** Visible lines of text before the field scrolls (people can drag it taller) */
|
|
69
|
+
this.rows = 4;
|
|
70
|
+
this._internals = this.attachInternals();
|
|
71
|
+
/** The starting text, restored when the form resets */
|
|
72
|
+
this._defaultValue = "";
|
|
73
|
+
/** Set when a disabled <fieldset> around it disables it */
|
|
74
|
+
this._formDisabled = false;
|
|
75
|
+
/**
|
|
76
|
+
* Errors that appear after first render (e.g. on submit) are announced via
|
|
77
|
+
* role="alert". Errors present on page load are only linked with
|
|
78
|
+
* aria-describedby, so they aren't read out unprompted.
|
|
79
|
+
*/
|
|
80
|
+
this._announceError = false;
|
|
81
|
+
}
|
|
82
|
+
static { this.formAssociated = true; }
|
|
83
|
+
static { this.styles = [
|
|
84
|
+
baseStyles,
|
|
85
|
+
css `
|
|
86
|
+
:host {
|
|
87
|
+
display: block;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.wrapper {
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
gap: var(--oh-spacing-2);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.label {
|
|
97
|
+
font-family: var(--oh-typography-control-font-family);
|
|
98
|
+
font-size: var(--oh-typography-control-font-size-sm);
|
|
99
|
+
font-weight: var(--oh-typography-control-font-weight);
|
|
100
|
+
color: var(--oh-color-text-primary);
|
|
101
|
+
letter-spacing: var(--oh-typography-control-letter-spacing);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.label--required::after {
|
|
105
|
+
content: " *";
|
|
106
|
+
color: var(--oh-color-feedback-error);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.textarea {
|
|
110
|
+
display: block;
|
|
111
|
+
width: 100%;
|
|
112
|
+
margin: 0;
|
|
113
|
+
resize: vertical;
|
|
114
|
+
font-family: var(--oh-typography-control-font-family);
|
|
115
|
+
font-size: var(--oh-typography-control-font-size-md);
|
|
116
|
+
/* 1.5 x the text size, rounded up to the brand's grid */
|
|
117
|
+
line-height: 1.5;
|
|
118
|
+
line-height: round(
|
|
119
|
+
up,
|
|
120
|
+
calc(var(--oh-typography-control-font-size-md) * 1.5),
|
|
121
|
+
var(--oh-grid-unit)
|
|
122
|
+
);
|
|
123
|
+
color: var(--oh-color-text-primary);
|
|
124
|
+
background-color: var(--oh-color-surface-base);
|
|
125
|
+
padding: var(--oh-spacing-3) var(--oh-spacing-4);
|
|
126
|
+
border: var(--oh-stroke-control) solid var(--oh-color-border-emphasis);
|
|
127
|
+
border-radius: var(--oh-shape-control);
|
|
128
|
+
box-shadow: inset var(--oh-elevation-offset-md)
|
|
129
|
+
var(--oh-elevation-offset-md) 0 0 var(--oh-shadow-field);
|
|
130
|
+
transition:
|
|
131
|
+
border-color var(--oh-motion-snappy) ease,
|
|
132
|
+
box-shadow var(--oh-motion-snappy) ease,
|
|
133
|
+
background-color var(--oh-motion-quick) ease;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.textarea::placeholder {
|
|
137
|
+
color: var(--oh-color-text-secondary);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.textarea:hover:not(:focus):not(:disabled) {
|
|
141
|
+
border-color: var(--oh-color-border-hover);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.textarea:focus {
|
|
145
|
+
outline: none;
|
|
146
|
+
background-color: var(--oh-color-surface-highlight);
|
|
147
|
+
border-color: var(--oh-focus-ring-color);
|
|
148
|
+
box-shadow: inset 0 0 0 2px var(--oh-focus-ring-color);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.textarea--error {
|
|
152
|
+
border-color: var(--oh-color-feedback-error);
|
|
153
|
+
background-color: var(--oh-color-feedback-error-subtle);
|
|
154
|
+
box-shadow: inset var(--oh-elevation-offset-md)
|
|
155
|
+
var(--oh-elevation-offset-md) 0 0 var(--oh-shadow-error);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.textarea--error:focus {
|
|
159
|
+
border-color: var(--oh-color-feedback-error);
|
|
160
|
+
box-shadow: inset 0 0 0 2px var(--oh-color-feedback-error);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Disabled: quiet, not broken */
|
|
164
|
+
.textarea:disabled {
|
|
165
|
+
cursor: not-allowed;
|
|
166
|
+
resize: none;
|
|
167
|
+
color: var(--oh-color-text-disabled);
|
|
168
|
+
background-color: var(--oh-color-surface-disabled);
|
|
169
|
+
border-color: var(--oh-color-border-disabled);
|
|
170
|
+
box-shadow: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.label--disabled {
|
|
174
|
+
color: var(--oh-color-text-disabled);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.helper {
|
|
178
|
+
font-family: var(--oh-typography-body-font-family);
|
|
179
|
+
font-size: var(--oh-typography-body-base-font-size);
|
|
180
|
+
line-height: var(--oh-typography-body-base-line-height);
|
|
181
|
+
color: var(--oh-color-text-secondary);
|
|
182
|
+
letter-spacing: var(--oh-typography-control-letter-spacing);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.error {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: var(--oh-spacing-2);
|
|
189
|
+
font-family: var(--oh-typography-body-font-family);
|
|
190
|
+
font-size: var(--oh-typography-body-base-font-size);
|
|
191
|
+
line-height: var(--oh-typography-body-base-line-height);
|
|
192
|
+
color: var(--oh-color-feedback-error);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.error-icon {
|
|
196
|
+
flex-shrink: 0;
|
|
197
|
+
width: var(--oh-spacing-4);
|
|
198
|
+
height: var(--oh-spacing-4);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@media (prefers-reduced-motion: reduce) {
|
|
202
|
+
.textarea {
|
|
203
|
+
transition-duration: 0.01ms !important;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
`,
|
|
207
|
+
]; }
|
|
208
|
+
connectedCallback() {
|
|
209
|
+
super.connectedCallback();
|
|
210
|
+
if (!this.hasUpdated)
|
|
211
|
+
this._defaultValue = this.value;
|
|
212
|
+
}
|
|
213
|
+
/** The form this field belongs to */
|
|
214
|
+
get form() {
|
|
215
|
+
return this._internals.form;
|
|
216
|
+
}
|
|
217
|
+
focus(options) {
|
|
218
|
+
this._textarea?.focus(options);
|
|
219
|
+
}
|
|
220
|
+
blur() {
|
|
221
|
+
this._textarea?.blur();
|
|
222
|
+
}
|
|
223
|
+
formResetCallback() {
|
|
224
|
+
this.value = this._defaultValue;
|
|
225
|
+
}
|
|
226
|
+
formDisabledCallback(disabled) {
|
|
227
|
+
this._formDisabled = disabled;
|
|
228
|
+
}
|
|
229
|
+
formStateRestoreCallback(state) {
|
|
230
|
+
if (typeof state === "string")
|
|
231
|
+
this.value = state;
|
|
232
|
+
}
|
|
233
|
+
willUpdate(changed) {
|
|
234
|
+
if (this.hasUpdated && changed.has("errorText")) {
|
|
235
|
+
this._announceError = !!this.errorText;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
updated(changed) {
|
|
239
|
+
if (changed.has("value"))
|
|
240
|
+
this._internals.setFormValue(this.value);
|
|
241
|
+
if (changed.has("value") ||
|
|
242
|
+
changed.has("required") ||
|
|
243
|
+
changed.has("maxlength")) {
|
|
244
|
+
this._internals.setValidity(this._textarea.validity, this._textarea.validationMessage, this._textarea);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
_handleInput(event) {
|
|
248
|
+
this.value = event.target.value;
|
|
249
|
+
this.emit("oh-input", { value: this.value, originalEvent: event });
|
|
250
|
+
}
|
|
251
|
+
_handleChange(event) {
|
|
252
|
+
this.emit("oh-change", { value: this.value, originalEvent: event });
|
|
253
|
+
}
|
|
254
|
+
render() {
|
|
255
|
+
const hasError = !!this.errorText;
|
|
256
|
+
const disabled = this.disabled || this._formDisabled;
|
|
257
|
+
const describedBy = hasError ? "error" : this.helperText ? "helper" : "";
|
|
258
|
+
return html `
|
|
259
|
+
<div class="wrapper">
|
|
260
|
+
${this.label
|
|
261
|
+
? html `<label
|
|
262
|
+
class=${this.classMap({
|
|
263
|
+
label: true,
|
|
264
|
+
"label--required": this.required,
|
|
265
|
+
"label--disabled": disabled,
|
|
266
|
+
})}
|
|
267
|
+
part="label"
|
|
268
|
+
for="textarea"
|
|
269
|
+
>${this.label}</label
|
|
270
|
+
>`
|
|
271
|
+
: nothing}
|
|
272
|
+
${hasError
|
|
273
|
+
? html `<span
|
|
274
|
+
id="error"
|
|
275
|
+
class="error"
|
|
276
|
+
part="error"
|
|
277
|
+
role=${this._announceError ? "alert" : nothing}
|
|
278
|
+
>
|
|
279
|
+
<svg
|
|
280
|
+
class="error-icon"
|
|
281
|
+
viewBox="0 0 20 20"
|
|
282
|
+
fill="currentColor"
|
|
283
|
+
aria-hidden="true"
|
|
284
|
+
>
|
|
285
|
+
<path
|
|
286
|
+
fill-rule="evenodd"
|
|
287
|
+
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z"
|
|
288
|
+
clip-rule="evenodd"
|
|
289
|
+
/>
|
|
290
|
+
</svg>
|
|
291
|
+
${this.errorText}
|
|
292
|
+
</span>`
|
|
293
|
+
: nothing}
|
|
294
|
+
|
|
295
|
+
<textarea
|
|
296
|
+
id="textarea"
|
|
297
|
+
part="textarea"
|
|
298
|
+
class=${this.classMap({
|
|
299
|
+
textarea: true,
|
|
300
|
+
"textarea--error": hasError,
|
|
301
|
+
})}
|
|
302
|
+
.value=${this.value}
|
|
303
|
+
rows=${this.rows}
|
|
304
|
+
placeholder=${this.placeholder || nothing}
|
|
305
|
+
maxlength=${this.maxlength ?? nothing}
|
|
306
|
+
autocomplete=${this.autocomplete || nothing}
|
|
307
|
+
?required=${this.required}
|
|
308
|
+
?disabled=${disabled}
|
|
309
|
+
aria-invalid=${hasError ? "true" : nothing}
|
|
310
|
+
aria-describedby=${describedBy || nothing}
|
|
311
|
+
@input=${this._handleInput}
|
|
312
|
+
@change=${this._handleChange}
|
|
313
|
+
></textarea>
|
|
314
|
+
|
|
315
|
+
${this.helperText && !hasError
|
|
316
|
+
? html `<span id="helper" class="helper" part="helper"
|
|
317
|
+
>${this.helperText}</span
|
|
318
|
+
>`
|
|
319
|
+
: nothing}
|
|
320
|
+
</div>
|
|
321
|
+
`;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ type: String })
|
|
326
|
+
], OhTextarea.prototype, "label", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
property({ type: String })
|
|
329
|
+
], OhTextarea.prototype, "value", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
property({ type: String })
|
|
332
|
+
], OhTextarea.prototype, "placeholder", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
property({ type: String, attribute: "helper-text" })
|
|
335
|
+
], OhTextarea.prototype, "helperText", void 0);
|
|
336
|
+
__decorate([
|
|
337
|
+
property({ type: String, attribute: "error-text" })
|
|
338
|
+
], OhTextarea.prototype, "errorText", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
property({ type: String, reflect: true })
|
|
341
|
+
], OhTextarea.prototype, "name", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
property({ type: Boolean, reflect: true })
|
|
344
|
+
], OhTextarea.prototype, "required", void 0);
|
|
345
|
+
__decorate([
|
|
346
|
+
property({ type: Boolean, reflect: true })
|
|
347
|
+
], OhTextarea.prototype, "disabled", void 0);
|
|
348
|
+
__decorate([
|
|
349
|
+
property({ type: Number })
|
|
350
|
+
], OhTextarea.prototype, "rows", void 0);
|
|
351
|
+
__decorate([
|
|
352
|
+
property({ type: Number })
|
|
353
|
+
], OhTextarea.prototype, "maxlength", void 0);
|
|
354
|
+
__decorate([
|
|
355
|
+
property({ type: String })
|
|
356
|
+
], OhTextarea.prototype, "autocomplete", void 0);
|
|
357
|
+
__decorate([
|
|
358
|
+
query("textarea")
|
|
359
|
+
], OhTextarea.prototype, "_textarea", void 0);
|
|
360
|
+
__decorate([
|
|
361
|
+
state()
|
|
362
|
+
], OhTextarea.prototype, "_formDisabled", void 0);
|
|
363
|
+
__decorate([
|
|
364
|
+
state()
|
|
365
|
+
], OhTextarea.prototype, "_announceError", void 0);
|
|
366
|
+
OhTextarea = __decorate([
|
|
367
|
+
customElement("oh-textarea")
|
|
368
|
+
], OhTextarea);
|
|
369
|
+
export { OhTextarea };
|
|
370
|
+
//# sourceMappingURL=oh-textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oh-textarea.js","sourceRoot":"","sources":["../src/oh-textarea.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAElD;;;;;;;;;;GA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AU,CAAC;6CACsB;AAShC;IADP,KAAK,EAAE;iDACsB;AAQtB;IADP,KAAK,EAAE;kDACuB;AA/LpB,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAmUtB"}
|
package/dist/oh-toggle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-toggle.d.ts","sourceRoot":"","sources":["../src/oh-toggle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,qBACa,QAAS,SAAQ,SAAS;IACrC,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"oh-toggle.d.ts","sourceRoot":"","sources":["../src/oh-toggle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,qBACa,QAAS,SAAQ,SAAS;IACrC,OAAgB,MAAM,4BA0HpB;IAEF,uCAAuC;IAEvC,OAAO,UAAS;IAEhB,8CAA8C;IAE9C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IAEH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,+BAA+B;IAE/B,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,gCAAgC;IAEhC,KAAK,SAAQ;IAEb,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;IAExF,MAAM;CA4BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
package/dist/oh-toggle.js
CHANGED
|
@@ -97,10 +97,11 @@ let OhToggle = class OhToggle extends OhElement {
|
|
|
97
97
|
width: 26px;
|
|
98
98
|
height: 26px;
|
|
99
99
|
background-color: var(--oh-color-surface-base);
|
|
100
|
-
border: var(--oh-
|
|
100
|
+
border: var(--oh-stroke-control) solid var(--oh-color-border-emphasis);
|
|
101
101
|
border-radius: 50%;
|
|
102
|
-
box-shadow:
|
|
103
|
-
|
|
102
|
+
box-shadow: var(--oh-elevation-offset-md) var(--oh-elevation-offset-md)
|
|
103
|
+
0 0 var(--oh-shadow-secondary);
|
|
104
|
+
transition:
|
|
104
105
|
transform var(--oh-motion-snappy) var(--oh-motion-ease-gentle),
|
|
105
106
|
box-shadow var(--oh-motion-snappy) ease;
|
|
106
107
|
}
|
|
@@ -108,31 +109,38 @@ let OhToggle = class OhToggle extends OhElement {
|
|
|
108
109
|
/* Checked: thumb moves right, shadow flips to bottom-left */
|
|
109
110
|
.toggle__track--checked .toggle__thumb {
|
|
110
111
|
transform: translateX(30px);
|
|
111
|
-
box-shadow: -
|
|
112
|
+
box-shadow: calc(-1 * var(--oh-elevation-offset-md))
|
|
113
|
+
var(--oh-elevation-offset-md) 0 0 var(--oh-shadow-primary);
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
/* Hover state - lift further up-left, shadow grows */
|
|
115
117
|
.toggle__track:hover .toggle__thumb {
|
|
116
|
-
transform: translate(-
|
|
117
|
-
box-shadow:
|
|
118
|
+
transform: translate(var(--oh-lift-hover-sm), var(--oh-lift-hover-sm));
|
|
119
|
+
box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
|
|
120
|
+
0 0 var(--oh-shadow-secondary);
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
/* Checked hover - shadow flipped and grows */
|
|
121
124
|
.toggle__track--checked:hover .toggle__thumb {
|
|
122
|
-
transform: translateX(30px)
|
|
123
|
-
|
|
125
|
+
transform: translateX(30px)
|
|
126
|
+
translate(var(--oh-lift-press-sm), var(--oh-lift-hover-sm));
|
|
127
|
+
box-shadow: calc(-1 * var(--oh-elevation-offset-lg))
|
|
128
|
+
var(--oh-elevation-offset-lg) 0 0 var(--oh-shadow-primary);
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
/* Active/pressed state - press down, shadow shrinks */
|
|
127
132
|
.toggle__track:active .toggle__thumb {
|
|
128
|
-
transform: translate(
|
|
129
|
-
box-shadow:
|
|
133
|
+
transform: translate(var(--oh-lift-press-sm), var(--oh-lift-press-sm));
|
|
134
|
+
box-shadow: var(--oh-elevation-offset-xs) var(--oh-elevation-offset-xs)
|
|
135
|
+
0 0 var(--oh-shadow-secondary);
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
/* Checked active - shadow flipped and shrinks */
|
|
133
139
|
.toggle__track--checked:active .toggle__thumb {
|
|
134
|
-
transform: translateX(30px)
|
|
135
|
-
|
|
140
|
+
transform: translateX(30px)
|
|
141
|
+
translate(var(--oh-lift-hover-sm), var(--oh-lift-press-sm));
|
|
142
|
+
box-shadow: calc(-1 * var(--oh-elevation-offset-xs))
|
|
143
|
+
var(--oh-elevation-offset-xs) 0 0 var(--oh-shadow-primary);
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
/* ═══════════════════════════════════════════════════════════════
|
|
@@ -182,7 +190,9 @@ let OhToggle = class OhToggle extends OhElement {
|
|
|
182
190
|
role="switch"
|
|
183
191
|
aria-checked="${this.checked}"
|
|
184
192
|
aria-labelledby="${hasVisibleLabel ? this._labelId : nothing}"
|
|
185
|
-
aria-label="${!hasVisibleLabel && this.accessibleLabel
|
|
193
|
+
aria-label="${!hasVisibleLabel && this.accessibleLabel
|
|
194
|
+
? this.accessibleLabel
|
|
195
|
+
: nothing}"
|
|
186
196
|
tabindex="0"
|
|
187
197
|
@click="${this._handleClick}"
|
|
188
198
|
@keydown="${this._handleKeydown}"
|
|
@@ -190,7 +200,12 @@ let OhToggle = class OhToggle extends OhElement {
|
|
|
190
200
|
<div class="toggle__thumb"></div>
|
|
191
201
|
</div>
|
|
192
202
|
${hasVisibleLabel
|
|
193
|
-
? html `<span
|
|
203
|
+
? html `<span
|
|
204
|
+
id="${this._labelId}"
|
|
205
|
+
class="toggle__label"
|
|
206
|
+
@click="${this._handleClick}"
|
|
207
|
+
>${this.label}</span
|
|
208
|
+
>`
|
|
194
209
|
: nothing}
|
|
195
210
|
`;
|
|
196
211
|
}
|
package/dist/oh-toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-toggle.js","sourceRoot":"","sources":["../src/oh-toggle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;;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;AAG3C,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,SAAS;IAAhC;;
|
|
1
|
+
{"version":3,"file":"oh-toggle.js","sourceRoot":"","sources":["../src/oh-toggle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;;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;AAG3C,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,SAAS;IAAhC;;QA6HL,uCAAuC;QAEvC,YAAO,GAAG,KAAK,CAAC;QAiBhB,gCAAgC;QAEhC,UAAK,GAAG,IAAI,CAAC;QAwBI,aAAQ,GAAG,mBAAmB,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IA8B1F,CAAC;a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AC,IAAI,CAAA;kBACI,IAAI,CAAC,QAAQ;;sBAET,IAAI,CAAC,YAAY;eACxB,IAAI,CAAC,KAAK;YACb;YACJ,CAAC,CAAC,OAAO;KACZ,CAAC;IACJ,CAAC;;AAxED;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAC3B;AAIhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCACZ;AAOf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;iDACjC;AAIzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCACb;AAId;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCACd;AAlJF,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAwMpB"}
|
|
@@ -124,18 +124,18 @@ export const typographyStyles = css `
|
|
|
124
124
|
|
|
125
125
|
a::after,
|
|
126
126
|
.oh-link::after {
|
|
127
|
-
content:
|
|
127
|
+
content: "";
|
|
128
128
|
position: absolute;
|
|
129
129
|
left: 0;
|
|
130
130
|
right: 0;
|
|
131
131
|
bottom: 0;
|
|
132
|
-
height:
|
|
132
|
+
height: var(--oh-decoration-underline-thickness);
|
|
133
133
|
background: repeating-linear-gradient(
|
|
134
134
|
to right,
|
|
135
135
|
currentColor 0,
|
|
136
|
-
currentColor
|
|
137
|
-
transparent
|
|
138
|
-
transparent
|
|
136
|
+
currentColor var(--oh-decoration-underline-dash),
|
|
137
|
+
transparent var(--oh-decoration-underline-dash),
|
|
138
|
+
transparent var(--oh-decoration-underline-period)
|
|
139
139
|
);
|
|
140
140
|
transform-origin: right;
|
|
141
141
|
transition: transform var(--oh-motion-slow) ease;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orange-halo/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Web Components for Orange Halo Design System",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
|
+
"./custom-elements.json": "./custom-elements.json",
|
|
13
14
|
"./oh-accordion.js": {
|
|
14
15
|
"types": "./dist/oh-accordion.d.ts",
|
|
15
16
|
"import": "./dist/oh-accordion.js"
|
|
@@ -113,6 +114,14 @@
|
|
|
113
114
|
"./oh-tabs.js": {
|
|
114
115
|
"types": "./dist/oh-tabs.d.ts",
|
|
115
116
|
"import": "./dist/oh-tabs.js"
|
|
117
|
+
},
|
|
118
|
+
"./oh-textarea.js": {
|
|
119
|
+
"types": "./dist/oh-textarea.d.ts",
|
|
120
|
+
"import": "./dist/oh-textarea.js"
|
|
121
|
+
},
|
|
122
|
+
"./oh-toggle.js": {
|
|
123
|
+
"types": "./dist/oh-toggle.d.ts",
|
|
124
|
+
"import": "./dist/oh-toggle.js"
|
|
116
125
|
}
|
|
117
126
|
},
|
|
118
127
|
"files": [
|
|
@@ -124,18 +133,20 @@
|
|
|
124
133
|
"lit": "^3.2.1"
|
|
125
134
|
},
|
|
126
135
|
"peerDependencies": {
|
|
127
|
-
"@orange-halo/tokens": "^2.
|
|
136
|
+
"@orange-halo/tokens": "^2.2.0",
|
|
128
137
|
"@orange-halo/utils": "^1.1.0"
|
|
129
138
|
},
|
|
130
139
|
"devDependencies": {
|
|
131
|
-
"@
|
|
140
|
+
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
141
|
+
"@orange-halo/tokens": "2.2.0",
|
|
132
142
|
"@orange-halo/utils": "1.1.0"
|
|
133
143
|
},
|
|
134
144
|
"publishConfig": {
|
|
135
145
|
"access": "public"
|
|
136
146
|
},
|
|
137
147
|
"scripts": {
|
|
138
|
-
"build": "tsc",
|
|
148
|
+
"build": "tsc && cem analyze",
|
|
149
|
+
"analyze": "cem analyze",
|
|
139
150
|
"dev": "tsc --watch",
|
|
140
151
|
"clean": "rm -rf dist",
|
|
141
152
|
"lint": "eslint src/",
|