@latty-ds/web 0.3.0 → 0.5.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 (36) hide show
  1. package/custom-elements.json +2932 -2558
  2. package/dist/components/accordion/index.js +1 -1
  3. package/dist/components/avatar/index.js +1 -1
  4. package/dist/components/checkbox/checkbox.d.ts +7 -5
  5. package/dist/components/checkbox/index.js +22 -9
  6. package/dist/components/color-input/color-input.d.ts +17 -0
  7. package/dist/components/color-input/index.js +32 -4
  8. package/dist/components/combobox/combobox.d.ts +8 -1
  9. package/dist/components/combobox/index.js +26 -7
  10. package/dist/components/date-input/date-input.d.ts +7 -0
  11. package/dist/components/date-input/index.js +24 -5
  12. package/dist/components/datepicker/datepicker.d.ts +8 -0
  13. package/dist/components/datepicker/index.js +27 -7
  14. package/dist/components/dialog/dialog.d.ts +4 -2
  15. package/dist/components/dialog/index.js +5 -12
  16. package/dist/components/divider/index.js +1 -1
  17. package/dist/components/nav/index.js +2 -2
  18. package/dist/components/progress/index.js +2 -2
  19. package/dist/components/radio/index.js +24 -4
  20. package/dist/components/radio/radio.d.ts +7 -0
  21. package/dist/components/radio-group/index.js +3 -3
  22. package/dist/components/select/index.js +28 -9
  23. package/dist/components/select/select.d.ts +11 -3
  24. package/dist/components/sidepanel/index.js +1 -1
  25. package/dist/components/slider/index.js +17 -4
  26. package/dist/components/slider/slider.d.ts +6 -0
  27. package/dist/components/switch/index.js +24 -4
  28. package/dist/components/switch/switch.d.ts +7 -0
  29. package/dist/components/tab/index.js +2 -2
  30. package/dist/components/tab-group/index.js +3 -3
  31. package/dist/components/textfield/index.js +26 -4
  32. package/dist/components/textfield/textfield.d.ts +11 -0
  33. package/dist/index.cjs +269 -83
  34. package/dist/index.js +269 -83
  35. package/dist/manifest.json +24 -0
  36. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -1744,7 +1744,7 @@ var Accordion = class extends ThemeableElement {
1744
1744
  };
1745
1745
  Accordion.styles = accordionStyles;
1746
1746
  __decorateClass([
1747
- n4()
1747
+ n4({ reflect: true })
1748
1748
  ], Accordion.prototype, "label", 2);
1749
1749
  __decorateClass([
1750
1750
  n4({ attribute: "icon-start" })
@@ -2657,7 +2657,7 @@ var checkboxStyles = i`
2657
2657
  var import_icons4 = require("@latty-ds/icons");
2658
2658
  var Checkbox = class extends ThemeableElement {
2659
2659
  constructor() {
2660
- super(...arguments);
2660
+ super();
2661
2661
  this.variant = "primary";
2662
2662
  this.size = "md";
2663
2663
  this.checked = false;
@@ -2668,15 +2668,27 @@ var Checkbox = class extends ThemeableElement {
2668
2668
  this.labelPosition = "right";
2669
2669
  this.name = "";
2670
2670
  this.value = "on";
2671
+ this._internals = this.attachInternals();
2671
2672
  }
2672
- /**
2673
- * Handles changes to the indeterminate property.
2674
- * Updates the native input's indeterminate state.
2675
- */
2676
2673
  updated(changedProperties) {
2677
2674
  if (changedProperties.has("indeterminate") && this.input) {
2678
2675
  this.input.indeterminate = this.indeterminate;
2679
2676
  }
2677
+ this._internals.setFormValue(this.checked ? this.value : null);
2678
+ if (this.required && !this.checked && this.input) {
2679
+ this._internals.setValidity({ valueMissing: true }, "Please check this box", this.input);
2680
+ } else {
2681
+ this._internals.setValidity({});
2682
+ }
2683
+ }
2684
+ formResetCallback() {
2685
+ this.checked = false;
2686
+ }
2687
+ checkValidity() {
2688
+ return this._internals.checkValidity();
2689
+ }
2690
+ reportValidity() {
2691
+ return this._internals.reportValidity();
2680
2692
  }
2681
2693
  /**
2682
2694
  * Handles checkbox change events.
@@ -2691,7 +2703,7 @@ var Checkbox = class extends ThemeableElement {
2691
2703
  this.indeterminate = false;
2692
2704
  this.dispatchEvent(
2693
2705
  new CustomEvent("change", {
2694
- detail: { checked: this.checked, indeterminate: this.indeterminate },
2706
+ detail: { checked: this.checked },
2695
2707
  bubbles: true,
2696
2708
  composed: true
2697
2709
  })
@@ -2735,6 +2747,7 @@ var Checkbox = class extends ThemeableElement {
2735
2747
  }
2736
2748
  };
2737
2749
  Checkbox.styles = checkboxStyles;
2750
+ Checkbox.formAssociated = true;
2738
2751
  __decorateClass([
2739
2752
  n4({ reflect: true })
2740
2753
  ], Checkbox.prototype, "variant", 2);
@@ -2754,16 +2767,16 @@ __decorateClass([
2754
2767
  n4({ type: Boolean, reflect: true })
2755
2768
  ], Checkbox.prototype, "required", 2);
2756
2769
  __decorateClass([
2757
- n4()
2770
+ n4({ reflect: true })
2758
2771
  ], Checkbox.prototype, "label", 2);
2759
2772
  __decorateClass([
2760
2773
  n4({ attribute: "label-position", reflect: true })
2761
2774
  ], Checkbox.prototype, "labelPosition", 2);
2762
2775
  __decorateClass([
2763
- n4()
2776
+ n4({ reflect: true })
2764
2777
  ], Checkbox.prototype, "name", 2);
2765
2778
  __decorateClass([
2766
- n4()
2779
+ n4({ reflect: true })
2767
2780
  ], Checkbox.prototype, "value", 2);
2768
2781
  __decorateClass([
2769
2782
  e4('input[type="checkbox"]')
@@ -3353,22 +3366,15 @@ var Dialog = class extends ThemeableElement {
3353
3366
  this.updateComplete.then(() => {
3354
3367
  this.dialogElement?.focus();
3355
3368
  });
3356
- this.dispatchEvent(
3357
- new CustomEvent("dialog-open", {
3358
- bubbles: true,
3359
- composed: true
3360
- })
3361
- );
3369
+ const openEvent = new CustomEvent("open", { bubbles: true, composed: true });
3370
+ this.dispatchEvent(openEvent);
3371
+ this.dispatchEvent(new CustomEvent("dialog-open", { bubbles: true, composed: true }));
3362
3372
  }
3363
3373
  handleClose() {
3364
3374
  document.body.style.overflow = "";
3365
3375
  this.restoreFocus();
3366
- this.dispatchEvent(
3367
- new CustomEvent("dialog-close", {
3368
- bubbles: true,
3369
- composed: true
3370
- })
3371
- );
3376
+ this.dispatchEvent(new CustomEvent("close", { bubbles: true, composed: true }));
3377
+ this.dispatchEvent(new CustomEvent("dialog-close", { bubbles: true, composed: true }));
3372
3378
  }
3373
3379
  restoreFocus() {
3374
3380
  if (this.previouslyFocusedElement) {
@@ -3837,7 +3843,7 @@ var radioStyles = i`
3837
3843
  // src/components/radio/radio.ts
3838
3844
  var Radio = class extends ThemeableElement {
3839
3845
  constructor() {
3840
- super(...arguments);
3846
+ super();
3841
3847
  this.variant = "primary";
3842
3848
  this.size = "md";
3843
3849
  this.checked = false;
@@ -3847,6 +3853,25 @@ var Radio = class extends ThemeableElement {
3847
3853
  this.labelPosition = "right";
3848
3854
  this.name = "";
3849
3855
  this.value = "";
3856
+ this._internals = this.attachInternals();
3857
+ }
3858
+ updated() {
3859
+ this._internals.setFormValue(this.checked ? this.value : null);
3860
+ const input = this.shadowRoot?.querySelector("input");
3861
+ if (this.required && !this.checked && input) {
3862
+ this._internals.setValidity({ valueMissing: true }, "Please select this option", input);
3863
+ } else {
3864
+ this._internals.setValidity({});
3865
+ }
3866
+ }
3867
+ formResetCallback() {
3868
+ this.checked = false;
3869
+ }
3870
+ checkValidity() {
3871
+ return this._internals.checkValidity();
3872
+ }
3873
+ reportValidity() {
3874
+ return this._internals.reportValidity();
3850
3875
  }
3851
3876
  /**
3852
3877
  * Handles radio change events.
@@ -3888,6 +3913,7 @@ var Radio = class extends ThemeableElement {
3888
3913
  }
3889
3914
  };
3890
3915
  Radio.styles = radioStyles;
3916
+ Radio.formAssociated = true;
3891
3917
  __decorateClass([
3892
3918
  n4({ reflect: true })
3893
3919
  ], Radio.prototype, "variant", 2);
@@ -3904,16 +3930,16 @@ __decorateClass([
3904
3930
  n4({ type: Boolean, reflect: true })
3905
3931
  ], Radio.prototype, "required", 2);
3906
3932
  __decorateClass([
3907
- n4()
3933
+ n4({ reflect: true })
3908
3934
  ], Radio.prototype, "label", 2);
3909
3935
  __decorateClass([
3910
3936
  n4({ attribute: "label-position", reflect: true })
3911
3937
  ], Radio.prototype, "labelPosition", 2);
3912
3938
  __decorateClass([
3913
- n4()
3939
+ n4({ reflect: true })
3914
3940
  ], Radio.prototype, "name", 2);
3915
3941
  __decorateClass([
3916
- n4()
3942
+ n4({ reflect: true })
3917
3943
  ], Radio.prototype, "value", 2);
3918
3944
  Radio = __decorateClass([
3919
3945
  t3("lt-radio")
@@ -4062,13 +4088,13 @@ var RadioGroup = class extends ThemeableElement {
4062
4088
  };
4063
4089
  RadioGroup.styles = radioGroupStyles;
4064
4090
  __decorateClass([
4065
- n4()
4091
+ n4({ reflect: true })
4066
4092
  ], RadioGroup.prototype, "label", 2);
4067
4093
  __decorateClass([
4068
- n4()
4094
+ n4({ reflect: true })
4069
4095
  ], RadioGroup.prototype, "name", 2);
4070
4096
  __decorateClass([
4071
- n4()
4097
+ n4({ reflect: true })
4072
4098
  ], RadioGroup.prototype, "value", 2);
4073
4099
  __decorateClass([
4074
4100
  n4({ reflect: true })
@@ -5679,12 +5705,13 @@ var selectStyles = [
5679
5705
  var import_icons7 = require("@latty-ds/icons");
5680
5706
  var Select = class extends ThemeableElement {
5681
5707
  constructor() {
5682
- super(...arguments);
5708
+ super();
5683
5709
  this.variant = "default";
5684
5710
  this.size = "md";
5685
5711
  this.value = "";
5686
5712
  this.placeholder = "Select an option";
5687
5713
  this.label = "";
5714
+ this.name = "";
5688
5715
  this.helperText = "";
5689
5716
  this.disabled = false;
5690
5717
  this.required = false;
@@ -5692,6 +5719,7 @@ var Select = class extends ThemeableElement {
5692
5719
  this.isOpen = false;
5693
5720
  this._cleanupClickOutside = null;
5694
5721
  this._floatingCleanup = null;
5722
+ this._internals = this.attachInternals();
5695
5723
  }
5696
5724
  /**
5697
5725
  * Toggles the dropdown open/closed state.
@@ -5777,16 +5805,20 @@ var Select = class extends ThemeableElement {
5777
5805
  const selected = this.options.find((opt) => opt.value === this.value);
5778
5806
  return selected ? selected.label : "";
5779
5807
  }
5780
- /**
5781
- * Reflects the open state as an attribute for CSS styling.
5782
- */
5783
5808
  updated(changedProperties) {
5809
+ this._internals.setFormValue(this.value || null);
5810
+ const trigger = this.shadowRoot?.querySelector(".select-trigger");
5811
+ if (this.required && !this.value && trigger) {
5812
+ this._internals.setValidity({ valueMissing: true }, "Please select an option", trigger);
5813
+ } else {
5814
+ this._internals.setValidity({});
5815
+ }
5784
5816
  if (!changedProperties.has("isOpen")) return;
5785
5817
  if (this.isOpen) {
5786
5818
  this.setAttribute("open", "");
5787
- const trigger = this.shadowRoot.querySelector(".select-trigger");
5819
+ const selectTrigger = this.shadowRoot.querySelector(".select-trigger");
5788
5820
  const listbox = this.shadowRoot.querySelector("lt-surface.dropdown");
5789
- openFloating(trigger, listbox, { matchWidth: true }).then((cleanup) => {
5821
+ openFloating(selectTrigger, listbox, { matchWidth: true }).then((cleanup) => {
5790
5822
  this._floatingCleanup = cleanup;
5791
5823
  });
5792
5824
  } else {
@@ -5796,6 +5828,15 @@ var Select = class extends ThemeableElement {
5796
5828
  this._floatingCleanup = null;
5797
5829
  }
5798
5830
  }
5831
+ formResetCallback() {
5832
+ this.value = "";
5833
+ }
5834
+ checkValidity() {
5835
+ return this._internals.checkValidity();
5836
+ }
5837
+ reportValidity() {
5838
+ return this._internals.reportValidity();
5839
+ }
5799
5840
  render() {
5800
5841
  const selectedLabel = this.getSelectedLabel();
5801
5842
  const hasValue = Boolean(this.value && selectedLabel);
@@ -5854,6 +5895,7 @@ var Select = class extends ThemeableElement {
5854
5895
  }
5855
5896
  };
5856
5897
  Select.styles = selectStyles;
5898
+ Select.formAssociated = true;
5857
5899
  __decorateClass([
5858
5900
  n4({ reflect: true })
5859
5901
  ], Select.prototype, "variant", 2);
@@ -5861,14 +5903,17 @@ __decorateClass([
5861
5903
  n4({ reflect: true })
5862
5904
  ], Select.prototype, "size", 2);
5863
5905
  __decorateClass([
5864
- n4()
5906
+ n4({ reflect: true })
5865
5907
  ], Select.prototype, "value", 2);
5866
5908
  __decorateClass([
5867
- n4()
5909
+ n4({ reflect: true })
5868
5910
  ], Select.prototype, "placeholder", 2);
5869
5911
  __decorateClass([
5870
- n4()
5912
+ n4({ reflect: true })
5871
5913
  ], Select.prototype, "label", 2);
5914
+ __decorateClass([
5915
+ n4({ reflect: true })
5916
+ ], Select.prototype, "name", 2);
5872
5917
  __decorateClass([
5873
5918
  n4({ attribute: "helper-text" })
5874
5919
  ], Select.prototype, "helperText", 2);
@@ -6055,7 +6100,7 @@ var switchStyles = i`
6055
6100
  // src/components/switch/switch.ts
6056
6101
  var Switch = class extends ThemeableElement {
6057
6102
  constructor() {
6058
- super(...arguments);
6103
+ super();
6059
6104
  this.variant = "primary";
6060
6105
  this.size = "md";
6061
6106
  this.checked = false;
@@ -6065,6 +6110,7 @@ var Switch = class extends ThemeableElement {
6065
6110
  this.labelPosition = "right";
6066
6111
  this.name = "";
6067
6112
  this.value = "on";
6113
+ this._internals = this.attachInternals();
6068
6114
  }
6069
6115
  /**
6070
6116
  * Handles switch change events.
@@ -6073,6 +6119,24 @@ var Switch = class extends ThemeableElement {
6073
6119
  * @param e - The native change event
6074
6120
  * @private
6075
6121
  */
6122
+ updated() {
6123
+ this._internals.setFormValue(this.checked ? this.value : null);
6124
+ const input = this.shadowRoot?.querySelector("input");
6125
+ if (this.required && !this.checked && input) {
6126
+ this._internals.setValidity({ valueMissing: true }, "Please check this switch", input);
6127
+ } else {
6128
+ this._internals.setValidity({});
6129
+ }
6130
+ }
6131
+ formResetCallback() {
6132
+ this.checked = false;
6133
+ }
6134
+ checkValidity() {
6135
+ return this._internals.checkValidity();
6136
+ }
6137
+ reportValidity() {
6138
+ return this._internals.reportValidity();
6139
+ }
6076
6140
  handleChange(e7) {
6077
6141
  const target = e7.target;
6078
6142
  this.checked = target.checked;
@@ -6108,6 +6172,7 @@ var Switch = class extends ThemeableElement {
6108
6172
  }
6109
6173
  };
6110
6174
  Switch.styles = switchStyles;
6175
+ Switch.formAssociated = true;
6111
6176
  __decorateClass([
6112
6177
  n4({ reflect: true })
6113
6178
  ], Switch.prototype, "variant", 2);
@@ -6124,16 +6189,16 @@ __decorateClass([
6124
6189
  n4({ type: Boolean, reflect: true })
6125
6190
  ], Switch.prototype, "required", 2);
6126
6191
  __decorateClass([
6127
- n4()
6192
+ n4({ reflect: true })
6128
6193
  ], Switch.prototype, "label", 2);
6129
6194
  __decorateClass([
6130
6195
  n4({ attribute: "label-position", reflect: true })
6131
6196
  ], Switch.prototype, "labelPosition", 2);
6132
6197
  __decorateClass([
6133
- n4()
6198
+ n4({ reflect: true })
6134
6199
  ], Switch.prototype, "name", 2);
6135
6200
  __decorateClass([
6136
- n4()
6201
+ n4({ reflect: true })
6137
6202
  ], Switch.prototype, "value", 2);
6138
6203
  Switch = __decorateClass([
6139
6204
  t3("lt-switch")
@@ -6289,10 +6354,10 @@ var Tab = class extends ThemeableElement {
6289
6354
  };
6290
6355
  Tab.styles = tabStyles;
6291
6356
  __decorateClass([
6292
- n4()
6357
+ n4({ reflect: true })
6293
6358
  ], Tab.prototype, "label", 2);
6294
6359
  __decorateClass([
6295
- n4()
6360
+ n4({ reflect: true })
6296
6361
  ], Tab.prototype, "value", 2);
6297
6362
  __decorateClass([
6298
6363
  n4({ attribute: "icon-start" })
@@ -6510,7 +6575,7 @@ var TabGroup = class extends ThemeableElement {
6510
6575
  };
6511
6576
  TabGroup.styles = tabGroupStyles;
6512
6577
  __decorateClass([
6513
- n4()
6578
+ n4({ reflect: true })
6514
6579
  ], TabGroup.prototype, "value", 2);
6515
6580
  __decorateClass([
6516
6581
  n4({ reflect: true })
@@ -7422,13 +7487,14 @@ var textfieldStyles = i`
7422
7487
  var import_icons10 = require("@latty-ds/icons");
7423
7488
  var Textfield = class extends ThemeableElement {
7424
7489
  constructor() {
7425
- super(...arguments);
7490
+ super();
7426
7491
  this.variant = "default";
7427
7492
  this.size = "md";
7428
7493
  this.type = "text";
7429
7494
  this.value = "";
7430
7495
  this.placeholder = "";
7431
7496
  this.label = "";
7497
+ this.name = "";
7432
7498
  this.helperText = "";
7433
7499
  this.disabled = false;
7434
7500
  this.required = false;
@@ -7447,6 +7513,7 @@ var Textfield = class extends ThemeableElement {
7447
7513
  this._touched = true;
7448
7514
  this._autoError = !this._validate();
7449
7515
  };
7516
+ this._internals = this.attachInternals();
7450
7517
  }
7451
7518
  /**
7452
7519
  * Handles input events from the native input or textarea element.
@@ -7544,6 +7611,22 @@ var Textfield = class extends ThemeableElement {
7544
7611
  updated(changed) {
7545
7612
  super.updated(changed);
7546
7613
  this.toggleAttribute("data-invalid", this._autoError);
7614
+ this._internals.setFormValue(this.value || null);
7615
+ const anchor = this.shadowRoot.querySelector("input") ?? this.shadowRoot.querySelector("textarea");
7616
+ if (this.required && !this.value && anchor) {
7617
+ this._internals.setValidity({ valueMissing: true }, "Please fill in this field", anchor);
7618
+ } else {
7619
+ this._internals.setValidity({});
7620
+ }
7621
+ }
7622
+ formResetCallback() {
7623
+ this.value = "";
7624
+ }
7625
+ checkValidity() {
7626
+ return this._internals.checkValidity();
7627
+ }
7628
+ reportValidity() {
7629
+ return this._internals.reportValidity();
7547
7630
  }
7548
7631
  render() {
7549
7632
  const hasStartIcon = Boolean(this.iconStart);
@@ -7618,6 +7701,7 @@ var Textfield = class extends ThemeableElement {
7618
7701
  }
7619
7702
  };
7620
7703
  Textfield.styles = textfieldStyles;
7704
+ Textfield.formAssociated = true;
7621
7705
  __decorateClass([
7622
7706
  n4({ reflect: true })
7623
7707
  ], Textfield.prototype, "variant", 2);
@@ -7628,14 +7712,17 @@ __decorateClass([
7628
7712
  n4({ reflect: true })
7629
7713
  ], Textfield.prototype, "type", 2);
7630
7714
  __decorateClass([
7631
- n4()
7715
+ n4({ reflect: true })
7632
7716
  ], Textfield.prototype, "value", 2);
7633
7717
  __decorateClass([
7634
- n4()
7718
+ n4({ reflect: true })
7635
7719
  ], Textfield.prototype, "placeholder", 2);
7636
7720
  __decorateClass([
7637
- n4()
7721
+ n4({ reflect: true })
7638
7722
  ], Textfield.prototype, "label", 2);
7723
+ __decorateClass([
7724
+ n4({ reflect: true })
7725
+ ], Textfield.prototype, "name", 2);
7639
7726
  __decorateClass([
7640
7727
  n4({ attribute: "helper-text" })
7641
7728
  ], Textfield.prototype, "helperText", 2);
@@ -7835,7 +7922,7 @@ __decorateClass([
7835
7922
  n4()
7836
7923
  ], Avatar.prototype, "src", 2);
7837
7924
  __decorateClass([
7838
- n4()
7925
+ n4({ reflect: true })
7839
7926
  ], Avatar.prototype, "name", 2);
7840
7927
  __decorateClass([
7841
7928
  n4()
@@ -8828,7 +8915,7 @@ var sliderStyles = i`
8828
8915
  // src/components/slider/slider.ts
8829
8916
  var Slider = class extends ThemeableElement {
8830
8917
  constructor() {
8831
- super(...arguments);
8918
+ super();
8832
8919
  this.size = "md";
8833
8920
  this.disabled = false;
8834
8921
  this.tooltip = false;
@@ -8838,6 +8925,7 @@ var Slider = class extends ThemeableElement {
8838
8925
  this.value = 0;
8839
8926
  this.label = "";
8840
8927
  this.name = "";
8928
+ this._internals = this.attachInternals();
8841
8929
  }
8842
8930
  get _fillPercent() {
8843
8931
  return (this.value - this.min) / (this.max - this.min) * 100;
@@ -8854,6 +8942,17 @@ var Slider = class extends ThemeableElement {
8854
8942
  const centerPx = fill / 100 * (trackW - thumbPx) + thumbPx / 2;
8855
8943
  this.style.setProperty("--_thumb-left", `${centerPx / trackW * 100}%`);
8856
8944
  }
8945
+ this._internals.setFormValue(String(this.value));
8946
+ this._internals.setValidity({});
8947
+ }
8948
+ formResetCallback() {
8949
+ this.value = this.min;
8950
+ }
8951
+ checkValidity() {
8952
+ return this._internals.checkValidity();
8953
+ }
8954
+ reportValidity() {
8955
+ return this._internals.reportValidity();
8857
8956
  }
8858
8957
  _onInput(e7) {
8859
8958
  e7.stopPropagation();
@@ -8907,6 +9006,7 @@ var Slider = class extends ThemeableElement {
8907
9006
  }
8908
9007
  };
8909
9008
  Slider.styles = sliderStyles;
9009
+ Slider.formAssociated = true;
8910
9010
  __decorateClass([
8911
9011
  n4({ reflect: true })
8912
9012
  ], Slider.prototype, "size", 2);
@@ -8926,13 +9026,13 @@ __decorateClass([
8926
9026
  n4({ type: Number })
8927
9027
  ], Slider.prototype, "step", 2);
8928
9028
  __decorateClass([
8929
- n4({ type: Number })
9029
+ n4({ type: Number, reflect: true })
8930
9030
  ], Slider.prototype, "value", 2);
8931
9031
  __decorateClass([
8932
- n4()
9032
+ n4({ reflect: true })
8933
9033
  ], Slider.prototype, "label", 2);
8934
9034
  __decorateClass([
8935
- n4()
9035
+ n4({ reflect: true })
8936
9036
  ], Slider.prototype, "name", 2);
8937
9037
  __decorateClass([
8938
9038
  e4("input")
@@ -9492,7 +9592,7 @@ __decorateClass([
9492
9592
  n4()
9493
9593
  ], NavItem.prototype, "href", 2);
9494
9594
  __decorateClass([
9495
- n4()
9595
+ n4({ reflect: true })
9496
9596
  ], NavItem.prototype, "label", 2);
9497
9597
  __decorateClass([
9498
9598
  n4({ attribute: "icon-start" })
@@ -9544,7 +9644,7 @@ var Nav = class extends ThemeableElement {
9544
9644
  };
9545
9645
  Nav.styles = navStyles;
9546
9646
  __decorateClass([
9547
- n4()
9647
+ n4({ reflect: true })
9548
9648
  ], Nav.prototype, "label", 2);
9549
9649
  __decorateClass([
9550
9650
  n4({ reflect: true })
@@ -9845,7 +9945,7 @@ __decorateClass([
9845
9945
  n4({ reflect: true })
9846
9946
  ], Divider.prototype, "appearance", 2);
9847
9947
  __decorateClass([
9848
- n4()
9948
+ n4({ reflect: true })
9849
9949
  ], Divider.prototype, "label", 2);
9850
9950
  Divider = __decorateClass([
9851
9951
  t3("lt-divider")
@@ -9958,7 +10058,7 @@ var Progress = class extends ThemeableElement {
9958
10058
  };
9959
10059
  Progress.styles = progressStyles;
9960
10060
  __decorateClass([
9961
- n4({ type: Number })
10061
+ n4({ type: Number, reflect: true })
9962
10062
  ], Progress.prototype, "value", 2);
9963
10063
  __decorateClass([
9964
10064
  n4({ reflect: true })
@@ -9967,7 +10067,7 @@ __decorateClass([
9967
10067
  n4({ reflect: true })
9968
10068
  ], Progress.prototype, "size", 2);
9969
10069
  __decorateClass([
9970
- n4()
10070
+ n4({ reflect: true })
9971
10071
  ], Progress.prototype, "label", 2);
9972
10072
  __decorateClass([
9973
10073
  n4({ type: Boolean, reflect: true })
@@ -10281,7 +10381,7 @@ __decorateClass([
10281
10381
  n4()
10282
10382
  ], SidePanel.prototype, "size", 2);
10283
10383
  __decorateClass([
10284
- n4()
10384
+ n4({ reflect: true })
10285
10385
  ], SidePanel.prototype, "label", 2);
10286
10386
  __decorateClass([
10287
10387
  n4({ type: Boolean, attribute: "no-close-button" })
@@ -10631,7 +10731,7 @@ var datepickerStyles = i`
10631
10731
  // src/components/datepicker/datepicker.ts
10632
10732
  var Datepicker = class extends ThemeableElement {
10633
10733
  constructor() {
10634
- super(...arguments);
10734
+ super();
10635
10735
  this.type = "date";
10636
10736
  this.value = "";
10637
10737
  this.min = "";
@@ -10644,6 +10744,26 @@ var Datepicker = class extends ThemeableElement {
10644
10744
  this.required = false;
10645
10745
  this.readonly = false;
10646
10746
  this.name = "";
10747
+ this._internals = this.attachInternals();
10748
+ }
10749
+ updated(changed) {
10750
+ if (changed.has("value") || changed.has("required")) {
10751
+ this._internals.setFormValue(this.value || null);
10752
+ if (this.required && !this.value) {
10753
+ this._internals.setValidity({ valueMissing: true }, "Please select a date", this.input);
10754
+ } else {
10755
+ this._internals.setValidity({});
10756
+ }
10757
+ }
10758
+ }
10759
+ formResetCallback() {
10760
+ this.value = "";
10761
+ }
10762
+ checkValidity() {
10763
+ return this._internals.checkValidity();
10764
+ }
10765
+ reportValidity() {
10766
+ return this._internals.reportValidity();
10647
10767
  }
10648
10768
  handleChange() {
10649
10769
  this.value = this.input.value;
@@ -10660,7 +10780,6 @@ var Datepicker = class extends ThemeableElement {
10660
10780
  .value=${this.value}
10661
10781
  min=${this.min || A}
10662
10782
  max=${this.max || A}
10663
- name=${this.name || A}
10664
10783
  ?disabled=${this.disabled}
10665
10784
  ?required=${this.required}
10666
10785
  ?readonly=${this.readonly}
@@ -10680,20 +10799,21 @@ var Datepicker = class extends ThemeableElement {
10680
10799
  }
10681
10800
  };
10682
10801
  Datepicker.styles = datepickerStyles;
10802
+ Datepicker.formAssociated = true;
10683
10803
  __decorateClass([
10684
10804
  n4({ reflect: true })
10685
10805
  ], Datepicker.prototype, "type", 2);
10686
10806
  __decorateClass([
10687
- n4()
10807
+ n4({ reflect: true })
10688
10808
  ], Datepicker.prototype, "value", 2);
10689
10809
  __decorateClass([
10690
- n4()
10810
+ n4({ reflect: true })
10691
10811
  ], Datepicker.prototype, "min", 2);
10692
10812
  __decorateClass([
10693
- n4()
10813
+ n4({ reflect: true })
10694
10814
  ], Datepicker.prototype, "max", 2);
10695
10815
  __decorateClass([
10696
- n4()
10816
+ n4({ reflect: true })
10697
10817
  ], Datepicker.prototype, "label", 2);
10698
10818
  __decorateClass([
10699
10819
  n4({ attribute: "helper-text" })
@@ -10714,7 +10834,7 @@ __decorateClass([
10714
10834
  n4({ type: Boolean, reflect: true })
10715
10835
  ], Datepicker.prototype, "readonly", 2);
10716
10836
  __decorateClass([
10717
- n4()
10837
+ n4({ reflect: true })
10718
10838
  ], Datepicker.prototype, "name", 2);
10719
10839
  __decorateClass([
10720
10840
  e4("input")
@@ -11798,7 +11918,7 @@ var dateInputStyles = [
11798
11918
  // src/components/date-input/date-input.ts
11799
11919
  var DateInput = class extends ThemeableElement {
11800
11920
  constructor() {
11801
- super(...arguments);
11921
+ super();
11802
11922
  this.value = "";
11803
11923
  this.min = "";
11804
11924
  this.max = "";
@@ -11818,6 +11938,7 @@ var DateInput = class extends ThemeableElement {
11818
11938
  this._open = false;
11819
11939
  this._cleanupClickOutside = null;
11820
11940
  this._floatingCleanup = null;
11941
+ this._internals = this.attachInternals();
11821
11942
  }
11822
11943
  get _displayValue() {
11823
11944
  if (!this.value) return "";
@@ -11865,6 +11986,24 @@ var DateInput = class extends ThemeableElement {
11865
11986
  this.shadowRoot?.querySelector(".field-btn")?.focus();
11866
11987
  }
11867
11988
  }
11989
+ updated() {
11990
+ this._internals.setFormValue(this.value || null);
11991
+ const btn = this.shadowRoot?.querySelector("#field-btn");
11992
+ if (this.required && !this.value && btn) {
11993
+ this._internals.setValidity({ valueMissing: true }, "Please select a date", btn);
11994
+ } else {
11995
+ this._internals.setValidity({});
11996
+ }
11997
+ }
11998
+ formResetCallback() {
11999
+ this.value = "";
12000
+ }
12001
+ checkValidity() {
12002
+ return this._internals.checkValidity();
12003
+ }
12004
+ reportValidity() {
12005
+ return this._internals.reportValidity();
12006
+ }
11868
12007
  render() {
11869
12008
  const displayText = this._displayValue || this.placeholder;
11870
12009
  const isPlaceholder = !this._displayValue;
@@ -11913,13 +12052,13 @@ var DateInput = class extends ThemeableElement {
11913
12052
  </div>
11914
12053
  </div>
11915
12054
 
11916
- ${this.name ? T`<input type="hidden" name=${this.name} .value=${this.value} />` : A}
11917
12055
  ${this.helperText ? T`<span class="helper-text">${this.helperText}</span>` : A}
11918
12056
  </div>
11919
12057
  `;
11920
12058
  }
11921
12059
  };
11922
12060
  DateInput.styles = dateInputStyles;
12061
+ DateInput.formAssociated = true;
11923
12062
  __decorateClass([
11924
12063
  n4({ reflect: true })
11925
12064
  ], DateInput.prototype, "value", 2);
@@ -11939,10 +12078,10 @@ __decorateClass([
11939
12078
  n4({ attribute: "week-start", reflect: true })
11940
12079
  ], DateInput.prototype, "weekStart", 2);
11941
12080
  __decorateClass([
11942
- n4()
12081
+ n4({ reflect: true })
11943
12082
  ], DateInput.prototype, "label", 2);
11944
12083
  __decorateClass([
11945
- n4()
12084
+ n4({ reflect: true })
11946
12085
  ], DateInput.prototype, "placeholder", 2);
11947
12086
  __decorateClass([
11948
12087
  n4({ attribute: "helper-text" })
@@ -11960,7 +12099,7 @@ __decorateClass([
11960
12099
  n4({ type: Boolean, reflect: true })
11961
12100
  ], DateInput.prototype, "required", 2);
11962
12101
  __decorateClass([
11963
- n4()
12102
+ n4({ reflect: true })
11964
12103
  ], DateInput.prototype, "name", 2);
11965
12104
  __decorateClass([
11966
12105
  r5()
@@ -12156,7 +12295,7 @@ var comboboxStyles = [
12156
12295
  var import_icons18 = require("@latty-ds/icons");
12157
12296
  var Combobox = class extends ThemeableElement {
12158
12297
  constructor() {
12159
- super(...arguments);
12298
+ super();
12160
12299
  this.options = [];
12161
12300
  this.value = "";
12162
12301
  this.label = "";
@@ -12172,6 +12311,7 @@ var Combobox = class extends ThemeableElement {
12172
12311
  this.activeIndex = -1;
12173
12312
  this._cleanupClickOutside = null;
12174
12313
  this._floatingCleanup = null;
12314
+ this._internals = this.attachInternals();
12175
12315
  }
12176
12316
  get selectedLabel() {
12177
12317
  return this.options.find((o10) => o10.value === this.value)?.label ?? "";
@@ -12204,7 +12344,7 @@ var Combobox = class extends ThemeableElement {
12204
12344
  if (opt.disabled) return;
12205
12345
  this.value = opt.value;
12206
12346
  this.closeDropdown();
12207
- dispatch(this, "change", { value: opt.value, label: opt.label });
12347
+ dispatch(this, "change", { value: opt.value });
12208
12348
  }
12209
12349
  handleInput(e7) {
12210
12350
  this.query = e7.target.value;
@@ -12242,6 +12382,24 @@ var Combobox = class extends ThemeableElement {
12242
12382
  this._floatingCleanup?.();
12243
12383
  this._floatingCleanup = null;
12244
12384
  }
12385
+ updated() {
12386
+ this._internals.setFormValue(this.value || null);
12387
+ const input = this.shadowRoot?.querySelector("input");
12388
+ if (this.required && !this.value && input) {
12389
+ this._internals.setValidity({ valueMissing: true }, "Please select an option", input);
12390
+ } else {
12391
+ this._internals.setValidity({});
12392
+ }
12393
+ }
12394
+ formResetCallback() {
12395
+ this.value = "";
12396
+ }
12397
+ checkValidity() {
12398
+ return this._internals.checkValidity();
12399
+ }
12400
+ reportValidity() {
12401
+ return this._internals.reportValidity();
12402
+ }
12245
12403
  render() {
12246
12404
  const opts = this.filtered;
12247
12405
  const displayValue = this.open ? this.query : this.selectedLabel;
@@ -12254,7 +12412,6 @@ var Combobox = class extends ThemeableElement {
12254
12412
  aria-autocomplete="list"
12255
12413
  aria-required=${this.required}
12256
12414
  autocomplete="off"
12257
- name=${this.name || A}
12258
12415
  placeholder=${this.open ? this.placeholder : this.selectedLabel || this.placeholder}
12259
12416
  .value=${displayValue}
12260
12417
  ?disabled=${this.disabled}
@@ -12296,17 +12453,18 @@ var Combobox = class extends ThemeableElement {
12296
12453
  }
12297
12454
  };
12298
12455
  Combobox.styles = comboboxStyles;
12456
+ Combobox.formAssociated = true;
12299
12457
  __decorateClass([
12300
12458
  n4({ type: Array })
12301
12459
  ], Combobox.prototype, "options", 2);
12302
12460
  __decorateClass([
12303
- n4()
12461
+ n4({ reflect: true })
12304
12462
  ], Combobox.prototype, "value", 2);
12305
12463
  __decorateClass([
12306
- n4()
12464
+ n4({ reflect: true })
12307
12465
  ], Combobox.prototype, "label", 2);
12308
12466
  __decorateClass([
12309
- n4()
12467
+ n4({ reflect: true })
12310
12468
  ], Combobox.prototype, "placeholder", 2);
12311
12469
  __decorateClass([
12312
12470
  n4({ attribute: "helper-text" })
@@ -12324,7 +12482,7 @@ __decorateClass([
12324
12482
  n4({ type: Boolean, reflect: true })
12325
12483
  ], Combobox.prototype, "required", 2);
12326
12484
  __decorateClass([
12327
- n4()
12485
+ n4({ reflect: true })
12328
12486
  ], Combobox.prototype, "name", 2);
12329
12487
  __decorateClass([
12330
12488
  r5()
@@ -12550,13 +12708,34 @@ function formatColor(hex, format) {
12550
12708
  }
12551
12709
  var ColorInput = class extends ThemeableElement {
12552
12710
  constructor() {
12553
- super(...arguments);
12711
+ super();
12554
12712
  this.value = "";
12555
12713
  this.format = "hex";
12556
12714
  this.label = "";
12557
12715
  this.placeholder = "Pick a color";
12558
12716
  this.disabled = false;
12717
+ this.required = false;
12718
+ this.name = "";
12559
12719
  this.size = "md";
12720
+ this._internals = this.attachInternals();
12721
+ }
12722
+ updated() {
12723
+ this._internals.setFormValue(this.value || null);
12724
+ const input = this.shadowRoot?.querySelector('input[type="color"]');
12725
+ if (this.required && !this.value && input) {
12726
+ this._internals.setValidity({ valueMissing: true }, "Please select a color", input);
12727
+ } else {
12728
+ this._internals.setValidity({});
12729
+ }
12730
+ }
12731
+ formResetCallback() {
12732
+ this.value = "";
12733
+ }
12734
+ checkValidity() {
12735
+ return this._internals.checkValidity();
12736
+ }
12737
+ reportValidity() {
12738
+ return this._internals.reportValidity();
12560
12739
  }
12561
12740
  _handleChange(e7) {
12562
12741
  const pickerHex = e7.target.value;
@@ -12592,21 +12771,28 @@ var ColorInput = class extends ThemeableElement {
12592
12771
  }
12593
12772
  };
12594
12773
  ColorInput.styles = colorInputStyles;
12774
+ ColorInput.formAssociated = true;
12595
12775
  __decorateClass([
12596
- n4()
12776
+ n4({ reflect: true })
12597
12777
  ], ColorInput.prototype, "value", 2);
12598
12778
  __decorateClass([
12599
12779
  n4({ reflect: true })
12600
12780
  ], ColorInput.prototype, "format", 2);
12601
12781
  __decorateClass([
12602
- n4()
12782
+ n4({ reflect: true })
12603
12783
  ], ColorInput.prototype, "label", 2);
12604
12784
  __decorateClass([
12605
- n4()
12785
+ n4({ reflect: true })
12606
12786
  ], ColorInput.prototype, "placeholder", 2);
12607
12787
  __decorateClass([
12608
12788
  n4({ type: Boolean, reflect: true })
12609
12789
  ], ColorInput.prototype, "disabled", 2);
12790
+ __decorateClass([
12791
+ n4({ type: Boolean, reflect: true })
12792
+ ], ColorInput.prototype, "required", 2);
12793
+ __decorateClass([
12794
+ n4({ reflect: true })
12795
+ ], ColorInput.prototype, "name", 2);
12610
12796
  __decorateClass([
12611
12797
  n4({ reflect: true })
12612
12798
  ], ColorInput.prototype, "size", 2);