@loomui-ng/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +46 -2
- package/accordion/README.md +38 -0
- package/alert/README.md +32 -0
- package/alert-dialog/README.md +37 -0
- package/aspect-ratio/README.md +24 -0
- package/attachment/README.md +40 -0
- package/avatar/README.md +34 -0
- package/badge/README.md +29 -0
- package/breadcrumb/README.md +33 -0
- package/bubble/README.md +32 -0
- package/button/README.md +31 -0
- package/button-group/README.md +30 -0
- package/calendar/README.md +35 -0
- package/card/README.md +41 -0
- package/carousel/README.md +41 -0
- package/chart/README.md +25 -0
- package/checkbox/README.md +31 -0
- package/collapsible/README.md +31 -0
- package/combobox/README.md +47 -0
- package/command/README.md +44 -0
- package/context-menu/README.md +36 -0
- package/data-table/README.md +39 -0
- package/date-picker/README.md +23 -0
- package/dialog/README.md +52 -0
- package/direction/README.md +19 -0
- package/drawer/README.md +37 -0
- package/dropdown-menu/README.md +46 -0
- package/empty/README.md +38 -0
- package/fesm2022/loomui-ng-ui-accordion.mjs +555 -0
- package/fesm2022/loomui-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-alert-dialog.mjs +652 -0
- package/fesm2022/loomui-ng-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-alert.mjs +286 -0
- package/fesm2022/loomui-ng-ui-alert.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-aspect-ratio.mjs +97 -0
- package/fesm2022/loomui-ng-ui-aspect-ratio.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-attachment.mjs +713 -0
- package/fesm2022/loomui-ng-ui-attachment.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-avatar.mjs +561 -0
- package/fesm2022/loomui-ng-ui-avatar.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-badge.mjs +102 -0
- package/fesm2022/loomui-ng-ui-badge.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-breadcrumb.mjs +520 -0
- package/fesm2022/loomui-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-bubble.mjs +386 -0
- package/fesm2022/loomui-ng-ui-bubble.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-button-group.mjs +193 -0
- package/fesm2022/loomui-ng-ui-button-group.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-button.mjs +162 -0
- package/fesm2022/loomui-ng-ui-button.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-calendar.mjs +681 -0
- package/fesm2022/loomui-ng-ui-calendar.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-card.mjs +461 -0
- package/fesm2022/loomui-ng-ui-card.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-carousel.mjs +532 -0
- package/fesm2022/loomui-ng-ui-carousel.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-chart.mjs +373 -0
- package/fesm2022/loomui-ng-ui-chart.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-checkbox.mjs +265 -0
- package/fesm2022/loomui-ng-ui-checkbox.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-collapsible.mjs +274 -0
- package/fesm2022/loomui-ng-ui-collapsible.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-combobox.mjs +971 -0
- package/fesm2022/loomui-ng-ui-combobox.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-command.mjs +982 -0
- package/fesm2022/loomui-ng-ui-command.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-context-menu.mjs +1359 -0
- package/fesm2022/loomui-ng-ui-context-menu.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-data-table.mjs +535 -0
- package/fesm2022/loomui-ng-ui-data-table.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-date-picker.mjs +312 -0
- package/fesm2022/loomui-ng-ui-date-picker.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-dialog.mjs +508 -0
- package/fesm2022/loomui-ng-ui-dialog.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-direction.mjs +112 -0
- package/fesm2022/loomui-ng-ui-direction.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-drawer.mjs +590 -0
- package/fesm2022/loomui-ng-ui-drawer.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-dropdown-menu.mjs +1322 -0
- package/fesm2022/loomui-ng-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-empty.mjs +408 -0
- package/fesm2022/loomui-ng-ui-empty.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-field.mjs +630 -0
- package/fesm2022/loomui-ng-ui-field.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-hover-card.mjs +230 -0
- package/fesm2022/loomui-ng-ui-hover-card.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-icon.mjs +498 -0
- package/fesm2022/loomui-ng-ui-icon.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-input-group.mjs +463 -0
- package/fesm2022/loomui-ng-ui-input-group.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-input-otp.mjs +586 -0
- package/fesm2022/loomui-ng-ui-input-otp.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-input.mjs +289 -0
- package/fesm2022/loomui-ng-ui-input.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-item.mjs +598 -0
- package/fesm2022/loomui-ng-ui-item.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-kbd.mjs +129 -0
- package/fesm2022/loomui-ng-ui-kbd.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-label.mjs +68 -0
- package/fesm2022/loomui-ng-ui-label.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-marker.mjs +234 -0
- package/fesm2022/loomui-ng-ui-marker.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-menubar.mjs +1523 -0
- package/fesm2022/loomui-ng-ui-menubar.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-message-scroller.mjs +519 -0
- package/fesm2022/loomui-ng-ui-message-scroller.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-message.mjs +408 -0
- package/fesm2022/loomui-ng-ui-message.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-native-select.mjs +389 -0
- package/fesm2022/loomui-ng-ui-native-select.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-navigation-menu.mjs +609 -0
- package/fesm2022/loomui-ng-ui-navigation-menu.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-pagination.mjs +611 -0
- package/fesm2022/loomui-ng-ui-pagination.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-popover.mjs +358 -0
- package/fesm2022/loomui-ng-ui-popover.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-progress.mjs +159 -0
- package/fesm2022/loomui-ng-ui-progress.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-questionnaire.mjs +1012 -0
- package/fesm2022/loomui-ng-ui-questionnaire.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-radio-group.mjs +399 -0
- package/fesm2022/loomui-ng-ui-radio-group.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-resizable.mjs +518 -0
- package/fesm2022/loomui-ng-ui-resizable.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-scroll-area.mjs +135 -0
- package/fesm2022/loomui-ng-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-select.mjs +863 -0
- package/fesm2022/loomui-ng-ui-select.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-separator.mjs +114 -0
- package/fesm2022/loomui-ng-ui-separator.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-sheet.mjs +530 -0
- package/fesm2022/loomui-ng-ui-sheet.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-sidebar.mjs +1918 -0
- package/fesm2022/loomui-ng-ui-sidebar.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-skeleton.mjs +69 -0
- package/fesm2022/loomui-ng-ui-skeleton.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-slider.mjs +390 -0
- package/fesm2022/loomui-ng-ui-slider.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-spinner.mjs +85 -0
- package/fesm2022/loomui-ng-ui-spinner.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-switch.mjs +212 -0
- package/fesm2022/loomui-ng-ui-switch.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-table.mjs +559 -0
- package/fesm2022/loomui-ng-ui-table.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-tabs.mjs +544 -0
- package/fesm2022/loomui-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-textarea.mjs +206 -0
- package/fesm2022/loomui-ng-ui-textarea.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-toast.mjs +432 -0
- package/fesm2022/loomui-ng-ui-toast.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-toggle-group.mjs +477 -0
- package/fesm2022/loomui-ng-ui-toggle-group.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-toggle.mjs +219 -0
- package/fesm2022/loomui-ng-ui-toggle.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-tooltip.mjs +240 -0
- package/fesm2022/loomui-ng-ui-tooltip.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-typography.mjs +129 -0
- package/fesm2022/loomui-ng-ui-typography.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-utils.mjs +1533 -0
- package/fesm2022/loomui-ng-ui-utils.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui.mjs +4 -0
- package/fesm2022/loomui-ng-ui.mjs.map +1 -0
- package/field/README.md +43 -0
- package/hover-card/README.md +31 -0
- package/icon/README.md +42 -0
- package/input/README.md +26 -0
- package/input-group/README.md +40 -0
- package/input-otp/README.md +35 -0
- package/item/README.md +33 -0
- package/kbd/README.md +21 -0
- package/label/README.md +24 -0
- package/marker/README.md +24 -0
- package/menubar/README.md +40 -0
- package/message/README.md +32 -0
- package/message-scroller/README.md +40 -0
- package/native-select/README.md +26 -0
- package/navigation-menu/README.md +39 -0
- package/package.json +325 -3
- package/pagination/README.md +37 -0
- package/popover/README.md +37 -0
- package/progress/README.md +25 -0
- package/questionnaire/README.md +52 -0
- package/radio-group/README.md +33 -0
- package/resizable/README.md +37 -0
- package/scroll-area/README.md +25 -0
- package/select/README.md +45 -0
- package/separator/README.md +28 -0
- package/sheet/README.md +38 -0
- package/sidebar/README.md +60 -0
- package/skeleton/README.md +21 -0
- package/slider/README.md +29 -0
- package/spinner/README.md +15 -0
- package/styles/loomui.css +330 -0
- package/switch/README.md +29 -0
- package/table/README.md +31 -0
- package/tabs/README.md +42 -0
- package/textarea/README.md +28 -0
- package/toast/README.md +27 -0
- package/toggle/README.md +27 -0
- package/toggle-group/README.md +37 -0
- package/tooltip/README.md +31 -0
- package/types/loomui-ng-ui-accordion.d.ts +141 -0
- package/types/loomui-ng-ui-alert-dialog.d.ts +175 -0
- package/types/loomui-ng-ui-alert.d.ts +77 -0
- package/types/loomui-ng-ui-aspect-ratio.d.ts +31 -0
- package/types/loomui-ng-ui-attachment.d.ts +192 -0
- package/types/loomui-ng-ui-avatar.d.ts +147 -0
- package/types/loomui-ng-ui-badge.d.ts +32 -0
- package/types/loomui-ng-ui-breadcrumb.d.ts +118 -0
- package/types/loomui-ng-ui-bubble.d.ts +100 -0
- package/types/loomui-ng-ui-button-group.d.ts +51 -0
- package/types/loomui-ng-ui-button.d.ts +57 -0
- package/types/loomui-ng-ui-calendar.d.ts +171 -0
- package/types/loomui-ng-ui-card.d.ts +123 -0
- package/types/loomui-ng-ui-carousel.d.ts +140 -0
- package/types/loomui-ng-ui-chart.d.ts +95 -0
- package/types/loomui-ng-ui-checkbox.d.ts +62 -0
- package/types/loomui-ng-ui-collapsible.d.ts +74 -0
- package/types/loomui-ng-ui-combobox.d.ts +229 -0
- package/types/loomui-ng-ui-command.d.ts +231 -0
- package/types/loomui-ng-ui-context-menu.d.ts +288 -0
- package/types/loomui-ng-ui-data-table.d.ts +111 -0
- package/types/loomui-ng-ui-date-picker.d.ts +63 -0
- package/types/loomui-ng-ui-dialog.d.ts +127 -0
- package/types/loomui-ng-ui-direction.d.ts +42 -0
- package/types/loomui-ng-ui-drawer.d.ts +149 -0
- package/types/loomui-ng-ui-dropdown-menu.d.ts +258 -0
- package/types/loomui-ng-ui-empty.d.ts +109 -0
- package/types/loomui-ng-ui-field.d.ts +169 -0
- package/types/loomui-ng-ui-hover-card.d.ts +62 -0
- package/types/loomui-ng-ui-icon.d.ts +156 -0
- package/types/loomui-ng-ui-input-group.d.ts +130 -0
- package/types/loomui-ng-ui-input-otp.d.ts +149 -0
- package/types/loomui-ng-ui-input.d.ts +89 -0
- package/types/loomui-ng-ui-item.d.ts +157 -0
- package/types/loomui-ng-ui-kbd.d.ts +36 -0
- package/types/loomui-ng-ui-label.d.ts +19 -0
- package/types/loomui-ng-ui-marker.d.ts +61 -0
- package/types/loomui-ng-ui-menubar.d.ts +321 -0
- package/types/loomui-ng-ui-message-scroller.d.ts +138 -0
- package/types/loomui-ng-ui-message.d.ts +109 -0
- package/types/loomui-ng-ui-native-select.d.ts +84 -0
- package/types/loomui-ng-ui-navigation-menu.d.ts +160 -0
- package/types/loomui-ng-ui-pagination.d.ts +130 -0
- package/types/loomui-ng-ui-popover.d.ts +90 -0
- package/types/loomui-ng-ui-progress.d.ts +39 -0
- package/types/loomui-ng-ui-questionnaire.d.ts +274 -0
- package/types/loomui-ng-ui-radio-group.d.ts +109 -0
- package/types/loomui-ng-ui-resizable.d.ts +121 -0
- package/types/loomui-ng-ui-scroll-area.d.ts +44 -0
- package/types/loomui-ng-ui-select.d.ts +204 -0
- package/types/loomui-ng-ui-separator.d.ts +35 -0
- package/types/loomui-ng-ui-sheet.d.ts +124 -0
- package/types/loomui-ng-ui-sidebar.d.ts +485 -0
- package/types/loomui-ng-ui-skeleton.d.ts +20 -0
- package/types/loomui-ng-ui-slider.d.ts +103 -0
- package/types/loomui-ng-ui-spinner.d.ts +19 -0
- package/types/loomui-ng-ui-switch.d.ts +56 -0
- package/types/loomui-ng-ui-table.d.ts +148 -0
- package/types/loomui-ng-ui-tabs.d.ts +148 -0
- package/types/loomui-ng-ui-textarea.d.ts +52 -0
- package/types/loomui-ng-ui-toast.d.ts +97 -0
- package/types/loomui-ng-ui-toggle-group.d.ts +138 -0
- package/types/loomui-ng-ui-toggle.d.ts +63 -0
- package/types/loomui-ng-ui-tooltip.d.ts +63 -0
- package/types/loomui-ng-ui-typography.d.ts +42 -0
- package/types/loomui-ng-ui-utils.d.ts +392 -0
- package/types/loomui-ng-ui.d.ts +5 -0
- package/typography/README.md +29 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Directive, booleanAttribute, computed, forwardRef, input, model, signal } from "@angular/core";
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import * as i1 from "@loomui-ng/ui/utils";
|
|
6
|
+
import { UiElementHost, cn } from "@loomui-ng/ui/utils";
|
|
7
|
+
const toggleVariants = cva("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-transparent hover:bg-muted",
|
|
11
|
+
outline: "border border-input bg-transparent hover:bg-muted"
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",
|
|
15
|
+
sm: "h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
16
|
+
lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: "default",
|
|
21
|
+
size: "default"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var UiToggle = class UiToggle {
|
|
25
|
+
pressed = model(false, ...ngDevMode ? [{ debugName: "pressed" }] : /* istanbul ignore next */ []);
|
|
26
|
+
variant = input("default", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
27
|
+
size = input("default", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
28
|
+
disabled = input(false, {
|
|
29
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
30
|
+
transform: booleanAttribute
|
|
31
|
+
});
|
|
32
|
+
userClass = input("", {
|
|
33
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
34
|
+
alias: "class"
|
|
35
|
+
});
|
|
36
|
+
cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
37
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
38
|
+
classes = computed(() => cn(toggleVariants({
|
|
39
|
+
variant: this.variant(),
|
|
40
|
+
size: this.size()
|
|
41
|
+
}), this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
42
|
+
onChange = () => {};
|
|
43
|
+
onTouched = () => {};
|
|
44
|
+
toggle() {
|
|
45
|
+
if (this.isDisabled()) return;
|
|
46
|
+
const next = !this.pressed();
|
|
47
|
+
this.pressed.set(next);
|
|
48
|
+
this.onChange(next);
|
|
49
|
+
}
|
|
50
|
+
writeValue(v) {
|
|
51
|
+
this.pressed.set(!!v);
|
|
52
|
+
}
|
|
53
|
+
registerOnChange(fn) {
|
|
54
|
+
this.onChange = fn;
|
|
55
|
+
}
|
|
56
|
+
registerOnTouched(fn) {
|
|
57
|
+
this.onTouched = fn;
|
|
58
|
+
}
|
|
59
|
+
setDisabledState(d) {
|
|
60
|
+
this.cvaDisabled.set(d);
|
|
61
|
+
}
|
|
62
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
63
|
+
minVersion: "12.0.0",
|
|
64
|
+
version: "22.2.2",
|
|
65
|
+
ngImport: i0,
|
|
66
|
+
type: UiToggle,
|
|
67
|
+
deps: [],
|
|
68
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
69
|
+
});
|
|
70
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
71
|
+
minVersion: "17.1.0",
|
|
72
|
+
version: "22.2.2",
|
|
73
|
+
type: UiToggle,
|
|
74
|
+
isStandalone: true,
|
|
75
|
+
selector: "button[uiToggle], ui-toggle",
|
|
76
|
+
inputs: {
|
|
77
|
+
pressed: {
|
|
78
|
+
classPropertyName: "pressed",
|
|
79
|
+
publicName: "pressed",
|
|
80
|
+
isSignal: true,
|
|
81
|
+
isRequired: false,
|
|
82
|
+
transformFunction: null
|
|
83
|
+
},
|
|
84
|
+
variant: {
|
|
85
|
+
classPropertyName: "variant",
|
|
86
|
+
publicName: "variant",
|
|
87
|
+
isSignal: true,
|
|
88
|
+
isRequired: false,
|
|
89
|
+
transformFunction: null
|
|
90
|
+
},
|
|
91
|
+
size: {
|
|
92
|
+
classPropertyName: "size",
|
|
93
|
+
publicName: "size",
|
|
94
|
+
isSignal: true,
|
|
95
|
+
isRequired: false,
|
|
96
|
+
transformFunction: null
|
|
97
|
+
},
|
|
98
|
+
disabled: {
|
|
99
|
+
classPropertyName: "disabled",
|
|
100
|
+
publicName: "disabled",
|
|
101
|
+
isSignal: true,
|
|
102
|
+
isRequired: false,
|
|
103
|
+
transformFunction: null
|
|
104
|
+
},
|
|
105
|
+
userClass: {
|
|
106
|
+
classPropertyName: "userClass",
|
|
107
|
+
publicName: "class",
|
|
108
|
+
isSignal: true,
|
|
109
|
+
isRequired: false,
|
|
110
|
+
transformFunction: null
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
outputs: { pressed: "pressedChange" },
|
|
114
|
+
host: {
|
|
115
|
+
attributes: {
|
|
116
|
+
"type": "button",
|
|
117
|
+
"data-slot": "toggle"
|
|
118
|
+
},
|
|
119
|
+
listeners: {
|
|
120
|
+
"click": "toggle()",
|
|
121
|
+
"blur": "onTouched()"
|
|
122
|
+
},
|
|
123
|
+
properties: {
|
|
124
|
+
"attr.aria-pressed": "pressed()",
|
|
125
|
+
"attr.data-state": "pressed() ? \"on\" : \"off\"",
|
|
126
|
+
"attr.data-disabled": "isDisabled() ? \"\" : null",
|
|
127
|
+
"attr.disabled": "(isDisabled()) ? \"\" : null",
|
|
128
|
+
"attr.class": "classes()"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
providers: [{
|
|
132
|
+
provide: NG_VALUE_ACCESSOR,
|
|
133
|
+
useExisting: forwardRef(() => UiToggle),
|
|
134
|
+
multi: true
|
|
135
|
+
}],
|
|
136
|
+
exportAs: ["uiToggle"],
|
|
137
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
138
|
+
ngImport: i0
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
142
|
+
minVersion: "12.0.0",
|
|
143
|
+
version: "22.2.2",
|
|
144
|
+
ngImport: i0,
|
|
145
|
+
type: UiToggle,
|
|
146
|
+
decorators: [{
|
|
147
|
+
type: Directive,
|
|
148
|
+
args: [{
|
|
149
|
+
selector: "button[uiToggle], ui-toggle",
|
|
150
|
+
hostDirectives: [UiElementHost],
|
|
151
|
+
exportAs: "uiToggle",
|
|
152
|
+
providers: [{
|
|
153
|
+
provide: NG_VALUE_ACCESSOR,
|
|
154
|
+
useExisting: forwardRef(() => UiToggle),
|
|
155
|
+
multi: true
|
|
156
|
+
}],
|
|
157
|
+
host: {
|
|
158
|
+
type: "button",
|
|
159
|
+
"data-slot": "toggle",
|
|
160
|
+
"[attr.aria-pressed]": "pressed()",
|
|
161
|
+
"[attr.data-state]": "pressed() ? \"on\" : \"off\"",
|
|
162
|
+
"[attr.data-disabled]": "isDisabled() ? \"\" : null",
|
|
163
|
+
"[attr.disabled]": "(isDisabled()) ? \"\" : null",
|
|
164
|
+
"[attr.class]": "classes()",
|
|
165
|
+
"(click)": "toggle()",
|
|
166
|
+
"(blur)": "onTouched()"
|
|
167
|
+
}
|
|
168
|
+
}]
|
|
169
|
+
}],
|
|
170
|
+
propDecorators: {
|
|
171
|
+
pressed: [{
|
|
172
|
+
type: i0.Input,
|
|
173
|
+
args: [{
|
|
174
|
+
isSignal: true,
|
|
175
|
+
alias: "pressed",
|
|
176
|
+
required: false
|
|
177
|
+
}]
|
|
178
|
+
}, {
|
|
179
|
+
type: i0.Output,
|
|
180
|
+
args: ["pressedChange"]
|
|
181
|
+
}],
|
|
182
|
+
variant: [{
|
|
183
|
+
type: i0.Input,
|
|
184
|
+
args: [{
|
|
185
|
+
isSignal: true,
|
|
186
|
+
alias: "variant",
|
|
187
|
+
required: false
|
|
188
|
+
}]
|
|
189
|
+
}],
|
|
190
|
+
size: [{
|
|
191
|
+
type: i0.Input,
|
|
192
|
+
args: [{
|
|
193
|
+
isSignal: true,
|
|
194
|
+
alias: "size",
|
|
195
|
+
required: false
|
|
196
|
+
}]
|
|
197
|
+
}],
|
|
198
|
+
disabled: [{
|
|
199
|
+
type: i0.Input,
|
|
200
|
+
args: [{
|
|
201
|
+
isSignal: true,
|
|
202
|
+
alias: "disabled",
|
|
203
|
+
required: false
|
|
204
|
+
}]
|
|
205
|
+
}],
|
|
206
|
+
userClass: [{
|
|
207
|
+
type: i0.Input,
|
|
208
|
+
args: [{
|
|
209
|
+
isSignal: true,
|
|
210
|
+
alias: "class",
|
|
211
|
+
required: false
|
|
212
|
+
}]
|
|
213
|
+
}]
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const UI_TOGGLE = [UiToggle];
|
|
217
|
+
export { UI_TOGGLE, UiToggle, toggleVariants };
|
|
218
|
+
|
|
219
|
+
//# sourceMappingURL=loomui-ng-ui-toggle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomui-ng-ui-toggle.mjs","names":[],"sources":["../../../libs/ui/toggle/toggle.ts"],"sourcesContent":["import { booleanAttribute, computed, Directive, forwardRef, input, model, signal } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '@loomui-ng/ui/utils';\nimport { UiElementHost } from '@loomui-ng/ui/utils';\n\n/** Classes derived from the live Toggle (docs/behavior-specs/toggle.md); pl/pr → ps/pe for RTL. */\nexport const toggleVariants = cva(\n \"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: 'bg-transparent hover:bg-muted',\n outline: 'border border-input bg-transparent hover:bg-muted',\n },\n size: {\n default: 'h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2',\n sm: \"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n lg: 'h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n);\nexport type ToggleVariants = VariantProps<typeof toggleVariants>;\n\n/** <button uiToggle [(pressed)]=\"bold\" aria-label=\"Toggle bold\">B</button> */\n@Directive({\n selector: 'button[uiToggle], ui-toggle', hostDirectives: [UiElementHost],\n exportAs: 'uiToggle',\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiToggle), multi: true }],\n host: {\n type: 'button',\n 'data-slot': 'toggle',\n '[attr.aria-pressed]': 'pressed()',\n '[attr.data-state]': 'pressed() ? \"on\" : \"off\"',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : null',\n '[attr.disabled]': '(isDisabled()) ? \"\" : null',\n '[attr.class]': 'classes()',\n '(click)': 'toggle()',\n '(blur)': 'onTouched()',\n },\n})\nexport class UiToggle implements ControlValueAccessor {\n readonly pressed = model(false);\n readonly variant = input<NonNullable<ToggleVariants['variant']>>('default');\n readonly size = input<NonNullable<ToggleVariants['size']>>('default');\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly userClass = input<string>('', { alias: 'class' });\n private readonly cvaDisabled = signal(false);\n protected readonly isDisabled = computed(() => this.disabled() || this.cvaDisabled());\n protected readonly classes = computed(() => cn(toggleVariants({ variant: this.variant(), size: this.size() }), this.userClass()));\n\n private onChange: (v: boolean) => void = () => {};\n protected onTouched: () => void = () => {};\n\n protected toggle(): void {\n if (this.isDisabled()) return;\n const next = !this.pressed();\n this.pressed.set(next);\n this.onChange(next);\n }\n writeValue(v: boolean | null): void {\n this.pressed.set(!!v);\n }\n registerOnChange(fn: (v: boolean) => void): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: () => void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;GAAE,SAAS;GAAmB,aAAa,iBAAiB,QAAQ;GAAG,OAAO;EAAI,CAAE;EAAC,UAAA,CAAA,UAAA;EAAA,gBAAA,CAAA,EAAA,WAAA,GAAA,cAAA,CAAA;EAAA,UAAA;CAAA,CAAA;;AAatF,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EAhBpB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GAA+B,gBAAgB,CAAC,aAAa;GACvE,UAAU;GACV,WAAW,CAAC;IAAE,SAAS;IAAmB,aAAa,iBAAgB,QAAS;IAAG,OAAO;GAAI,CAAE;GAChG,MAAM;IACJ,MAAM;IACN,aAAa;IACb,uBAAuB;IACvB,qBAAqB;IACrB,wBAAwB;IACxB,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;IACX,UAAU;GACX;EACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCD,MAAa,YAAY,CAAC,QAAQ"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { DestroyRef, Directive, ElementRef, computed, inject, input, numberAttribute, signal } from "@angular/core";
|
|
3
|
+
import * as i1 from "@loomui-ng/ui/utils";
|
|
4
|
+
import { UiElementHost, UiLayerRoot, UiPopperContentBase, cn } from "@loomui-ng/ui/utils";
|
|
5
|
+
const CONTENT_CLASS = "z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pe-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95";
|
|
6
|
+
var UiTooltip = class UiTooltip extends UiLayerRoot {
|
|
7
|
+
delay = input(0, {
|
|
8
|
+
...ngDevMode ? { debugName: "delay" } : /* istanbul ignore next */ {},
|
|
9
|
+
transform: numberAttribute
|
|
10
|
+
});
|
|
11
|
+
openedBy = signal("hover", ...ngDevMode ? [{ debugName: "openedBy" }] : /* istanbul ignore next */ []);
|
|
12
|
+
timer;
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
inject(DestroyRef).onDestroy(() => clearTimeout(this.timer));
|
|
16
|
+
}
|
|
17
|
+
show(by) {
|
|
18
|
+
clearTimeout(this.timer);
|
|
19
|
+
this.openedBy.set(by);
|
|
20
|
+
if (by === "focus" || this.delay() === 0) return this.open.set(true);
|
|
21
|
+
this.timer = setTimeout(() => this.open.set(true), this.delay());
|
|
22
|
+
}
|
|
23
|
+
hide(graceMs = 0) {
|
|
24
|
+
clearTimeout(this.timer);
|
|
25
|
+
if (!graceMs) return this.open.set(false);
|
|
26
|
+
this.timer = setTimeout(() => this.open.set(false), graceMs);
|
|
27
|
+
}
|
|
28
|
+
cancelHide() {
|
|
29
|
+
clearTimeout(this.timer);
|
|
30
|
+
}
|
|
31
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
32
|
+
minVersion: "12.0.0",
|
|
33
|
+
version: "22.2.2",
|
|
34
|
+
ngImport: i0,
|
|
35
|
+
type: UiTooltip,
|
|
36
|
+
deps: [],
|
|
37
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
38
|
+
});
|
|
39
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
40
|
+
minVersion: "17.1.0",
|
|
41
|
+
version: "22.2.2",
|
|
42
|
+
type: UiTooltip,
|
|
43
|
+
isStandalone: true,
|
|
44
|
+
selector: "[uiTooltip], ui-tooltip",
|
|
45
|
+
inputs: { delay: {
|
|
46
|
+
classPropertyName: "delay",
|
|
47
|
+
publicName: "delay",
|
|
48
|
+
isSignal: true,
|
|
49
|
+
isRequired: false,
|
|
50
|
+
transformFunction: null
|
|
51
|
+
} },
|
|
52
|
+
exportAs: ["uiTooltip"],
|
|
53
|
+
usesInheritance: true,
|
|
54
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
55
|
+
ngImport: i0
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
59
|
+
minVersion: "12.0.0",
|
|
60
|
+
version: "22.2.2",
|
|
61
|
+
ngImport: i0,
|
|
62
|
+
type: UiTooltip,
|
|
63
|
+
decorators: [{
|
|
64
|
+
type: Directive,
|
|
65
|
+
args: [{
|
|
66
|
+
selector: "[uiTooltip], ui-tooltip",
|
|
67
|
+
hostDirectives: [UiElementHost],
|
|
68
|
+
exportAs: "uiTooltip"
|
|
69
|
+
}]
|
|
70
|
+
}],
|
|
71
|
+
ctorParameters: () => [],
|
|
72
|
+
propDecorators: { delay: [{
|
|
73
|
+
type: i0.Input,
|
|
74
|
+
args: [{
|
|
75
|
+
isSignal: true,
|
|
76
|
+
alias: "delay",
|
|
77
|
+
required: false
|
|
78
|
+
}]
|
|
79
|
+
}] }
|
|
80
|
+
});
|
|
81
|
+
var UiTooltipTrigger = class UiTooltipTrigger {
|
|
82
|
+
tip = inject(UiTooltip);
|
|
83
|
+
constructor() {
|
|
84
|
+
this.tip.trigger.set(inject(ElementRef).nativeElement);
|
|
85
|
+
}
|
|
86
|
+
onEnter(e) {
|
|
87
|
+
if (e.pointerType === "touch") return;
|
|
88
|
+
this.tip.show("hover");
|
|
89
|
+
}
|
|
90
|
+
onFocus() {
|
|
91
|
+
if (this.tip.trigger()?.matches(":focus-visible")) this.tip.show("focus");
|
|
92
|
+
}
|
|
93
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
94
|
+
minVersion: "12.0.0",
|
|
95
|
+
version: "22.2.2",
|
|
96
|
+
ngImport: i0,
|
|
97
|
+
type: UiTooltipTrigger,
|
|
98
|
+
deps: [],
|
|
99
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
100
|
+
});
|
|
101
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
102
|
+
minVersion: "14.0.0",
|
|
103
|
+
version: "22.2.2",
|
|
104
|
+
type: UiTooltipTrigger,
|
|
105
|
+
isStandalone: true,
|
|
106
|
+
selector: "[uiTooltipTrigger], ui-tooltip-trigger",
|
|
107
|
+
host: {
|
|
108
|
+
attributes: { "data-slot": "tooltip-trigger" },
|
|
109
|
+
listeners: {
|
|
110
|
+
"pointerenter": "onEnter($event)",
|
|
111
|
+
"pointerleave": "tip.hide(100)",
|
|
112
|
+
"focus": "onFocus()",
|
|
113
|
+
"blur": "tip.hide()",
|
|
114
|
+
"pointerdown": "tip.hide()",
|
|
115
|
+
"keydown.escape": "tip.hide()"
|
|
116
|
+
},
|
|
117
|
+
properties: {
|
|
118
|
+
"attr.data-state": "tip.open() ? (tip.openedBy() === \"hover\" ? \"delayed-open\" : \"instant-open\") : \"closed\"",
|
|
119
|
+
"attr.aria-describedby": "tip.open() ? tip.id + \"-tip\" : null"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
123
|
+
ngImport: i0
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
127
|
+
minVersion: "12.0.0",
|
|
128
|
+
version: "22.2.2",
|
|
129
|
+
ngImport: i0,
|
|
130
|
+
type: UiTooltipTrigger,
|
|
131
|
+
decorators: [{
|
|
132
|
+
type: Directive,
|
|
133
|
+
args: [{
|
|
134
|
+
selector: "[uiTooltipTrigger], ui-tooltip-trigger",
|
|
135
|
+
hostDirectives: [UiElementHost],
|
|
136
|
+
host: {
|
|
137
|
+
"data-slot": "tooltip-trigger",
|
|
138
|
+
"[attr.data-state]": "tip.open() ? (tip.openedBy() === \"hover\" ? \"delayed-open\" : \"instant-open\") : \"closed\"",
|
|
139
|
+
"[attr.aria-describedby]": "tip.open() ? tip.id + \"-tip\" : null",
|
|
140
|
+
"(pointerenter)": "onEnter($event)",
|
|
141
|
+
"(pointerleave)": "tip.hide(100)",
|
|
142
|
+
"(focus)": "onFocus()",
|
|
143
|
+
"(blur)": "tip.hide()",
|
|
144
|
+
"(pointerdown)": "tip.hide()",
|
|
145
|
+
"(keydown.escape)": "tip.hide()"
|
|
146
|
+
}
|
|
147
|
+
}]
|
|
148
|
+
}],
|
|
149
|
+
ctorParameters: () => []
|
|
150
|
+
});
|
|
151
|
+
var UiTooltipContent = class UiTooltipContent extends UiPopperContentBase {
|
|
152
|
+
root = inject(UiTooltip);
|
|
153
|
+
varPrefix = "--radix-tooltip";
|
|
154
|
+
classes = computed(() => cn(CONTENT_CLASS, this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
155
|
+
sr = null;
|
|
156
|
+
arrow = null;
|
|
157
|
+
constructor() {
|
|
158
|
+
super();
|
|
159
|
+
this.closeOnOutside = false;
|
|
160
|
+
this.restoreFocusOnClose = false;
|
|
161
|
+
this.init();
|
|
162
|
+
}
|
|
163
|
+
onAttached() {
|
|
164
|
+
this.sr = document.createElement("span");
|
|
165
|
+
this.sr.id = `${this.root.id}-tip`;
|
|
166
|
+
this.sr.setAttribute("role", "tooltip");
|
|
167
|
+
this.sr.style.cssText = "position:absolute;border:0;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;overflow-wrap:normal";
|
|
168
|
+
this.sr.textContent = this.el.textContent;
|
|
169
|
+
this.el.appendChild(this.sr);
|
|
170
|
+
this.arrow = document.createElement("span");
|
|
171
|
+
this.arrow.setAttribute("data-slot", "tooltip-arrow");
|
|
172
|
+
this.arrow.setAttribute("aria-hidden", "true");
|
|
173
|
+
this.arrow.className = "absolute size-2.5 rotate-45 rounded-[2px] bg-foreground group-data-[side=bottom]:-top-1 group-data-[side=top]:-bottom-1 left-1/2 -translate-x-1/2";
|
|
174
|
+
this.el.classList.add("group", "relative");
|
|
175
|
+
this.el.appendChild(this.arrow);
|
|
176
|
+
}
|
|
177
|
+
onDetached() {
|
|
178
|
+
this.sr?.remove();
|
|
179
|
+
this.arrow?.remove();
|
|
180
|
+
this.sr = this.arrow = null;
|
|
181
|
+
}
|
|
182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
183
|
+
minVersion: "12.0.0",
|
|
184
|
+
version: "22.2.2",
|
|
185
|
+
ngImport: i0,
|
|
186
|
+
type: UiTooltipContent,
|
|
187
|
+
deps: [],
|
|
188
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
189
|
+
});
|
|
190
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
191
|
+
minVersion: "14.0.0",
|
|
192
|
+
version: "22.2.2",
|
|
193
|
+
type: UiTooltipContent,
|
|
194
|
+
isStandalone: true,
|
|
195
|
+
selector: "[uiTooltipContent], ui-tooltip-content",
|
|
196
|
+
host: {
|
|
197
|
+
attributes: { "data-slot": "tooltip-content" },
|
|
198
|
+
listeners: {
|
|
199
|
+
"pointerenter": "root.cancelHide()",
|
|
200
|
+
"pointerleave": "root.hide(100)"
|
|
201
|
+
},
|
|
202
|
+
properties: {
|
|
203
|
+
"attr.data-state": "root.state() === \"closed\" ? \"closed\" : root.openedBy() === \"hover\" ? \"delayed-open\" : \"instant-open\"",
|
|
204
|
+
"attr.class": "classes()"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
usesInheritance: true,
|
|
208
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
209
|
+
ngImport: i0
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
213
|
+
minVersion: "12.0.0",
|
|
214
|
+
version: "22.2.2",
|
|
215
|
+
ngImport: i0,
|
|
216
|
+
type: UiTooltipContent,
|
|
217
|
+
decorators: [{
|
|
218
|
+
type: Directive,
|
|
219
|
+
args: [{
|
|
220
|
+
selector: "[uiTooltipContent], ui-tooltip-content",
|
|
221
|
+
hostDirectives: [UiElementHost],
|
|
222
|
+
host: {
|
|
223
|
+
"data-slot": "tooltip-content",
|
|
224
|
+
"[attr.data-state]": "root.state() === \"closed\" ? \"closed\" : root.openedBy() === \"hover\" ? \"delayed-open\" : \"instant-open\"",
|
|
225
|
+
"[attr.class]": "classes()",
|
|
226
|
+
"(pointerenter)": "root.cancelHide()",
|
|
227
|
+
"(pointerleave)": "root.hide(100)"
|
|
228
|
+
}
|
|
229
|
+
}]
|
|
230
|
+
}],
|
|
231
|
+
ctorParameters: () => []
|
|
232
|
+
});
|
|
233
|
+
const UI_TOOLTIP = [
|
|
234
|
+
UiTooltip,
|
|
235
|
+
UiTooltipTrigger,
|
|
236
|
+
UiTooltipContent
|
|
237
|
+
];
|
|
238
|
+
export { UI_TOOLTIP, UiTooltip, UiTooltipContent, UiTooltipTrigger };
|
|
239
|
+
|
|
240
|
+
//# sourceMappingURL=loomui-ng-ui-tooltip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomui-ng-ui-tooltip.mjs","names":[],"sources":["../../../libs/ui/tooltip/tooltip.ts"],"sourcesContent":["import { computed, signal, DestroyRef, Directive, ElementRef, inject, input, numberAttribute } from '@angular/core';\nimport { cn } from '@loomui-ng/ui/utils';\nimport { UiLayerRoot } from '@loomui-ng/ui/utils';\nimport { UiPopperContentBase } from '@loomui-ng/ui/utils';\nimport { UiElementHost } from '@loomui-ng/ui/utils';\n\nconst CONTENT_CLASS =\n 'z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pe-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95';\n\n/**\n * <div uiTooltip class=\"contents\">\n * <button uiButton uiTooltipTrigger>Hover</button>\n * <div uiTooltipContent>Add to library</div>\n * </div>\n *\n * Observed on live site: content `data-state=\"delayed-open\"` when opened by hover; a visually-hidden\n * `role=\"tooltip\"` copy of the text is inside the content and referenced by the trigger's aria-describedby.\n */\n@Directive({ selector: '[uiTooltip], ui-tooltip', hostDirectives: [UiElementHost], exportAs: 'uiTooltip' })\nexport class UiTooltip extends UiLayerRoot {\n /** Hover-open delay in ms (shadcn default is 0). */\n readonly delay = input(0, { transform: numberAttribute });\n readonly openedBy = signal<'hover' | 'focus'>('hover');\n private timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor() {\n super();\n inject(DestroyRef).onDestroy(() => clearTimeout(this.timer));\n }\n\n show(by: 'hover' | 'focus'): void {\n clearTimeout(this.timer);\n this.openedBy.set(by);\n if (by === 'focus' || this.delay() === 0) return this.open.set(true);\n this.timer = setTimeout(() => this.open.set(true), this.delay());\n }\n\n hide(graceMs = 0): void {\n clearTimeout(this.timer);\n if (!graceMs) return this.open.set(false);\n this.timer = setTimeout(() => this.open.set(false), graceMs);\n }\n\n cancelHide(): void {\n clearTimeout(this.timer);\n }\n}\n\n@Directive({\n selector: '[uiTooltipTrigger], ui-tooltip-trigger', hostDirectives: [UiElementHost],\n host: {\n 'data-slot': 'tooltip-trigger',\n '[attr.data-state]': 'tip.open() ? (tip.openedBy() === \"hover\" ? \"delayed-open\" : \"instant-open\") : \"closed\"',\n '[attr.aria-describedby]': 'tip.open() ? tip.id + \"-tip\" : null',\n '(pointerenter)': 'onEnter($event)',\n '(pointerleave)': 'tip.hide(100)',\n '(focus)': 'onFocus()',\n '(blur)': 'tip.hide()',\n '(pointerdown)': 'tip.hide()',\n '(keydown.escape)': 'tip.hide()',\n },\n})\nexport class UiTooltipTrigger {\n protected readonly tip = inject(UiTooltip);\n constructor() {\n this.tip.trigger.set(inject<ElementRef<HTMLElement>>(ElementRef).nativeElement);\n }\n protected onEnter(e: PointerEvent): void {\n if (e.pointerType === 'touch') return;\n this.tip.show('hover');\n }\n protected onFocus(): void {\n // Only keyboard focus opens the tooltip (focus-visible), like Radix.\n const el = this.tip.trigger();\n if (el?.matches(':focus-visible')) this.tip.show('focus');\n }\n}\n\n@Directive({\n selector: '[uiTooltipContent], ui-tooltip-content', hostDirectives: [UiElementHost],\n host: {\n 'data-slot': 'tooltip-content',\n '[attr.data-state]': 'root.state() === \"closed\" ? \"closed\" : root.openedBy() === \"hover\" ? \"delayed-open\" : \"instant-open\"',\n '[attr.class]': 'classes()',\n '(pointerenter)': 'root.cancelHide()',\n '(pointerleave)': 'root.hide(100)',\n },\n})\nexport class UiTooltipContent extends UiPopperContentBase {\n protected readonly root = inject(UiTooltip);\n protected readonly varPrefix = '--radix-tooltip';\n protected readonly classes = computed(() => cn(CONTENT_CLASS, this.userClass()));\n private sr: HTMLElement | null = null;\n private arrow: HTMLElement | null = null;\n\n constructor() {\n super();\n this.closeOnOutside = false;\n this.restoreFocusOnClose = false;\n this.init();\n }\n\n protected override onAttached(): void {\n // Visually hidden tooltip for assistive tech (matches Radix output).\n this.sr = document.createElement('span');\n this.sr.id = `${this.root.id}-tip`;\n this.sr.setAttribute('role', 'tooltip');\n this.sr.style.cssText =\n 'position:absolute;border:0;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;overflow-wrap:normal';\n this.sr.textContent = this.el.textContent;\n this.el.appendChild(this.sr);\n\n this.arrow = document.createElement('span');\n this.arrow.setAttribute('data-slot', 'tooltip-arrow');\n this.arrow.setAttribute('aria-hidden', 'true');\n // Arrow classes are UNKNOWN on the live site (only a Radix svg was observed); a rotated square is used.\n this.arrow.className =\n 'absolute size-2.5 rotate-45 rounded-[2px] bg-foreground ' +\n 'group-data-[side=bottom]:-top-1 group-data-[side=top]:-bottom-1 left-1/2 -translate-x-1/2';\n this.el.classList.add('group', 'relative');\n this.el.appendChild(this.arrow);\n }\n\n protected override onDetached(): void {\n this.sr?.remove();\n this.arrow?.remove();\n this.sr = this.arrow = null;\n }\n}\n\nexport const UI_TOOLTIP = [UiTooltip, UiTooltipTrigger, UiTooltipContent] as const;\n"],"mappings":";;;;AAMA,MAAM,gBACJ;AAYF,IAAa,YAAb,MAAa,kBAAkB,YAAW;CAE/B,QAAQ,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW;CAAe,CAAA;CAC7C,WAAW,OAA0B,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAC9C;CAER,cAAA;EACE,MAAK;EACL,OAAO,UAAU,CAAC,CAAC,gBAAgB,aAAa,KAAK,KAAK,CAAC;CAC7D;CAEA,KAAK,IAAqB;EACxB,aAAa,KAAK,KAAK;EACvB,KAAK,SAAS,IAAI,EAAE;EACpB,IAAI,OAAO,WAAW,KAAK,MAAK,MAAO,GAAG,OAAO,KAAK,KAAK,IAAI,IAAI;EACnE,KAAK,QAAQ,iBAAiB,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,MAAK,CAAE;CACjE;CAEA,KAAK,UAAU,GAAC;EACd,aAAa,KAAK,KAAK;EACvB,IAAI,CAAC,SAAS,OAAO,KAAK,KAAK,IAAI,KAAK;EACxC,KAAK,QAAQ,iBAAiB,KAAK,KAAK,IAAI,KAAK,GAAG,OAAO;CAC7D;CAEA,aAAU;EACR,aAAa,KAAK,KAAK;CACzB;CA1BW,OAAA,OAAA,GAAA,mBAAA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C,KAAK,GAAG,YAAY,KAAK,KAAK;CAChC;CAEmB,aAAU;EAC3B,KAAK,IAAI,OAAM;EACf,KAAK,OAAO,OAAM;EAClB,KAAK,KAAK,KAAK,QAAQ;CACzB;CAvCW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAgB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAhB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAgB,cAAA;EAAA,UAAA;EAAA,MAAA;GAAA,YAAA,EAAA,aAAA,kBAAA;GAAA,WAAA;IAAA,gBAAA;IAAA,gBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,cAAA;GAAA;EAAA;EAAA,iBAAA;EAAA,gBAAA,CAAA,EAAA,WAAA,GAAA,cAAA,CAAA;EAAA,UAAA;CAAA,CAAA;;AAAhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAV5B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GAA0C,gBAAgB,CAAC,aAAa;GAClF,MAAM;IACJ,aAAa;IACb,qBAAqB;IACrB,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;GACnB;EACF,CAAA;;;;AA2CD,MAAa,aAAa;CAAC;CAAW;CAAkB;AAAgB"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Directive, computed, input } from "@angular/core";
|
|
3
|
+
import * as i1 from "@loomui-ng/ui/utils";
|
|
4
|
+
import { UiElementHost, cn } from "@loomui-ng/ui/utils";
|
|
5
|
+
const typographyClasses = {
|
|
6
|
+
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight text-balance",
|
|
7
|
+
h2: "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",
|
|
8
|
+
h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
|
|
9
|
+
h4: "scroll-m-20 text-xl font-semibold tracking-tight",
|
|
10
|
+
p: "leading-7 [&:not(:first-child)]:mt-6",
|
|
11
|
+
blockquote: "mt-6 border-s-2 ps-6 italic",
|
|
12
|
+
list: "my-6 ms-6 list-disc [&>li]:mt-2",
|
|
13
|
+
code: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",
|
|
14
|
+
lead: "text-xl text-muted-foreground",
|
|
15
|
+
large: "text-lg font-semibold",
|
|
16
|
+
small: "text-sm leading-none font-medium",
|
|
17
|
+
muted: "text-sm text-muted-foreground"
|
|
18
|
+
};
|
|
19
|
+
var UiTypography = class UiTypography {
|
|
20
|
+
attrVariant = input("", {
|
|
21
|
+
...ngDevMode ? { debugName: "attrVariant" } : /* istanbul ignore next */ {},
|
|
22
|
+
alias: "uiTypography"
|
|
23
|
+
});
|
|
24
|
+
elVariant = input("", {
|
|
25
|
+
...ngDevMode ? { debugName: "elVariant" } : /* istanbul ignore next */ {},
|
|
26
|
+
alias: "variant"
|
|
27
|
+
});
|
|
28
|
+
variant = computed(() => this.attrVariant() || this.elVariant() || "p", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
29
|
+
userClass = input("", {
|
|
30
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
31
|
+
alias: "class"
|
|
32
|
+
});
|
|
33
|
+
classes = computed(() => cn(typographyClasses[this.variant()], this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
34
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
35
|
+
minVersion: "12.0.0",
|
|
36
|
+
version: "22.2.2",
|
|
37
|
+
ngImport: i0,
|
|
38
|
+
type: UiTypography,
|
|
39
|
+
deps: [],
|
|
40
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
41
|
+
});
|
|
42
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
43
|
+
minVersion: "17.1.0",
|
|
44
|
+
version: "22.2.2",
|
|
45
|
+
type: UiTypography,
|
|
46
|
+
isStandalone: true,
|
|
47
|
+
selector: "[uiTypography], ui-typography",
|
|
48
|
+
inputs: {
|
|
49
|
+
attrVariant: {
|
|
50
|
+
classPropertyName: "attrVariant",
|
|
51
|
+
publicName: "uiTypography",
|
|
52
|
+
isSignal: true,
|
|
53
|
+
isRequired: false,
|
|
54
|
+
transformFunction: null
|
|
55
|
+
},
|
|
56
|
+
elVariant: {
|
|
57
|
+
classPropertyName: "elVariant",
|
|
58
|
+
publicName: "variant",
|
|
59
|
+
isSignal: true,
|
|
60
|
+
isRequired: false,
|
|
61
|
+
transformFunction: null
|
|
62
|
+
},
|
|
63
|
+
userClass: {
|
|
64
|
+
classPropertyName: "userClass",
|
|
65
|
+
publicName: "class",
|
|
66
|
+
isSignal: true,
|
|
67
|
+
isRequired: false,
|
|
68
|
+
transformFunction: null
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
host: {
|
|
72
|
+
attributes: { "data-slot": "typography" },
|
|
73
|
+
properties: {
|
|
74
|
+
"attr.data-variant": "variant()",
|
|
75
|
+
"attr.class": "classes()"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
79
|
+
ngImport: i0
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
83
|
+
minVersion: "12.0.0",
|
|
84
|
+
version: "22.2.2",
|
|
85
|
+
ngImport: i0,
|
|
86
|
+
type: UiTypography,
|
|
87
|
+
decorators: [{
|
|
88
|
+
type: Directive,
|
|
89
|
+
args: [{
|
|
90
|
+
selector: "[uiTypography], ui-typography",
|
|
91
|
+
hostDirectives: [UiElementHost],
|
|
92
|
+
host: {
|
|
93
|
+
"data-slot": "typography",
|
|
94
|
+
"[attr.data-variant]": "variant()",
|
|
95
|
+
"[attr.class]": "classes()"
|
|
96
|
+
}
|
|
97
|
+
}]
|
|
98
|
+
}],
|
|
99
|
+
propDecorators: {
|
|
100
|
+
attrVariant: [{
|
|
101
|
+
type: i0.Input,
|
|
102
|
+
args: [{
|
|
103
|
+
isSignal: true,
|
|
104
|
+
alias: "uiTypography",
|
|
105
|
+
required: false
|
|
106
|
+
}]
|
|
107
|
+
}],
|
|
108
|
+
elVariant: [{
|
|
109
|
+
type: i0.Input,
|
|
110
|
+
args: [{
|
|
111
|
+
isSignal: true,
|
|
112
|
+
alias: "variant",
|
|
113
|
+
required: false
|
|
114
|
+
}]
|
|
115
|
+
}],
|
|
116
|
+
userClass: [{
|
|
117
|
+
type: i0.Input,
|
|
118
|
+
args: [{
|
|
119
|
+
isSignal: true,
|
|
120
|
+
alias: "class",
|
|
121
|
+
required: false
|
|
122
|
+
}]
|
|
123
|
+
}]
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
const UI_TYPOGRAPHY = [UiTypography];
|
|
127
|
+
export { UI_TYPOGRAPHY, UiTypography, typographyClasses };
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=loomui-ng-ui-typography.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomui-ng-ui-typography.mjs","names":[],"sources":["../../../libs/ui/typography/typography.ts"],"sourcesContent":["import { computed, Directive, input } from '@angular/core';\nimport { cn } from '@loomui-ng/ui/utils';\nimport { UiElementHost } from '@loomui-ng/ui/utils';\n\nexport type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'blockquote' | 'list' | 'code' | 'lead' | 'large' | 'small' | 'muted';\n\nexport const typographyClasses: Record<TypographyVariant, string> = {\n h1: 'scroll-m-20 text-4xl font-extrabold tracking-tight text-balance',\n h2: 'scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0',\n h3: 'scroll-m-20 text-2xl font-semibold tracking-tight',\n h4: 'scroll-m-20 text-xl font-semibold tracking-tight',\n p: 'leading-7 [&:not(:first-child)]:mt-6',\n blockquote: 'mt-6 border-s-2 ps-6 italic',\n list: 'my-6 ms-6 list-disc [&>li]:mt-2',\n code: 'relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold',\n lead: 'text-xl text-muted-foreground',\n large: 'text-lg font-semibold',\n small: 'text-sm leading-none font-medium',\n muted: 'text-sm text-muted-foreground',\n};\n\n/**\n * Typographic styles as a directive: <h1 uiTypography=\"h1\">Title</h1>, <p uiTypography=\"lead\">…</p>, or as an element:\n * <ui-typography variant=\"h1\">Title</ui-typography>.\n * Deviation: the live docs Typography page now redirects to \"Typeset\" (a CSS system with its own builder). This ships the\n * classic shadcn typography recipe (class strings from the former docs page) as a thin directive; Typeset is not reproduced.\n */\n@Directive({\n selector: '[uiTypography], ui-typography', hostDirectives: [UiElementHost],\n host: { 'data-slot': 'typography', '[attr.data-variant]': 'variant()', '[attr.class]': 'classes()' },\n})\nexport class UiTypography {\n /** Attribute form: `<p uiTypography=\"lead\">`. */\n readonly attrVariant = input<TypographyVariant | ''>('', { alias: 'uiTypography' });\n /** Element form: `<ui-typography variant=\"lead\">`. */\n readonly elVariant = input<TypographyVariant | ''>('', { alias: 'variant' });\n readonly variant = computed<TypographyVariant>(() => this.attrVariant() || this.elVariant() || 'p');\n readonly userClass = input<string>('', { alias: 'class' });\n protected readonly classes = computed(() => cn(typographyClasses[this.variant()], this.userClass()));\n}\n\nexport const UI_TYPOGRAPHY = [UiTypography] as const;\n"],"mappings":";;;;AAMA,MAAa,oBAAuD;CAClE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,YAAY;CACZ,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO;AACR;AAYD,IAAa,eAAb,MAAa,aAAY;CAEd,cAAc,MAA8B,IAAE;EAAA,GAAA,YAAA,EAAA,WAAA,cAAA,+BAAA,CAAA;EAAI,OAAO;CAAc,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