@warp-ds/elements 2.6.0 → 2.7.0-next.2
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.
- package/dist/custom-elements.json +1552 -0
- package/dist/index.d.ts +561 -0
- package/dist/packages/affix/affix.js +11 -11
- package/dist/packages/affix/affix.js.map +3 -3
- package/dist/packages/alert/alert.js +7 -7
- package/dist/packages/alert/alert.js.map +3 -3
- package/dist/packages/attention/attention.js +22 -22
- package/dist/packages/attention/attention.js.map +3 -3
- package/dist/packages/breadcrumbs/breadcrumbs.js +9 -9
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
- package/dist/packages/button/button.js +11 -11
- package/dist/packages/button/button.js.map +3 -3
- package/dist/packages/card/card.js +8 -8
- package/dist/packages/card/card.js.map +3 -3
- package/dist/packages/checkbox/checkbox.a11y.test.d.ts +1 -0
- package/dist/packages/checkbox/checkbox.a11y.test.js +73 -0
- package/dist/packages/checkbox/checkbox.d.ts +49 -0
- package/dist/packages/checkbox/checkbox.js +2594 -0
- package/dist/packages/checkbox/checkbox.js.map +7 -0
- package/dist/packages/checkbox/checkbox.react.stories.d.ts +12 -0
- package/dist/packages/checkbox/checkbox.react.stories.js +10 -0
- package/dist/packages/checkbox/checkbox.stories.d.ts +25 -0
- package/dist/packages/checkbox/checkbox.stories.js +183 -0
- package/dist/packages/checkbox/checkbox.test.d.ts +1 -0
- package/dist/packages/checkbox/checkbox.test.js +142 -0
- package/dist/packages/checkbox/react.d.ts +5 -0
- package/dist/packages/checkbox/react.js +15 -0
- package/dist/packages/checkbox/styles.d.ts +1 -0
- package/dist/packages/checkbox/styles.js +134 -0
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.d.ts +2 -0
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.js +109 -0
- package/dist/packages/checkbox-group/checkbox-group.d.ts +33 -0
- package/dist/packages/checkbox-group/checkbox-group.js +71 -0
- package/dist/packages/checkbox-group/checkbox-group.js.map +7 -0
- package/dist/packages/checkbox-group/checkbox-group.test.d.ts +2 -0
- package/dist/packages/checkbox-group/checkbox-group.test.js +112 -0
- package/dist/packages/checkbox-group/locales/da/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/da/messages.mjs +1 -0
- package/dist/packages/checkbox-group/locales/en/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/en/messages.mjs +1 -0
- package/dist/packages/checkbox-group/locales/fi/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/fi/messages.mjs +1 -0
- package/dist/packages/checkbox-group/locales/nb/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/nb/messages.mjs +1 -0
- package/dist/packages/checkbox-group/locales/sv/messages.d.mts +1 -0
- package/dist/packages/checkbox-group/locales/sv/messages.mjs +1 -0
- package/dist/packages/checkbox-group/react.d.ts +2 -0
- package/dist/packages/checkbox-group/react.js +11 -0
- package/dist/packages/combobox/combobox.js +11 -11
- package/dist/packages/combobox/combobox.js.map +3 -3
- package/dist/packages/datepicker/datepicker.js +42 -42
- package/dist/packages/datepicker/datepicker.js.map +3 -3
- package/dist/packages/expandable/expandable.js +11 -11
- package/dist/packages/expandable/expandable.js.map +3 -3
- package/dist/packages/i18n.d.ts +2 -0
- package/dist/packages/i18n.js +87 -2
- package/dist/packages/modal-header/modal-header.js +15 -15
- package/dist/packages/modal-header/modal-header.js.map +3 -3
- package/dist/packages/page-indicator/page-indicator.js +7 -7
- package/dist/packages/page-indicator/page-indicator.js.map +3 -3
- package/dist/packages/pagination/pagination.js +24 -24
- package/dist/packages/pagination/pagination.js.map +3 -3
- package/dist/packages/pill/pill.js +10 -10
- package/dist/packages/pill/pill.js.map +3 -3
- package/dist/packages/select/select.js +20 -20
- package/dist/packages/select/select.js.map +3 -3
- package/dist/packages/slider/Slider.d.ts +2 -0
- package/dist/packages/slider/Slider.js +8 -0
- package/dist/packages/slider/index.d.ts +2 -0
- package/dist/packages/slider/index.js +2 -0
- package/dist/packages/slider/locales/da/messages.d.mts +1 -0
- package/dist/packages/slider/locales/da/messages.mjs +1 -0
- package/dist/packages/slider/locales/en/messages.d.mts +1 -0
- package/dist/packages/slider/locales/en/messages.mjs +1 -0
- package/dist/packages/slider/locales/fi/messages.d.mts +1 -0
- package/dist/packages/slider/locales/fi/messages.mjs +1 -0
- package/dist/packages/slider/locales/nb/messages.d.mts +1 -0
- package/dist/packages/slider/locales/nb/messages.mjs +1 -0
- package/dist/packages/slider/locales/sv/messages.d.mts +1 -0
- package/dist/packages/slider/locales/sv/messages.mjs +1 -0
- package/dist/packages/slider/react.d.ts +3 -0
- package/dist/packages/slider/react.js +13 -0
- package/dist/packages/slider/slider.d.ts +64 -0
- package/dist/packages/slider/slider.js +2641 -0
- package/dist/packages/slider/slider.js.map +7 -0
- package/dist/packages/slider/slider.react.stories.d.ts +19 -0
- package/dist/packages/slider/slider.react.stories.js +161 -0
- package/dist/packages/slider/slider.stories.d.ts +26 -0
- package/dist/packages/slider/slider.stories.js +464 -0
- package/dist/packages/slider/slider.test.d.ts +5 -0
- package/dist/packages/slider/slider.test.js +380 -0
- package/dist/packages/slider/styles/w-slider.styles.d.ts +1 -0
- package/dist/packages/slider/styles/w-slider.styles.js +154 -0
- package/dist/packages/slider/styles.d.ts +1 -0
- package/dist/packages/slider/styles.js +2 -0
- package/dist/packages/slider-thumb/SliderThumb.d.ts +2 -0
- package/dist/packages/slider-thumb/SliderThumb.js +8 -0
- package/dist/packages/slider-thumb/oddbird-css-anchor-positioning.d.ts +2 -0
- package/dist/packages/slider-thumb/oddbird-css-anchor-positioning.js +3 -0
- package/dist/packages/slider-thumb/react.d.ts +6 -0
- package/dist/packages/slider-thumb/react.js +15 -0
- package/dist/packages/slider-thumb/slider-thumb.d.ts +72 -0
- package/dist/packages/slider-thumb/slider-thumb.js +2774 -0
- package/dist/packages/slider-thumb/slider-thumb.js.map +7 -0
- package/dist/packages/slider-thumb/styles/w-slider-thumb.styles.d.ts +1 -0
- package/dist/packages/slider-thumb/styles/w-slider-thumb.styles.js +194 -0
- package/dist/packages/step/step.js +13 -13
- package/dist/packages/step/step.js.map +3 -3
- package/dist/packages/step-indicator/step-indicator.a11y.test.js +6 -2
- package/dist/packages/textarea/textarea.a11y.test.js +1 -1
- package/dist/packages/textarea/textarea.test.js +2 -1
- package/dist/packages/textfield/styles/w-textfield.styles.js +6 -0
- package/dist/packages/textfield/textfield.js +7 -1
- package/dist/packages/textfield/textfield.js.map +2 -2
- package/dist/packages/toast/toast.js +13 -13
- package/dist/packages/toast/toast.js.map +3 -3
- package/dist/setup-tests.js +1 -1
- package/dist/web-types.json +328 -1
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js", "../../../node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/index.js", "../../../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", "../../../node_modules/.pnpm/@open-wc+form-control@1.0.0/node_modules/@open-wc/form-control/src/FormControlMixin.ts", "../../../packages/checkbox-group/checkbox-group.ts", "../../../packages/i18n.ts", "../../../packages/checkbox-group/locales/da/messages.mjs", "../../../packages/checkbox-group/locales/en/messages.mjs", "../../../packages/checkbox-group/locales/fi/messages.mjs", "../../../packages/checkbox-group/locales/nb/messages.mjs", "../../../packages/checkbox-group/locales/sv/messages.mjs"],
|
|
4
|
+
"sourcesContent": ["\"use strict\";\n// NOTE: don't construct errors here or they'll have the wrong stack trace.\n// NOTE: don't make custom error class; the JS engines use `SyntaxError`\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.errorMessages = exports.ErrorType = void 0;\n/**\n * Keys for possible error messages used by `unraw`.\n * Note: These do _not_ map to actual error object types. All errors thrown\n * are `SyntaxError`.\n */\n// Don't use const enum or JS users won't be able to access the enum values\nvar ErrorType;\n(function (ErrorType) {\n /**\n * Thrown when a badly formed Unicode escape sequence is found. Possible\n * reasons include the code being too short (`\"\\u25\"`) or having invalid\n * characters (`\"\\u2$A5\"`).\n */\n ErrorType[\"MalformedUnicode\"] = \"MALFORMED_UNICODE\";\n /**\n * Thrown when a badly formed hexadecimal escape sequence is found. Possible\n * reasons include the code being too short (`\"\\x2\"`) or having invalid\n * characters (`\"\\x2$\"`).\n */\n ErrorType[\"MalformedHexadecimal\"] = \"MALFORMED_HEXADECIMAL\";\n /**\n * Thrown when a Unicode code point escape sequence has too high of a code\n * point. The maximum code point allowed is `\\u{10FFFF}`, so `\\u{110000}` and\n * higher will throw this error.\n */\n ErrorType[\"CodePointLimit\"] = \"CODE_POINT_LIMIT\";\n /**\n * Thrown when an octal escape sequences is encountered and `allowOctals` is\n * `false`. For example, `unraw(\"\\234\", false)`.\n */\n ErrorType[\"OctalDeprecation\"] = \"OCTAL_DEPRECATION\";\n /**\n * Thrown only when a single backslash is found at the end of a string. For\n * example, `\"\\\\\"` or `\"test\\\\x24\\\\\"`.\n */\n ErrorType[\"EndOfString\"] = \"END_OF_STRING\";\n})(ErrorType = exports.ErrorType || (exports.ErrorType = {}));\n/** Map of error message names to the full text of the message. */\nexports.errorMessages = new Map([\n [ErrorType.MalformedUnicode, \"malformed Unicode character escape sequence\"],\n [\n ErrorType.MalformedHexadecimal,\n \"malformed hexadecimal character escape sequence\"\n ],\n [\n ErrorType.CodePointLimit,\n \"Unicode codepoint must not be greater than 0x10FFFF in escape sequence\"\n ],\n [\n ErrorType.OctalDeprecation,\n '\"0\"-prefixed octal literals and octal escape sequences are deprecated; ' +\n 'for octal literals use the \"0o\" prefix instead'\n ],\n [ErrorType.EndOfString, \"malformed escape sequence at end of string\"]\n]);\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.unraw = exports.errorMessages = exports.ErrorType = void 0;\nconst errors_1 = require(\"./errors\");\nObject.defineProperty(exports, \"ErrorType\", { enumerable: true, get: function () { return errors_1.ErrorType; } });\nObject.defineProperty(exports, \"errorMessages\", { enumerable: true, get: function () { return errors_1.errorMessages; } });\n/**\n * Parse a string as a base-16 number. This is more strict than `parseInt` as it\n * will not allow any other characters, including (for example) \"+\", \"-\", and\n * \".\".\n * @param hex A string containing a hexadecimal number.\n * @returns The parsed integer, or `NaN` if the string is not a valid hex\n * number.\n */\nfunction parseHexToInt(hex) {\n const isOnlyHexChars = !hex.match(/[^a-f0-9]/i);\n return isOnlyHexChars ? parseInt(hex, 16) : NaN;\n}\n/**\n * Check the validity and length of a hexadecimal code and optionally enforces\n * a specific number of hex digits.\n * @param hex The string to validate and parse.\n * @param errorName The name of the error message to throw a `SyntaxError` with\n * if `hex` is invalid. This is used to index `errorMessages`.\n * @param enforcedLength If provided, will throw an error if `hex` is not\n * exactly this many characters.\n * @returns The parsed hex number as a normal number.\n * @throws {SyntaxError} If the code is not valid.\n */\nfunction validateAndParseHex(hex, errorName, enforcedLength) {\n const parsedHex = parseHexToInt(hex);\n if (Number.isNaN(parsedHex) ||\n (enforcedLength !== undefined && enforcedLength !== hex.length)) {\n throw new SyntaxError(errors_1.errorMessages.get(errorName));\n }\n return parsedHex;\n}\n/**\n * Parse a two-digit hexadecimal character escape code.\n * @param code The two-digit hexadecimal number that represents the character to\n * output.\n * @returns The single character represented by the code.\n * @throws {SyntaxError} If the code is not valid hex or is not the right\n * length.\n */\nfunction parseHexadecimalCode(code) {\n const parsedCode = validateAndParseHex(code, errors_1.ErrorType.MalformedHexadecimal, 2);\n return String.fromCharCode(parsedCode);\n}\n/**\n * Parse a four-digit Unicode character escape code.\n * @param code The four-digit unicode number that represents the character to\n * output.\n * @param surrogateCode Optional four-digit unicode surrogate that represents\n * the other half of the character to output.\n * @returns The single character represented by the code.\n * @throws {SyntaxError} If the codes are not valid hex or are not the right\n * length.\n */\nfunction parseUnicodeCode(code, surrogateCode) {\n const parsedCode = validateAndParseHex(code, errors_1.ErrorType.MalformedUnicode, 4);\n if (surrogateCode !== undefined) {\n const parsedSurrogateCode = validateAndParseHex(surrogateCode, errors_1.ErrorType.MalformedUnicode, 4);\n return String.fromCharCode(parsedCode, parsedSurrogateCode);\n }\n return String.fromCharCode(parsedCode);\n}\n/**\n * Test if the text is surrounded by curly braces (`{}`).\n * @param text Text to check.\n * @returns `true` if the text is in the form `{*}`.\n */\nfunction isCurlyBraced(text) {\n return text.charAt(0) === \"{\" && text.charAt(text.length - 1) === \"}\";\n}\n/**\n * Parse a Unicode code point character escape code.\n * @param codePoint A unicode escape code point, including the surrounding curly\n * braces.\n * @returns The single character represented by the code.\n * @throws {SyntaxError} If the code is not valid hex or does not have the\n * surrounding curly braces.\n */\nfunction parseUnicodeCodePointCode(codePoint) {\n if (!isCurlyBraced(codePoint)) {\n throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.MalformedUnicode));\n }\n const withoutBraces = codePoint.slice(1, -1);\n const parsedCode = validateAndParseHex(withoutBraces, errors_1.ErrorType.MalformedUnicode);\n try {\n return String.fromCodePoint(parsedCode);\n }\n catch (err) {\n throw err instanceof RangeError\n ? new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.CodePointLimit))\n : err;\n }\n}\n// Have to give overload that takes boolean for when compiler doesn't know if\n// true or false\nfunction parseOctalCode(code, error = false) {\n if (error) {\n throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.OctalDeprecation));\n }\n // The original regex only allows digits so we don't need to have a strict\n // octal parser like hexToInt. Length is not enforced for octals.\n const parsedCode = parseInt(code, 8);\n return String.fromCharCode(parsedCode);\n}\n/**\n * Map of unescaped letters to their corresponding special JS escape characters.\n * Intentionally does not include characters that map to themselves like \"\\'\".\n */\nconst singleCharacterEscapes = new Map([\n [\"b\", \"\\b\"],\n [\"f\", \"\\f\"],\n [\"n\", \"\\n\"],\n [\"r\", \"\\r\"],\n [\"t\", \"\\t\"],\n [\"v\", \"\\v\"],\n [\"0\", \"\\0\"]\n]);\n/**\n * Parse a single character escape sequence and return the matching character.\n * If none is matched, defaults to `code`.\n * @param code A single character code.\n */\nfunction parseSingleCharacterCode(code) {\n return singleCharacterEscapes.get(code) || code;\n}\n/**\n * Matches every escape sequence possible, including invalid ones.\n *\n * All capture groups (described below) are unique (only one will match), except\n * for 4, which can only potentially match if 3 does.\n *\n * **Capture Groups:**\n * 0. A single backslash\n * 1. Hexadecimal code\n * 2. Unicode code point code with surrounding curly braces\n * 3. Unicode escape code with surrogate\n * 4. Surrogate code\n * 5. Unicode escape code without surrogate\n * 6. Octal code _NOTE: includes \"0\"._\n * 7. A single character (will never be \\, x, u, or 0-3)\n */\nconst escapeMatch = /\\\\(?:(\\\\)|x([\\s\\S]{0,2})|u(\\{[^}]*\\}?)|u([\\s\\S]{4})\\\\u([^{][\\s\\S]{0,3})|u([\\s\\S]{0,4})|([0-3]?[0-7]{1,2})|([\\s\\S])|$)/g;\n/**\n * Replace raw escape character strings with their escape characters.\n * @param raw A string where escape characters are represented as raw string\n * values like `\\'` rather than `'`.\n * @param allowOctals If `true`, will process the now-deprecated octal escape\n * sequences (ie, `\\111`).\n * @returns The processed string, with escape characters replaced by their\n * respective actual Unicode characters.\n */\nfunction unraw(raw, allowOctals = false) {\n return raw.replace(escapeMatch, function (_, backslash, hex, codePoint, unicodeWithSurrogate, surrogate, unicode, octal, singleCharacter) {\n // Compare groups to undefined because empty strings mean different errors\n // Otherwise, `\\u` would fail the same as `\\` which is wrong.\n if (backslash !== undefined) {\n return \"\\\\\";\n }\n if (hex !== undefined) {\n return parseHexadecimalCode(hex);\n }\n if (codePoint !== undefined) {\n return parseUnicodeCodePointCode(codePoint);\n }\n if (unicodeWithSurrogate !== undefined) {\n return parseUnicodeCode(unicodeWithSurrogate, surrogate);\n }\n if (unicode !== undefined) {\n return parseUnicodeCode(unicode);\n }\n if (octal === \"0\") {\n return \"\\0\";\n }\n if (octal !== undefined) {\n return parseOctalCode(octal, !allowOctals);\n }\n if (singleCharacter !== undefined) {\n return parseSingleCharacterCode(singleCharacter);\n }\n throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.EndOfString));\n });\n}\nexports.unraw = unraw;\nexports.default = unraw;\n", "import { unraw } from 'unraw';\nimport { compileMessage } from '@lingui/message-utils/compileMessage';\n\nconst isString = (s) => typeof s === \"string\";\nconst isFunction = (f) => typeof f === \"function\";\n\nconst cache = /* @__PURE__ */ new Map();\nconst defaultLocale = \"en\";\nfunction normalizeLocales(locales) {\n const out = Array.isArray(locales) ? locales : [locales];\n return [...out, defaultLocale];\n}\nfunction date(locales, value, format) {\n const _locales = normalizeLocales(locales);\n if (!format) {\n format = \"default\";\n }\n let o;\n if (typeof format === \"string\") {\n o = {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\"\n };\n switch (format) {\n case \"full\":\n o.weekday = \"long\";\n case \"long\":\n o.month = \"long\";\n break;\n case \"short\":\n o.month = \"numeric\";\n break;\n }\n } else {\n o = format;\n }\n const formatter = getMemoized(\n () => cacheKey(\"date\", _locales, format),\n () => new Intl.DateTimeFormat(_locales, o)\n );\n return formatter.format(isString(value) ? new Date(value) : value);\n}\nfunction time(locales, value, format) {\n let o;\n if (!format) {\n format = \"default\";\n }\n if (typeof format === \"string\") {\n o = {\n second: \"numeric\",\n minute: \"numeric\",\n hour: \"numeric\"\n };\n switch (format) {\n case \"full\":\n case \"long\":\n o.timeZoneName = \"short\";\n break;\n case \"short\":\n delete o.second;\n }\n } else {\n o = format;\n }\n return date(locales, value, o);\n}\nfunction number(locales, value, format) {\n const _locales = normalizeLocales(locales);\n const formatter = getMemoized(\n () => cacheKey(\"number\", _locales, format),\n () => new Intl.NumberFormat(_locales, format)\n );\n return formatter.format(value);\n}\nfunction plural(locales, ordinal, value, { offset = 0, ...rules }) {\n const _locales = normalizeLocales(locales);\n const plurals = ordinal ? getMemoized(\n () => cacheKey(\"plural-ordinal\", _locales),\n () => new Intl.PluralRules(_locales, { type: \"ordinal\" })\n ) : getMemoized(\n () => cacheKey(\"plural-cardinal\", _locales),\n () => new Intl.PluralRules(_locales, { type: \"cardinal\" })\n );\n return rules[value] ?? rules[plurals.select(value - offset)] ?? rules.other;\n}\nfunction getMemoized(getKey, construct) {\n const key = getKey();\n let formatter = cache.get(key);\n if (!formatter) {\n formatter = construct();\n cache.set(key, formatter);\n }\n return formatter;\n}\nfunction cacheKey(type, locales, options) {\n const localeKey = locales.join(\"-\");\n return `${type}-${localeKey}-${JSON.stringify(options)}`;\n}\n\nconst formats = {\n __proto__: null,\n date: date,\n defaultLocale: defaultLocale,\n number: number,\n plural: plural,\n time: time\n};\n\nconst UNICODE_REGEX = /\\\\u[a-fA-F0-9]{4}|\\\\x[a-fA-F0-9]{2}/;\nconst OCTOTHORPE_PH = \"%__lingui_octothorpe__%\";\nconst getDefaultFormats = (locale, passedLocales, formats = {}) => {\n const locales = passedLocales || locale;\n const style = (format) => {\n if (typeof format === \"object\")\n return format;\n return formats[format];\n };\n const replaceOctothorpe = (value, message) => {\n const numberFormat = Object.keys(formats).length ? style(\"number\") : void 0;\n const valueStr = number(locales, value, numberFormat);\n return message.replace(new RegExp(OCTOTHORPE_PH, \"g\"), valueStr);\n };\n return {\n plural: (value, cases) => {\n const { offset = 0 } = cases;\n const message = plural(locales, false, value, cases);\n return replaceOctothorpe(value - offset, message);\n },\n selectordinal: (value, cases) => {\n const { offset = 0 } = cases;\n const message = plural(locales, true, value, cases);\n return replaceOctothorpe(value - offset, message);\n },\n select: selectFormatter,\n number: (value, format) => number(\n locales,\n value,\n style(format) || { style: format }\n ),\n date: (value, format) => date(locales, value, style(format) || format),\n time: (value, format) => time(locales, value, style(format) || format)\n };\n};\nconst selectFormatter = (value, rules) => rules[value] ?? rules.other;\nfunction interpolate(translation, locale, locales) {\n return (values = {}, formats) => {\n const formatters = getDefaultFormats(locale, locales, formats);\n const formatMessage = (tokens, replaceOctothorpe = false) => {\n if (!Array.isArray(tokens))\n return tokens;\n return tokens.reduce((message, token) => {\n if (token === \"#\" && replaceOctothorpe) {\n return message + OCTOTHORPE_PH;\n }\n if (isString(token)) {\n return message + token;\n }\n const [name, type, format] = token;\n let interpolatedFormat = {};\n if (type === \"plural\" || type === \"selectordinal\" || type === \"select\") {\n Object.entries(format).forEach(\n ([key, value2]) => {\n interpolatedFormat[key] = formatMessage(\n value2,\n type === \"plural\" || type === \"selectordinal\"\n );\n }\n );\n } else {\n interpolatedFormat = format;\n }\n let value;\n if (type) {\n const formatter = formatters[type];\n value = formatter(values[name], interpolatedFormat);\n } else {\n value = values[name];\n }\n if (value == null) {\n return message;\n }\n return message + value;\n }, \"\");\n };\n const result = formatMessage(translation);\n if (isString(result) && UNICODE_REGEX.test(result)) {\n return unraw(result);\n }\n if (isString(result))\n return result;\n return result ? String(result) : \"\";\n };\n}\n\nvar __defProp$1 = Object.defineProperty;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField$1 = (obj, key, value) => {\n __defNormalProp$1(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass EventEmitter {\n constructor() {\n __publicField$1(this, \"_events\", {});\n }\n on(event, listener) {\n var _a;\n (_a = this._events)[event] ?? (_a[event] = []);\n this._events[event].push(listener);\n return () => this.removeListener(event, listener);\n }\n removeListener(event, listener) {\n const maybeListeners = this._getListeners(event);\n if (!maybeListeners)\n return;\n const index = maybeListeners.indexOf(listener);\n if (~index)\n maybeListeners.splice(index, 1);\n }\n emit(event, ...args) {\n const maybeListeners = this._getListeners(event);\n if (!maybeListeners)\n return;\n maybeListeners.map((listener) => listener.apply(this, args));\n }\n _getListeners(event) {\n const maybeListeners = this._events[event];\n return Array.isArray(maybeListeners) ? maybeListeners : false;\n }\n}\n\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass I18n extends EventEmitter {\n constructor(params) {\n super();\n __publicField(this, \"_locale\", \"\");\n __publicField(this, \"_locales\");\n __publicField(this, \"_localeData\", {});\n __publicField(this, \"_messages\", {});\n __publicField(this, \"_missing\");\n __publicField(this, \"_messageCompiler\");\n /**\n * Alias for {@see I18n._}\n */\n __publicField(this, \"t\", this._.bind(this));\n if (process.env.NODE_ENV !== \"production\") {\n this.setMessagesCompiler(compileMessage);\n }\n if (params.missing != null)\n this._missing = params.missing;\n if (params.messages != null)\n this.load(params.messages);\n if (params.localeData != null)\n this.loadLocaleData(params.localeData);\n if (typeof params.locale === \"string\" || params.locales) {\n this.activate(params.locale ?? defaultLocale, params.locales);\n }\n }\n get locale() {\n return this._locale;\n }\n get locales() {\n return this._locales;\n }\n get messages() {\n return this._messages[this._locale] ?? {};\n }\n /**\n * @deprecated this has no effect. Please remove this from the code. Deprecated in v4\n */\n get localeData() {\n return this._localeData[this._locale] ?? {};\n }\n _loadLocaleData(locale, localeData) {\n const maybeLocaleData = this._localeData[locale];\n if (!maybeLocaleData) {\n this._localeData[locale] = localeData;\n } else {\n Object.assign(maybeLocaleData, localeData);\n }\n }\n /**\n * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.\n *\n * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.\n * By default, message catalogs should be precompiled during the build process. However,\n * if you need to compile catalogs at runtime, you can use this method to set a message compiler.\n *\n * Example usage:\n *\n * ```ts\n * import { compileMessage } from \"@lingui/message-utils/compileMessage\";\n *\n * i18n.setMessagesCompiler(compileMessage);\n * ```\n */\n setMessagesCompiler(compiler) {\n this._messageCompiler = compiler;\n return this;\n }\n /**\n * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4\n */\n loadLocaleData(localeOrAllData, localeData) {\n if (typeof localeOrAllData === \"string\") {\n this._loadLocaleData(localeOrAllData, localeData);\n } else {\n Object.keys(localeOrAllData).forEach(\n (locale) => this._loadLocaleData(locale, localeOrAllData[locale])\n );\n }\n this.emit(\"change\");\n }\n _load(locale, messages) {\n const maybeMessages = this._messages[locale];\n if (!maybeMessages) {\n this._messages[locale] = messages;\n } else {\n Object.assign(maybeMessages, messages);\n }\n }\n load(localeOrMessages, messages) {\n if (typeof localeOrMessages == \"string\" && typeof messages === \"object\") {\n this._load(localeOrMessages, messages);\n } else {\n Object.entries(localeOrMessages).forEach(\n ([locale, messages2]) => this._load(locale, messages2)\n );\n }\n this.emit(\"change\");\n }\n /**\n * @param options {@link LoadAndActivateOptions}\n */\n loadAndActivate({ locale, locales, messages }) {\n this._locale = locale;\n this._locales = locales || void 0;\n this._messages[this._locale] = messages;\n this.emit(\"change\");\n }\n activate(locale, locales) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!this._messages[locale]) {\n console.warn(`Messages for locale \"${locale}\" not loaded.`);\n }\n }\n this._locale = locale;\n this._locales = locales;\n this.emit(\"change\");\n }\n _(id, values, options) {\n if (!this.locale) {\n throw new Error(\n \"Lingui: Attempted to call a translation function without setting a locale.\\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\\nThis issue may also occur due to a race condition in your initialization logic.\"\n );\n }\n let message = options?.message;\n if (!id) {\n id = \"\";\n }\n if (!isString(id)) {\n values = id.values || values;\n message = id.message;\n id = id.id;\n }\n const messageForId = this.messages[id];\n const messageMissing = messageForId === void 0;\n const missing = this._missing;\n if (missing && messageMissing) {\n return isFunction(missing) ? missing(this._locale, id) : missing;\n }\n if (messageMissing) {\n this.emit(\"missing\", { id, locale: this._locale });\n }\n let translation = messageForId || message || id;\n if (isString(translation)) {\n if (this._messageCompiler) {\n translation = this._messageCompiler(translation);\n } else {\n console.warn(`Uncompiled message detected! Message:\n\n> ${translation}\n\nThat means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.\nICU features such as interpolation and plurals will not work properly for that message. \n\nPlease compile your catalog first. \n`);\n }\n }\n if (isString(translation) && UNICODE_REGEX.test(translation))\n return JSON.parse(`\"${translation}\"`);\n if (isString(translation))\n return translation;\n return interpolate(\n translation,\n this._locale,\n this._locales\n )(values, options?.formats);\n }\n date(value, format) {\n return date(this._locales || this._locale, value, format);\n }\n number(value, format) {\n return number(this._locales || this._locale, value, format);\n }\n}\nfunction setupI18n(params = {}) {\n return new I18n(params);\n}\n\nconst i18n = setupI18n();\n\nexport { I18n, formats, i18n, setupI18n };\n", "import { Constructor, CustomValidityState, FormControlInterface, FormValue, IControlHost, validationMessageCallback, Validator } from './types.js';\n\nexport function FormControlMixin<\n TBase extends Constructor<HTMLElement & IControlHost> & { observedAttributes?: string [] }\n>(SuperClass: TBase) {\n class FormControl extends SuperClass {\n /** Wires up control instances to be form associated */\n static get formAssociated(): boolean {\n return true;\n }\n\n /**\n * A list of Validator objects that will be evaluated when a control's form\n * value is modified or optionally when a given attribute changes.\n *\n * When a Validator's callback returns false, the entire form control will\n * be set to an invalid state.\n */\n declare static formControlValidators: Validator[];\n\n /**\n * If set to true the control described should be evaluated and validated\n * as part of a group. Like a radio, if any member of the group's validity\n * changes the the other members should update as well.\n */\n declare static formControlValidationGroup: boolean;\n\n private static get validators(): Validator[] {\n return this.formControlValidators || [];\n }\n\n /**\n * Allows the FormControl instance to respond to Validator attributes.\n * For instance, if a given Validator has a `required` attribute, that\n * validator will be evaluated whenever the host's required attribute\n * is updated.\n */\n static get observedAttributes(): string[] {\n const validatorAttributes = this.validators.map((validator) => validator.attribute).flat();\n\n const observedAttributes = super.observedAttributes || [];\n\n /** Make sure there are no duplicates inside the attributes list */\n const attributeSet = new Set([...observedAttributes, ...validatorAttributes]);\n return [...attributeSet] as string[];\n }\n\n /**\n * Return the validator associated with a given attribute. If no\n * Validator is associated with the attribute, it will return null.\n */\n static getValidator(attribute: string): Validator | null {\n return this.validators.find((validator) => validator.attribute === attribute) || null;\n }\n\n /**\n * Get all validators that are set to react to a given attribute\n * @param {string} attribute - The attribute that has changed\n * @returns {Validator[]}\n */\n static getValidators(attribute: string): Validator[] | null {\n return this.validators.filter(validator => {\n if (validator.attribute === attribute || validator.attribute?.includes(attribute)) {\n return true;\n }\n });\n }\n\n /** The ElementInternals instance for the control. */\n internals = this.attachInternals();\n\n /**\n * Keep track of if the control has focus\n * @private\n */\n #focused = false;\n\n /**\n * Exists to control when an error should be displayed\n * @private\n */\n #forceError = false;\n\n /**\n * Toggles to true whenever the element has been focused. This property\n * will reset whenever the control's formResetCallback is called.\n * @private\n */\n #touched = false;\n\n /** An internal abort controller for cancelling pending async validation */\n #abortController?: AbortController;\n #previousAbortController?: AbortController;\n\n /**\n * Used for tracking if a validation target has been set to manage focus\n * when the control's validity is reported\n */\n #awaitingValidationTarget = true;\n\n /** All of the controls within a root with a matching local name and form name */\n get #formValidationGroup(): NodeListOf<FormControl> {\n const rootNode = this.getRootNode() as HTMLElement;\n const selector = `${this.localName}[name=\"${this.getAttribute('name')}\"]`;\n return rootNode.querySelectorAll<FormControl>(selector);\n }\n\n /**\n * Acts as a cache for the current value so the value can be re-evaluated\n * whenever an attribute changes or on some other event.\n */\n #value: FormValue = '';\n\n /**\n * Set this[touched] and this[focused]\n * to true when the element is focused\n * @private\n */\n #onFocus = (): void => {\n this.#touched = true;\n this.#focused = true;\n this.#shouldShowError();\n };\n\n /**\n * Reset this[focused] on blur\n * @private\n */\n #onBlur = (): void => {\n this.#focused = false;\n\n this.#runValidators(this.shouldFormValueUpdate() ? this.#value : '');\n\n /**\n * Set forceError to ensure error messages persist until\n * the value is changed.\n */\n if (!this.validity.valid && this.#touched) {\n this.#forceError = true;\n }\n const showError = this.#shouldShowError();\n if (this.validationMessageCallback) {\n this.validationMessageCallback(showError ? this.internals.validationMessage : '');\n }\n };\n\n /**\n * For the show error state on invalid\n * @private\n */\n #onInvalid = (): void => {\n if (this.#awaitingValidationTarget && this.validationTarget) {\n this.internals.setValidity(\n this.validity,\n this.validationMessage,\n this.validationTarget\n );\n this.#awaitingValidationTarget = false;\n }\n this.#touched = true;\n this.#forceError = true;\n this.#shouldShowError();\n this?.validationMessageCallback?.(this.showError ? this.internals.validationMessage : '');\n };\n\n /** Return a reference to the control's form */\n get form(): HTMLFormElement {\n return this.internals.form;\n }\n\n /**\n * Will return true if it is recommended that the control shows an internal\n * error. If using this property, it is wise to listen for 'invalid' events\n * on the element host and call preventDefault on the event. Doing this will\n * prevent browsers from showing a validation popup.\n */\n get showError(): boolean {\n return this.#shouldShowError();\n }\n\n /**\n * Forward the internals checkValidity method\n * will return the valid state of the control.\n */\n checkValidity(): boolean {\n return this.internals.checkValidity();\n }\n\n /** The element's validity state */\n get validity(): ValidityState {\n return this.internals.validity;\n }\n\n /**\n * The validation message shown by a given Validator object. If the control\n * is in a valid state this should be falsy.\n */\n get validationMessage(): string {\n return this.internals.validationMessage;\n }\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n constructor(...args: any[]) {\n super(...args);\n this.addEventListener?.('focus', this.#onFocus);\n this.addEventListener?.('blur', this.#onBlur);\n this.addEventListener?.('invalid', this.#onInvalid);\n this.setValue(null);\n }\n\n attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n\n /**\n * Check to see if a Validator is associated with the changed attribute.\n * If one exists, call control's validate function which will perform\n * control validation.\n */\n const proto = this.constructor as typeof FormControl;\n const validators = proto.getValidators(name);\n\n if (validators?.length && this.validationTarget) {\n this.setValue(this.#value);\n }\n }\n\n /** PUBLIC LIFECYCLE METHODS */\n\n /**\n * Sets the control's form value if the call to `shouldFormValueUpdate`\n * returns `true`.\n * @param value {FormValue} - The value to pass to the form\n */\n setValue(value: FormValue): void {\n this.#forceError = false;\n this.validationMessageCallback?.('');\n this.#value = value;\n const valueShouldUpdate = this.shouldFormValueUpdate();\n const valueToUpdate = valueShouldUpdate ? value : null;\n this.internals.setFormValue(valueToUpdate as string);\n this.#runValidators(valueToUpdate);\n if (this.valueChangedCallback) {\n this.valueChangedCallback(valueToUpdate);\n }\n this.#shouldShowError();\n }\n\n /**\n * This method can be overridden to determine if the control's form value\n * should be set on a call to `setValue`. An example of when a user might want\n * to skip this step is when implementing checkbox-like behavior, first checking\n * to see if `this.checked` is set to a truthy value. By default this returns\n * `true`.\n */\n shouldFormValueUpdate(): boolean {\n return true;\n }\n\n /** Save a reference to the validation complete resolver */\n #validationCompleteResolver?: (value: void | PromiseLike<void>) => void;\n\n /** When true validation will be pending */\n #isValidationPending = false;\n\n #validationComplete = Promise.resolve();\n\n /** A promise that will resolve when all pending validations are complete */\n get validationComplete(): Promise<void> {\n return new Promise(resolve => resolve(this.#validationComplete));\n }\n\n /** DECLARED INSTANCE METHODS AND PROPERTIES*/\n\n /**\n * Resets a form control to its initial state\n */\n declare resetFormControl: () => void;\n\n /**\n * This method is used to override the controls' validity message\n * for a given Validator key. This has the highest level of priority when\n * setting a validationMessage, so use this method wisely.\n *\n * The returned value will be used as the validationMessage for the given key.\n * @param validationKey {string} - The key that has returned invalid\n */\n declare validityCallback: (validationKey: string) => string | void;\n\n /**\n * Called when the control's validationMessage should be changed\n * @param message { string } - The new validation message\n */\n declare validationMessageCallback: (message: string) => void;\n\n /**\n * A callback for when the controls' form value changes. The value\n * passed to this function should not be confused with the control's\n * value property, this is the value that will appear on the form.\n *\n * In cases where `checked` did not exist on the control's prototype\n * upon initialization, this value and the value property will be identical;\n * in cases where `checked` is present upon initialization, this will be\n * effectively `this.checked && this.value`.\n */\n declare valueChangedCallback: (value: FormValue) => void;\n\n /**\n * The element that will receive focus when the control's validity\n * state is reported either by a form submission or via API\n *\n * We use declare since this is optional and we don't particularly\n * care how the consuming component implements this (as a field, member\n * or getter/setter)\n */\n declare validationTarget: HTMLElement | null;\n\n /** PRIVATE LIFECYCLE METHODS */\n\n /**\n * Check to see if an error should be shown. This method will also\n * update the internals state object with the --show-error state\n * if necessary.\n * @private\n */\n #shouldShowError(): boolean {\n if (this.hasAttribute('disabled')) {\n return false;\n }\n\n const showError = this.#forceError || (this.#touched && !this.validity.valid && !this.#focused);\n\n /**\n * At the time of writing Firefox doesn't support states\n * TODO: Remove when check for states when fully support is in place\n */\n if (showError && this.internals.states) {\n this.internals.states.add('--show-error');\n } else if (this.internals.states) {\n this.internals.states.delete('--show-error');\n }\n\n return showError;\n }\n\n #runValidators(value: FormValue): void {\n const proto = this.constructor as typeof FormControl;\n const validity: CustomValidityState = {};\n const validators = proto.validators;\n const asyncValidators: Promise<boolean|void>[] = [];\n const hasAsyncValidators = validators.some((validator) => validator.isValid instanceof Promise)\n\n if (!this.#isValidationPending) {\n this.#validationComplete = new Promise(resolve => {\n this.#validationCompleteResolver = resolve\n });\n this.#isValidationPending = true;\n }\n\n /**\n * If an abort controller exists from a previous validation step\n * notify still-running async validators that we are requesting they\n * discontinue any work.\n */\n if (this.#abortController) {\n this.#abortController.abort();\n this.#previousAbortController = this.#abortController;\n }\n\n /**\n * Create a new abort controller and replace the instance reference\n * so we can clean it up for next time\n */\n const abortController = new AbortController();\n this.#abortController = abortController;\n let validationMessage: string | undefined = undefined;\n\n /** Track to see if any validity key has changed */\n let hasChange = false;\n\n if (!validators.length) {\n return;\n }\n\n validators.forEach(validator => {\n const key = validator.key || 'customError';\n const isValid = validator.isValid(this, value, abortController.signal);\n const isAsyncValidator = isValid instanceof Promise;\n\n if (isAsyncValidator) {\n asyncValidators.push(isValid);\n\n isValid.then(isValidatorValid => {\n if (isValidatorValid === undefined || isValidatorValid === null) {\n return;\n }\n /** Invert the validity state to correspond to the ValidityState API */\n validity[key] = !isValidatorValid;\n\n validationMessage = this.#getValidatorMessageForValue(validator, value);\n this.#setValidityWithOptionalTarget(validity, validationMessage);\n });\n } else {\n /** Invert the validity state to correspond to the ValidityState API */\n validity[key] = !isValid;\n\n if (this.validity[key] !== !isValid) {\n hasChange = true;\n }\n\n // only update the validationMessage for the first invalid scenario\n // so that earlier invalid validators dont get their messages overwritten by later ones\n // in the validators array\n if (!isValid && !validationMessage) {\n validationMessage = this.#getValidatorMessageForValue(validator, value);\n }\n }\n });\n\n /** Once all the async validators have settled, resolve validationComplete */\n Promise.allSettled(asyncValidators)\n .then(() => {\n /** Don't resolve validations if the signal is aborted */\n if (!abortController?.signal.aborted) {\n this.#isValidationPending = false;\n this.#validationCompleteResolver?.();\n }\n });\n\n /**\n * If async validators are present:\n * Only run updates when a sync validator has a change. This is to prevent\n * situations where running sync validators can override async validators\n * that are still in progress\n *\n * If async validators are not present, always update validity\n */\n if (hasChange || !hasAsyncValidators) {\n this.#setValidityWithOptionalTarget(validity, validationMessage);\n }\n }\n\n /**\n * If the validationTarget is not set, the user can decide how they would\n * prefer to handle focus when the field is validated.\n */\n #setValidityWithOptionalTarget(validity: Partial<ValidityState>, validationMessage: string|undefined): void {\n if (this.validationTarget) {\n this.internals.setValidity(validity, validationMessage, this.validationTarget);\n this.#awaitingValidationTarget = false;\n } else {\n this.internals.setValidity(validity, validationMessage);\n\n if (this.internals.validity.valid) {\n return;\n }\n\n /**\n * Sets mark the component as awaiting a validation target\n * if the element dispatches an invalid event, the #onInvalid listener\n * will check to see if the validation target has been set since this call\n * has run. This useful in cases like Lit's use of the query\n * decorator for setting the validationTarget or any scenario\n * where the validationTarget isn't available upon construction\n */\n this.#awaitingValidationTarget = true;\n }\n }\n\n /** Process the validator message attribute */\n #getValidatorMessageForValue(validator: Validator, value: FormValue): string {\n /** If the validity callback exists and returns, use that as the result */\n if (this.validityCallback) {\n const message = this.validityCallback(validator.key || 'customError');\n\n if (message) {\n return message;\n }\n }\n\n if (validator.message instanceof Function) {\n return (validator.message as validationMessageCallback)(this, value);\n } else {\n return validator.message as string;\n }\n }\n\n /** Reset control state when the form is reset */\n formResetCallback() {\n this.#touched = false;\n this.#forceError = false;\n this.#shouldShowError();\n this.resetFormControl?.();\n\n this.validationMessageCallback?.(\n this.#shouldShowError() ? this.validationMessage : ''\n );\n }\n }\n\n return FormControl as Constructor<FormControlInterface> & TBase;\n}\n", "import { i18n } from '@lingui/core';\nimport { FormControlMixin } from '@open-wc/form-control';\nimport { css, html, LitElement, nothing, PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { activateI18n } from '../i18n';\nimport { messages as daMessages } from './locales/da/messages.mjs';\nimport { messages as enMessages } from './locales/en/messages.mjs';\nimport { messages as fiMessages } from './locales/fi/messages.mjs';\nimport { messages as nbMessages } from './locales/nb/messages.mjs';\nimport { messages as svMessages } from './locales/sv/messages.mjs';\n\nactivateI18n(enMessages, nbMessages, fiMessages, daMessages, svMessages);\n\nconst REQUIRED_MESSAGE = () =>\n i18n._({\n id: 'checkbox-group.validation.required',\n message: 'At least one selection is required.',\n comment: 'Shown when required checkbox group has no selections',\n });\n\nexport class WCheckboxGroup extends FormControlMixin(LitElement) {\n /** The group label displayed above the checkboxes. */\n @property({ type: String, reflect: true })\n label: string;\n\n /** The name applied to child checkboxes when they do not provide one. */\n @property({ type: String, reflect: true })\n name: string;\n\n /** Whether to show optional text next to the label. */\n @property({ type: Boolean, reflect: true })\n optional: boolean;\n\n @property({ type: String, reflect: true, attribute: 'help-text' })\n helpText: string;\n\n /** Makes the checkbox group required. */\n @property({ type: Boolean, reflect: true })\n required: boolean;\n\n /** Marks the checkbox group as invalid. */\n @property({ type: Boolean, reflect: true })\n invalid: boolean;\n\n // Track whether the user has interacted with the group.\n #hasInteracted = false;\n\n // Track whether we've warned about missing name in a form.\n #hasWarnedMissingName = false;\n\n // Track whether we set tabindex automatically for invalid focusability.\n #autoTabIndex = false;\n\n #unsubscribeI18n?: () => void;\n\n static styles = css`\n .wrapper {\n display: inline-flex;\n flex-direction: column;\n gap: 16px;\n }\n\n .checkbox-group {\n display: grid;\n gap: 16px;\n }\n\n .label {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--w-font-size-s);\n line-height: var(--w-line-height-s);\n font-weight: 700;\n color: var(--w-s-color-text);\n }\n\n .optional {\n font-weight: 400;\n color: var(--w-s-color-text-subtle);\n }\n\n .help-text {\n display: block;\n font-size: var(--w-font-size-xs);\n line-height: var(--w-line-height-xs);\n color: var(--w-s-color-text-subtle);\n }\n\n .error {\n color: var(--w-s-color-text-negative);\n }\n `;\n\n render() {\n const hasSelection = this.#getCheckedCount() > 0;\n const requiredInvalid = this.required && !hasSelection;\n const showRequiredError = requiredInvalid && this.#hasInteracted;\n const isInvalid = this.invalid || showRequiredError;\n const helpText = isInvalid ? this.#getRequiredMessage() : this.helpText;\n const helpId = helpText ? 'checkbox-group__help' : undefined;\n const labelId = this.label ? 'checkbox-group__label' : undefined;\n const ariaInvalid = isInvalid ? 'true' : undefined;\n\n return html`\n <div class=\"wrapper\">\n ${this.label\n ? html`\n <div class=\"label\" id=\"${labelId}\">\n <span>${this.label}</span>\n ${this.optional\n ? html`\n <span class=\"optional\">\n ${i18n._({\n id: 'checkbox-group.label.optional',\n message: 'Optional',\n comment: 'Shown behind label when marked as optional',\n })}\n </span>\n `\n : nothing}\n </div>\n `\n : nothing}\n <div\n class=\"checkbox-group\"\n role=\"group\"\n aria-labelledby=${ifDefined(labelId)}\n aria-describedby=${ifDefined(helpId)}\n aria-invalid=${ifDefined(ariaInvalid)}\n >\n <slot></slot>\n </div>\n ${helpText\n ? html`<div class=\"${isInvalid ? 'help-text error' : 'help-text'}\" id=\"${helpId}\">${helpText}</div>`\n : nothing}\n </div>\n `;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('change', this.#handleChange);\n this.addEventListener('invalid', this.#handleInvalid);\n this.addEventListener('slotchange', this.#handleSlotChange);\n this.#unsubscribeI18n = i18n.on('change', this.#handleI18nChange);\n this.setValue(null);\n this.#warnIfMissingName();\n }\n\n disconnectedCallback(): void {\n this.#unsubscribeI18n?.();\n this.#unsubscribeI18n = undefined;\n super.disconnectedCallback();\n }\n\n /** Checks whether the group passes constraint validation */\n checkValidity(): boolean {\n this.#updateValidity();\n return this.internals.checkValidity();\n }\n\n /** Checks validity and shows the validation message if invalid */\n reportValidity(): boolean {\n this.#markInteracted();\n this.#updateValidity();\n return this.internals.checkValidity();\n }\n\n /** Sets focus on the checkbox group. */\n focus(options?: FocusOptions) {\n const anchor = this.#getValidationAnchor() as HTMLElement | undefined;\n if (anchor?.focus) {\n anchor.focus(options);\n return;\n }\n HTMLElement.prototype.focus.call(this, options);\n }\n\n #handleChange = () => {\n this.#markInteracted();\n this.#updateValidity();\n this.requestUpdate();\n };\n\n #handleInvalid = () => {\n this.#markInteracted();\n this.#updateValidity();\n this.requestUpdate();\n };\n\n #handleSlotChange = () => {\n this.#applyGroupName();\n this.#updateValidity();\n this.requestUpdate();\n };\n\n #markInteracted(): void {\n this.#hasInteracted = true;\n }\n\n #handleI18nChange = () => {\n this.requestUpdate();\n };\n\n #getCheckedCount(): number {\n return this.#getAssignedElements().filter(el => (el as { checked?: boolean }).checked).length;\n }\n\n #applyGroupName(): void {\n if (!this.name) return;\n for (const el of this.#getAssignedElements()) {\n const checkbox = el as { name?: string };\n if (checkbox && typeof checkbox === 'object' && !checkbox.name) {\n checkbox.name = this.name;\n }\n }\n }\n\n #syncChildInvalid(isInvalid: boolean): void {\n for (const el of this.#getAssignedElements()) {\n if ('invalid' in el) {\n (el as { invalid: boolean }).invalid = isInvalid;\n }\n }\n }\n\n #getValidationAnchor(): HTMLElement | undefined {\n return this.#getAssignedElements()[0] as HTMLElement | undefined;\n }\n\n #getAssignedElements(): Element[] {\n const slot = this.shadowRoot?.querySelector('slot');\n return slot?.assignedElements({ flatten: true }) ?? [];\n }\n\n #getRequiredMessage(): string {\n return REQUIRED_MESSAGE();\n }\n\n updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties);\n\n if (this.#shouldUpdateValidity(changedProperties)) {\n if (changedProperties.has('name')) {\n this.#applyGroupName();\n }\n this.#updateValidity();\n }\n }\n\n #shouldUpdateValidity(changedProperties: PropertyValues<this>): boolean {\n return (\n changedProperties.has('invalid') ||\n changedProperties.has('required') ||\n changedProperties.has('helpText') ||\n changedProperties.has('name')\n );\n }\n\n #setValidityState(state: ValidityStateFlags): void {\n // Suppress native validation popovers (Safari) and provide a focusable anchor.\n const anchor = this.#getValidationAnchor();\n this.internals.setValidity(state, ' ', anchor ?? undefined);\n }\n\n #syncHostTabIndex(shouldBeFocusable: boolean): void {\n const hasTabIndexAttr = this.hasAttribute('tabindex');\n if (hasTabIndexAttr && !this.#autoTabIndex) return;\n\n if (shouldBeFocusable) {\n this.tabIndex = 0;\n this.#autoTabIndex = true;\n return;\n }\n\n if (this.#autoTabIndex) {\n this.removeAttribute('tabindex');\n this.#autoTabIndex = false;\n }\n }\n\n #updateValidity(): void {\n this.#warnIfMissingName();\n const hasSelection = this.#getCheckedCount() > 0;\n const requiredInvalid = this.required && !hasSelection;\n const externalInvalid = this.invalid;\n const showRequiredError = requiredInvalid && this.#hasInteracted;\n const showInvalidUi = externalInvalid || showRequiredError;\n\n this.#syncHostTabIndex(showInvalidUi);\n\n if (requiredInvalid) {\n this.#setValidityState({ valueMissing: true });\n this.#syncChildInvalid(showInvalidUi);\n return;\n }\n\n if (externalInvalid) {\n this.#setValidityState({ customError: true });\n this.#syncChildInvalid(true);\n return;\n }\n\n this.internals.setValidity({});\n this.#syncChildInvalid(false);\n }\n\n #warnIfMissingName(): void {\n if (this.#hasWarnedMissingName) return;\n if (!this.internals.form) return;\n if (this.name && this.name.trim().length > 0) return;\n console.warn('w-checkbox-group: \"name\" is required for form submission.');\n this.#hasWarnedMissingName = true;\n }\n}\n\nif (!customElements.get('w-checkbox-group')) {\n customElements.define('w-checkbox-group', WCheckboxGroup);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'w-checkbox-group': WCheckboxGroup;\n }\n}\n", "import { i18n, Messages } from '@lingui/core';\n\nexport const supportedLocales = ['en', 'nb', 'fi', 'da', 'sv'] as const;\ntype SupportedLocale = (typeof supportedLocales)[number];\n\nexport const defaultLocale = 'en';\n\nexport const getSupportedLocale = (usedLocale: string) => {\n return (\n supportedLocales.find((locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)) ||\n defaultLocale\n );\n};\n\nexport function detectLocale(): SupportedLocale {\n if (typeof window === 'undefined') {\n /**\n * Server locale detection. This requires e.g LANG environment variable to be set on the server.\n */\n const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;\n return getSupportedLocale(serverLocale);\n }\n\n try {\n /**\n * Client locale detection. Expects the lang attribute to be defined.\n */\n const htmlLocale = getDocumentLang(document);\n if (htmlLocale) {\n return getSupportedLocale(htmlLocale);\n }\n\n const frameLocale = getFrameElementLang();\n if (frameLocale) {\n return getSupportedLocale(frameLocale);\n }\n\n const parentLocale = getDocumentLang(getParentDocument());\n if (parentLocale) {\n return getSupportedLocale(parentLocale);\n }\n\n return defaultLocale;\n } catch (e) {\n console.warn('could not detect locale, falling back to source locale', e);\n return defaultLocale;\n }\n}\n\nexport const getMessages = (\n locale: SupportedLocale,\n enMsg: Messages,\n nbMsg: Messages,\n fiMsg: Messages,\n daMsg: Messages,\n svMsg: Messages,\n) => {\n if (locale === 'nb') return nbMsg;\n if (locale === 'fi') return fiMsg;\n if (locale === 'da') return daMsg;\n if (locale === 'sv') return svMsg;\n // Default to English\n return enMsg;\n};\n\nexport const activateI18n = (\n enMessages: Messages,\n nbMessages: Messages,\n fiMessages: Messages,\n daMessages: Messages,\n svMessages: Messages,\n) => {\n // Load all locales upfront to support dynamic locale switching\n i18n.load('en', enMessages);\n i18n.load('nb', nbMessages);\n i18n.load('fi', fiMessages);\n i18n.load('da', daMessages);\n i18n.load('sv', svMessages);\n\n const locale = detectLocale();\n i18n.activate(locale);\n notifyI18nChange();\n\n setupLangObserver();\n};\n\nexport const I18N_CHANGE_EVENT = 'warp-i18n-change';\n\nexport function notifyI18nChange() {\n if (typeof window === 'undefined') return;\n window.dispatchEvent(new Event(I18N_CHANGE_EVENT));\n}\n\nlet langObserverInitialized = false;\n\nfunction setupLangObserver() {\n if (langObserverInitialized) return;\n if (typeof window === 'undefined') return;\n if (!document?.documentElement) return;\n\n langObserverInitialized = true;\n\n const handleLangChange = () => {\n const nextLocale = detectLocale();\n if (i18n.locale !== nextLocale) {\n i18n.activate(nextLocale);\n notifyI18nChange();\n }\n };\n\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === 'attributes' && mutation.attributeName === 'lang') {\n handleLangChange();\n break;\n }\n }\n });\n\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['lang'] });\n\n const parentDocument = getParentDocument();\n if (parentDocument && parentDocument.documentElement && parentDocument !== document) {\n observer.observe(parentDocument.documentElement, { attributes: true, attributeFilter: ['lang'] });\n }\n\n const frameEl = getFrameElement();\n if (frameEl) {\n observer.observe(frameEl, { attributes: true, attributeFilter: ['lang'] });\n }\n}\n\nfunction getParentDocument(): Document | null {\n try {\n return window.parent?.document ?? null;\n } catch {\n return null;\n }\n}\n\nfunction getDocumentLang(doc: Document | null | undefined): string {\n try {\n return doc?.documentElement?.lang ?? '';\n } catch {\n return '';\n }\n}\n\nfunction getFrameElement(): HTMLElement | null {\n try {\n return (window.frameElement as HTMLElement | null) ?? null;\n } catch {\n return null;\n }\n}\n\nfunction getFrameElementLang(): string {\n try {\n return window.frameElement?.getAttribute?.('lang') ?? '';\n } catch {\n return '';\n }\n}\n", "/*eslint-disable*/export const messages=JSON.parse(\"{\\\"checkbox-group.validation.required\\\":[\\\"Mindst \u00E9n valgt mulighed er p\u00E5kr\u00E6vet.\\\"],\\\"checkbox-group.label.optional\\\":[\\\"Valgfri\\\"]}\");", "/*eslint-disable*/export const messages=JSON.parse(\"{\\\"checkbox-group.validation.required\\\":[\\\"At least one selection is required.\\\"],\\\"checkbox-group.label.optional\\\":[\\\"Optional\\\"]}\");", "/*eslint-disable*/export const messages=JSON.parse(\"{\\\"checkbox-group.validation.required\\\":[\\\"V\u00E4hint\u00E4\u00E4n yksi valinta vaaditaan.\\\"],\\\"checkbox-group.label.optional\\\":[\\\"Valinnainen\\\"]}\");", "/*eslint-disable*/export const messages=JSON.parse(\"{\\\"checkbox-group.validation.required\\\":[\\\"Minst ett valg er p\u00E5krevd.\\\"],\\\"checkbox-group.label.optional\\\":[\\\"Valgfri\\\"]}\");", "/*eslint-disable*/export const messages=JSON.parse(\"{\\\"checkbox-group.validation.required\\\":[\\\"Minst ett val kr\u00E4vs.\\\"],\\\"checkbox-group.label.optional\\\":[\\\"Valfritt\\\"]}\");"],
|
|
5
|
+
"mappings": "kiCAAA,IAAAA,GAAAC,GAAAC,GAAA,cAGA,OAAO,eAAeA,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EAC5DA,EAAQ,cAAgBA,EAAQ,UAAY,OAO5C,IAAIC,GACH,SAAUA,EAAW,CAMlBA,EAAU,iBAAsB,oBAMhCA,EAAU,qBAA0B,wBAMpCA,EAAU,eAAoB,mBAK9BA,EAAU,iBAAsB,oBAKhCA,EAAU,YAAiB,eAC/B,GAAGA,EAAYD,EAAQ,YAAcA,EAAQ,UAAY,CAAC,EAAE,EAE5DA,EAAQ,cAAgB,IAAI,IAAI,CAC5B,CAACC,EAAU,iBAAkB,6CAA6C,EAC1E,CACIA,EAAU,qBACV,iDACJ,EACA,CACIA,EAAU,eACV,wEACJ,EACA,CACIA,EAAU,iBACV,uHAEJ,EACA,CAACA,EAAU,YAAa,4CAA4C,CACxE,CAAC,IC3DD,IAAAC,GAAAC,GAAAC,GAAA,cACA,OAAO,eAAeA,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EAC5DA,EAAQ,MAAQA,EAAQ,cAAgBA,EAAQ,UAAY,OAC5D,IAAMC,EAAW,KACjB,OAAO,eAAeD,EAAS,YAAa,CAAE,WAAY,GAAM,IAAK,UAAY,CAAE,OAAOC,EAAS,SAAW,CAAE,CAAC,EACjH,OAAO,eAAeD,EAAS,gBAAiB,CAAE,WAAY,GAAM,IAAK,UAAY,CAAE,OAAOC,EAAS,aAAe,CAAE,CAAC,EASzH,SAASC,GAAcC,EAAK,CAExB,MADuB,CAACA,EAAI,MAAM,YAAY,EACtB,SAASA,EAAK,EAAE,EAAI,GAChD,CAYA,SAASC,EAAoBD,EAAK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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAhChBC,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAF9BhC,EAGX,qBAIA+B,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAN9BhC,EAOX,oBAIA+B,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAV/BhC,EAWX,wBAGA+B,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,GAAM,UAAW,WAAY,CAAC,GAbtDhC,EAcX,wBAIA+B,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAjB/BhC,EAkBX,wBAIA+B,EAAA,CADCC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GArB/BhC,EAsBX,uBAmRG,eAAe,IAAI,kBAAkB,GACxC,eAAe,OAAO,mBAAoBA,CAAc",
|
|
6
|
+
"names": ["require_errors", "__commonJSMin", "exports", "ErrorType", "require_dist", "__commonJSMin", "exports", "errors_1", "parseHexToInt", "hex", "validateAndParseHex", "errorName", "enforcedLength", "parsedHex", "parseHexadecimalCode", "code", "parsedCode", "parseUnicodeCode", "surrogateCode", "parsedSurrogateCode", "isCurlyBraced", "text", "parseUnicodeCodePointCode", "codePoint", "withoutBraces", "err", "parseOctalCode", "error", "singleCharacterEscapes", "parseSingleCharacterCode", "escapeMatch", "unraw", "raw", "allowOctals", "_", "backslash", "unicodeWithSurrogate", "surrogate", "unicode", "octal", "singleCharacter", "import_unraw", "isString", "isFunction", "f", "cache", "defaultLocale", "normalizeLocales", "locales", "date", "value", "format", "_locales", "o", "getMemoized", "cacheKey", "time", "number", "plural", "ordinal", "offset", "rules", "_a", "_b", "plurals", "getKey", "construct", "key", "formatter", "type", "options", "localeKey", "UNICODE_REGEX", "OCTOTHORPE_PH", "getDefaultFormats", "locale", "passedLocales", "formats", "locales", "style", "format", "replaceOctothorpe", "value", "message", "numberFormat", "valueStr", "number", "cases", "offset", "plural", "selectFormatter", "date", "time", "rules", "_a", "interpolate", "translation", "values", "formatters", "formatMessage", "tokens", "token", "isString", "name", "type", "interpolatedFormat", "key", "value2", "formatter", "result", "__defProp$1", "__defNormalProp$1", "obj", "__publicField$1", "EventEmitter", "event", "listener", "maybeListeners", "index", "args", "__defProp", "__defNormalProp", "__publicField", "I18n", "params", "defaultLocale", "localeData", "maybeLocaleData", "compiler", "localeOrAllData", "messages", "maybeMessages", "localeOrMessages", "messages2", "id", "options", "messageForId", "messageMissing", "missing", "isFunction", "setupI18n", "i18n", "FormControlMixin", "SuperClass", "FormControl", "args", "_FormControl_focused", "_FormControl_forceError", "_FormControl_touched", "_FormControl_abortController", "_FormControl_previousAbortController", "_FormControl_awaitingValidationTarget", "_FormControl_value", "_FormControl_onFocus", "__classPrivateFieldSet", "__classPrivateFieldGet", "_FormControl_instances", "_FormControl_shouldShowError", "_FormControl_onBlur", "_FormControl_runValidators", "showError", "_FormControl_onInvalid", "_a", "_FormControl_validationCompleteResolver", "_FormControl_isValidationPending", "_FormControl_validationComplete", "_b", "_c", "validatorAttributes", "validator", "observedAttributes", "attribute", "name", "oldValue", "newValue", "validators", "value", "valueToUpdate", "resolve", "rootNode", "selector", "proto", "validity", "asyncValidators", "hasAsyncValidators", "abortController", "validationMessage", "hasChange", "key", "isValid", "isValidatorValid", "_FormControl_getValidatorMessageForValue", "_FormControl_setValidityWithOptionalTarget", "message", "css", "html", "LitElement", "nothing", "property", "ifDefined", "supportedLocales", "defaultLocale", "getSupportedLocale", "usedLocale", "locale", "detectLocale", "serverLocale", "htmlLocale", "getDocumentLang", "frameLocale", "getFrameElementLang", "parentLocale", "getParentDocument", "e", "activateI18n", "enMessages", "nbMessages", "fiMessages", "daMessages", "svMessages", "i18n", "locale", "detectLocale", "notifyI18nChange", "setupLangObserver", "I18N_CHANGE_EVENT", "langObserverInitialized", "handleLangChange", "nextLocale", "observer", "mutations", "mutation", "parentDocument", "getParentDocument", "frameEl", "getFrameElement", "_a", "_b", "e", "getDocumentLang", "doc", "getFrameElementLang", "_c", "messages", "messages", "messages", "messages", "messages", "activateI18n", "messages", "REQUIRED_MESSAGE", "i18n", "_hasInteracted", "_hasWarnedMissingName", "_autoTabIndex", "_unsubscribeI18n", "_handleChange", "_handleInvalid", "_handleSlotChange", "_WCheckboxGroup_instances", "markInteracted_fn", "_handleI18nChange", "getCheckedCount_fn", "applyGroupName_fn", "syncChildInvalid_fn", "getValidationAnchor_fn", "getAssignedElements_fn", "getRequiredMessage_fn", "shouldUpdateValidity_fn", "setValidityState_fn", "syncHostTabIndex_fn", "updateValidity_fn", "warnIfMissingName_fn", "WCheckboxGroup", "FormControlMixin", "LitElement", "__privateAdd", "__privateMethod", "hasSelection", "showRequiredError", "__privateGet", "isInvalid", "helpText", "helpId", "labelId", "ariaInvalid", "html", "nothing", "ifDefined", "__privateSet", "_a", "options", "anchor", "changedProperties", "el", "checkbox", "_b", "slot", "state", "shouldBeFocusable", "requiredInvalid", "externalInvalid", "showInvalidUi", "css", "__decorateClass", "property"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { i18n } from '@lingui/core';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { expect, test, vi } from 'vitest';
|
|
4
|
+
import { render } from 'vitest-browser-lit';
|
|
5
|
+
import './checkbox-group.js';
|
|
6
|
+
import '../checkbox/checkbox.js';
|
|
7
|
+
// Initialize i18n with English locale for tests
|
|
8
|
+
i18n.load('en', {
|
|
9
|
+
'checkbox-group.label.optional': ['(optional)'],
|
|
10
|
+
'checkbox-group.validation.required': ['At least one selection is required.'],
|
|
11
|
+
});
|
|
12
|
+
i18n.activate('en');
|
|
13
|
+
test('renders help text when provided', async () => {
|
|
14
|
+
const page = render(html `
|
|
15
|
+
<w-checkbox-group help-text="Select all that apply">
|
|
16
|
+
<w-checkbox>One</w-checkbox>
|
|
17
|
+
<w-checkbox>Two</w-checkbox>
|
|
18
|
+
</w-checkbox-group>
|
|
19
|
+
`);
|
|
20
|
+
await expect.element(page.getByText('Select all that apply')).toBeVisible();
|
|
21
|
+
});
|
|
22
|
+
test('associates help text with the group', async () => {
|
|
23
|
+
const page = render(html `
|
|
24
|
+
<w-checkbox-group help-text="Choose wisely">
|
|
25
|
+
<w-checkbox>One</w-checkbox>
|
|
26
|
+
<w-checkbox>Two</w-checkbox>
|
|
27
|
+
</w-checkbox-group>
|
|
28
|
+
`);
|
|
29
|
+
const group = page.getByRole('group');
|
|
30
|
+
await expect.element(group).toHaveAccessibleDescription('Choose wisely');
|
|
31
|
+
});
|
|
32
|
+
test('renders label above the group and associates it', async () => {
|
|
33
|
+
const page = render(html `
|
|
34
|
+
<w-checkbox-group label="Preferences">
|
|
35
|
+
<w-checkbox>One</w-checkbox>
|
|
36
|
+
<w-checkbox>Two</w-checkbox>
|
|
37
|
+
</w-checkbox-group>
|
|
38
|
+
`);
|
|
39
|
+
await expect.element(page.getByText('Preferences')).toBeVisible();
|
|
40
|
+
await expect.element(page.getByRole('group', { name: 'Preferences' })).toBeVisible();
|
|
41
|
+
});
|
|
42
|
+
test('renders optional text when optional is true', async () => {
|
|
43
|
+
const page = render(html `
|
|
44
|
+
<w-checkbox-group label="Preferences" optional>
|
|
45
|
+
<w-checkbox>One</w-checkbox>
|
|
46
|
+
<w-checkbox>Two</w-checkbox>
|
|
47
|
+
</w-checkbox-group>
|
|
48
|
+
`);
|
|
49
|
+
await expect.element(page.getByText('(optional)')).toBeVisible();
|
|
50
|
+
});
|
|
51
|
+
test('required group toggles invalid state for group and children after submit and selection', async () => {
|
|
52
|
+
const page = render(html `
|
|
53
|
+
<form>
|
|
54
|
+
<w-checkbox-group label="Preferences" required>
|
|
55
|
+
<w-checkbox name="group" value="foo">Foo</w-checkbox>
|
|
56
|
+
<w-checkbox name="group" value="bar">Bar</w-checkbox>
|
|
57
|
+
</w-checkbox-group>
|
|
58
|
+
<button type="submit">Submit</button>
|
|
59
|
+
</form>
|
|
60
|
+
`);
|
|
61
|
+
const form = document.querySelector('form');
|
|
62
|
+
const submit = page.getByRole('button', { name: 'Submit' });
|
|
63
|
+
const group = page.getByRole('group', { name: 'Preferences' });
|
|
64
|
+
const firstCheckbox = page.getByRole('checkbox', { name: 'Foo' });
|
|
65
|
+
const firstCheckboxEl = document.querySelector('w-checkbox');
|
|
66
|
+
await submit.click();
|
|
67
|
+
await expect.poll(() => form.checkValidity()).toBe(false);
|
|
68
|
+
await expect.element(group).toHaveAttribute('aria-invalid', 'true');
|
|
69
|
+
await expect.element(firstCheckbox).toHaveAttribute('aria-invalid', 'true');
|
|
70
|
+
firstCheckboxEl.click();
|
|
71
|
+
await expect.poll(() => form.checkValidity()).toBe(true);
|
|
72
|
+
await expect.element(group).not.toHaveAttribute('aria-invalid', 'true');
|
|
73
|
+
await expect.element(firstCheckbox).not.toHaveAttribute('aria-invalid', 'true');
|
|
74
|
+
});
|
|
75
|
+
test('submits checked checkbox values via form data', async () => {
|
|
76
|
+
render(html `
|
|
77
|
+
<form>
|
|
78
|
+
<w-checkbox-group label="Preferences">
|
|
79
|
+
<w-checkbox name="prefs" value="alpha" checked>Alpha</w-checkbox>
|
|
80
|
+
<w-checkbox name="prefs" value="beta" checked>Beta</w-checkbox>
|
|
81
|
+
<w-checkbox name="prefs" value="gamma">Gamma</w-checkbox>
|
|
82
|
+
</w-checkbox-group>
|
|
83
|
+
</form>
|
|
84
|
+
`);
|
|
85
|
+
const form = document.querySelector('form');
|
|
86
|
+
const data = new FormData(form);
|
|
87
|
+
expect(data.getAll('prefs')).toEqual(['alpha', 'beta']);
|
|
88
|
+
});
|
|
89
|
+
test('applies group name to child checkboxes without a name', async () => {
|
|
90
|
+
render(html `
|
|
91
|
+
<w-checkbox-group name="prefs">
|
|
92
|
+
<w-checkbox value="alpha" checked>Alpha</w-checkbox>
|
|
93
|
+
<w-checkbox name="custom" value="beta" checked>Beta</w-checkbox>
|
|
94
|
+
</w-checkbox-group>
|
|
95
|
+
`);
|
|
96
|
+
const [first, second] = Array.from(document.querySelectorAll('w-checkbox'));
|
|
97
|
+
await first.updateComplete;
|
|
98
|
+
expect(first.name).toBe('prefs');
|
|
99
|
+
expect(second.name).toBe('custom');
|
|
100
|
+
});
|
|
101
|
+
test('warns when used in a form without a name', async () => {
|
|
102
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
103
|
+
render(html `
|
|
104
|
+
<form>
|
|
105
|
+
<w-checkbox-group>
|
|
106
|
+
<w-checkbox value="alpha" checked>Alpha</w-checkbox>
|
|
107
|
+
</w-checkbox-group>
|
|
108
|
+
</form>
|
|
109
|
+
`);
|
|
110
|
+
await expect.poll(() => warn).toHaveBeenCalled();
|
|
111
|
+
warn.mockRestore();
|
|
112
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const messages: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"checkbox-group.validation.required\":[\"Mindst én valgt mulighed er påkrævet.\"],\"checkbox-group.label.optional\":[\"Valgfri\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const messages: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"checkbox-group.validation.required\":[\"At least one selection is required.\"],\"checkbox-group.label.optional\":[\"Optional\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const messages: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"checkbox-group.validation.required\":[\"Vähintään yksi valinta vaaditaan.\"],\"checkbox-group.label.optional\":[\"Valinnainen\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const messages: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"checkbox-group.validation.required\":[\"Minst ett valg er påkrevd.\"],\"checkbox-group.label.optional\":[\"Valgfri\"]}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const messages: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*eslint-disable*/ export const messages = JSON.parse("{\"checkbox-group.validation.required\":[\"Minst ett val krävs.\"],\"checkbox-group.label.optional\":[\"Valfritt\"]}");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createComponent } from '@lit/react';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
// decouple from CDN by providing a dummy class
|
|
5
|
+
class Component extends LitElement {
|
|
6
|
+
}
|
|
7
|
+
export const CheckboxGroup = createComponent({
|
|
8
|
+
tagName: 'w-checkbox-group',
|
|
9
|
+
elementClass: Component,
|
|
10
|
+
react: React,
|
|
11
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function
|
|
1
|
+
var je=Object.create;var Q=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var Ue=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var ce=o=>{throw TypeError(o)};var de=(o,r)=>()=>(r||o((r={exports:{}}).exports,r),r.exports);var qe=(o,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ue(r))!Be.call(o,a)&&a!==e&&Q(o,a,{get:()=>r[a],enumerable:!(t=le(r,a))||t.enumerable});return o};var He=(o,r,e)=>(e=o!=null?je(Ye(o)):{},qe(r||!o||!o.__esModule?Q(e,"default",{value:o,enumerable:!0}):e,o));var p=(o,r,e,t)=>{for(var a=t>1?void 0:t?le(r,e):r,i=o.length-1,s;i>=0;i--)(s=o[i])&&(a=(t?s(r,e,a):s(a))||a);return t&&a&&Q(r,e,a),a};var ue=(o,r,e)=>r.has(o)||ce("Cannot "+e);var he=(o,r,e)=>(ue(o,r,"read from private field"),e?e.call(o):r.get(o)),pe=(o,r,e)=>r.has(o)?ce("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(o):r.set(o,e),be=(o,r,e,t)=>(ue(o,r,"write to private field"),t?t.call(o,e):r.set(o,e),e);var ge=de(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.errorMessages=V.ErrorType=void 0;var D;(function(o){o.MalformedUnicode="MALFORMED_UNICODE",o.MalformedHexadecimal="MALFORMED_HEXADECIMAL",o.CodePointLimit="CODE_POINT_LIMIT",o.OctalDeprecation="OCTAL_DEPRECATION",o.EndOfString="END_OF_STRING"})(D=V.ErrorType||(V.ErrorType={}));V.errorMessages=new Map([[D.MalformedUnicode,"malformed Unicode character escape sequence"],[D.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[D.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[D.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[D.EndOfString,"malformed escape sequence at end of string"]])});var fe=de(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.unraw=M.errorMessages=M.ErrorType=void 0;var f=ge();Object.defineProperty(M,"ErrorType",{enumerable:!0,get:function(){return f.ErrorType}});Object.defineProperty(M,"errorMessages",{enumerable:!0,get:function(){return f.errorMessages}});function Xe(o){return!o.match(/[^a-f0-9]/i)?parseInt(o,16):NaN}function H(o,r,e){let t=Xe(o);if(Number.isNaN(t)||e!==void 0&&e!==o.length)throw new SyntaxError(f.errorMessages.get(r));return t}function Ze(o){let r=H(o,f.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(r)}function ve(o,r){let e=H(o,f.ErrorType.MalformedUnicode,4);if(r!==void 0){let t=H(r,f.ErrorType.MalformedUnicode,4);return String.fromCharCode(e,t)}return String.fromCharCode(e)}function Ke(o){return o.charAt(0)==="{"&&o.charAt(o.length-1)==="}"}function Ge(o){if(!Ke(o))throw new SyntaxError(f.errorMessages.get(f.ErrorType.MalformedUnicode));let r=o.slice(1,-1),e=H(r,f.ErrorType.MalformedUnicode);try{return String.fromCodePoint(e)}catch(t){throw t instanceof RangeError?new SyntaxError(f.errorMessages.get(f.ErrorType.CodePointLimit)):t}}function Je(o,r=!1){if(r)throw new SyntaxError(f.errorMessages.get(f.ErrorType.OctalDeprecation));let e=parseInt(o,8);return String.fromCharCode(e)}var We=new Map([["b","\b"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function Qe(o){return We.get(o)||o}var er=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function me(o,r=!1){return o.replace(er,function(e,t,a,i,s,n,c,v,O){if(t!==void 0)return"\\";if(a!==void 0)return Ze(a);if(i!==void 0)return Ge(i);if(s!==void 0)return ve(s,n);if(c!==void 0)return ve(c);if(v==="0")return"\0";if(v!==void 0)return Je(v,!r);if(O!==void 0)return Qe(O);throw new SyntaxError(f.errorMessages.get(f.ErrorType.EndOfString))})}M.unraw=me;M.default=me});var Y=function(){for(var o=[],r=arguments.length;r--;)o[r]=arguments[r];return o.reduce(function(e,t){return e.concat(typeof t=="string"?t:Array.isArray(t)?Y.apply(void 0,t):typeof t=="object"&&t?Object.keys(t).map(function(a){return t[a]?a:""}):"")},[]).join(" ")};var ke=He(fe(),1);var S=o=>typeof o=="string",rr=o=>typeof o=="function",we=new Map,ye="en";function oe(o){return[...Array.isArray(o)?o:[o],ye]}function ae(o,r,e){let t=oe(o);e||(e="default");let a;if(typeof e=="string")switch(a={day:"numeric",month:"short",year:"numeric"},e){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=e;return X(()=>Z("date",t,e),()=>new Intl.DateTimeFormat(t,a)).format(S(r)?new Date(r):r)}function tr(o,r,e){let t;if(e||(e="default"),typeof e=="string")switch(t={second:"numeric",minute:"numeric",hour:"numeric"},e){case"full":case"long":t.timeZoneName="short";break;case"short":delete t.second}else t=e;return ae(o,r,t)}function ee(o,r,e){let t=oe(o);return X(()=>Z("number",t,e),()=>new Intl.NumberFormat(t,e)).format(r)}function xe(o,r,e,{offset:t=0,...a}){var n,c;let i=oe(o),s=r?X(()=>Z("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):X(()=>Z("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return(c=(n=a[e])!=null?n:a[s.select(e-t)])!=null?c:a.other}function X(o,r){let e=o(),t=we.get(e);return t||(t=r(),we.set(e,t)),t}function Z(o,r,e){let t=r.join("-");return`${o}-${t}-${JSON.stringify(e)}`}var _e=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Oe="%__lingui_octothorpe__%",or=(o,r,e={})=>{let t=r||o,a=s=>typeof s=="object"?s:e[s],i=(s,n)=>{let c=Object.keys(e).length?a("number"):void 0,v=ee(t,s,c);return n.replace(new RegExp(Oe,"g"),v)};return{plural:(s,n)=>{let{offset:c=0}=n,v=xe(t,!1,s,n);return i(s-c,v)},selectordinal:(s,n)=>{let{offset:c=0}=n,v=xe(t,!0,s,n);return i(s-c,v)},select:ar,number:(s,n)=>ee(t,s,a(n)||{style:n}),date:(s,n)=>ae(t,s,a(n)||n),time:(s,n)=>tr(t,s,a(n)||n)}},ar=(o,r)=>{var e;return(e=r[o])!=null?e:r.other};function ir(o,r,e){return(t={},a)=>{let i=or(r,e,a),s=(c,v=!1)=>Array.isArray(c)?c.reduce((O,E)=>{if(E==="#"&&v)return O+Oe;if(S(E))return O+E;let[T,k,z]=E,F={};k==="plural"||k==="selectordinal"||k==="select"?Object.entries(z).forEach(([L,N])=>{F[L]=s(N,k==="plural"||k==="selectordinal")}):F=z;let x;if(k){let L=i[k];x=L(t[T],F)}else x=t[T];return x==null?O:O+x},""):c,n=s(o);return S(n)&&_e.test(n)?(0,ke.unraw)(n):S(n)?n:n?String(n):""}}var nr=Object.defineProperty,sr=(o,r,e)=>r in o?nr(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,lr=(o,r,e)=>(sr(o,typeof r!="symbol"?r+"":r,e),e),re=class{constructor(){lr(this,"_events",{})}on(r,e){var a;var t;return(a=(t=this._events)[r])!=null||(t[r]=[]),this._events[r].push(e),()=>this.removeListener(r,e)}removeListener(r,e){let t=this._getListeners(r);if(!t)return;let a=t.indexOf(e);~a&&t.splice(a,1)}emit(r,...e){let t=this._getListeners(r);t&&t.map(a=>a.apply(this,e))}_getListeners(r){let e=this._events[r];return Array.isArray(e)?e:!1}},cr=Object.defineProperty,dr=(o,r,e)=>r in o?cr(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,I=(o,r,e)=>(dr(o,typeof r!="symbol"?r+"":r,e),e),te=class extends re{constructor(r){var e;super(),I(this,"_locale",""),I(this,"_locales"),I(this,"_localeData",{}),I(this,"_messages",{}),I(this,"_missing"),I(this,"_messageCompiler"),I(this,"t",this._.bind(this)),r.missing!=null&&(this._missing=r.missing),r.messages!=null&&this.load(r.messages),r.localeData!=null&&this.loadLocaleData(r.localeData),(typeof r.locale=="string"||r.locales)&&this.activate((e=r.locale)!=null?e:ye,r.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var r;return(r=this._messages[this._locale])!=null?r:{}}get localeData(){var r;return(r=this._localeData[this._locale])!=null?r:{}}_loadLocaleData(r,e){let t=this._localeData[r];t?Object.assign(t,e):this._localeData[r]=e}setMessagesCompiler(r){return this._messageCompiler=r,this}loadLocaleData(r,e){typeof r=="string"?this._loadLocaleData(r,e):Object.keys(r).forEach(t=>this._loadLocaleData(t,r[t])),this.emit("change")}_load(r,e){let t=this._messages[r];t?Object.assign(t,e):this._messages[r]=e}load(r,e){typeof r=="string"&&typeof e=="object"?this._load(r,e):Object.entries(r).forEach(([t,a])=>this._load(t,a)),this.emit("change")}loadAndActivate({locale:r,locales:e,messages:t}){this._locale=r,this._locales=e||void 0,this._messages[this._locale]=t,this.emit("change")}activate(r,e){this._locale=r,this._locales=e,this.emit("change")}_(r,e,t){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let a=t==null?void 0:t.message;r||(r=""),S(r)||(e=r.values||e,a=r.message,r=r.id);let i=this.messages[r],s=i===void 0,n=this._missing;if(n&&s)return rr(n)?n(this._locale,r):n;s&&this.emit("missing",{id:r,locale:this._locale});let c=i||a||r;return S(c)&&(this._messageCompiler?c=this._messageCompiler(c):console.warn(`Uncompiled message detected! Message:
|
|
3
3
|
|
|
4
4
|
> ${c}
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ That means you use raw catalog or your catalog doesn't have a translation for th
|
|
|
7
7
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
8
8
|
|
|
9
9
|
Please compile your catalog first.
|
|
10
|
-
`)),S(c)&&
|
|
10
|
+
`)),S(c)&&_e.test(c)?JSON.parse(`"${c}"`):S(c)?c:ir(c,this._locale,this._locales)(e,t==null?void 0:t.formats)}date(r,e){return ae(this._locales||this._locale,r,e)}number(r,e){return ee(this._locales||this._locale,r,e)}};function ur(o={}){return new te(o)}var _=ur();var u=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},g=function(o,r,e,t,a){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!a:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?a.call(o,e):a?a.value=e:r.set(o,e),e};function Ce(o){var r,e,t,a,i,s,n,c,v,O,E,T,k,z,F,x,L,N,G;class Pe extends o{constructor(...l){var d,b,m;super(...l),r.add(this),this.internals=this.attachInternals(),e.set(this,!1),t.set(this,!1),a.set(this,!1),i.set(this,void 0),s.set(this,void 0),n.set(this,!0),v.set(this,""),O.set(this,()=>{g(this,a,!0,"f"),g(this,e,!0,"f"),u(this,r,"m",x).call(this)}),E.set(this,()=>{g(this,e,!1,"f"),u(this,r,"m",L).call(this,this.shouldFormValueUpdate()?u(this,v,"f"):""),!this.validity.valid&&u(this,a,"f")&&g(this,t,!0,"f");let C=u(this,r,"m",x).call(this);this.validationMessageCallback&&this.validationMessageCallback(C?this.internals.validationMessage:"")}),T.set(this,()=>{var C;u(this,n,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),g(this,n,!1,"f")),g(this,a,!0,"f"),g(this,t,!0,"f"),u(this,r,"m",x).call(this),(C=this===null||this===void 0?void 0:this.validationMessageCallback)===null||C===void 0||C.call(this,this.showError?this.internals.validationMessage:"")}),k.set(this,void 0),z.set(this,!1),F.set(this,Promise.resolve()),(d=this.addEventListener)===null||d===void 0||d.call(this,"focus",u(this,O,"f")),(b=this.addEventListener)===null||b===void 0||b.call(this,"blur",u(this,E,"f")),(m=this.addEventListener)===null||m===void 0||m.call(this,"invalid",u(this,T,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let l=this.validators.map(m=>m.attribute).flat(),d=super.observedAttributes||[];return[...new Set([...d,...l])]}static getValidator(l){return this.validators.find(d=>d.attribute===l)||null}static getValidators(l){return this.validators.filter(d=>{var b;if(d.attribute===l||!((b=d.attribute)===null||b===void 0)&&b.includes(l))return!0})}get form(){return this.internals.form}get showError(){return u(this,r,"m",x).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(l,d,b){var m;(m=super.attributeChangedCallback)===null||m===void 0||m.call(this,l,d,b);let P=this.constructor.getValidators(l);P!=null&&P.length&&this.validationTarget&&this.setValue(u(this,v,"f"))}setValue(l){var d;g(this,t,!1,"f"),(d=this.validationMessageCallback)===null||d===void 0||d.call(this,""),g(this,v,l,"f");let m=this.shouldFormValueUpdate()?l:null;this.internals.setFormValue(m),u(this,r,"m",L).call(this,m),this.valueChangedCallback&&this.valueChangedCallback(m),u(this,r,"m",x).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(l=>l(u(this,F,"f")))}formResetCallback(){var l,d;g(this,a,!1,"f"),g(this,t,!1,"f"),u(this,r,"m",x).call(this),(l=this.resetFormControl)===null||l===void 0||l.call(this),(d=this.validationMessageCallback)===null||d===void 0||d.call(this,u(this,r,"m",x).call(this)?this.validationMessage:"")}}return e=new WeakMap,t=new WeakMap,a=new WeakMap,i=new WeakMap,s=new WeakMap,n=new WeakMap,v=new WeakMap,O=new WeakMap,E=new WeakMap,T=new WeakMap,k=new WeakMap,z=new WeakMap,F=new WeakMap,r=new WeakSet,c=function(){let l=this.getRootNode(),d=`${this.localName}[name="${this.getAttribute("name")}"]`;return l.querySelectorAll(d)},x=function(){if(this.hasAttribute("disabled"))return!1;let l=u(this,t,"f")||u(this,a,"f")&&!this.validity.valid&&!u(this,e,"f");return l&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),l},L=function(l){let d=this.constructor,b={},m=d.validators,C=[],P=m.some(y=>y.isValid instanceof Promise);u(this,z,"f")||(g(this,F,new Promise(y=>{g(this,k,y,"f")}),"f"),g(this,z,!0,"f")),u(this,i,"f")&&(u(this,i,"f").abort(),g(this,s,u(this,i,"f"),"f"));let j=new AbortController;g(this,i,j,"f");let U,se=!1;m.length&&(m.forEach(y=>{let J=y.key||"customError",$=y.isValid(this,l,j.signal);$ instanceof Promise?(C.push($),$.then(W=>{W!=null&&(b[J]=!W,U=u(this,r,"m",G).call(this,y,l),u(this,r,"m",N).call(this,b,U))})):(b[J]=!$,this.validity[J]!==!$&&(se=!0),!$&&!U&&(U=u(this,r,"m",G).call(this,y,l)))}),Promise.allSettled(C).then(()=>{var y;j!=null&&j.signal.aborted||(g(this,z,!1,"f"),(y=u(this,k,"f"))===null||y===void 0||y.call(this))}),(se||!P)&&u(this,r,"m",N).call(this,b,U))},N=function(l,d){if(this.validationTarget)this.internals.setValidity(l,d,this.validationTarget),g(this,n,!1,"f");else{if(this.internals.setValidity(l,d),this.internals.validity.valid)return;g(this,n,!0,"f")}},G=function(l,d){if(this.validityCallback){let b=this.validityCallback(l.key||"customError");if(b)return b}return l.message instanceof Function?l.message(this,d):l.message},Pe}import{html as ne,LitElement as fr}from"lit";import{property as w,state as B}from"lit/decorators.js";import{repeat as wr}from"lit/directives/repeat.js";var hr=["en","nb","fi","da","sv"],ie="en",K=o=>hr.find(r=>o===r||o.toLowerCase().includes(r))||ie;function ze(){if(typeof window=="undefined"){let o=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return K(o)}try{let o=Ee(document);if(o)return K(o);let r=vr();if(r)return K(r);let e=Ee(Ae());return e?K(e):ie}catch(o){return console.warn("could not detect locale, falling back to source locale",o),ie}}var Fe=(o,r,e,t,a)=>{_.load("en",o),_.load("nb",r),_.load("fi",e),_.load("da",t),_.load("sv",a);let i=ze();_.activate(i),Se(),br()},pr="warp-i18n-change";function Se(){typeof window!="undefined"&&window.dispatchEvent(new Event(pr))}var Me=!1;function br(){if(Me||typeof window=="undefined"||!(document!=null&&document.documentElement))return;Me=!0;let o=()=>{let a=ze();_.locale!==a&&(_.activate(a),Se())},r=new MutationObserver(a=>{for(let i of a)if(i.type==="attributes"&&i.attributeName==="lang"){o();break}});r.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});let e=Ae();e&&e.documentElement&&e!==document&&r.observe(e.documentElement,{attributes:!0,attributeFilter:["lang"]});let t=gr();t&&r.observe(t,{attributes:!0,attributeFilter:["lang"]})}function Ae(){var o,r;try{return(r=(o=window.parent)==null?void 0:o.document)!=null?r:null}catch(e){return null}}function Ee(o){var r,e;try{return(e=(r=o==null?void 0:o.documentElement)==null?void 0:r.lang)!=null?e:""}catch(t){return""}}function gr(){var o;try{return(o=window.frameElement)!=null?o:null}catch(r){return null}}function vr(){var o,r,e;try{return(e=(r=(o=window.frameElement)==null?void 0:o.getAttribute)==null?void 0:r.call(o,"lang"))!=null?e:""}catch(t){return""}}import{css as Le}from"lit";var Ve=Le`
|
|
11
11
|
*,
|
|
12
12
|
:before,
|
|
13
13
|
:after {
|
|
@@ -280,7 +280,7 @@ Please compile your catalog first.
|
|
|
280
280
|
svg {
|
|
281
281
|
pointer-events: none;
|
|
282
282
|
}
|
|
283
|
-
`,
|
|
283
|
+
`,Ar=Le`*, :before, :after {
|
|
284
284
|
--w-rotate: 0;
|
|
285
285
|
--w-rotate-x: 0;
|
|
286
286
|
--w-rotate-y: 0;
|
|
@@ -2446,9 +2446,9 @@ Please compile your catalog first.
|
|
|
2446
2446
|
display: none
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
|
-
`;var
|
|
2450
|
-
.z-0{z-index:0;}.z-20{z-index:20;}`;var A={wrapper:"relative z-0",base:"absolute z-20 left-0 right-0 s-bg pb-4 rounded-8 overflow-hidden shadow-m",listbox:"m-0 p-0 select-none list-none",option:"block cursor-pointer p-8",optionUnselected:"hover:s-bg-hover",optionSelected:"s-bg-selected hover:s-bg-selected-hover",textMatch:"font-bold",a11y:"sr-only"},q,h=class extends
|
|
2451
|
-
>${e.substring(
|
|
2449
|
+
`;var Ie=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultater"]}]],"combobox.aria.noResults":["Ingen resultater"]}');var Te=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," result"],"other":["#"," results"]}]],"combobox.aria.noResults":["No results"]}');var $e=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," tulos"],"other":["#"," tulosta"]}]],"combobox.aria.noResults":["Ei tuloksia"]}');var De=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultater"]}]],"combobox.aria.noResults":["Ingen resultater"]}');var Ne=JSON.parse('{"combobox.aria.pluralResults":[["numResults","plural",{"one":["#"," resultat"],"other":["#"," resultat"]}]],"combobox.aria.noResults":["Inga resultat"]}');import{css as mr}from"lit";var Re=mr`*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.rounded-8{border-radius:8px}.block{display:block}.overflow-hidden{overflow:hidden}.list-none{list-style-type:none}.left-0{left:0}.right-0{right:0}.absolute{position:absolute}.relative{position:relative}.static{position:static}.s-bg{background-color:var(--w-s-color-background)}.s-bg-selected{background-color:var(--w-s-color-background-selected)}.hover\\:s-bg-hover:hover{background-color:var(--w-s-color-background-hover)}.hover\\:s-bg-selected-hover:hover{background-color:var(--w-s-color-background-selected-hover)}.shadow-m{box-shadow:var(--w-shadow-m)}.m-0{margin:0}.p-0{padding:0}.p-8{padding:.8rem}.pb-4{padding-bottom:.4rem}.cursor-pointer{cursor:pointer}.font-bold{font-weight:700}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.select-none{-webkit-user-select:none;user-select:none};
|
|
2450
|
+
.z-0{z-index:0;}.z-20{z-index:20;}`;var A={wrapper:"relative z-0",base:"absolute z-20 left-0 right-0 s-bg pb-4 rounded-8 overflow-hidden shadow-m",listbox:"m-0 p-0 select-none list-none",option:"block cursor-pointer p-8",optionUnselected:"hover:s-bg-hover",optionSelected:"s-bg-selected hover:s-bg-selected-hover",textMatch:"font-bold",a11y:"sr-only"},q,h=class extends Ce(fr){constructor(){super();this.options=[];this.value="";this.openOnFocus=!1;this.selectOnBlur=!0;this.matchTextSegments=!1;this.disableStaticFiltering=!1;this.invalid=!1;this.disabled=!1;this.required=!1;this.optional=!1;this.autocomplete="off";this._isOpen=!1;this._navigationOption=null;this._currentOptions=[];this._optionIdCounter=0;this._displayValue="";pe(this,q,null);Fe(Te,De,$e,Ie,Ne)}firstUpdated(e){be(this,q,this.value)}updated(e){e.has("value")&&this.setValue(this.value)}resetFormControl(){this.value=he(this,q)}get _listboxId(){return`${this._id}-listbox`}get _id(){return"combobox"}get _helpId(){return this.helpText?`${this._id}__hint`:void 0}get _navigationLabelOrDisplayValue(){return this._navigationOption?this._navigationOption.label||this._navigationOption.value:this._displayValue}get _navigationValueOrInputValue(){var e;return((e=this._navigationOption)==null?void 0:e.value)||this.value}_createOptionsWithIdAndMatch(e,t){return e.map((a,i)=>({...a,id:`${this._id}-option-${this._optionIdCounter+i}`,key:a.key||a.value,currentInputValue:t}))}_getAriaText(e,t){if(!e||!t)return"";let a=e.filter(n=>(n.label||n.value).toLowerCase().includes(t.toLowerCase())),i=_._({id:"combobox.aria.pluralResults",message:"{numResults, plural, one {# result} other {# results}}",comment:"Aria text for combobox when one or more results",values:{numResults:a.length}}),s=_._({id:"combobox.aria.noResults",message:"No results",comment:"Aria text for combobox when no results"});return a.length?i:s}_getOptionClasses(e){var t;return Y(A.option,((t=this._navigationOption)==null?void 0:t.id)===(e==null?void 0:e.id)?A.optionSelected:A.optionUnselected)}_handleKeyDown(e){let t=["ArrowDown","ArrowUp","PageUp","PageDown","Home","End"].includes(e.key),a=["ArrowDown","ArrowLeft","ArrowUp","ArrowRight"];if(t&&!this._isOpen){this._isOpen=!0;return}if(t&&this._isOpen){this._findAndSetActiveOption(e);return}if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.key){case"Enter":this._navigationOption&&(e.preventDefault(),this._handleSelect(this._navigationOption),requestAnimationFrame(()=>{var n,c;let i=(n=this.shadowRoot)==null?void 0:n.querySelector("w-textfield"),s=(c=i==null?void 0:i.shadowRoot)==null?void 0:c.querySelector("input");s&&(s.value=this._displayValue)})),this._isOpen=!1;break;case"Tab":case"Delete":this._isOpen=!1;break;case"Escape":this._isOpen?this._isOpen=!1:this._handleChange(""),this._navigationOption=null;break;case"Backspace":this._handleChange(this._navigationLabelOrDisplayValue),this._navigationOption=null,this._isOpen=!0;break;default:if(a.includes(e.key))break;this._isOpen=!0,this._navigationOption?(this._handleChange(this._navigationOption.value),this._navigationOption=null):this._handleChange(this.value);break}}_findAndSetActiveOption(e){e.preventDefault();let t=this._currentOptions.findIndex(s=>{var n;return s.id===((n=this._navigationOption)==null?void 0:n.id)}),a=t+1,i=t-1;switch(e.key){case"ArrowDown":this._navigationOption=a>this._currentOptions.length-1?null:this._currentOptions[a];break;case"ArrowUp":this._navigationOption=i===-2?this._currentOptions[this._currentOptions.length-1]:i<0?null:this._currentOptions[i];break;case"PageUp":this._navigationOption=t-10<0?this._currentOptions[0]:this._currentOptions[t-10];break;case"PageDown":this._navigationOption=t+10>this._currentOptions.length-1?this._currentOptions[this._currentOptions.length-1]:this._currentOptions[t+10];break;case"Home":this._navigationOption=this._currentOptions[0];break;case"End":this._navigationOption=this._currentOptions[this._currentOptions.length-1];break}}_handleSelect(e){this.value=e.value,this._displayValue=e.label||e.value,this.setValue(this.value);let t=new CustomEvent("select",{detail:{value:e.value},bubbles:!0,composed:!0});this.dispatchEvent(t),this._isOpen=!1,this._navigationOption=null,this.disableStaticFiltering&&(this._currentOptions=[])}_handleChange(e){if(e===void 0)return;this.value=e,this._displayValue=e;let t=new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0});this.dispatchEvent(t)}_handleFocus(){if(!this.openOnFocus)return;let e=new CustomEvent("focus",{bubbles:!0,composed:!0});this.dispatchEvent(e),this._isOpen=!0}_handleBlur(e){var i,s;let t=e.relatedTarget;if(t&&((i=this.shadowRoot)!=null&&i.contains(t)))return;if(this._isOpen=!1,this.selectOnBlur&&(this._navigationOption||!this._navigationOption&&this._currentOptions.findIndex(n=>n.value===this.value)!==-1)){let n=((s=this._navigationOption)==null?void 0:s.value)||this.value;this.value=n;let c=new CustomEvent("select",{detail:{value:n},bubbles:!0,composed:!0});this.dispatchEvent(c)}this._navigationOption=null;let a=new CustomEvent("blur",{detail:{value:this._navigationValueOrInputValue},bubbles:!0,composed:!0});this.dispatchEvent(a)}_handleOptionClick(e,t){this._handleSelect(t),requestAnimationFrame(()=>{var s,n;let a=(s=this.shadowRoot)==null?void 0:s.querySelector("w-textfield"),i=(n=a==null?void 0:a.shadowRoot)==null?void 0:n.querySelector("input");i&&(i.value=t.label||t.value)})}_handleContainerBlur(e){(!e.currentTarget||!e.currentTarget.contains(e.relatedTarget))&&(this._isOpen=!1)}_renderTextMatch(e,t){if(!this.matchTextSegments)return e;let a=e.toLowerCase().indexOf(t.currentInputValue.toLowerCase());if(a!==-1){let i=a+t.currentInputValue.length;return ne`${e.substring(0,a)}<span class="${A.textMatch}">${e.substring(a,i)}</span
|
|
2451
|
+
>${e.substring(i)}`}return e}willUpdate(e){if(e.has("value")||e.has("options")){let t=this.options.find(i=>i.value===this.value),a=t?t.label||t.value:this.value;this._displayValue!==a&&this._displayValue!==this.value&&(this._displayValue=a),!this._displayValue&&this.value&&(this._displayValue=a)}(e.has("options")||e.has("value")||e.has("disableStaticFiltering")||e.has("_displayValue"))&&(this._optionIdCounter+=this.options.length,this._currentOptions=this._createOptionsWithIdAndMatch(this.options,this._displayValue).filter(t=>this.disableStaticFiltering?!0:(t.label||t.value).toLowerCase().includes(this._displayValue.toLowerCase()))),this.disableStaticFiltering&&this._currentOptions.length&&this._currentOptions.length===1&&!this._currentOptions.some(t=>t.value===this.value)&&!this._isOpen&&(this._isOpen=!0)}render(){var e;return ne`
|
|
2452
2452
|
<div class=${Y(A.wrapper)} @blur=${this._handleContainerBlur}>
|
|
2453
2453
|
<w-textfield
|
|
2454
2454
|
class="w-combobox-textfield"
|
|
@@ -2476,19 +2476,19 @@ Please compile your catalog first.
|
|
|
2476
2476
|
|
|
2477
2477
|
<div ?hidden=${!this._isOpen||!this._currentOptions.length} class=${Y(A.base)}>
|
|
2478
2478
|
<ul id=${this._listboxId} role="listbox" class="${A.listbox}">
|
|
2479
|
-
${
|
|
2479
|
+
${wr(this._currentOptions,t=>t.key,t=>{var i;let a=t.label||t.value;return ne`
|
|
2480
2480
|
<li
|
|
2481
2481
|
id=${t.id}
|
|
2482
2482
|
role="option"
|
|
2483
|
-
aria-selected=${((
|
|
2483
|
+
aria-selected=${((i=this._navigationOption)==null?void 0:i.id)===t.id}
|
|
2484
2484
|
tabindex="-1"
|
|
2485
2485
|
class=${this._getOptionClasses(t)}
|
|
2486
|
-
@mousedown=${
|
|
2486
|
+
@mousedown=${s=>this._handleOptionClick(s,t)}>
|
|
2487
2487
|
${this._renderTextMatch(a,t)}
|
|
2488
2488
|
</li>
|
|
2489
2489
|
`})}
|
|
2490
2490
|
</ul>
|
|
2491
2491
|
</div>
|
|
2492
2492
|
</div>
|
|
2493
|
-
`}};q=new WeakMap,h.styles=[
|
|
2493
|
+
`}};q=new WeakMap,h.styles=[Ve,Re],p([w({type:Array})],h.prototype,"options",2),p([w({type:String,reflect:!0})],h.prototype,"label",2),p([w({type:String,reflect:!0})],h.prototype,"placeholder",2),p([w({type:String,reflect:!0})],h.prototype,"value",2),p([w({type:Boolean,attribute:"open-on-focus"})],h.prototype,"openOnFocus",2),p([w({type:Boolean,attribute:"select-on-blur"})],h.prototype,"selectOnBlur",2),p([w({type:Boolean,attribute:"match-text-segments"})],h.prototype,"matchTextSegments",2),p([w({type:Boolean,attribute:"disable-static-filtering"})],h.prototype,"disableStaticFiltering",2),p([w({type:Boolean,reflect:!0})],h.prototype,"invalid",2),p([w({type:String,attribute:"help-text",reflect:!0})],h.prototype,"helpText",2),p([w({type:Boolean,reflect:!0})],h.prototype,"disabled",2),p([w({type:Boolean,reflect:!0})],h.prototype,"required",2),p([w({type:Boolean,reflect:!0})],h.prototype,"optional",2),p([w({type:String,reflect:!0})],h.prototype,"name",2),p([w({type:String,reflect:!0})],h.prototype,"autocomplete",2),p([B()],h.prototype,"_isOpen",2),p([B()],h.prototype,"_navigationOption",2),p([B()],h.prototype,"_currentOptions",2),p([B()],h.prototype,"_optionIdCounter",2),p([B()],h.prototype,"_displayValue",2);customElements.get("w-combobox")||customElements.define("w-combobox",h);export{h as WarpCombobox};
|
|
2494
2494
|
//# sourceMappingURL=combobox.js.map
|