@uh-design-system/component-library 0.2.0-alpha.0 → 0.2.1-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 (86) hide show
  1. package/dist/cjs/{uh-component-library.cjs.js → component-library.cjs.js} +3 -3
  2. package/dist/cjs/ds-accordion_2.cjs.entry.js +10 -36
  3. package/dist/cjs/ds-button_2.cjs.entry.js +14 -43
  4. package/dist/cjs/ds-text-input.cjs.entry.js +9 -31
  5. package/dist/cjs/{index-f7420801.js → index-d03b8350.js} +369 -316
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +1 -1
  8. package/dist/collection/components/00-foundations/borders/borders.stories.js +0 -1
  9. package/dist/collection/components/00-foundations/breakpoints/breakpoints.stories.js +0 -2
  10. package/dist/collection/components/00-foundations/icons/categories/actions.js +0 -3
  11. package/dist/collection/components/00-foundations/icons/categories/arrows.js +0 -3
  12. package/dist/collection/components/00-foundations/icons/categories/custom.js +0 -3
  13. package/dist/collection/components/00-foundations/icons/categories/information.js +0 -3
  14. package/dist/collection/components/00-foundations/icons/categories/media.js +0 -3
  15. package/dist/collection/components/00-foundations/icons/categories/navigation.js +0 -3
  16. package/dist/collection/components/00-foundations/icons/categories/notifications.js +0 -3
  17. package/dist/collection/components/00-foundations/icons/categories/text.js +0 -3
  18. package/dist/collection/components/00-foundations/icons/categories/users.js +0 -3
  19. package/dist/collection/components/00-foundations/icons/iconList.js +0 -1
  20. package/dist/collection/components/00-foundations/icons/icons.stories.js +0 -3
  21. package/dist/collection/components/00-foundations/spacing/spacing.stories.js +0 -2
  22. package/dist/collection/components/00-foundations/typography/typography.stories.js +0 -2
  23. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +8 -8
  24. package/dist/collection/components/01-base-components/ds-button/ds-button.js +12 -13
  25. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +0 -1
  26. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +0 -5
  27. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +0 -7
  28. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +7 -29
  29. package/dist/collection/utils/attributes.js +0 -32
  30. package/dist/collection/utils/borders/borderUtils.js +0 -1
  31. package/dist/collection/utils/breakpoints/breakpointsUtils.js +0 -1
  32. package/dist/collection/utils/colours/colourTypes.js +0 -1
  33. package/dist/collection/utils/colours/colourUtils.js +1 -5
  34. package/dist/collection/utils/spacing/spacingUtils.js +1 -2
  35. package/dist/collection/utils/tests/testUtils.js +0 -4
  36. package/dist/collection/utils/typography/typographyUtils.js +0 -2
  37. package/dist/collection/utils/utils.js +0 -14
  38. package/dist/{uh-component-library/uh-component-library.esm.js → component-library/component-library.esm.js} +1 -1
  39. package/dist/{uh-component-library → component-library}/ds-accordion_2.entry.js +1 -1
  40. package/dist/component-library/ds-button_2.entry.js +1 -0
  41. package/dist/component-library/ds-text-input.entry.js +1 -0
  42. package/dist/component-library/index-dfeefc7e.js +2 -0
  43. package/dist/components/ds-accordion.js +9 -9
  44. package/dist/components/ds-button2.js +13 -42
  45. package/dist/components/ds-icon2.js +1 -27
  46. package/dist/components/ds-text-input.js +8 -30
  47. package/dist/components/ds-visually-hidden2.js +1 -1
  48. package/dist/components/index2.js +322 -283
  49. package/dist/esm/{uh-component-library.js → component-library.js} +3 -3
  50. package/dist/esm/ds-accordion_2.entry.js +10 -36
  51. package/dist/esm/ds-button_2.entry.js +14 -43
  52. package/dist/esm/ds-text-input.entry.js +9 -31
  53. package/dist/esm/{index-1d0a6586.js → index-dfeefc7e.js} +369 -316
  54. package/dist/esm/loader.js +2 -2
  55. package/dist/loader/package.json +1 -1
  56. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.d.ts +0 -1
  57. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.d.ts +0 -1
  58. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.stories.d.ts +0 -1
  59. package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +0 -13
  60. package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +0 -1
  61. package/dist/types/components/01-base-components/ds-button/stories/ds-button.stories.d.ts +0 -1
  62. package/dist/types/components/01-base-components/ds-icon/ds-icon.stories.d.ts +0 -1
  63. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.examples.stories.d.ts +0 -1
  64. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.features.stories.d.ts +0 -1
  65. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.stories.d.ts +0 -1
  66. package/dist/types/components/01-base-components/ds-visually-hidden/ds-visually-hidden.stories.d.ts +0 -1
  67. package/dist/types/index.d.ts +0 -9
  68. package/dist/types/utils/attributes.d.ts +0 -31
  69. package/dist/types/utils/tests/testUtils.d.ts +0 -4
  70. package/dist/types/utils/utils.d.ts +0 -14
  71. package/package.json +6 -9
  72. package/README.md +0 -13
  73. package/dist/uh-component-library/ds-button_2.entry.js +0 -1
  74. package/dist/uh-component-library/ds-text-input.entry.js +0 -1
  75. package/dist/uh-component-library/index-1d0a6586.js +0 -2
  76. package/docs/DEPLOYMENT.md +0 -52
  77. package/docs/DEVELOPMENT.md +0 -52
  78. package/docs/PUBLISHING.md +0 -48
  79. package/docs/TESTING.md +0 -24
  80. package/docs/USAGE.md +0 -30
  81. package/react-wrapper/components.ts +0 -24
  82. /package/dist/cjs/{index-5a88e57b.js → index-5b0b9d4c.js} +0 -0
  83. /package/dist/{uh-component-library → component-library}/app-globals-0f993ce5.js +0 -0
  84. /package/dist/{uh-component-library/index-097075ad.js → component-library/index-72ac5051.js} +0 -0
  85. /package/dist/{uh-component-library → component-library}/index.esm.js +0 -0
  86. /package/dist/esm/{index-097075ad.js → index-72ac5051.js} +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-f7420801.js');
5
+ const index = require('./index-d03b8350.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "compiler": {
10
10
  "name": "@stencil/core",
11
- "version": "4.23.0",
11
+ "version": "4.25.1",
12
12
  "typescriptVersion": "5.5.4"
13
13
  },
14
14
  "collections": [],
@@ -1,4 +1,3 @@
1
- // src/components/00-foundations/borders/borders.stories.ts
2
1
  import "./_borders.scss";
3
2
  import { getBorderVariables, createBorderSection, categories } from "../../../utils/borders/borderUtils";
4
3
  export default {
@@ -1,4 +1,3 @@
1
- // src/components/00-foundations/breakpoints/breakpoints.stories.ts
2
1
  import "./_breakpoints.scss";
3
2
  import { getBreakpointVariables, createCategorySection, categories } from "../../../utils/breakpoints/breakpointsUtils";
4
3
  export default {
@@ -7,7 +6,6 @@ export default {
7
6
  export const Breakpoints = () => {
8
7
  const container = document.createElement('div');
9
8
  const breakpointVariables = getBreakpointVariables();
10
- // Reset the renderedCategories set
11
9
  const renderedCategories = new Set();
12
10
  const categoryNames = [...new Set(Object.values(categories)), 'Other'];
13
11
  categoryNames.forEach(category => {
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/actions.ts
2
- // Set category name
3
1
  const category = 'Actions';
4
- // Import Material Icons
5
2
  import ArchiveIcon from "@material-symbols/svg-700/sharp/archive.svg";
6
3
  import ArchiveFillIcon from "@material-symbols/svg-700/sharp/archive-fill.svg";
7
4
  import DownloadIcon from "@material-symbols/svg-700/sharp/download.svg";
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/arrows.ts
2
- // Set category name
3
1
  const category = 'Arrows and operators';
4
- // Import Material Icons
5
2
  import ArrowUpwardIcon from "@material-symbols/svg-700/sharp/arrow_upward.svg";
6
3
  import AddIcon from "@material-symbols/svg-700/sharp/add.svg";
7
4
  import ArrowOutwardIcon from "@material-symbols/svg-700/sharp/arrow_outward.svg";
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/custom.ts
2
- // Set category name
3
1
  const category = 'DS Custom icons';
4
- // Import custom icons
5
2
  import DSFlameIcon from "../../../../../custom-icons/ds-flame.svg";
6
3
  import DSFlameFillIcon from "../../../../../custom-icons/ds-flame-fill.svg";
7
4
  export const icons = [
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/information.ts
2
- // Set category name
3
1
  const category = 'Information';
4
- // Import Material Icons
5
2
  import CalendarMonthIcon from "@material-symbols/svg-700/sharp/calendar_month.svg";
6
3
  import CalendarMonthFillIcon from "@material-symbols/svg-700/sharp/calendar_month-fill.svg";
7
4
  import EventAvailableIcon from "@material-symbols/svg-700/sharp/event_available.svg";
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/media.ts
2
- // Set category name
3
1
  const category = 'Media and devices';
4
- // Import Material Icons
5
2
  import PhotoCameraIcon from "@material-symbols/svg-700/sharp/photo_camera.svg";
6
3
  import PhotoCameraFillIcon from "@material-symbols/svg-700/sharp/photo_camera-fill.svg";
7
4
  import ChatIcon from "@material-symbols/svg-700/sharp/chat.svg";
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/navigation.ts
2
- // Set category name
3
1
  const category = 'Navigation';
4
- // Import Material Icons
5
2
  import HomeIcon from "@material-symbols/svg-700/sharp/home.svg";
6
3
  import MenuIcon from "@material-symbols/svg-700/sharp/menu.svg";
7
4
  import HomeFillIcon from "@material-symbols/svg-700/sharp/home-fill.svg";
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/notifications.ts
2
- // Set category name
3
1
  const category = 'Notifications and expressions';
4
- // Import Material Icons
5
2
  import FavoriteIcon from "@material-symbols/svg-700/sharp/favorite.svg";
6
3
  import FavoriteFillIcon from "@material-symbols/svg-700/sharp/favorite-fill.svg";
7
4
  import HelpIcon from "@material-symbols/svg-700/sharp/help.svg";
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/text.ts
2
- // Set category name
3
1
  const category = 'Text formatting';
4
- // Import Material Icons
5
2
  import FormatQuoteIcon from "@material-symbols/svg-700/sharp/format_quote.svg";
6
3
  import FormatQuoteFillIcon from "@material-symbols/svg-700/sharp/format_quote-fill.svg";
7
4
  import FormatQuoteOffIcon from "@material-symbols/svg-700/sharp/format_quote_off.svg";
@@ -1,7 +1,4 @@
1
- // src/components/00-foundations/icons/categories/users.ts
2
- // Set category name
3
1
  const category = 'Users and avatars';
4
- // Import Material Icons
5
2
  import AccountCircleIcon from "@material-symbols/svg-700/sharp/account_circle.svg";
6
3
  import AccountCircleFillIcon from "@material-symbols/svg-700/sharp/account_circle-fill.svg";
7
4
  import PersonIcon from "@material-symbols/svg-700/sharp/person.svg";
@@ -1,4 +1,3 @@
1
- // src/components/00-foundations/icons/iconList.ts
2
1
  import { icons as customIcons } from "./categories/custom";
3
2
  import { icons as actionIcons } from "./categories/actions";
4
3
  import { icons as arrowIcons } from "./categories/arrows";
@@ -1,4 +1,3 @@
1
- // src/components/00-foundations/icons/icons.stories.ts
2
1
  import { icons } from "./iconList";
3
2
  export default {
4
3
  title: 'Foundations/Icons',
@@ -12,7 +11,6 @@ export const Icons = () => {
12
11
  const containerTitle = document.createElement('h2');
13
12
  containerTitle.textContent = 'Icon categories';
14
13
  container.appendChild(containerTitle);
15
- // Group icons by category
16
14
  const categories = icons.reduce((acc, icon) => {
17
15
  if (!acc[icon.category]) {
18
16
  acc[icon.category] = [];
@@ -20,7 +18,6 @@ export const Icons = () => {
20
18
  acc[icon.category].push(icon);
21
19
  return acc;
22
20
  }, {});
23
- // Create a section for each category
24
21
  Object.keys(categories).forEach((category) => {
25
22
  const categoryContainer = document.createElement('div');
26
23
  const categoryTitle = document.createElement('h3');
@@ -1,4 +1,3 @@
1
- // src/components/00-foundations/spacing/spacing.stories.ts
2
1
  import "./_spacing.scss";
3
2
  import { getSpacingVariables, createCategorySection, categories } from "../../../utils/spacing/spacingUtils";
4
3
  export default {
@@ -7,7 +6,6 @@ export default {
7
6
  export const Spacing = () => {
8
7
  const container = document.createElement('div');
9
8
  const spacingVariables = getSpacingVariables();
10
- // Reset the renderedCategories set
11
9
  const renderedCategories = new Set();
12
10
  const categoryNames = [...new Set(Object.values(categories)), 'Other'];
13
11
  categoryNames.forEach(category => {
@@ -1,4 +1,3 @@
1
- // src/components/00-foundations/typography/typography.stories.ts
2
1
  import "./_typography.scss";
3
2
  import { getTypographyVariables, createCategorySection, categories } from "../../../utils/typography/typographyUtils";
4
3
  import { html } from "lit";
@@ -47,7 +46,6 @@ export const Text = {
47
46
  const renderTypography = () => {
48
47
  const container = document.createElement('div');
49
48
  const typographyVariables = getTypographyVariables();
50
- // Reset the renderedCategories set
51
49
  const renderedCategories = new Set();
52
50
  const categoryNames = [...new Set(Object.values(categories)), 'Other'];
53
51
  categoryNames.forEach(category => {
@@ -2,6 +2,14 @@ import { h } from "@stencil/core";
2
2
  import classNames from "classnames";
3
3
  export class DsAccordion {
4
4
  constructor() {
5
+ this.variant = 'default';
6
+ this.borderAligned = false;
7
+ this.openByDefault = false;
8
+ this.accordionId = 'dsaccordion';
9
+ this.headingLevel = 2;
10
+ this.useCloseButton = false;
11
+ this.closeButtonLabel = 'Close';
12
+ this.isExpanded = this.openByDefault;
5
13
  this.shouldMoveFocus = false;
6
14
  this.handleClick = (event) => {
7
15
  const isCloseButton = event.target.closest('.ds-accordion__close-button');
@@ -19,14 +27,6 @@ export class DsAccordion {
19
27
  break;
20
28
  }
21
29
  };
22
- this.variant = 'default';
23
- this.borderAligned = false;
24
- this.openByDefault = false;
25
- this.accordionId = 'dsaccordion';
26
- this.headingLevel = 2;
27
- this.useCloseButton = false;
28
- this.closeButtonLabel = 'Close';
29
- this.isExpanded = this.openByDefault;
30
30
  }
31
31
  watchHandler(isExpanded) {
32
32
  if (!isExpanded && this.shouldMoveFocus && this.headerButtonRef) {
@@ -5,9 +5,17 @@ export class DsButton {
5
5
  constructor() {
6
6
  this.inheritedAttributes = {};
7
7
  this.pressedKeys = new Set();
8
+ this.value = '';
9
+ this.variant = 'primary';
10
+ this.colour = 'blue';
11
+ this.size = 'medium';
12
+ this.fontWeight = 'normal';
13
+ this.icon = '';
14
+ this.iconPosition = 'start';
15
+ this.type = 'button';
16
+ this.disabled = false;
17
+ this.ariaDisabled = 'false';
8
18
  this.handleKeyDown = (event) => {
9
- // Exit early when a key is held down
10
- // See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
11
19
  if (event.repeat) {
12
20
  return;
13
21
  }
@@ -30,16 +38,6 @@ export class DsButton {
30
38
  break;
31
39
  }
32
40
  };
33
- this.value = '';
34
- this.variant = 'primary';
35
- this.colour = 'blue';
36
- this.size = 'medium';
37
- this.fontWeight = 'normal';
38
- this.icon = '';
39
- this.iconPosition = 'start';
40
- this.type = 'button';
41
- this.disabled = false;
42
- this.ariaDisabled = 'false';
43
41
  }
44
42
  componentWillLoad() {
45
43
  this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el, ['aria-disabled'])), inheritAttributes(this.el, [
@@ -56,6 +54,7 @@ export class DsButton {
56
54
  ]));
57
55
  }
58
56
  render() {
57
+ console.log('render');
59
58
  const classes = classNames(`${this.variant} ${this.colour} ${this.size}`, {
60
59
  'icon-start': this.icon && this.iconPosition === 'start' && this.value,
61
60
  'icon-end': this.icon && this.iconPosition === 'end' && this.value,
@@ -63,7 +62,7 @@ export class DsButton {
63
62
  });
64
63
  const iconSize = this.size === 'small' ? '1rem' : undefined;
65
64
  const isDisabled = this.disabled || this.ariaDisabled === 'true';
66
- return (h("button", Object.assign({ key: '1230108c308cc8a89f8202bef69e839e36b6912d', ref: el => (this.buttonEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, class: classes, style: { fontWeight: this.fontWeight }, type: this.type, "aria-disabled": isDisabled ? 'true' : 'false' }, this.inheritedAttributes), h("slot", { key: 'bb67886e636e7a5294a6fbbde4a8a013e1ace3ce', name: "prefix" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '6e93f6095ee4482d5026b42a67b7591712206146', name: this.icon, size: iconSize })), this.value && h("span", { key: '833424437f89ace4253e9daef6d8cda409563a4a', class: "button-value" }, this.value), h("slot", { key: '162e459206000c3b1b5b4ede761f5600f88b3de1', name: "suffix" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: '2e9bff6bdc4d5023374916bcbdc11151270113b6', name: this.icon, size: iconSize }))));
65
+ return (h("button", Object.assign({ key: 'd85ee424afafcb437fa873e69b7554e315e4cad5', ref: el => (this.buttonEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, class: classes, style: { fontWeight: this.fontWeight }, type: this.type, "aria-disabled": isDisabled ? 'true' : 'false' }, this.inheritedAttributes), h("slot", { key: 'c21dc9317ae1970d8e5fcead12b4041a8dc13af0', name: "prefix" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: 'cc993dd0b2a12b3243bc8863d754a0efa3b6f1f4', name: this.icon, size: iconSize })), this.value && h("span", { key: 'b8a7bcac21782fd898192d98c605c0eacbfff882', class: "button-value" }, this.value), h("slot", { key: 'e4766fc18983798416533173ceddcbe3c80779ba', name: "suffix" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: 'f308fb96c0b0b06036975df25fc5fba59dffe301', name: this.icon, size: iconSize }))));
67
66
  }
68
67
  static get is() { return "ds-button"; }
69
68
  static get encapsulation() { return "scoped"; }
@@ -1,4 +1,3 @@
1
- // src/examples/buttonGroup.stories.ts
2
1
  import { html } from "lit";
3
2
  const meta = {
4
3
  title: 'Base Components/Button/Examples',
@@ -1,10 +1,5 @@
1
1
  import { icons } from "../../../00-foundations/icons/iconList";
2
2
  import { getAriaAttributeArgTypes } from "../../../../utils/attributes";
3
- /**
4
- * Button aria-attributes
5
- *
6
- * @see {@link https://w3c.github.io/aria/#button}
7
- */
8
3
  const buttonAriaAttributes = [
9
4
  'aria-busy',
10
5
  'aria-live',
@@ -2,15 +2,12 @@ import { Fragment, h } from "@stencil/core";
2
2
  import { icons } from "../../../components/00-foundations/icons/iconList";
3
3
  export class DsIcon {
4
4
  constructor() {
5
- this.name = undefined;
6
- this.colour = undefined;
7
5
  this.size = '1.5rem';
8
6
  this.title = 'Icon';
9
7
  this.role = 'img';
10
8
  this.hidden = true;
11
9
  this.message = '';
12
10
  }
13
- // get the icon from the icon list
14
11
  getIcon() {
15
12
  const selectedIcon = icons.find(icon => icon.name === this.name);
16
13
  if (!selectedIcon) {
@@ -23,18 +20,15 @@ export class DsIcon {
23
20
  }
24
21
  return svgElement ? svgElement.outerHTML : '';
25
22
  }
26
- // parse the svg string to an svg element
27
23
  parseSvg(svgString) {
28
24
  const parser = new DOMParser();
29
25
  const svgDoc = parser.parseFromString(svgString, 'image/svg+xml');
30
26
  return svgDoc.querySelector('svg');
31
27
  }
32
- // get the colour of the icon
33
28
  getIconColour() {
34
29
  const colour = this.colour ? `var(--${this.colour})` : 'currentColor';
35
30
  return colour;
36
31
  }
37
- // set the attributes of the icon
38
32
  setIconAttributes(svgElement) {
39
33
  const size = this.size || '1.5rem';
40
34
  const colour = this.getIconColour() || 'currentColor';
@@ -42,7 +36,6 @@ export class DsIcon {
42
36
  const title = this.title || '';
43
37
  svgElement.setAttribute('style', `fill: ${colour}; width: ${size}; height: ${size};`);
44
38
  svgElement.setAttribute('role', role);
45
- // if title is available, insert it into the svg element
46
39
  const titleText = title || 'Icon';
47
40
  const titleElement = document.createElementNS('http://www.w3.org/2000/svg', 'title');
48
41
  titleElement.textContent = titleText;
@@ -18,6 +18,13 @@ export class DsTextInput {
18
18
  this.visuallyHiddenAssistiveTextId = visuallyHiddenAssistiveTextIdGenerator.next().value;
19
19
  this.successTextId = successTextIdGenerator.next().value;
20
20
  this.errorTextId = errorTextIdGenerator.next().value;
21
+ this.id = 'input';
22
+ this.icon = '';
23
+ this.type = 'text';
24
+ this.hasFocus = false;
25
+ this.clearButtonVisible = false;
26
+ this.passwordInputVisible = false;
27
+ this.inputActive = false;
21
28
  this.onActionButtonClicked = (e) => {
22
29
  e.stopPropagation();
23
30
  switch (this.type) {
@@ -29,35 +36,6 @@ export class DsTextInput {
29
36
  return;
30
37
  }
31
38
  };
32
- this.label = undefined;
33
- this.placeholder = undefined;
34
- this.id = 'input';
35
- this.name = undefined;
36
- this.disabled = undefined;
37
- this.required = undefined;
38
- this.readonly = undefined;
39
- this.value = undefined;
40
- this.min = undefined;
41
- this.max = undefined;
42
- this.maxlength = undefined;
43
- this.pattern = undefined;
44
- this.autocomplete = undefined;
45
- this.errorText = undefined;
46
- this.successText = undefined;
47
- this.assistiveText = undefined;
48
- this.actionButtonAriaLabel = undefined;
49
- this.hiddenAssistiveText = undefined;
50
- this.prefixText = undefined;
51
- this.suffixText = undefined;
52
- this.icon = '';
53
- this.type = 'text';
54
- this.ariaLabel = undefined;
55
- this.ariaLabelledBy = undefined;
56
- this.ariaDescribedby = undefined;
57
- this.hasFocus = false;
58
- this.clearButtonVisible = false;
59
- this.passwordInputVisible = false;
60
- this.inputActive = false;
61
39
  }
62
40
  async togglePasswordVisibility() {
63
41
  return (this.passwordInputVisible = !this.passwordInputVisible);
@@ -1,15 +1,3 @@
1
- /**
2
- * Copied from https://github.com/ionic-team/ionic-framework/blob/main/core/src/utils/helpers.ts
3
- *
4
- * Elements inside of web components sometimes need to inherit global attributes
5
- * set on the host. For example, the inner input in `ion-input` should inherit
6
- * the `title` attribute that developers set directly on `ion-input`. This
7
- * helper function should be called in componentWillLoad and assigned to a variable
8
- * that is later used in the render function.
9
- *
10
- * This does not need to be reactive as changing attributes on the host element
11
- * does not trigger a re-render.
12
- */
13
1
  export const inheritAttributes = (el, attributes = []) => {
14
2
  const attributeObject = {};
15
3
  attributes.forEach(attr => {
@@ -23,13 +11,6 @@ export const inheritAttributes = (el, attributes = []) => {
23
11
  });
24
12
  return attributeObject;
25
13
  };
26
- /**
27
- * Copied from https://github.com/ionic-team/ionic-framework/blob/main/core/src/utils/helpers.ts
28
- *
29
- * List of available ARIA attributes + `role`.
30
- * Removed deprecated attributes.
31
- * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes
32
- */
33
14
  export const ariaAttributes = [
34
15
  'role',
35
16
  'aria-activedescendant',
@@ -83,21 +64,8 @@ export const ariaAttributes = [
83
64
  'aria-valuenow',
84
65
  'aria-valuetext',
85
66
  ];
86
- /**
87
- * Turns a kebab-case string (eg. aria-*) to camelCase
88
- * Copied from: https://stackoverflow.com/a/60738940
89
- */
90
67
  const kebabToCamelCase = (attr) => attr.replace(/-./g, x => x[1].toUpperCase());
91
68
  export const getAriaAttributeArgTypes = (attrs) => attrs.reduce((acc, curr) => ((acc[kebabToCamelCase(curr)] = { control: 'text', name: curr }), acc), {});
92
- /**
93
- * Copied from https://github.com/ionic-team/ionic-framework/blob/main/core/src/utils/helpers.ts
94
- *
95
- * Returns an array of aria attributes that should be copied from
96
- * the shadow host element to a target within the light DOM.
97
- * @param el The element that the attributes should be copied from.
98
- * @param ignoreList The list of aria-attributes to ignore reflecting and removing from the host.
99
- * Use this in instances where we manually specify aria attributes on the `<Host>` element.
100
- */
101
69
  export const inheritAriaAttributes = (el, ignoreList) => {
102
70
  let attributesToInherit = [...ariaAttributes];
103
71
  if (ignoreList && ignoreList.length > 0) {
@@ -1,4 +1,3 @@
1
- // src/utils/borders/borderUtils.ts
2
1
  import "./borderBox.scss";
3
2
  export const categories = {
4
3
  '-borderWidth-': 'Border width',
@@ -1,4 +1,3 @@
1
- // src/utils/breakpoints/breakpointsUtils.ts
2
1
  import "./breakpointBox.scss";
3
2
  export const categories = {
4
3
  '--ds-breakpoint-': 'Breakpoint',
@@ -1,4 +1,3 @@
1
- // src/utils/colours/colourUtils.ts
2
1
  export const palette = {
3
2
  '--ds-palette-mainBlue': 'Main blue',
4
3
  '--ds-palette-black': 'Grayscale|black',
@@ -1,4 +1,3 @@
1
- // src/utils/colours/colourUtils.ts
2
1
  import scssContentPalette from "!!raw-loader!../../components/00-foundations/colours/_colours.scss";
3
2
  import scssContentSemantic from "!!raw-loader!../../components/00-foundations/colours/_semantic-colours.scss";
4
3
  import "./colourBox.scss";
@@ -23,14 +22,12 @@ const getStyles = (colourType) => {
23
22
  }
24
23
  };
25
24
  export const getColourVariables = (colourType) => {
26
- // Extract CSS variables from the SCSS content
27
25
  const cssVariables = Array.from(getStyles(colourType).matchAll(/--[\w-]+:\s*[^;]+;/g)).map(match => match[0]);
28
26
  const categories = getCategories(colourType);
29
- // Process the extracted variables as needed
30
27
  return cssVariables
31
28
  .map(variable => {
32
29
  const [name, value] = variable.split(':').map(part => part.trim().replace(';', ''));
33
- const cleanName = name.replace(/^--/, ''); // Remove the "--" from the start of the name
30
+ const cleanName = name.replace(/^--/, '');
34
31
  const categoryKey = Object.keys(categories).find(key => name.startsWith(key));
35
32
  if (categoryKey) {
36
33
  return { name: cleanName, variable, value, category: categories[categoryKey] };
@@ -82,7 +79,6 @@ const createCategorySection = (category, colours, renderedCategories) => {
82
79
  };
83
80
  export const createColourContainer = (colourType) => {
84
81
  const container = document.createElement('div');
85
- // Reset the renderedCategories set
86
82
  const renderedCategories = new Set();
87
83
  const categoryNames = [...new Set(Object.values(getCategories(colourType)).map(value => value)), 'Other'];
88
84
  categoryNames.forEach(category => {
@@ -1,4 +1,3 @@
1
- // src/utils/spacing/spacingUtils.ts
2
1
  import "./spacingBox.scss";
3
2
  export const categories = {
4
3
  '--ds-spacing-': 'Spacing',
@@ -71,7 +70,7 @@ export const createCategorySection = (category, spacings, renderedCategories) =>
71
70
  const gridContainer = document.createElement('div');
72
71
  spacings.forEach(spacing => {
73
72
  const remValue = parseFloat(spacing.value);
74
- const pixelValue = remValue * 16; // Assuming 1rem = 16px
73
+ const pixelValue = remValue * 16;
75
74
  gridContainer.appendChild(createSpacingBox(spacing.name, `${spacing.value} / ${pixelValue}px`, spacing.value));
76
75
  });
77
76
  section.appendChild(gridContainer);
@@ -11,10 +11,6 @@ const findWhenRendered = async (customElem, selector, isShadow = true) => {
11
11
  }, { timeout: 5000 });
12
12
  return webc;
13
13
  };
14
- /**
15
- * Utility function for running storybook interaction tests in Shadow DOM containers.
16
- * Logic taken from https://github.com/storybookjs/testing-library/issues/24#issuecomment-1593709872
17
- */
18
14
  export const withinShadowRoot = async (customElem, selector) => {
19
15
  const webc = await findWhenRendered(customElem, selector);
20
16
  return within(webc.shadowRoot);
@@ -1,4 +1,3 @@
1
- // src/utils/typography/typographyUtils.ts
2
1
  import "./typographyBox.scss";
3
2
  export const categories = {
4
3
  '--ds-fontFamily': 'Font family',
@@ -10,7 +9,6 @@ export const categories = {
10
9
  };
11
10
  export const getTypographyVariables = () => {
12
11
  const typographyVariables = [];
13
- // There can be multiple rules so find and combine.
14
12
  const findRootRule = () => {
15
13
  const rootRules = [];
16
14
  for (const sheet of document.styleSheets) {
@@ -1,17 +1,3 @@
1
- /**
2
- * Generates Lorem Ipsum text with configurable options
3
- * @param {Object} options - Configuration options for text generation
4
- * @param {number} [options.paragraphs=1] - Number of paragraphs to generate
5
- * @param {number} [options.wordsPerParagraph=50] - Average number of words per paragraph
6
- * @param {boolean} [options.startWithLorem=true] - Whether to start with "Lorem ipsum dolor sit amet"
7
- * @returns {string} Generated Lorem Ipsum text
8
- *
9
- * Example usage:
10
- * generateLoremIpsum(); // 1 paragraph, starts with Lorem Ipsum
11
- * generateLoremIpsum({ paragraphs: 3, wordsPerParagraph: 30 });
12
- * generateLoremIpsum({ startWithLorem: false });
13
- * generateLoremIpsum({ consistent: true }); // Generate same text everytime
14
- */
15
1
  export function generateLoremIpsum({ paragraphs = 1, wordsPerParagraph = 50, startWithLorem = true, consistent = false } = {}) {
16
2
  const loremWords = [
17
3
  'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit',
@@ -1 +1 @@
1
- import{p as e,b as a}from"./index-1d0a6586.js";export{s as setNonce}from"./index-1d0a6586.js";import{g as i}from"./app-globals-0f993ce5.js";(()=>{const a=import.meta.url,i={};return""!==a&&(i.resourcesUrl=new URL(".",a).href),e(i)})().then((async e=>(await i(),a([["ds-accordion_2",[[1,"ds-accordion",{variant:[1],borderAligned:[4,"border-aligned"],openByDefault:[4,"open-by-default"],accordionId:[1,"accordion-id"],headingLevel:[2,"heading-level"],useCloseButton:[4,"use-close-button"],closeButtonLabel:[1,"close-button-label"],isExpanded:[32]},null,{isExpanded:["watchHandler"]}],[1,"ds-icon",{name:[1],colour:[1],size:[1],title:[1],role:[1],hidden:[4],message:[32]}]]],["ds-button_2",[[6,"ds-button",{value:[1],variant:[1],colour:[1],size:[1],fontWeight:[1,"font-weight"],icon:[1],iconPosition:[1,"icon-position"],type:[1],disabled:[4],ariaDisabled:[1,"aria-disabled"]}],[1,"ds-visually-hidden"]]],["ds-text-input",[[6,"ds-text-input",{label:[1],placeholder:[1],id:[1],name:[1],disabled:[4],required:[4],readonly:[4],value:[1],min:[2],max:[2],maxlength:[2],pattern:[1],autocomplete:[1],errorText:[1,"error-text"],successText:[1,"success-text"],assistiveText:[1,"assistive-text"],actionButtonAriaLabel:[1,"action-button-aria-label"],hiddenAssistiveText:[1,"hidden-assistive-text"],prefixText:[1,"prefix-text"],suffixText:[1,"suffix-text"],icon:[1],type:[1],ariaLabel:[1,"aria-label"],ariaLabelledBy:[1,"aria-labelledby"],ariaDescribedby:[1,"aria-describedby"],hasFocus:[32],clearButtonVisible:[32],passwordInputVisible:[32],inputActive:[32],togglePasswordVisibility:[64],clearInput:[64]}]]]],e))));
1
+ import{p as e,b as i}from"./index-dfeefc7e.js";export{s as setNonce}from"./index-dfeefc7e.js";import{g as t}from"./app-globals-0f993ce5.js";(()=>{const i=import.meta.url,t={};return""!==i&&(t.resourcesUrl=new URL(".",i).href),e(t)})().then((async e=>(await t(),i([["ds-accordion_2",[[1,"ds-accordion",{variant:[1],borderAligned:[4,"border-aligned"],openByDefault:[4,"open-by-default"],accordionId:[1,"accordion-id"],headingLevel:[2,"heading-level"],useCloseButton:[4,"use-close-button"],closeButtonLabel:[1,"close-button-label"],isExpanded:[32]},null,{isExpanded:["watchHandler"]}],[1,"ds-icon",{name:[1],colour:[1],size:[1],title:[1],role:[1],hidden:[4],message:[32]}]]],["ds-button_2",[[6,"ds-button",{value:[1],variant:[1],colour:[1],size:[1],fontWeight:[1,"font-weight"],icon:[1],iconPosition:[1,"icon-position"],type:[1],disabled:[4],ariaDisabled:[1,"aria-disabled"]}],[1,"ds-visually-hidden"]]],["ds-text-input",[[6,"ds-text-input",{label:[1],placeholder:[1],id:[1],name:[1],disabled:[4],required:[4],readonly:[4],value:[1],min:[2],max:[2],maxlength:[2],pattern:[1],autocomplete:[1],errorText:[1,"error-text"],successText:[1,"success-text"],assistiveText:[1,"assistive-text"],actionButtonAriaLabel:[1,"action-button-aria-label"],hiddenAssistiveText:[1,"hidden-assistive-text"],prefixText:[1,"prefix-text"],suffixText:[1,"suffix-text"],icon:[1],type:[1],ariaLabel:[1,"aria-label"],ariaLabelledBy:[1,"aria-labelledby"],ariaDescribedby:[1,"aria-describedby"],hasFocus:[32],clearButtonVisible:[32],passwordInputVisible:[32],inputActive:[32],togglePasswordVisibility:[64],clearInput:[64]}]]]],e))));