@jack-henry/jh-elements 2.0.0-beta.8
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/LICENSE +201 -0
- package/NOTICE +26 -0
- package/README.md +13 -0
- package/components/badge/badge.js +73 -0
- package/components/button/button.js +953 -0
- package/components/card/card.js +333 -0
- package/components/checkbox/checkbox.js +601 -0
- package/components/checkbox-group/checkbox-group.js +241 -0
- package/components/divider/divider.js +91 -0
- package/components/icon/icon.js +96 -0
- package/components/input/input.js +1245 -0
- package/components/input-email/input-email.js +18 -0
- package/components/input-password/input-password.js +153 -0
- package/components/input-search/input-search.js +41 -0
- package/components/input-telephone/input-telephone.js +18 -0
- package/components/input-textarea/input-textarea.js +374 -0
- package/components/input-url/input-url.js +31 -0
- package/components/list-group/list-group.js +103 -0
- package/components/list-item/list-item.js +350 -0
- package/components/menu/menu.js +60 -0
- package/components/notification/notification.js +327 -0
- package/components/progress/progress.js +417 -0
- package/components/radio/radio.js +422 -0
- package/components/radio-group/radio-group.js +400 -0
- package/components/switch/switch.js +316 -0
- package/components/table/table.js +367 -0
- package/components/table-data-cell/table-data-cell.js +107 -0
- package/components/table-header-cell/table-header-cell.js +321 -0
- package/components/table-row/table-row.js +52 -0
- package/components/tag/tag.js +422 -0
- package/components/tag-group/tag-group.js +57 -0
- package/components/toast/toast.js +172 -0
- package/components/toast-controller/toast-controller.js +122 -0
- package/components/tooltip/tooltip.js +498 -0
- package/custom-elements.json +6864 -0
- package/index.d.ts +69 -0
- package/jsconfig.json +9 -0
- package/package.json +52 -0
- package/utils/themeProvider.js +32 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2025 Jack Henry
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
import { LitElement, css, html } from 'lit';
|
|
6
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
|
+
|
|
8
|
+
let id = 0;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @cssprop --jh-checkbox-group-label-color-text - The label text color. Defaults to `--jh-color-content-primary-enabled`.
|
|
12
|
+
* @cssprop --jh-checkbox-group-required-color-text - The required indicator color.
|
|
13
|
+
* Defaults to `--jh-color-content-negative-enabled`.
|
|
14
|
+
* @cssprop --jh-checkbox-group-required-color-text-optional - The optional indicator text color.
|
|
15
|
+
* Defaults to `--jh-color-content-primary-enabled`.
|
|
16
|
+
* @cssprop --jh-checkbox-group-helper-color-text - The helper-text text color.
|
|
17
|
+
* Defaults to `--jh-color-content-secondary-enabled`.
|
|
18
|
+
* @cssprop --jh-checkbox-group-error-color-text - The error-text text color.
|
|
19
|
+
* Defaults to `--jh-color-content-negative-enabled`.
|
|
20
|
+
*
|
|
21
|
+
* @slot default - Use to insert `<jh-checkbox>` component(s).
|
|
22
|
+
*
|
|
23
|
+
* @customElement jh-checkbox-group
|
|
24
|
+
*/
|
|
25
|
+
export class JhCheckboxGroup extends LitElement {
|
|
26
|
+
/** @type {?Number} */
|
|
27
|
+
#id;
|
|
28
|
+
|
|
29
|
+
static get styles() {
|
|
30
|
+
return css`
|
|
31
|
+
:host {
|
|
32
|
+
font-family: var(--jh-font-helper-regular-font-family);
|
|
33
|
+
font-weight: var(--jh-font-helper-regular-font-weight);
|
|
34
|
+
font-size: var(--jh-font-helper-regular-font-size);
|
|
35
|
+
line-height: var(--jh-font-helper-regular-line-height);
|
|
36
|
+
display: block;
|
|
37
|
+
}
|
|
38
|
+
/* reset fieldset and legend for styling */
|
|
39
|
+
:host fieldset {
|
|
40
|
+
border: none;
|
|
41
|
+
padding: 0;
|
|
42
|
+
margin: 0;
|
|
43
|
+
}
|
|
44
|
+
:host legend {
|
|
45
|
+
padding: 0;
|
|
46
|
+
}
|
|
47
|
+
:host([label]) .controls {
|
|
48
|
+
margin-top: var(--jh-dimension-200);
|
|
49
|
+
}
|
|
50
|
+
:host([orientation='vertical']) .controls {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
}
|
|
54
|
+
:host([orientation='vertical']) ::slotted(*) {
|
|
55
|
+
margin-bottom: var(--jh-dimension-200);
|
|
56
|
+
flex: 1;
|
|
57
|
+
}
|
|
58
|
+
:host([orientation='vertical']) ::slotted(:last-of-type) {
|
|
59
|
+
margin-bottom: 0;
|
|
60
|
+
}
|
|
61
|
+
:host([orientation='horizontal']) .controls {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: row;
|
|
64
|
+
}
|
|
65
|
+
:host([orientation='horizontal']) ::slotted(*) {
|
|
66
|
+
margin-right: var(--jh-dimension-400);
|
|
67
|
+
margin-bottom: 0;
|
|
68
|
+
flex: 1;
|
|
69
|
+
}
|
|
70
|
+
:host([orientation='horizontal']) ::slotted(:last-of-type) {
|
|
71
|
+
margin-right: 0;
|
|
72
|
+
}
|
|
73
|
+
.label {
|
|
74
|
+
color: var(
|
|
75
|
+
--jh-checkbox-group-label-color-text,
|
|
76
|
+
var(--jh-color-content-primary-enabled)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
.helper-text {
|
|
80
|
+
color: var(
|
|
81
|
+
--jh-checkbox-group-helper-color-text,
|
|
82
|
+
var(--jh-color-content-secondary-enabled)
|
|
83
|
+
);
|
|
84
|
+
margin: 0;
|
|
85
|
+
}
|
|
86
|
+
.label-text,
|
|
87
|
+
.helper-text,
|
|
88
|
+
:host([invalid]) .error-text {
|
|
89
|
+
word-break: break-word;
|
|
90
|
+
}
|
|
91
|
+
:host([invalid]) .error-text {
|
|
92
|
+
color: var(
|
|
93
|
+
--jh-checkbox-group-error-color-text,
|
|
94
|
+
var(--jh-color-content-negative-enabled)
|
|
95
|
+
);
|
|
96
|
+
margin: var(--jh-dimension-200) 0 0 0;
|
|
97
|
+
}
|
|
98
|
+
:host([show-indicator]) .indicator {
|
|
99
|
+
color: var(
|
|
100
|
+
--jh-checkbox-group-required-color-text-optional,
|
|
101
|
+
var(--jh-color-content-primary-enabled)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
:host([show-indicator][required]) .indicator {
|
|
105
|
+
color: var(
|
|
106
|
+
--jh-checkbox-group-required-color-text,
|
|
107
|
+
var(--jh-color-content-negative-enabled)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
static get properties() {
|
|
113
|
+
return {
|
|
114
|
+
/** Sets an `aria-label` to assist screen reader users when no visible label is present. */
|
|
115
|
+
accessibleLabel: {
|
|
116
|
+
type: String,
|
|
117
|
+
attribute: 'accessible-label',
|
|
118
|
+
},
|
|
119
|
+
/** Text to be displayed when checkbox group has failed validation and `invalid` is true. */
|
|
120
|
+
errorText: {
|
|
121
|
+
type: String,
|
|
122
|
+
attribute: 'error-text',
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Provides additional context or guidance for using the checkbox group. For `helper-text` to be displayed, the `label` property must also be set.
|
|
126
|
+
*/
|
|
127
|
+
helperText: {
|
|
128
|
+
attribute: 'helper-text',
|
|
129
|
+
},
|
|
130
|
+
/** Sets an `aria-invalid` on the checkbox group to indicate the value supplied was invalid and displays `error-text` when set. */
|
|
131
|
+
invalid: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
reflect: true,
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Describes the type of data to be collected.
|
|
137
|
+
*/
|
|
138
|
+
label: {
|
|
139
|
+
type: String,
|
|
140
|
+
},
|
|
141
|
+
/** Indicates a value is required. */
|
|
142
|
+
required: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
reflect: true,
|
|
145
|
+
},
|
|
146
|
+
/** Determines the orientation of the checkbox group. */
|
|
147
|
+
orientation: {
|
|
148
|
+
type: String,
|
|
149
|
+
reflect: true,
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Adds a visual indicator next to the label. Indicates that a value is optional (by default) or required if the `required` property is also set. For the indicator to be displayed, the `label` property must also be set. */
|
|
153
|
+
showIndicator: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
reflect: true,
|
|
156
|
+
attribute: 'show-indicator',
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
constructor() {
|
|
161
|
+
super();
|
|
162
|
+
/** @type {?string} */
|
|
163
|
+
this.accessibleLabel = null;
|
|
164
|
+
/** @type {?string} */
|
|
165
|
+
this.errorText = null;
|
|
166
|
+
/** @type {?string} */
|
|
167
|
+
this.helperText = null;
|
|
168
|
+
/** @type {?Boolean} */
|
|
169
|
+
this.invalid = false;
|
|
170
|
+
/** @type {?string} */
|
|
171
|
+
this.label = null;
|
|
172
|
+
/** @type {?Boolean} */
|
|
173
|
+
this.required = false;
|
|
174
|
+
/** @type {'vertical'|'horizontal'} */
|
|
175
|
+
this.orientation = 'vertical';
|
|
176
|
+
/** @type {?boolean} */
|
|
177
|
+
this.showIndicator = false;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
connectedCallback() {
|
|
181
|
+
super.connectedCallback();
|
|
182
|
+
this.#id = id++;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
#getAriaDescribedBy() {
|
|
186
|
+
if (this.errorText && this.invalid && this.helperText && this.label) {
|
|
187
|
+
return `checkbox-group-error-${this.#id} checkbox-group-helper-${
|
|
188
|
+
this.#id
|
|
189
|
+
}`;
|
|
190
|
+
} else if (this.errorText && this.invalid) {
|
|
191
|
+
return `checkbox-group-error-${this.#id}`;
|
|
192
|
+
} else if (this.helperText && this.label) {
|
|
193
|
+
return `checkbox-group-helper-${this.#id}`;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
render() {
|
|
198
|
+
let indicator;
|
|
199
|
+
let helperText;
|
|
200
|
+
let label;
|
|
201
|
+
let errorText;
|
|
202
|
+
|
|
203
|
+
if (this.showIndicator) {
|
|
204
|
+
if (this.required) {
|
|
205
|
+
indicator = html`<span class="indicator" aria-hidden="true"> *</span>`;
|
|
206
|
+
} else {
|
|
207
|
+
indicator = html`<span class="indicator"> (optional)</span>`;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (this.helperText) {
|
|
212
|
+
helperText = html`<p class="helper-text" id="checkbox-group-helper-${this.#id}">${this.helperText}</p>`;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (this.label) {
|
|
216
|
+
label = html`
|
|
217
|
+
<legend class="label" for="checkbox-group-label-${this.#id}">
|
|
218
|
+
${this.label}${indicator}
|
|
219
|
+
</legend>
|
|
220
|
+
${helperText}`;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (this.invalid && this.errorText) {
|
|
224
|
+
errorText = html`<p class="error-text" id="checkbox-group-error-${this.#id}">${this.errorText}</p>`;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return html`
|
|
228
|
+
<fieldset
|
|
229
|
+
id=${ifDefined(this.label ? `checkbox-group-label-${this.#id}` : null)}
|
|
230
|
+
aria-describedby=${ifDefined(this.#getAriaDescribedBy())}
|
|
231
|
+
?required=${this.required}
|
|
232
|
+
aria-invalid=${ifDefined(this.invalid ? 'true' : null)}
|
|
233
|
+
aria-label=${ifDefined(this.accessibleLabel)}>
|
|
234
|
+
${label}
|
|
235
|
+
<div class="controls"><slot></slot></div>
|
|
236
|
+
${errorText}
|
|
237
|
+
</fieldset>
|
|
238
|
+
`;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
customElements.define('jh-checkbox-group', JhCheckboxGroup);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2025 Jack Henry
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
import { LitElement, css } from 'lit';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @cssprop --jh-divider-border-width - The divider width. Defaults to `--jh-border-decorative-width`.
|
|
9
|
+
* @cssprop --jh-divider-border-style - The divider style. Defaults to `--jh-border-decorative-style`.
|
|
10
|
+
* @cssprop --jh-divider-color-border - The divider color. Defaults to `--jh-border-decorative-color`.
|
|
11
|
+
* @cssprop --jh-divider-space-inset - The divider margin-left. Defaults to `0`.
|
|
12
|
+
* @customElement jh-divider
|
|
13
|
+
*/
|
|
14
|
+
export class JhDivider extends LitElement {
|
|
15
|
+
static get styles() {
|
|
16
|
+
return css`
|
|
17
|
+
:host {
|
|
18
|
+
border-bottom-width: var(--jh-divider-border-width, var(--jh-border-decorative-width));
|
|
19
|
+
border-bottom-style: var(--jh-divider-border-style, var(--jh-border-decorative-style));
|
|
20
|
+
border-bottom-color: var(--jh-divider-color-border, var(--jh-border-decorative-color));
|
|
21
|
+
display: block;
|
|
22
|
+
margin-top: 16px;
|
|
23
|
+
margin-bottom: 16px;
|
|
24
|
+
box-sizing: content-box;
|
|
25
|
+
}
|
|
26
|
+
:host([inset='0']) {
|
|
27
|
+
--inset: 0;
|
|
28
|
+
}
|
|
29
|
+
:host([inset='8']) {
|
|
30
|
+
--inset: var(--jh-dimension-200);
|
|
31
|
+
}
|
|
32
|
+
:host([inset='16']) {
|
|
33
|
+
--inset: var(--jh-dimension-400);
|
|
34
|
+
}
|
|
35
|
+
:host([inset='24']) {
|
|
36
|
+
--inset: var(--jh-dimension-600);
|
|
37
|
+
}
|
|
38
|
+
:host([inset='32']) {
|
|
39
|
+
--inset: var(--jh-dimension-800);
|
|
40
|
+
}
|
|
41
|
+
:host([inset='40']) {
|
|
42
|
+
--inset: var(--jh-dimension-1000);
|
|
43
|
+
}
|
|
44
|
+
:host([inset='48']) {
|
|
45
|
+
--inset: var(--jh-dimension-1200);
|
|
46
|
+
}
|
|
47
|
+
:host([inset='56']) {
|
|
48
|
+
--inset: var(--jh-dimension-1400);
|
|
49
|
+
}
|
|
50
|
+
:host([inset='64']) {
|
|
51
|
+
--inset: var(--jh-dimension-1600);
|
|
52
|
+
}
|
|
53
|
+
:host([inset='72']) {
|
|
54
|
+
--inset: var(--jh-dimension-1800);
|
|
55
|
+
}
|
|
56
|
+
:host([inset='80']) {
|
|
57
|
+
--inset: var(--jh-dimension-2000);
|
|
58
|
+
}
|
|
59
|
+
:host([inset='88']) {
|
|
60
|
+
--inset: var(--jh-dimension-2200);
|
|
61
|
+
}
|
|
62
|
+
:host([inset='96']) {
|
|
63
|
+
--inset: var(--jh-dimension-2400);
|
|
64
|
+
}
|
|
65
|
+
:host,
|
|
66
|
+
:host[inset] {
|
|
67
|
+
margin-left: var(--inset, var(--jh-divider-space-inset));
|
|
68
|
+
}
|
|
69
|
+
`
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static get properties() {
|
|
73
|
+
return {
|
|
74
|
+
/**
|
|
75
|
+
* The alignment of the left edge of the divider.
|
|
76
|
+
*/
|
|
77
|
+
inset: {
|
|
78
|
+
type: Number,
|
|
79
|
+
reflect: true,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
constructor() {
|
|
85
|
+
super();
|
|
86
|
+
/** @type {0|8|16|24|32|40|48|56|64|72|80|88|96} */
|
|
87
|
+
this.inset = null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
customElements.define('jh-divider', JhDivider);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2025 Jack Henry
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
import { LitElement, css, html } from 'lit';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @cssprop --jh-icon-color-fill - The icon color. Defaults to `--jh-color-content-secondary-enabled`.
|
|
9
|
+
* @cssprop --jh-icon-size-extra-small - The icon size when `size="extra-small"`. Defaults to `--jh-dimension-400`.
|
|
10
|
+
* @cssprop --jh-icon-size-small - The icon size when `size="small"`. Defaults to `--jh-dimension-500`.
|
|
11
|
+
* @cssprop --jh-icon-size-medium - The icon size when `size="medium"`. Defaults to `--jh-dimension-600`.
|
|
12
|
+
* @cssprop --jh-icon-size-large - The icon size when `size="large"`. Defaults to `--jh-dimension-900`.
|
|
13
|
+
* @cssprop --jh-icon-size-extra-large - The icon size when `size="extra-large"`. Defaults to `--jh-dimension-1400`.
|
|
14
|
+
* @slot default - Use to insert the icon SVG content.
|
|
15
|
+
* @customElement jh-icon
|
|
16
|
+
*/
|
|
17
|
+
export class JhIcon extends LitElement {
|
|
18
|
+
|
|
19
|
+
/** @type {ElementInternals} */
|
|
20
|
+
#internals;
|
|
21
|
+
|
|
22
|
+
static get styles() {
|
|
23
|
+
return css`
|
|
24
|
+
:host {
|
|
25
|
+
fill: var(
|
|
26
|
+
--jh-icon-color-fill,
|
|
27
|
+
var(--jh-color-content-secondary-enabled)
|
|
28
|
+
);
|
|
29
|
+
width: var(--icon-size);
|
|
30
|
+
height: var(--icon-size);
|
|
31
|
+
display: inline-block;
|
|
32
|
+
}
|
|
33
|
+
:host([size='x-small']) {
|
|
34
|
+
--icon-size: var(
|
|
35
|
+
--jh-icon-size-extra-small,
|
|
36
|
+
var(--jh-dimension-400)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
:host([size='small']) {
|
|
40
|
+
--icon-size: var(
|
|
41
|
+
--jh-icon-size-small,
|
|
42
|
+
var(--jh-dimension-500)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
:host([size='medium']) {
|
|
46
|
+
--icon-size: var(
|
|
47
|
+
--jh-icon-size-medium,
|
|
48
|
+
var(--jh-dimension-600)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
:host([size='large']) {
|
|
52
|
+
--icon-size: var(
|
|
53
|
+
--jh-icon-size-large,
|
|
54
|
+
var(--jh-dimension-900)
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
:host([size='x-large']) {
|
|
58
|
+
--icon-size: var(
|
|
59
|
+
--jh-icon-size-extra-large,
|
|
60
|
+
var(--jh-dimension-1400)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
svg,
|
|
64
|
+
::slotted(*) {
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
static get properties() {
|
|
71
|
+
return {
|
|
72
|
+
/**
|
|
73
|
+
* Sets the size of the icon.
|
|
74
|
+
*/
|
|
75
|
+
size: {
|
|
76
|
+
type: String, reflect: true
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
constructor() {
|
|
81
|
+
super();
|
|
82
|
+
this.#internals = this.attachInternals();
|
|
83
|
+
this.#internals.role = 'graphics-symbol';
|
|
84
|
+
this.#internals.ariaHidden = 'true';
|
|
85
|
+
|
|
86
|
+
/** @type {'x-small'|'small'|'medium'|'large'|'x-large'} */
|
|
87
|
+
this.size = 'medium';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
render() {
|
|
91
|
+
return html`
|
|
92
|
+
<slot></slot>
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
customElements.define('jh-icon', JhIcon);
|