@geajs/ui 0.2.4 → 0.2.10
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/accordion.d.mts +2 -2
- package/dist/accordion.mjs +92 -122
- package/dist/accordion.mjs.map +1 -1
- package/dist/alert.d.mts +3 -3
- package/dist/alert.mjs +45 -107
- package/dist/alert.mjs.map +1 -1
- package/dist/avatar.d.mts +2 -2
- package/dist/avatar.mjs +38 -62
- package/dist/avatar.mjs.map +1 -1
- package/dist/badge.d.mts +1 -1
- package/dist/badge.mjs +18 -43
- package/dist/badge.mjs.map +1 -1
- package/dist/bind.mjs +169 -0
- package/dist/bind.mjs.map +1 -0
- package/dist/button.d.mts +3 -2
- package/dist/button.mjs +30 -85
- package/dist/button.mjs.map +1 -1
- package/dist/card.d.mts +6 -6
- package/dist/card.mjs +82 -194
- package/dist/card.mjs.map +1 -1
- package/dist/checkbox.d.mts +2 -2
- package/dist/checkbox.mjs +30 -31
- package/dist/checkbox.mjs.map +1 -1
- package/dist/clipboard.d.mts +2 -2
- package/dist/clipboard.mjs +49 -55
- package/dist/clipboard.mjs.map +1 -1
- package/dist/collapsible.d.mts +2 -2
- package/dist/collapsible.mjs +18 -45
- package/dist/collapsible.mjs.map +1 -1
- package/dist/combobox.d.mts +2 -2
- package/dist/combobox.mjs +390 -261
- package/dist/combobox.mjs.map +1 -1
- package/dist/compiled-component.mjs +121 -0
- package/dist/compiled-component.mjs.map +1 -0
- package/dist/compiled-reactive-component.mjs +435 -0
- package/dist/compiled-reactive-component.mjs.map +1 -0
- package/dist/component-id.mjs +21 -0
- package/dist/component-id.mjs.map +1 -0
- package/dist/conditional-truthy.mjs +48 -0
- package/dist/conditional-truthy.mjs.map +1 -0
- package/dist/conditional.mjs +54 -0
- package/dist/conditional.mjs.map +1 -0
- package/dist/delegate-event.mjs +53 -0
- package/dist/delegate-event.mjs.map +1 -0
- package/dist/dialog.d.mts +4 -3
- package/dist/dialog.mjs +57 -70
- package/dist/dialog.mjs.map +1 -1
- package/dist/dirty-symbols.mjs +7 -0
- package/dist/dirty-symbols.mjs.map +1 -0
- package/dist/disposer.mjs +65 -0
- package/dist/disposer.mjs.map +1 -0
- package/dist/dnd-manager.d.mts +9 -1
- package/dist/dnd-manager.mjs +67 -29
- package/dist/dnd-manager.mjs.map +1 -1
- package/dist/drag-drop-context.d.mts +1 -1
- package/dist/drag-drop-context.mjs +17 -33
- package/dist/drag-drop-context.mjs.map +1 -1
- package/dist/draggable.d.mts +1 -1
- package/dist/draggable.mjs +2 -91
- package/dist/draggable2.mjs +424 -0
- package/dist/draggable2.mjs.map +1 -0
- package/dist/droppable.d.mts +1 -1
- package/dist/droppable.mjs +20 -44
- package/dist/droppable.mjs.map +1 -1
- package/dist/file-upload.d.mts +2 -2
- package/dist/file-upload.mjs +405 -122
- package/dist/file-upload.mjs.map +1 -1
- package/dist/hover-card.d.mts +2 -2
- package/dist/hover-card.mjs +24 -59
- package/dist/hover-card.mjs.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/input.d.mts +1 -1
- package/dist/input.mjs +1 -93
- package/dist/input2.mjs +56 -0
- package/dist/input2.mjs.map +1 -0
- package/dist/internal-symbols.mjs +9 -0
- package/dist/internal-symbols.mjs.map +1 -0
- package/dist/item-obs.mjs +31 -0
- package/dist/item-obs.mjs.map +1 -0
- package/dist/keyed-list-symbols.mjs +6 -0
- package/dist/keyed-list-symbols.mjs.map +1 -0
- package/dist/keyed-list.mjs +538 -0
- package/dist/keyed-list.mjs.map +1 -0
- package/dist/label.d.mts +1 -1
- package/dist/label.mjs +20 -45
- package/dist/label.mjs.map +1 -1
- package/dist/menu.d.mts +2 -2
- package/dist/menu.mjs +87 -41
- package/dist/menu.mjs.map +1 -1
- package/dist/number-input.d.mts +2 -2
- package/dist/number-input.mjs +28 -32
- package/dist/number-input.mjs.map +1 -1
- package/dist/pagination.d.mts +2 -2
- package/dist/pagination.mjs +12 -35
- package/dist/pagination.mjs.map +1 -1
- package/dist/patch.mjs +21 -0
- package/dist/patch.mjs.map +1 -0
- package/dist/pin-input.d.mts +2 -2
- package/dist/pin-input.mjs +88 -87
- package/dist/pin-input.mjs.map +1 -1
- package/dist/popover.d.mts +2 -2
- package/dist/popover.mjs +45 -67
- package/dist/popover.mjs.map +1 -1
- package/dist/progress.d.mts +2 -2
- package/dist/progress.mjs +37 -43
- package/dist/progress.mjs.map +1 -1
- package/dist/radio-group.d.mts +2 -2
- package/dist/radio-group.mjs +99 -140
- package/dist/radio-group.mjs.map +1 -1
- package/dist/rating-group.d.mts +2 -2
- package/dist/rating-group.mjs +91 -99
- package/dist/rating-group.mjs.map +1 -1
- package/dist/reactive-attr.mjs +13 -0
- package/dist/reactive-attr.mjs.map +1 -0
- package/dist/reactive-bool.mjs +13 -0
- package/dist/reactive-bool.mjs.map +1 -0
- package/dist/reactive-class-name.mjs +15 -0
- package/dist/reactive-class-name.mjs.map +1 -0
- package/dist/reactive-class.mjs +54 -0
- package/dist/reactive-class.mjs.map +1 -0
- package/dist/reactive-style.mjs +24 -0
- package/dist/reactive-style.mjs.map +1 -0
- package/dist/reactive-text.mjs +62 -0
- package/dist/reactive-text.mjs.map +1 -0
- package/dist/select.d.mts +2 -2
- package/dist/select.mjs +106 -186
- package/dist/select.mjs.map +1 -1
- package/dist/separator.d.mts +1 -1
- package/dist/separator.mjs +19 -45
- package/dist/separator.mjs.map +1 -1
- package/dist/skeleton.d.mts +1 -1
- package/dist/skeleton.mjs +11 -35
- package/dist/skeleton.mjs.map +1 -1
- package/dist/slider.d.mts +2 -2
- package/dist/slider.mjs +31 -32
- package/dist/slider.mjs.map +1 -1
- package/dist/switch.d.mts +2 -2
- package/dist/switch.mjs +30 -31
- package/dist/switch.mjs.map +1 -1
- package/dist/tabs.d.mts +7 -2
- package/dist/tabs.mjs +180 -147
- package/dist/tabs.mjs.map +1 -1
- package/dist/tags-input.d.mts +2 -2
- package/dist/tags-input.mjs +102 -188
- package/dist/tags-input.mjs.map +1 -1
- package/dist/textarea.d.mts +1 -1
- package/dist/textarea.mjs +32 -75
- package/dist/textarea.mjs.map +1 -1
- package/dist/theme.css +4 -5
- package/dist/toast.d.mts +1 -1
- package/dist/toast.mjs +14 -34
- package/dist/toast.mjs.map +1 -1
- package/dist/toggle-group.d.mts +2 -2
- package/dist/toggle-group.mjs +78 -85
- package/dist/toggle-group.mjs.map +1 -1
- package/dist/tooltip.d.mts +2 -2
- package/dist/tooltip.mjs +23 -43
- package/dist/tooltip.mjs.map +1 -1
- package/dist/tree-view.d.mts +2 -2
- package/dist/tree-view.mjs +32 -50
- package/dist/tree-view.mjs.map +1 -1
- package/dist/types.d.mts +9 -0
- package/dist/zag-component.d.mts +26 -3
- package/dist/zag-component.mjs +73 -17
- package/dist/zag-component.mjs.map +1 -1
- package/package.json +4 -3
- package/dist/cn.mjs +0 -10
- package/dist/cn.mjs.map +0 -1
- package/dist/draggable.mjs.map +0 -1
- package/dist/input.mjs.map +0 -1
package/dist/separator.d.mts
CHANGED
package/dist/separator.mjs
CHANGED
|
@@ -1,49 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as cn, t as CompiledComponent } from "./compiled-component.mjs";
|
|
2
|
+
import { o as GEA_CREATE_TEMPLATE } from "./bind.mjs";
|
|
3
|
+
import { t as reactiveAttr } from "./reactive-attr.mjs";
|
|
4
|
+
import { t as reactiveClass } from "./reactive-class.mjs";
|
|
3
5
|
//#region src/components/separator.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (__el) {
|
|
20
|
-
const __newClass = String(__boundValue ?? "").trim().replace(/\s+/g, " ");
|
|
21
|
-
if (__el.className !== __newClass) __el.className = __newClass;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
{
|
|
25
|
-
const __el = this[GEA_ELEMENT];
|
|
26
|
-
this.props;
|
|
27
|
-
const __boundValue = value || "horizontal";
|
|
28
|
-
if (__el) {
|
|
29
|
-
var __av = __boundValue;
|
|
30
|
-
if (__av == null || __av === false) __el.removeAttribute("aria-orientation");
|
|
31
|
-
else {
|
|
32
|
-
const __newAttr = String(__av);
|
|
33
|
-
if (__el.getAttribute("aria-orientation") !== __newAttr) __el.setAttribute("aria-orientation", __newAttr);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (key === "class") {
|
|
39
|
-
const __el = this[GEA_ELEMENT];
|
|
40
|
-
this.props;
|
|
41
|
-
const __boundValue = cn("shrink-0 bg-border", this.props.orientation === "vertical" ? "h-full w-[1px]" : "h-[1px] w-full", value);
|
|
42
|
-
if (__el) {
|
|
43
|
-
const __newClass = String(__boundValue ?? "").trim().replace(/\s+/g, " ");
|
|
44
|
-
if (__el.className !== __newClass) __el.className = __newClass;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
6
|
+
let _tpl0_root = null;
|
|
7
|
+
function _tpl0_create() {
|
|
8
|
+
const t = document.createElement("template");
|
|
9
|
+
t.innerHTML = "<div role=separator>";
|
|
10
|
+
return t.content.firstChild;
|
|
11
|
+
}
|
|
12
|
+
var Separator = class extends CompiledComponent {
|
|
13
|
+
[GEA_CREATE_TEMPLATE](d) {
|
|
14
|
+
this.props.orientation;
|
|
15
|
+
const root = (_tpl0_root || (_tpl0_root = _tpl0_create())).cloneNode(true);
|
|
16
|
+
const el0 = root;
|
|
17
|
+
const el1 = el0;
|
|
18
|
+
reactiveClass(el0, d, this, () => cn("shrink-0 bg-border", this.props.orientation === "vertical" ? "h-full w-[1px]" : "h-[1px] w-full", this.props.class));
|
|
19
|
+
reactiveAttr(el1, d, this, "aria-orientation", () => this.props.orientation || "horizontal");
|
|
20
|
+
return root;
|
|
47
21
|
}
|
|
48
22
|
};
|
|
49
23
|
//#endregion
|
package/dist/separator.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"separator.mjs","names":["
|
|
1
|
+
{"version":3,"file":"separator.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClass","reactiveAttr","CompiledComponent","Component","cn","_tpl0_root","_tpl0_create","t","document","createElement","innerHTML","content","firstChild","Separator","d","isVertical","props","orientation","root","cloneNode","el0","el1","class"],"sources":["../src/components/separator.tsx"],"sourcesContent":["import { Component } from '@geajs/core'\nimport { cn } from '../utils/cn'\n\nexport default class Separator extends Component {\n template(props: any) {\n const isVertical = props.orientation === 'vertical'\n\n return (\n <div\n class={cn('shrink-0 bg-border', isVertical ? 'h-full w-[1px]' : 'h-[1px] w-full', props.class)}\n role=\"separator\"\n aria-orientation={props.orientation || 'horizontal'}\n ></div>\n )\n }\n}\n"],"mappings":";;;;;AAGA,IAAIM,aAAa;AACjB,SAASC,eAAe;CACtB,MAAMC,IAAIC,SAASC,cAAc,WAAW;AAC5CF,GAAEG,YAAY;AACd,QAAOH,EAAEI,QAAQC;;AAEnB,IAAqBC,YAArB,cAAuCX,kBAAkB;CACvD,CAACH,qBAAqBe,GAAG;AACJ,OAAKE,MAAMC;EAC9B,MAAMC,QAAQb,eAAeA,aAAaC,cAAc,GAAGa,UAAU,KAAK;EAC1E,MAAMC,MAAMF;EACZ,MAAMG,MAAMD;AACZpB,gBAAcoB,KAAKN,GAAG,YAAYV,GAAG,sBAAsB,KAAKY,MAAMC,gBAAgB,aAAa,mBAAmB,kBAAkB,KAAKD,MAAMM,MAAM,CAAC;AAC1JrB,eAAaoB,KAAKP,GAAG,MAAM,0BAA0B,KAAKE,MAAMC,eAAe,aAAa;AAC5F,SAAOC"}
|
package/dist/skeleton.d.mts
CHANGED
package/dist/skeleton.mjs
CHANGED
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as cn, t as CompiledComponent } from "./compiled-component.mjs";
|
|
2
|
+
import { o as GEA_CREATE_TEMPLATE } from "./bind.mjs";
|
|
3
|
+
import { t as reactiveClass } from "./reactive-class.mjs";
|
|
3
4
|
//#region src/components/skeleton.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.__tpl = (() => {
|
|
13
|
-
if (typeof document === "undefined") return void 0;
|
|
14
|
-
var t = document.createElement("template");
|
|
15
|
-
t.innerHTML = "<div></div>";
|
|
16
|
-
return t;
|
|
17
|
-
})();
|
|
18
|
-
}
|
|
19
|
-
[GEA_CLONE_TEMPLATE]() {
|
|
20
|
-
var __tpl = this.constructor.__tpl;
|
|
21
|
-
if (!__tpl) throw new Error("[gea] __tpl missing for clone template");
|
|
22
|
-
var __root = __tpl.content.firstElementChild.cloneNode(true);
|
|
23
|
-
__root.id = this.id;
|
|
24
|
-
__root.className = (cn("animate-pulse rounded-md bg-primary/10", props.class) != null ? String(cn("animate-pulse rounded-md bg-primary/10", props.class)) : "").trim();
|
|
25
|
-
return __root;
|
|
26
|
-
}
|
|
27
|
-
[GEA_ON_PROP_CHANGE](key, value) {
|
|
28
|
-
if (key === "class") {
|
|
29
|
-
const __el = this[GEA_ELEMENT];
|
|
30
|
-
this.props;
|
|
31
|
-
const __boundValue = cn("animate-pulse rounded-md bg-primary/10", value);
|
|
32
|
-
if (__el) {
|
|
33
|
-
const __newClass = String(__boundValue ?? "").trim().replace(/\s+/g, " ");
|
|
34
|
-
if (__el.className !== __newClass) __el.className = __newClass;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
5
|
+
function _tpl0_create() {
|
|
6
|
+
return document.createElement("div");
|
|
7
|
+
}
|
|
8
|
+
var Skeleton = class extends CompiledComponent {
|
|
9
|
+
[GEA_CREATE_TEMPLATE](d) {
|
|
10
|
+
const root = _tpl0_create();
|
|
11
|
+
reactiveClass(root, d, this, () => cn("animate-pulse rounded-md bg-primary/10", this.props.class));
|
|
12
|
+
return root;
|
|
37
13
|
}
|
|
38
14
|
};
|
|
39
15
|
//#endregion
|
package/dist/skeleton.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.mjs","names":["
|
|
1
|
+
{"version":3,"file":"skeleton.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClass","CompiledComponent","Component","cn","_tpl0_create","e","document","createElement","Skeleton","d","root","el0","props","class"],"sources":["../src/components/skeleton.tsx"],"sourcesContent":["import { Component } from '@geajs/core'\nimport { cn } from '../utils/cn'\n\nexport default class Skeleton extends Component {\n template(props: any) {\n return <div class={cn('animate-pulse rounded-md bg-primary/10', props.class)}></div>\n }\n}\n"],"mappings":";;;;AAGA,SAASK,eAAe;AAEtB,QADUE,SAASC,cAAc,MACzB;;AAEV,IAAqBC,WAArB,cAAsCP,kBAAkB;CACtD,CAACF,qBAAqBU,GAAG;EACvB,MAAMC,OAAON,cAAc;AAE3BJ,gBAAcW,MAAKF,GAAG,YAAYN,GAAG,0CAA0C,KAAKS,MAAMC,MAAM,CAAC;AACjG,SAAOH"}
|
package/dist/slider.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ declare class Slider extends ZagComponent {
|
|
|
7
7
|
value: number[];
|
|
8
8
|
createMachine(_props: any): any;
|
|
9
9
|
getMachineProps(props: any): {
|
|
10
|
-
id:
|
|
10
|
+
id: string;
|
|
11
11
|
value: any;
|
|
12
12
|
defaultValue: any;
|
|
13
13
|
min: any;
|
|
@@ -37,7 +37,7 @@ declare class Slider extends ZagComponent {
|
|
|
37
37
|
_syncThumbs(): void;
|
|
38
38
|
syncState(api: any): void;
|
|
39
39
|
_applyAllSpreads(): void;
|
|
40
|
-
template(props: any):
|
|
40
|
+
template(props: any): any;
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
export { Slider as default };
|
package/dist/slider.mjs
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { t as ZagComponent } from "./zag-component.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { o as GEA_CREATE_TEMPLATE } from "./bind.mjs";
|
|
3
|
+
import { n as reactiveTextValue } from "./reactive-text.mjs";
|
|
4
|
+
import { t as reactiveClass } from "./reactive-class.mjs";
|
|
5
|
+
import { t as reactiveClassName } from "./reactive-class-name.mjs";
|
|
6
|
+
import { t as conditionalTruthy } from "./conditional-truthy.mjs";
|
|
3
7
|
import { normalizeProps } from "@zag-js/vanilla";
|
|
4
8
|
import * as slider from "@zag-js/slider";
|
|
5
9
|
//#region src/components/slider.tsx
|
|
6
10
|
const THUMB_CLASS = "slider-thumb block h-5 w-5 rounded-full border-2 border-primary bg-background shadow transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring";
|
|
11
|
+
let _tpl0_root = null;
|
|
12
|
+
function _tpl0_create() {
|
|
13
|
+
const t = document.createElement("template");
|
|
14
|
+
t.innerHTML = "<div data-part=root><!--1--><div data-part=control class=\"slider-control relative flex items-center\"><div data-part=track class=\"slider-track relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20\"><div data-part=range class=\"slider-range absolute h-full bg-primary\"></div></div><div data-part=thumb data-index=0><input data-part=hidden-input data-index=0 type=hidden>";
|
|
15
|
+
return t.content.firstChild;
|
|
16
|
+
}
|
|
17
|
+
let _tpl1_root = null;
|
|
18
|
+
function _tpl1_create() {
|
|
19
|
+
const t = document.createElement("template");
|
|
20
|
+
t.innerHTML = "<div class=\"flex justify-between mb-2\"><label data-part=label class=\"slider-label text-sm font-medium\">0";
|
|
21
|
+
return t.content.firstChild;
|
|
22
|
+
}
|
|
7
23
|
var Slider = class extends ZagComponent {
|
|
8
|
-
static {
|
|
9
|
-
this.__geaTagName = "gea-slider";
|
|
10
|
-
}
|
|
11
|
-
constructor(...args) {
|
|
12
|
-
super(...args);
|
|
13
|
-
this.props;
|
|
14
|
-
this[geaCondValueSymbol(0)] = !!this.props.label;
|
|
15
|
-
this[GEA_REGISTER_COND](0, "c0", () => {
|
|
16
|
-
this.props;
|
|
17
|
-
return this.props.label;
|
|
18
|
-
}, () => {
|
|
19
|
-
this.props;
|
|
20
|
-
return `<div class="flex justify-between mb-2"><label data-part="label" class="slider-label text-sm font-medium">${geaEscapeHtml(String(this.props.label))}</label></div>`;
|
|
21
|
-
}, null);
|
|
22
|
-
}
|
|
23
24
|
createMachine(_props) {
|
|
24
25
|
return slider.machine;
|
|
25
26
|
}
|
|
@@ -93,22 +94,20 @@ var Slider = class extends ZagComponent {
|
|
|
93
94
|
this._elementCache?.clear();
|
|
94
95
|
super._applyAllSpreads();
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
if (key === "label") this[GEA_PATCH_COND](0);
|
|
97
|
+
[GEA_CREATE_TEMPLATE](d) {
|
|
98
|
+
const root = (_tpl0_root || (_tpl0_root = _tpl0_create())).cloneNode(true);
|
|
99
|
+
const el0 = root;
|
|
100
|
+
const anchor1 = root.firstChild;
|
|
101
|
+
const el2 = root.childNodes[1].childNodes[1];
|
|
102
|
+
reactiveClassName(el0, d, this, () => "w-full " + (this.props.class || ""));
|
|
103
|
+
conditionalTruthy(anchor1.parentNode, anchor1, d, this, () => this.props.label, (d) => {
|
|
104
|
+
const root = (_tpl1_root || (_tpl1_root = _tpl1_create())).cloneNode(true);
|
|
105
|
+
const t0 = root.firstChild.firstChild;
|
|
106
|
+
reactiveTextValue(t0, d, this, () => this.props.label);
|
|
107
|
+
return root;
|
|
108
|
+
});
|
|
109
|
+
reactiveClass(el2, d, this, () => THUMB_CLASS);
|
|
110
|
+
return root;
|
|
112
111
|
}
|
|
113
112
|
};
|
|
114
113
|
//#endregion
|
package/dist/slider.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.mjs","names":["
|
|
1
|
+
{"version":3,"file":"slider.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClassName","reactiveTextValue","conditionalTruthy","reactiveClass","slider","normalizeProps","ZagComponent","THUMB_CLASS","_tpl0_root","_tpl0_create","t","document","createElement","innerHTML","content","firstChild","_tpl1_root","_tpl1_create","Slider","value","createMachine","_props","machine","getMachineProps","props","id","defaultValue","min","max","step","orientation","thumbAlignment","disabled","readOnly","name","onValueChange","details","ValueChangeDetails","onValueChangeEnd","connectApi","service","connect","getSpreadMap","[data-part=\"thumb\"]","api","el","index","parseInt","HTMLElement","dataset","getThumbProps","[data-part=\"hidden-input\"]","getHiddenInputProps","_syncThumbs","_api","control","querySelector","thumbCount","length","existing","querySelectorAll","i","thumb","setAttribute","String","className","input","type","appendChild","remove","syncState","_applyAllSpreads","_elementCache","clear","d","root","cloneNode","el0","anchor1","el2","childNodes","class","parentNode","label","marker0","t0"],"sources":["../src/components/slider.tsx"],"sourcesContent":["import * as slider from '@zag-js/slider'\nimport { normalizeProps } from '@zag-js/vanilla'\nimport ZagComponent from '../primitives/zag-component'\n\nconst THUMB_CLASS =\n 'slider-thumb block h-5 w-5 rounded-full border-2 border-primary bg-background shadow ' +\n 'transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring'\n\nexport default class Slider extends ZagComponent {\n declare value: number[]\n\n createMachine(_props: any): any {\n return slider.machine\n }\n\n getMachineProps(props: any) {\n return {\n id: this.id,\n value: props.value,\n defaultValue: props.defaultValue ?? [50],\n min: props.min ?? 0,\n max: props.max ?? 100,\n step: props.step ?? 1,\n orientation: props.orientation ?? 'horizontal',\n thumbAlignment: props.thumbAlignment ?? 'center',\n disabled: props.disabled,\n readOnly: props.readOnly,\n name: props.name,\n 'aria-label': props['aria-label'],\n onValueChange: (details: slider.ValueChangeDetails) => {\n this.value = details.value\n props.onValueChange?.(details)\n },\n onValueChangeEnd: props.onValueChangeEnd,\n }\n }\n\n connectApi(service: any) {\n return slider.connect(service, normalizeProps)\n }\n\n getSpreadMap() {\n return {\n '[data-part=\"root\"]': 'getRootProps',\n '[data-part=\"label\"]': 'getLabelProps',\n '[data-part=\"control\"]': 'getControlProps',\n '[data-part=\"track\"]': 'getTrackProps',\n '[data-part=\"range\"]': 'getRangeProps',\n '[data-part=\"thumb\"]': (api, el) => {\n const index = parseInt((el as HTMLElement).dataset.index || '0', 10)\n return api.getThumbProps({ index })\n },\n '[data-part=\"hidden-input\"]': (api, el) => {\n const index = parseInt((el as HTMLElement).dataset.index || '0', 10)\n return api.getHiddenInputProps({ index })\n },\n }\n }\n\n _syncThumbs() {\n if (!this._api || !this.el) return\n const control = this.el.querySelector('[data-part=\"control\"]')\n if (!control) return\n\n const thumbCount = this._api.value.length\n const existing = control.querySelectorAll(':scope > [data-part=\"thumb\"]')\n\n if (existing.length === thumbCount) return\n\n if (existing.length < thumbCount) {\n for (let i = existing.length; i < thumbCount; i++) {\n const thumb = document.createElement('div')\n thumb.setAttribute('data-part', 'thumb')\n thumb.setAttribute('data-index', String(i))\n thumb.className = THUMB_CLASS\n\n const input = document.createElement('input')\n input.setAttribute('data-part', 'hidden-input')\n input.setAttribute('data-index', String(i))\n input.type = 'hidden'\n thumb.appendChild(input)\n\n control.appendChild(thumb)\n }\n } else {\n for (let i = existing.length - 1; i >= thumbCount; i--) {\n existing[i].remove()\n }\n }\n }\n\n syncState(api: any) {\n this.value = api.value\n }\n\n _applyAllSpreads() {\n this._syncThumbs()\n this._elementCache?.clear()\n super._applyAllSpreads()\n }\n\n template(props: any) {\n return (\n <div data-part=\"root\" class={'w-full ' + (props.class || '')}>\n {props.label && (\n <div class=\"flex justify-between mb-2\">\n <label data-part=\"label\" class=\"slider-label text-sm font-medium\">\n {props.label}\n </label>\n </div>\n )}\n <div data-part=\"control\" class=\"slider-control relative flex items-center\">\n <div\n data-part=\"track\"\n class=\"slider-track relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20\"\n >\n <div data-part=\"range\" class=\"slider-range absolute h-full bg-primary\"></div>\n </div>\n <div data-part=\"thumb\" data-index=\"0\" class={THUMB_CLASS}>\n <input data-part=\"hidden-input\" data-index=\"0\" type=\"hidden\" />\n </div>\n </div>\n </div>\n )\n }\n}\n"],"mappings":";;;;;;;;;AAIA,MAAMQ,cAAc;AACpB,IAAIC,aAAa;AACjB,SAASC,eAAe;CACtB,MAAMC,IAAIC,SAASC,cAAc,WAAW;AAC5CF,GAAEG,YAAY;AACd,QAAOH,EAAEI,QAAQC;;AAEnB,IAAIC,aAAa;AACjB,SAASC,eAAe;CACtB,MAAMP,IAAIC,SAASC,cAAc,WAAW;AAC5CF,GAAEG,YAAY;AACd,QAAOH,EAAEI,QAAQC;;AAEnB,IAAqBG,SAArB,cAAoCZ,aAAa;CAE/Cc,cAAcC,QAAkB;AAC9B,SAAOjB,OAAOkB;;CAEhBC,gBAAgBC,OAAY;AAC1B,SAAO;GACLC,IAAI,KAAKA;GACTN,OAAOK,MAAML;GACbO,cAAcF,MAAME,gBAAgB,CAAC,GAAG;GACxCC,KAAKH,MAAMG,OAAO;GAClBC,KAAKJ,MAAMI,OAAO;GAClBC,MAAML,MAAMK,QAAQ;GACpBC,aAAaN,MAAMM,eAAe;GAClCC,gBAAgBP,MAAMO,kBAAkB;GACxCC,UAAUR,MAAMQ;GAChBC,UAAUT,MAAMS;GAChBC,MAAMV,MAAMU;GACZ,cAAcV,MAAM;GACpBW,gBAAgBC,YAAuC;AACrD,SAAKjB,QAAQiB,QAAQjB;AACrBK,UAAMW,gBAAgBC,QAAQ;;GAEhCE,kBAAkBd,MAAMc;GACzB;;CAEHC,WAAWC,SAAc;AACvB,SAAOpC,OAAOqC,QAAQD,SAASnC,eAAe;;CAEhDqC,eAAe;AACb,SAAO;GACL,wBAAsB;GACtB,yBAAuB;GACvB,2BAAyB;GACzB,yBAAuB;GACvB,yBAAuB;GACvB,0BAAwBE,KAAKC,OAAO;IAClC,MAAMC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A,aAAaC,cAAc,GAAGmE,UAAU,KAAK;EAC1E,MAAMC,MAAMF;EACZ,MAAMG,UAAUH,KAAK5D;EACrB,MAAMgE,MAAMJ,KAAKK,WAAW,GAAGA,WAAW;AAC1ChF,oBAAkB6E,KAAKH,GAAG,YAAY,aAAa,KAAKlD,MAAMyD,SAAS,IAAI;AAC3E/E,oBAAkB4E,QAAQI,YAAYJ,SAASJ,GAAG,YAAY,KAAKlD,MAAM2D,QAAOT,MAAK;GACnF,MAAMC,QAAQ3D,eAAeA,aAAaC,cAAc,GAAG2D,UAAU,KAAK;GAE1E,MAAMS,KADUV,KAAK5D,WAAWA;AAEhCd,qBAAkBoF,IAAIX,GAAG,YAAY,KAAKlD,MAAM2D,MAAM;AACtD,UAAOR;IACP;AACFxE,gBAAc4E,KAAKL,GAAG,YAAYnE,YAAY;AAC9C,SAAOoE"}
|
package/dist/switch.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ declare class Switch extends ZagComponent {
|
|
|
7
7
|
checked: boolean;
|
|
8
8
|
createMachine(_props: any): any;
|
|
9
9
|
getMachineProps(props: any): {
|
|
10
|
-
id:
|
|
10
|
+
id: string;
|
|
11
11
|
checked: any;
|
|
12
12
|
defaultChecked: any;
|
|
13
13
|
disabled: any;
|
|
@@ -30,7 +30,7 @@ declare class Switch extends ZagComponent {
|
|
|
30
30
|
'[data-part="hidden-input"]': string;
|
|
31
31
|
};
|
|
32
32
|
syncState(api: any): void;
|
|
33
|
-
template(props: any):
|
|
33
|
+
template(props: any): any;
|
|
34
34
|
}
|
|
35
35
|
//#endregion
|
|
36
36
|
export { Switch as default };
|
package/dist/switch.mjs
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { t as ZagComponent } from "./zag-component.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { o as GEA_CREATE_TEMPLATE } from "./bind.mjs";
|
|
3
|
+
import { n as reactiveTextValue } from "./reactive-text.mjs";
|
|
4
|
+
import { t as reactiveClassName } from "./reactive-class-name.mjs";
|
|
5
|
+
import { t as conditionalTruthy } from "./conditional-truthy.mjs";
|
|
3
6
|
import { normalizeProps } from "@zag-js/vanilla";
|
|
4
7
|
import * as switchMachine from "@zag-js/switch";
|
|
5
8
|
//#region src/components/switch.tsx
|
|
9
|
+
let _tpl0_root = null;
|
|
10
|
+
function _tpl0_create() {
|
|
11
|
+
const t = document.createElement("template");
|
|
12
|
+
t.innerHTML = "<label data-part=root><input data-part=hidden-input type=checkbox><span data-part=control class=\"switch-control inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input\"><span data-part=thumb class=\"switch-thumb pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0\"></span></span><!--1-->";
|
|
13
|
+
return t.content.firstChild;
|
|
14
|
+
}
|
|
15
|
+
let _tpl1_root = null;
|
|
16
|
+
function _tpl1_create() {
|
|
17
|
+
const t = document.createElement("template");
|
|
18
|
+
t.innerHTML = "<span data-part=label class=\"switch-label text-sm font-medium\">0";
|
|
19
|
+
return t.content.firstChild;
|
|
20
|
+
}
|
|
6
21
|
var Switch = class extends ZagComponent {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
constructor(...args) {
|
|
11
|
-
super(...args);
|
|
22
|
+
constructor(..._args) {
|
|
23
|
+
super(..._args);
|
|
12
24
|
this.checked = false;
|
|
13
|
-
this.props;
|
|
14
|
-
this[geaCondValueSymbol(0)] = !!this.props.label;
|
|
15
|
-
this[GEA_REGISTER_COND](0, "c0", () => {
|
|
16
|
-
this.props;
|
|
17
|
-
return this.props.label;
|
|
18
|
-
}, () => {
|
|
19
|
-
this.props;
|
|
20
|
-
return `<span data-part="label" class="switch-label text-sm font-medium">${geaEscapeHtml(String(this.props.label))}</span>`;
|
|
21
|
-
}, null);
|
|
22
25
|
}
|
|
23
26
|
createMachine(_props) {
|
|
24
27
|
return switchMachine.machine;
|
|
@@ -56,22 +59,18 @@ var Switch = class extends ZagComponent {
|
|
|
56
59
|
syncState(api) {
|
|
57
60
|
this.checked = api.checked;
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
this.props;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (__el.className !== __newClass) __el.className = __newClass;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (key === "label") this[GEA_PATCH_COND](0);
|
|
62
|
+
[GEA_CREATE_TEMPLATE](d) {
|
|
63
|
+
const root = (_tpl0_root || (_tpl0_root = _tpl0_create())).cloneNode(true);
|
|
64
|
+
const el0 = root;
|
|
65
|
+
const anchor1 = root.childNodes[2];
|
|
66
|
+
reactiveClassName(el0, d, this, () => `switch-root inline-flex items-center gap-2 cursor-pointer ${this.props.class || ""}`);
|
|
67
|
+
conditionalTruthy(anchor1.parentNode, anchor1, d, this, () => this.props.label, (d) => {
|
|
68
|
+
const root = (_tpl1_root || (_tpl1_root = _tpl1_create())).cloneNode(true);
|
|
69
|
+
const t0 = root.firstChild;
|
|
70
|
+
reactiveTextValue(t0, d, this, () => this.props.label);
|
|
71
|
+
return root;
|
|
72
|
+
});
|
|
73
|
+
return root;
|
|
75
74
|
}
|
|
76
75
|
};
|
|
77
76
|
//#endregion
|
package/dist/switch.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.mjs","names":["
|
|
1
|
+
{"version":3,"file":"switch.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClassName","reactiveTextValue","conditionalTruthy","switchMachine","normalizeProps","ZagComponent","_tpl0_root","_tpl0_create","t","document","createElement","innerHTML","content","firstChild","_tpl1_root","_tpl1_create","Switch","checked","createMachine","_props","machine","getMachineProps","props","id","defaultChecked","disabled","invalid","required","readOnly","name","form","value","onCheckedChange","details","CheckedChangeDetails","connectApi","service","connect","getSpreadMap","syncState","api","d","root","cloneNode","el0","anchor1","childNodes","class","parentNode","label","marker0","t0"],"sources":["../src/components/switch.tsx"],"sourcesContent":["import * as switchMachine from '@zag-js/switch'\nimport { normalizeProps } from '@zag-js/vanilla'\nimport ZagComponent from '../primitives/zag-component'\n\nexport default class Switch extends ZagComponent {\n checked = false\n\n createMachine(_props: any): any {\n return switchMachine.machine\n }\n\n getMachineProps(props: any) {\n return {\n id: this.id,\n checked: props.checked,\n defaultChecked: props.defaultChecked,\n disabled: props.disabled,\n invalid: props.invalid,\n required: props.required,\n readOnly: props.readOnly,\n name: props.name,\n form: props.form,\n value: props.value ?? 'on',\n onCheckedChange: (details: switchMachine.CheckedChangeDetails) => {\n this.checked = details.checked\n props.onCheckedChange?.(details)\n },\n }\n }\n\n connectApi(service: any) {\n return switchMachine.connect(service, normalizeProps)\n }\n\n getSpreadMap() {\n return {\n '[data-part=\"root\"]': 'getRootProps',\n '[data-part=\"label\"]': 'getLabelProps',\n '[data-part=\"control\"]': 'getControlProps',\n '[data-part=\"thumb\"]': 'getThumbProps',\n '[data-part=\"hidden-input\"]': 'getHiddenInputProps',\n }\n }\n\n syncState(api: any) {\n this.checked = api.checked\n }\n\n template(props: any) {\n return (\n <label data-part=\"root\" class={`switch-root inline-flex items-center gap-2 cursor-pointer ${props.class || ''}`}>\n <input data-part=\"hidden-input\" type=\"checkbox\" />\n <span\n data-part=\"control\"\n class=\"switch-control inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input\"\n >\n <span\n data-part=\"thumb\"\n class=\"switch-thumb pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0\"\n ></span>\n </span>\n {props.label && (\n <span data-part=\"label\" class=\"switch-label text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YAAYH,SAASJ,GAAG,YAAY,KAAKnB,MAAM2B,QAAOR,MAAK;GACnF,MAAMC,QAAQ5B,eAAeA,aAAaC,cAAc,GAAG4B,UAAU,KAAK;GAE1E,MAAMQ,KADUT,KAAK7B;AAErBZ,qBAAkBkD,IAAIV,GAAG,YAAY,KAAKnB,MAAM2B,MAAM;AACtD,UAAOP;IACP;AACF,SAAOA"}
|
package/dist/tabs.d.mts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { n as ZagComponent } from "./zag-component.mjs";
|
|
2
|
+
import { GEA_ON_PROP_CHANGE } from "@geajs/core";
|
|
2
3
|
import * as tabs from "@zag-js/tabs";
|
|
3
4
|
import * as _$_zag_js_types0 from "@zag-js/types";
|
|
4
5
|
|
|
5
6
|
//#region src/components/tabs.d.ts
|
|
6
7
|
declare class Tabs extends ZagComponent {
|
|
7
8
|
value: string | null;
|
|
9
|
+
_isNodeLike(value: unknown): value is Node;
|
|
10
|
+
_setPanelContent(panel: HTMLElement, value: unknown): void;
|
|
11
|
+
_syncPanelContents(nextProps: Record<string, any> | undefined): void;
|
|
8
12
|
createMachine(_props: any): any;
|
|
13
|
+
[GEA_ON_PROP_CHANGE](key: string, next: unknown): void;
|
|
9
14
|
getMachineProps(props: any): {
|
|
10
|
-
id:
|
|
15
|
+
id: string;
|
|
11
16
|
value: any;
|
|
12
17
|
defaultValue: any;
|
|
13
18
|
orientation: any;
|
|
@@ -29,7 +34,7 @@ declare class Tabs extends ZagComponent {
|
|
|
29
34
|
};
|
|
30
35
|
syncState(api: any): void;
|
|
31
36
|
onAfterRender(): void;
|
|
32
|
-
template(props: any):
|
|
37
|
+
template(props: any): any;
|
|
33
38
|
}
|
|
34
39
|
//#endregion
|
|
35
40
|
export { Tabs as default };
|