@codbex/harmonia 1.9.1 → 1.10.0
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 +199 -11
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +199 -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,192 @@ 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
|
+
"focus-visible:outline-[calc(var(--spacing)*0.75)]",
|
|
5315
|
+
"focus-visible:outline",
|
|
5316
|
+
"h-7",
|
|
5317
|
+
"gap-1.5",
|
|
5318
|
+
"px-2.5",
|
|
5319
|
+
"has-[>svg]:pl-1.5",
|
|
5320
|
+
"has-[>[data-slot=chip-close]]:pr-0",
|
|
5321
|
+
"has-[>[data-slot=spinner]]:px-2",
|
|
5322
|
+
"text-secondary-foreground",
|
|
5323
|
+
"fill-secondary-foreground",
|
|
5324
|
+
"border"
|
|
5325
|
+
);
|
|
5326
|
+
if (!el.hasAttribute("type")) {
|
|
5327
|
+
el.setAttribute("type", "button");
|
|
5328
|
+
}
|
|
5329
|
+
el.setAttribute("data-slot", "chip");
|
|
5330
|
+
const variants = {
|
|
5331
|
+
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"],
|
|
5332
|
+
primary: [
|
|
5333
|
+
"bg-primary/10",
|
|
5334
|
+
"border-primary/50",
|
|
5335
|
+
"[&>svg]:fill-primary",
|
|
5336
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-primary/15",
|
|
5337
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-primary/20",
|
|
5338
|
+
"outline-primary/50"
|
|
5339
|
+
],
|
|
5340
|
+
positive: [
|
|
5341
|
+
"bg-positive/10",
|
|
5342
|
+
"border-positive/50",
|
|
5343
|
+
"[&>svg]:fill-positive",
|
|
5344
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-positive/15",
|
|
5345
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-positive/20",
|
|
5346
|
+
"outline-positive/50"
|
|
5347
|
+
],
|
|
5348
|
+
negative: [
|
|
5349
|
+
"bg-negative/10",
|
|
5350
|
+
"border-negative/50",
|
|
5351
|
+
"[&>svg]:fill-negative",
|
|
5352
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-negative/15",
|
|
5353
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-negative/20",
|
|
5354
|
+
"outline-negative/50"
|
|
5355
|
+
],
|
|
5356
|
+
warning: [
|
|
5357
|
+
"bg-warning/10",
|
|
5358
|
+
"border-warning/50",
|
|
5359
|
+
"[&>svg]:fill-warning",
|
|
5360
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-warning/15",
|
|
5361
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-warning/20",
|
|
5362
|
+
"outline-warning/50"
|
|
5363
|
+
],
|
|
5364
|
+
information: [
|
|
5365
|
+
"bg-information/10",
|
|
5366
|
+
"border-information/50",
|
|
5367
|
+
"[&>svg]:fill-information",
|
|
5368
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-information/15",
|
|
5369
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-information/20",
|
|
5370
|
+
"outline-information/50"
|
|
5371
|
+
],
|
|
5372
|
+
outline: [
|
|
5373
|
+
"bg-background",
|
|
5374
|
+
"[&>svg]:fill-secondary-foreground",
|
|
5375
|
+
"[&:hover:not(:has([data-slot=chip-close]:hover)):not(:active)]:bg-secondary-hover",
|
|
5376
|
+
"[&:active:not(:has([data-slot=chip-close]:active))]:bg-secondary-active",
|
|
5377
|
+
"outline-ring/50"
|
|
5378
|
+
]
|
|
5379
|
+
};
|
|
5380
|
+
function setVariant(variant) {
|
|
5381
|
+
el._h_chip.variant = variant;
|
|
5382
|
+
for (const [_, value] of Object.entries(variants)) {
|
|
5383
|
+
el.classList.remove(...value);
|
|
5384
|
+
}
|
|
5385
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
5386
|
+
}
|
|
5387
|
+
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
5388
|
+
const observer = new MutationObserver(() => {
|
|
5389
|
+
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
5390
|
+
});
|
|
5391
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant"] });
|
|
5392
|
+
cleanup(() => {
|
|
5393
|
+
observer.disconnect();
|
|
5394
|
+
});
|
|
5395
|
+
});
|
|
5396
|
+
Alpine.directive("h-chip-close", (el, { original }, { effect, cleanup }) => {
|
|
5397
|
+
if (el.tagName === "BUTTON") {
|
|
5398
|
+
throw new Error(`${original} must NOT be a button element`);
|
|
5399
|
+
}
|
|
5400
|
+
const chip = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_chip"));
|
|
5401
|
+
el.classList.add(
|
|
5402
|
+
"cursor-pointer",
|
|
5403
|
+
"inline-flex",
|
|
5404
|
+
"items-center",
|
|
5405
|
+
"justify-center",
|
|
5406
|
+
"pl-1",
|
|
5407
|
+
"pr-1.5",
|
|
5408
|
+
"h-full",
|
|
5409
|
+
"text-sm",
|
|
5410
|
+
"transition-all",
|
|
5411
|
+
"duration-100",
|
|
5412
|
+
"motion-reduce:transition-none",
|
|
5413
|
+
"disabled:pointer-events-none",
|
|
5414
|
+
"disabled:opacity-50",
|
|
5415
|
+
"bg-transparent",
|
|
5416
|
+
"text-secondary-foreground",
|
|
5417
|
+
"fill-secondary-foreground",
|
|
5418
|
+
"rounded-r-full",
|
|
5419
|
+
"border-l",
|
|
5420
|
+
"border-transparent",
|
|
5421
|
+
"outline-none",
|
|
5422
|
+
"focus-visible:inset-ring-[calc(var(--spacing)*0.75)]",
|
|
5423
|
+
"focus-visible:inset-ring",
|
|
5424
|
+
"hover:[[data-variant]>&]:border-inherit",
|
|
5425
|
+
"active:border-inherit",
|
|
5426
|
+
"aria-pressed:border-inherit"
|
|
5427
|
+
);
|
|
5428
|
+
el.setAttribute("data-slot", "chip-close");
|
|
5429
|
+
el.setAttribute("tabindex", "0");
|
|
5430
|
+
el.setAttribute("role", "button");
|
|
5431
|
+
el.appendChild(
|
|
5432
|
+
createSvg({
|
|
5433
|
+
icon: Close,
|
|
5434
|
+
classes: "size-3.5 shrink-0 pointer-events-none",
|
|
5435
|
+
attrs: {
|
|
5436
|
+
"aria-hidden": true,
|
|
5437
|
+
role: "presentation"
|
|
5438
|
+
}
|
|
5439
|
+
})
|
|
5440
|
+
);
|
|
5441
|
+
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
5442
|
+
console.error(`${original}: Must have an "aria-label" or "aria-labelledby" attribute`, el);
|
|
5443
|
+
}
|
|
5444
|
+
const variants = {
|
|
5445
|
+
default: ["hover:border-foreground/20", "hover:bg-secondary-hover", "active:bg-secondary-active", "focus-visible:inset-ring-ring/50"],
|
|
5446
|
+
primary: ["hover:bg-primary/10", "active:bg-primary/15", "aria-pressed:bg-primary/15", "focus-visible:inset-ring-primary/50"],
|
|
5447
|
+
positive: ["hover:bg-positive/10", "active:bg-positive/15", "aria-pressed:bg-positive/15", "focus-visible:inset-ring-positive/50"],
|
|
5448
|
+
negative: ["hover:bg-negative/10", "active:bg-negative/15", "aria-pressed:bg-negative/15", "focus-visible:inset-ring-negative/50"],
|
|
5449
|
+
warning: ["hover:bg-warning/10", "active:bg-warning/15", "aria-pressed:bg-warning/15", "focus-visible:inset-ring-warning/50"],
|
|
5450
|
+
information: ["hover:bg-information/10", "active:bg-information/15", "aria-pressed:bg-information/15", "focus-visible:inset-ring-information/50"],
|
|
5451
|
+
outline: ["hover:bg-secondary-hover", "active:bg-secondary-active", "aria-pressed:bg-secondary-active", "focus-visible:inset-ring-ring/50"]
|
|
5452
|
+
};
|
|
5453
|
+
effect(() => {
|
|
5454
|
+
for (const [_, value] of Object.entries(variants)) {
|
|
5455
|
+
el.classList.remove(...value);
|
|
5456
|
+
}
|
|
5457
|
+
if (Object.prototype.hasOwnProperty.call(variants, chip._h_chip.variant)) {
|
|
5458
|
+
el.classList.add(...variants[chip._h_chip.variant]);
|
|
5459
|
+
}
|
|
5460
|
+
});
|
|
5461
|
+
const stopPropagation = (event) => {
|
|
5462
|
+
if (chip.getAttribute("aria-expanded") !== "true") event.stopPropagation();
|
|
5463
|
+
};
|
|
5464
|
+
el.addEventListener("click", stopPropagation);
|
|
5465
|
+
cleanup(() => {
|
|
5466
|
+
el.removeEventListener("click", stopPropagation);
|
|
5467
|
+
});
|
|
5468
|
+
});
|
|
5469
|
+
}
|
|
5470
|
+
|
|
5285
5471
|
// src/common/input-size.js
|
|
5286
5472
|
function setSize(el, size3) {
|
|
5287
5473
|
if (size3 === "sm") {
|
|
@@ -5583,7 +5769,7 @@ function dialog_default(Alpine) {
|
|
|
5583
5769
|
el.classList.add("order-1", "text-lg", "leading-none", "font-semibold");
|
|
5584
5770
|
el.setAttribute("data-slot", "dialog-title");
|
|
5585
5771
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
5586
|
-
if (dialog &&
|
|
5772
|
+
if (dialog && !dialog.hasAttribute("aria-labelledby") && !dialog.hasAttribute("aria-label")) {
|
|
5587
5773
|
if (!el.hasAttribute("id")) {
|
|
5588
5774
|
const id = `dht${uuid_default()}`;
|
|
5589
5775
|
el.setAttribute("id", id);
|
|
@@ -5616,7 +5802,7 @@ function dialog_default(Alpine) {
|
|
|
5616
5802
|
el.classList.add("order-3", "col-span-full", "text-muted-foreground", "text-sm");
|
|
5617
5803
|
el.setAttribute("data-slot", "dialog-description");
|
|
5618
5804
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
5619
|
-
if (dialog &&
|
|
5805
|
+
if (dialog && !dialog.hasAttribute("aria-describedby") && !dialog.hasAttribute("aria-description")) {
|
|
5620
5806
|
if (!el.hasAttribute("id")) {
|
|
5621
5807
|
const id = `dhd${uuid_default()}`;
|
|
5622
5808
|
el.setAttribute("id", id);
|
|
@@ -5935,7 +6121,7 @@ function info_page_default(Alpine) {
|
|
|
5935
6121
|
});
|
|
5936
6122
|
Alpine.directive("h-info-page-content", (el) => {
|
|
5937
6123
|
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-
|
|
6124
|
+
el.setAttribute("data-slot", "info-page-content");
|
|
5939
6125
|
});
|
|
5940
6126
|
}
|
|
5941
6127
|
|
|
@@ -7886,6 +8072,7 @@ function select_default(Alpine) {
|
|
|
7886
8072
|
displayValue.innerText = value;
|
|
7887
8073
|
displayValue.classList.add("text-muted-foreground");
|
|
7888
8074
|
} else {
|
|
8075
|
+
displayValue.innerText = "";
|
|
7889
8076
|
displayValue.classList.remove("text-muted-foreground");
|
|
7890
8077
|
}
|
|
7891
8078
|
}
|
|
@@ -8363,7 +8550,7 @@ function select_default(Alpine) {
|
|
|
8363
8550
|
}
|
|
8364
8551
|
} else if (select._h_model.get() !== getValue()) {
|
|
8365
8552
|
select._h_model.set(getValue());
|
|
8366
|
-
} else {
|
|
8553
|
+
} else if (select.getAttribute("data-clearable") === "true") {
|
|
8367
8554
|
select._h_model.set("");
|
|
8368
8555
|
}
|
|
8369
8556
|
}
|
|
@@ -10904,13 +11091,13 @@ function tooltip_default(Alpine) {
|
|
|
10904
11091
|
Alpine.directive("h-tooltip-trigger", (el, _, { Alpine: Alpine2, cleanup }) => {
|
|
10905
11092
|
el._tooltip = Alpine2.reactive({
|
|
10906
11093
|
id: void 0,
|
|
10907
|
-
controls: `
|
|
11094
|
+
controls: `htp${uuid_default()}`,
|
|
10908
11095
|
shown: false
|
|
10909
11096
|
});
|
|
10910
11097
|
if (el.hasAttribute("id")) {
|
|
10911
11098
|
el._tooltip.id = el.getAttribute("id");
|
|
10912
11099
|
} else {
|
|
10913
|
-
el._tooltip.id = `
|
|
11100
|
+
el._tooltip.id = `htt${uuid_default()}`;
|
|
10914
11101
|
el.setAttribute("id", el._tooltip.id);
|
|
10915
11102
|
}
|
|
10916
11103
|
el.setAttribute("aria-describedby", el._tooltip.controls);
|
|
@@ -11244,7 +11431,7 @@ function tree_default(Alpine) {
|
|
|
11244
11431
|
}
|
|
11245
11432
|
|
|
11246
11433
|
// package.json
|
|
11247
|
-
var version = "1.
|
|
11434
|
+
var version = "1.10.0";
|
|
11248
11435
|
|
|
11249
11436
|
// src/utils/theme.js
|
|
11250
11437
|
var colorSchemeKey = "codbex.harmonia.colorMode";
|
|
@@ -11489,6 +11676,7 @@ export {
|
|
|
11489
11676
|
calendar_default as Calendar,
|
|
11490
11677
|
card_default as Card,
|
|
11491
11678
|
checkbox_default as Checkbox,
|
|
11679
|
+
chip_default as Chip,
|
|
11492
11680
|
datepicker_default as DatePicker,
|
|
11493
11681
|
dialog_default as Dialog,
|
|
11494
11682
|
expansion_panel_default as ExpansionPanel,
|