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