@uh-design-system/component-library 0.1.0 → 0.2.0-alpha.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.
Files changed (185) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/app-globals-3a1e7e63.js +0 -2
  3. package/dist/cjs/ds-accordion_2.cjs.entry.js +930 -0
  4. package/dist/cjs/ds-button_2.cjs.entry.js +196 -0
  5. package/dist/cjs/ds-text-input.cjs.entry.js +137 -0
  6. package/dist/cjs/index-5a88e57b.js +82 -0
  7. package/dist/cjs/{index-eaf5876c.js → index-f7420801.js} +652 -149
  8. package/dist/cjs/index.cjs.js +0 -9
  9. package/dist/cjs/loader.cjs.js +2 -4
  10. package/dist/cjs/uh-component-library.cjs.js +3 -5
  11. package/dist/collection/collection-manifest.json +6 -2
  12. package/dist/collection/components/00-foundations/borders/borders.stories.js +7 -8
  13. package/dist/collection/components/00-foundations/breakpoints/breakpoints.stories.js +20 -0
  14. package/dist/collection/components/00-foundations/colours/colours.stories.js +9 -17
  15. package/dist/collection/components/00-foundations/icons/categories/actions.js +110 -0
  16. package/dist/collection/components/00-foundations/icons/categories/arrows.js +64 -0
  17. package/dist/collection/components/00-foundations/icons/categories/custom.js +10 -0
  18. package/dist/collection/components/00-foundations/icons/categories/information.js +94 -0
  19. package/dist/collection/components/00-foundations/icons/categories/media.js +76 -0
  20. package/dist/collection/components/00-foundations/icons/categories/navigation.js +50 -0
  21. package/dist/collection/components/00-foundations/icons/categories/notifications.js +64 -0
  22. package/dist/collection/components/00-foundations/icons/categories/text.js +18 -0
  23. package/dist/collection/components/00-foundations/icons/categories/users.js +52 -0
  24. package/dist/collection/components/00-foundations/icons/iconList.js +18 -293
  25. package/dist/collection/components/00-foundations/icons/icons.stories.js +0 -1
  26. package/dist/collection/components/00-foundations/spacing/spacing.stories.js +2 -3
  27. package/dist/collection/components/00-foundations/typography/typography.stories.js +52 -3
  28. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +130 -0
  29. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +217 -0
  30. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.js +43 -0
  31. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.js +79 -0
  32. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +96 -0
  33. package/dist/collection/components/01-base-components/ds-button/ds-button.css +238 -0
  34. package/dist/collection/components/01-base-components/ds-button/ds-button.js +294 -0
  35. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +28 -0
  36. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +77 -0
  37. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +79 -0
  38. package/dist/collection/components/01-base-components/ds-icon/ds-icon.css +1 -1
  39. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +18 -6
  40. package/dist/collection/components/01-base-components/ds-icon/ds-icon.stories.js +1 -2
  41. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +186 -0
  42. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.examples.stories.js +24 -0
  43. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.features.stories.js +126 -0
  44. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +665 -0
  45. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.stories.js +73 -0
  46. package/dist/collection/components/01-base-components/ds-text-input/utils.js +16 -0
  47. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.css +9 -0
  48. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +18 -0
  49. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.stories.js +9 -0
  50. package/dist/collection/index.js +1 -11
  51. package/dist/collection/utils/attributes.js +107 -0
  52. package/dist/collection/utils/borders/borderUtils.js +24 -4
  53. package/dist/collection/utils/breakpoints/breakpointsUtils.js +58 -0
  54. package/dist/collection/utils/colours/colourTypes.js +19 -0
  55. package/dist/collection/utils/colours/colourUtils.js +67 -47
  56. package/dist/collection/utils/spacing/spacingUtils.js +21 -9
  57. package/dist/collection/utils/tests/testUtils.js +21 -6
  58. package/dist/collection/utils/typography/typographyUtils.js +0 -1
  59. package/dist/collection/utils/utils.js +48 -3
  60. package/dist/components/ds-accordion.d.ts +11 -0
  61. package/dist/components/ds-accordion.js +96 -0
  62. package/dist/components/ds-button.d.ts +11 -0
  63. package/dist/components/ds-button.js +6 -0
  64. package/dist/components/ds-button2.js +209 -0
  65. package/dist/components/ds-icon.js +1 -540
  66. package/dist/components/ds-icon2.js +890 -0
  67. package/dist/components/ds-text-input.d.ts +11 -0
  68. package/dist/components/ds-text-input.js +200 -0
  69. package/dist/components/ds-visually-hidden.d.ts +11 -0
  70. package/dist/components/ds-visually-hidden.js +6 -0
  71. package/dist/components/ds-visually-hidden2.js +31 -0
  72. package/dist/components/index.js +1 -9
  73. package/dist/components/{p-dcfb6eb2.js → index2.js} +616 -146
  74. package/dist/components/index3.js +80 -0
  75. package/dist/esm/app-globals-0f993ce5.js +0 -2
  76. package/dist/esm/ds-accordion_2.entry.js +925 -0
  77. package/dist/esm/ds-button_2.entry.js +191 -0
  78. package/dist/esm/ds-text-input.entry.js +133 -0
  79. package/dist/esm/index-097075ad.js +80 -0
  80. package/dist/esm/{index-1586ada2.js → index-1d0a6586.js} +652 -150
  81. package/dist/esm/index.js +0 -6
  82. package/dist/esm/loader.js +3 -5
  83. package/dist/esm/uh-component-library.js +4 -6
  84. package/dist/loader/cdn.js +1 -0
  85. package/dist/loader/index.cjs.js +1 -0
  86. package/{loader → dist/loader}/index.d.ts +1 -1
  87. package/dist/loader/index.es2017.js +1 -0
  88. package/{loader → dist/loader}/index.js +1 -1
  89. package/dist/types/components/00-foundations/breakpoints/breakpoints.stories.d.ts +6 -0
  90. package/dist/types/components/00-foundations/colours/colours.stories.d.ts +3 -2
  91. package/dist/types/components/00-foundations/icons/categories/actions.d.ts +5 -0
  92. package/dist/types/components/00-foundations/icons/categories/arrows.d.ts +5 -0
  93. package/dist/types/components/00-foundations/icons/categories/custom.d.ts +5 -0
  94. package/dist/types/components/00-foundations/icons/categories/information.d.ts +5 -0
  95. package/dist/types/components/00-foundations/icons/categories/media.d.ts +5 -0
  96. package/dist/types/components/00-foundations/icons/categories/navigation.d.ts +5 -0
  97. package/dist/types/components/00-foundations/icons/categories/notifications.d.ts +5 -0
  98. package/dist/types/components/00-foundations/icons/categories/text.d.ts +5 -0
  99. package/dist/types/components/00-foundations/icons/categories/users.d.ts +5 -0
  100. package/dist/types/components/00-foundations/typography/typography.stories.d.ts +6 -5
  101. package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +17 -0
  102. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.d.ts +9 -0
  103. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.d.ts +13 -0
  104. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.stories.d.ts +8 -0
  105. package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +33 -0
  106. package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +6 -0
  107. package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +17 -0
  108. package/dist/types/components/01-base-components/ds-button/stories/ds-button.stories.d.ts +8 -0
  109. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +46 -0
  110. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.examples.stories.d.ts +8 -0
  111. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.features.stories.d.ts +18 -0
  112. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.stories.d.ts +8 -0
  113. package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +3 -0
  114. package/dist/types/components/01-base-components/ds-visually-hidden/ds-visually-hidden.d.ts +3 -0
  115. package/dist/types/components/01-base-components/ds-visually-hidden/ds-visually-hidden.stories.d.ts +7 -0
  116. package/dist/types/components.d.ts +152 -0
  117. package/dist/types/declarations.d.ts +4 -0
  118. package/dist/types/index.d.ts +0 -1
  119. package/dist/types/utils/attributes.d.ts +39 -0
  120. package/dist/types/utils/borders/borderUtils.d.ts +9 -0
  121. package/dist/types/utils/breakpoints/breakpointsUtils.d.ts +11 -0
  122. package/dist/types/utils/colours/colourTypes.d.ts +18 -0
  123. package/dist/types/utils/colours/colourUtils.d.ts +4 -14
  124. package/dist/types/utils/spacing/spacingUtils.d.ts +6 -3
  125. package/dist/types/utils/tests/testUtils.d.ts +2 -0
  126. package/dist/types/utils/utils.d.ts +20 -1
  127. package/dist/uh-component-library/app-globals-0f993ce5.js +1 -0
  128. package/dist/uh-component-library/ds-accordion_2.entry.js +1 -0
  129. package/dist/uh-component-library/ds-button_2.entry.js +1 -0
  130. package/dist/uh-component-library/ds-text-input.entry.js +1 -0
  131. package/dist/uh-component-library/index-097075ad.js +6 -0
  132. package/dist/uh-component-library/index-1d0a6586.js +2 -0
  133. package/dist/uh-component-library/index.esm.js +0 -2
  134. package/dist/uh-component-library/uh-component-library.esm.js +1 -2
  135. package/package.json +8 -15
  136. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  137. package/dist/cjs/ds-icon.cjs.entry.js +0 -522
  138. package/dist/cjs/ds-icon.cjs.entry.js.map +0 -1
  139. package/dist/cjs/index-eaf5876c.js.map +0 -1
  140. package/dist/cjs/index.cjs.js.map +0 -1
  141. package/dist/cjs/loader.cjs.js.map +0 -1
  142. package/dist/cjs/uh-component-library.cjs.js.map +0 -1
  143. package/dist/collection/components/00-foundations/borders/borders.stories.js.map +0 -1
  144. package/dist/collection/components/00-foundations/colours/colours.stories.js.map +0 -1
  145. package/dist/collection/components/00-foundations/icons/iconList.js.map +0 -1
  146. package/dist/collection/components/00-foundations/icons/icons.stories.js.map +0 -1
  147. package/dist/collection/components/00-foundations/spacing/spacing.stories.js.map +0 -1
  148. package/dist/collection/components/00-foundations/typography/headings.stories.js +0 -23
  149. package/dist/collection/components/00-foundations/typography/headings.stories.js.map +0 -1
  150. package/dist/collection/components/00-foundations/typography/text.stories.js +0 -17
  151. package/dist/collection/components/00-foundations/typography/text.stories.js.map +0 -1
  152. package/dist/collection/components/00-foundations/typography/typography.stories.js.map +0 -1
  153. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js.map +0 -1
  154. package/dist/collection/components/01-base-components/ds-icon/ds-icon.stories.js.map +0 -1
  155. package/dist/collection/index.js.map +0 -1
  156. package/dist/collection/utils/borders/borderUtils.js.map +0 -1
  157. package/dist/collection/utils/colours/colourUtils.js.map +0 -1
  158. package/dist/collection/utils/spacing/spacingUtils.js.map +0 -1
  159. package/dist/collection/utils/tests/testUtils.js.map +0 -1
  160. package/dist/collection/utils/typography/typographyUtils.js.map +0 -1
  161. package/dist/collection/utils/utils.js.map +0 -1
  162. package/dist/components/ds-icon.js.map +0 -1
  163. package/dist/components/index.js.map +0 -1
  164. package/dist/components/p-dcfb6eb2.js.map +0 -1
  165. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  166. package/dist/esm/ds-icon.entry.js +0 -518
  167. package/dist/esm/ds-icon.entry.js.map +0 -1
  168. package/dist/esm/index-1586ada2.js.map +0 -1
  169. package/dist/esm/index.js.map +0 -1
  170. package/dist/esm/loader.js.map +0 -1
  171. package/dist/esm/uh-component-library.js.map +0 -1
  172. package/dist/types/components/00-foundations/typography/headings.stories.d.ts +0 -17
  173. package/dist/types/components/00-foundations/typography/text.stories.d.ts +0 -11
  174. package/dist/uh-component-library/index.esm.js.map +0 -1
  175. package/dist/uh-component-library/p-74d73de3.js +0 -3
  176. package/dist/uh-component-library/p-74d73de3.js.map +0 -1
  177. package/dist/uh-component-library/p-c7cd80a5.entry.js +0 -2
  178. package/dist/uh-component-library/p-c7cd80a5.entry.js.map +0 -1
  179. package/dist/uh-component-library/p-e1255160.js +0 -2
  180. package/dist/uh-component-library/p-e1255160.js.map +0 -1
  181. package/dist/uh-component-library/uh-component-library.esm.js.map +0 -1
  182. package/loader/cdn.js +0 -1
  183. package/loader/index.cjs.js +0 -1
  184. package/loader/index.es2017.js +0 -1
  185. /package/{loader → dist/loader}/package.json +0 -0
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface DsTextInput extends Components.DsTextInput, HTMLElement {}
4
+ export const DsTextInput: {
5
+ prototype: DsTextInput;
6
+ new (): DsTextInput;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,200 @@
1
+ import { p as proxyCustomElement, H, h, F as Fragment } from './index2.js';
2
+ import { c as classNames } from './index3.js';
3
+ import { d as defineCustomElement$4 } from './ds-button2.js';
4
+ import { d as defineCustomElement$3 } from './ds-icon2.js';
5
+ import { d as defineCustomElement$2 } from './ds-visually-hidden2.js';
6
+
7
+ function* idGenerator(id) {
8
+ let currentId = 1;
9
+ while (true) {
10
+ yield `${id}-${currentId++}`;
11
+ }
12
+ }
13
+
14
+ const dsTextInputCss = ".sc-ds-text-input:root{--ds-breakpoint-xSmall:20rem;--ds-breakpoint-small:30rem;--ds-breakpoint-medium:60rem;--ds-breakpoint-large:75rem;--ds-breakpoint-xLarge:90rem}.sc-ds-text-input-h{display:block;width:288px}@media (min-width: 75rem){.sc-ds-text-input-h{width:320px}}.label-container.sc-ds-text-input{margin-block-end:var(--ds-spacing-2xSmall)}.label-container.sc-ds-text-input label.sc-ds-text-input{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-semibold);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);color:var(--ds-textColor-default)}.label-container.sc-ds-text-input label.required.sc-ds-text-input::after{content:\" *\";color:var(--ds-textColor-secondary)}.label-container.sc-ds-text-input small.sc-ds-text-input{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-14);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);display:block;margin-block-start:var(--ds-spacing-3xSmall);color:var(--ds-textColor-secondary)}.input-container.sc-ds-text-input{box-sizing:border-box;width:100%;display:inline-flex;position:relative;align-items:center;border-width:var(--ds-borderWidth-thin);border-style:solid;border-color:var(--ds-borderColor-default);padding-inline:var(--ds-spacing-xSmall)}.input-container.invalid.sc-ds-text-input{background-color:var(--ds-palette-danger-light);border-color:var(--ds-borderColor-danger)}.input-container.valid.sc-ds-text-input{background-color:var(--ds-palette-success-light);border-color:var(--ds-borderColor-success)}.input-container.readonly.sc-ds-text-input,.input-container.disabled.sc-ds-text-input{background-color:var(--ds-bgColor-disabled-onLight);border-color:var(--ds-borderColor-disabled-onLight)}.input-container.sc-ds-text-input:has(input:active){outline:none}.input-container.sc-ds-text-input:has(input:active):not:has(input:disabled,input.sc-ds-text-input:readonly){border-color:var(--ds-borderColor-primary)}.input-container.active.sc-ds-text-input:not(.input-container.disabled,.input-container.readonly).sc-ds-text-input{border-color:var(--ds-borderColor-primary)}.input-container.sc-ds-text-input:hover:not(.input-container.disabled,.input-container.readonly.sc-ds-text-input,.input-container.active).sc-ds-text-input{border-color:var(--ds-borderColor-black)}.input-container.sc-ds-text-input:focus-within{outline-width:var(--ds-borderWidth-thin);outline-offset:1px;outline-style:solid;outline-color:var(--ds-palette-black)}.input-container.sc-ds-text-input:focus-within:not(.input-container:focus-within.invalid,.input-container.sc-ds-text-input:focus-within.valid,.input-container.sc-ds-text-input:focus-within.readonly){border-color:var(--ds-borderColor-primary)}.input-container.sc-ds-text-input:focus-within *.sc-ds-text-input>ds-button.suffix.sc-ds-text-input>button.sc-ds-text-input:focus-visible{background-clip:padding-box;outline-offset:-5px;box-shadow:none;height:var(--ds-spacing-xLarge);background-color:var(--ds-bgColor-transparent-onLight-hover)}.input-container.sc-ds-text-input>input.sc-ds-text-input{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);width:100%;box-sizing:border-box;background-color:unset;flex-grow:1;height:var(--ds-spacing-xLarge);line-height:var(--ds-fontSize-24);color:var(--ds-textColor-default);padding-block:var(--ds-spacing-4xSmall);border:none}.input-container.sc-ds-text-input>input.sc-ds-text-input:disabled{color:var(--ds-textColor-disabled-onLight)}.input-container.sc-ds-text-input>input.sc-ds-text-input:disabled::placeholder{color:var(--ds-textColor-disabled-onLight)}.input-container.sc-ds-text-input>input.sc-ds-text-input::placeholder{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);color:var(--ds-textColor-secondary)}.input-container.sc-ds-text-input>input.sc-ds-text-input:focus{outline:none;border:none}.input-container.sc-ds-text-input>input[type=number].sc-ds-text-input{-moz-appearance:textfield}.input-container.sc-ds-text-input>input.sc-ds-text-input::-webkit-search-decoration,.input-container.sc-ds-text-input>input.sc-ds-text-input::-webkit-search-cancel-button,.input-container.sc-ds-text-input>input.sc-ds-text-input::-webkit-search-results-button,.input-container.sc-ds-text-input>input.sc-ds-text-input::-webkit-search-results-decoration,.input-container.sc-ds-text-input>input.sc-ds-text-input::-webkit-inner-spin-button,.input-container.sc-ds-text-input>input.sc-ds-text-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-container.sc-ds-text-input:has(span.prefix,ds-icon.prefix).sc-ds-text-input{padding-inline-start:var(--ds-spacing-2xSmall)}.input-container.sc-ds-text-input:has(span.prefix,ds-icon.prefix).sc-ds-text-input>input.sc-ds-text-input{padding-inline-start:var(--ds-spacing-2xSmall)}.input-container.sc-ds-text-input:has(ds-button.suffix){padding-inline-end:unset}.input-container.sc-ds-text-input span.prefix.sc-ds-text-input,.input-container.sc-ds-text-input span.suffix.sc-ds-text-input{color:var(--ds-palette-black-70)}.input-container.sc-ds-text-input ds-icon.prefix.sc-ds-text-input,.input-container.sc-ds-text-input-s>[slot=prefix],.input-container .sc-ds-text-input-s>[slot=prefix]{height:1.5rem;color:var(--ds-textColor-default)}.input-container.sc-ds-text-input ds-button.suffix.sc-ds-text-input{margin-top:calc(var(--ds-spacing-3xSmall) * -1);margin-right:calc(var(--ds-spacing-4xSmall) * -1);max-height:40px}.error-text-container.sc-ds-text-input,.success-text-container.sc-ds-text-input{display:flex;align-items:center;margin-top:var(--ds-spacing-2xSmall);gap:var(--ds-spacing-2xSmall)}.error-text-container.sc-ds-text-input ds-icon.sc-ds-text-input,.success-text-container.sc-ds-text-input ds-icon.sc-ds-text-input{display:block;height:1.5rem}.error-text-container.sc-ds-text-input small.sc-ds-text-input,.success-text-container.sc-ds-text-input small.sc-ds-text-input{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large)}.error-text-container.sc-ds-text-input{color:var(--ds-textColor-danger)}.success-text-container.sc-ds-text-input{color:var(--ds-textColor-success)}";
15
+ const DsTextInputStyle0 = dsTextInputCss;
16
+
17
+ const INPUT_TYPE_ICONS_MAP = {
18
+ search: 'search',
19
+ };
20
+ const INPUT_TYPE_ACTION_BUTTON_ICON_MAP = {
21
+ search: ({ clearButtonVisible }) => (clearButtonVisible ? 'cancel_fill' : ''),
22
+ password: ({ passwordInputVisible }) => (passwordInputVisible ? 'visibility_off_fill' : 'visibility_fill'),
23
+ };
24
+ const assistiveTextIdGenerator = idGenerator('ds-assistive-text');
25
+ const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
26
+ const successTextIdGenerator = idGenerator('success-text');
27
+ const errorTextIdGenerator = idGenerator('error-text');
28
+ const DsTextInput$1 = /*@__PURE__*/ proxyCustomElement(class DsTextInput extends H {
29
+ constructor() {
30
+ super();
31
+ this.__registerHost();
32
+ this.assistiveTextId = assistiveTextIdGenerator.next().value;
33
+ this.visuallyHiddenAssistiveTextId = visuallyHiddenAssistiveTextIdGenerator.next().value;
34
+ this.successTextId = successTextIdGenerator.next().value;
35
+ this.errorTextId = errorTextIdGenerator.next().value;
36
+ this.onActionButtonClicked = (e) => {
37
+ e.stopPropagation();
38
+ switch (this.type) {
39
+ case 'password':
40
+ return this.togglePasswordVisibility();
41
+ case 'search':
42
+ this.clearInput();
43
+ default:
44
+ return;
45
+ }
46
+ };
47
+ this.label = undefined;
48
+ this.placeholder = undefined;
49
+ this.id = 'input';
50
+ this.name = undefined;
51
+ this.disabled = undefined;
52
+ this.required = undefined;
53
+ this.readonly = undefined;
54
+ this.value = undefined;
55
+ this.min = undefined;
56
+ this.max = undefined;
57
+ this.maxlength = undefined;
58
+ this.pattern = undefined;
59
+ this.autocomplete = undefined;
60
+ this.errorText = undefined;
61
+ this.successText = undefined;
62
+ this.assistiveText = undefined;
63
+ this.actionButtonAriaLabel = undefined;
64
+ this.hiddenAssistiveText = undefined;
65
+ this.prefixText = undefined;
66
+ this.suffixText = undefined;
67
+ this.icon = '';
68
+ this.type = 'text';
69
+ this.ariaLabel = undefined;
70
+ this.ariaLabelledBy = undefined;
71
+ this.ariaDescribedby = undefined;
72
+ this.hasFocus = false;
73
+ this.clearButtonVisible = false;
74
+ this.passwordInputVisible = false;
75
+ this.inputActive = false;
76
+ }
77
+ async togglePasswordVisibility() {
78
+ return (this.passwordInputVisible = !this.passwordInputVisible);
79
+ }
80
+ async clearInput() {
81
+ this.inputElement.value = '';
82
+ this.inputElement.focus();
83
+ this.clearButtonVisible = false;
84
+ }
85
+ renderValidityMessage(type) {
86
+ const textId = type === 'success' ? this.successTextId : this.errorTextId;
87
+ const text = type === 'success' ? this.successText : this.errorText;
88
+ const icon = type === 'success' ? 'check_circle_fill' : 'warning_fill';
89
+ const className = type + '-text';
90
+ return (h("slot", { name: className }, text && (h("div", { class: `${className}-container` }, h("ds-icon", { name: icon }), h("small", { id: textId, class: className }, text)))));
91
+ }
92
+ renderPrefixContent() {
93
+ if (this.prefixText) {
94
+ return (h("slot", { name: "prefix" }, h("span", { class: "prefix" }, this.prefixText)));
95
+ }
96
+ const prefixIcon = this.icon || INPUT_TYPE_ICONS_MAP[this.type];
97
+ if (prefixIcon) {
98
+ return (h("slot", { name: "prefix" }, h("ds-icon", { class: "prefix", name: prefixIcon })));
99
+ }
100
+ return null;
101
+ }
102
+ renderSuffixContent() {
103
+ var _a, _b;
104
+ if (this.suffixText) {
105
+ return (h("slot", { name: "suffix" }, h("span", { class: "suffix" }, this.suffixText)));
106
+ }
107
+ const actionButtonIcon = (_b = (_a = INPUT_TYPE_ACTION_BUTTON_ICON_MAP[this.type]) === null || _a === void 0 ? void 0 : _a.call(INPUT_TYPE_ACTION_BUTTON_ICON_MAP, this)) !== null && _b !== void 0 ? _b : '';
108
+ const ariaPressed = this.type === 'password' ? this.passwordInputVisible : undefined;
109
+ if (actionButtonIcon) {
110
+ return (h("slot", { name: "suffix" }, h("ds-button", { ref: e => (this.suffixButtonElement = e), variant: "supplementary", colour: "black", class: "suffix", disabled: false, icon: actionButtonIcon, onClick: this.onActionButtonClicked, "aria-pressed": ariaPressed, "aria-label": this.actionButtonAriaLabel })));
111
+ }
112
+ return null;
113
+ }
114
+ handleInputContainerClick(e) {
115
+ if (e.target === this.suffixButtonElement)
116
+ return;
117
+ this.inputElement.focus();
118
+ }
119
+ render() {
120
+ const inputType = this.type === 'password' && this.passwordInputVisible ? 'text' : this.type;
121
+ return (h(Fragment, { key: '6d7c594001a3103009b407b8ff83d2c1280d014a' }, h("div", { key: '76051b2e72023d0a11fe07f10390b787e7466f02', class: "label-container" }, h("slot", { key: '3c6aa9d9ad95523cd241fddf19be9f3b61cc6a5e', name: "label" }, h("label", { key: '9adea3cfcbd36030bdf66dd9ddc64a1483910c0f', class: classNames({ required: this.required }), htmlFor: this.id }, this.label)), h("slot", { key: '12466889750015207ac3f56159c70795e797d433', name: "help-text" }, h("small", { key: '4c4ae48f06cb9633d5f306ae14da8ccc5d09699e', id: this.assistiveTextId }, this.assistiveText), h("ds-visually-hidden", { key: '899469a328caf988e955bc2f3e4bc15664f01de3', id: this.visuallyHiddenAssistiveTextId }, this.hiddenAssistiveText))), h("div", { key: 'b8afbafcafc45a83b9bf177a09d585745ff2d7bf', onMouseDown: () => (this.inputActive = true), onMouseUp: () => (this.inputActive = false), onClick: e => this.handleInputContainerClick(e), class: classNames('input-container', {
122
+ disabled: this.disabled,
123
+ readonly: this.readonly,
124
+ valid: !!this.successText,
125
+ invalid: !!this.errorText,
126
+ focus: this.hasFocus,
127
+ active: !!this.inputActive,
128
+ }) }, this.renderPrefixContent(), h("input", { key: '75b925eced73863f039c31f7c8abaf8996532f7c', ref: e => (this.inputElement = e), id: this.id, name: this.name, "aria-label": this.ariaLabel, "aria-labelledby": this.ariaLabelledBy, "aria-describedby": this.ariaDescribedby ||
129
+ classNames(this.assistiveTextId, this.visuallyHiddenAssistiveTextId, {
130
+ [this.successTextId]: this.successText,
131
+ [this.errorTextId]: this.errorText,
132
+ }), 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: e => (this.clearButtonVisible = !!e.target.value), onFocus: () => (this.hasFocus = true), onBlur: () => (this.hasFocus = false) }), this.renderSuffixContent()), this.renderValidityMessage('error'), this.renderValidityMessage('success')));
133
+ }
134
+ static get style() { return DsTextInputStyle0; }
135
+ }, [6, "ds-text-input", {
136
+ "label": [1],
137
+ "placeholder": [1],
138
+ "id": [1],
139
+ "name": [1],
140
+ "disabled": [4],
141
+ "required": [4],
142
+ "readonly": [4],
143
+ "value": [1],
144
+ "min": [2],
145
+ "max": [2],
146
+ "maxlength": [2],
147
+ "pattern": [1],
148
+ "autocomplete": [1],
149
+ "errorText": [1, "error-text"],
150
+ "successText": [1, "success-text"],
151
+ "assistiveText": [1, "assistive-text"],
152
+ "actionButtonAriaLabel": [1, "action-button-aria-label"],
153
+ "hiddenAssistiveText": [1, "hidden-assistive-text"],
154
+ "prefixText": [1, "prefix-text"],
155
+ "suffixText": [1, "suffix-text"],
156
+ "icon": [1],
157
+ "type": [1],
158
+ "ariaLabel": [1, "aria-label"],
159
+ "ariaLabelledBy": [1, "aria-labelledby"],
160
+ "ariaDescribedby": [1, "aria-describedby"],
161
+ "hasFocus": [32],
162
+ "clearButtonVisible": [32],
163
+ "passwordInputVisible": [32],
164
+ "inputActive": [32],
165
+ "togglePasswordVisibility": [64],
166
+ "clearInput": [64]
167
+ }]);
168
+ function defineCustomElement$1() {
169
+ if (typeof customElements === "undefined") {
170
+ return;
171
+ }
172
+ const components = ["ds-text-input", "ds-button", "ds-icon", "ds-visually-hidden"];
173
+ components.forEach(tagName => { switch (tagName) {
174
+ case "ds-text-input":
175
+ if (!customElements.get(tagName)) {
176
+ customElements.define(tagName, DsTextInput$1);
177
+ }
178
+ break;
179
+ case "ds-button":
180
+ if (!customElements.get(tagName)) {
181
+ defineCustomElement$4();
182
+ }
183
+ break;
184
+ case "ds-icon":
185
+ if (!customElements.get(tagName)) {
186
+ defineCustomElement$3();
187
+ }
188
+ break;
189
+ case "ds-visually-hidden":
190
+ if (!customElements.get(tagName)) {
191
+ defineCustomElement$2();
192
+ }
193
+ break;
194
+ } });
195
+ }
196
+
197
+ const DsTextInput = DsTextInput$1;
198
+ const defineCustomElement = defineCustomElement$1;
199
+
200
+ export { DsTextInput, defineCustomElement };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface DsVisuallyHidden extends Components.DsVisuallyHidden, HTMLElement {}
4
+ export const DsVisuallyHidden: {
5
+ prototype: DsVisuallyHidden;
6
+ new (): DsVisuallyHidden;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { D as DsVisuallyHidden$1, d as defineCustomElement$1 } from './ds-visually-hidden2.js';
2
+
3
+ const DsVisuallyHidden = DsVisuallyHidden$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { DsVisuallyHidden, defineCustomElement };
@@ -0,0 +1,31 @@
1
+ import { p as proxyCustomElement, H, h } from './index2.js';
2
+
3
+ const dsVisuallyHiddenCss = ":host{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}";
4
+ const DsVisuallyHiddenStyle0 = dsVisuallyHiddenCss;
5
+
6
+ const DsVisuallyHidden = /*@__PURE__*/ proxyCustomElement(class DsVisuallyHidden extends H {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ }
12
+ render() {
13
+ return (h("slot", { key: '390610148832811748f7700f0d438b257bdb354d' }));
14
+ }
15
+ static get style() { return DsVisuallyHiddenStyle0; }
16
+ }, [1, "ds-visually-hidden"]);
17
+ function defineCustomElement() {
18
+ if (typeof customElements === "undefined") {
19
+ return;
20
+ }
21
+ const components = ["ds-visually-hidden"];
22
+ components.forEach(tagName => { switch (tagName) {
23
+ case "ds-visually-hidden":
24
+ if (!customElements.get(tagName)) {
25
+ customElements.define(tagName, DsVisuallyHidden);
26
+ }
27
+ break;
28
+ } });
29
+ }
30
+
31
+ export { DsVisuallyHidden as D, defineCustomElement as d };
@@ -1,9 +1 @@
1
- export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-dcfb6eb2.js';
2
-
3
- function format(first, middle, last) {
4
- return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
5
- }
6
-
7
- export { format };
8
-
9
- //# sourceMappingURL=index.js.map
1
+ export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './index2.js';