@uh-design-system/component-library 0.1.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 (196) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +0 -2
  2. package/dist/cjs/component-library.cjs.js +25 -0
  3. package/dist/cjs/ds-accordion_2.cjs.entry.js +904 -0
  4. package/dist/cjs/ds-button_2.cjs.entry.js +167 -0
  5. package/dist/cjs/ds-text-input.cjs.entry.js +115 -0
  6. package/dist/cjs/index-5b0b9d4c.js +82 -0
  7. package/dist/cjs/{index-eaf5876c.js → index-d03b8350.js} +622 -66
  8. package/dist/cjs/index.cjs.js +0 -9
  9. package/dist/cjs/loader.cjs.js +2 -4
  10. package/dist/collection/collection-manifest.json +6 -2
  11. package/dist/collection/components/00-foundations/borders/borders.stories.js +7 -9
  12. package/dist/collection/components/00-foundations/breakpoints/breakpoints.stories.js +18 -0
  13. package/dist/collection/components/00-foundations/colours/colours.stories.js +9 -17
  14. package/dist/collection/components/00-foundations/icons/categories/actions.js +107 -0
  15. package/dist/collection/components/00-foundations/icons/categories/arrows.js +61 -0
  16. package/dist/collection/components/00-foundations/icons/categories/custom.js +7 -0
  17. package/dist/collection/components/00-foundations/icons/categories/information.js +91 -0
  18. package/dist/collection/components/00-foundations/icons/categories/media.js +73 -0
  19. package/dist/collection/components/00-foundations/icons/categories/navigation.js +47 -0
  20. package/dist/collection/components/00-foundations/icons/categories/notifications.js +61 -0
  21. package/dist/collection/components/00-foundations/icons/categories/text.js +15 -0
  22. package/dist/collection/components/00-foundations/icons/categories/users.js +49 -0
  23. package/dist/collection/components/00-foundations/icons/iconList.js +18 -294
  24. package/dist/collection/components/00-foundations/icons/icons.stories.js +0 -4
  25. package/dist/collection/components/00-foundations/spacing/spacing.stories.js +2 -5
  26. package/dist/collection/components/00-foundations/typography/typography.stories.js +52 -5
  27. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +130 -0
  28. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +217 -0
  29. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.js +43 -0
  30. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.js +79 -0
  31. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +96 -0
  32. package/dist/collection/components/01-base-components/ds-button/ds-button.css +238 -0
  33. package/dist/collection/components/01-base-components/ds-button/ds-button.js +293 -0
  34. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +27 -0
  35. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +77 -0
  36. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +74 -0
  37. package/dist/collection/components/01-base-components/ds-icon/ds-icon.css +1 -1
  38. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +18 -13
  39. package/dist/collection/components/01-base-components/ds-icon/ds-icon.stories.js +1 -2
  40. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +186 -0
  41. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.examples.stories.js +24 -0
  42. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.features.stories.js +126 -0
  43. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +643 -0
  44. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.stories.js +73 -0
  45. package/dist/collection/components/01-base-components/ds-text-input/utils.js +16 -0
  46. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.css +9 -0
  47. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +18 -0
  48. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.stories.js +9 -0
  49. package/dist/collection/index.js +1 -11
  50. package/dist/collection/utils/attributes.js +75 -0
  51. package/dist/collection/utils/borders/borderUtils.js +24 -5
  52. package/dist/collection/utils/breakpoints/breakpointsUtils.js +57 -0
  53. package/dist/collection/utils/colours/colourTypes.js +18 -0
  54. package/dist/collection/utils/colours/colourUtils.js +64 -48
  55. package/dist/collection/utils/spacing/spacingUtils.js +22 -11
  56. package/dist/collection/utils/tests/testUtils.js +19 -8
  57. package/dist/collection/utils/typography/typographyUtils.js +0 -3
  58. package/dist/collection/utils/utils.js +34 -3
  59. package/dist/component-library/app-globals-0f993ce5.js +1 -0
  60. package/dist/component-library/component-library.esm.js +1 -0
  61. package/dist/component-library/ds-accordion_2.entry.js +1 -0
  62. package/dist/component-library/ds-button_2.entry.js +1 -0
  63. package/dist/component-library/ds-text-input.entry.js +1 -0
  64. package/dist/component-library/index-72ac5051.js +6 -0
  65. package/dist/component-library/index-dfeefc7e.js +2 -0
  66. package/dist/component-library/index.esm.js +0 -0
  67. package/dist/components/ds-accordion.d.ts +11 -0
  68. package/dist/components/ds-accordion.js +96 -0
  69. package/dist/components/ds-button.d.ts +11 -0
  70. package/dist/components/ds-button.js +6 -0
  71. package/dist/components/ds-button2.js +180 -0
  72. package/dist/components/ds-icon.js +1 -540
  73. package/dist/components/ds-icon2.js +864 -0
  74. package/dist/components/ds-text-input.d.ts +11 -0
  75. package/dist/components/ds-text-input.js +178 -0
  76. package/dist/components/ds-visually-hidden.d.ts +11 -0
  77. package/dist/components/ds-visually-hidden.js +6 -0
  78. package/dist/components/ds-visually-hidden2.js +31 -0
  79. package/dist/components/index.js +1 -9
  80. package/dist/components/{p-dcfb6eb2.js → index2.js} +562 -53
  81. package/dist/components/index3.js +80 -0
  82. package/dist/esm/app-globals-0f993ce5.js +0 -2
  83. package/dist/esm/component-library.js +20 -0
  84. package/dist/esm/ds-accordion_2.entry.js +899 -0
  85. package/dist/esm/ds-button_2.entry.js +162 -0
  86. package/dist/esm/ds-text-input.entry.js +111 -0
  87. package/dist/esm/index-72ac5051.js +80 -0
  88. package/dist/esm/{index-1586ada2.js → index-dfeefc7e.js} +622 -67
  89. package/dist/esm/index.js +0 -6
  90. package/dist/esm/loader.js +3 -5
  91. package/dist/loader/cdn.js +1 -0
  92. package/dist/loader/index.cjs.js +1 -0
  93. package/{loader → dist/loader}/index.d.ts +1 -1
  94. package/dist/loader/index.es2017.js +1 -0
  95. package/{loader → dist/loader}/index.js +1 -1
  96. package/{loader → dist/loader}/package.json +1 -1
  97. package/dist/types/components/00-foundations/breakpoints/breakpoints.stories.d.ts +6 -0
  98. package/dist/types/components/00-foundations/colours/colours.stories.d.ts +3 -2
  99. package/dist/types/components/00-foundations/icons/categories/actions.d.ts +5 -0
  100. package/dist/types/components/00-foundations/icons/categories/arrows.d.ts +5 -0
  101. package/dist/types/components/00-foundations/icons/categories/custom.d.ts +5 -0
  102. package/dist/types/components/00-foundations/icons/categories/information.d.ts +5 -0
  103. package/dist/types/components/00-foundations/icons/categories/media.d.ts +5 -0
  104. package/dist/types/components/00-foundations/icons/categories/navigation.d.ts +5 -0
  105. package/dist/types/components/00-foundations/icons/categories/notifications.d.ts +5 -0
  106. package/dist/types/components/00-foundations/icons/categories/text.d.ts +5 -0
  107. package/dist/types/components/00-foundations/icons/categories/users.d.ts +5 -0
  108. package/dist/types/components/00-foundations/typography/typography.stories.d.ts +6 -5
  109. package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +17 -0
  110. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.d.ts +8 -0
  111. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.d.ts +12 -0
  112. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.stories.d.ts +7 -0
  113. package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +20 -0
  114. package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +6 -0
  115. package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +16 -0
  116. package/dist/types/components/01-base-components/ds-button/stories/ds-button.stories.d.ts +7 -0
  117. package/dist/types/components/01-base-components/ds-icon/ds-icon.stories.d.ts +0 -1
  118. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +46 -0
  119. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.examples.stories.d.ts +7 -0
  120. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.features.stories.d.ts +17 -0
  121. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.stories.d.ts +7 -0
  122. package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +3 -0
  123. package/dist/types/components/01-base-components/ds-visually-hidden/ds-visually-hidden.d.ts +3 -0
  124. package/dist/types/components/01-base-components/ds-visually-hidden/ds-visually-hidden.stories.d.ts +6 -0
  125. package/dist/types/components.d.ts +152 -0
  126. package/dist/types/declarations.d.ts +4 -0
  127. package/dist/types/index.d.ts +0 -10
  128. package/dist/types/utils/attributes.d.ts +8 -0
  129. package/dist/types/utils/borders/borderUtils.d.ts +9 -0
  130. package/dist/types/utils/breakpoints/breakpointsUtils.d.ts +11 -0
  131. package/dist/types/utils/colours/colourTypes.d.ts +18 -0
  132. package/dist/types/utils/colours/colourUtils.d.ts +4 -14
  133. package/dist/types/utils/spacing/spacingUtils.d.ts +6 -3
  134. package/dist/types/utils/tests/testUtils.d.ts +2 -4
  135. package/dist/types/utils/utils.d.ts +6 -1
  136. package/package.json +12 -22
  137. package/README.md +0 -12
  138. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  139. package/dist/cjs/ds-icon.cjs.entry.js +0 -522
  140. package/dist/cjs/ds-icon.cjs.entry.js.map +0 -1
  141. package/dist/cjs/index-eaf5876c.js.map +0 -1
  142. package/dist/cjs/index.cjs.js.map +0 -1
  143. package/dist/cjs/loader.cjs.js.map +0 -1
  144. package/dist/cjs/uh-component-library.cjs.js +0 -27
  145. package/dist/cjs/uh-component-library.cjs.js.map +0 -1
  146. package/dist/collection/components/00-foundations/borders/borders.stories.js.map +0 -1
  147. package/dist/collection/components/00-foundations/colours/colours.stories.js.map +0 -1
  148. package/dist/collection/components/00-foundations/icons/iconList.js.map +0 -1
  149. package/dist/collection/components/00-foundations/icons/icons.stories.js.map +0 -1
  150. package/dist/collection/components/00-foundations/spacing/spacing.stories.js.map +0 -1
  151. package/dist/collection/components/00-foundations/typography/headings.stories.js +0 -23
  152. package/dist/collection/components/00-foundations/typography/headings.stories.js.map +0 -1
  153. package/dist/collection/components/00-foundations/typography/text.stories.js +0 -17
  154. package/dist/collection/components/00-foundations/typography/text.stories.js.map +0 -1
  155. package/dist/collection/components/00-foundations/typography/typography.stories.js.map +0 -1
  156. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js.map +0 -1
  157. package/dist/collection/components/01-base-components/ds-icon/ds-icon.stories.js.map +0 -1
  158. package/dist/collection/index.js.map +0 -1
  159. package/dist/collection/utils/borders/borderUtils.js.map +0 -1
  160. package/dist/collection/utils/colours/colourUtils.js.map +0 -1
  161. package/dist/collection/utils/spacing/spacingUtils.js.map +0 -1
  162. package/dist/collection/utils/tests/testUtils.js.map +0 -1
  163. package/dist/collection/utils/typography/typographyUtils.js.map +0 -1
  164. package/dist/collection/utils/utils.js.map +0 -1
  165. package/dist/components/ds-icon.js.map +0 -1
  166. package/dist/components/index.js.map +0 -1
  167. package/dist/components/p-dcfb6eb2.js.map +0 -1
  168. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  169. package/dist/esm/ds-icon.entry.js +0 -518
  170. package/dist/esm/ds-icon.entry.js.map +0 -1
  171. package/dist/esm/index-1586ada2.js.map +0 -1
  172. package/dist/esm/index.js.map +0 -1
  173. package/dist/esm/loader.js.map +0 -1
  174. package/dist/esm/uh-component-library.js +0 -22
  175. package/dist/esm/uh-component-library.js.map +0 -1
  176. package/dist/types/components/00-foundations/typography/headings.stories.d.ts +0 -17
  177. package/dist/types/components/00-foundations/typography/text.stories.d.ts +0 -11
  178. package/dist/uh-component-library/index.esm.js +0 -2
  179. package/dist/uh-component-library/index.esm.js.map +0 -1
  180. package/dist/uh-component-library/p-74d73de3.js +0 -3
  181. package/dist/uh-component-library/p-74d73de3.js.map +0 -1
  182. package/dist/uh-component-library/p-c7cd80a5.entry.js +0 -2
  183. package/dist/uh-component-library/p-c7cd80a5.entry.js.map +0 -1
  184. package/dist/uh-component-library/p-e1255160.js +0 -2
  185. package/dist/uh-component-library/p-e1255160.js.map +0 -1
  186. package/dist/uh-component-library/uh-component-library.esm.js +0 -2
  187. package/dist/uh-component-library/uh-component-library.esm.js.map +0 -1
  188. package/docs/DEPLOYMENT.md +0 -52
  189. package/docs/DEVELOPMENT.md +0 -52
  190. package/docs/PUBLISHING.md +0 -48
  191. package/docs/TESTING.md +0 -24
  192. package/docs/USAGE.md +0 -30
  193. package/loader/cdn.js +0 -1
  194. package/loader/index.cjs.js +0 -1
  195. package/loader/index.es2017.js +0 -1
  196. package/react-wrapper/components.ts +0 -24
@@ -0,0 +1,293 @@
1
+ import { h } from "@stencil/core";
2
+ import classNames from "classnames";
3
+ import { inheritAriaAttributes, inheritAttributes } from "../../../utils/attributes";
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
+ }
42
+ 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
+ ]));
55
+ }
56
+ render() {
57
+ console.log('render');
58
+ const classes = classNames(`${this.variant} ${this.colour} ${this.size}`, {
59
+ 'icon-start': this.icon && this.iconPosition === 'start' && this.value,
60
+ 'icon-end': this.icon && this.iconPosition === 'end' && this.value,
61
+ 'icon-only': this.icon && !this.value,
62
+ });
63
+ const iconSize = this.size === 'small' ? '1rem' : undefined;
64
+ 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 }))));
66
+ }
67
+ static get is() { return "ds-button"; }
68
+ static get encapsulation() { return "scoped"; }
69
+ static get originalStyleUrls() {
70
+ return {
71
+ "$": ["ds-button.scss"]
72
+ };
73
+ }
74
+ static get styleUrls() {
75
+ return {
76
+ "$": ["ds-button.css"]
77
+ };
78
+ }
79
+ static get properties() {
80
+ return {
81
+ "value": {
82
+ "type": "string",
83
+ "mutable": false,
84
+ "complexType": {
85
+ "original": "string",
86
+ "resolved": "string",
87
+ "references": {}
88
+ },
89
+ "required": false,
90
+ "optional": false,
91
+ "docs": {
92
+ "tags": [{
93
+ "name": "example",
94
+ "text": "<ds-button value=\"button\"></ds-button> // Do this\n<ds-button>button</ds-button> // Instead of this"
95
+ }, {
96
+ "name": "see",
97
+ "text": "{@link https://stackoverflow.com/a/52445966}"
98
+ }, {
99
+ "name": "see",
100
+ "text": "{@link https://github.com/ionic-team/stencil/issues/399}"
101
+ }],
102
+ "text": "Button text content.\n\nUses a text prop instead of `<slot />` to avoid triggering another render to set correct CSS classes just after initial load."
103
+ },
104
+ "getter": false,
105
+ "setter": false,
106
+ "attribute": "value",
107
+ "reflect": false,
108
+ "defaultValue": "''"
109
+ },
110
+ "variant": {
111
+ "type": "string",
112
+ "mutable": false,
113
+ "complexType": {
114
+ "original": "'primary' | 'secondary' | 'supplementary'",
115
+ "resolved": "\"primary\" | \"secondary\" | \"supplementary\"",
116
+ "references": {}
117
+ },
118
+ "required": false,
119
+ "optional": false,
120
+ "docs": {
121
+ "tags": [],
122
+ "text": ""
123
+ },
124
+ "getter": false,
125
+ "setter": false,
126
+ "attribute": "variant",
127
+ "reflect": false,
128
+ "defaultValue": "'primary'"
129
+ },
130
+ "colour": {
131
+ "type": "string",
132
+ "mutable": false,
133
+ "complexType": {
134
+ "original": "'blue' | 'black' | 'white'",
135
+ "resolved": "\"black\" | \"blue\" | \"white\"",
136
+ "references": {}
137
+ },
138
+ "required": false,
139
+ "optional": false,
140
+ "docs": {
141
+ "tags": [],
142
+ "text": ""
143
+ },
144
+ "getter": false,
145
+ "setter": false,
146
+ "attribute": "colour",
147
+ "reflect": false,
148
+ "defaultValue": "'blue'"
149
+ },
150
+ "size": {
151
+ "type": "string",
152
+ "mutable": false,
153
+ "complexType": {
154
+ "original": "'small' | 'medium'",
155
+ "resolved": "\"medium\" | \"small\"",
156
+ "references": {}
157
+ },
158
+ "required": false,
159
+ "optional": false,
160
+ "docs": {
161
+ "tags": [],
162
+ "text": ""
163
+ },
164
+ "getter": false,
165
+ "setter": false,
166
+ "attribute": "size",
167
+ "reflect": false,
168
+ "defaultValue": "'medium'"
169
+ },
170
+ "fontWeight": {
171
+ "type": "string",
172
+ "mutable": false,
173
+ "complexType": {
174
+ "original": "string",
175
+ "resolved": "string",
176
+ "references": {}
177
+ },
178
+ "required": false,
179
+ "optional": false,
180
+ "docs": {
181
+ "tags": [],
182
+ "text": ""
183
+ },
184
+ "getter": false,
185
+ "setter": false,
186
+ "attribute": "font-weight",
187
+ "reflect": false,
188
+ "defaultValue": "'normal'"
189
+ },
190
+ "icon": {
191
+ "type": "string",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "string",
195
+ "resolved": "string",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": ""
203
+ },
204
+ "getter": false,
205
+ "setter": false,
206
+ "attribute": "icon",
207
+ "reflect": false,
208
+ "defaultValue": "''"
209
+ },
210
+ "iconPosition": {
211
+ "type": "string",
212
+ "mutable": false,
213
+ "complexType": {
214
+ "original": "'start' | 'end'",
215
+ "resolved": "\"end\" | \"start\"",
216
+ "references": {}
217
+ },
218
+ "required": false,
219
+ "optional": false,
220
+ "docs": {
221
+ "tags": [],
222
+ "text": ""
223
+ },
224
+ "getter": false,
225
+ "setter": false,
226
+ "attribute": "icon-position",
227
+ "reflect": false,
228
+ "defaultValue": "'start'"
229
+ },
230
+ "type": {
231
+ "type": "string",
232
+ "mutable": false,
233
+ "complexType": {
234
+ "original": "'button' | 'submit' | 'reset'",
235
+ "resolved": "\"button\" | \"reset\" | \"submit\"",
236
+ "references": {}
237
+ },
238
+ "required": false,
239
+ "optional": false,
240
+ "docs": {
241
+ "tags": [],
242
+ "text": ""
243
+ },
244
+ "getter": false,
245
+ "setter": false,
246
+ "attribute": "type",
247
+ "reflect": false,
248
+ "defaultValue": "'button'"
249
+ },
250
+ "disabled": {
251
+ "type": "boolean",
252
+ "mutable": false,
253
+ "complexType": {
254
+ "original": "boolean",
255
+ "resolved": "boolean",
256
+ "references": {}
257
+ },
258
+ "required": false,
259
+ "optional": false,
260
+ "docs": {
261
+ "tags": [],
262
+ "text": ""
263
+ },
264
+ "getter": false,
265
+ "setter": false,
266
+ "attribute": "disabled",
267
+ "reflect": false,
268
+ "defaultValue": "false"
269
+ },
270
+ "ariaDisabled": {
271
+ "type": "string",
272
+ "mutable": false,
273
+ "complexType": {
274
+ "original": "string",
275
+ "resolved": "string",
276
+ "references": {}
277
+ },
278
+ "required": false,
279
+ "optional": false,
280
+ "docs": {
281
+ "tags": [],
282
+ "text": ""
283
+ },
284
+ "getter": false,
285
+ "setter": false,
286
+ "attribute": "aria-disabled",
287
+ "reflect": false,
288
+ "defaultValue": "'false'"
289
+ }
290
+ };
291
+ }
292
+ static get elementRef() { return "el"; }
293
+ }
@@ -0,0 +1,27 @@
1
+ import { html } from "lit";
2
+ const meta = {
3
+ title: 'Base Components/Button/Examples',
4
+ component: 'ds-button',
5
+ };
6
+ export default meta;
7
+ export const ButtonGroup = {
8
+ render: () => html `
9
+ <div class="button-group">
10
+ <ds-button variant="primary" value="Primary"></ds-button>
11
+ <ds-button variant="secondary" value="Secondary"></ds-button>
12
+ <ds-button variant="supplementary" value="Supplementary"></ds-button>
13
+ </div>
14
+ `,
15
+ };
16
+ export const ResetAndSubmitButton = {
17
+ render: () => html `
18
+ <form>
19
+ <ds-text-input name="firstname" label="firstname"></ds-text-input>
20
+ <ds-text-input name="lastname" label="lastname"></ds-text-input>
21
+ <div class="button-group">
22
+ <ds-button value="reset" type="reset" variant="secondary"></ds-button>
23
+ <ds-button value="submit" type="submit"></ds-button>
24
+ </div>
25
+ </form>
26
+ `,
27
+ };
@@ -0,0 +1,77 @@
1
+ import { html } from "lit";
2
+ const meta = {
3
+ title: 'Base Components/Button/Features',
4
+ component: 'ds-button',
5
+ args: {
6
+ value: 'Button',
7
+ },
8
+ argTypes: {
9
+ value: { table: { disable: true } },
10
+ variant: { name: 'Variant', table: { disable: true } },
11
+ colour: { name: 'Colour', table: { disable: true } },
12
+ size: { name: 'Size', table: { disable: true } },
13
+ disabled: { name: 'Disabled', table: { disable: true } },
14
+ icon: { name: 'Icon', table: { disable: true } },
15
+ iconPosition: { name: 'Icon Position', table: { disable: true } },
16
+ },
17
+ };
18
+ export default meta;
19
+ export const Primary = {};
20
+ Primary.args = {
21
+ value: 'Primary',
22
+ variant: 'primary',
23
+ };
24
+ export const Secondary = {};
25
+ Secondary.args = {
26
+ value: 'Secondary',
27
+ variant: 'secondary',
28
+ };
29
+ export const Supplementary = {};
30
+ Supplementary.args = {
31
+ value: 'Supplementary',
32
+ variant: 'supplementary',
33
+ };
34
+ export const Blue = {};
35
+ Blue.args = {
36
+ value: 'Blue',
37
+ colour: 'blue',
38
+ };
39
+ export const Black = {};
40
+ Black.args = {
41
+ value: 'Black',
42
+ colour: 'black',
43
+ };
44
+ export const White = {};
45
+ White.args = {
46
+ value: 'White',
47
+ colour: 'white',
48
+ };
49
+ export const Medium = {};
50
+ Medium.args = {
51
+ value: 'Medium',
52
+ size: 'medium',
53
+ };
54
+ export const Small = {};
55
+ Small.args = {
56
+ value: 'Small',
57
+ size: 'small',
58
+ };
59
+ export const Disabled = {
60
+ render: () => html `
61
+ <div class="button-group">
62
+ <ds-button disabled value="disabled"></ds-button>
63
+ <ds-button aria-disabled="true" value="aria-disabled"></ds-button>
64
+ </div>
65
+ `,
66
+ };
67
+ export const IconStart = {};
68
+ IconStart.args = {
69
+ value: 'Icon start',
70
+ icon: 'arrow_forward',
71
+ };
72
+ export const IconEnd = {};
73
+ IconEnd.args = {
74
+ value: 'Icon end',
75
+ icon: 'arrow_forward',
76
+ iconPosition: 'end',
77
+ };
@@ -0,0 +1,74 @@
1
+ import { icons } from "../../../00-foundations/icons/iconList";
2
+ import { getAriaAttributeArgTypes } from "../../../../utils/attributes";
3
+ const buttonAriaAttributes = [
4
+ 'aria-busy',
5
+ 'aria-live',
6
+ 'aria-atomic',
7
+ 'aria-disabled',
8
+ 'aria-expanded',
9
+ 'aria-pressed',
10
+ 'aria-hidden',
11
+ 'aria-label',
12
+ 'aria-labelledby',
13
+ 'aria-controls',
14
+ 'aria-haspopup',
15
+ 'aria-describedby',
16
+ 'aria-relevant',
17
+ 'aria-details',
18
+ ];
19
+ const buttonAriaAttributeArgTypes = getAriaAttributeArgTypes(buttonAriaAttributes);
20
+ const meta = {
21
+ title: 'Base Components/Button',
22
+ component: 'ds-button',
23
+ };
24
+ export default meta;
25
+ export const Default = {
26
+ args: {
27
+ value: 'button',
28
+ fontWeight: '700',
29
+ disabled: false,
30
+ },
31
+ argTypes: {
32
+ value: { control: 'text' },
33
+ disabled: { control: 'boolean' },
34
+ fontWeight: {
35
+ control: 'select',
36
+ options: [400, 600, 650, 700],
37
+ },
38
+ },
39
+ };
40
+ export const Playground = {
41
+ argTypes: Object.assign(Object.assign(Object.assign({}, Default.argTypes), { variant: {
42
+ options: ['primary', 'secondary', 'supplementary'],
43
+ control: {
44
+ type: 'radio',
45
+ },
46
+ }, colour: {
47
+ options: ['blue', 'black', 'white'],
48
+ control: {
49
+ type: 'radio',
50
+ },
51
+ }, size: {
52
+ options: ['medium', 'small'],
53
+ control: {
54
+ type: 'radio',
55
+ },
56
+ }, fontWeight: {
57
+ control: 'select',
58
+ options: [400, 600, 650, 700],
59
+ }, icon: {
60
+ control: 'select',
61
+ options: icons.map(icon => icon.name),
62
+ }, iconPosition: {
63
+ options: ['start', 'end'],
64
+ control: {
65
+ type: 'radio',
66
+ },
67
+ }, type: {
68
+ options: ['submit', 'reset', 'button'],
69
+ control: {
70
+ type: 'radio',
71
+ },
72
+ } }), buttonAriaAttributeArgTypes),
73
+ args: Object.assign(Object.assign({}, Default.args), { variant: 'primary', colour: 'blue', size: 'medium', disabled: false, ariaLabel: '', ariaLabelledby: '', icon: '', iconPosition: 'start' }),
74
+ };
@@ -1,3 +1,3 @@
1
1
  :host {
2
- display: block;
2
+ display: inline;
3
3
  }
@@ -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
- this.size = undefined;
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
- const cssVariable = `--colour-${this.colour}`;
35
- return getComputedStyle(document.documentElement).getPropertyValue(cssVariable) || this.colour;
29
+ const colour = this.colour ? `var(--${this.colour})` : 'currentColor';
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;
@@ -52,7 +45,7 @@ export class DsIcon {
52
45
  }
53
46
  }
54
47
  render() {
55
- return (h(Fragment, { key: '8a2414880389617aa1f009bc7972201ee877ab65' }, h("span", { key: 'e7441e46ef7473d1e7d1a40b70eacc843ee742ea', class: "icon-container", innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
48
+ return (h(Fragment, { key: '8d8a1304c6293c49ecc830ec02227dff9852b8c5' }, h("span", { key: '83f992b6b58f24398fa84e0fe62a62e60ea72e1b', class: "icon-container", innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
56
49
  }
57
50
  static get is() { return "ds-icon"; }
58
51
  static get encapsulation() { return "shadow"; }
@@ -82,6 +75,8 @@ export class DsIcon {
82
75
  "tags": [],
83
76
  "text": ""
84
77
  },
78
+ "getter": false,
79
+ "setter": false,
85
80
  "attribute": "name",
86
81
  "reflect": false
87
82
  },
@@ -99,6 +94,8 @@ export class DsIcon {
99
94
  "tags": [],
100
95
  "text": ""
101
96
  },
97
+ "getter": false,
98
+ "setter": false,
102
99
  "attribute": "colour",
103
100
  "reflect": false
104
101
  },
@@ -116,8 +113,11 @@ export class DsIcon {
116
113
  "tags": [],
117
114
  "text": ""
118
115
  },
116
+ "getter": false,
117
+ "setter": false,
119
118
  "attribute": "size",
120
- "reflect": false
119
+ "reflect": false,
120
+ "defaultValue": "'1.5rem'"
121
121
  },
122
122
  "title": {
123
123
  "type": "string",
@@ -133,6 +133,8 @@ export class DsIcon {
133
133
  "tags": [],
134
134
  "text": ""
135
135
  },
136
+ "getter": false,
137
+ "setter": false,
136
138
  "attribute": "title",
137
139
  "reflect": false,
138
140
  "defaultValue": "'Icon'"
@@ -151,6 +153,8 @@ export class DsIcon {
151
153
  "tags": [],
152
154
  "text": ""
153
155
  },
156
+ "getter": false,
157
+ "setter": false,
154
158
  "attribute": "role",
155
159
  "reflect": false,
156
160
  "defaultValue": "'img'"
@@ -169,6 +173,8 @@ export class DsIcon {
169
173
  "tags": [],
170
174
  "text": ""
171
175
  },
176
+ "getter": false,
177
+ "setter": false,
172
178
  "attribute": "hidden",
173
179
  "reflect": false,
174
180
  "defaultValue": "true"
@@ -181,4 +187,3 @@ export class DsIcon {
181
187
  };
182
188
  }
183
189
  }
184
- //# sourceMappingURL=ds-icon.js.map
@@ -12,7 +12,7 @@ const meta = {
12
12
  name: 'Icon',
13
13
  },
14
14
  colour: {
15
- options: getColourVariables().map(colour => colour.name),
15
+ options: getColourVariables('palette').map(colour => colour.name),
16
16
  control: {
17
17
  type: 'select',
18
18
  },
@@ -53,4 +53,3 @@ Default.args = {
53
53
  title: 'Icon',
54
54
  hidden: true,
55
55
  };
56
- //# sourceMappingURL=ds-icon.stories.js.map