@solid-design-system/components 1.21.1 → 1.22.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 (103) hide show
  1. package/dist/components/es/checkbox-group.js +1 -0
  2. package/dist/components/es/checkbox.js +11 -0
  3. package/dist/components/es/icon.js +4 -4
  4. package/dist/components/es/solid-components2.js +1 -1
  5. package/dist/components/es/solid-element.js +1 -1
  6. package/dist/components/umd/solid-components.js +24 -14
  7. package/dist/custom-elements.json +1 -1
  8. package/dist/package/components/checkbox/checkbox.d.ts +40 -0
  9. package/dist/package/components/checkbox/checkbox.js +179 -0
  10. package/dist/package/components/checkbox-group/checkbox-group.d.ts +20 -0
  11. package/dist/package/components/checkbox-group/checkbox-group.js +102 -0
  12. package/dist/package/components/icon/library.system.d.ts +2 -0
  13. package/dist/package/components/icon/library.system.js +11 -1
  14. package/dist/package/internal/default-value.d.ts +2 -0
  15. package/dist/package/internal/default-value.js +21 -0
  16. package/dist/package/solid-components.d.ts +2 -0
  17. package/dist/package/solid-components.js +32 -28
  18. package/dist/package/styles/tailwind.css.js +1 -1
  19. package/dist/versioned-components/es/accordion-group.js +1 -1
  20. package/dist/versioned-components/es/accordion.js +1 -1
  21. package/dist/versioned-components/es/badge.js +1 -1
  22. package/dist/versioned-components/es/brandshape.js +1 -1
  23. package/dist/versioned-components/es/button.js +1 -1
  24. package/dist/versioned-components/es/carousel-item.js +1 -1
  25. package/dist/versioned-components/es/carousel.js +3 -3
  26. package/dist/versioned-components/es/checkbox-group.js +1 -0
  27. package/dist/versioned-components/es/checkbox.js +11 -0
  28. package/dist/versioned-components/es/divider.js +1 -1
  29. package/dist/versioned-components/es/drawer.js +1 -1
  30. package/dist/versioned-components/es/dropdown.js +1 -1
  31. package/dist/versioned-components/es/form.js +1 -1
  32. package/dist/versioned-components/es/icon.js +4 -4
  33. package/dist/versioned-components/es/include.js +1 -1
  34. package/dist/versioned-components/es/link.js +1 -1
  35. package/dist/versioned-components/es/navigation-item.js +1 -1
  36. package/dist/versioned-components/es/popup.js +1 -1
  37. package/dist/versioned-components/es/radio-group.js +1 -1
  38. package/dist/versioned-components/es/radio.js +1 -1
  39. package/dist/versioned-components/es/solid-components2.js +1 -1
  40. package/dist/versioned-components/es/solid-element.js +1 -1
  41. package/dist/versioned-components/es/spinner.js +1 -1
  42. package/dist/versioned-components/es/tag.js +1 -1
  43. package/dist/versioned-components/es/teaser.js +1 -1
  44. package/dist/versioned-components/es/video.js +1 -1
  45. package/dist/versioned-package/_components/button-group/button-group.d.ts +1 -1
  46. package/dist/versioned-package/_components/button-group/button-group.js +11 -11
  47. package/dist/versioned-package/components/accordion/accordion.d.ts +1 -1
  48. package/dist/versioned-package/components/accordion/accordion.js +2 -2
  49. package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +1 -1
  50. package/dist/versioned-package/components/accordion-group/accordion-group.js +3 -3
  51. package/dist/versioned-package/components/badge/badge.d.ts +1 -1
  52. package/dist/versioned-package/components/badge/badge.js +1 -1
  53. package/dist/versioned-package/components/brandshape/brandshape.d.ts +1 -1
  54. package/dist/versioned-package/components/brandshape/brandshape.js +1 -1
  55. package/dist/versioned-package/components/button/button.d.ts +1 -1
  56. package/dist/versioned-package/components/button/button.js +4 -4
  57. package/dist/versioned-package/components/carousel/carousel.d.ts +1 -1
  58. package/dist/versioned-package/components/carousel/carousel.js +6 -6
  59. package/dist/versioned-package/components/carousel-item/carousel-item.d.ts +1 -1
  60. package/dist/versioned-package/components/carousel-item/carousel-item.js +1 -1
  61. package/dist/versioned-package/components/checkbox/checkbox.d.ts +40 -0
  62. package/dist/versioned-package/components/checkbox/checkbox.js +179 -0
  63. package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +20 -0
  64. package/dist/versioned-package/components/checkbox-group/checkbox-group.js +102 -0
  65. package/dist/versioned-package/components/divider/divider.d.ts +1 -1
  66. package/dist/versioned-package/components/divider/divider.js +2 -2
  67. package/dist/versioned-package/components/drawer/drawer.d.ts +1 -1
  68. package/dist/versioned-package/components/drawer/drawer.js +2 -2
  69. package/dist/versioned-package/components/dropdown/dropdown.d.ts +1 -1
  70. package/dist/versioned-package/components/dropdown/dropdown.js +6 -6
  71. package/dist/versioned-package/components/icon/icon.d.ts +1 -1
  72. package/dist/versioned-package/components/icon/icon.js +1 -1
  73. package/dist/versioned-package/components/icon/library.system.d.ts +2 -0
  74. package/dist/versioned-package/components/icon/library.system.js +11 -1
  75. package/dist/versioned-package/components/include/include.d.ts +1 -1
  76. package/dist/versioned-package/components/include/include.js +1 -1
  77. package/dist/versioned-package/components/link/link.d.ts +1 -1
  78. package/dist/versioned-package/components/link/link.js +2 -2
  79. package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +1 -1
  80. package/dist/versioned-package/components/navigation-item/navigation-item.js +3 -3
  81. package/dist/versioned-package/components/popup/popup.d.ts +1 -1
  82. package/dist/versioned-package/components/popup/popup.js +1 -1
  83. package/dist/versioned-package/components/radio/radio.d.ts +1 -1
  84. package/dist/versioned-package/components/radio/radio.js +2 -2
  85. package/dist/versioned-package/components/radio-group/radio-group.d.ts +2 -2
  86. package/dist/versioned-package/components/radio-group/radio-group.js +12 -12
  87. package/dist/versioned-package/components/spinner/spinner.d.ts +1 -1
  88. package/dist/versioned-package/components/spinner/spinner.js +1 -1
  89. package/dist/versioned-package/components/tag/tag.d.ts +1 -1
  90. package/dist/versioned-package/components/tag/tag.js +2 -2
  91. package/dist/versioned-package/components/teaser/teaser.js +1 -1
  92. package/dist/versioned-package/components/video/video.d.ts +1 -1
  93. package/dist/versioned-package/components/video/video.js +2 -2
  94. package/dist/versioned-package/internal/default-value.d.ts +2 -0
  95. package/dist/versioned-package/internal/default-value.js +21 -0
  96. package/dist/versioned-package/internal/form.js +1 -1
  97. package/dist/versioned-package/solid-components.d.ts +2 -0
  98. package/dist/versioned-package/solid-components.js +32 -28
  99. package/dist/versioned-package/styles/tailwind.css.js +1 -1
  100. package/dist/versioned-styles/solid-styles.css +1 -1
  101. package/dist/vscode.html-custom-data.json +209 -21
  102. package/dist/web-types.json +311 -1
  103. package/package.json +3 -3
@@ -48,16 +48,16 @@ let SdAccordionGroup = class extends SolidElement {
48
48
  SdAccordionGroup.styles = [
49
49
  componentStyles,
50
50
  SolidElement.styles,
51
- css`:host{display:block}::slotted(sd-1-21-1-accordion:not(:first-of-type)){margin-top:-1px}`
51
+ css`:host{display:block}::slotted(sd-1-22-0-accordion:not(:first-of-type)){margin-top:-1px}`
52
52
  ];
53
53
  __decorateClass([
54
- queryAssignedElements({ selector: "sd-1-21-1-accordion" })
54
+ queryAssignedElements({ selector: "sd-1-22-0-accordion" })
55
55
  ], SdAccordionGroup.prototype, "_accordionsInDefaultSlot", 2);
56
56
  __decorateClass([
57
57
  property({ attribute: "close-others", type: Boolean })
58
58
  ], SdAccordionGroup.prototype, "closeOthers", 2);
59
59
  SdAccordionGroup = __decorateClass([
60
- customElement("sd-1-21-1-accordion-group")
60
+ customElement("sd-1-22-0-accordion-group")
61
61
  ], SdAccordionGroup);
62
62
  export {
63
63
  SdAccordionGroup as default
@@ -8,6 +8,6 @@ export default class SdBadge extends SolidElement {
8
8
  }
9
9
  declare global {
10
10
  interface HTMLElementTagNameMap {
11
- 'sd-1-21-1-badge': SdBadge;
11
+ 'sd-1-22-0-badge': SdBadge;
12
12
  }
13
13
  }
@@ -53,7 +53,7 @@ __decorateClass([
53
53
  property({ type: Boolean, reflect: true })
54
54
  ], SdBadge.prototype, "inverted", 2);
55
55
  SdBadge = __decorateClass([
56
- customElement("sd-1-21-1-badge")
56
+ customElement("sd-1-22-0-badge")
57
57
  ], SdBadge);
58
58
  export {
59
59
  SdBadge as default
@@ -22,6 +22,6 @@ export default class SdBrandshape extends SolidElement {
22
22
  }
23
23
  declare global {
24
24
  interface HTMLElementTagNameMap {
25
- 'sd-1-21-1-brandshape': SdBrandshape;
25
+ 'sd-1-22-0-brandshape': SdBrandshape;
26
26
  }
27
27
  }
@@ -123,7 +123,7 @@ __decorateClass([
123
123
  state()
124
124
  ], SdBrandshape.prototype, "componentBreakpoint", 2);
125
125
  SdBrandshape = __decorateClass([
126
- customElement("sd-1-21-1-brandshape")
126
+ customElement("sd-1-22-0-brandshape")
127
127
  ], SdBrandshape);
128
128
  export {
129
129
  SdBrandshape as default
@@ -47,6 +47,6 @@ export default class SdButton extends SolidElement implements SolidFormControl {
47
47
  }
48
48
  declare global {
49
49
  interface HTMLElementTagNameMap {
50
- 'sd-1-21-1-button': SdButton;
50
+ 'sd-1-22-0-button': SdButton;
51
51
  }
52
52
  }
@@ -213,19 +213,19 @@ let SdButton = class extends SolidElement {
213
213
  md: "ml-2",
214
214
  lg: "ml-2"
215
215
  }[this.size]
216
- )}"></slot>${this.loading ? html`<sd-1-21-1-spinner class="${cx("absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2")}"></sd-1-21-1-spinner>` : ""}</${tag}>`;
216
+ )}"></slot>${this.loading ? html`<sd-1-22-0-spinner class="${cx("absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2")}"></sd-1-22-0-spinner>` : ""}</${tag}>`;
217
217
  }
218
218
  };
219
219
  SdButton.styles = [
220
220
  componentStyles,
221
221
  SolidElement.styles,
222
- css`:host{display:inline-block;position:relative;width:auto;cursor:pointer}sd-1-21-1-spinner{--indicator-color:currentColor;--track-color:var(--tw-varcolor-200)}::slotted(sd-1-21-1-badge){position:absolute;top:0;right:0;translate:50% -50%;pointer-events:none}::slotted(sd-1-21-1-icon),sd-1-21-1-spinner{font-size:calc(var(--tw-varspacing)/ 2)}`
222
+ css`:host{display:inline-block;position:relative;width:auto;cursor:pointer}sd-1-22-0-spinner{--indicator-color:currentColor;--track-color:var(--tw-varcolor-200)}::slotted(sd-1-22-0-badge){position:absolute;top:0;right:0;translate:50% -50%;pointer-events:none}::slotted(sd-1-22-0-icon),sd-1-22-0-spinner{font-size:calc(var(--tw-varspacing)/ 2)}`
223
223
  ];
224
224
  __decorateClass([
225
225
  query("a, button")
226
226
  ], SdButton.prototype, "button", 2);
227
227
  __decorateClass([
228
- queryAssignedElements({ selector: "sd-1-21-1-icon" })
228
+ queryAssignedElements({ selector: "sd-1-22-0-icon" })
229
229
  ], SdButton.prototype, "_iconsInDefaultSlot", 2);
230
230
  __decorateClass([
231
231
  state()
@@ -288,7 +288,7 @@ __decorateClass([
288
288
  watch("disabled", { waitUntilFirstUpdate: true })
289
289
  ], SdButton.prototype, "handleDisabledChange", 1);
290
290
  SdButton = __decorateClass([
291
- customElement("sd-1-21-1-button")
291
+ customElement("sd-1-22-0-button")
292
292
  ], SdButton);
293
293
  export {
294
294
  SdButton as default
@@ -41,6 +41,6 @@ export default class SdCarousel extends SolidElement {
41
41
  }
42
42
  declare global {
43
43
  interface HTMLElementTagNameMap {
44
- 'sd-1-21-1-carousel': SdCarousel;
44
+ 'sd-1-22-0-carousel': SdCarousel;
45
45
  }
46
46
  }
@@ -39,7 +39,7 @@ let SdCarousel = class extends SolidElement {
39
39
  this.pausedAutoplay = false;
40
40
  this.autoplayController = new AutoplayController(this, () => this.next());
41
41
  this.scrollController = new ScrollController(this);
42
- this.slides = this.getElementsByTagName("sd-1-21-1-carousel-item");
42
+ this.slides = this.getElementsByTagName("sd-1-22-0-carousel-item");
43
43
  this.intersectionObserverEntries = /* @__PURE__ */ new Map();
44
44
  this.localize = new LocalizeController(this);
45
45
  this.handleSlotChange = (mutations) => {
@@ -276,7 +276,7 @@ let SdCarousel = class extends SolidElement {
276
276
  "!mr-6 !rounded-sm sd-interactive",
277
277
  !prevEnabled && "sd-interactive--disabled",
278
278
  this.inverted ? "sd-interactive--inverted" : "sd-interactive--reset"
279
- )}" aria-label="${this.localize.term("previousSlide")}" aria-controls="scroll-container" aria-disabled="${prevEnabled ? "false" : "true"}" @click="${prevEnabled ? () => this.previous() : null}"><slot name="previous-icon"><sd-1-21-1-icon class="${cx("h-6 w-6 rotate-90 grid place-items-center")}" library="system" name="${isLtr ? "chevron-down" : "chevron-up"}"></sd-1-21-1-icon></slot></button> ${this.variant === "dot" ? html`<div part="pagination-dot" role="tablist" class="${cx("carousel__pagination dot flex wrap items-center gap-2")}" aria-controls="scroll-container">${map(range(pagesCount), (index) => {
279
+ )}" aria-label="${this.localize.term("previousSlide")}" aria-controls="scroll-container" aria-disabled="${prevEnabled ? "false" : "true"}" @click="${prevEnabled ? () => this.previous() : null}"><slot name="previous-icon"><sd-1-22-0-icon class="${cx("h-6 w-6 rotate-90 grid place-items-center")}" library="system" name="${isLtr ? "chevron-down" : "chevron-up"}"></sd-1-22-0-icon></slot></button> ${this.variant === "dot" ? html`<div part="pagination-dot" role="tablist" class="${cx("carousel__pagination dot flex wrap items-center gap-2")}" aria-controls="scroll-container">${map(range(pagesCount), (index) => {
280
280
  const isActive = index === currentPage;
281
281
  return html`<button part="pagination-item ${isActive ? "pagination-item--active" : ""}" class="${cx(
282
282
  "carousel__pagination-item",
@@ -296,18 +296,18 @@ let SdCarousel = class extends SolidElement {
296
296
  )}" aria-label="${this.localize.term("nextSlide")}" aria-controls="scroll-container" aria-disabled="${nextEnabled ? "false" : "true"}" @click="${nextEnabled ? () => {
297
297
  console.log("click-next");
298
298
  this.next();
299
- } : null}"><slot name="next-icon"><sd-1-21-1-icon class="${cx("h-6 w-6 rotate-90 grid place-items-center")}" library="system" name="${isLtr ? "chevron-up" : "chevron-down"}"></sd-1-21-1-icon></slot></button></div><button class="${cx(
299
+ } : null}"><slot name="next-icon"><sd-1-22-0-icon class="${cx("h-6 w-6 rotate-90 grid place-items-center")}" library="system" name="${isLtr ? "chevron-up" : "chevron-down"}"></sd-1-22-0-icon></slot></button></div><button class="${cx(
300
300
  "ml-6 !rounded-sm",
301
301
  "!absolute !right-0 sd-interactive",
302
302
  this.inverted ? "sd-interactive--inverted" : "sd-interactive--reset",
303
303
  !this.autoplay && "!hidden"
304
- )}" part="autoplay-controls" @click="${() => this.pausedAutoplay = !this.pausedAutoplay}"><slot name="autoplay-start" class="${cx(!this.pausedAutoplay ? "hidden" : "")}"><sd-1-21-1-icon class="h-6 w-6 grid place-items-center" library="system" name="start"></sd-1-21-1-icon></slot><slot name="autoplay-pause" class="${cx(this.pausedAutoplay ? "hidden" : "")}"><sd-1-21-1-icon class="h-6 w-6 grid place-items-center" library="system" name="pause"></sd-1-21-1-icon></slot></button></div></div>`;
304
+ )}" part="autoplay-controls" @click="${() => this.pausedAutoplay = !this.pausedAutoplay}"><slot name="autoplay-start" class="${cx(!this.pausedAutoplay ? "hidden" : "")}"><sd-1-22-0-icon class="h-6 w-6 grid place-items-center" library="system" name="start"></sd-1-22-0-icon></slot><slot name="autoplay-pause" class="${cx(this.pausedAutoplay ? "hidden" : "")}"><sd-1-22-0-icon class="h-6 w-6 grid place-items-center" library="system" name="pause"></sd-1-22-0-icon></slot></button></div></div>`;
305
305
  }
306
306
  };
307
307
  SdCarousel.styles = [
308
308
  SolidElement.styles,
309
309
  unsafeCSS(InteractiveStyles),
310
- css`${componentStyles}:host{--slide-gap:var(--sl-spacing-medium, 1rem);--scroll-hint:0px;display:flex}.carousel{grid-template-areas:'. slides .' '. pagination .'}.carousel__pagination{grid-area:pagination}.carousel__slides{grid-area:slides;scrollbar-width:none;--slide-size:calc((100% - (var(--slides-per-page) - 1) * var(--slide-gap)) / var(--slides-per-page));grid-auto-columns:var(--slide-size);column-gap:var(--slide-gap);scroll-padding-inline:var(--scroll-hint);padding-inline:var(--scroll-hint)}@media (prefers-reduced-motion){:where(.carousel__slides){scroll-behavior:auto}}.carousel__slides--dragging,.carousel__slides--dropping{scroll-snap-type:unset}.carousel__slides::-webkit-scrollbar{display:none}.carousel__navigation{grid-area:navigation}sd-1-21-1-button::part(label){display:flex;flex:1 1 auto;align-items:center;pointer-events:none}`
310
+ css`${componentStyles}:host{--slide-gap:var(--sl-spacing-medium, 1rem);--scroll-hint:0px;display:flex}.carousel{grid-template-areas:'. slides .' '. pagination .'}.carousel__pagination{grid-area:pagination}.carousel__slides{grid-area:slides;scrollbar-width:none;--slide-size:calc((100% - (var(--slides-per-page) - 1) * var(--slide-gap)) / var(--slides-per-page));grid-auto-columns:var(--slide-size);column-gap:var(--slide-gap);scroll-padding-inline:var(--scroll-hint);padding-inline:var(--scroll-hint)}@media (prefers-reduced-motion){:where(.carousel__slides){scroll-behavior:auto}}.carousel__slides--dragging,.carousel__slides--dropping{scroll-snap-type:unset}.carousel__slides::-webkit-scrollbar{display:none}.carousel__navigation{grid-area:navigation}sd-1-22-0-button::part(label){display:flex;flex:1 1 auto;align-items:center;pointer-events:none}`
311
311
  ];
312
312
  __decorateClass([
313
313
  property({ type: String, reflect: true })
@@ -359,7 +359,7 @@ __decorateClass([
359
359
  watch("autoplay")
360
360
  ], SdCarousel.prototype, "handleAutoplayChange", 1);
361
361
  SdCarousel = __decorateClass([
362
- customElement("sd-1-21-1-carousel")
362
+ customElement("sd-1-22-0-carousel")
363
363
  ], SdCarousel);
364
364
  export {
365
365
  SdCarousel as default
@@ -7,6 +7,6 @@ export default class SdCarouselItem extends SolidElement {
7
7
  }
8
8
  declare global {
9
9
  interface HTMLElementTagNameMap {
10
- 'sd-1-21-1-carousel-item': SdCarouselItem;
10
+ 'sd-1-22-0-carousel-item': SdCarouselItem;
11
11
  }
12
12
  }
@@ -30,7 +30,7 @@ SdCarouselItem.styles = [
30
30
  css`${componentStyles}:host{display:flex;align-items:center;justify-content:center;flex-direction:column;width:100%;height:100%;aspect-ratio:var(--aspect-ratio);scroll-snap-align:start;scroll-snap-stop:always}::slotted(img){width:100%;height:100%;object-fit:cover}`
31
31
  ];
32
32
  SdCarouselItem = __decorateClass([
33
- customElement("sd-1-21-1-carousel-item")
33
+ customElement("sd-1-22-0-carousel-item")
34
34
  ], SdCarouselItem);
35
35
  export {
36
36
  SdCarouselItem as default
@@ -0,0 +1,40 @@
1
+ import '../icon/icon';
2
+ import SolidElement from '../../internal/solid-element';
3
+ import type { SolidFormControl } from '../../internal/solid-element';
4
+ export default class SdCheckbox extends SolidElement implements SolidFormControl {
5
+ private readonly formControlController;
6
+ input: HTMLInputElement;
7
+ title: string;
8
+ name: string;
9
+ value: string;
10
+ size: 'sm' | 'lg';
11
+ disabled: boolean;
12
+ checked: boolean;
13
+ indeterminate: boolean;
14
+ defaultChecked: boolean;
15
+ form: string;
16
+ required: boolean;
17
+ get validity(): ValidityState;
18
+ firstUpdated(): void;
19
+ private handleClick;
20
+ private handleBlur;
21
+ private handleInput;
22
+ private handleInvalid;
23
+ private handleFocus;
24
+ handleDisabledChange(): void;
25
+ handleStateChange(): void;
26
+ click(): void;
27
+ focus(options?: FocusOptions): void;
28
+ blur(): void;
29
+ checkValidity(): boolean;
30
+ getForm(): HTMLFormElement | null;
31
+ reportValidity(): boolean;
32
+ setCustomValidity(message: string): void;
33
+ render(): import("lit-html").TemplateResult<1>;
34
+ static styles: import("lit").CSSResultGroup[];
35
+ }
36
+ declare global {
37
+ interface HTMLElementTagNameMap {
38
+ 'sd-1-22-0-checkbox': SdCheckbox;
39
+ }
40
+ }
@@ -0,0 +1,179 @@
1
+ import "../icon/icon.js";
2
+ import { css, html } from "lit";
3
+ import { customElement } from "../../internal/register-custom-element.js";
4
+ import { defaultValue } from "../../internal/default-value.js";
5
+ import { FormControlController } from "../../internal/form.js";
6
+ import { ifDefined } from "lit/directives/if-defined.js";
7
+ import { live } from "lit/directives/live.js";
8
+ import { query, property } from "lit/decorators.js";
9
+ import { watch } from "../../internal/watch.js";
10
+ import cx from "classix";
11
+ import SolidElement from "../../internal/solid-element.js";
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __decorateClass = (decorators, target, key, kind) => {
15
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
16
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
17
+ if (decorator = decorators[i])
18
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
19
+ if (kind && result)
20
+ __defProp(target, key, result);
21
+ return result;
22
+ };
23
+ let SdCheckbox = class extends SolidElement {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.formControlController = new FormControlController(this, {
27
+ value: (control) => control.checked ? control.value || "on" : void 0,
28
+ defaultValue: (control) => control.defaultChecked,
29
+ setValue: (control, checked) => control.checked = checked
30
+ });
31
+ this.title = "";
32
+ this.name = "";
33
+ this.size = "lg";
34
+ this.disabled = false;
35
+ this.checked = false;
36
+ this.indeterminate = false;
37
+ this.defaultChecked = false;
38
+ this.form = "";
39
+ this.required = false;
40
+ }
41
+ /** Gets the validity state object */
42
+ get validity() {
43
+ return this.input.validity;
44
+ }
45
+ firstUpdated() {
46
+ this.formControlController.updateValidity();
47
+ }
48
+ handleClick() {
49
+ this.checked = !this.checked;
50
+ this.indeterminate = false;
51
+ this.emit("sd-change");
52
+ }
53
+ handleBlur() {
54
+ this.emit("sd-blur");
55
+ }
56
+ handleInput() {
57
+ this.emit("sd-input");
58
+ }
59
+ handleInvalid(event) {
60
+ this.formControlController.setValidity(false);
61
+ this.formControlController.emitInvalidEvent(event);
62
+ }
63
+ handleFocus() {
64
+ this.emit("sd-focus");
65
+ }
66
+ handleDisabledChange() {
67
+ this.setAttribute("aria-disabled", this.disabled ? "true" : "false");
68
+ this.formControlController.setValidity(this.disabled);
69
+ }
70
+ handleStateChange() {
71
+ this.input.checked = this.checked;
72
+ this.input.indeterminate = this.indeterminate;
73
+ this.formControlController.updateValidity();
74
+ }
75
+ /** Simulates a click on the checkbox. */
76
+ click() {
77
+ this.input.click();
78
+ }
79
+ /** Sets focus on the checkbox. */
80
+ focus(options) {
81
+ this.input.focus(options);
82
+ }
83
+ /** Removes focus from the checkbox. */
84
+ blur() {
85
+ this.input.blur();
86
+ }
87
+ /** Checks for validity but does not show a validation message. Returns true when valid and false when invalid. */
88
+ checkValidity() {
89
+ return this.input.checkValidity();
90
+ }
91
+ /** Gets the associated form, if one exists. */
92
+ getForm() {
93
+ return this.formControlController.getForm();
94
+ }
95
+ /** Checks for validity and shows a validation message if the control is invalid. */
96
+ reportValidity() {
97
+ return this.input.reportValidity();
98
+ }
99
+ /**
100
+ * Sets a custom validation message. The value provided will be shown to the user when the form is submitted. To clear
101
+ * the custom validation message, call this method with an empty string.
102
+ */
103
+ setCustomValidity(message) {
104
+ this.input.setCustomValidity(message);
105
+ this.formControlController.updateValidity();
106
+ }
107
+ render() {
108
+ return html`<label part="base" class="${cx(
109
+ "sd-1-22-0-checkbox group flex items-start text-base leading-normal text-black cursor-pointer",
110
+ this.disabled && "hover:cursor-not-allowed",
111
+ {
112
+ /* sizes, fonts */
113
+ sm: "text-sm",
114
+ lg: "text-base"
115
+ }[this.size]
116
+ )}"><input class="peer absolute opacity-0 p-0 m-0 pointer-events-none" type="checkbox" title="${this.title}" name="${this.name}" value="${ifDefined(this.value)}" .indeterminate="${live(this.indeterminate)}" .checked="${live(this.checked)}" .disabled="${this.disabled}" .required="${this.required}" aria-checked="${this.checked ? "true" : "false"}" @click="${this.handleClick}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @blur="${this.handleBlur}" @focus="${this.handleFocus}"> <span id="control" part="control ${this.checked ? " control--checked" : "control--unchecked"} ${this.indeterminate ? " control--indeterminate" : ""}" class="${cx(
117
+ `relative flex flex-initial items-center justify-center border rounded-sm h-4 w-4
118
+ peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2
119
+ peer-focus-visible:outline-primary`,
120
+ {
121
+ sm: "mt-[2px]",
122
+ lg: "mt-[3px]"
123
+ }[this.size],
124
+ this.disabled && this.indeterminate && "border-neutral-500 bg-neutral-500" || this.disabled && this.checked && "border-neutral-500 bg-neutral-500" || this.disabled && "border-neutral-500" || (this.checked || this.indeterminate) && "border-accent hover:border-accent-550 group-hover:border-accent-550 bg-accent group-hover:bg-accent-550" || "border-neutral-800 hover:bg-neutral-200 group-hover:bg-neutral-200 bg-white"
125
+ )}">${this.checked ? html`<sd-1-22-0-icon part="checked-icon" class="text-white w-3 h-3" library="system" name="status-hook"></sd-1-22-0-icon>` : ""} ${!this.checked && this.indeterminate ? html`<sd-1-22-0-icon part="indeterminate-icon" class="text-white w-3 h-3" library="system" name="status-minus"></sd-1-22-0-icon>` : ""} </span><span part="label" id="label" class="${cx(
126
+ "select-none inline-block ml-2 text-black",
127
+ this.disabled && "text-neutral-500" || "text-neutral-800"
128
+ )}"><slot></slot></span></label>`;
129
+ }
130
+ };
131
+ SdCheckbox.styles = [
132
+ SolidElement.styles,
133
+ css`:host{display:block}:host(:focus-visible){outline:0}:host([required]) #label::after{content:' *'}:host([data-user-invalid]) #label{color:rgb(var(--sd-color-error,204 25 55))}:host([data-user-invalid]) #control{border-color:rgb(var(--sd-color-error,204 25 55))}:host([data-user-invalid]):host([indeterminate]) #control{background-color:rgb(var(--sd-color-error,204 25 55))}`
134
+ ];
135
+ __decorateClass([
136
+ query('input[type="checkbox"]')
137
+ ], SdCheckbox.prototype, "input", 2);
138
+ __decorateClass([
139
+ property()
140
+ ], SdCheckbox.prototype, "title", 2);
141
+ __decorateClass([
142
+ property()
143
+ ], SdCheckbox.prototype, "name", 2);
144
+ __decorateClass([
145
+ property()
146
+ ], SdCheckbox.prototype, "value", 2);
147
+ __decorateClass([
148
+ property({ reflect: true })
149
+ ], SdCheckbox.prototype, "size", 2);
150
+ __decorateClass([
151
+ property({ type: Boolean, reflect: true })
152
+ ], SdCheckbox.prototype, "disabled", 2);
153
+ __decorateClass([
154
+ property({ type: Boolean, reflect: true })
155
+ ], SdCheckbox.prototype, "checked", 2);
156
+ __decorateClass([
157
+ property({ type: Boolean, reflect: true })
158
+ ], SdCheckbox.prototype, "indeterminate", 2);
159
+ __decorateClass([
160
+ defaultValue("checked")
161
+ ], SdCheckbox.prototype, "defaultChecked", 2);
162
+ __decorateClass([
163
+ property({ reflect: true })
164
+ ], SdCheckbox.prototype, "form", 2);
165
+ __decorateClass([
166
+ property({ type: Boolean, reflect: true })
167
+ ], SdCheckbox.prototype, "required", 2);
168
+ __decorateClass([
169
+ watch("disabled", { waitUntilFirstUpdate: true })
170
+ ], SdCheckbox.prototype, "handleDisabledChange", 1);
171
+ __decorateClass([
172
+ watch(["checked", "indeterminate"], { waitUntilFirstUpdate: true })
173
+ ], SdCheckbox.prototype, "handleStateChange", 1);
174
+ SdCheckbox = __decorateClass([
175
+ customElement("sd-1-22-0-checkbox")
176
+ ], SdCheckbox);
177
+ export {
178
+ SdCheckbox as default
179
+ };
@@ -0,0 +1,20 @@
1
+ import '../icon/icon';
2
+ import SolidElement from '../../internal/solid-element';
3
+ export default class SdCheckboxGroup extends SolidElement {
4
+ private readonly hasSlotController;
5
+ label: string;
6
+ size: 'lg' | 'sm';
7
+ orientation: 'horizontal' | 'vertical';
8
+ private getAllCheckboxes;
9
+ private syncCheckboxElements;
10
+ private syncCheckboxes;
11
+ handleSizeChange(): void;
12
+ handleInvalid(): void;
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ static styles: import("lit").CSSResultGroup[];
15
+ }
16
+ declare global {
17
+ interface HTMLElementTagNameMap {
18
+ 'sd-1-22-0-checkbox-group': SdCheckboxGroup;
19
+ }
20
+ }
@@ -0,0 +1,102 @@
1
+ import "../icon/icon.js";
2
+ import { css, html } from "lit";
3
+ import { customElement } from "../../internal/register-custom-element.js";
4
+ import { HasSlotController } from "../../internal/slot.js";
5
+ import { property } from "lit/decorators.js";
6
+ import { watch } from "../../internal/watch.js";
7
+ import componentStyles from "../../styles/component.styles.js";
8
+ import cx from "classix";
9
+ import SolidElement from "../../internal/solid-element.js";
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __decorateClass = (decorators, target, key, kind) => {
13
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
15
+ if (decorator = decorators[i])
16
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
17
+ if (kind && result)
18
+ __defProp(target, key, result);
19
+ return result;
20
+ };
21
+ let SdCheckboxGroup = class extends SolidElement {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.hasSlotController = new HasSlotController(this, "label");
25
+ this.label = "";
26
+ this.size = "lg";
27
+ this.orientation = "vertical";
28
+ }
29
+ getAllCheckboxes() {
30
+ return [...this.querySelectorAll("sd-1-22-0-checkbox")];
31
+ }
32
+ async syncCheckboxElements() {
33
+ const checkboxes = this.getAllCheckboxes();
34
+ await Promise.all(
35
+ // Sync the checked state and size
36
+ checkboxes.map(async (checkbox) => {
37
+ await checkbox.updateComplete;
38
+ checkbox.size = this.size;
39
+ })
40
+ );
41
+ if (!checkboxes.some((checkbox) => checkbox.checked)) {
42
+ checkboxes[0].tabIndex = 0;
43
+ }
44
+ }
45
+ syncCheckboxes() {
46
+ if (customElements.get("sd-1-22-0-checkbox")) {
47
+ this.syncCheckboxElements();
48
+ } else {
49
+ customElements.whenDefined("sd-1-22-0-checkbox").then(() => this.syncCheckboxes());
50
+ }
51
+ }
52
+ handleSizeChange() {
53
+ this.syncCheckboxes();
54
+ }
55
+ handleInvalid() {
56
+ this.syncCheckboxes();
57
+ }
58
+ render() {
59
+ const hasLabelSlot = this.hasSlotController.test("label");
60
+ const hasLabel = this.label ? true : hasLabelSlot;
61
+ const defaultSlot = html`<slot @slotchange="${this.syncCheckboxes}"></slot>`;
62
+ return html`<fieldset part="form-control" class="${cx(
63
+ "border-0 p-0 m-0",
64
+ {
65
+ /* sizes, fonts */
66
+ sm: "text-sm",
67
+ lg: "text-base"
68
+ }[this.size]
69
+ )}" role="group" aria-labelledby="label"><label part="form-control-label" id="label" class="${cx("mb-2 p-0 font-bold leading-normal text-black", hasLabel ? "flex" : "hidden")}" aria-hidden="${!hasLabel}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${cx(
70
+ {
71
+ vertical: "flex flex-col",
72
+ horizontal: "flex flex-row"
73
+ }[this.orientation]
74
+ )}">${defaultSlot}</div></fieldset>`;
75
+ }
76
+ };
77
+ SdCheckboxGroup.styles = [
78
+ componentStyles,
79
+ SolidElement.styles,
80
+ css`:host{display:block}:host([orientation=vertical]) ::slotted(sd-1-22-0-checkbox){margin-bottom:8px;display:flex}:host([orientation=vertical]) ::slotted(sd-1-22-0-checkbox:last-of-type){margin-bottom:0}:host([orientation=horizontal]) ::slotted(sd-1-22-0-checkbox){margin-right:24px}:host([size=sm]):host([orientation=horizontal]) ::slotted(sd-1-22-0-checkbox){margin-right:16px}:host([orientation=horizontal]) ::slotted(sd-1-22-0-checkbox:last-of-type){margin-right:0}`
81
+ ];
82
+ __decorateClass([
83
+ property()
84
+ ], SdCheckboxGroup.prototype, "label", 2);
85
+ __decorateClass([
86
+ property({ reflect: true })
87
+ ], SdCheckboxGroup.prototype, "size", 2);
88
+ __decorateClass([
89
+ property({ reflect: true })
90
+ ], SdCheckboxGroup.prototype, "orientation", 2);
91
+ __decorateClass([
92
+ watch("size", { waitUntilFirstUpdate: true })
93
+ ], SdCheckboxGroup.prototype, "handleSizeChange", 1);
94
+ __decorateClass([
95
+ watch("invalid", { waitUntilFirstUpdate: true })
96
+ ], SdCheckboxGroup.prototype, "handleInvalid", 1);
97
+ SdCheckboxGroup = __decorateClass([
98
+ customElement("sd-1-22-0-checkbox-group")
99
+ ], SdCheckboxGroup);
100
+ export {
101
+ SdCheckboxGroup as default
102
+ };
@@ -8,6 +8,6 @@ export default class SdDivider extends SolidElement {
8
8
  }
9
9
  declare global {
10
10
  interface HTMLElementTagNameMap {
11
- 'sd-1-21-1-divider': SdDivider;
11
+ 'sd-1-22-0-divider': SdDivider;
12
12
  }
13
13
  }
@@ -35,7 +35,7 @@ let SdDivider = class extends SolidElement {
35
35
  SdDivider.styles = [
36
36
  componentStyles,
37
37
  SolidElement.styles,
38
- css`:host{margin:0}:host(sd-1-21-1-divider[orientation=horizontal]){display:block}:host(sd-1-21-1-divider[orientation=vertical]){display:inline-block}`
38
+ css`:host{margin:0}:host(sd-1-22-0-divider[orientation=horizontal]){display:block}:host(sd-1-22-0-divider[orientation=vertical]){display:inline-block}`
39
39
  ];
40
40
  __decorateClass([
41
41
  property({ reflect: true })
@@ -44,7 +44,7 @@ __decorateClass([
44
44
  property({ type: Boolean, reflect: true })
45
45
  ], SdDivider.prototype, "inverted", 2);
46
46
  SdDivider = __decorateClass([
47
- customElement("sd-1-21-1-divider")
47
+ customElement("sd-1-22-0-divider")
48
48
  ], SdDivider);
49
49
  export {
50
50
  SdDivider as default
@@ -29,6 +29,6 @@ export default class SdDrawer extends SolidElement {
29
29
  }
30
30
  declare global {
31
31
  interface HTMLElementTagNameMap {
32
- 'sd-1-21-1-drawer': SdDrawer;
32
+ 'sd-1-22-0-drawer': SdDrawer;
33
33
  }
34
34
  }
@@ -183,7 +183,7 @@ let SdDrawer = class extends SolidElement {
183
183
  end: "top-0 end-0 bottom-auto start-auto w-[--width] h-full",
184
184
  start: "top-0 end-auto bottom-auto start-0 w-[--width] h-full"
185
185
  }[this.placement]
186
- )}" role="dialog" aria-modal="true" aria-hidden="${this.open ? "false" : "true"}" aria-label="${this.label}" aria-labelledby="${ifDefined(!this.noHeader ? "title" : void 0)}" tabindex="0">${!this.noHeader ? html`<header part="header" class="flex justify-between py-2 px-4 items-center flex-shrink-0" style="min-height:56px"><div part="title"><slot name="header" part="title" class="flex-auto text-xl m-0" id="title"></slot></div><div class="shrink-0 flex flex-wrap justify-end gap-1 ml-4 absolute top-2 right-2"><sd-1-21-1-button variant="tertiary" size="lg" part="close-button" @click="${() => this.requestClose("close-button")}"><sd-1-21-1-icon name="close" library="system"></sd-1-21-1-icon></sd-1-21-1-button></div></header>` : ""}<div part="body" class="flex-auto block px-4"><slot></slot></div><footer part="footer" class="${cx(this.hasSlotController.test("footer") ? "text-left p-4" : "hidden")}"><slot name="footer"></slot></footer></div></div>`;
186
+ )}" role="dialog" aria-modal="true" aria-hidden="${this.open ? "false" : "true"}" aria-label="${this.label}" aria-labelledby="${ifDefined(!this.noHeader ? "title" : void 0)}" tabindex="0">${!this.noHeader ? html`<header part="header" class="flex justify-between py-2 px-4 items-center flex-shrink-0" style="min-height:56px"><div part="title"><slot name="header" part="title" class="flex-auto text-xl m-0" id="title"></slot></div><div class="shrink-0 flex flex-wrap justify-end gap-1 ml-4 absolute top-2 right-2"><sd-1-22-0-button variant="tertiary" size="lg" part="close-button" @click="${() => this.requestClose("close-button")}"><sd-1-22-0-icon name="close" library="system"></sd-1-22-0-icon></sd-1-22-0-button></div></header>` : ""}<div part="body" class="flex-auto block px-4"><slot></slot></div><footer part="footer" class="${cx(this.hasSlotController.test("footer") ? "text-left p-4" : "hidden")}"><slot name="footer"></slot></footer></div></div>`;
187
187
  }
188
188
  };
189
189
  SdDrawer.styles = [
@@ -221,7 +221,7 @@ __decorateClass([
221
221
  watch("contained", { waitUntilFirstUpdate: true })
222
222
  ], SdDrawer.prototype, "handleNoModalChange", 1);
223
223
  SdDrawer = __decorateClass([
224
- customElement("sd-1-21-1-drawer")
224
+ customElement("sd-1-22-0-drawer")
225
225
  ], SdDrawer);
226
226
  setDefaultAnimation("drawer.showStart", {
227
227
  keyframes: [
@@ -44,6 +44,6 @@ export default class SdDropdown extends SolidElement {
44
44
  }
45
45
  declare global {
46
46
  interface HTMLElementTagNameMap {
47
- 'sd-1-21-1-dropdown': SdDropdown;
47
+ 'sd-1-22-0-dropdown': SdDropdown;
48
48
  }
49
49
  }
@@ -170,7 +170,7 @@ let SdDropdown = class extends SolidElement {
170
170
  // that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,
171
171
  // a child of the slotted element, or an element in the slotted element's shadow root.
172
172
  //
173
- // For example, the accessible trigger of an <sd-1-21-1-button> is a <button> located inside its shadow root.
173
+ // For example, the accessible trigger of an <sd-1-22-0-button> is a <button> located inside its shadow root.
174
174
  //
175
175
  // To determine this, we assume the first tabbable element in the trigger slot is the "accessible trigger."
176
176
  //
@@ -180,8 +180,8 @@ let SdDropdown = class extends SolidElement {
180
180
  let target;
181
181
  if (accessibleTrigger) {
182
182
  switch (accessibleTrigger.tagName.toLowerCase()) {
183
- case "sd-1-21-1-button":
184
- case "sd-1-21-1-icon-button":
183
+ case "sd-1-22-0-button":
184
+ case "sd-1-22-0-icon-button":
185
185
  target = accessibleTrigger.button;
186
186
  break;
187
187
  default:
@@ -257,11 +257,11 @@ let SdDropdown = class extends SolidElement {
257
257
  }
258
258
  }
259
259
  render() {
260
- return html`<sd-1-21-1-popup part="base" id="dropdown" placement="${this.placement}" distance="${this.rounded && this.distance < 1 ? 1 : this.distance}" skidding="${this.skidding}" strategy="${this.hoist ? "fixed" : "absolute"}" ?flip="${!this.noFlip}" shift auto-size="vertical" auto-size-padding="10" ?active="${this.open}"><slot name="trigger" slot="anchor" part="trigger" class="block" @click="${this.handleTriggerClick}" @keydown="${this.handleTriggerKeyDown}" @keyup="${this.handleTriggerKeyUp}" @slotchange="${this.handleTriggerSlotChange}"></slot><slot part="panel" class="${cx(
260
+ return html`<sd-1-22-0-popup part="base" id="dropdown" placement="${this.placement}" distance="${this.rounded && this.distance < 1 ? 1 : this.distance}" skidding="${this.skidding}" strategy="${this.hoist ? "fixed" : "absolute"}" ?flip="${!this.noFlip}" shift auto-size="vertical" auto-size-padding="10" ?active="${this.open}"><slot name="trigger" slot="anchor" part="trigger" class="block" @click="${this.handleTriggerClick}" @keydown="${this.handleTriggerKeyDown}" @keyup="${this.handleTriggerKeyUp}" @slotchange="${this.handleTriggerSlotChange}"></slot><slot part="panel" class="${cx(
261
261
  "shadow bg-white",
262
262
  this.open ? "block pointer-events-auto" : "pointer-events-none",
263
263
  this.rounded && "rounded-md"
264
- )}" aria-hidden="${this.open ? "false" : "true"}" aria-labelledby="dropdown"></slot></sd-1-21-1-popup>`;
264
+ )}" aria-hidden="${this.open ? "false" : "true"}" aria-labelledby="dropdown"></slot></sd-1-22-0-popup>`;
265
265
  }
266
266
  };
267
267
  SdDropdown.styles = [
@@ -315,7 +315,7 @@ __decorateClass([
315
315
  watch("open", { waitUntilFirstUpdate: true })
316
316
  ], SdDropdown.prototype, "handleOpenChange", 1);
317
317
  SdDropdown = __decorateClass([
318
- customElement("sd-1-21-1-dropdown")
318
+ customElement("sd-1-22-0-dropdown")
319
319
  ], SdDropdown);
320
320
  setDefaultAnimation("dropdown.show", {
321
321
  keyframes: [