@warp-ds/elements 1.4.0 → 1.4.1-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/index.js +141 -104
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/index.js +8 -6
- package/dist/packages/affix/index.js.map +3 -3
- package/dist/packages/alert/index.js +19 -17
- package/dist/packages/alert/index.js.map +3 -3
- package/dist/packages/attention/index.js +714 -718
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/badge/index.js +15 -13
- package/dist/packages/badge/index.js.map +3 -3
- package/dist/packages/box/index.js +16 -14
- package/dist/packages/box/index.js.map +3 -3
- package/dist/packages/breadcrumbs/index.js +519 -517
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/broadcast/index.js.map +2 -2
- package/dist/packages/button/index.js +523 -517
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/card/index.js +5 -3
- package/dist/packages/card/index.js.map +3 -3
- package/dist/packages/expandable/index.js +39 -42
- package/dist/packages/expandable/index.js.map +3 -3
- package/dist/packages/pill/index.js +68 -66
- package/dist/packages/pill/index.js.map +4 -4
- package/dist/packages/select/index.js +522 -516
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/textfield/index.js +24 -3
- package/dist/packages/textfield/index.js.map +3 -3
- package/dist/packages/toast/index.js +455 -446
- package/dist/packages/toast/index.js.map +4 -4
- package/package.json +7 -11
|
@@ -1039,9 +1039,6 @@ var require_parser = __commonJS({
|
|
|
1039
1039
|
|
|
1040
1040
|
// packages/select/index.js
|
|
1041
1041
|
import { html as html2 } from "lit";
|
|
1042
|
-
import WarpElement from "@warp-ds/elements-core";
|
|
1043
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
1044
|
-
import { when } from "lit/directives/when.js";
|
|
1045
1042
|
|
|
1046
1043
|
// node_modules/.pnpm/@chbphone55+classnames@2.0.0/node_modules/@chbphone55/classnames/dist/index.m.js
|
|
1047
1044
|
var r = function() {
|
|
@@ -1054,78 +1051,440 @@ var r = function() {
|
|
|
1054
1051
|
}, []).join(" ");
|
|
1055
1052
|
};
|
|
1056
1053
|
|
|
1057
|
-
// node_modules/.pnpm/@
|
|
1058
|
-
var
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1054
|
+
// node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
|
|
1055
|
+
var import_unraw = __toESM(require_dist(), 1);
|
|
1056
|
+
|
|
1057
|
+
// node_modules/.pnpm/@lingui+message-utils@4.7.1/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1058
|
+
var import_parser = __toESM(require_parser(), 1);
|
|
1059
|
+
function processTokens(tokens, mapText) {
|
|
1060
|
+
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
1061
|
+
return tokens.map((token) => mapText(token.value)).join("");
|
|
1062
|
+
}
|
|
1063
|
+
return tokens.map((token) => {
|
|
1064
|
+
var _a;
|
|
1065
|
+
if (token.type === "content") {
|
|
1066
|
+
return mapText(token.value);
|
|
1067
|
+
} else if (token.type === "octothorpe") {
|
|
1068
|
+
return "#";
|
|
1069
|
+
} else if (token.type === "argument") {
|
|
1070
|
+
return [token.arg];
|
|
1071
|
+
} else if (token.type === "function") {
|
|
1072
|
+
const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
|
|
1073
|
+
if (_param) {
|
|
1074
|
+
return [token.arg, token.key, _param.value.trim()];
|
|
1075
|
+
} else {
|
|
1076
|
+
return [token.arg, token.key];
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
const offset = token.pluralOffset;
|
|
1080
|
+
const formatProps = {};
|
|
1081
|
+
token.cases.forEach((item) => {
|
|
1082
|
+
formatProps[item.key.replace(/^=(.)+/, "$1")] = processTokens(
|
|
1083
|
+
item.tokens,
|
|
1084
|
+
mapText
|
|
1085
|
+
);
|
|
1086
|
+
});
|
|
1087
|
+
return [
|
|
1088
|
+
token.arg,
|
|
1089
|
+
token.type,
|
|
1090
|
+
__spreadValues({
|
|
1091
|
+
offset
|
|
1092
|
+
}, formatProps)
|
|
1093
|
+
];
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
function compileMessage(message, mapText = (v) => v) {
|
|
1097
|
+
try {
|
|
1098
|
+
return processTokens((0, import_parser.parse)(message), mapText);
|
|
1099
|
+
} catch (e) {
|
|
1100
|
+
console.error(`${e.message}
|
|
1101
|
+
|
|
1102
|
+
Message: ${message}`);
|
|
1103
|
+
return message;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
|
|
1108
|
+
var isString = (s) => typeof s === "string";
|
|
1109
|
+
var isFunction = (f) => typeof f === "function";
|
|
1110
|
+
var cache = /* @__PURE__ */ new Map();
|
|
1111
|
+
var defaultLocale = "en";
|
|
1112
|
+
function normalizeLocales(locales) {
|
|
1113
|
+
const out = Array.isArray(locales) ? locales : [locales];
|
|
1114
|
+
return [...out, defaultLocale];
|
|
1115
|
+
}
|
|
1116
|
+
function date(locales, value, format) {
|
|
1117
|
+
const _locales = normalizeLocales(locales);
|
|
1118
|
+
const formatter = getMemoized(
|
|
1119
|
+
() => cacheKey("date", _locales, format),
|
|
1120
|
+
() => new Intl.DateTimeFormat(_locales, format)
|
|
1121
|
+
);
|
|
1122
|
+
return formatter.format(isString(value) ? new Date(value) : value);
|
|
1123
|
+
}
|
|
1124
|
+
function number(locales, value, format) {
|
|
1125
|
+
const _locales = normalizeLocales(locales);
|
|
1126
|
+
const formatter = getMemoized(
|
|
1127
|
+
() => cacheKey("number", _locales, format),
|
|
1128
|
+
() => new Intl.NumberFormat(_locales, format)
|
|
1129
|
+
);
|
|
1130
|
+
return formatter.format(value);
|
|
1131
|
+
}
|
|
1132
|
+
function plural(locales, ordinal, value, _a) {
|
|
1133
|
+
var _b = _a, { offset = 0 } = _b, rules = __objRest(_b, ["offset"]);
|
|
1134
|
+
var _a2, _b2;
|
|
1135
|
+
const _locales = normalizeLocales(locales);
|
|
1136
|
+
const plurals = ordinal ? getMemoized(
|
|
1137
|
+
() => cacheKey("plural-ordinal", _locales),
|
|
1138
|
+
() => new Intl.PluralRules(_locales, { type: "ordinal" })
|
|
1139
|
+
) : getMemoized(
|
|
1140
|
+
() => cacheKey("plural-cardinal", _locales),
|
|
1141
|
+
() => new Intl.PluralRules(_locales, { type: "cardinal" })
|
|
1142
|
+
);
|
|
1143
|
+
return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset)]) != null ? _b2 : rules.other;
|
|
1144
|
+
}
|
|
1145
|
+
function getMemoized(getKey, construct) {
|
|
1146
|
+
const key = getKey();
|
|
1147
|
+
let formatter = cache.get(key);
|
|
1148
|
+
if (!formatter) {
|
|
1149
|
+
formatter = construct();
|
|
1150
|
+
cache.set(key, formatter);
|
|
1151
|
+
}
|
|
1152
|
+
return formatter;
|
|
1153
|
+
}
|
|
1154
|
+
function cacheKey(type, locales, options) {
|
|
1155
|
+
const localeKey = locales.join("-");
|
|
1156
|
+
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1157
|
+
}
|
|
1158
|
+
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
|
|
1159
|
+
var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
|
|
1160
|
+
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1161
|
+
const locales = passedLocales || locale;
|
|
1162
|
+
const style = (format) => {
|
|
1163
|
+
return typeof format === "object" ? format : formats[format] || { style: format };
|
|
1164
|
+
};
|
|
1165
|
+
const replaceOctothorpe = (value, message) => {
|
|
1166
|
+
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
1167
|
+
const valueStr = number(locales, value, numberFormat);
|
|
1168
|
+
return message.replace(new RegExp(OCTOTHORPE_PH, "g"), valueStr);
|
|
1169
|
+
};
|
|
1170
|
+
return {
|
|
1171
|
+
plural: (value, cases) => {
|
|
1172
|
+
const { offset = 0 } = cases;
|
|
1173
|
+
const message = plural(locales, false, value, cases);
|
|
1174
|
+
return replaceOctothorpe(value - offset, message);
|
|
1175
|
+
},
|
|
1176
|
+
selectordinal: (value, cases) => {
|
|
1177
|
+
const { offset = 0 } = cases;
|
|
1178
|
+
const message = plural(locales, true, value, cases);
|
|
1179
|
+
return replaceOctothorpe(value - offset, message);
|
|
1180
|
+
},
|
|
1181
|
+
select: selectFormatter,
|
|
1182
|
+
number: (value, format) => number(locales, value, style(format)),
|
|
1183
|
+
date: (value, format) => date(locales, value, style(format))
|
|
1184
|
+
};
|
|
1097
1185
|
};
|
|
1098
|
-
var
|
|
1099
|
-
var
|
|
1100
|
-
|
|
1101
|
-
secondary: "s-text-link s-border s-bg hover:s-bg-hover hover:s-border-hover active:s-bg-active",
|
|
1102
|
-
utility: "s-text s-bg hover:s-bg-hover active:s-bg-active s-border hover:s-border-hover active:s-border-active",
|
|
1103
|
-
destructive: "s-bg-negative s-text-inverted hover:s-bg-negative-hover active:s-bg-negative-active",
|
|
1104
|
-
pill: "s-icon hover:s-icon-hover active:s-icon-active bg-transparent hover:bg-[--w-color-button-pill-background-hover] active:bg-[--w-color-button-pill-background-active]",
|
|
1105
|
-
disabled: "s-text-inverted s-bg-disabled",
|
|
1106
|
-
quiet: "bg-transparent s-text-link hover:s-bg-hover active:s-bg-active",
|
|
1107
|
-
utilityQuiet: "s-text bg-transparent hover:s-bg-hover active:s-bg-active",
|
|
1108
|
-
negativeQuiet: "bg-transparent s-text-negative hover:s-bg-negative-subtle-hover active:s-bg-negative-subtle-active",
|
|
1109
|
-
loading: "s-text s-bg-subtle",
|
|
1110
|
-
link: "s-text-link"
|
|
1186
|
+
var selectFormatter = (value, rules) => {
|
|
1187
|
+
var _a;
|
|
1188
|
+
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1111
1189
|
};
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1190
|
+
function interpolate(translation, locale, locales) {
|
|
1191
|
+
return (values = {}, formats) => {
|
|
1192
|
+
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1193
|
+
const formatMessage = (tokens) => {
|
|
1194
|
+
if (!Array.isArray(tokens))
|
|
1195
|
+
return tokens;
|
|
1196
|
+
return tokens.reduce((message, token) => {
|
|
1197
|
+
if (token === "#") {
|
|
1198
|
+
return message + OCTOTHORPE_PH;
|
|
1199
|
+
}
|
|
1200
|
+
if (isString(token)) {
|
|
1201
|
+
return message + token;
|
|
1202
|
+
}
|
|
1203
|
+
const [name, type, format] = token;
|
|
1204
|
+
let interpolatedFormat = {};
|
|
1205
|
+
if (type === "plural" || type === "selectordinal" || type === "select") {
|
|
1206
|
+
Object.entries(format).forEach(
|
|
1207
|
+
([key, value2]) => {
|
|
1208
|
+
interpolatedFormat[key] = formatMessage(value2);
|
|
1209
|
+
}
|
|
1210
|
+
);
|
|
1211
|
+
} else {
|
|
1212
|
+
interpolatedFormat = format;
|
|
1213
|
+
}
|
|
1214
|
+
let value;
|
|
1215
|
+
if (type) {
|
|
1216
|
+
const formatter = formatters[type];
|
|
1217
|
+
value = formatter(values[name], interpolatedFormat);
|
|
1218
|
+
} else {
|
|
1219
|
+
value = values[name];
|
|
1220
|
+
}
|
|
1221
|
+
if (value == null) {
|
|
1222
|
+
return message;
|
|
1223
|
+
}
|
|
1224
|
+
return message + value;
|
|
1225
|
+
}, "");
|
|
1226
|
+
};
|
|
1227
|
+
const result = formatMessage(translation);
|
|
1228
|
+
if (isString(result) && UNICODE_REGEX.test(result)) {
|
|
1229
|
+
return (0, import_unraw.unraw)(result.trim());
|
|
1230
|
+
}
|
|
1231
|
+
if (isString(result))
|
|
1232
|
+
return result.trim();
|
|
1233
|
+
return result ? String(result) : "";
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
var __defProp$1 = Object.defineProperty;
|
|
1237
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1238
|
+
var __publicField$1 = (obj, key, value) => {
|
|
1239
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1240
|
+
return value;
|
|
1119
1241
|
};
|
|
1120
|
-
var
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1242
|
+
var EventEmitter = class {
|
|
1243
|
+
constructor() {
|
|
1244
|
+
__publicField$1(this, "_events", {});
|
|
1245
|
+
}
|
|
1246
|
+
on(event, listener) {
|
|
1247
|
+
var _a2;
|
|
1248
|
+
var _a;
|
|
1249
|
+
(_a2 = (_a = this._events)[event]) != null ? _a2 : _a[event] = [];
|
|
1250
|
+
this._events[event].push(listener);
|
|
1251
|
+
return () => this.removeListener(event, listener);
|
|
1252
|
+
}
|
|
1253
|
+
removeListener(event, listener) {
|
|
1254
|
+
const maybeListeners = this._getListeners(event);
|
|
1255
|
+
if (!maybeListeners)
|
|
1256
|
+
return;
|
|
1257
|
+
const index = maybeListeners.indexOf(listener);
|
|
1258
|
+
if (~index)
|
|
1259
|
+
maybeListeners.splice(index, 1);
|
|
1260
|
+
}
|
|
1261
|
+
emit(event, ...args) {
|
|
1262
|
+
const maybeListeners = this._getListeners(event);
|
|
1263
|
+
if (!maybeListeners)
|
|
1264
|
+
return;
|
|
1265
|
+
maybeListeners.map((listener) => listener.apply(this, args));
|
|
1266
|
+
}
|
|
1267
|
+
_getListeners(event) {
|
|
1268
|
+
const maybeListeners = this._events[event];
|
|
1269
|
+
return Array.isArray(maybeListeners) ? maybeListeners : false;
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
var __defProp2 = Object.defineProperty;
|
|
1273
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1274
|
+
var __publicField2 = (obj, key, value) => {
|
|
1275
|
+
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1276
|
+
return value;
|
|
1277
|
+
};
|
|
1278
|
+
var I18n = class extends EventEmitter {
|
|
1279
|
+
constructor(params) {
|
|
1280
|
+
var _a;
|
|
1281
|
+
super();
|
|
1282
|
+
__publicField2(this, "_locale", "");
|
|
1283
|
+
__publicField2(this, "_locales");
|
|
1284
|
+
__publicField2(this, "_localeData", {});
|
|
1285
|
+
__publicField2(this, "_messages", {});
|
|
1286
|
+
__publicField2(this, "_missing");
|
|
1287
|
+
__publicField2(this, "t", this._.bind(this));
|
|
1288
|
+
if (params.missing != null)
|
|
1289
|
+
this._missing = params.missing;
|
|
1290
|
+
if (params.messages != null)
|
|
1291
|
+
this.load(params.messages);
|
|
1292
|
+
if (params.localeData != null)
|
|
1293
|
+
this.loadLocaleData(params.localeData);
|
|
1294
|
+
if (typeof params.locale === "string" || params.locales) {
|
|
1295
|
+
this.activate((_a = params.locale) != null ? _a : defaultLocale, params.locales);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
get locale() {
|
|
1299
|
+
return this._locale;
|
|
1300
|
+
}
|
|
1301
|
+
get locales() {
|
|
1302
|
+
return this._locales;
|
|
1303
|
+
}
|
|
1304
|
+
get messages() {
|
|
1305
|
+
var _a;
|
|
1306
|
+
return (_a = this._messages[this._locale]) != null ? _a : {};
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* @deprecated this has no effect. Please remove this from the code. Deprecated in v4
|
|
1310
|
+
*/
|
|
1311
|
+
get localeData() {
|
|
1312
|
+
var _a;
|
|
1313
|
+
return (_a = this._localeData[this._locale]) != null ? _a : {};
|
|
1314
|
+
}
|
|
1315
|
+
_loadLocaleData(locale, localeData) {
|
|
1316
|
+
const maybeLocaleData = this._localeData[locale];
|
|
1317
|
+
if (!maybeLocaleData) {
|
|
1318
|
+
this._localeData[locale] = localeData;
|
|
1319
|
+
} else {
|
|
1320
|
+
Object.assign(maybeLocaleData, localeData);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1325
|
+
*/
|
|
1326
|
+
// @ts-ignore deprecated, so ignore the reported error
|
|
1327
|
+
loadLocaleData(localeOrAllData, localeData) {
|
|
1328
|
+
if (localeData != null) {
|
|
1329
|
+
this._loadLocaleData(localeOrAllData, localeData);
|
|
1330
|
+
} else {
|
|
1331
|
+
Object.keys(localeOrAllData).forEach(
|
|
1332
|
+
(locale) => this._loadLocaleData(locale, localeOrAllData[locale])
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1335
|
+
this.emit("change");
|
|
1336
|
+
}
|
|
1337
|
+
_load(locale, messages5) {
|
|
1338
|
+
const maybeMessages = this._messages[locale];
|
|
1339
|
+
if (!maybeMessages) {
|
|
1340
|
+
this._messages[locale] = messages5;
|
|
1341
|
+
} else {
|
|
1342
|
+
Object.assign(maybeMessages, messages5);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
load(localeOrMessages, messages5) {
|
|
1346
|
+
if (typeof localeOrMessages == "string" && typeof messages5 === "object") {
|
|
1347
|
+
this._load(localeOrMessages, messages5);
|
|
1348
|
+
} else {
|
|
1349
|
+
Object.entries(localeOrMessages).forEach(
|
|
1350
|
+
([locale, messages23]) => this._load(locale, messages23)
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
this.emit("change");
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* @param options {@link LoadAndActivateOptions}
|
|
1357
|
+
*/
|
|
1358
|
+
loadAndActivate({ locale, locales, messages: messages5 }) {
|
|
1359
|
+
this._locale = locale;
|
|
1360
|
+
this._locales = locales || void 0;
|
|
1361
|
+
this._messages[this._locale] = messages5;
|
|
1362
|
+
this.emit("change");
|
|
1363
|
+
}
|
|
1364
|
+
activate(locale, locales) {
|
|
1365
|
+
if (true) {
|
|
1366
|
+
if (!this._messages[locale]) {
|
|
1367
|
+
console.warn(`Messages for locale "${locale}" not loaded.`);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
this._locale = locale;
|
|
1371
|
+
this._locales = locales;
|
|
1372
|
+
this.emit("change");
|
|
1373
|
+
}
|
|
1374
|
+
_(id, values, options) {
|
|
1375
|
+
let message = options == null ? void 0 : options.message;
|
|
1376
|
+
if (!isString(id)) {
|
|
1377
|
+
values = id.values || values;
|
|
1378
|
+
message = id.message;
|
|
1379
|
+
id = id.id;
|
|
1380
|
+
}
|
|
1381
|
+
const messageForId = this.messages[id];
|
|
1382
|
+
const messageMissing = messageForId === void 0;
|
|
1383
|
+
const missing = this._missing;
|
|
1384
|
+
if (missing && messageMissing) {
|
|
1385
|
+
return isFunction(missing) ? missing(this._locale, id) : missing;
|
|
1386
|
+
}
|
|
1387
|
+
if (messageMissing) {
|
|
1388
|
+
this.emit("missing", { id, locale: this._locale });
|
|
1389
|
+
}
|
|
1390
|
+
let translation = messageForId || message || id;
|
|
1391
|
+
if (true) {
|
|
1392
|
+
translation = isString(translation) ? compileMessage(translation) : translation;
|
|
1393
|
+
}
|
|
1394
|
+
if (isString(translation) && UNICODE_REGEX.test(translation))
|
|
1395
|
+
return JSON.parse(`"${translation}"`);
|
|
1396
|
+
if (isString(translation))
|
|
1397
|
+
return translation;
|
|
1398
|
+
return interpolate(
|
|
1399
|
+
translation,
|
|
1400
|
+
this._locale,
|
|
1401
|
+
this._locales
|
|
1402
|
+
)(values, options == null ? void 0 : options.formats);
|
|
1403
|
+
}
|
|
1404
|
+
date(value, format) {
|
|
1405
|
+
return date(this._locales || this._locale, value, format);
|
|
1406
|
+
}
|
|
1407
|
+
number(value, format) {
|
|
1408
|
+
return number(this._locales || this._locale, value, format);
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
function setupI18n(params = {}) {
|
|
1412
|
+
return new I18n(params);
|
|
1413
|
+
}
|
|
1414
|
+
var i18n = setupI18n();
|
|
1415
|
+
|
|
1416
|
+
// node_modules/.pnpm/@warp-ds+css@1.9.7/node_modules/@warp-ds/css/component-classes/index.js
|
|
1417
|
+
var box = {
|
|
1418
|
+
box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
|
|
1419
|
+
// Relative here enables w-clickable
|
|
1420
|
+
bleed: "-mx-16 sm:mx-0 rounded-l-0 rounded-r-0 sm:rounded-8",
|
|
1421
|
+
// We target L and R to override the default rounded-8
|
|
1422
|
+
info: "s-bg-info-subtle",
|
|
1423
|
+
neutral: "s-surface-sunken",
|
|
1424
|
+
bordered: "border-2 s-border s-bg",
|
|
1425
|
+
infoClickable: "hover:s-bg-info-subtle-hover active:s-bg-info-subtle-active",
|
|
1426
|
+
// Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
|
|
1427
|
+
neutralClickable: "hover:s-bg-hover active:s-bg-active",
|
|
1428
|
+
// Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
|
|
1429
|
+
borderedClickable: "hover:s-bg-hover active:s-bg-active hover:s-border-hover active:s-border-active"
|
|
1430
|
+
// Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
|
|
1431
|
+
};
|
|
1432
|
+
var buttonReset = "focus:outline-none appearance-none cursor-pointer bg-transparent border-0 m-0 p-0 inline-block";
|
|
1433
|
+
var expandable = {
|
|
1434
|
+
expandable: "will-change-height",
|
|
1435
|
+
expandableTitle: "font-bold s-text",
|
|
1436
|
+
expandableBox: "s-surface-sunken hover:s-bg-hover active:s-bg-active py-0 px-0 " + box.box,
|
|
1437
|
+
expandableInfo: "s-bg-info-subtle! hover:s-bg-info-subtle-hover!",
|
|
1438
|
+
expandableBleed: box.bleed,
|
|
1439
|
+
chevron: "inline-block align-middle s-icon",
|
|
1440
|
+
chevronNonBox: "ml-8",
|
|
1441
|
+
chevronBox: "",
|
|
1442
|
+
chevronTransform: "transform transition-transform transform-gpu ease-in-out",
|
|
1443
|
+
chevronExpand: "-rotate-180",
|
|
1444
|
+
chevronCollapse: "rotate-180",
|
|
1445
|
+
elementsTransformChevronDownPart: "part-[w-icon-chevron-down-16-part]:transform part-[w-icon-chevron-down-16-part]:transition-transform part-[w-icon-chevron-down-16-part]:transform-gpu part-[w-icon-chevron-down-16-part]:ease-in-out",
|
|
1446
|
+
elementsChevronDownExpandPart: "part-[w-icon-chevron-down-16-part]:-rotate-180",
|
|
1447
|
+
elementsTransformChevronUpPart: "part-[w-icon-chevron-up-16-part]:transform part-[w-icon-chevron-up-16-part]:transition-transform part-[w-icon-chevron-up-16-part]:transform-gpu part-[w-icon-chevron-up-16-part]:ease-in-out",
|
|
1448
|
+
elementsChevronUpCollapsePart: "part-[w-icon-chevron-up-16-part]:rotate-180",
|
|
1449
|
+
expansion: "overflow-hidden",
|
|
1450
|
+
expansionNotExpanded: "h-0 invisible",
|
|
1451
|
+
button: buttonReset + " hover:underline focus-visible:underline",
|
|
1452
|
+
buttonBox: "w-full text-left relative inline-flex items-center justify-between " + box.box,
|
|
1453
|
+
paddingTop: "pt-0",
|
|
1454
|
+
title: "flex w-full justify-between items-center",
|
|
1455
|
+
titleType: "h4"
|
|
1456
|
+
};
|
|
1457
|
+
var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
|
|
1458
|
+
var buttonColors = {
|
|
1459
|
+
primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
|
|
1460
|
+
secondary: "s-text-link s-border s-bg hover:s-bg-hover hover:s-border-hover active:s-bg-active",
|
|
1461
|
+
utility: "s-text s-bg hover:s-bg-hover active:s-bg-active s-border hover:s-border-hover active:s-border-active",
|
|
1462
|
+
destructive: "s-bg-negative s-text-inverted hover:s-bg-negative-hover active:s-bg-negative-active",
|
|
1463
|
+
pill: "s-icon hover:s-icon-hover active:s-icon-active bg-transparent hover:bg-[--w-color-button-pill-background-hover] active:bg-[--w-color-button-pill-background-active]",
|
|
1464
|
+
disabled: "s-text-inverted s-bg-disabled",
|
|
1465
|
+
quiet: "bg-transparent s-text-link hover:s-bg-hover active:s-bg-active",
|
|
1466
|
+
utilityQuiet: "s-text bg-transparent hover:s-bg-hover active:s-bg-active",
|
|
1467
|
+
negativeQuiet: "bg-transparent s-text-negative hover:s-bg-negative-subtle-hover active:s-bg-negative-subtle-active",
|
|
1468
|
+
loading: "s-text s-bg-subtle",
|
|
1469
|
+
link: "s-text-link"
|
|
1470
|
+
};
|
|
1471
|
+
var buttonTypes = {
|
|
1472
|
+
primary: `border-0 rounded-8 ${buttonDefaultStyling}`,
|
|
1473
|
+
secondary: `border-2 rounded-8 ${buttonDefaultStyling}`,
|
|
1474
|
+
utility: `border rounded-4 ${buttonDefaultStyling}`,
|
|
1475
|
+
negative: `border-0 rounded-8 ${buttonDefaultStyling}`,
|
|
1476
|
+
pill: `p-4 rounded-full border-0 inline-flex items-center justify-center hover:bg-clip-padding ${buttonDefaultStyling}`,
|
|
1477
|
+
link: `bg-transparent focusable ease-in-out inline active:underline hover:underline focus:underline ${buttonColors.link}`
|
|
1478
|
+
};
|
|
1479
|
+
var buttonSizes = {
|
|
1480
|
+
xsmall: "py-6 px-16",
|
|
1481
|
+
small: "py-8 px-16",
|
|
1482
|
+
medium: "py-10 px-14",
|
|
1483
|
+
large: "py-12 px-16",
|
|
1484
|
+
utility: "py-[11px] px-[15px]",
|
|
1485
|
+
smallUtility: "py-[7px] px-[15px]",
|
|
1486
|
+
pill: "min-h-[44px] min-w-[44px]",
|
|
1487
|
+
pillSmall: "min-h-32 min-w-32",
|
|
1129
1488
|
link: "p-0"
|
|
1130
1489
|
};
|
|
1131
1490
|
var buttonTextSizes = {
|
|
@@ -1299,452 +1658,67 @@ var toggle = {
|
|
|
1299
1658
|
indeterminateInvalid: 'before:content-["\u2013"] before:rounded-2 before:leading-xs before:text-center before:font-bold before:s-icon-inverted peer-indeterminate:before:s-border-negative peer-indeterminate:before:s-bg-negative peer-indeterminate:hover:before:s-border-negative-hover peer-indeterminate:hover:before:s-bg-negative-hover',
|
|
1300
1659
|
// isCheckbox && isIndeterminate && isInvalid && !isDisabled
|
|
1301
1660
|
indeterminateDisabled: 'before:content-["\u2013"] before:rounded-2 before:leading-xs before:text-center before:font-bold pointer-events-none before:s-icon-inverted peer-indeterminate:before:s-border-disabled peer-indeterminate:before:s-bg-disabled',
|
|
1302
|
-
// isCheckbox && isIndeterminate && !isInvalid && isDisabled
|
|
1303
|
-
radio: "before:s-bg before:rounded-full peer-checked:before:border-[6] peer-checked:before:s-border-selected peer-checked:peer-hover:before:s-border-selected-hover peer-hover:before:s-border-primary peer-hover:before:s-bg-hover",
|
|
1304
|
-
// isRadio && !isDisabled && !isInvalid
|
|
1305
|
-
radioInvalid: "before:s-bg before:s-border-negative before:rounded-full peer-checked:before:border-[6] peer-hover:before:s-bg-negative-subtle peer-hover:before:s-border-negative-hover peer-checked:before:s-border-negative peer-checked:peer-hover:before:s-border-negative-hover",
|
|
1306
|
-
// isRadio && isInvalid && !isDisabled
|
|
1307
|
-
radioDisabled: "before:s-bg-disabled-subtle before:s-border-disabled pointer-events-none before:rounded-full peer-checked:before:border-[6]",
|
|
1308
|
-
// isRadio && !isInvalid && isDisabled
|
|
1309
|
-
radioButtonsLabel: "peer-hover:peer-not-checked:s-bg-hover peer-checked:s-text-inverted peer-checked:s-bg-primary peer-checked:s-border-primary block relative font-bold cursor-pointer s-text-link text-center s-bg border-2 s-border group-first-of-type:rounded-tl-8 group-first-of-type:rounded-bl-8 group-last-of-type:rounded-tr-8 group-last-of-type:rounded-br-8 group-not-last-of-type:border-r-0 peer-checked:z-10 group-not-first:-ml-2",
|
|
1310
|
-
// isRadioButtons
|
|
1311
|
-
radioButtonsRegular: "text-s py-8 pl-12 pr-14",
|
|
1312
|
-
// isRadioButtons && !isSmall
|
|
1313
|
-
radioButtonsSmall: "text-xs py-[5px] px-[8px]"
|
|
1314
|
-
// isRadioButtons && isSmall
|
|
1315
|
-
};
|
|
1316
|
-
var deadToggle = {
|
|
1317
|
-
wrapper: `${toggle.wrapper} h-20 w-20 pointer-events-none`,
|
|
1318
|
-
input: `${toggle.input} hidden`,
|
|
1319
|
-
inputVue: "hidden",
|
|
1320
|
-
labelRadio: `${toggle.label} ${toggle.labelBefore} ${toggle.radio}`,
|
|
1321
|
-
labelCheckbox: `${toggle.label} ${toggle.labelBefore} ${toggle.checkbox}`,
|
|
1322
|
-
labelVue: "-mt-2"
|
|
1323
|
-
};
|
|
1324
|
-
var clickable = {
|
|
1325
|
-
toggle: "absolute inset-0 h-full w-full appearance-none cursor-pointer focusable focusable-inset",
|
|
1326
|
-
label: `px-12 ${label.label} py-8! cursor-pointer focusable focusable-inset`,
|
|
1327
|
-
buttonOrLink: "bg-transparent focusable",
|
|
1328
|
-
buttonOrLinkStretch: "inset-0 absolute"
|
|
1329
|
-
};
|
|
1330
|
-
var attention = {
|
|
1331
|
-
base: "border-2 relative flex items-start",
|
|
1332
|
-
tooltip: "s-bg-inverted border-[--w-s-color-background-inverted] shadow-m s-text-inverted-static rounded-4 py-6 px-8",
|
|
1333
|
-
callout: "bg-[--w-color-callout-background] border-[--w-color-callout-border] s-text py-8 px-16 rounded-8",
|
|
1334
|
-
highlight: "bg-[--w-color-callout-background] border-[--w-color-callout-border] s-text py-8 px-16 rounded-8 drop-shadow-m translate-z-0",
|
|
1335
|
-
popover: "bg-[--w-s-color-surface-elevated-300] border-[--w-s-color-surface-elevated-300] s-text rounded-8 p-16 drop-shadow-m translate-z-0",
|
|
1336
|
-
arrowBase: "absolute h-[14px] w-[14px] border-2 border-b-0 border-r-0 rounded-tl-4 transform",
|
|
1337
|
-
arrowDirectionLeftStart: "-left-[8px]",
|
|
1338
|
-
arrowDirectionLeft: "-left-[8px]",
|
|
1339
|
-
arrowDirectionLeftEnd: "-left-[8px]",
|
|
1340
|
-
arrowDirectionRightStart: "-right-[8px]",
|
|
1341
|
-
arrowDirectionRight: "-right-[8px]",
|
|
1342
|
-
arrowDirectionRightEnd: "-right-[8px]",
|
|
1343
|
-
arrowDirectionBottomStart: "-bottom-[8px]",
|
|
1344
|
-
arrowDirectionBottom: "-bottom-[8px]",
|
|
1345
|
-
arrowDirectionBottomEnd: "-bottom-[8px]",
|
|
1346
|
-
arrowDirectionTopStart: "-top-[8px]",
|
|
1347
|
-
arrowDirectionTop: "-top-[8px]",
|
|
1348
|
-
arrowDirectionTopEnd: "-top-[8px]",
|
|
1349
|
-
arrowTooltip: "s-bg-inverted border-[--w-s-color-background-inverted]",
|
|
1350
|
-
arrowCallout: "bg-[--w-color-callout-background] border-[--w-color-callout-border]",
|
|
1351
|
-
arrowPopover: "bg-[--w-s-color-surface-elevated-300] border-[--w-s-color-surface-elevated-300]",
|
|
1352
|
-
arrowHighlight: "bg-[--w-color-callout-background] border-[--w-color-callout-border]",
|
|
1353
|
-
content: "last-child:mb-0",
|
|
1354
|
-
notCallout: "absolute z-50",
|
|
1355
|
-
closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
|
|
1356
|
-
};
|
|
1357
|
-
|
|
1358
|
-
// packages/utils/index.js
|
|
1359
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
1360
|
-
var camelCaseToKebabCase = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1361
|
-
function kebabCaseAttributes(constructor) {
|
|
1362
|
-
return class extends constructor {
|
|
1363
|
-
static createProperty(name, options) {
|
|
1364
|
-
let customOptions = options;
|
|
1365
|
-
if (typeof (options == null ? void 0 : options.attribute) === "undefined" || (options == null ? void 0 : options.attribute) === true) {
|
|
1366
|
-
customOptions = Object.assign({}, options, {
|
|
1367
|
-
attribute: camelCaseToKebabCase(name.toString())
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
super.createProperty(name, customOptions);
|
|
1371
|
-
}
|
|
1372
|
-
};
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
// packages/select/index.js
|
|
1376
|
-
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
1377
|
-
|
|
1378
|
-
// node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
|
|
1379
|
-
var import_unraw = __toESM(require_dist(), 1);
|
|
1380
|
-
|
|
1381
|
-
// node_modules/.pnpm/@lingui+message-utils@4.7.1/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1382
|
-
var import_parser = __toESM(require_parser(), 1);
|
|
1383
|
-
function processTokens(tokens, mapText) {
|
|
1384
|
-
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
1385
|
-
return tokens.map((token) => mapText(token.value)).join("");
|
|
1386
|
-
}
|
|
1387
|
-
return tokens.map((token) => {
|
|
1388
|
-
var _a;
|
|
1389
|
-
if (token.type === "content") {
|
|
1390
|
-
return mapText(token.value);
|
|
1391
|
-
} else if (token.type === "octothorpe") {
|
|
1392
|
-
return "#";
|
|
1393
|
-
} else if (token.type === "argument") {
|
|
1394
|
-
return [token.arg];
|
|
1395
|
-
} else if (token.type === "function") {
|
|
1396
|
-
const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
|
|
1397
|
-
if (_param) {
|
|
1398
|
-
return [token.arg, token.key, _param.value.trim()];
|
|
1399
|
-
} else {
|
|
1400
|
-
return [token.arg, token.key];
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
const offset = token.pluralOffset;
|
|
1404
|
-
const formatProps = {};
|
|
1405
|
-
token.cases.forEach((item) => {
|
|
1406
|
-
formatProps[item.key.replace(/^=(.)+/, "$1")] = processTokens(
|
|
1407
|
-
item.tokens,
|
|
1408
|
-
mapText
|
|
1409
|
-
);
|
|
1410
|
-
});
|
|
1411
|
-
return [
|
|
1412
|
-
token.arg,
|
|
1413
|
-
token.type,
|
|
1414
|
-
__spreadValues({
|
|
1415
|
-
offset
|
|
1416
|
-
}, formatProps)
|
|
1417
|
-
];
|
|
1418
|
-
});
|
|
1419
|
-
}
|
|
1420
|
-
function compileMessage(message, mapText = (v) => v) {
|
|
1421
|
-
try {
|
|
1422
|
-
return processTokens((0, import_parser.parse)(message), mapText);
|
|
1423
|
-
} catch (e) {
|
|
1424
|
-
console.error(`${e.message}
|
|
1425
|
-
|
|
1426
|
-
Message: ${message}`);
|
|
1427
|
-
return message;
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
// node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
|
|
1432
|
-
var isString = (s) => typeof s === "string";
|
|
1433
|
-
var isFunction = (f) => typeof f === "function";
|
|
1434
|
-
var cache = /* @__PURE__ */ new Map();
|
|
1435
|
-
var defaultLocale = "en";
|
|
1436
|
-
function normalizeLocales(locales) {
|
|
1437
|
-
const out = Array.isArray(locales) ? locales : [locales];
|
|
1438
|
-
return [...out, defaultLocale];
|
|
1439
|
-
}
|
|
1440
|
-
function date(locales, value, format) {
|
|
1441
|
-
const _locales = normalizeLocales(locales);
|
|
1442
|
-
const formatter = getMemoized(
|
|
1443
|
-
() => cacheKey("date", _locales, format),
|
|
1444
|
-
() => new Intl.DateTimeFormat(_locales, format)
|
|
1445
|
-
);
|
|
1446
|
-
return formatter.format(isString(value) ? new Date(value) : value);
|
|
1447
|
-
}
|
|
1448
|
-
function number(locales, value, format) {
|
|
1449
|
-
const _locales = normalizeLocales(locales);
|
|
1450
|
-
const formatter = getMemoized(
|
|
1451
|
-
() => cacheKey("number", _locales, format),
|
|
1452
|
-
() => new Intl.NumberFormat(_locales, format)
|
|
1453
|
-
);
|
|
1454
|
-
return formatter.format(value);
|
|
1455
|
-
}
|
|
1456
|
-
function plural(locales, ordinal, value, _a) {
|
|
1457
|
-
var _b = _a, { offset = 0 } = _b, rules = __objRest(_b, ["offset"]);
|
|
1458
|
-
var _a2, _b2;
|
|
1459
|
-
const _locales = normalizeLocales(locales);
|
|
1460
|
-
const plurals = ordinal ? getMemoized(
|
|
1461
|
-
() => cacheKey("plural-ordinal", _locales),
|
|
1462
|
-
() => new Intl.PluralRules(_locales, { type: "ordinal" })
|
|
1463
|
-
) : getMemoized(
|
|
1464
|
-
() => cacheKey("plural-cardinal", _locales),
|
|
1465
|
-
() => new Intl.PluralRules(_locales, { type: "cardinal" })
|
|
1466
|
-
);
|
|
1467
|
-
return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset)]) != null ? _b2 : rules.other;
|
|
1468
|
-
}
|
|
1469
|
-
function getMemoized(getKey, construct) {
|
|
1470
|
-
const key = getKey();
|
|
1471
|
-
let formatter = cache.get(key);
|
|
1472
|
-
if (!formatter) {
|
|
1473
|
-
formatter = construct();
|
|
1474
|
-
cache.set(key, formatter);
|
|
1475
|
-
}
|
|
1476
|
-
return formatter;
|
|
1477
|
-
}
|
|
1478
|
-
function cacheKey(type, locales, options) {
|
|
1479
|
-
const localeKey = locales.join("-");
|
|
1480
|
-
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1481
|
-
}
|
|
1482
|
-
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
|
|
1483
|
-
var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
|
|
1484
|
-
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1485
|
-
const locales = passedLocales || locale;
|
|
1486
|
-
const style = (format) => {
|
|
1487
|
-
return typeof format === "object" ? format : formats[format] || { style: format };
|
|
1488
|
-
};
|
|
1489
|
-
const replaceOctothorpe = (value, message) => {
|
|
1490
|
-
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
1491
|
-
const valueStr = number(locales, value, numberFormat);
|
|
1492
|
-
return message.replace(new RegExp(OCTOTHORPE_PH, "g"), valueStr);
|
|
1493
|
-
};
|
|
1494
|
-
return {
|
|
1495
|
-
plural: (value, cases) => {
|
|
1496
|
-
const { offset = 0 } = cases;
|
|
1497
|
-
const message = plural(locales, false, value, cases);
|
|
1498
|
-
return replaceOctothorpe(value - offset, message);
|
|
1499
|
-
},
|
|
1500
|
-
selectordinal: (value, cases) => {
|
|
1501
|
-
const { offset = 0 } = cases;
|
|
1502
|
-
const message = plural(locales, true, value, cases);
|
|
1503
|
-
return replaceOctothorpe(value - offset, message);
|
|
1504
|
-
},
|
|
1505
|
-
select: selectFormatter,
|
|
1506
|
-
number: (value, format) => number(locales, value, style(format)),
|
|
1507
|
-
date: (value, format) => date(locales, value, style(format))
|
|
1508
|
-
};
|
|
1509
|
-
};
|
|
1510
|
-
var selectFormatter = (value, rules) => {
|
|
1511
|
-
var _a;
|
|
1512
|
-
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1513
|
-
};
|
|
1514
|
-
function interpolate(translation, locale, locales) {
|
|
1515
|
-
return (values = {}, formats) => {
|
|
1516
|
-
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1517
|
-
const formatMessage = (tokens) => {
|
|
1518
|
-
if (!Array.isArray(tokens))
|
|
1519
|
-
return tokens;
|
|
1520
|
-
return tokens.reduce((message, token) => {
|
|
1521
|
-
if (token === "#") {
|
|
1522
|
-
return message + OCTOTHORPE_PH;
|
|
1523
|
-
}
|
|
1524
|
-
if (isString(token)) {
|
|
1525
|
-
return message + token;
|
|
1526
|
-
}
|
|
1527
|
-
const [name, type, format] = token;
|
|
1528
|
-
let interpolatedFormat = {};
|
|
1529
|
-
if (type === "plural" || type === "selectordinal" || type === "select") {
|
|
1530
|
-
Object.entries(format).forEach(
|
|
1531
|
-
([key, value2]) => {
|
|
1532
|
-
interpolatedFormat[key] = formatMessage(value2);
|
|
1533
|
-
}
|
|
1534
|
-
);
|
|
1535
|
-
} else {
|
|
1536
|
-
interpolatedFormat = format;
|
|
1537
|
-
}
|
|
1538
|
-
let value;
|
|
1539
|
-
if (type) {
|
|
1540
|
-
const formatter = formatters[type];
|
|
1541
|
-
value = formatter(values[name], interpolatedFormat);
|
|
1542
|
-
} else {
|
|
1543
|
-
value = values[name];
|
|
1544
|
-
}
|
|
1545
|
-
if (value == null) {
|
|
1546
|
-
return message;
|
|
1547
|
-
}
|
|
1548
|
-
return message + value;
|
|
1549
|
-
}, "");
|
|
1550
|
-
};
|
|
1551
|
-
const result = formatMessage(translation);
|
|
1552
|
-
if (isString(result) && UNICODE_REGEX.test(result)) {
|
|
1553
|
-
return (0, import_unraw.unraw)(result.trim());
|
|
1554
|
-
}
|
|
1555
|
-
if (isString(result))
|
|
1556
|
-
return result.trim();
|
|
1557
|
-
return result ? String(result) : "";
|
|
1558
|
-
};
|
|
1559
|
-
}
|
|
1560
|
-
var __defProp$1 = Object.defineProperty;
|
|
1561
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1562
|
-
var __publicField$1 = (obj, key, value) => {
|
|
1563
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1564
|
-
return value;
|
|
1661
|
+
// isCheckbox && isIndeterminate && !isInvalid && isDisabled
|
|
1662
|
+
radio: "before:s-bg before:rounded-full peer-checked:before:border-[6] peer-checked:before:s-border-selected peer-checked:peer-hover:before:s-border-selected-hover peer-hover:before:s-border-primary peer-hover:before:s-bg-hover",
|
|
1663
|
+
// isRadio && !isDisabled && !isInvalid
|
|
1664
|
+
radioInvalid: "before:s-bg before:s-border-negative before:rounded-full peer-checked:before:border-[6] peer-hover:before:s-bg-negative-subtle peer-hover:before:s-border-negative-hover peer-checked:before:s-border-negative peer-checked:peer-hover:before:s-border-negative-hover",
|
|
1665
|
+
// isRadio && isInvalid && !isDisabled
|
|
1666
|
+
radioDisabled: "before:s-bg-disabled-subtle before:s-border-disabled pointer-events-none before:rounded-full peer-checked:before:border-[6]",
|
|
1667
|
+
// isRadio && !isInvalid && isDisabled
|
|
1668
|
+
radioButtonsLabel: "peer-hover:peer-not-checked:s-bg-hover peer-checked:s-text-inverted peer-checked:s-bg-primary peer-checked:s-border-primary block relative font-bold cursor-pointer s-text-link text-center s-bg border-2 s-border group-first-of-type:rounded-tl-8 group-first-of-type:rounded-bl-8 group-last-of-type:rounded-tr-8 group-last-of-type:rounded-br-8 group-not-last-of-type:border-r-0 peer-checked:z-10 group-not-first:-ml-2",
|
|
1669
|
+
// isRadioButtons
|
|
1670
|
+
radioButtonsRegular: "text-s py-8 pl-12 pr-14",
|
|
1671
|
+
// isRadioButtons && !isSmall
|
|
1672
|
+
radioButtonsSmall: "text-xs py-[5px] px-[8px]"
|
|
1673
|
+
// isRadioButtons && isSmall
|
|
1565
1674
|
};
|
|
1566
|
-
var
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
(_a2 = (_a = this._events)[event]) != null ? _a2 : _a[event] = [];
|
|
1574
|
-
this._events[event].push(listener);
|
|
1575
|
-
return () => this.removeListener(event, listener);
|
|
1576
|
-
}
|
|
1577
|
-
removeListener(event, listener) {
|
|
1578
|
-
const maybeListeners = this._getListeners(event);
|
|
1579
|
-
if (!maybeListeners)
|
|
1580
|
-
return;
|
|
1581
|
-
const index = maybeListeners.indexOf(listener);
|
|
1582
|
-
if (~index)
|
|
1583
|
-
maybeListeners.splice(index, 1);
|
|
1584
|
-
}
|
|
1585
|
-
emit(event, ...args) {
|
|
1586
|
-
const maybeListeners = this._getListeners(event);
|
|
1587
|
-
if (!maybeListeners)
|
|
1588
|
-
return;
|
|
1589
|
-
maybeListeners.map((listener) => listener.apply(this, args));
|
|
1590
|
-
}
|
|
1591
|
-
_getListeners(event) {
|
|
1592
|
-
const maybeListeners = this._events[event];
|
|
1593
|
-
return Array.isArray(maybeListeners) ? maybeListeners : false;
|
|
1594
|
-
}
|
|
1675
|
+
var deadToggle = {
|
|
1676
|
+
wrapper: `${toggle.wrapper} h-20 w-20 pointer-events-none`,
|
|
1677
|
+
input: `${toggle.input} hidden`,
|
|
1678
|
+
inputVue: "hidden",
|
|
1679
|
+
labelRadio: `${toggle.label} ${toggle.labelBefore} ${toggle.radio}`,
|
|
1680
|
+
labelCheckbox: `${toggle.label} ${toggle.labelBefore} ${toggle.checkbox}`,
|
|
1681
|
+
labelVue: "-mt-2"
|
|
1595
1682
|
};
|
|
1596
|
-
var
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1683
|
+
var clickable = {
|
|
1684
|
+
toggle: "absolute inset-0 h-full w-full appearance-none cursor-pointer focusable focusable-inset",
|
|
1685
|
+
label: `px-12 ${label.label} py-8! cursor-pointer focusable focusable-inset`,
|
|
1686
|
+
buttonOrLink: "bg-transparent focusable",
|
|
1687
|
+
buttonOrLinkStretch: "inset-0 absolute"
|
|
1601
1688
|
};
|
|
1602
|
-
var
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
}
|
|
1628
|
-
get messages() {
|
|
1629
|
-
var _a;
|
|
1630
|
-
return (_a = this._messages[this._locale]) != null ? _a : {};
|
|
1631
|
-
}
|
|
1632
|
-
/**
|
|
1633
|
-
* @deprecated this has no effect. Please remove this from the code. Deprecated in v4
|
|
1634
|
-
*/
|
|
1635
|
-
get localeData() {
|
|
1636
|
-
var _a;
|
|
1637
|
-
return (_a = this._localeData[this._locale]) != null ? _a : {};
|
|
1638
|
-
}
|
|
1639
|
-
_loadLocaleData(locale, localeData) {
|
|
1640
|
-
const maybeLocaleData = this._localeData[locale];
|
|
1641
|
-
if (!maybeLocaleData) {
|
|
1642
|
-
this._localeData[locale] = localeData;
|
|
1643
|
-
} else {
|
|
1644
|
-
Object.assign(maybeLocaleData, localeData);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
/**
|
|
1648
|
-
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1649
|
-
*/
|
|
1650
|
-
// @ts-ignore deprecated, so ignore the reported error
|
|
1651
|
-
loadLocaleData(localeOrAllData, localeData) {
|
|
1652
|
-
if (localeData != null) {
|
|
1653
|
-
this._loadLocaleData(localeOrAllData, localeData);
|
|
1654
|
-
} else {
|
|
1655
|
-
Object.keys(localeOrAllData).forEach(
|
|
1656
|
-
(locale) => this._loadLocaleData(locale, localeOrAllData[locale])
|
|
1657
|
-
);
|
|
1658
|
-
}
|
|
1659
|
-
this.emit("change");
|
|
1660
|
-
}
|
|
1661
|
-
_load(locale, messages5) {
|
|
1662
|
-
const maybeMessages = this._messages[locale];
|
|
1663
|
-
if (!maybeMessages) {
|
|
1664
|
-
this._messages[locale] = messages5;
|
|
1665
|
-
} else {
|
|
1666
|
-
Object.assign(maybeMessages, messages5);
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
load(localeOrMessages, messages5) {
|
|
1670
|
-
if (typeof localeOrMessages == "string" && typeof messages5 === "object") {
|
|
1671
|
-
this._load(localeOrMessages, messages5);
|
|
1672
|
-
} else {
|
|
1673
|
-
Object.entries(localeOrMessages).forEach(
|
|
1674
|
-
([locale, messages23]) => this._load(locale, messages23)
|
|
1675
|
-
);
|
|
1676
|
-
}
|
|
1677
|
-
this.emit("change");
|
|
1678
|
-
}
|
|
1679
|
-
/**
|
|
1680
|
-
* @param options {@link LoadAndActivateOptions}
|
|
1681
|
-
*/
|
|
1682
|
-
loadAndActivate({ locale, locales, messages: messages5 }) {
|
|
1683
|
-
this._locale = locale;
|
|
1684
|
-
this._locales = locales || void 0;
|
|
1685
|
-
this._messages[this._locale] = messages5;
|
|
1686
|
-
this.emit("change");
|
|
1687
|
-
}
|
|
1688
|
-
activate(locale, locales) {
|
|
1689
|
-
if (true) {
|
|
1690
|
-
if (!this._messages[locale]) {
|
|
1691
|
-
console.warn(`Messages for locale "${locale}" not loaded.`);
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
this._locale = locale;
|
|
1695
|
-
this._locales = locales;
|
|
1696
|
-
this.emit("change");
|
|
1697
|
-
}
|
|
1698
|
-
_(id, values, options) {
|
|
1699
|
-
let message = options == null ? void 0 : options.message;
|
|
1700
|
-
if (!isString(id)) {
|
|
1701
|
-
values = id.values || values;
|
|
1702
|
-
message = id.message;
|
|
1703
|
-
id = id.id;
|
|
1704
|
-
}
|
|
1705
|
-
const messageForId = this.messages[id];
|
|
1706
|
-
const messageMissing = messageForId === void 0;
|
|
1707
|
-
const missing = this._missing;
|
|
1708
|
-
if (missing && messageMissing) {
|
|
1709
|
-
return isFunction(missing) ? missing(this._locale, id) : missing;
|
|
1710
|
-
}
|
|
1711
|
-
if (messageMissing) {
|
|
1712
|
-
this.emit("missing", { id, locale: this._locale });
|
|
1713
|
-
}
|
|
1714
|
-
let translation = messageForId || message || id;
|
|
1715
|
-
if (true) {
|
|
1716
|
-
translation = isString(translation) ? compileMessage(translation) : translation;
|
|
1717
|
-
}
|
|
1718
|
-
if (isString(translation) && UNICODE_REGEX.test(translation))
|
|
1719
|
-
return JSON.parse(`"${translation}"`);
|
|
1720
|
-
if (isString(translation))
|
|
1721
|
-
return translation;
|
|
1722
|
-
return interpolate(
|
|
1723
|
-
translation,
|
|
1724
|
-
this._locale,
|
|
1725
|
-
this._locales
|
|
1726
|
-
)(values, options == null ? void 0 : options.formats);
|
|
1727
|
-
}
|
|
1728
|
-
date(value, format) {
|
|
1729
|
-
return date(this._locales || this._locale, value, format);
|
|
1730
|
-
}
|
|
1731
|
-
number(value, format) {
|
|
1732
|
-
return number(this._locales || this._locale, value, format);
|
|
1733
|
-
}
|
|
1689
|
+
var attention = {
|
|
1690
|
+
base: "border-2 relative flex items-start",
|
|
1691
|
+
tooltip: "s-bg-inverted border-[--w-s-color-background-inverted] shadow-m s-text-inverted-static rounded-4 py-6 px-8",
|
|
1692
|
+
callout: "bg-[--w-color-callout-background] border-[--w-color-callout-border] s-text py-8 px-16 rounded-8",
|
|
1693
|
+
highlight: "bg-[--w-color-callout-background] border-[--w-color-callout-border] s-text py-8 px-16 rounded-8 drop-shadow-m translate-z-0",
|
|
1694
|
+
popover: "bg-[--w-s-color-surface-elevated-300] border-[--w-s-color-surface-elevated-300] s-text rounded-8 p-16 drop-shadow-m translate-z-0",
|
|
1695
|
+
arrowBase: "absolute h-[14px] w-[14px] border-2 border-b-0 border-r-0 rounded-tl-4 transform",
|
|
1696
|
+
arrowDirectionLeftStart: "-left-[8px]",
|
|
1697
|
+
arrowDirectionLeft: "-left-[8px]",
|
|
1698
|
+
arrowDirectionLeftEnd: "-left-[8px]",
|
|
1699
|
+
arrowDirectionRightStart: "-right-[8px]",
|
|
1700
|
+
arrowDirectionRight: "-right-[8px]",
|
|
1701
|
+
arrowDirectionRightEnd: "-right-[8px]",
|
|
1702
|
+
arrowDirectionBottomStart: "-bottom-[8px]",
|
|
1703
|
+
arrowDirectionBottom: "-bottom-[8px]",
|
|
1704
|
+
arrowDirectionBottomEnd: "-bottom-[8px]",
|
|
1705
|
+
arrowDirectionTopStart: "-top-[8px]",
|
|
1706
|
+
arrowDirectionTop: "-top-[8px]",
|
|
1707
|
+
arrowDirectionTopEnd: "-top-[8px]",
|
|
1708
|
+
arrowTooltip: "s-bg-inverted border-[--w-s-color-background-inverted]",
|
|
1709
|
+
arrowCallout: "bg-[--w-color-callout-background] border-[--w-color-callout-border]",
|
|
1710
|
+
arrowPopover: "bg-[--w-s-color-surface-elevated-300] border-[--w-s-color-surface-elevated-300]",
|
|
1711
|
+
arrowHighlight: "bg-[--w-color-callout-background] border-[--w-color-callout-border]",
|
|
1712
|
+
content: "last-child:mb-0",
|
|
1713
|
+
notCallout: "absolute z-50",
|
|
1714
|
+
closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
|
|
1734
1715
|
};
|
|
1735
|
-
function setupI18n(params = {}) {
|
|
1736
|
-
return new I18n(params);
|
|
1737
|
-
}
|
|
1738
|
-
var i18n = setupI18n();
|
|
1739
|
-
|
|
1740
|
-
// packages/select/locales/en/messages.mjs
|
|
1741
|
-
var messages = JSON.parse('{"select.label.optional":"(optional)"}');
|
|
1742
1716
|
|
|
1743
|
-
// packages/select/
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1717
|
+
// packages/select/index.js
|
|
1718
|
+
import WarpElement from "@warp-ds/elements-core";
|
|
1719
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
1720
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
1721
|
+
import { when } from "lit/directives/when.js";
|
|
1748
1722
|
|
|
1749
1723
|
// packages/i18n.ts
|
|
1750
1724
|
var supportedLocales = ["en", "nb", "fi"];
|
|
@@ -1781,7 +1755,33 @@ var activateI18n = (enMessages, nbMessages, fiMessages) => {
|
|
|
1781
1755
|
i18n.activate(locale);
|
|
1782
1756
|
};
|
|
1783
1757
|
|
|
1784
|
-
//
|
|
1758
|
+
// packages/utils/index.js
|
|
1759
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
1760
|
+
var camelCaseToKebabCase = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1761
|
+
function kebabCaseAttributes(constructor) {
|
|
1762
|
+
return class extends constructor {
|
|
1763
|
+
static createProperty(name, options) {
|
|
1764
|
+
let customOptions = options;
|
|
1765
|
+
if (typeof (options == null ? void 0 : options.attribute) === "undefined" || (options == null ? void 0 : options.attribute) === true) {
|
|
1766
|
+
customOptions = Object.assign({}, options, {
|
|
1767
|
+
attribute: camelCaseToKebabCase(name.toString())
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
super.createProperty(name, customOptions);
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
// packages/select/locales/en/messages.mjs
|
|
1776
|
+
var messages = JSON.parse('{"select.label.optional":"(optional)"}');
|
|
1777
|
+
|
|
1778
|
+
// packages/select/locales/fi/messages.mjs
|
|
1779
|
+
var messages2 = JSON.parse('{"select.label.optional":"(vapaaehtoinen)"}');
|
|
1780
|
+
|
|
1781
|
+
// packages/select/locales/nb/messages.mjs
|
|
1782
|
+
var messages3 = JSON.parse('{"select.label.optional":"(valgfritt)"}');
|
|
1783
|
+
|
|
1784
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.1/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
|
|
1785
1785
|
import { LitElement } from "lit";
|
|
1786
1786
|
import { unsafeStatic, html } from "lit/static-html.js";
|
|
1787
1787
|
var messages4 = JSON.parse('{"icon.title.chevron-down":"Nedoverpil"}');
|
|
@@ -1882,7 +1882,7 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement) {
|
|
|
1882
1882
|
__privateAdd(this, _chevronClasses);
|
|
1883
1883
|
__privateAdd(this, _id);
|
|
1884
1884
|
__privateAdd(this, _helpId);
|
|
1885
|
-
activateI18n(messages,
|
|
1885
|
+
activateI18n(messages, messages3, messages2);
|
|
1886
1886
|
this._options = this.innerHTML;
|
|
1887
1887
|
}
|
|
1888
1888
|
render() {
|
|
@@ -1904,7 +1904,13 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement) {
|
|
|
1904
1904
|
>`
|
|
1905
1905
|
)}
|
|
1906
1906
|
<div class="${select.selectWrapper}">
|
|
1907
|
-
<select
|
|
1907
|
+
<select
|
|
1908
|
+
class="${__privateGet(this, _classes, classes_get)}"
|
|
1909
|
+
id="${__privateGet(this, _id, id_get)}"
|
|
1910
|
+
?autofocus=${this.autoFocus}
|
|
1911
|
+
aria-describedby="${ifDefined(__privateGet(this, _helpId, helpId_get))}"
|
|
1912
|
+
aria-invalid="${ifDefined(this.invalid)}"
|
|
1913
|
+
aria-errormessage="${ifDefined(this.invalid && __privateGet(this, _helpId, helpId_get))}">
|
|
1908
1914
|
${unsafeHTML(this._options)}
|
|
1909
1915
|
</select>
|
|
1910
1916
|
<div class="${__privateGet(this, _chevronClasses, chevronClasses_get)}">
|