@warp-ds/elements 2.0.0-next.2 → 2.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +3 -6
- package/dist/api.js.map +1 -1
- package/dist/index.js +519 -603
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/index.d.ts +13 -6
- package/dist/packages/affix/index.js +66 -113
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/alert/index.js +48 -114
- package/dist/packages/alert/index.js.map +3 -3
- package/dist/packages/attention/index.js +147 -179
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/badge/index.js +27 -77
- package/dist/packages/badge/index.js.map +4 -4
- package/dist/packages/box/index.d.ts +1 -1
- package/dist/packages/box/index.js +26 -68
- package/dist/packages/box/index.js.map +4 -4
- package/dist/packages/breadcrumbs/index.js +42 -103
- package/dist/packages/breadcrumbs/index.js.map +3 -3
- package/dist/packages/broadcast/index.js +2 -6
- package/dist/packages/broadcast/index.js.map +1 -1
- package/dist/packages/button/index.d.ts +6 -0
- package/dist/packages/button/index.js +101 -156
- package/dist/packages/button/index.js.map +3 -3
- package/dist/packages/card/index.d.ts +5 -5
- package/dist/packages/card/index.js +1462 -96
- package/dist/packages/card/index.js.map +4 -4
- package/dist/packages/card/locales/da/messages.d.mts +1 -0
- package/dist/packages/card/locales/en/messages.d.mts +1 -0
- package/dist/packages/card/locales/fi/messages.d.mts +1 -0
- package/dist/packages/card/locales/nb/messages.d.mts +1 -0
- package/dist/packages/expandable/index.d.ts +1 -6
- package/dist/packages/expandable/index.js +104 -135
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/modal/index.js +51 -119
- package/dist/packages/modal/index.js.map +3 -3
- package/dist/packages/modal/modal-header.d.ts +1 -1
- package/dist/packages/modal/modal-main.d.ts +3 -3
- package/dist/packages/pill/index.js +53 -119
- package/dist/packages/pill/index.js.map +3 -3
- package/dist/packages/select/index.d.ts +9 -0
- package/dist/packages/select/index.js +90 -155
- package/dist/packages/select/index.js.map +3 -3
- package/dist/packages/textfield/index.d.ts +9 -5
- package/dist/packages/textfield/index.js +54 -89
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/toast/api.d.ts +1 -1
- package/dist/packages/toast/index.js +118 -195
- package/dist/packages/toast/index.js.map +4 -4
- package/dist/packages/toast/toast-container.d.ts +1 -1
- package/dist/packages/toast/toast.d.ts +1 -2
- package/dist/packages/utils/index.d.ts +1 -1
- package/dist/packages/utils/unstyled-heading.d.ts +1 -1
- package/package.json +29 -30
|
@@ -31,12 +31,21 @@ export class WarpSelect extends WarpSelect_base {
|
|
|
31
31
|
type: BooleanConstructor;
|
|
32
32
|
reflect: boolean;
|
|
33
33
|
};
|
|
34
|
+
disabled: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
reflect: boolean;
|
|
37
|
+
};
|
|
38
|
+
readOnly: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
relfect: boolean;
|
|
41
|
+
};
|
|
34
42
|
_options: {
|
|
35
43
|
state: boolean;
|
|
36
44
|
};
|
|
37
45
|
};
|
|
38
46
|
static styles: any[];
|
|
39
47
|
_options: any;
|
|
48
|
+
handleKeyDown(event: any): void;
|
|
40
49
|
render(): import("lit").TemplateResult<1>;
|
|
41
50
|
#private;
|
|
42
51
|
}
|
|
@@ -6,6 +6,9 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __typeError = (msg) => {
|
|
10
|
+
throw TypeError(msg);
|
|
11
|
+
};
|
|
9
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
13
|
var __spreadValues = (a, b) => {
|
|
11
14
|
for (var prop in b || (b = {}))
|
|
@@ -49,23 +52,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
49
52
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
50
53
|
mod
|
|
51
54
|
));
|
|
52
|
-
var __publicField = (obj, key, value) =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var __accessCheck = (obj, member, msg) => {
|
|
57
|
-
if (!member.has(obj))
|
|
58
|
-
throw TypeError("Cannot " + msg);
|
|
59
|
-
};
|
|
60
|
-
var __privateGet = (obj, member, getter) => {
|
|
61
|
-
__accessCheck(obj, member, "read from private field");
|
|
62
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
63
|
-
};
|
|
64
|
-
var __privateAdd = (obj, member, value) => {
|
|
65
|
-
if (member.has(obj))
|
|
66
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
67
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
68
|
-
};
|
|
55
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
56
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
57
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
58
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
69
59
|
|
|
70
60
|
// node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js
|
|
71
61
|
var require_errors = __commonJS({
|
|
@@ -238,8 +228,7 @@ var require_moo = __commonJS({
|
|
|
238
228
|
return "(" + s + ")";
|
|
239
229
|
}
|
|
240
230
|
function reUnion(regexps) {
|
|
241
|
-
if (!regexps.length)
|
|
242
|
-
return "(?!)";
|
|
231
|
+
if (!regexps.length) return "(?!)";
|
|
243
232
|
var source = regexps.map(function(s) {
|
|
244
233
|
return "(?:" + s + ")";
|
|
245
234
|
}).join("|");
|
|
@@ -249,14 +238,10 @@ var require_moo = __commonJS({
|
|
|
249
238
|
if (typeof obj === "string") {
|
|
250
239
|
return "(?:" + reEscape(obj) + ")";
|
|
251
240
|
} else if (isRegExp(obj)) {
|
|
252
|
-
if (obj.ignoreCase)
|
|
253
|
-
|
|
254
|
-
if (obj.
|
|
255
|
-
|
|
256
|
-
if (obj.sticky)
|
|
257
|
-
throw new Error("RegExp /y flag is implied");
|
|
258
|
-
if (obj.multiline)
|
|
259
|
-
throw new Error("RegExp /m flag is implied");
|
|
241
|
+
if (obj.ignoreCase) throw new Error("RegExp /i flag not allowed");
|
|
242
|
+
if (obj.global) throw new Error("RegExp /g flag is implied");
|
|
243
|
+
if (obj.sticky) throw new Error("RegExp /y flag is implied");
|
|
244
|
+
if (obj.multiline) throw new Error("RegExp /m flag is implied");
|
|
260
245
|
return obj.source;
|
|
261
246
|
} else {
|
|
262
247
|
throw new Error("Not a pattern: " + obj);
|
|
@@ -305,16 +290,14 @@ var require_moo = __commonJS({
|
|
|
305
290
|
var match = [];
|
|
306
291
|
rules.forEach(function(rule) {
|
|
307
292
|
if (isObject(rule)) {
|
|
308
|
-
if (match.length)
|
|
309
|
-
result.push(ruleOptions(key, match));
|
|
293
|
+
if (match.length) result.push(ruleOptions(key, match));
|
|
310
294
|
result.push(ruleOptions(key, rule));
|
|
311
295
|
match = [];
|
|
312
296
|
} else {
|
|
313
297
|
match.push(rule);
|
|
314
298
|
}
|
|
315
299
|
});
|
|
316
|
-
if (match.length)
|
|
317
|
-
result.push(ruleOptions(key, match));
|
|
300
|
+
if (match.length) result.push(ruleOptions(key, match));
|
|
318
301
|
}
|
|
319
302
|
return result;
|
|
320
303
|
}
|
|
@@ -449,8 +432,7 @@ var require_moo = __commonJS({
|
|
|
449
432
|
var fallbackRule = errorRule && errorRule.fallback;
|
|
450
433
|
var flags = hasSticky && !fallbackRule ? "ym" : "gm";
|
|
451
434
|
var suffix2 = hasSticky || fallbackRule ? "" : "|";
|
|
452
|
-
if (unicodeFlag === true)
|
|
453
|
-
flags += "u";
|
|
435
|
+
if (unicodeFlag === true) flags += "u";
|
|
454
436
|
var combined = new RegExp(reUnion(parts) + suffix2, flags);
|
|
455
437
|
return { regexp: combined, groups, fast, error: errorRule || defaultErrorRule };
|
|
456
438
|
}
|
|
@@ -471,8 +453,7 @@ var require_moo = __commonJS({
|
|
|
471
453
|
var all = states.$all ? toRules(states.$all) : [];
|
|
472
454
|
delete states.$all;
|
|
473
455
|
var keys = Object.getOwnPropertyNames(states);
|
|
474
|
-
if (!start)
|
|
475
|
-
start = keys[0];
|
|
456
|
+
if (!start) start = keys[0];
|
|
476
457
|
var ruleMap = /* @__PURE__ */ Object.create(null);
|
|
477
458
|
for (var i = 0; i < keys.length; i++) {
|
|
478
459
|
var key = keys[i];
|
|
@@ -484,8 +465,7 @@ var require_moo = __commonJS({
|
|
|
484
465
|
var included = /* @__PURE__ */ Object.create(null);
|
|
485
466
|
for (var j = 0; j < rules.length; j++) {
|
|
486
467
|
var rule = rules[j];
|
|
487
|
-
if (!rule.include)
|
|
488
|
-
continue;
|
|
468
|
+
if (!rule.include) continue;
|
|
489
469
|
var splice = [j, 1];
|
|
490
470
|
if (rule.include !== key && !included[rule.include]) {
|
|
491
471
|
included[rule.include] = true;
|
|
@@ -495,8 +475,7 @@ var require_moo = __commonJS({
|
|
|
495
475
|
}
|
|
496
476
|
for (var k = 0; k < newRules.length; k++) {
|
|
497
477
|
var newRule = newRules[k];
|
|
498
|
-
if (rules.indexOf(newRule) !== -1)
|
|
499
|
-
continue;
|
|
478
|
+
if (rules.indexOf(newRule) !== -1) continue;
|
|
500
479
|
splice.push(newRule);
|
|
501
480
|
}
|
|
502
481
|
}
|
|
@@ -577,8 +556,7 @@ var require_moo = __commonJS({
|
|
|
577
556
|
};
|
|
578
557
|
};
|
|
579
558
|
Lexer.prototype.setState = function(state) {
|
|
580
|
-
if (!state || this.state === state)
|
|
581
|
-
return;
|
|
559
|
+
if (!state || this.state === state) return;
|
|
582
560
|
this.state = state;
|
|
583
561
|
var info = this.states[state];
|
|
584
562
|
this.groups = info.groups;
|
|
@@ -682,12 +660,9 @@ var require_moo = __commonJS({
|
|
|
682
660
|
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
683
661
|
throw err;
|
|
684
662
|
}
|
|
685
|
-
if (group.pop)
|
|
686
|
-
|
|
687
|
-
else if (group.
|
|
688
|
-
this.pushState(group.push);
|
|
689
|
-
else if (group.next)
|
|
690
|
-
this.setState(group.next);
|
|
663
|
+
if (group.pop) this.popState();
|
|
664
|
+
else if (group.push) this.pushState(group.push);
|
|
665
|
+
else if (group.next) this.setState(group.next);
|
|
691
666
|
return token;
|
|
692
667
|
};
|
|
693
668
|
if (typeof Symbol !== "undefined" && Symbol.iterator) {
|
|
@@ -1042,8 +1017,7 @@ import { html as html2 } from "lit";
|
|
|
1042
1017
|
|
|
1043
1018
|
// node_modules/.pnpm/@chbphone55+classnames@2.0.0/node_modules/@chbphone55/classnames/dist/index.m.js
|
|
1044
1019
|
var r = function() {
|
|
1045
|
-
for (var t = [], n = arguments.length; n--; )
|
|
1046
|
-
t[n] = arguments[n];
|
|
1020
|
+
for (var t = [], n = arguments.length; n--; ) t[n] = arguments[n];
|
|
1047
1021
|
return t.reduce(function(t2, n2) {
|
|
1048
1022
|
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) {
|
|
1049
1023
|
return n2[r2] ? r2 : "";
|
|
@@ -1051,10 +1025,10 @@ var r = function() {
|
|
|
1051
1025
|
}, []).join(" ");
|
|
1052
1026
|
};
|
|
1053
1027
|
|
|
1054
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1028
|
+
// node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
|
|
1055
1029
|
var import_unraw = __toESM(require_dist(), 1);
|
|
1056
1030
|
|
|
1057
|
-
// node_modules/.pnpm/@lingui+message-utils@4.
|
|
1031
|
+
// node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1058
1032
|
var import_parser = __toESM(require_parser(), 1);
|
|
1059
1033
|
function processTokens(tokens, mapText) {
|
|
1060
1034
|
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
@@ -1078,11 +1052,9 @@ function processTokens(tokens, mapText) {
|
|
|
1078
1052
|
}
|
|
1079
1053
|
const offset = token.pluralOffset;
|
|
1080
1054
|
const formatProps = {};
|
|
1081
|
-
token.cases.forEach((
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
mapText
|
|
1085
|
-
);
|
|
1055
|
+
token.cases.forEach(({ key, tokens: tokens2 }) => {
|
|
1056
|
+
const prop = key[0] === "=" ? key.slice(1) : key;
|
|
1057
|
+
formatProps[prop] = processTokens(tokens2, mapText);
|
|
1086
1058
|
});
|
|
1087
1059
|
return [
|
|
1088
1060
|
token.arg,
|
|
@@ -1104,7 +1076,7 @@ Message: ${message}`);
|
|
|
1104
1076
|
}
|
|
1105
1077
|
}
|
|
1106
1078
|
|
|
1107
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1079
|
+
// node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
|
|
1108
1080
|
var isString = (s) => typeof s === "string";
|
|
1109
1081
|
var isFunction = (f) => typeof f === "function";
|
|
1110
1082
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -1190,11 +1162,11 @@ var selectFormatter = (value, rules) => {
|
|
|
1190
1162
|
function interpolate(translation, locale, locales) {
|
|
1191
1163
|
return (values = {}, formats) => {
|
|
1192
1164
|
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1193
|
-
const formatMessage = (tokens) => {
|
|
1165
|
+
const formatMessage = (tokens, replaceOctothorpe = false) => {
|
|
1194
1166
|
if (!Array.isArray(tokens))
|
|
1195
1167
|
return tokens;
|
|
1196
1168
|
return tokens.reduce((message, token) => {
|
|
1197
|
-
if (token === "#") {
|
|
1169
|
+
if (token === "#" && replaceOctothorpe) {
|
|
1198
1170
|
return message + OCTOTHORPE_PH;
|
|
1199
1171
|
}
|
|
1200
1172
|
if (isString(token)) {
|
|
@@ -1205,7 +1177,10 @@ function interpolate(translation, locale, locales) {
|
|
|
1205
1177
|
if (type === "plural" || type === "selectordinal" || type === "select") {
|
|
1206
1178
|
Object.entries(format).forEach(
|
|
1207
1179
|
([key, value2]) => {
|
|
1208
|
-
interpolatedFormat[key] = formatMessage(
|
|
1180
|
+
interpolatedFormat[key] = formatMessage(
|
|
1181
|
+
value2,
|
|
1182
|
+
type === "plural" || type === "selectordinal"
|
|
1183
|
+
);
|
|
1209
1184
|
}
|
|
1210
1185
|
);
|
|
1211
1186
|
} else {
|
|
@@ -1373,6 +1348,9 @@ var I18n = class extends EventEmitter {
|
|
|
1373
1348
|
}
|
|
1374
1349
|
_(id, values, options) {
|
|
1375
1350
|
let message = options == null ? void 0 : options.message;
|
|
1351
|
+
if (!id) {
|
|
1352
|
+
id = "";
|
|
1353
|
+
}
|
|
1376
1354
|
if (!isString(id)) {
|
|
1377
1355
|
values = id.values || values;
|
|
1378
1356
|
message = id.message;
|
|
@@ -1413,41 +1391,7 @@ function setupI18n(params = {}) {
|
|
|
1413
1391
|
}
|
|
1414
1392
|
var i18n = setupI18n();
|
|
1415
1393
|
|
|
1416
|
-
// node_modules/.pnpm/@warp-ds+css@2.0.
|
|
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
|
-
};
|
|
1426
|
-
var buttonReset = "focus:outline-none appearance-none cursor-pointer bg-transparent border-0 m-0 p-0 inline-block";
|
|
1427
|
-
var expandable = {
|
|
1428
|
-
expandable: "will-change-height",
|
|
1429
|
-
expandableTitle: "font-bold s-text",
|
|
1430
|
-
expandableBox: "s-surface-sunken hover:s-bg-hover active:s-bg-active py-0 px-0 " + box.box,
|
|
1431
|
-
expandableInfo: "s-bg-info-subtle! hover:s-bg-info-subtle-hover!",
|
|
1432
|
-
expandableBleed: box.bleed,
|
|
1433
|
-
chevron: "inline-block align-middle s-icon",
|
|
1434
|
-
chevronNonBox: "ml-8",
|
|
1435
|
-
chevronBox: "",
|
|
1436
|
-
chevronTransform: "transform transition-transform transform-gpu ease-in-out",
|
|
1437
|
-
chevronExpand: "-rotate-180",
|
|
1438
|
-
chevronCollapse: "rotate-180",
|
|
1439
|
-
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",
|
|
1440
|
-
elementsChevronDownExpandPart: "part-[w-icon-chevron-down-16-part]:-rotate-180",
|
|
1441
|
-
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",
|
|
1442
|
-
elementsChevronUpCollapsePart: "part-[w-icon-chevron-up-16-part]:rotate-180",
|
|
1443
|
-
expansion: "overflow-hidden",
|
|
1444
|
-
expansionNotExpanded: "h-0 invisible",
|
|
1445
|
-
button: buttonReset + " hover:underline focus-visible:underline",
|
|
1446
|
-
buttonBox: "w-full text-left relative inline-flex items-center justify-between " + box.box,
|
|
1447
|
-
paddingTop: "pt-0",
|
|
1448
|
-
title: "flex w-full justify-between items-center",
|
|
1449
|
-
titleType: "h4"
|
|
1450
|
-
};
|
|
1394
|
+
// node_modules/.pnpm/@warp-ds+css@2.0.0_@warp-ds+uno@2.0.0_unocss@0.62.0_postcss@8.4.41_rollup@4.20.0_vite@5.3.3_@_vyiy5vwpqfzwy5hpmfkwp3zmle/node_modules/@warp-ds/css/component-classes/index.js
|
|
1451
1395
|
var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
|
|
1452
1396
|
var buttonColors = {
|
|
1453
1397
|
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]",
|
|
@@ -1565,7 +1509,7 @@ var button = {
|
|
|
1565
1509
|
};
|
|
1566
1510
|
var modal = {
|
|
1567
1511
|
backdrop: "fixed inset-0 flex sm:place-content-center sm:place-items-center items-end z-30 [--w-modal-max-height:80%] [--w-modal-width:640px] bg-[--w-black/25]",
|
|
1568
|
-
|
|
1512
|
+
base: "pb-safe-[32] shadow-m max-h-[--w-modal-max-height] min-h-[--w-modal-min-height] w-[--w-modal-width] h-[--w-modal-height] relative transition-300 ease-in-out backface-hidden will-change-height rounded-8 mx-0 sm:mx-16 bg-[--w-s-color-surface-elevated-100] flex flex-col overflow-hidden outline-none space-y-16 pt-8 sm:pt-32 sm:pb-32 rounded-b-0 sm:rounded-b-8",
|
|
1569
1513
|
content: "block overflow-y-auto overflow-x-hidden last-child:mb-0 grow shrink px-16 sm:px-32 relative",
|
|
1570
1514
|
footer: "flex justify-end shrink-0 px-16 sm:px-32",
|
|
1571
1515
|
transitionTitle: "transition-all duration-300",
|
|
@@ -1580,33 +1524,34 @@ var modal = {
|
|
|
1580
1524
|
titleButtonIconRotated: "transform rotate-90"
|
|
1581
1525
|
};
|
|
1582
1526
|
var select = {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1527
|
+
base: "block text-m mb-0 py-12 pr-32 rounded-4 w-full focusable focus:[--w-outline-offset:-2px] appearance-none cursor-pointer caret-current",
|
|
1528
|
+
default: "s-text s-bg pl-8 border-1 s-border hover:s-border-hover active:s-border-active",
|
|
1529
|
+
disabled: "s-text-disabled s-bg-disabled-subtle pl-8 border-1 s-border-disabled hover:s-border-disabled active:s-border-disabled pointer-events-none",
|
|
1530
|
+
invalid: "s-text s-bg pl-8 border-1 s-border-negative hover:s-border-negative-hover active:s-border-active outline-[--w-s-color-border-negative]!",
|
|
1531
|
+
readOnly: "s-text bg-transparent pl-0 border-0 pointer-events-none before:hidden",
|
|
1587
1532
|
wrapper: "relative",
|
|
1588
1533
|
selectWrapper: `relative before:block before:absolute before:right-0 before:bottom-0 before:w-32 before:h-full before:pointer-events-none `,
|
|
1589
|
-
chevron: "absolute top-[30%]
|
|
1534
|
+
chevron: "block absolute top-[30%] right-0 bottom-0 w-32 h-full s-icon pointer-events-none cursor-pointer",
|
|
1590
1535
|
chevronDisabled: "opacity-25"
|
|
1591
1536
|
};
|
|
1592
1537
|
var label = {
|
|
1593
|
-
|
|
1538
|
+
base: "antialiased block relative text-s font-bold pb-4 cursor-pointer s-text",
|
|
1594
1539
|
optional: "pl-8 font-normal text-s s-text-subtle"
|
|
1595
1540
|
};
|
|
1596
1541
|
var helpText = {
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1542
|
+
base: "text-xs mt-4 block",
|
|
1543
|
+
color: "s-text-subtle",
|
|
1544
|
+
colorInvalid: "s-text-negative"
|
|
1600
1545
|
};
|
|
1601
|
-
var
|
|
1546
|
+
var prefixSuffixWrapper = "absolute top-0 bottom-0 flex justify-center items-center focusable rounded-4 focus:[--w-outline-offset:-2px] bg-transparent ";
|
|
1602
1547
|
var suffix = {
|
|
1603
|
-
wrapper:
|
|
1548
|
+
wrapper: prefixSuffixWrapper + "right-0",
|
|
1604
1549
|
wrapperWithLabel: "w-max pr-12",
|
|
1605
1550
|
wrapperWithIcon: "w-40",
|
|
1606
1551
|
label: "antialiased block relative cursor-default pb-0 font-bold text-xs s-text"
|
|
1607
1552
|
};
|
|
1608
1553
|
var prefix = {
|
|
1609
|
-
wrapper:
|
|
1554
|
+
wrapper: prefixSuffixWrapper + "left-0",
|
|
1610
1555
|
wrapperWithLabel: "w-max pl-12",
|
|
1611
1556
|
wrapperWithIcon: "w-40",
|
|
1612
1557
|
label: "antialiased block relative cursor-default pb-0 font-bold text-xs s-text"
|
|
@@ -1663,15 +1608,9 @@ var deadToggle = {
|
|
|
1663
1608
|
wrapper: `${toggle.wrapper} h-20 w-20 pointer-events-none`,
|
|
1664
1609
|
input: `${toggle.input} hidden`,
|
|
1665
1610
|
inputVue: "hidden",
|
|
1611
|
+
labelVue: "-mt-2",
|
|
1666
1612
|
labelRadio: `${toggle.label} ${toggle.labelBefore} ${toggle.radio}`,
|
|
1667
|
-
labelCheckbox: `${toggle.label} ${toggle.labelBefore} ${toggle.checkbox}
|
|
1668
|
-
labelVue: "-mt-2"
|
|
1669
|
-
};
|
|
1670
|
-
var clickable = {
|
|
1671
|
-
toggle: "absolute inset-0 h-full w-full appearance-none cursor-pointer focusable focusable-inset",
|
|
1672
|
-
label: `px-12 ${label.label} py-8! cursor-pointer focusable focusable-inset`,
|
|
1673
|
-
buttonOrLink: "bg-transparent focusable",
|
|
1674
|
-
buttonOrLinkStretch: "inset-0 absolute"
|
|
1613
|
+
labelCheckbox: `${toggle.label} ${toggle.labelBefore} ${toggle.checkbox}`
|
|
1675
1614
|
};
|
|
1676
1615
|
var attention = {
|
|
1677
1616
|
base: "border-2 relative flex items-start",
|
|
@@ -1729,12 +1668,9 @@ function detectLocale() {
|
|
|
1729
1668
|
}
|
|
1730
1669
|
}
|
|
1731
1670
|
var getMessages = (locale, enMsg, nbMsg, fiMsg, daMsg) => {
|
|
1732
|
-
if (locale === "nb")
|
|
1733
|
-
|
|
1734
|
-
if (locale === "
|
|
1735
|
-
return fiMsg;
|
|
1736
|
-
if (locale === "da")
|
|
1737
|
-
return daMsg;
|
|
1671
|
+
if (locale === "nb") return nbMsg;
|
|
1672
|
+
if (locale === "fi") return fiMsg;
|
|
1673
|
+
if (locale === "da") return daMsg;
|
|
1738
1674
|
return enMsg;
|
|
1739
1675
|
};
|
|
1740
1676
|
var activateI18n = (enMessages, nbMessages, fiMessages, daMessages) => {
|
|
@@ -1773,7 +1709,7 @@ var messages3 = JSON.parse('{"select.label.optional":"(vapaaehtoinen)"}');
|
|
|
1773
1709
|
// packages/select/locales/nb/messages.mjs
|
|
1774
1710
|
var messages4 = JSON.parse('{"select.label.optional":"(valgfritt)"}');
|
|
1775
1711
|
|
|
1776
|
-
// node_modules/.pnpm/@warp-ds+icons@2.0.
|
|
1712
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.2/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
|
|
1777
1713
|
import { LitElement } from "lit";
|
|
1778
1714
|
import { unsafeStatic, html } from "lit/static-html.js";
|
|
1779
1715
|
var messages5 = JSON.parse('{"icon.title.chevron-down":"Nedoverpil"}');
|
|
@@ -1865,23 +1801,24 @@ if (!customElements.get("w-icon-chevron-down-16")) {
|
|
|
1865
1801
|
}
|
|
1866
1802
|
|
|
1867
1803
|
// packages/select/index.js
|
|
1868
|
-
var
|
|
1804
|
+
var _WarpSelect_instances, classes_get, helpTextClasses_get, chevronClasses_get, id_get, helpId_get;
|
|
1869
1805
|
var WarpSelect = class extends kebabCaseAttributes(WarpElement) {
|
|
1870
1806
|
constructor() {
|
|
1871
1807
|
super();
|
|
1872
|
-
__privateAdd(this,
|
|
1873
|
-
__privateAdd(this, _helpTextClasses);
|
|
1874
|
-
__privateAdd(this, _chevronClasses);
|
|
1875
|
-
__privateAdd(this, _id);
|
|
1876
|
-
__privateAdd(this, _helpId);
|
|
1808
|
+
__privateAdd(this, _WarpSelect_instances);
|
|
1877
1809
|
activateI18n(messages2, messages4, messages3, messages);
|
|
1878
1810
|
this._options = this.innerHTML;
|
|
1879
1811
|
}
|
|
1812
|
+
handleKeyDown(event) {
|
|
1813
|
+
if (this.readOnly && (event.key === " " || event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
1814
|
+
event.preventDefault();
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1880
1817
|
render() {
|
|
1881
1818
|
return html2`<div class="${select.wrapper}">
|
|
1882
1819
|
${when(
|
|
1883
1820
|
this.label,
|
|
1884
|
-
() => html2`<label class="${label.
|
|
1821
|
+
() => html2`<label class="${label.base}" for="${__privateGet(this, _WarpSelect_instances, id_get)}">
|
|
1885
1822
|
${this.label}
|
|
1886
1823
|
${when(
|
|
1887
1824
|
this.optional,
|
|
@@ -1897,51 +1834,45 @@ var WarpSelect = class extends kebabCaseAttributes(WarpElement) {
|
|
|
1897
1834
|
)}
|
|
1898
1835
|
<div class="${select.selectWrapper}">
|
|
1899
1836
|
<select
|
|
1900
|
-
class="${__privateGet(this,
|
|
1901
|
-
id="${__privateGet(this,
|
|
1837
|
+
class="${__privateGet(this, _WarpSelect_instances, classes_get)}"
|
|
1838
|
+
id="${__privateGet(this, _WarpSelect_instances, id_get)}"
|
|
1902
1839
|
?autofocus=${this.autoFocus}
|
|
1903
|
-
|
|
1840
|
+
?disabled=${this.disabled}
|
|
1841
|
+
aria-describedby="${ifDefined(__privateGet(this, _WarpSelect_instances, helpId_get))}"
|
|
1904
1842
|
aria-invalid="${ifDefined(this.invalid)}"
|
|
1905
|
-
aria-errormessage="${ifDefined(this.invalid && __privateGet(this,
|
|
1843
|
+
aria-errormessage="${ifDefined(this.invalid && __privateGet(this, _WarpSelect_instances, helpId_get))}"
|
|
1844
|
+
@keydown=${this.handleKeyDown}>
|
|
1906
1845
|
${unsafeHTML(this._options)}
|
|
1907
1846
|
</select>
|
|
1908
|
-
<div class="${__privateGet(this,
|
|
1847
|
+
<div class="${__privateGet(this, _WarpSelect_instances, chevronClasses_get)}">
|
|
1909
1848
|
<w-icon-chevron-down-16></w-icon-chevron-down-16>
|
|
1910
1849
|
</div>
|
|
1911
1850
|
</div>
|
|
1912
|
-
${when(this.always || this.invalid, () => html2`<div id="${__privateGet(this,
|
|
1851
|
+
${when(this.always || this.invalid, () => html2`<div id="${__privateGet(this, _WarpSelect_instances, helpId_get)}" class="${__privateGet(this, _WarpSelect_instances, helpTextClasses_get)}">${this.hint}</div>`)}
|
|
1913
1852
|
</div>`;
|
|
1914
1853
|
}
|
|
1915
1854
|
};
|
|
1916
|
-
|
|
1855
|
+
_WarpSelect_instances = new WeakSet();
|
|
1917
1856
|
classes_get = function() {
|
|
1918
|
-
return r(
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1857
|
+
return r([
|
|
1858
|
+
select.base,
|
|
1859
|
+
!this.invalid && !this.disabled && !this.readOnly && select.default,
|
|
1860
|
+
this.invalid && select.invalid,
|
|
1861
|
+
this.disabled && select.disabled,
|
|
1862
|
+
this.readOnly && select.readOnly
|
|
1863
|
+
]);
|
|
1922
1864
|
};
|
|
1923
|
-
_helpTextClasses = new WeakSet();
|
|
1924
1865
|
helpTextClasses_get = function() {
|
|
1925
|
-
return r(
|
|
1926
|
-
[helpText.helpText]: true,
|
|
1927
|
-
[helpText.helpTextColor]: !this.invalid,
|
|
1928
|
-
[helpText.helpTextColorInvalid]: this.invalid
|
|
1929
|
-
});
|
|
1866
|
+
return r([helpText.base, this.invalid ? helpText.colorInvalid : helpText.color]);
|
|
1930
1867
|
};
|
|
1931
|
-
_chevronClasses = new WeakSet();
|
|
1932
1868
|
chevronClasses_get = function() {
|
|
1933
|
-
return r(
|
|
1934
|
-
[select.chevron]: true,
|
|
1935
|
-
[select.chevronDisabled]: this.disabled
|
|
1936
|
-
});
|
|
1869
|
+
return r([select.chevron, this.disabled && select.chevronDisabled]);
|
|
1937
1870
|
};
|
|
1938
|
-
_id = new WeakSet();
|
|
1939
1871
|
id_get = function() {
|
|
1940
1872
|
return "select_id";
|
|
1941
1873
|
};
|
|
1942
|
-
_helpId = new WeakSet();
|
|
1943
1874
|
helpId_get = function() {
|
|
1944
|
-
return this.hint ? `${__privateGet(this,
|
|
1875
|
+
return this.hint ? `${__privateGet(this, _WarpSelect_instances, id_get)}__hint` : void 0;
|
|
1945
1876
|
};
|
|
1946
1877
|
__publicField(WarpSelect, "properties", {
|
|
1947
1878
|
// Whether the element should receive focus on render
|
|
@@ -1956,6 +1887,10 @@ __publicField(WarpSelect, "properties", {
|
|
|
1956
1887
|
label: { type: String, reflect: true },
|
|
1957
1888
|
// Whether to show optional text
|
|
1958
1889
|
optional: { type: Boolean, reflect: true },
|
|
1890
|
+
// Renders the field in a disabled state.
|
|
1891
|
+
disabled: { type: Boolean, reflect: true },
|
|
1892
|
+
// Renders the field in a readonly state.
|
|
1893
|
+
readOnly: { type: Boolean, relfect: true },
|
|
1959
1894
|
_options: { state: true }
|
|
1960
1895
|
});
|
|
1961
1896
|
__publicField(WarpSelect, "styles", [WarpElement.styles]);
|