@codbex/harmonia 1.9.1 → 1.10.1
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/harmonia.css +1 -1
- package/dist/harmonia.esm.js +202 -11
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +202 -11
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +4 -4
- package/package.json +9 -2
package/dist/harmonia.esm.js
CHANGED
|
@@ -4815,7 +4815,7 @@ function calendar_default(Alpine) {
|
|
|
4815
4815
|
];
|
|
4816
4816
|
const previousYearBtn = document.createElement("button");
|
|
4817
4817
|
previousYearBtn.classList.add(...buttonClasses);
|
|
4818
|
-
previousYearBtn.setAttribute("aria-label", el.hasAttribute("data-aria-prev-year") ? el.
|
|
4818
|
+
previousYearBtn.setAttribute("aria-label", el.hasAttribute("data-aria-prev-year") ? el.getAttribute("data-aria-prev-year") : "previous year");
|
|
4819
4819
|
previousYearBtn.setAttribute("type", "button");
|
|
4820
4820
|
previousYearBtn.appendChild(
|
|
4821
4821
|
createSvg({
|
|
@@ -4834,7 +4834,7 @@ function calendar_default(Alpine) {
|
|
|
4834
4834
|
header.appendChild(previousYearBtn);
|
|
4835
4835
|
const previousMonthBtn = document.createElement("button");
|
|
4836
4836
|
previousMonthBtn.classList.add(...buttonClasses);
|
|
4837
|
-
previousMonthBtn.setAttribute("aria-label", el.hasAttribute("data-aria-prev-month") ? el.
|
|
4837
|
+
previousMonthBtn.setAttribute("aria-label", el.hasAttribute("data-aria-prev-month") ? el.getAttribute("data-aria-prev-month") : "previous month");
|
|
4838
4838
|
previousMonthBtn.setAttribute("type", "button");
|
|
4839
4839
|
previousMonthBtn.appendChild(
|
|
4840
4840
|
createSvg({
|
|
@@ -4858,7 +4858,7 @@ function calendar_default(Alpine) {
|
|
|
4858
4858
|
header.appendChild(headerLabel);
|
|
4859
4859
|
const nextMonthBtn = document.createElement("button");
|
|
4860
4860
|
nextMonthBtn.classList.add(...buttonClasses);
|
|
4861
|
-
nextMonthBtn.setAttribute("aria-label", el.hasAttribute("data-aria-next-month") ? el.
|
|
4861
|
+
nextMonthBtn.setAttribute("aria-label", el.hasAttribute("data-aria-next-month") ? el.getAttribute("data-aria-next-month") : "next month");
|
|
4862
4862
|
nextMonthBtn.setAttribute("type", "button");
|
|
4863
4863
|
nextMonthBtn.appendChild(
|
|
4864
4864
|
createSvg({
|
|
@@ -4877,7 +4877,7 @@ function calendar_default(Alpine) {
|
|
|
4877
4877
|
header.appendChild(nextMonthBtn);
|
|
4878
4878
|
const nextYearBtn = document.createElement("button");
|
|
4879
4879
|
nextYearBtn.classList.add(...buttonClasses);
|
|
4880
|
-
nextYearBtn.setAttribute("aria-label", el.hasAttribute("data-aria-next-year") ? el.
|
|
4880
|
+
nextYearBtn.setAttribute("aria-label", el.hasAttribute("data-aria-next-year") ? el.getAttribute("data-aria-next-year") : "next year");
|
|
4881
4881
|
nextYearBtn.setAttribute("type", "button");
|
|
4882
4882
|
nextYearBtn.appendChild(
|
|
4883
4883
|
createSvg({
|
|
@@ -5282,6 +5282,195 @@ function checkbox_default(Alpine) {
|
|
|
5282
5282
|
});
|
|
5283
5283
|
}
|
|
5284
5284
|
|
|
5285
|
+
// src/components/chip.js
|
|
5286
|
+
function chip_default(Alpine) {
|
|
5287
|
+
Alpine.directive("h-chip", (el, { original }, { cleanup }) => {
|
|
5288
|
+
if (el.tagName !== "BUTTON") {
|
|
5289
|
+
throw new Error(`${original} must be a button element`);
|
|
5290
|
+
}
|
|
5291
|
+
el._h_chip = Alpine.reactive({
|
|
5292
|
+
variant: "default"
|
|
5293
|
+
});
|
|
5294
|
+
el.classList.add(
|
|
5295
|
+
"cursor-pointer",
|
|
5296
|
+
"inline-flex",
|
|
5297
|
+
"items-center",
|
|
5298
|
+
"justify-center",
|
|
5299
|
+
"whitespace-nowrap",
|
|
5300
|
+
"rounded-full",
|
|
5301
|
+
"text-sm",
|
|
5302
|
+
"leading-none",
|
|
5303
|
+
"transform-gpu",
|
|
5304
|
+
"overflow-hidden",
|
|
5305
|
+
"transition-all",
|
|
5306
|
+
"duration-100",
|
|
5307
|
+
"motion-reduce:transition-none",
|
|
5308
|
+
"disabled:pointer-events-none",
|
|
5309
|
+
"disabled:opacity-50",
|
|
5310
|
+
"[&_svg]:pointer-events-none",
|
|
5311
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
5312
|
+
"shrink-0",
|
|
5313
|
+
"[&_svg]:shrink-0",
|
|
5314
|
+
"aria-expanded:outline-[calc(var(--spacing)*0.75)]",
|
|
5315
|
+
"aria-expanded:outline",
|
|
5316
|
+
"focus:outline-[calc(var(--spacing)*0.75)]",
|
|
5317
|
+
"focus:outline",
|
|
5318
|
+
"focus-visible:outline-[calc(var(--spacing)*0.75)]",
|
|
5319
|
+
"focus-visible:outline",
|
|
5320
|
+
"h-7",
|
|
5321
|
+
"gap-1.5",
|
|
5322
|
+
"px-2.5",
|
|
5323
|
+
"has-[>svg]:pl-1.5",
|
|
5324
|
+
"has-[>[data-slot=chip-close]]:pr-0",
|
|
5325
|
+
"has-[>[data-slot=spinner]]:px-2",
|
|
5326
|
+
"text-secondary-foreground",
|
|
5327
|
+
"border"
|
|
5328
|
+
);
|
|
5329
|
+
if (!el.hasAttribute("type")) {
|
|
5330
|
+
el.setAttribute("type", "button");
|
|
5331
|
+
}
|
|
5332
|
+
el.setAttribute("data-slot", "chip");
|
|
5333
|
+
const variants = {
|
|
5334
|
+
default: ["bg-secondary", "[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-secondary-hover", "[&:active:not(:has([data-slot=chip-close]:active))]:bg-secondary-active", "outline-ring/50"],
|
|
5335
|
+
primary: [
|
|
5336
|
+
"bg-primary/10",
|
|
5337
|
+
"border-primary/50",
|
|
5338
|
+
"[&>svg]:text-primary",
|
|
5339
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-primary/15",
|
|
5340
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-primary/20",
|
|
5341
|
+
"outline-primary/50"
|
|
5342
|
+
],
|
|
5343
|
+
positive: [
|
|
5344
|
+
"bg-positive/10",
|
|
5345
|
+
"border-positive/50",
|
|
5346
|
+
"[&>svg]:text-positive",
|
|
5347
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-positive/15",
|
|
5348
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-positive/20",
|
|
5349
|
+
"outline-positive/50"
|
|
5350
|
+
],
|
|
5351
|
+
negative: [
|
|
5352
|
+
"bg-negative/10",
|
|
5353
|
+
"border-negative/50",
|
|
5354
|
+
"[&>svg]:text-negative",
|
|
5355
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-negative/15",
|
|
5356
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-negative/20",
|
|
5357
|
+
"outline-negative/50"
|
|
5358
|
+
],
|
|
5359
|
+
warning: [
|
|
5360
|
+
"bg-warning/10",
|
|
5361
|
+
"border-warning/50",
|
|
5362
|
+
"[&>svg]:text-warning",
|
|
5363
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-warning/15",
|
|
5364
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-warning/20",
|
|
5365
|
+
"outline-warning/50"
|
|
5366
|
+
],
|
|
5367
|
+
information: [
|
|
5368
|
+
"bg-information/10",
|
|
5369
|
+
"border-information/50",
|
|
5370
|
+
"[&>svg]:text-information",
|
|
5371
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-information/15",
|
|
5372
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-information/20",
|
|
5373
|
+
"outline-information/50"
|
|
5374
|
+
],
|
|
5375
|
+
outline: [
|
|
5376
|
+
"bg-background",
|
|
5377
|
+
"[&>svg]:text-secondary-foreground",
|
|
5378
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-secondary-hover",
|
|
5379
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-secondary-active",
|
|
5380
|
+
"outline-ring/50"
|
|
5381
|
+
]
|
|
5382
|
+
};
|
|
5383
|
+
function setVariant(variant) {
|
|
5384
|
+
el._h_chip.variant = variant;
|
|
5385
|
+
for (const [_, value] of Object.entries(variants)) {
|
|
5386
|
+
el.classList.remove(...value);
|
|
5387
|
+
}
|
|
5388
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
5389
|
+
}
|
|
5390
|
+
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
5391
|
+
const observer = new MutationObserver(() => {
|
|
5392
|
+
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
5393
|
+
});
|
|
5394
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant"] });
|
|
5395
|
+
cleanup(() => {
|
|
5396
|
+
observer.disconnect();
|
|
5397
|
+
});
|
|
5398
|
+
});
|
|
5399
|
+
Alpine.directive("h-chip-close", (el, { original }, { effect, cleanup }) => {
|
|
5400
|
+
if (el.tagName === "BUTTON") {
|
|
5401
|
+
throw new Error(`${original} must NOT be a button element`);
|
|
5402
|
+
}
|
|
5403
|
+
const chip = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_chip"));
|
|
5404
|
+
el.classList.add(
|
|
5405
|
+
"cursor-pointer",
|
|
5406
|
+
"inline-flex",
|
|
5407
|
+
"items-center",
|
|
5408
|
+
"justify-center",
|
|
5409
|
+
"pl-1",
|
|
5410
|
+
"pr-1.5",
|
|
5411
|
+
"h-full",
|
|
5412
|
+
"text-sm",
|
|
5413
|
+
"transition-all",
|
|
5414
|
+
"duration-100",
|
|
5415
|
+
"motion-reduce:transition-none",
|
|
5416
|
+
"disabled:pointer-events-none",
|
|
5417
|
+
"disabled:opacity-50",
|
|
5418
|
+
"bg-transparent",
|
|
5419
|
+
"text-secondary-foreground",
|
|
5420
|
+
"fill-secondary-foreground",
|
|
5421
|
+
"rounded-r-full",
|
|
5422
|
+
"border-l",
|
|
5423
|
+
"border-transparent",
|
|
5424
|
+
"outline-none",
|
|
5425
|
+
"focus-visible:inset-ring-[calc(var(--spacing)*0.75)]",
|
|
5426
|
+
"focus-visible:inset-ring",
|
|
5427
|
+
"hover:[[data-variant]>&]:border-inherit",
|
|
5428
|
+
"active:border-inherit",
|
|
5429
|
+
"aria-pressed:border-inherit"
|
|
5430
|
+
);
|
|
5431
|
+
el.setAttribute("data-slot", "chip-close");
|
|
5432
|
+
el.setAttribute("tabindex", "0");
|
|
5433
|
+
el.setAttribute("role", "button");
|
|
5434
|
+
el.appendChild(
|
|
5435
|
+
createSvg({
|
|
5436
|
+
icon: Close,
|
|
5437
|
+
classes: "size-3.5 shrink-0 pointer-events-none",
|
|
5438
|
+
attrs: {
|
|
5439
|
+
"aria-hidden": true,
|
|
5440
|
+
role: "presentation"
|
|
5441
|
+
}
|
|
5442
|
+
})
|
|
5443
|
+
);
|
|
5444
|
+
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
5445
|
+
console.error(`${original}: Must have an "aria-label" or "aria-labelledby" attribute`, el);
|
|
5446
|
+
}
|
|
5447
|
+
const variants = {
|
|
5448
|
+
default: ["hover:border-foreground/20", "hover:bg-secondary-hover", "active:bg-secondary-active", "focus-visible:inset-ring-ring/50"],
|
|
5449
|
+
primary: ["hover:bg-primary/10", "active:bg-primary/15", "aria-pressed:bg-primary/15", "focus-visible:inset-ring-primary/50"],
|
|
5450
|
+
positive: ["hover:bg-positive/10", "active:bg-positive/15", "aria-pressed:bg-positive/15", "focus-visible:inset-ring-positive/50"],
|
|
5451
|
+
negative: ["hover:bg-negative/10", "active:bg-negative/15", "aria-pressed:bg-negative/15", "focus-visible:inset-ring-negative/50"],
|
|
5452
|
+
warning: ["hover:bg-warning/10", "active:bg-warning/15", "aria-pressed:bg-warning/15", "focus-visible:inset-ring-warning/50"],
|
|
5453
|
+
information: ["hover:bg-information/10", "active:bg-information/15", "aria-pressed:bg-information/15", "focus-visible:inset-ring-information/50"],
|
|
5454
|
+
outline: ["hover:bg-secondary-hover", "active:bg-secondary-active", "aria-pressed:bg-secondary-active", "focus-visible:inset-ring-ring/50"]
|
|
5455
|
+
};
|
|
5456
|
+
effect(() => {
|
|
5457
|
+
for (const [_, value] of Object.entries(variants)) {
|
|
5458
|
+
el.classList.remove(...value);
|
|
5459
|
+
}
|
|
5460
|
+
if (Object.prototype.hasOwnProperty.call(variants, chip._h_chip.variant)) {
|
|
5461
|
+
el.classList.add(...variants[chip._h_chip.variant]);
|
|
5462
|
+
}
|
|
5463
|
+
});
|
|
5464
|
+
const stopPropagation = (event) => {
|
|
5465
|
+
if (chip.getAttribute("aria-expanded") !== "true") event.stopPropagation();
|
|
5466
|
+
};
|
|
5467
|
+
el.addEventListener("click", stopPropagation);
|
|
5468
|
+
cleanup(() => {
|
|
5469
|
+
el.removeEventListener("click", stopPropagation);
|
|
5470
|
+
});
|
|
5471
|
+
});
|
|
5472
|
+
}
|
|
5473
|
+
|
|
5285
5474
|
// src/common/input-size.js
|
|
5286
5475
|
function setSize(el, size3) {
|
|
5287
5476
|
if (size3 === "sm") {
|
|
@@ -5583,7 +5772,7 @@ function dialog_default(Alpine) {
|
|
|
5583
5772
|
el.classList.add("order-1", "text-lg", "leading-none", "font-semibold");
|
|
5584
5773
|
el.setAttribute("data-slot", "dialog-title");
|
|
5585
5774
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
5586
|
-
if (dialog &&
|
|
5775
|
+
if (dialog && !dialog.hasAttribute("aria-labelledby") && !dialog.hasAttribute("aria-label")) {
|
|
5587
5776
|
if (!el.hasAttribute("id")) {
|
|
5588
5777
|
const id = `dht${uuid_default()}`;
|
|
5589
5778
|
el.setAttribute("id", id);
|
|
@@ -5616,7 +5805,7 @@ function dialog_default(Alpine) {
|
|
|
5616
5805
|
el.classList.add("order-3", "col-span-full", "text-muted-foreground", "text-sm");
|
|
5617
5806
|
el.setAttribute("data-slot", "dialog-description");
|
|
5618
5807
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
5619
|
-
if (dialog &&
|
|
5808
|
+
if (dialog && !dialog.hasAttribute("aria-describedby") && !dialog.hasAttribute("aria-description")) {
|
|
5620
5809
|
if (!el.hasAttribute("id")) {
|
|
5621
5810
|
const id = `dhd${uuid_default()}`;
|
|
5622
5811
|
el.setAttribute("id", id);
|
|
@@ -5935,7 +6124,7 @@ function info_page_default(Alpine) {
|
|
|
5935
6124
|
});
|
|
5936
6125
|
Alpine.directive("h-info-page-content", (el) => {
|
|
5937
6126
|
el.classList.add("vbox", "w-full", "max-w-sm", "min-w-0", "items-center", "gap-4", "text-sm", "text-balance");
|
|
5938
|
-
el.setAttribute("data-slot", "info-page-
|
|
6127
|
+
el.setAttribute("data-slot", "info-page-content");
|
|
5939
6128
|
});
|
|
5940
6129
|
}
|
|
5941
6130
|
|
|
@@ -7886,6 +8075,7 @@ function select_default(Alpine) {
|
|
|
7886
8075
|
displayValue.innerText = value;
|
|
7887
8076
|
displayValue.classList.add("text-muted-foreground");
|
|
7888
8077
|
} else {
|
|
8078
|
+
displayValue.innerText = "";
|
|
7889
8079
|
displayValue.classList.remove("text-muted-foreground");
|
|
7890
8080
|
}
|
|
7891
8081
|
}
|
|
@@ -8363,7 +8553,7 @@ function select_default(Alpine) {
|
|
|
8363
8553
|
}
|
|
8364
8554
|
} else if (select._h_model.get() !== getValue()) {
|
|
8365
8555
|
select._h_model.set(getValue());
|
|
8366
|
-
} else {
|
|
8556
|
+
} else if (select.getAttribute("data-clearable") === "true") {
|
|
8367
8557
|
select._h_model.set("");
|
|
8368
8558
|
}
|
|
8369
8559
|
}
|
|
@@ -10904,13 +11094,13 @@ function tooltip_default(Alpine) {
|
|
|
10904
11094
|
Alpine.directive("h-tooltip-trigger", (el, _, { Alpine: Alpine2, cleanup }) => {
|
|
10905
11095
|
el._tooltip = Alpine2.reactive({
|
|
10906
11096
|
id: void 0,
|
|
10907
|
-
controls: `
|
|
11097
|
+
controls: `htp${uuid_default()}`,
|
|
10908
11098
|
shown: false
|
|
10909
11099
|
});
|
|
10910
11100
|
if (el.hasAttribute("id")) {
|
|
10911
11101
|
el._tooltip.id = el.getAttribute("id");
|
|
10912
11102
|
} else {
|
|
10913
|
-
el._tooltip.id = `
|
|
11103
|
+
el._tooltip.id = `htt${uuid_default()}`;
|
|
10914
11104
|
el.setAttribute("id", el._tooltip.id);
|
|
10915
11105
|
}
|
|
10916
11106
|
el.setAttribute("aria-describedby", el._tooltip.controls);
|
|
@@ -11244,7 +11434,7 @@ function tree_default(Alpine) {
|
|
|
11244
11434
|
}
|
|
11245
11435
|
|
|
11246
11436
|
// package.json
|
|
11247
|
-
var version = "1.
|
|
11437
|
+
var version = "1.10.1";
|
|
11248
11438
|
|
|
11249
11439
|
// src/utils/theme.js
|
|
11250
11440
|
var colorSchemeKey = "codbex.harmonia.colorMode";
|
|
@@ -11489,6 +11679,7 @@ export {
|
|
|
11489
11679
|
calendar_default as Calendar,
|
|
11490
11680
|
card_default as Card,
|
|
11491
11681
|
checkbox_default as Checkbox,
|
|
11682
|
+
chip_default as Chip,
|
|
11492
11683
|
datepicker_default as DatePicker,
|
|
11493
11684
|
dialog_default as Dialog,
|
|
11494
11685
|
expansion_panel_default as ExpansionPanel,
|