@warp-ds/elements 2.2.0-next.2 → 2.2.0-next.4

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 (59) hide show
  1. package/dist/custom-elements.json +812 -0
  2. package/dist/index.js +3356 -349
  3. package/dist/index.js.map +4 -4
  4. package/dist/packages/affix/index.d.ts +1 -1
  5. package/dist/packages/affix/index.js +7 -6
  6. package/dist/packages/affix/index.js.map +3 -3
  7. package/dist/packages/alert/alert.test.d.ts +1 -0
  8. package/dist/packages/alert/index.d.ts +11 -16
  9. package/dist/packages/attention/index.d.ts +1 -1
  10. package/dist/packages/attention/index.js +5 -7
  11. package/dist/packages/attention/index.js.map +3 -3
  12. package/dist/packages/badge/index.d.ts +3 -2
  13. package/dist/packages/badge/index.js +1 -1
  14. package/dist/packages/badge/index.js.map +1 -1
  15. package/dist/packages/box/index.d.ts +5 -3
  16. package/dist/packages/box/index.js +1 -1
  17. package/dist/packages/box/index.js.map +1 -1
  18. package/dist/packages/breadcrumbs/index.d.ts +1 -1
  19. package/dist/packages/breadcrumbs/index.js +5 -7
  20. package/dist/packages/breadcrumbs/index.js.map +3 -3
  21. package/dist/packages/button/button.test.d.ts +1 -0
  22. package/dist/packages/button/index.d.ts +28 -52
  23. package/dist/packages/card/card.test.d.ts +1 -0
  24. package/dist/packages/card/index.d.ts +6 -15
  25. package/dist/packages/expandable/expandable.test.d.ts +1 -0
  26. package/dist/packages/expandable/index.d.ts +13 -51
  27. package/dist/packages/modal/index.d.ts +3 -3
  28. package/dist/packages/modal/index.js +302 -351
  29. package/dist/packages/modal/index.js.map +4 -4
  30. package/dist/packages/modal/modal-footer.d.ts +2 -2
  31. package/dist/packages/modal/modal-header.d.ts +12 -20
  32. package/dist/packages/modal/modal-main.d.ts +14 -24
  33. package/dist/packages/pill/index.d.ts +1 -1
  34. package/dist/packages/pill/index.js +6 -8
  35. package/dist/packages/pill/index.js.map +3 -3
  36. package/dist/packages/select/index.d.ts +12 -2
  37. package/dist/packages/select/index.js +306 -11
  38. package/dist/packages/select/index.js.map +4 -4
  39. package/dist/packages/styles.d.ts +2 -0
  40. package/dist/packages/textfield/index.d.ts +7 -7
  41. package/dist/packages/textfield/index.js +294 -5
  42. package/dist/packages/textfield/index.js.map +4 -4
  43. package/dist/packages/toast/index.d.ts +3 -0
  44. package/dist/packages/toast/index.js +8 -10
  45. package/dist/packages/toast/index.js.map +3 -3
  46. package/dist/packages/toast/toast-container.d.ts +3 -4
  47. package/dist/packages/toast/toast.d.ts +4 -6
  48. package/dist/packages/utils/expand-transition.d.ts +3 -2
  49. package/dist/packages/utils/index.d.ts +1 -1
  50. package/dist/packages/utils/unstyled-heading.d.ts +4 -3
  51. package/package.json +27 -15
  52. package/dist/packages/alert/index.js +0 -2466
  53. package/dist/packages/alert/index.js.map +0 -7
  54. package/dist/packages/button/index.js +0 -2183
  55. package/dist/packages/button/index.js.map +0 -7
  56. package/dist/packages/card/index.js +0 -2131
  57. package/dist/packages/card/index.js.map +0 -7
  58. package/dist/packages/expandable/index.js +0 -2346
  59. package/dist/packages/expandable/index.js.map +0 -7
@@ -1,4 +1,4 @@
1
- declare const WarpSelect_base: {
1
+ declare const WarpSelect_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & {
2
2
  new (): {
3
3
  [x: string]: any;
4
4
  };
@@ -42,9 +42,19 @@ export class WarpSelect extends WarpSelect_base {
42
42
  _options: {
43
43
  state: boolean;
44
44
  };
45
+ name: {
46
+ type: StringConstructor;
47
+ reflect: boolean;
48
+ };
49
+ value: {
50
+ type: StringConstructor;
51
+ reflect: boolean;
52
+ };
45
53
  };
46
- static styles: any[];
54
+ static styles: (import("lit").CSSResult | CSSStyleSheet | import("lit").CSSResultArray)[][];
47
55
  _options: any;
56
+ _setValue: (value: any) => void;
57
+ value: any;
48
58
  firstUpdated(): void;
49
59
  handleKeyDown(event: any): void;
50
60
  onChange({ target }: {
@@ -1032,7 +1032,7 @@ var r = function() {
1032
1032
  }, []).join(" ");
1033
1033
  };
1034
1034
 
1035
- // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1035
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_ty_33a2537ce57a59324989ce8020998d0e/node_modules/@lingui/core/dist/index.mjs
1036
1036
  var import_unraw = __toESM(require_dist(), 1);
1037
1037
 
1038
1038
  // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
@@ -1354,7 +1354,7 @@ Message: ${message}`);
1354
1354
  }
1355
1355
  }
1356
1356
 
1357
- // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1357
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_ty_33a2537ce57a59324989ce8020998d0e/node_modules/@lingui/core/dist/index.mjs
1358
1358
  var isString = (s) => typeof s === "string";
1359
1359
  var isFunction = (f) => typeof f === "function";
1360
1360
  var cache = /* @__PURE__ */ new Map();
@@ -1762,7 +1762,292 @@ function setupI18n(params = {}) {
1762
1762
  }
1763
1763
  var i18n = setupI18n();
1764
1764
 
1765
- // node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5.3.3_@t_sgrraibu65gdmqpe655kfrpl6a/node_modules/@warp-ds/css/component-classes/index.js
1765
+ // node_modules/.pnpm/@open-wc+form-control@1.0.0/node_modules/@open-wc/form-control/src/FormControlMixin.js
1766
+ var __classPrivateFieldGet = function(receiver, state, kind, f) {
1767
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1768
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1769
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1770
+ };
1771
+ var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
1772
+ if (kind === "m") throw new TypeError("Private method is not writable");
1773
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1774
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1775
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1776
+ };
1777
+ function FormControlMixin(SuperClass) {
1778
+ var _FormControl_instances, _FormControl_focused, _FormControl_forceError, _FormControl_touched, _FormControl_abortController, _FormControl_previousAbortController, _FormControl_awaitingValidationTarget, _FormControl_formValidationGroup_get, _FormControl_value, _FormControl_onFocus, _FormControl_onBlur, _FormControl_onInvalid, _FormControl_validationCompleteResolver, _FormControl_isValidationPending, _FormControl_validationComplete, _FormControl_shouldShowError, _FormControl_runValidators, _FormControl_setValidityWithOptionalTarget, _FormControl_getValidatorMessageForValue;
1779
+ class FormControl extends SuperClass {
1780
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1781
+ constructor(...args) {
1782
+ var _a, _b, _c;
1783
+ super(...args);
1784
+ _FormControl_instances.add(this);
1785
+ this.internals = this.attachInternals();
1786
+ _FormControl_focused.set(this, false);
1787
+ _FormControl_forceError.set(this, false);
1788
+ _FormControl_touched.set(this, false);
1789
+ _FormControl_abortController.set(this, void 0);
1790
+ _FormControl_previousAbortController.set(this, void 0);
1791
+ _FormControl_awaitingValidationTarget.set(this, true);
1792
+ _FormControl_value.set(this, "");
1793
+ _FormControl_onFocus.set(this, () => {
1794
+ __classPrivateFieldSet(this, _FormControl_touched, true, "f");
1795
+ __classPrivateFieldSet(this, _FormControl_focused, true, "f");
1796
+ __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
1797
+ });
1798
+ _FormControl_onBlur.set(this, () => {
1799
+ __classPrivateFieldSet(this, _FormControl_focused, false, "f");
1800
+ __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_runValidators).call(this, this.shouldFormValueUpdate() ? __classPrivateFieldGet(this, _FormControl_value, "f") : "");
1801
+ if (!this.validity.valid && __classPrivateFieldGet(this, _FormControl_touched, "f")) {
1802
+ __classPrivateFieldSet(this, _FormControl_forceError, true, "f");
1803
+ }
1804
+ const showError = __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
1805
+ if (this.validationMessageCallback) {
1806
+ this.validationMessageCallback(showError ? this.internals.validationMessage : "");
1807
+ }
1808
+ });
1809
+ _FormControl_onInvalid.set(this, () => {
1810
+ var _a2;
1811
+ if (__classPrivateFieldGet(this, _FormControl_awaitingValidationTarget, "f") && this.validationTarget) {
1812
+ this.internals.setValidity(this.validity, this.validationMessage, this.validationTarget);
1813
+ __classPrivateFieldSet(this, _FormControl_awaitingValidationTarget, false, "f");
1814
+ }
1815
+ __classPrivateFieldSet(this, _FormControl_touched, true, "f");
1816
+ __classPrivateFieldSet(this, _FormControl_forceError, true, "f");
1817
+ __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
1818
+ (_a2 = this === null || this === void 0 ? void 0 : this.validationMessageCallback) === null || _a2 === void 0 ? void 0 : _a2.call(this, this.showError ? this.internals.validationMessage : "");
1819
+ });
1820
+ _FormControl_validationCompleteResolver.set(this, void 0);
1821
+ _FormControl_isValidationPending.set(this, false);
1822
+ _FormControl_validationComplete.set(this, Promise.resolve());
1823
+ (_a = this.addEventListener) === null || _a === void 0 ? void 0 : _a.call(this, "focus", __classPrivateFieldGet(this, _FormControl_onFocus, "f"));
1824
+ (_b = this.addEventListener) === null || _b === void 0 ? void 0 : _b.call(this, "blur", __classPrivateFieldGet(this, _FormControl_onBlur, "f"));
1825
+ (_c = this.addEventListener) === null || _c === void 0 ? void 0 : _c.call(this, "invalid", __classPrivateFieldGet(this, _FormControl_onInvalid, "f"));
1826
+ this.setValue(null);
1827
+ }
1828
+ /** Wires up control instances to be form associated */
1829
+ static get formAssociated() {
1830
+ return true;
1831
+ }
1832
+ static get validators() {
1833
+ return this.formControlValidators || [];
1834
+ }
1835
+ /**
1836
+ * Allows the FormControl instance to respond to Validator attributes.
1837
+ * For instance, if a given Validator has a `required` attribute, that
1838
+ * validator will be evaluated whenever the host's required attribute
1839
+ * is updated.
1840
+ */
1841
+ static get observedAttributes() {
1842
+ const validatorAttributes = this.validators.map((validator) => validator.attribute).flat();
1843
+ const observedAttributes = super.observedAttributes || [];
1844
+ const attributeSet = /* @__PURE__ */ new Set([...observedAttributes, ...validatorAttributes]);
1845
+ return [...attributeSet];
1846
+ }
1847
+ /**
1848
+ * Return the validator associated with a given attribute. If no
1849
+ * Validator is associated with the attribute, it will return null.
1850
+ */
1851
+ static getValidator(attribute) {
1852
+ return this.validators.find((validator) => validator.attribute === attribute) || null;
1853
+ }
1854
+ /**
1855
+ * Get all validators that are set to react to a given attribute
1856
+ * @param {string} attribute - The attribute that has changed
1857
+ * @returns {Validator[]}
1858
+ */
1859
+ static getValidators(attribute) {
1860
+ return this.validators.filter((validator) => {
1861
+ var _a;
1862
+ if (validator.attribute === attribute || ((_a = validator.attribute) === null || _a === void 0 ? void 0 : _a.includes(attribute))) {
1863
+ return true;
1864
+ }
1865
+ });
1866
+ }
1867
+ /** Return a reference to the control's form */
1868
+ get form() {
1869
+ return this.internals.form;
1870
+ }
1871
+ /**
1872
+ * Will return true if it is recommended that the control shows an internal
1873
+ * error. If using this property, it is wise to listen for 'invalid' events
1874
+ * on the element host and call preventDefault on the event. Doing this will
1875
+ * prevent browsers from showing a validation popup.
1876
+ */
1877
+ get showError() {
1878
+ return __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
1879
+ }
1880
+ /**
1881
+ * Forward the internals checkValidity method
1882
+ * will return the valid state of the control.
1883
+ */
1884
+ checkValidity() {
1885
+ return this.internals.checkValidity();
1886
+ }
1887
+ /** The element's validity state */
1888
+ get validity() {
1889
+ return this.internals.validity;
1890
+ }
1891
+ /**
1892
+ * The validation message shown by a given Validator object. If the control
1893
+ * is in a valid state this should be falsy.
1894
+ */
1895
+ get validationMessage() {
1896
+ return this.internals.validationMessage;
1897
+ }
1898
+ attributeChangedCallback(name, oldValue, newValue) {
1899
+ var _a;
1900
+ (_a = super.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.call(this, name, oldValue, newValue);
1901
+ const proto = this.constructor;
1902
+ const validators = proto.getValidators(name);
1903
+ if ((validators === null || validators === void 0 ? void 0 : validators.length) && this.validationTarget) {
1904
+ this.setValue(__classPrivateFieldGet(this, _FormControl_value, "f"));
1905
+ }
1906
+ }
1907
+ /** PUBLIC LIFECYCLE METHODS */
1908
+ /**
1909
+ * Sets the control's form value if the call to `shouldFormValueUpdate`
1910
+ * returns `true`.
1911
+ * @param value {FormValue} - The value to pass to the form
1912
+ */
1913
+ setValue(value) {
1914
+ var _a;
1915
+ __classPrivateFieldSet(this, _FormControl_forceError, false, "f");
1916
+ (_a = this.validationMessageCallback) === null || _a === void 0 ? void 0 : _a.call(this, "");
1917
+ __classPrivateFieldSet(this, _FormControl_value, value, "f");
1918
+ const valueShouldUpdate = this.shouldFormValueUpdate();
1919
+ const valueToUpdate = valueShouldUpdate ? value : null;
1920
+ this.internals.setFormValue(valueToUpdate);
1921
+ __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_runValidators).call(this, valueToUpdate);
1922
+ if (this.valueChangedCallback) {
1923
+ this.valueChangedCallback(valueToUpdate);
1924
+ }
1925
+ __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
1926
+ }
1927
+ /**
1928
+ * This method can be overridden to determine if the control's form value
1929
+ * should be set on a call to `setValue`. An example of when a user might want
1930
+ * to skip this step is when implementing checkbox-like behavior, first checking
1931
+ * to see if `this.checked` is set to a truthy value. By default this returns
1932
+ * `true`.
1933
+ */
1934
+ shouldFormValueUpdate() {
1935
+ return true;
1936
+ }
1937
+ /** A promise that will resolve when all pending validations are complete */
1938
+ get validationComplete() {
1939
+ return new Promise((resolve) => resolve(__classPrivateFieldGet(this, _FormControl_validationComplete, "f")));
1940
+ }
1941
+ /** Reset control state when the form is reset */
1942
+ formResetCallback() {
1943
+ var _a, _b;
1944
+ __classPrivateFieldSet(this, _FormControl_touched, false, "f");
1945
+ __classPrivateFieldSet(this, _FormControl_forceError, false, "f");
1946
+ __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this);
1947
+ (_a = this.resetFormControl) === null || _a === void 0 ? void 0 : _a.call(this);
1948
+ (_b = this.validationMessageCallback) === null || _b === void 0 ? void 0 : _b.call(this, __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_shouldShowError).call(this) ? this.validationMessage : "");
1949
+ }
1950
+ }
1951
+ _FormControl_focused = /* @__PURE__ */ new WeakMap(), _FormControl_forceError = /* @__PURE__ */ new WeakMap(), _FormControl_touched = /* @__PURE__ */ new WeakMap(), _FormControl_abortController = /* @__PURE__ */ new WeakMap(), _FormControl_previousAbortController = /* @__PURE__ */ new WeakMap(), _FormControl_awaitingValidationTarget = /* @__PURE__ */ new WeakMap(), _FormControl_value = /* @__PURE__ */ new WeakMap(), _FormControl_onFocus = /* @__PURE__ */ new WeakMap(), _FormControl_onBlur = /* @__PURE__ */ new WeakMap(), _FormControl_onInvalid = /* @__PURE__ */ new WeakMap(), _FormControl_validationCompleteResolver = /* @__PURE__ */ new WeakMap(), _FormControl_isValidationPending = /* @__PURE__ */ new WeakMap(), _FormControl_validationComplete = /* @__PURE__ */ new WeakMap(), _FormControl_instances = /* @__PURE__ */ new WeakSet(), _FormControl_formValidationGroup_get = function _FormControl_formValidationGroup_get2() {
1952
+ const rootNode = this.getRootNode();
1953
+ const selector = `${this.localName}[name="${this.getAttribute("name")}"]`;
1954
+ return rootNode.querySelectorAll(selector);
1955
+ }, _FormControl_shouldShowError = function _FormControl_shouldShowError2() {
1956
+ if (this.hasAttribute("disabled")) {
1957
+ return false;
1958
+ }
1959
+ const showError = __classPrivateFieldGet(this, _FormControl_forceError, "f") || __classPrivateFieldGet(this, _FormControl_touched, "f") && !this.validity.valid && !__classPrivateFieldGet(this, _FormControl_focused, "f");
1960
+ if (showError && this.internals.states) {
1961
+ this.internals.states.add("--show-error");
1962
+ } else if (this.internals.states) {
1963
+ this.internals.states.delete("--show-error");
1964
+ }
1965
+ return showError;
1966
+ }, _FormControl_runValidators = function _FormControl_runValidators2(value) {
1967
+ const proto = this.constructor;
1968
+ const validity = {};
1969
+ const validators = proto.validators;
1970
+ const asyncValidators = [];
1971
+ const hasAsyncValidators = validators.some((validator) => validator.isValid instanceof Promise);
1972
+ if (!__classPrivateFieldGet(this, _FormControl_isValidationPending, "f")) {
1973
+ __classPrivateFieldSet(this, _FormControl_validationComplete, new Promise((resolve) => {
1974
+ __classPrivateFieldSet(this, _FormControl_validationCompleteResolver, resolve, "f");
1975
+ }), "f");
1976
+ __classPrivateFieldSet(this, _FormControl_isValidationPending, true, "f");
1977
+ }
1978
+ if (__classPrivateFieldGet(this, _FormControl_abortController, "f")) {
1979
+ __classPrivateFieldGet(this, _FormControl_abortController, "f").abort();
1980
+ __classPrivateFieldSet(this, _FormControl_previousAbortController, __classPrivateFieldGet(this, _FormControl_abortController, "f"), "f");
1981
+ }
1982
+ const abortController = new AbortController();
1983
+ __classPrivateFieldSet(this, _FormControl_abortController, abortController, "f");
1984
+ let validationMessage = void 0;
1985
+ let hasChange = false;
1986
+ if (!validators.length) {
1987
+ return;
1988
+ }
1989
+ validators.forEach((validator) => {
1990
+ const key = validator.key || "customError";
1991
+ const isValid = validator.isValid(this, value, abortController.signal);
1992
+ const isAsyncValidator = isValid instanceof Promise;
1993
+ if (isAsyncValidator) {
1994
+ asyncValidators.push(isValid);
1995
+ isValid.then((isValidatorValid) => {
1996
+ if (isValidatorValid === void 0 || isValidatorValid === null) {
1997
+ return;
1998
+ }
1999
+ validity[key] = !isValidatorValid;
2000
+ validationMessage = __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_getValidatorMessageForValue).call(this, validator, value);
2001
+ __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_setValidityWithOptionalTarget).call(this, validity, validationMessage);
2002
+ });
2003
+ } else {
2004
+ validity[key] = !isValid;
2005
+ if (this.validity[key] !== !isValid) {
2006
+ hasChange = true;
2007
+ }
2008
+ if (!isValid && !validationMessage) {
2009
+ validationMessage = __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_getValidatorMessageForValue).call(this, validator, value);
2010
+ }
2011
+ }
2012
+ });
2013
+ Promise.allSettled(asyncValidators).then(() => {
2014
+ var _a;
2015
+ if (!(abortController === null || abortController === void 0 ? void 0 : abortController.signal.aborted)) {
2016
+ __classPrivateFieldSet(this, _FormControl_isValidationPending, false, "f");
2017
+ (_a = __classPrivateFieldGet(this, _FormControl_validationCompleteResolver, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2018
+ }
2019
+ });
2020
+ if (hasChange || !hasAsyncValidators) {
2021
+ __classPrivateFieldGet(this, _FormControl_instances, "m", _FormControl_setValidityWithOptionalTarget).call(this, validity, validationMessage);
2022
+ }
2023
+ }, _FormControl_setValidityWithOptionalTarget = function _FormControl_setValidityWithOptionalTarget2(validity, validationMessage) {
2024
+ if (this.validationTarget) {
2025
+ this.internals.setValidity(validity, validationMessage, this.validationTarget);
2026
+ __classPrivateFieldSet(this, _FormControl_awaitingValidationTarget, false, "f");
2027
+ } else {
2028
+ this.internals.setValidity(validity, validationMessage);
2029
+ if (this.internals.validity.valid) {
2030
+ return;
2031
+ }
2032
+ __classPrivateFieldSet(this, _FormControl_awaitingValidationTarget, true, "f");
2033
+ }
2034
+ }, _FormControl_getValidatorMessageForValue = function _FormControl_getValidatorMessageForValue2(validator, value) {
2035
+ if (this.validityCallback) {
2036
+ const message = this.validityCallback(validator.key || "customError");
2037
+ if (message) {
2038
+ return message;
2039
+ }
2040
+ }
2041
+ if (validator.message instanceof Function) {
2042
+ return validator.message(this, value);
2043
+ } else {
2044
+ return validator.message;
2045
+ }
2046
+ };
2047
+ return FormControl;
2048
+ }
2049
+
2050
+ // node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5._43dfacbc4a7d78ad84ef685a7085e344/node_modules/@warp-ds/css/component-classes/index.js
1766
2051
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1767
2052
  var buttonColors = {
1768
2053
  primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
@@ -2021,9 +2306,7 @@ import { when } from "lit/directives/when.js";
2021
2306
  var supportedLocales = ["en", "nb", "fi", "da", "sv"];
2022
2307
  var defaultLocale2 = "en";
2023
2308
  var getSupportedLocale = (usedLocale) => {
2024
- return supportedLocales.find(
2025
- (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
2026
- ) || defaultLocale2;
2309
+ return supportedLocales.find((locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)) || defaultLocale2;
2027
2310
  };
2028
2311
  function detectLocale() {
2029
2312
  if (typeof window === "undefined") {
@@ -2084,7 +2367,7 @@ var messages4 = JSON.parse('{"select.label.optional":["(valgfritt)"]}');
2084
2367
  // packages/select/locales/sv/messages.mjs
2085
2368
  var messages5 = JSON.parse('{"select.label.optional":["(valfritt)"]}');
2086
2369
 
2087
- // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
2370
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-p_f73b1d3c5bd9121d6f30248535f1f172/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
2088
2371
  import { LitElement } from "lit";
2089
2372
  import { unsafeStatic, html } from "lit/static-html.js";
2090
2373
  var messages6 = JSON.parse('{"icon.title.chevron-down":["Nedoverpil"]}');
@@ -2180,23 +2463,33 @@ if (!customElements.get("w-icon-chevron-down-16")) {
2180
2463
 
2181
2464
  // packages/select/index.js
2182
2465
  var _WarpSelect_instances, classes_get, helpTextClasses_get, chevronClasses_get, id_get, helpId_get;
2183
- var WarpSelect = class extends kebabCaseAttributes(WarpElement) {
2466
+ var WarpSelect = class extends FormControlMixin(kebabCaseAttributes(WarpElement)) {
2184
2467
  constructor() {
2185
2468
  super();
2186
2469
  __privateAdd(this, _WarpSelect_instances);
2470
+ __publicField(this, "_setValue", (value) => {
2471
+ this.value = value;
2472
+ this.setValue(value);
2473
+ });
2187
2474
  activateI18n(messages2, messages4, messages3, messages, messages5);
2188
2475
  this._options = this.innerHTML;
2189
2476
  }
2190
2477
  firstUpdated() {
2191
- this.autoFocus && this.shadowRoot.querySelector("select").focus();
2478
+ if (this.autoFocus) this.shadowRoot.querySelector("select").focus();
2479
+ Array.from(this.children).map((child) => {
2480
+ if (child.selected) {
2481
+ this._setValue(child.value);
2482
+ }
2483
+ });
2192
2484
  }
2193
2485
  handleKeyDown(event) {
2194
2486
  if (this.readOnly && (event.key === " " || event.key === "ArrowDown" || event.key === "ArrowUp")) {
2195
2487
  event.preventDefault();
2196
2488
  }
2197
2489
  }
2198
- // Fire a custom 'change' event, used when the dropdown changes state.
2490
+ // // Fire a custom 'change' event, used when the dropdown changes state.
2199
2491
  onChange({ target }) {
2492
+ this._setValue(target.value);
2200
2493
  const event = new CustomEvent("change", { detail: target.value });
2201
2494
  this.dispatchEvent(event);
2202
2495
  }
@@ -2277,7 +2570,9 @@ __publicField(WarpSelect, "properties", {
2277
2570
  disabled: { type: Boolean, reflect: true },
2278
2571
  // Renders the field in a readonly state.
2279
2572
  readOnly: { type: Boolean, relfect: true },
2280
- _options: { state: true }
2573
+ _options: { state: true },
2574
+ name: { type: String, reflect: true },
2575
+ value: { type: String, reflect: true }
2281
2576
  });
2282
2577
  __publicField(WarpSelect, "styles", [WarpElement.styles]);
2283
2578
  if (!customElements.get("w-select")) {