@jack-henry/jh-elements 2.0.0-beta.10 → 2.0.0-beta.11

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/README.md CHANGED
@@ -10,4 +10,4 @@ Contains Jack Henry's web component library. To get started, visit our documenta
10
10
 
11
11
  * [Jackhenry.design](https://jackhenry.design) focuses on introducing the underlying concepts of the Design System, usage guidelines, and a style guide.
12
12
  * [Storybook](https://main--68f8e6a25b256d0ef89b13e6.chromatic.com/?path=/docs/welcome-about-jh--docs) focuses on technical implementations and considerations
13
- for engineers, author guidance, and a playground where you can test drive our components.
13
+ for engineers including author guidance and a playground where you can test drive our components.
@@ -7,8 +7,8 @@ import { ifDefined } from 'lit/directives/if-defined.js';
7
7
 
8
8
  /**
9
9
  * @cssprop --jh-badge-border-radius - The badge border radius. Defaults to `--jh-border-radius-pill`.
10
- * @cssprop --jh-badge-color-background-enabled - The badge background color. Defaults to `--jh-color-content-brand-enabled`.
11
- * @cssprop --jh-badge-color-text-enabled - The badge text color. Defaults to `--jh-color-content-on-brand-enabled`.
10
+ * @cssprop --jh-badge-color-background-enabled - The badge background color. Defaults to `--jh-color-content-negative-enabled`.
11
+ * @cssprop --jh-badge-color-text-enabled - The badge text color. Defaults to `--jh-color-content-on-negative-enabled`.
12
12
  *
13
13
  * @customElement jh-badge
14
14
  */
@@ -19,8 +19,8 @@ export class JhBadge extends LitElement {
19
19
  display: inline-flex;
20
20
  }
21
21
  span {
22
- background: var(--jh-badge-color-background-enabled, var(--jh-color-content-brand-enabled));
23
- color: var(--jh-badge-color-text-enabled, var(--jh-color-content-on-brand-enabled));
22
+ background: var(--jh-badge-color-background-enabled, var(--jh-color-content-negative-enabled));
23
+ color: var(--jh-badge-color-text-enabled, var(--jh-color-content-on-negative-enabled));
24
24
  border-radius: var(--jh-badge-border-radius, var(--jh-border-radius-pill));
25
25
  min-width: var(--jh-dimension-200);
26
26
  height: var(--jh-dimension-200);
@@ -28,10 +28,10 @@ export class JhBadge extends LitElement {
28
28
  justify-content: center;
29
29
  }
30
30
  .count-present {
31
- font-family: var(--jh-font-helper-medium-font-family);
32
- font-weight: var(--jh-font-helper-medium-font-weight);
33
- font-size: var(--jh-font-helper-medium-font-size);
34
- line-height: var(--jh-font-helper-medium-line-height);
31
+ font-family: var(--jh-font-helper-bold-font-family);
32
+ font-weight: var(--jh-font-helper-bold-font-weight);
33
+ font-size: var(--jh-font-helper-bold-font-size);
34
+ line-height: var(--jh-font-helper-bold-line-height);
35
35
  height: var(--jh-dimension-400);
36
36
  padding: var(--jh-dimension-0) var(--jh-dimension-100);
37
37
  width: auto;
@@ -44,7 +44,7 @@ export class JhBadge extends LitElement {
44
44
  /** Number to show within the badge. If no `count` is supplied, Badge will render as a dot.*/
45
45
  count: { type: String },
46
46
  /** Sets the max count to show. Appends `+` to the `max-count` when value is exceeded. */
47
- maxCount: { type: String, attribute: 'max-count' },
47
+ maxCount: { type: Number, attribute: 'max-count' },
48
48
  };
49
49
  }
50
50
 
@@ -53,7 +53,7 @@ export class JhBadge extends LitElement {
53
53
  /** @type {?string} */
54
54
  this.count = null;
55
55
  /** @type {?number} */
56
- this.maxCount = null;
56
+ this.maxCount = 99;
57
57
  }
58
58
 
59
59
  render() {
@@ -71,3 +71,4 @@ export class JhBadge extends LitElement {
71
71
  }
72
72
  }
73
73
  customElements.define('jh-badge', JhBadge);
74
+
@@ -8,8 +8,8 @@ import '../divider/divider.js';
8
8
 
9
9
  /**
10
10
  * @cssprop --jh-card-color-background - The card background-color. Defaults to `--jh-color-container-primary-enabled`.
11
- * @cssprop --jh-card-border-radius - The card border-radius. Defaults to `--jh-border-radius-400`.
12
- * @cssprop --jh-card-shadow - The card box-shadow. Defaults to `--jh-shadow-low`.
11
+ * @cssprop --jh-card-border-radius - The card border-radius. Defaults to `--jh-border-radius-200`.
12
+ * @cssprop --jh-card-color-border - The card border color. Defaults to `--jh-border-decorative-color`.
13
13
  * @cssprop --jh-card-media-aspect-ratio - The media slot aspect-ratio. Defaults to `auto`.
14
14
  * @cssprop --jh-card-media-space-padding - The media slot padding. Defaults to `0`.
15
15
  * @cssprop --jh-card-header-color-text - The header text color. Defaults to `--jh-color-content-primary-enabled`.
@@ -35,7 +35,7 @@ export class JhCard extends LitElement {
35
35
  static get styles() {
36
36
  return css`
37
37
  :host {
38
- --border-radius: var(--jh-border-radius-400);
38
+ --border-radius: var(--jh-border-radius-200);
39
39
  background-color: var(
40
40
  --jh-card-color-background,
41
41
  var(--jh-color-container-primary-enabled)
@@ -44,7 +44,9 @@ export class JhCard extends LitElement {
44
44
  --jh-card-border-radius,
45
45
  var(--border-radius)
46
46
  );
47
- box-shadow: var(--jh-card-shadow, var(--jh-shadow-low));
47
+ border-color: var(--jh-card-color-border, var(--jh-border-decorative-color));
48
+ border-width: var(--jh-border-decorative-width);
49
+ border-style: var(--jh-border-decorative-style);
48
50
  word-break: break-word;
49
51
  display: block;
50
52
  }
@@ -76,10 +76,10 @@ export class JhCheckbox extends LitElement {
76
76
  static get styles() {
77
77
  return css`
78
78
  :host {
79
- font-family: var(--jh-font-body-regular-1-font-family);
80
- font-weight: var(--jh-font-body-regular-1-font-weight);
81
- font-size: var(--jh-font-body-regular-1-font-size);
82
- line-height: var(--jh-font-body-regular-1-line-height);
79
+ font-family: var(--jh-font-body-medium-1-font-family);
80
+ font-weight: var(--jh-font-body-medium-1-font-weight);
81
+ font-size: var(--jh-font-body-medium-1-font-size);
82
+ line-height: var(--jh-font-body-medium-1-line-height);
83
83
  display: inline-flex;
84
84
  position: relative;
85
85
  }
@@ -9,6 +9,7 @@ let id = 0;
9
9
  /**
10
10
  *
11
11
  * @cssprop --jh-checkbox-group-label-color-text - The label text color. Defaults to `--jh-color-content-primary-enabled`.
12
+ * @cssprop --jh-checkbox-group-opacity-disabled - The opacity of the checkbox group when disabled. Defaults to `--jh-opacity-disabled`.
12
13
  * @cssprop --jh-checkbox-group-required-color-text - The required indicator color.
13
14
  * Defaults to `--jh-color-content-negative-enabled`.
14
15
  * @cssprop --jh-checkbox-group-required-color-text-optional - The optional indicator text color.
@@ -41,6 +42,21 @@ export class JhCheckboxGroup extends LitElement {
41
42
  padding: 0;
42
43
  margin: 0;
43
44
  }
45
+ :host([disabled]) {
46
+ --group-disabled-opacity: var(
47
+ --jh-checkbox-group-opacity-disabled,
48
+ var(--jh-opacity-disabled)
49
+ );
50
+ }
51
+ :host([disabled]) .label,
52
+ :host([disabled]) .helper-text,
53
+ :host([disabled]) .error-text {
54
+ opacity: var(--group-disabled-opacity);
55
+ pointer-events: none;
56
+ }
57
+ :host([disabled]) ::slotted(jh-checkbox) {
58
+ --jh-checkbox-opacity-disabled: var(--group-disabled-opacity);
59
+ }
44
60
  :host legend {
45
61
  padding: 0;
46
62
  }
@@ -83,7 +99,6 @@ export class JhCheckboxGroup extends LitElement {
83
99
  );
84
100
  margin: 0;
85
101
  }
86
- .label-text,
87
102
  .helper-text,
88
103
  :host([invalid]) .error-text {
89
104
  word-break: break-word;
@@ -116,6 +131,11 @@ export class JhCheckboxGroup extends LitElement {
116
131
  type: String,
117
132
  attribute: 'accessible-label',
118
133
  },
134
+ /** Disables the checkbox group and prevents all user interactions. May cause the group to be ignored by assistive technologies (AT). */
135
+ disabled: {
136
+ type: Boolean,
137
+ reflect: true,
138
+ },
119
139
  /** Text to be displayed when checkbox group has failed validation and `invalid` is true. */
120
140
  errorText: {
121
141
  type: String,
@@ -159,17 +179,19 @@ export class JhCheckboxGroup extends LitElement {
159
179
  }
160
180
  constructor() {
161
181
  super();
182
+ /** @type {boolean} */
183
+ this.disabled = false;
162
184
  /** @type {?string} */
163
185
  this.accessibleLabel = null;
164
186
  /** @type {?string} */
165
187
  this.errorText = null;
166
188
  /** @type {?string} */
167
189
  this.helperText = null;
168
- /** @type {?Boolean} */
190
+ /** @type {?boolean} */
169
191
  this.invalid = false;
170
192
  /** @type {?string} */
171
193
  this.label = null;
172
- /** @type {?Boolean} */
194
+ /** @type {?boolean} */
173
195
  this.required = false;
174
196
  /** @type {'vertical'|'horizontal'} */
175
197
  this.orientation = 'vertical';
@@ -182,6 +204,27 @@ export class JhCheckboxGroup extends LitElement {
182
204
  this.#id = id++;
183
205
  }
184
206
 
207
+ firstUpdated() {
208
+ const slot = this.renderRoot?.querySelector('slot');
209
+ this.#syncDisabledToChildren();
210
+ }
211
+
212
+ updated(changedProperties) {
213
+ if (changedProperties.has('disabled')) {
214
+ this.#syncDisabledToChildren();
215
+ }
216
+ }
217
+
218
+ #syncDisabledToChildren() {
219
+ const slot = this.renderRoot?.querySelector('slot');
220
+ if(!slot) return;
221
+
222
+ const checkboxes = slot.assignedElements().filter(el => el.tagName === 'JH-CHECKBOX');
223
+ checkboxes.forEach(checkbox => {
224
+ checkbox.disabled = this.disabled;
225
+ })
226
+ }
227
+
185
228
  #getAriaDescribedBy() {
186
229
  if (this.errorText && this.invalid && this.helperText && this.label) {
187
230
  return `checkbox-group-error-${this.#id} checkbox-group-helper-${
@@ -230,9 +273,10 @@ export class JhCheckboxGroup extends LitElement {
230
273
  aria-describedby=${ifDefined(this.#getAriaDescribedBy())}
231
274
  ?required=${this.required}
232
275
  aria-invalid=${ifDefined(this.invalid ? 'true' : null)}
276
+ aria-disabled=${ifDefined(this.disabled ? 'true' : null)}
233
277
  aria-label=${ifDefined(this.accessibleLabel)}>
234
278
  ${label}
235
- <div class="controls"><slot></slot></div>
279
+ <div class="controls"><slot @slotchange=${() => this.#syncDisabledToChildren()} ></slot></div>
236
280
  ${errorText}
237
281
  </fieldset>
238
282
  `;
@@ -91,6 +91,8 @@ export class JhInput extends LitElement {
91
91
  // alphanumeric characters -> usernames, product codes, etc.
92
92
  '*': /[A-Za-z0-9]/,
93
93
  };
94
+ /** @type {Map} */
95
+ #activeSlottedElement = new Map();
94
96
 
95
97
  static get styles() {
96
98
  return css`
@@ -464,6 +466,7 @@ export class JhInput extends LitElement {
464
466
 
465
467
  disconnectedCallback() {
466
468
  super.disconnectedCallback();
469
+ this.#resizeObserver.disconnect();
467
470
  if (this.inputMask) {
468
471
  this.removeEventListener('jh-select', this.#setSelection);
469
472
  }
@@ -1048,27 +1051,39 @@ export class JhInput extends LitElement {
1048
1051
  );
1049
1052
  }
1050
1053
 
1051
- #handleSlotChange(e) {
1054
+ // capture dimensions of slotted content and set CSS variables to adjust input padding and vertically center slotted content
1055
+ #resizeObserver = new ResizeObserver((entries) => {
1052
1056
  let inputEl = this.shadowRoot.querySelector('input');
1053
- let slottedElement = e.target.assignedElements()[0];
1054
- let slotName = e.target.name;
1055
1057
 
1056
- if (slottedElement?.tagName.startsWith('JH-ICON')) {
1057
- slottedElement.setAttribute('size', 'medium');
1058
+ for (let entry of entries) {
1059
+ let slottedEl = entry.target;
1060
+ let slottedElWidth = entry.borderBoxSize[0].inlineSize;
1061
+ let slottedElHeight = entry.borderBoxSize[0].blockSize;
1062
+
1063
+ this.style.setProperty(`--${slottedEl.slot}-width`, `${slottedElWidth}px`);
1064
+
1065
+ this.style.setProperty(`--${slottedEl.slot}-top`, `${(inputEl.offsetHeight - slottedElHeight) / 2}px`);
1058
1066
  }
1067
+ });
1059
1068
 
1060
- // capture dimensions of slotted content
1061
- if (slottedElement) {
1062
- if (slotName === 'jh-input-left' || slotName === 'jh-input-right') {
1069
+ #handleSlotChange(e) {
1070
+ let newSlottedElement = e.target.assignedElements()[0];
1071
+ let slotName = e.target.name;
1072
+
1073
+ // stop observing previous slotted element for each slot
1074
+ if (this.#activeSlottedElement.has(slotName)) {
1075
+ this.#resizeObserver.unobserve(this.#activeSlottedElement.get(slotName));
1076
+ }
1063
1077
 
1064
- // set a CSS variable for the width of the slotted content
1065
- this.style.setProperty(`--${slottedElement.slot}-width`, `${slottedElement.offsetWidth}px`);
1078
+ if (newSlottedElement) {
1079
+ this.#activeSlottedElement.set(slotName, newSlottedElement);
1066
1080
 
1067
- // set a css variable to vertically center slotted content
1068
- this.style.setProperty(`--${slottedElement.slot}-top`, `${(inputEl.offsetHeight - slottedElement.offsetHeight) / 2}px`);
1081
+ if (newSlottedElement.tagName.startsWith('JH-ICON')) {
1082
+ newSlottedElement.setAttribute('size', 'medium');
1069
1083
  }
1084
+ this.#resizeObserver.observe(newSlottedElement);
1070
1085
  }
1071
- this.#addClass(slotName, slottedElement);
1086
+ this.#addClass(slotName, newSlottedElement);
1072
1087
  }
1073
1088
 
1074
1089
  // sets class on input element so padding can accomodate slotted content
@@ -74,10 +74,10 @@ export class JhRadio extends LitElement {
74
74
  static get styles() {
75
75
  return css`
76
76
  :host {
77
- font-family: var(--jh-font-body-regular-1-font-family);
78
- font-weight: var(--jh-font-body-regular-1-font-weight);
79
- font-size: var(--jh-font-body-regular-1-font-size);
80
- line-height: var(--jh-font-body-regular-1-line-height);
77
+ font-family: var(--jh-font-body-medium-1-font-family);
78
+ font-weight: var(--jh-font-body-medium-1-font-weight);
79
+ font-size: var(--jh-font-body-medium-1-font-size);
80
+ line-height: var(--jh-font-body-medium-1-line-height);
81
81
  display: inline-flex;
82
82
  position: relative;
83
83
  }
@@ -35,10 +35,10 @@ export class JhSwitch extends LitElement {
35
35
  static get styles() {
36
36
  return css`
37
37
  :host {
38
- font-family: var(--jh-font-body-regular-1-font-family);
39
- font-weight: var(--jh-font-body-regular-1-font-weight);
40
- font-size: var(--jh-font-body-regular-1-font-size);
41
- line-height: var(--jh-font-body-regular-1-line-height);
38
+ font-family: var(--jh-font-body-medium-1-font-family);
39
+ font-weight: var(--jh-font-body-medium-1-font-weight);
40
+ font-size: var(--jh-font-body-medium-1-font-size);
41
+ line-height: var(--jh-font-body-medium-1-line-height);
42
42
  display: inline-flex;
43
43
  position: relative;
44
44
  }
@@ -132,6 +132,7 @@ export class JhTable extends LitElement {
132
132
  :host([sticky-header]) .header {
133
133
  position: sticky;
134
134
  top: 0;
135
+ z-index: 1000;
135
136
  }
136
137
  :host([sticky-footer]) .footer {
137
138
  --jh-table-data-cell-color-border-top: var(
@@ -139,6 +140,7 @@ export class JhTable extends LitElement {
139
140
  );
140
141
  position: sticky;
141
142
  bottom: 0;
143
+ z-index: 1000;
142
144
  }
143
145
  :host([sticky-footer]) .body::slotted(jh-table-row:nth-last-of-type(2)) {
144
146
  --jh-table-data-cell-color-border-bottom: transparent;
@@ -178,8 +180,10 @@ export class JhTable extends LitElement {
178
180
  }
179
181
 
180
182
  :host([scrollable]) .table-container {
181
- overflow: scroll;
183
+ overflow: auto;
182
184
  height: 100%;
185
+ /* keeps space reserved for vertical scrollbar */
186
+ scrollbar-gutter: stable;
183
187
  /* removes bouncy scroll behavior in Safari and FF */
184
188
  /* overscroll-behavior: none; */
185
189
  }
@@ -293,7 +297,6 @@ export class JhTable extends LitElement {
293
297
  async firstUpdated() {
294
298
  if (!this.scrollable) return;
295
299
 
296
- const container = this.shadowRoot.querySelector('.table-container');
297
300
  let scrollTable = this.shadowRoot.querySelector('.table');
298
301
  await scrollTable.updateComplete;
299
302
  let originalTableWidth = scrollTable.getBoundingClientRect().width;
@@ -13,7 +13,8 @@
13
13
  {
14
14
  "name": "max-count",
15
15
  "description": "Sets the max count to show. Appends `+` to the `max-count` when value is exceeded.",
16
- "type": "?number"
16
+ "type": "?number",
17
+ "default": "99"
17
18
  }
18
19
  ],
19
20
  "properties": [
@@ -27,7 +28,8 @@
27
28
  "name": "maxCount",
28
29
  "attribute": "max-count",
29
30
  "description": "Sets the max count to show. Appends `+` to the `max-count` when value is exceeded.",
30
- "type": "?number"
31
+ "type": "?number",
32
+ "default": "99"
31
33
  }
32
34
  ],
33
35
  "cssProperties": [
@@ -37,11 +39,11 @@
37
39
  },
38
40
  {
39
41
  "name": "--jh-badge-color-background-enabled",
40
- "description": "The badge background color. Defaults to `--jh-color-content-brand-enabled`."
42
+ "description": "The badge background color. Defaults to `--jh-color-content-negative-enabled`."
41
43
  },
42
44
  {
43
45
  "name": "--jh-badge-color-text-enabled",
44
- "description": "The badge text color. Defaults to `--jh-color-content-on-brand-enabled`."
46
+ "description": "The badge text color. Defaults to `--jh-color-content-on-negative-enabled`."
45
47
  }
46
48
  ]
47
49
  },
@@ -741,11 +743,11 @@
741
743
  },
742
744
  {
743
745
  "name": "--jh-card-border-radius",
744
- "description": "The card border-radius. Defaults to `--jh-border-radius-400`."
746
+ "description": "The card border-radius. Defaults to `--jh-border-radius-200`."
745
747
  },
746
748
  {
747
- "name": "--jh-card-shadow",
748
- "description": "The card box-shadow. Defaults to `--jh-shadow-low`."
749
+ "name": "--jh-card-color-border",
750
+ "description": "The card border color. Defaults to `--jh-border-decorative-color`."
749
751
  },
750
752
  {
751
753
  "name": "--jh-card-media-aspect-ratio",
@@ -793,6 +795,12 @@
793
795
  "name": "jh-checkbox-group",
794
796
  "path": "./components/checkbox-group/checkbox-group.js",
795
797
  "attributes": [
798
+ {
799
+ "name": "disabled",
800
+ "description": "Disables the checkbox group and prevents all user interactions. May cause the group to be ignored by assistive technologies (AT).",
801
+ "type": "boolean",
802
+ "default": "false"
803
+ },
796
804
  {
797
805
  "name": "accessible-label",
798
806
  "description": "Sets an `aria-label` to assist screen reader users when no visible label is present.",
@@ -811,7 +819,7 @@
811
819
  {
812
820
  "name": "invalid",
813
821
  "description": "Sets an `aria-invalid` on the checkbox group to indicate the value supplied was invalid and displays `error-text` when set.",
814
- "type": "?Boolean",
822
+ "type": "?boolean",
815
823
  "default": "false"
816
824
  },
817
825
  {
@@ -822,7 +830,7 @@
822
830
  {
823
831
  "name": "required",
824
832
  "description": "Indicates a value is required.",
825
- "type": "?Boolean",
833
+ "type": "?boolean",
826
834
  "default": "false"
827
835
  },
828
836
  {
@@ -839,6 +847,13 @@
839
847
  }
840
848
  ],
841
849
  "properties": [
850
+ {
851
+ "name": "disabled",
852
+ "attribute": "disabled",
853
+ "description": "Disables the checkbox group and prevents all user interactions. May cause the group to be ignored by assistive technologies (AT).",
854
+ "type": "boolean",
855
+ "default": "false"
856
+ },
842
857
  {
843
858
  "name": "accessibleLabel",
844
859
  "attribute": "accessible-label",
@@ -861,7 +876,7 @@
861
876
  "name": "invalid",
862
877
  "attribute": "invalid",
863
878
  "description": "Sets an `aria-invalid` on the checkbox group to indicate the value supplied was invalid and displays `error-text` when set.",
864
- "type": "?Boolean",
879
+ "type": "?boolean",
865
880
  "default": "false"
866
881
  },
867
882
  {
@@ -874,7 +889,7 @@
874
889
  "name": "required",
875
890
  "attribute": "required",
876
891
  "description": "Indicates a value is required.",
877
- "type": "?Boolean",
892
+ "type": "?boolean",
878
893
  "default": "false"
879
894
  },
880
895
  {
@@ -903,6 +918,10 @@
903
918
  "name": "--jh-checkbox-group-label-color-text",
904
919
  "description": "The label text color. Defaults to `--jh-color-content-primary-enabled`."
905
920
  },
921
+ {
922
+ "name": "--jh-checkbox-group-opacity-disabled",
923
+ "description": "The opacity of the checkbox group when disabled. Defaults to `--jh-opacity-disabled`."
924
+ },
906
925
  {
907
926
  "name": "--jh-checkbox-group-required-color-text",
908
927
  "description": "The required indicator color.\nDefaults to `--jh-color-content-negative-enabled`."
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jack-henry/jh-elements",
3
3
  "description": "Jack Henry's design system web components.",
4
- "version": "2.0.0-beta.10",
4
+ "version": "2.0.0-beta.11",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/Banno/jack-henry-design-system.git"