@uh-design-system/component-library 0.2.1 → 0.2.2-alpha.2

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 (31) hide show
  1. package/dist/cjs/component-library.cjs.js +1 -1
  2. package/dist/cjs/ds-accordion_2.cjs.entry.js +35 -32
  3. package/dist/cjs/ds-button_2.cjs.entry.js +54 -51
  4. package/dist/cjs/ds-text-input.cjs.entry.js +48 -25
  5. package/dist/cjs/{index-d03b8350.js → index-fd4f6cd2.js} +28 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +27 -27
  8. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +6 -1
  9. package/dist/collection/components/01-base-components/ds-button/ds-button.js +53 -51
  10. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +29 -9
  11. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +7 -7
  12. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +47 -26
  13. package/dist/collection/utils/typography/typographyUtils.js +1 -1
  14. package/dist/component-library/component-library.esm.js +1 -1
  15. package/dist/component-library/ds-accordion_2.entry.js +1 -1
  16. package/dist/component-library/ds-button_2.entry.js +1 -1
  17. package/dist/component-library/ds-text-input.entry.js +1 -1
  18. package/dist/component-library/index-4200d514.js +2 -0
  19. package/dist/components/ds-accordion.js +27 -26
  20. package/dist/components/ds-button2.js +53 -50
  21. package/dist/components/ds-icon2.js +7 -5
  22. package/dist/components/ds-text-input.js +47 -24
  23. package/dist/components/index2.js +28 -1
  24. package/dist/esm/component-library.js +2 -2
  25. package/dist/esm/ds-accordion_2.entry.js +35 -32
  26. package/dist/esm/ds-button_2.entry.js +54 -51
  27. package/dist/esm/ds-text-input.entry.js +48 -25
  28. package/dist/esm/{index-dfeefc7e.js → index-4200d514.js} +28 -1
  29. package/dist/esm/loader.js +2 -2
  30. package/package.json +2 -2
  31. package/dist/component-library/index-dfeefc7e.js +0 -2
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d03b8350.js');
5
+ const index = require('./index-fd4f6cd2.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d03b8350.js');
5
+ const index = require('./index-fd4f6cd2.js');
6
6
  const index$1 = require('./index-5b0b9d4c.js');
7
7
 
8
8
  const dsAccordionCss = ".ds-accordion__open-button{color:var(--ds-textColor-default, #1A1A1A);all:unset;box-sizing:border-box;display:flex;flex-direction:row;gap:8px;width:100%}.ds-accordion__open-button:hover{cursor:pointer;background:var(--ds-bgColor-transparent-onLight-hover, rgba(0, 0, 0, 0.1019607843))}.ds-accordion__open-button:hover.ds-accordion--border-aligned{padding-inline:16px;margin-inline:0}.ds-accordion__open-button:active{background:var(--ds-bgColor-transparent-onLight-active, rgba(0, 0, 0, 0.1490196078))}.ds-accordion__open-button:active.ds-accordion--border-aligned{padding-inline:16px;margin-inline:0}.ds-accordion__open-button:focus{background:var(--ds-bgColor-transparent-onLight-hover, rgba(0, 0, 0, 0.1019607843));box-shadow:0px 0px 0px 1px var(--ds-palette-black)}.ds-accordion__open-button:focus.ds-accordion--border-aligned{padding-inline:16px;margin-inline:0}.ds-accordion__open-button.ds-accordion--default{padding:16px;font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-18);font-weight:600;line-height:27px;letter-spacing:var(--letterSpacing-wide)}.ds-accordion__open-button.ds-accordion--compact{font-size:var(--ds-fontSize-16);padding:12px 16px 12px 16px;line-height:24px;font-weight:600}.ds-accordion__open-button.ds-accordion--border-aligned{padding-inline:0;padding-inline:0;margin-inline:16px}.ds-accordion__open-button[aria-expanded=false]{border-bottom:1px solid var(--ds-borderColor-light, #CCCCCC)}.ds-accordion__panel--expanded{border-bottom:1px solid var(--ds-borderColor-light, #CCCCCC)}.ds-accordion__content{color:var(--ds-textColor-default, #1A1A1A);font-family:var(--ds-fontFamily-body);padding:16px}.ds-accordion__content .ds-accordion--default{font-size:var(--ds-fontSize-18);font-weight:400;line-height:27px;letter-spacing:var(--ds-letterSpacing-wide)}.ds-accordion__content .ds-accordion--compact{font-size:var(--fontSize-16);font-weight:400;line-height:24px;letter-spacing:var(--letterSpacing-wide)}.ds-accordion__close-button{color:var(--ds-textColor-default, #1A1A1A);all:unset;border-bottom:1px solid var(--ds-borderColor-light, #CCCCCC);display:flex;flex-direction:row;gap:8px;font-family:var(--ds-fontFamily-body);letter-spacing:var(--ds-letterSpacing-wide);width:100%}.ds-accordion__close-button:hover{cursor:pointer;background:var(--ds-bgColor-transparent-onLight-hover, rgba(0, 0, 0, 0.1019607843))}.ds-accordion__close-button:hover.ds-accordion--border-aligned{padding-inline:16px;margin-inline:0}.ds-accordion__close-button:active{background:var(--ds-bgColor-transparent-onLight-active, rgba(0, 0, 0, 0.1490196078))}.ds-accordion__close-button:active.ds-accordion--border-aligned{padding-inline:16px;margin-inline:0}.ds-accordion__close-button:focus{background:var(--ds-bgColor-transparent-onLight-hover, rgba(0, 0, 0, 0.1019607843));box-shadow:0px 0px 0px 1px var(--ds-palette-black)}.ds-accordion__close-button:focus.ds-accordion--border-aligned{padding-inline:16px;margin-inline:0}.ds-accordion__close-button.ds-accordion--default{padding:16px;font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-18);font-weight:600;line-height:27px;letter-spacing:var(--letterSpacing-wide)}.ds-accordion__close-button.ds-accordion--compact{font-size:var(--ds-fontSize-16);padding:12px 16px 12px 16px;line-height:24px;font-weight:600}.ds-accordion__close-button.ds-accordion--border-aligned{padding-inline:0;padding-inline:0;margin-inline:16px}";
@@ -11,38 +11,40 @@ const DsAccordionStyle0 = dsAccordionCss;
11
11
  const DsAccordion = class {
12
12
  constructor(hostRef) {
13
13
  index.registerInstance(this, hostRef);
14
- this.variant = 'default';
15
- this.borderAligned = false;
16
- this.openByDefault = false;
17
- this.accordionId = 'dsaccordion';
18
- this.headingLevel = 2;
19
- this.useCloseButton = false;
20
- this.closeButtonLabel = 'Close';
21
- this.isExpanded = this.openByDefault;
22
- this.shouldMoveFocus = false;
23
- this.handleClick = (event) => {
24
- const isCloseButton = event.target.closest('.ds-accordion__close-button');
25
- this.shouldMoveFocus = isCloseButton ? true : false;
26
- this.isExpanded = !this.isExpanded;
27
- };
28
- this.handleKeyDown = (event) => {
29
- switch (event.key) {
30
- case 'Enter':
31
- case ' ':
32
- event.preventDefault();
33
- const isCloseButton = event.target.closest('.ds-accordion__close-button');
34
- this.shouldMoveFocus = isCloseButton ? true : false;
35
- this.isExpanded = !this.isExpanded;
36
- break;
37
- }
38
- };
39
14
  }
15
+ variant = 'default';
16
+ borderAligned = false;
17
+ openByDefault = false;
18
+ accordionId = 'dsaccordion';
19
+ headingLevel = 2;
20
+ useCloseButton = false;
21
+ closeButtonLabel = 'Close';
22
+ isExpanded = this.openByDefault;
23
+ get host() { return index.getElement(this); }
24
+ headerButtonRef;
25
+ shouldMoveFocus = false;
40
26
  watchHandler(isExpanded) {
41
27
  if (!isExpanded && this.shouldMoveFocus && this.headerButtonRef) {
42
28
  this.headerButtonRef.focus();
43
29
  this.shouldMoveFocus = false;
44
30
  }
45
31
  }
32
+ handleClick = (event) => {
33
+ const isCloseButton = event.target.closest('.ds-accordion__close-button');
34
+ this.shouldMoveFocus = isCloseButton ? true : false;
35
+ this.isExpanded = !this.isExpanded;
36
+ };
37
+ handleKeyDown = (event) => {
38
+ switch (event.key) {
39
+ case 'Enter':
40
+ case ' ':
41
+ event.preventDefault();
42
+ const isCloseButton = event.target.closest('.ds-accordion__close-button');
43
+ this.shouldMoveFocus = isCloseButton ? true : false;
44
+ this.isExpanded = !this.isExpanded;
45
+ break;
46
+ }
47
+ };
46
48
  render() {
47
49
  return (index.h("div", { key: '2cc1b7c39897a2437b1c1b2a2dda3c73366f2406', class: index$1.classNames('ds-accordion', `ds-accordion--${this.variant}`, {
48
50
  'ds-accordion--border-aligned': this.borderAligned
@@ -55,7 +57,6 @@ const DsAccordion = class {
55
57
  'ds-accordion--border-aligned': this.borderAligned
56
58
  }), "aria-labelledby": `${this.accordionId}-close-button ${this.accordionId}`, id: `${this.accordionId}-close-button`, onClick: this.handleClick, onKeyDown: this.handleKeyDown }, index.h("ds-icon", { key: '295bb76f0130566900081b90e5d80033bbe9758f', hidden: true, name: "keyboard_arrow_up" }), index.h("span", { key: '90dcf29559c485707ea8517e0056249027b1e45b' }, this.closeButtonLabel))))));
57
59
  }
58
- get host() { return index.getElement(this); }
59
60
  static get watchers() { return {
60
61
  "isExpanded": ["watchHandler"]
61
62
  }; }
@@ -852,12 +853,14 @@ const DsIconStyle0 = dsIconCss;
852
853
  const DsIcon = class {
853
854
  constructor(hostRef) {
854
855
  index.registerInstance(this, hostRef);
855
- this.size = '1.5rem';
856
- this.title = 'Icon';
857
- this.role = 'img';
858
- this.hidden = true;
859
- this.message = '';
860
856
  }
857
+ name;
858
+ colour;
859
+ size = '1.5rem';
860
+ title = 'Icon';
861
+ role = 'img';
862
+ hidden = true;
863
+ message = '';
861
864
  getIcon() {
862
865
  const selectedIcon = icons.find(icon => icon.name === this.name);
863
866
  if (!selectedIcon) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d03b8350.js');
5
+ const index = require('./index-fd4f6cd2.js');
6
6
  const index$1 = require('./index-5b0b9d4c.js');
7
7
 
8
8
  const inheritAttributes = (el, attributes = []) => {
@@ -85,58 +85,62 @@ const DsButtonStyle0 = dsButtonCss;
85
85
  const DsButton = class {
86
86
  constructor(hostRef) {
87
87
  index.registerInstance(this, hostRef);
88
- this.inheritedAttributes = {};
89
- this.pressedKeys = new Set();
90
- this.value = '';
91
- this.variant = 'primary';
92
- this.colour = 'blue';
93
- this.size = 'medium';
94
- this.fontWeight = 'normal';
95
- this.icon = '';
96
- this.iconPosition = 'start';
97
- this.type = 'button';
98
- this.disabled = false;
99
- this.ariaDisabled = 'false';
100
- this.handleKeyDown = (event) => {
101
- if (event.repeat) {
102
- return;
103
- }
104
- switch (event.key) {
105
- case 'Enter':
106
- case ' ':
107
- this.pressedKeys.add(event.key);
108
- this.buttonEl.classList.add(`${this.colour}--active`);
109
- break;
110
- }
111
- };
112
- this.handleKeyUp = (event) => {
113
- switch (event.key) {
114
- case 'Enter':
115
- case ' ':
116
- this.pressedKeys.delete(event.key);
117
- if (this.pressedKeys.size === 0) {
118
- this.buttonEl.classList.remove(`${this.colour}--active`);
119
- }
120
- break;
121
- }
122
- };
123
88
  }
89
+ inheritedAttributes = {};
90
+ buttonEl;
91
+ pressedKeys = new Set();
92
+ get el() { return index.getElement(this); }
93
+ value = '';
94
+ variant = 'primary';
95
+ colour = 'blue';
96
+ size = 'medium';
97
+ fontWeight = 'normal';
98
+ icon = '';
99
+ iconPosition = 'start';
100
+ type = 'button';
101
+ disabled = false;
102
+ ariaDisabled = 'false';
124
103
  componentWillLoad() {
125
- this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el, ['aria-disabled'])), inheritAttributes(this.el, [
126
- 'autofocus',
127
- 'form',
128
- 'formaction',
129
- 'formenctype',
130
- 'formmethod',
131
- 'formnovalidate',
132
- 'formtarget',
133
- 'name',
134
- 'popovertarget',
135
- 'popovertargetaction',
136
- ]));
104
+ this.inheritedAttributes = {
105
+ ...inheritAriaAttributes(this.el, ['aria-disabled']),
106
+ ...inheritAttributes(this.el, [
107
+ 'autofocus',
108
+ 'form',
109
+ 'formaction',
110
+ 'formenctype',
111
+ 'formmethod',
112
+ 'formnovalidate',
113
+ 'formtarget',
114
+ 'name',
115
+ 'popovertarget',
116
+ 'popovertargetaction',
117
+ ]),
118
+ };
137
119
  }
120
+ handleKeyDown = (event) => {
121
+ if (event.repeat) {
122
+ return;
123
+ }
124
+ switch (event.key) {
125
+ case 'Enter':
126
+ case ' ':
127
+ this.pressedKeys.add(event.key);
128
+ this.buttonEl.classList.add(`${this.colour}--active`);
129
+ break;
130
+ }
131
+ };
132
+ handleKeyUp = (event) => {
133
+ switch (event.key) {
134
+ case 'Enter':
135
+ case ' ':
136
+ this.pressedKeys.delete(event.key);
137
+ if (this.pressedKeys.size === 0) {
138
+ this.buttonEl.classList.remove(`${this.colour}--active`);
139
+ }
140
+ break;
141
+ }
142
+ };
138
143
  render() {
139
- console.log('render');
140
144
  const classes = index$1.classNames(`${this.variant} ${this.colour} ${this.size}`, {
141
145
  'icon-start': this.icon && this.iconPosition === 'start' && this.value,
142
146
  'icon-end': this.icon && this.iconPosition === 'end' && this.value,
@@ -144,9 +148,8 @@ const DsButton = class {
144
148
  });
145
149
  const iconSize = this.size === 'small' ? '1rem' : undefined;
146
150
  const isDisabled = this.disabled || this.ariaDisabled === 'true';
147
- return (index.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), index.h("slot", { key: 'c21dc9317ae1970d8e5fcead12b4041a8dc13af0', name: "prefix" }, this.icon && this.iconPosition === 'start' && index.h("ds-icon", { key: 'cc993dd0b2a12b3243bc8863d754a0efa3b6f1f4', name: this.icon, size: iconSize })), this.value && index.h("span", { key: 'b8a7bcac21782fd898192d98c605c0eacbfff882', class: "button-value" }, this.value), index.h("slot", { key: 'e4766fc18983798416533173ceddcbe3c80779ba', name: "suffix" }, this.icon && this.iconPosition === 'end' && index.h("ds-icon", { key: 'f308fb96c0b0b06036975df25fc5fba59dffe301', name: this.icon, size: iconSize }))));
151
+ return (index.h("button", { 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 }, index.h("slot", { key: 'bb67886e636e7a5294a6fbbde4a8a013e1ace3ce', name: "prefix" }, this.icon && this.iconPosition === 'start' && index.h("ds-icon", { key: '6e93f6095ee4482d5026b42a67b7591712206146', name: this.icon, size: iconSize })), this.value && index.h("span", { key: '833424437f89ace4253e9daef6d8cda409563a4a', class: "button-value" }, this.value), index.h("slot", { key: '162e459206000c3b1b5b4ede761f5600f88b3de1', name: "suffix" }, this.icon && this.iconPosition === 'end' && index.h("ds-icon", { key: '2e9bff6bdc4d5023374916bcbdc11151270113b6', name: this.icon, size: iconSize }))));
148
152
  }
149
- get el() { return index.getElement(this); }
150
153
  };
151
154
  DsButton.style = DsButtonStyle0;
152
155
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d03b8350.js');
5
+ const index = require('./index-fd4f6cd2.js');
6
6
  const index$1 = require('./index-5b0b9d4c.js');
7
7
 
8
8
  function* idGenerator(id) {
@@ -29,29 +29,42 @@ const errorTextIdGenerator = idGenerator('error-text');
29
29
  const DsTextInput = class {
30
30
  constructor(hostRef) {
31
31
  index.registerInstance(this, hostRef);
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.id = 'input';
37
- this.icon = '';
38
- this.type = 'text';
39
- this.hasFocus = false;
40
- this.clearButtonVisible = false;
41
- this.passwordInputVisible = false;
42
- this.inputActive = false;
43
- this.onActionButtonClicked = (e) => {
44
- e.stopPropagation();
45
- switch (this.type) {
46
- case 'password':
47
- return this.togglePasswordVisibility();
48
- case 'search':
49
- this.clearInput();
50
- default:
51
- return;
52
- }
53
- };
54
32
  }
33
+ suffixButtonElement;
34
+ inputElement;
35
+ assistiveTextId = assistiveTextIdGenerator.next().value;
36
+ visuallyHiddenAssistiveTextId = visuallyHiddenAssistiveTextIdGenerator.next().value;
37
+ successTextId = successTextIdGenerator.next().value;
38
+ errorTextId = errorTextIdGenerator.next().value;
39
+ label;
40
+ placeholder;
41
+ id = 'input';
42
+ name;
43
+ disabled;
44
+ required;
45
+ readonly;
46
+ value;
47
+ min;
48
+ max;
49
+ maxlength;
50
+ pattern;
51
+ autocomplete;
52
+ errorText;
53
+ successText;
54
+ assistiveText;
55
+ actionButtonAriaLabel;
56
+ hiddenAssistiveText;
57
+ prefixText;
58
+ suffixText;
59
+ icon = '';
60
+ type = 'text';
61
+ ariaLabel;
62
+ ariaLabelledBy;
63
+ ariaDescribedby;
64
+ hasFocus = false;
65
+ clearButtonVisible = false;
66
+ passwordInputVisible = false;
67
+ inputActive = false;
55
68
  async togglePasswordVisibility() {
56
69
  return (this.passwordInputVisible = !this.passwordInputVisible);
57
70
  }
@@ -60,6 +73,17 @@ const DsTextInput = class {
60
73
  this.inputElement.focus();
61
74
  this.clearButtonVisible = false;
62
75
  }
76
+ onActionButtonClicked = (e) => {
77
+ e.stopPropagation();
78
+ switch (this.type) {
79
+ case 'password':
80
+ return this.togglePasswordVisibility();
81
+ case 'search':
82
+ this.clearInput();
83
+ default:
84
+ return;
85
+ }
86
+ };
63
87
  renderValidityMessage(type) {
64
88
  const textId = type === 'success' ? this.successTextId : this.errorTextId;
65
89
  const text = type === 'success' ? this.successText : this.errorText;
@@ -78,11 +102,10 @@ const DsTextInput = class {
78
102
  return null;
79
103
  }
80
104
  renderSuffixContent() {
81
- var _a, _b;
82
105
  if (this.suffixText) {
83
106
  return (index.h("slot", { name: "suffix" }, index.h("span", { class: "suffix" }, this.suffixText)));
84
107
  }
85
- 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 actionButtonIcon = INPUT_TYPE_ACTION_BUTTON_ICON_MAP[this.type]?.(this) ?? '';
86
109
  const ariaPressed = this.type === 'password' ? this.passwordInputVisible : undefined;
87
110
  if (actionButtonIcon) {
88
111
  return (index.h("slot", { name: "suffix" }, index.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 })));
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'component-library';
24
- const BUILD = /* component-library */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
24
+ const BUILD = /* component-library */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, modernPropertyDecls: true, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
25
25
 
26
26
  /*
27
27
  Stencil Client Platform v4.25.1 | MIT Licensed | https://stenciljs.com
@@ -32,11 +32,38 @@ var __export = (target, all) => {
32
32
  __defProp(target, name, { get: all[name], enumerable: true });
33
33
  };
34
34
 
35
+ // src/utils/es2022-rewire-class-members.ts
36
+ var reWireGetterSetter = (instance, hostRef) => {
37
+ var _a;
38
+ const cmpMeta = hostRef.$cmpMeta$;
39
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
40
+ members.map(([memberName, [memberFlags]]) => {
41
+ if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
42
+ const ogValue = instance[memberName];
43
+ const ogDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(instance), memberName);
44
+ Object.defineProperty(instance, memberName, {
45
+ get() {
46
+ return ogDescriptor.get.call(this);
47
+ },
48
+ set(newValue) {
49
+ ogDescriptor.set.call(this, newValue);
50
+ },
51
+ configurable: true,
52
+ enumerable: true
53
+ });
54
+ instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
55
+ }
56
+ });
57
+ };
58
+
35
59
  // src/client/client-host-ref.ts
36
60
  var hostRefs = /* @__PURE__ */ new WeakMap();
37
61
  var getHostRef = (ref) => hostRefs.get(ref);
38
62
  var registerInstance = (lazyInstance, hostRef) => {
39
63
  hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
64
+ {
65
+ reWireGetterSetter(lazyInstance, hostRef);
66
+ }
40
67
  };
41
68
  var registerHost = (hostElement, cmpMeta) => {
42
69
  const hostRef = {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d03b8350.js');
5
+ const index = require('./index-fd4f6cd2.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
@@ -1,39 +1,39 @@
1
1
  import { h } from "@stencil/core";
2
2
  import classNames from "classnames";
3
3
  export class DsAccordion {
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;
13
- this.shouldMoveFocus = false;
14
- this.handleClick = (event) => {
15
- const isCloseButton = event.target.closest('.ds-accordion__close-button');
16
- this.shouldMoveFocus = isCloseButton ? true : false;
17
- this.isExpanded = !this.isExpanded;
18
- };
19
- this.handleKeyDown = (event) => {
20
- switch (event.key) {
21
- case 'Enter':
22
- case ' ':
23
- event.preventDefault();
24
- const isCloseButton = event.target.closest('.ds-accordion__close-button');
25
- this.shouldMoveFocus = isCloseButton ? true : false;
26
- this.isExpanded = !this.isExpanded;
27
- break;
28
- }
29
- };
30
- }
4
+ variant = 'default';
5
+ borderAligned = false;
6
+ openByDefault = false;
7
+ accordionId = 'dsaccordion';
8
+ headingLevel = 2;
9
+ useCloseButton = false;
10
+ closeButtonLabel = 'Close';
11
+ isExpanded = this.openByDefault;
12
+ host;
13
+ headerButtonRef;
14
+ shouldMoveFocus = false;
31
15
  watchHandler(isExpanded) {
32
16
  if (!isExpanded && this.shouldMoveFocus && this.headerButtonRef) {
33
17
  this.headerButtonRef.focus();
34
18
  this.shouldMoveFocus = false;
35
19
  }
36
20
  }
21
+ handleClick = (event) => {
22
+ const isCloseButton = event.target.closest('.ds-accordion__close-button');
23
+ this.shouldMoveFocus = isCloseButton ? true : false;
24
+ this.isExpanded = !this.isExpanded;
25
+ };
26
+ handleKeyDown = (event) => {
27
+ switch (event.key) {
28
+ case 'Enter':
29
+ case ' ':
30
+ event.preventDefault();
31
+ const isCloseButton = event.target.closest('.ds-accordion__close-button');
32
+ this.shouldMoveFocus = isCloseButton ? true : false;
33
+ this.isExpanded = !this.isExpanded;
34
+ break;
35
+ }
36
+ };
37
37
  render() {
38
38
  return (h("div", { key: '2cc1b7c39897a2437b1c1b2a2dda3c73366f2406', class: classNames('ds-accordion', `ds-accordion--${this.variant}`, {
39
39
  'ds-accordion--border-aligned': this.borderAligned
@@ -77,7 +77,12 @@ export const Playground = {
77
77
  },
78
78
  },
79
79
  };
80
- Playground.args = Object.assign(Object.assign({}, Default.args), { Header: exampleHeader, Content: exampleContent, Items: 3 });
80
+ Playground.args = {
81
+ ...Default.args,
82
+ Header: exampleHeader,
83
+ Content: exampleContent,
84
+ Items: 3,
85
+ };
81
86
  Playground.render = (args) => {
82
87
  const accordions = Array.from({ length: args.Items }, (_, index) => `
83
88
  <ds-accordion
@@ -2,59 +2,61 @@ import { h } from "@stencil/core";
2
2
  import classNames from "classnames";
3
3
  import { inheritAriaAttributes, inheritAttributes } from "../../../utils/attributes";
4
4
  export class DsButton {
5
- constructor() {
6
- this.inheritedAttributes = {};
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';
18
- this.handleKeyDown = (event) => {
19
- if (event.repeat) {
20
- return;
21
- }
22
- switch (event.key) {
23
- case 'Enter':
24
- case ' ':
25
- this.pressedKeys.add(event.key);
26
- this.buttonEl.classList.add(`${this.colour}--active`);
27
- break;
28
- }
29
- };
30
- this.handleKeyUp = (event) => {
31
- switch (event.key) {
32
- case 'Enter':
33
- case ' ':
34
- this.pressedKeys.delete(event.key);
35
- if (this.pressedKeys.size === 0) {
36
- this.buttonEl.classList.remove(`${this.colour}--active`);
37
- }
38
- break;
39
- }
40
- };
41
- }
5
+ inheritedAttributes = {};
6
+ buttonEl;
7
+ pressedKeys = new Set();
8
+ el;
9
+ value = '';
10
+ variant = 'primary';
11
+ colour = 'blue';
12
+ size = 'medium';
13
+ fontWeight = 'normal';
14
+ icon = '';
15
+ iconPosition = 'start';
16
+ type = 'button';
17
+ disabled = false;
18
+ ariaDisabled = 'false';
42
19
  componentWillLoad() {
43
- this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el, ['aria-disabled'])), inheritAttributes(this.el, [
44
- 'autofocus',
45
- 'form',
46
- 'formaction',
47
- 'formenctype',
48
- 'formmethod',
49
- 'formnovalidate',
50
- 'formtarget',
51
- 'name',
52
- 'popovertarget',
53
- 'popovertargetaction',
54
- ]));
20
+ this.inheritedAttributes = {
21
+ ...inheritAriaAttributes(this.el, ['aria-disabled']),
22
+ ...inheritAttributes(this.el, [
23
+ 'autofocus',
24
+ 'form',
25
+ 'formaction',
26
+ 'formenctype',
27
+ 'formmethod',
28
+ 'formnovalidate',
29
+ 'formtarget',
30
+ 'name',
31
+ 'popovertarget',
32
+ 'popovertargetaction',
33
+ ]),
34
+ };
55
35
  }
36
+ handleKeyDown = (event) => {
37
+ if (event.repeat) {
38
+ return;
39
+ }
40
+ switch (event.key) {
41
+ case 'Enter':
42
+ case ' ':
43
+ this.pressedKeys.add(event.key);
44
+ this.buttonEl.classList.add(`${this.colour}--active`);
45
+ break;
46
+ }
47
+ };
48
+ handleKeyUp = (event) => {
49
+ switch (event.key) {
50
+ case 'Enter':
51
+ case ' ':
52
+ this.pressedKeys.delete(event.key);
53
+ if (this.pressedKeys.size === 0) {
54
+ this.buttonEl.classList.remove(`${this.colour}--active`);
55
+ }
56
+ break;
57
+ }
58
+ };
56
59
  render() {
57
- console.log('render');
58
60
  const classes = classNames(`${this.variant} ${this.colour} ${this.size}`, {
59
61
  'icon-start': this.icon && this.iconPosition === 'start' && this.value,
60
62
  'icon-end': this.icon && this.iconPosition === 'end' && this.value,
@@ -62,7 +64,7 @@ export class DsButton {
62
64
  });
63
65
  const iconSize = this.size === 'small' ? '1rem' : undefined;
64
66
  const isDisabled = this.disabled || this.ariaDisabled === 'true';
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
+ return (h("button", { 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 }))));
66
68
  }
67
69
  static get is() { return "ds-button"; }
68
70
  static get encapsulation() { return "scoped"; }