@boostdev/design-system-components 2.0.0 → 2.1.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 (34) hide show
  1. package/README.md +2 -1
  2. package/dist/client.cjs +52 -50
  3. package/dist/client.css +536 -523
  4. package/dist/client.d.cts +3 -1
  5. package/dist/client.d.ts +3 -1
  6. package/dist/client.js +52 -50
  7. package/dist/index.cjs +52 -50
  8. package/dist/index.css +536 -523
  9. package/dist/index.d.cts +3 -1
  10. package/dist/index.d.ts +3 -1
  11. package/dist/index.js +52 -50
  12. package/dist/native/index.cjs +5 -2
  13. package/dist/native/index.d.cts +3 -1
  14. package/dist/native/index.d.ts +3 -1
  15. package/dist/native/index.js +5 -2
  16. package/dist/web-components/{chunk-3REOIRDW.js → chunk-N3TN6WCH.js} +26 -1
  17. package/dist/web-components/index.js +1 -1
  18. package/dist/web-components/interaction/bds-button.d.ts +7 -0
  19. package/dist/web-components/interaction/bds-button.js +1 -1
  20. package/package.json +1 -1
  21. package/src/components/interaction/Button/Button.mdx +81 -36
  22. package/src/components/interaction/Button/Button.module.css +24 -0
  23. package/src/components/interaction/Button/Button.native.mdx +31 -12
  24. package/src/components/interaction/Button/Button.native.spec.tsx +20 -0
  25. package/src/components/interaction/Button/Button.native.stories.tsx +110 -9
  26. package/src/components/interaction/Button/Button.native.tsx +13 -4
  27. package/src/components/interaction/Button/Button.spec.tsx +16 -0
  28. package/src/components/interaction/Button/Button.stories.tsx +134 -16
  29. package/src/components/interaction/Button/Button.tsx +4 -0
  30. package/src/components/layout/IconWrapper/IconWrapper.stories.tsx +46 -14
  31. package/src/web-components/interaction/BdsButton.mdx +46 -14
  32. package/src/web-components/interaction/BdsButton.stories.tsx +171 -19
  33. package/src/web-components/interaction/bds-button.spec.ts +35 -0
  34. package/src/web-components/interaction/bds-button.ts +28 -1
@@ -14,6 +14,7 @@ export type ButtonSize = 'small' | 'medium' | 'large';
14
14
  * target — forwarded to <a> when href is set
15
15
  * rel — forwarded to <a> when href is set
16
16
  * has-pulse — boolean, enables the pulse ring animation
17
+ * is-icon-only — boolean, forces a 1:1 aspect ratio with minimal xs padding (requires aria-label)
17
18
  * type — "button" (default) | "submit" | "reset"
18
19
  *
19
20
  * Slots:
@@ -114,6 +115,23 @@ export class BdsButton extends LitElement {
114
115
  animation: pulse 3s infinite;
115
116
  }
116
117
 
118
+ /* Icon-only: square (1:1), equal xs padding on both axes — composes with
119
+ any variant/size. box-sizing: border-box keeps the outer box at
120
+ --button_height; without it, all: unset reverts to content-box and
121
+ padding-block would stretch the button past its declared height.
122
+ Slotted child fills the content area (button height minus the two
123
+ padding sides) so SVG icons scale with button size. */
124
+ .button.is-icon-only {
125
+ aspect-ratio: 1;
126
+ box-sizing: border-box;
127
+ padding: var(--bds-space_xs);
128
+ }
129
+
130
+ :host([is-icon-only]) ::slotted(*) {
131
+ inline-size: 100%;
132
+ block-size: 100%;
133
+ }
134
+
117
135
  /* SVG icon colour */
118
136
  .button svg {
119
137
  --icon__stroke: currentcolor;
@@ -141,6 +159,12 @@ export class BdsButton extends LitElement {
141
159
  transition: var(--bds-animation_transition);
142
160
  }
143
161
 
162
+ /* Icon-only: zero out icon slot margins so icon centres */
163
+ .button.is-icon-only .icon-start.has-content,
164
+ .button.is-icon-only .icon-end.has-content {
165
+ margin-inline: 0;
166
+ }
167
+
144
168
  /* Hover icon animation */
145
169
  @media (hover: hover) and (pointer: fine) {
146
170
  .button:hover .icon-start svg,
@@ -189,6 +213,7 @@ export class BdsButton extends LitElement {
189
213
  target: { type: String },
190
214
  rel: { type: String },
191
215
  hasPulse: { type: Boolean, attribute: 'has-pulse', reflect: true },
216
+ isIconOnly: { type: Boolean, attribute: 'is-icon-only', reflect: true },
192
217
  type: { type: String },
193
218
  ariaLabel: { type: String, attribute: 'aria-label' },
194
219
  // Internal state
@@ -205,6 +230,7 @@ export class BdsButton extends LitElement {
205
230
  declare target: string | undefined;
206
231
  declare rel: string | undefined;
207
232
  declare hasPulse: boolean;
233
+ declare isIconOnly: boolean;
208
234
  declare type: 'button' | 'submit' | 'reset';
209
235
  declare ariaLabel: string | null;
210
236
  declare private _iconStartFilled: boolean;
@@ -216,6 +242,7 @@ export class BdsButton extends LitElement {
216
242
  this.size = 'medium';
217
243
  this.disabled = false;
218
244
  this.hasPulse = false;
245
+ this.isIconOnly = false;
219
246
  this.type = 'button';
220
247
  this.ariaLabel = null;
221
248
  this._iconStartFilled = false;
@@ -233,7 +260,7 @@ export class BdsButton extends LitElement {
233
260
  }
234
261
 
235
262
  private get _classes() {
236
- return `button ${this.variant} ${this.size}${this.hasPulse ? ' has-pulse' : ''}`;
263
+ return `button ${this.variant} ${this.size}${this.hasPulse ? ' has-pulse' : ''}${this.isIconOnly ? ' is-icon-only' : ''}`;
237
264
  }
238
265
 
239
266
  private _handleAnchorClick(e: MouseEvent) {