@uh-design-system/component-library 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/cjs/component-library.cjs.js +2 -2
  2. package/dist/cjs/{controlUtils-041de0fd.js → controlUtils-8bf55ef0.js} +1 -1
  3. package/dist/cjs/{ds-accordion_3.cjs.entry.js → ds-accordion_5.cjs.entry.js} +122 -24
  4. package/dist/cjs/ds-checkbox-group.cjs.entry.js +39 -30
  5. package/dist/cjs/ds-checkbox.cjs.entry.js +33 -28
  6. package/dist/cjs/ds-input-validity.cjs.entry.js +4 -4
  7. package/dist/cjs/ds-link-with-arrow.cjs.entry.js +5 -6
  8. package/dist/cjs/ds-link.cjs.entry.js +5 -6
  9. package/dist/cjs/ds-radio-button-group.cjs.entry.js +111 -0
  10. package/dist/cjs/ds-radio-button.cjs.entry.js +150 -0
  11. package/dist/cjs/ds-text-input.cjs.entry.js +15 -10
  12. package/dist/cjs/{index-bf84b124.js → index-947af833.js} +36 -4
  13. package/dist/cjs/index.cjs.js +2 -2
  14. package/dist/cjs/loader.cjs.js +2 -2
  15. package/dist/cjs/{store-9bd20f3c.js → store-e8e87298.js} +1 -1
  16. package/dist/cjs/{attributes-5f5b58be.js → utils-3412cbed.js} +41 -2
  17. package/dist/collection/collection-manifest.json +4 -1
  18. package/dist/collection/components/00-foundations/icons/categories/actions.js +2 -0
  19. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +12 -12
  20. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +11 -13
  21. package/dist/collection/components/01-base-components/ds-button/ds-button.css +98 -87
  22. package/dist/collection/components/01-base-components/ds-button/ds-button.js +92 -6
  23. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +66 -0
  24. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +3 -0
  25. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +31 -20
  26. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +31 -47
  27. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +1 -1
  28. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +52 -26
  29. package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +74 -18
  30. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
  31. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.css +2 -2
  32. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +1 -1
  33. package/dist/collection/components/01-base-components/ds-link/ds-link.css +12 -12
  34. package/dist/collection/components/01-base-components/ds-link/ds-link.js +1 -1
  35. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +10 -10
  36. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +1 -1
  37. package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.css +116 -0
  38. package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.js +468 -0
  39. package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.js +70 -0
  40. package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.js +36 -0
  41. package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.css +31 -0
  42. package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.js +287 -0
  43. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.js +51 -0
  44. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.js +58 -0
  45. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.js +59 -0
  46. package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.css +309 -0
  47. package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.js +221 -0
  48. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.js +122 -0
  49. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.js +107 -0
  50. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.stories.js +59 -0
  51. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +38 -38
  52. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +12 -6
  53. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +2 -2
  54. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.css +1 -1
  55. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  56. package/dist/collection/utils/attributes/attributes.js +14 -3
  57. package/dist/collection/utils/button/buttonUtils.js +14 -0
  58. package/dist/collection/utils/colours/colourTypes.js +3 -3
  59. package/dist/collection/utils/colours/colourUtils.js +5 -3
  60. package/dist/collection/utils/controls/controlUtils.js +1 -1
  61. package/dist/collection/utils/spinner/spinnerUtils.js +20 -0
  62. package/dist/collection/utils/tests/testUtils.js +1 -0
  63. package/dist/collection/utils/typography/typographyUtils.js +3 -3
  64. package/dist/component-library/component-library.css +1 -1
  65. package/dist/component-library/component-library.esm.js +1 -1
  66. package/dist/component-library/controlUtils-c2ba44bd.js +1 -0
  67. package/dist/component-library/ds-accordion_5.entry.js +1 -0
  68. package/dist/component-library/ds-checkbox-group.entry.js +1 -1
  69. package/dist/component-library/ds-checkbox.entry.js +1 -1
  70. package/dist/component-library/ds-input-validity.entry.js +1 -1
  71. package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
  72. package/dist/component-library/ds-link.entry.js +1 -1
  73. package/dist/component-library/ds-radio-button-group.entry.js +1 -0
  74. package/dist/component-library/ds-radio-button.entry.js +1 -0
  75. package/dist/component-library/ds-text-input.entry.js +1 -1
  76. package/dist/component-library/index-84fd0ee9.js +2 -0
  77. package/dist/component-library/index.esm.js +1 -1
  78. package/dist/component-library/{store-b8d17c10.js → store-73a56075.js} +1 -1
  79. package/dist/component-library/{attributes-7d09be1b.js → utils-cfc536bc.js} +1 -1
  80. package/dist/components/attributes.js +15 -3
  81. package/dist/components/controlUtils.js +1 -1
  82. package/dist/components/ds-accordion.js +28 -18
  83. package/dist/components/ds-button2.js +51 -9
  84. package/dist/components/ds-checkbox-group.js +38 -27
  85. package/dist/components/ds-checkbox2.js +33 -26
  86. package/dist/components/ds-icon2.js +4 -1
  87. package/dist/components/ds-input-validity2.js +2 -2
  88. package/dist/components/ds-link-with-arrow.js +2 -2
  89. package/dist/components/ds-link.js +2 -2
  90. package/dist/components/ds-radio-button-group.d.ts +11 -0
  91. package/dist/components/ds-radio-button-group.js +147 -0
  92. package/dist/components/ds-radio-button.d.ts +11 -0
  93. package/dist/components/ds-radio-button.js +196 -0
  94. package/dist/components/ds-spinner.d.ts +11 -0
  95. package/dist/components/ds-spinner.js +6 -0
  96. package/dist/components/ds-spinner2.js +90 -0
  97. package/dist/components/ds-text-input.js +25 -13
  98. package/dist/components/ds-visually-hidden2.js +2 -2
  99. package/dist/components/index2.js +36 -5
  100. package/dist/esm/component-library.js +3 -3
  101. package/dist/esm/controlUtils-c2ba44bd.js +4 -0
  102. package/dist/esm/{ds-accordion_3.entry.js → ds-accordion_5.entry.js} +120 -24
  103. package/dist/esm/ds-checkbox-group.entry.js +38 -29
  104. package/dist/esm/ds-checkbox.entry.js +33 -28
  105. package/dist/esm/ds-input-validity.entry.js +4 -4
  106. package/dist/esm/ds-link-with-arrow.entry.js +4 -5
  107. package/dist/esm/ds-link.entry.js +4 -5
  108. package/dist/esm/ds-radio-button-group.entry.js +107 -0
  109. package/dist/esm/ds-radio-button.entry.js +146 -0
  110. package/dist/esm/ds-text-input.entry.js +15 -10
  111. package/dist/esm/{index-434995e1.js → index-84fd0ee9.js} +36 -5
  112. package/dist/esm/index.js +2 -2
  113. package/dist/esm/loader.js +3 -3
  114. package/dist/esm/{store-b8d17c10.js → store-73a56075.js} +1 -1
  115. package/dist/esm/{attributes-7d09be1b.js → utils-cfc536bc.js} +38 -3
  116. package/dist/styles/helpers.css +7 -0
  117. package/dist/styles/helpers.css.map +1 -0
  118. package/dist/styles/mixins/_breakpoints.scss +14 -0
  119. package/dist/styles/mixins/_focus.scss +28 -0
  120. package/dist/styles/mixins/_wrapper.scss +5 -0
  121. package/dist/styles/mixins/imports-default/_imports.scss +2 -0
  122. package/dist/styles/mixins/tokens/_breakpoints.scss +13 -0
  123. package/dist/styles/mixins/tokens/_semantic-colours.scss +75 -0
  124. package/dist/styles/mixins.scss +10 -0
  125. package/dist/styles/variables.css +168 -0
  126. package/dist/styles/variables.css.map +1 -0
  127. package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +5 -0
  128. package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +1 -0
  129. package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +6 -10
  130. package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +5 -4
  131. package/dist/types/components/01-base-components/ds-radio-button/ds-radio-button.d.ts +44 -0
  132. package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.d.ts +15 -0
  133. package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.d.ts +7 -0
  134. package/dist/types/components/01-base-components/ds-radio-button-group/ds-radio-button-group.d.ts +24 -0
  135. package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.d.ts +6 -0
  136. package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.d.ts +10 -0
  137. package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.d.ts +7 -0
  138. package/dist/types/components/01-base-components/ds-spinner/ds-spinner.d.ts +17 -0
  139. package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.d.ts +7 -0
  140. package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.d.ts +7 -0
  141. package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.stories.d.ts +7 -0
  142. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +2 -1
  143. package/dist/types/components.d.ts +135 -20
  144. package/dist/types/utils/attributes/attributes.d.ts +2 -1
  145. package/dist/types/utils/button/buttonUtils.d.ts +1 -0
  146. package/dist/types/utils/colours/colourTypes.d.ts +3 -3
  147. package/dist/types/utils/spinner/spinnerUtils.d.ts +1 -0
  148. package/dist/types/utils/tests/testUtils.d.ts +1 -0
  149. package/package.json +15 -15
  150. package/dist/cjs/ds-visually-hidden.cjs.entry.js +0 -20
  151. package/dist/cjs/utils-2ba5e075.js +0 -28
  152. package/dist/component-library/controlUtils-9ca4087b.js +0 -1
  153. package/dist/component-library/ds-accordion_3.entry.js +0 -1
  154. package/dist/component-library/ds-visually-hidden.entry.js +0 -1
  155. package/dist/component-library/index-434995e1.js +0 -2
  156. package/dist/component-library/utils-5daa5bc0.js +0 -1
  157. package/dist/esm/controlUtils-9ca4087b.js +0 -4
  158. package/dist/esm/ds-visually-hidden.entry.js +0 -16
  159. package/dist/esm/utils-5daa5bc0.js +0 -24
@@ -0,0 +1,107 @@
1
+ import { html } from "lit";
2
+ import { litTemplateResultToString } from "../../../../utils/utils";
3
+ const meta = {
4
+ title: 'Base Components/Spinner/Features',
5
+ component: 'ds-spinner',
6
+ };
7
+ export default meta;
8
+ const spinnerColorsDom = html `
9
+ <div class="ds-sp-container">
10
+ <div class="ds-sp-item">
11
+ <span>Blue</span>
12
+ <ds-spinner spinner-color="blue" size="large"></ds-spinner>
13
+ </div>
14
+ <div class="ds-sp-item">
15
+ <span>Black</span>
16
+ <ds-spinner spinner-color="black" size="large"></ds-spinner>
17
+ </div>
18
+ <div class="ds-sp-item white">
19
+ <span>White</span>
20
+ <ds-spinner spinner-color="white" size="large"></ds-spinner>
21
+ </div>
22
+ </div>
23
+ `;
24
+ export const Colours = {
25
+ parameters: {
26
+ docs: {
27
+ source: {
28
+ code: litTemplateResultToString(spinnerColorsDom),
29
+ },
30
+ },
31
+ },
32
+ render: () => html `
33
+ <style>
34
+ .ds-sp-container {
35
+ display: flex;
36
+ gap: 1rem;
37
+ width: 100%;
38
+ }
39
+ .ds-sp-item {
40
+ align-items: center;
41
+ display: flex;
42
+ flex-direction: column;
43
+ gap: .5rem;
44
+ padding: 0.5rem;
45
+ }
46
+ .white {
47
+ color: #FFF;
48
+ background: #000;
49
+ }
50
+ </style>
51
+ ${spinnerColorsDom}
52
+ `
53
+ };
54
+ const spinnerSizesDom = html `
55
+ <div class="ds-sp-container">
56
+ <div class="ds-sp-item">
57
+ <span>Small</span>
58
+ <ds-spinner size="small"></ds-spinner>
59
+ </div>
60
+ <div class="ds-sp-item">
61
+ <span>Medium</span>
62
+ <ds-spinner size="medium"></ds-spinner>
63
+ </div>
64
+ <div class="ds-sp-item">
65
+ <span>Large</span>
66
+ <ds-spinner size="large"></ds-spinner>
67
+ </div>
68
+ <div class="ds-sp-item">
69
+ <span>xLarge</span>
70
+ <ds-spinner size="xLarge"></ds-spinner>
71
+ </div>
72
+ <div class="ds-sp-item">
73
+ <span>2xLarge</span>
74
+ <ds-spinner size="2xLarge"></ds-spinner>
75
+ </div>
76
+ </div>
77
+ `;
78
+ export const Sizes = {
79
+ parameters: {
80
+ docs: {
81
+ source: {
82
+ code: litTemplateResultToString(spinnerSizesDom),
83
+ },
84
+ },
85
+ },
86
+ render: () => html `
87
+ <style>
88
+ .ds-sp-container {
89
+ display: flex;
90
+ gap: 1rem;
91
+ width: 100%;
92
+ }
93
+ .ds-sp-item {
94
+ align-items: center;
95
+ display: flex;
96
+ flex-direction: column;
97
+ gap: .5rem;
98
+ padding: 0.5rem;
99
+ }
100
+ .white {
101
+ color: #FFF;
102
+ background: #000;
103
+ }
104
+ </style>
105
+ ${spinnerSizesDom}
106
+ `
107
+ };
@@ -0,0 +1,59 @@
1
+ const meta = {
2
+ title: 'Base Components/Spinner',
3
+ component: 'ds-spinner',
4
+ argTypes: {
5
+ text: { control: 'text' },
6
+ size: {
7
+ control: 'select',
8
+ options: [
9
+ 'small',
10
+ 'medium',
11
+ 'large',
12
+ 'xLarge',
13
+ '2xLarge',
14
+ ],
15
+ table: {
16
+ type: { summary: 'select' },
17
+ defaultValue: { summary: 'medium' },
18
+ },
19
+ },
20
+ spinnerTextPosition: {
21
+ control: 'select',
22
+ options: ['below', 'side'],
23
+ table: {
24
+ type: { summary: 'select' },
25
+ defaultValue: { summary: 'below' },
26
+ },
27
+ },
28
+ spinnerColor: {
29
+ control: 'select',
30
+ options: ['blue', 'black', 'white'],
31
+ table: {
32
+ type: { summary: 'select' },
33
+ defaultValue: { summary: 'blue' },
34
+ },
35
+ },
36
+ hiddenAssistiveText: {
37
+ name: 'Hidden assistive text',
38
+ control: 'text',
39
+ },
40
+ useRoleAlert: {
41
+ name: 'Use role="alert"',
42
+ control: 'boolean',
43
+ },
44
+ useAriaLive: {
45
+ name: 'Use aria-live="polite"',
46
+ control: 'boolean',
47
+ }
48
+ }
49
+ };
50
+ export default meta;
51
+ export const Default = {};
52
+ export const Playground = {
53
+ args: {
54
+ text: 'Loading...',
55
+ spinnerTextPosition: 'below',
56
+ size: 'medium',
57
+ spinnerColor: 'blue',
58
+ },
59
+ };
@@ -6,7 +6,7 @@
6
6
  --ds-breakpoint-xLarge: 90rem;
7
7
  }
8
8
 
9
- .no-style-leak *, :host * {
9
+ .dsNoStyleLeak *, :host * {
10
10
  all: unset;
11
11
  box-sizing: border-box;
12
12
  display: block;
@@ -31,7 +31,7 @@
31
31
  font-weight: var(--ds-fontWeight-semibold);
32
32
  letter-spacing: var(--ds-letterSpacing-wide);
33
33
  line-height: var(--ds-lineHeight-large);
34
- color: var(--ds-textColor-default);
34
+ color: var(--ds-palette-black-95);
35
35
  }
36
36
  .ds-input--label-container small {
37
37
  font-family: var(--ds-fontFamily-body);
@@ -41,7 +41,7 @@
41
41
  line-height: var(--ds-lineHeight-large);
42
42
  display: block;
43
43
  margin-block-start: var(--ds-spacing-3xSmall);
44
- color: var(--ds-textColor-secondary);
44
+ color: var(--ds-palette-black-70);
45
45
  }
46
46
  .ds-input--container {
47
47
  box-sizing: border-box;
@@ -51,74 +51,74 @@
51
51
  align-items: center;
52
52
  border-width: var(--ds-borderWidth-thin);
53
53
  border-style: solid;
54
- border-color: var(--ds-borderColor-default);
54
+ border-color: var(--ds-palette-black-50);
55
55
  padding-inline: var(--ds-spacing-xSmall);
56
56
  }
57
57
  .ds-input--container:focus-visible {
58
- box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
59
- outline-color: var(--ds-borderColor-black);
60
- outline-offset: var(--ds-borderWidth-thin);
58
+ box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-palette-white);
59
+ outline-color: var(--ds-palette-black-95);
60
+ outline-offset: calc(var(--ds-borderWidth-thin) * 1);
61
61
  outline-style: solid;
62
62
  outline-width: var(--ds-borderWidth-thin);
63
63
  }
64
64
  .ds-input--container:focus-within {
65
- box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
66
- outline-color: var(--ds-borderColor-black);
67
- outline-offset: var(--ds-borderWidth-thin);
65
+ box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-palette-white);
66
+ outline-color: var(--ds-palette-black-95);
67
+ outline-offset: calc(var(--ds-borderWidth-thin) * 1);
68
68
  outline-style: solid;
69
69
  outline-width: var(--ds-borderWidth-thin);
70
70
  }
71
71
  .ds-input--container.invalid {
72
- background-color: var(--ds-bgColor-danger);
73
- border-color: var(--ds-borderColor-danger);
72
+ background-color: var(--ds-palette-red-05);
73
+ border-color: var(--ds-palette-red-50);
74
74
  }
75
75
  .ds-input--container.invalid:hover:not(.ds-input--container.invalid:focus-within) {
76
- background-color: var(--ds-bgColor-danger-hover);
77
- border-color: var(--ds-borderColor-danger);
76
+ background-color: var(--ds-palette-red-10);
77
+ border-color: var(--ds-palette-red-50);
78
78
  }
79
79
  .ds-input--container.invalid.active {
80
- background-color: var(--ds-bgColor-danger-active);
81
- border-color: var(--ds-borderColor-danger);
80
+ background-color: var(--ds-palette-red-20);
81
+ border-color: var(--ds-palette-red-50);
82
82
  }
83
83
  .ds-input--container.valid {
84
- background-color: var(--ds-bgColor-success);
85
- border-color: var(--ds-borderColor-success);
84
+ background-color: var(--ds-palette-green-05);
85
+ border-color: var(--ds-palette-green-50);
86
86
  }
87
87
  .ds-input--container.valid:hover:not(.ds-input--container.valid:focus-within) {
88
- background-color: var(--ds-bgColor-success-hover);
89
- border-color: var(--ds-borderColor-success);
88
+ background-color: var(--ds-palette-green-10);
89
+ border-color: var(--ds-palette-green-50);
90
90
  }
91
91
  .ds-input--container.valid.active {
92
- background-color: var(--ds-bgColor-success-active);
93
- border-color: var(--ds-borderColor-success);
92
+ background-color: var(--ds-palette-green-20);
93
+ border-color: var(--ds-palette-green-50);
94
94
  }
95
95
  .ds-input--container.readonly, .ds-input--container.disabled {
96
- background-color: var(--ds-bgColor-disabled-onLight);
97
- border-color: var(--ds-borderColor-disabled-onLight);
96
+ background-color: var(--ds-overlay-black-10);
97
+ border-color: var(--ds-overlay-black-15);
98
98
  }
99
99
  .ds-input--container:has(input:active) {
100
100
  outline: none;
101
101
  }
102
102
  .ds-input--container:has(input:active):not:has(input:disabled, input:readonly) {
103
- border-color: var(--ds-borderColor-default);
103
+ border-color: var(--ds-palette-black-50);
104
104
  }
105
105
  .ds-input--container.active:not(.ds-input--container.disabled, .ds-input--container.readonly, .ds-input--container.invalid, .ds-input--container.valid) {
106
- border-color: var(--ds-borderColor-default);
107
- background-color: var(--ds-bgColor-white-active);
106
+ border-color: var(--ds-palette-black-50);
107
+ background-color: var(--ds-palette-black-20);
108
108
  }
109
109
  .ds-input--container:hover:not(.ds-input--container.disabled, .ds-input--container.readonly, .ds-input--container.active, .ds-input--container.invalid, .ds-input--container.valid, .ds-input--container:focus-within) {
110
- border-color: var(--ds-borderColor-default);
111
- background-color: var(--ds-bgColor-white-hover);
110
+ border-color: var(--ds-palette-black-50);
111
+ background-color: var(--ds-palette-black-10);
112
112
  }
113
113
  .ds-input--container:focus-within:not(.ds-input--container:focus-within.invalid, .ds-input--container:focus-within.valid, .ds-input--container:focus-within.readonly) {
114
- border-color: var(--ds-borderColor-primary);
114
+ border-color: var(--ds-palette-mainBlue-70);
115
115
  }
116
116
  .ds-input--container:focus-within * > ds-button.suffix > button:focus-visible {
117
117
  background-clip: padding-box;
118
118
  outline-offset: -5px;
119
119
  box-shadow: none;
120
120
  height: var(--ds-spacing-xLarge);
121
- background-color: var(--ds-bgColor-transparent-onLight-hover);
121
+ background-color: var(--ds-overlay-black-10);
122
122
  }
123
123
  .ds-input--container > input {
124
124
  font-family: var(--ds-fontFamily-body);
@@ -132,15 +132,15 @@
132
132
  flex-grow: 1;
133
133
  height: var(--ds-spacing-xLarge);
134
134
  line-height: var(--ds-fontSize-24);
135
- color: var(--ds-textColor-default);
135
+ color: var(--ds-palette-black-95);
136
136
  border: none;
137
137
  padding-block: var(--ds-spacing-4xSmall);
138
138
  }
139
139
  .ds-input--container > input:disabled {
140
- color: var(--ds-textColor-disabled-onLight);
140
+ color: var(--ds-palette-black-40);
141
141
  }
142
142
  .ds-input--container > input:disabled::placeholder {
143
- color: var(--ds-textColor-disabled-onLight);
143
+ color: var(--ds-palette-black-40);
144
144
  }
145
145
  .ds-input--container > input::placeholder {
146
146
  font-family: var(--ds-fontFamily-body);
@@ -148,7 +148,7 @@
148
148
  font-weight: var(--ds-fontWeight-regular);
149
149
  letter-spacing: var(--ds-letterSpacing-wide);
150
150
  line-height: var(--ds-lineHeight-large);
151
- color: var(--ds-textColor-secondary);
151
+ color: var(--ds-palette-black-70);
152
152
  }
153
153
  .ds-input--container > input:focus {
154
154
  outline: none;
@@ -175,7 +175,7 @@
175
175
  }
176
176
  .ds-input--container ds-icon.prefix, .ds-input--container ::slotted([slot=prefix]) {
177
177
  height: 1.5rem;
178
- color: var(--ds-textColor-default);
178
+ color: var(--ds-palette-black-95);
179
179
  }
180
180
  .ds-input--container ds-button.suffix {
181
181
  margin-top: calc(var(--ds-spacing-3xSmall) * -1);
@@ -205,9 +205,9 @@
205
205
  }
206
206
 
207
207
  .error-text--container {
208
- color: var(--ds-textColor-danger);
208
+ color: var(--ds-palette-red-70);
209
209
  }
210
210
 
211
211
  .success-text--container {
212
- color: var(--ds-textColor-success);
212
+ color: var(--ds-palette-green-70);
213
213
  }
@@ -3,6 +3,7 @@ import classNames from "classnames";
3
3
  import { getOptionalText, getRequiredText } from "../../../utils/controls/controlUtils";
4
4
  import { isValidation } from "../../../store";
5
5
  import { idGenerator, getAriaLabel } from "../../../utils/utils";
6
+ import { inheritAttributes } from "../../../utils/attributes/attributes";
6
7
  const INPUT_TYPE_ICONS_MAP = {
7
8
  search: 'search',
8
9
  };
@@ -12,6 +13,7 @@ const INPUT_TYPE_ACTION_BUTTON_ICON_MAP = {
12
13
  };
13
14
  const inputIdGenerator = idGenerator('ds-input');
14
15
  export class DsTextInput {
16
+ inheritedAttributes = {};
15
17
  suffixButtonElement;
16
18
  inputElement;
17
19
  assistiveTextId;
@@ -48,7 +50,7 @@ export class DsTextInput {
48
50
  icon = '';
49
51
  type = 'text';
50
52
  ariaLabel;
51
- ariaLabelledBy;
53
+ ariaLabelledby;
52
54
  ariaDescribedby;
53
55
  hasFocus = false;
54
56
  clearButtonVisible = false;
@@ -81,6 +83,9 @@ export class DsTextInput {
81
83
  return this.label;
82
84
  };
83
85
  componentWillLoad() {
86
+ this.inheritedAttributes = {
87
+ ...inheritAttributes(this, this.el),
88
+ };
84
89
  this.setIds();
85
90
  this.hasPrefixSlot = !!this.el.querySelector('[slot="prefix"]');
86
91
  this.hasSuffixSlot = !!this.el.querySelector('[slot="suffix"]');
@@ -109,6 +114,7 @@ export class DsTextInput {
109
114
  return this.togglePasswordVisibility();
110
115
  case 'search':
111
116
  this.clearInput();
117
+ return;
112
118
  default:
113
119
  return;
114
120
  }
@@ -147,18 +153,18 @@ export class DsTextInput {
147
153
  }
148
154
  render() {
149
155
  const inputType = this.type === 'password' && this.passwordInputVisible ? 'text' : this.type;
150
- return (h(Fragment, { key: 'efb783f742bb82b01fd6807a628eb693666a819b' }, h("div", { key: 'dde260b136af4b68de1fa15928529f5e57f54c3a', class: "ds-input--label-container" }, h("slot", { key: 'e7ba428a8b8202c9b3e4d9a9c6d4257b0b48d83a', name: "label" }, h("label", { key: '1f28c5fd53249068de50c6d0ea0aa88ccf65a1ec', htmlFor: this.identifier }, this.getLabelText())), h("slot", { key: 'e3c1ea925cfc7f9599ee651da0aeaab98fa806bb', name: "help-text" }, h("small", { key: '671ab99029e2775d964feb012beb8a20912be5e3', id: this.assistiveTextId }, this.assistiveText), h("ds-visually-hidden", { key: '8eb744be9b95ddceb1dd5bed0274d29a26e7ec1d', id: this.visuallyHiddenAssistiveTextId }, this.hiddenAssistiveText))), h("div", { key: 'b7fa7067a52d176b810eb88777423adf50dfd8b9', onMouseDown: () => (this.inputActive = true), onMouseUp: () => (this.inputActive = false), onClick: e => this.handleInputContainerClick(e), class: classNames('ds-input--container', {
156
+ return (h(Fragment, { key: '9706a2c55f36b1888b7287344d91ddd10f96201d' }, h("div", { key: '35eafa8a92261bfdb4e0ed8325d98be85665eca6', class: "ds-input--label-container" }, h("slot", { key: '50e67a545686807337bda0c607888f6bf9bf9d58', name: "label" }, h("label", { key: '87ce740880e1fb5e966607a05af463a40655410d', htmlFor: this.identifier }, this.getLabelText())), h("slot", { key: 'f9c002b843341a3934df96611176fe8178c49c0d', name: "help-text" }, h("small", { key: '2e780ce79e6e0720dee0360fe7e11a4742a26fca', id: this.assistiveTextId }, this.assistiveText), h("ds-visually-hidden", { key: '63d47cc268aaf3128799f907144048411a0e9be5', id: this.visuallyHiddenAssistiveTextId }, this.hiddenAssistiveText))), h("div", { key: 'a060e806ef56c1b232ad2eacb5a1b675b01891f7', onMouseDown: () => (this.inputActive = true), onMouseUp: () => (this.inputActive = false), onClick: e => this.handleInputContainerClick(e), class: classNames('ds-input--container', {
151
157
  disabled: this.disabled,
152
158
  readonly: this.readonly,
153
159
  valid: !!this.successText,
154
- invalid: !!this.errorText,
160
+ invalid: !!this.validationMessage,
155
161
  focus: this.hasFocus,
156
162
  active: !!this.inputActive,
157
- }) }, this.renderPrefixContent(), h("input", { key: 'f619722a0c088fbd99d851b4cc49a220538da0ae', ref: e => (this.inputElement = e), id: this.identifier, name: this.name, "aria-label": getAriaLabel(this.label, this.ariaLabel), "aria-labelledby": this.ariaLabelledBy, "aria-describedby": this.ariaDescribedby ||
163
+ }) }, this.renderPrefixContent(), h("input", { key: 'cb27157fde11dcb0fc305423fbc94fcafdc34b1c', ref: e => (this.inputElement = e), id: this.identifier, name: this.name, "aria-label": getAriaLabel(this.label, this.ariaLabel), "aria-labelledby": this.ariaLabelledby, "aria-describedby": this.ariaDescribedby ||
158
164
  classNames(this.assistiveTextId, this.visuallyHiddenAssistiveTextId, {
159
165
  [this.errorTextId]: Boolean(this.validationMessage),
160
166
  [this.successTextId]: Boolean(this.successText),
161
- }), "aria-invalid": Boolean(this.validationMessage) ? 'true' : 'false', disabled: this.disabled, required: this.required, readonly: this.readonly, value: this.value, type: inputType, min: this.min, max: this.max, maxlength: this.maxlength, pattern: this.pattern, placeholder: this.placeholder, autocomplete: this.autocomplete, onInput: this.handleInput, onFocus: () => (this.hasFocus = true), onBlur: this.handleBlur }), this.renderSuffixContent()), h("slot", { key: 'b70c638ad0de13e0bfa1c2f0ec366e748ab8e4e2', name: "input-validity" }, h("ds-input-validity", { key: '7c1da6ba8d42add8de43f4926c24c8a64bbe32e2', id: this.errorTextId, text: this.validationMessage, type: "error", role: "alert" }), h("ds-input-validity", { key: '46258021c17e3461ea4a0c2ae720fb44305550c5', id: this.successTextId, text: this.successText, type: "success", role: "status" }))));
167
+ }), "aria-invalid": this.validationMessage ? 'true' : 'false', disabled: this.disabled, required: this.required, readonly: this.readonly, value: this.value, type: inputType, min: this.min, max: this.max, maxlength: this.maxlength, pattern: this.pattern, placeholder: this.placeholder, autocomplete: this.autocomplete, onInput: this.handleInput, onFocus: () => (this.hasFocus = true), onBlur: this.handleBlur, ...this.inheritedAttributes }), this.renderSuffixContent()), h("slot", { key: '8e961d353346bd088e6f5f6d4efa9508598a2596', name: "input-validity" }, h("ds-input-validity", { key: 'd784f945dec403f64721a71fba72ecc1f836e844', id: this.errorTextId, text: this.validationMessage, type: "error", role: "alert" }), h("ds-input-validity", { key: 'f343fc9fdbc4c4f33d345921a23f89fcb27b8a18', id: this.successTextId, text: this.successText, type: "success", role: "status" }))));
162
168
  }
163
169
  static get is() { return "ds-text-input"; }
164
170
  static get encapsulation() { return "scoped"; }
@@ -659,7 +665,7 @@ export class DsTextInput {
659
665
  "attribute": "aria-label",
660
666
  "reflect": false
661
667
  },
662
- "ariaLabelledBy": {
668
+ "ariaLabelledby": {
663
669
  "type": "string",
664
670
  "mutable": false,
665
671
  "complexType": {
@@ -41,7 +41,7 @@ export const Playground = {
41
41
  options: textInputTypes,
42
42
  },
43
43
  ariaLabel: { name: 'aria-label', control: 'text' },
44
- ariaLabelledBy: { name: 'aria-labelledby', control: 'text' },
44
+ ariaLabelledby: { name: 'aria-labelledby', control: 'text' },
45
45
  ariaDescribedby: { name: 'aria-describedby', control: 'text' },
46
46
  autocomplete: { control: 'text' },
47
47
  },
@@ -66,7 +66,7 @@ export const Playground = {
66
66
  type: 'text',
67
67
  autocomplete: '',
68
68
  ariaLabel: '',
69
- ariaLabelledBy: '',
69
+ ariaLabelledby: '',
70
70
  ariaDescribedby: '',
71
71
  }
72
72
  };
@@ -1,4 +1,4 @@
1
- :host {
1
+ .ds-visually-hidden {
2
2
  clip: rect(0 0 0 0);
3
3
  clip-path: inset(50%);
4
4
  height: 1px;
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  export class DsVisuallyHidden {
3
3
  render() {
4
- return (h("slot", { key: '083eaed9210a85360479b367769c8904a6089f64' }));
4
+ return (h("div", { key: 'a4816a680d41ece91ad716ee0cc52a8c777990a4', class: "ds-visually-hidden" }, h("slot", { key: 'd5444d14b4fdab28a414ab687ca24b9eb14e1ac4' })));
5
5
  }
6
6
  static get is() { return "ds-visually-hidden"; }
7
7
  static get encapsulation() { return "shadow"; }
@@ -1,4 +1,5 @@
1
- export const inheritAttributes = (el, attributes = []) => {
1
+ const kebabToCamelCase = (str) => str.replace(/-./g, x => x[1].toUpperCase());
2
+ export const inheritSpecifiedAttributes = (el, attributes = []) => {
2
3
  const attributeObject = {};
3
4
  attributes.forEach(attr => {
4
5
  if (el.hasAttribute(attr)) {
@@ -64,12 +65,22 @@ export const ariaAttributes = [
64
65
  'aria-valuenow',
65
66
  'aria-valuetext',
66
67
  ];
67
- const kebabToCamelCase = (attr) => attr.replace(/-./g, x => x[1].toUpperCase());
68
68
  export const getAriaAttributeArgTypes = (attrs) => attrs.reduce((acc, curr) => ((acc[kebabToCamelCase(curr)] = { control: 'text', name: curr }), acc), {});
69
69
  export const inheritAriaAttributes = (el, ignoreList) => {
70
70
  let attributesToInherit = [...ariaAttributes];
71
71
  if (ignoreList && ignoreList.length > 0) {
72
72
  attributesToInherit = attributesToInherit.filter(attr => !ignoreList.includes(attr));
73
73
  }
74
- return inheritAttributes(el, attributesToInherit);
74
+ return inheritSpecifiedAttributes(el, attributesToInherit);
75
+ };
76
+ export const inheritAttributes = (component, elem) => {
77
+ const attributesToIgnore = new Set(['class', 'style', ...ariaAttributes]);
78
+ const propsToIgnore = new Set(Object.keys(component));
79
+ const attributes = {};
80
+ for (const attr of elem.attributes) {
81
+ if (!propsToIgnore.has(kebabToCamelCase(attr.name)) && !attributesToIgnore.has(attr.name)) {
82
+ attributes[attr.name] = attr.value;
83
+ }
84
+ }
85
+ return attributes;
75
86
  };
@@ -0,0 +1,14 @@
1
+ export function handleButtonLoading(buttonElement, originalValue, loadValue, loadingDuration = 3000) {
2
+ if (buttonElement.getAttribute('is-loading') === 'true')
3
+ return;
4
+ const originalIsLoading = buttonElement.getAttribute('is-loading') || 'false';
5
+ const originalAriaDisabled = buttonElement.getAttribute('aria-disabled') || 'false';
6
+ buttonElement.setAttribute('value', loadValue);
7
+ buttonElement.setAttribute('is-loading', 'true');
8
+ buttonElement.setAttribute('aria-disabled', 'true');
9
+ setTimeout(() => {
10
+ buttonElement.setAttribute('value', originalValue);
11
+ buttonElement.setAttribute('is-loading', originalIsLoading);
12
+ buttonElement.setAttribute('aria-disabled', originalAriaDisabled);
13
+ }, loadingDuration);
14
+ }
@@ -12,7 +12,7 @@ export const opaque = {
12
12
  '--ds-overlay-white': 'Opaque overlays|white',
13
13
  };
14
14
  export const semantic = {
15
- '--ds-textColor': 'Semantic colours|text',
16
- '--ds-bgColor': 'Semantic colours|background',
17
- '--ds-borderColor': 'Semantic colours|border',
15
+ '$dsTextColor': 'Semantic colours|text',
16
+ '$dsBgColor': 'Semantic colours|background',
17
+ '$dsBorderColor': 'Semantic colours|border',
18
18
  };
@@ -22,17 +22,18 @@ const getStyles = (colourType) => {
22
22
  }
23
23
  };
24
24
  export const getColourVariables = (colourType) => {
25
- const cssVariables = Array.from(getStyles(colourType).matchAll(/--[\w-]+:\s*[^;]+;/g)).map(match => match[0]);
25
+ const variablePattern = colourType === 'semantic' ? /\$[\w-]+:\s*[^;]+;/g : /--[\w-]+:\s*[^;]+;/g;
26
+ const cssVariables = Array.from(getStyles(colourType).matchAll(variablePattern)).map(match => match[0]);
26
27
  const categories = getCategories(colourType);
27
28
  return cssVariables
28
29
  .map(variable => {
29
30
  const [name, value] = variable.split(':').map(part => part.trim().replace(';', ''));
30
- const cleanName = name.replace(/^--/, '');
31
+ const cleanName = name.replace(/^(\$|--)/, '');
31
32
  const categoryKey = Object.keys(categories).find(key => name.startsWith(key));
32
33
  if (categoryKey) {
33
34
  return { name: cleanName, variable, value, category: categories[categoryKey] };
34
35
  }
35
- return null;
36
+ return { name: cleanName, variable, value, category: 'Other' };
36
37
  })
37
38
  .filter(variable => variable !== null);
38
39
  };
@@ -42,6 +43,7 @@ const createColourBox = (name, hex) => {
42
43
  const colourSwatch = document.createElement('div');
43
44
  colourSwatch.className = 'colour-swatch';
44
45
  colourSwatch.style.backgroundColor = hex;
46
+ colourSwatch.setAttribute('title', `${name}: ${hex}`);
45
47
  const colourInfo = document.createElement('div');
46
48
  colourInfo.className = 'colour-info';
47
49
  colourInfo.innerHTML = `${name} <br /> <code>${hex}</code>`;
@@ -1,2 +1,2 @@
1
- export const getOptionalText = (text, optionalText) => [text, Boolean(optionalText) ? optionalText : '(optional)'].join(' ');
1
+ export const getOptionalText = (text, optionalText) => [text, optionalText || '(optional)'].join(' ');
2
2
  export const getRequiredText = (text) => [text, '*'].join(' ');
@@ -0,0 +1,20 @@
1
+ export function toggleSpinnerLoad(buttonElement, spinnerElement, results, buttonOriginalValue, loadValue, loadingDuration = 3000) {
2
+ if (buttonElement.getAttribute('is-loading') === 'true')
3
+ return;
4
+ console.log(buttonElement, spinnerElement, results);
5
+ const originalIsLoading = buttonElement.getAttribute('is-loading') || 'false';
6
+ const originalAriaDisabled = buttonElement.getAttribute('aria-disabled') || 'false';
7
+ buttonElement.setAttribute('value', loadValue);
8
+ buttonElement.setAttribute('is-loading', 'true');
9
+ buttonElement.setAttribute('aria-disabled', 'true');
10
+ results.classList.add('ds-sb-hidden');
11
+ spinnerElement.classList.remove('ds-sb-hidden');
12
+ setTimeout(() => {
13
+ buttonElement.setAttribute('value', buttonOriginalValue);
14
+ buttonElement.setAttribute('is-loading', originalIsLoading);
15
+ buttonElement.setAttribute('aria-disabled', originalAriaDisabled);
16
+ results.innerHTML = 'Sended';
17
+ results.classList.remove('ds-sb-hidden');
18
+ spinnerElement.classList.add('ds-sb-hidden');
19
+ }, loadingDuration);
20
+ }
@@ -29,3 +29,4 @@ export const addMockEventListener = (container, selector, eventName) => {
29
29
  elem.addEventListener(eventName, mockFunction);
30
30
  return mockFunction;
31
31
  };
32
+ export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -85,11 +85,11 @@ export const createCategorySection = (category, fonts, renderedCategories) => {
85
85
  };
86
86
  export const getCSSClasses = (prefix) => {
87
87
  const stylesheets = Array.from(document.styleSheets);
88
- let classNames = [];
89
- for (let sheet of stylesheets) {
88
+ const classNames = [];
89
+ for (const sheet of stylesheets) {
90
90
  try {
91
91
  const rules = Array.from(sheet.cssRules);
92
- for (let rule of rules) {
92
+ for (const rule of rules) {
93
93
  if (rule.selectorText) {
94
94
  const selector = rule.selectorText;
95
95
  if (selector.startsWith(`.${prefix}`)) {