fluid-primitives 0.19.1 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/Client-HrMIqv7d.js +1934 -0
- package/dist/accordion.d.ts +2 -2
- package/dist/accordion.js +25 -29
- package/dist/button.d.ts +52 -0
- package/dist/button.js +135 -0
- package/dist/checkbox-group.d.ts +6 -5
- package/dist/checkbox-group.js +36 -20
- package/dist/{checkbox-group.registry-CGwuF7SF.js → checkbox-group.registry-D8P8A4LY.js} +13 -8
- package/dist/checkbox.d.ts +18 -4
- package/dist/checkbox.js +30 -27
- package/dist/client.d.ts +2 -2
- package/dist/client.js +2 -2
- package/dist/clipboard.d.ts +12 -5
- package/dist/clipboard.js +14 -16
- package/dist/collapsible.d.ts +3 -3
- package/dist/collapsible.js +13 -17
- package/dist/combobox.d.ts +37 -0
- package/dist/combobox.js +151 -0
- package/dist/date-picker.d.ts +67 -0
- package/dist/date-picker.js +289 -0
- package/dist/dialog.d.ts +3 -3
- package/dist/dialog.js +11 -12
- package/dist/field-array.d.ts +97 -0
- package/dist/field-array.js +223 -0
- package/dist/field.d.ts +30 -54
- package/dist/field.js +589 -175
- package/dist/fieldset.d.ts +15 -0
- package/dist/fieldset.js +27 -0
- package/dist/file-upload.d.ts +85 -0
- package/dist/file-upload.js +255 -0
- package/dist/form.d.ts +2 -83
- package/dist/form.fields-B58TZukv.js +329 -0
- package/dist/form.js +263 -276
- package/dist/index-B06gIN_k.d.ts +1358 -0
- package/dist/input.d.ts +96 -0
- package/dist/input.js +233 -0
- package/dist/menu.d.ts +55 -0
- package/dist/menu.js +144 -0
- package/dist/navigation-menu.d.ts +3 -3
- package/dist/navigation-menu.js +29 -43
- package/dist/number-input.d.ts +13 -4
- package/dist/number-input.js +30 -31
- package/dist/popover.d.ts +11 -3
- package/dist/popover.js +17 -18
- package/dist/radio-group.d.ts +4 -4
- package/dist/radio-group.js +35 -42
- package/dist/scroll-area.d.ts +3 -3
- package/dist/scroll-area.js +10 -9
- package/dist/select.d.ts +13 -51
- package/dist/select.js +62 -55
- package/dist/slider.d.ts +27 -0
- package/dist/slider.js +71 -0
- package/dist/switch.d.ts +4 -4
- package/dist/switch.js +24 -33
- package/dist/tabs.d.ts +3 -3
- package/dist/tabs.js +12 -15
- package/dist/textarea.d.ts +101 -0
- package/dist/textarea.js +231 -0
- package/dist/tooltip.d.ts +11 -3
- package/dist/tooltip.js +11 -10
- package/package.json +79 -24
- package/dist/Client-C51NSHxg.js +0 -248
- package/dist/field.dom-CJQXpQbZ.js +0 -11
- package/dist/form.registry-Cb8Pvoe8.d.ts +0 -7
- package/dist/form.registry-CmpTny_s.js +0 -51
- package/dist/index-B8JCdyld.d.ts +0 -118
package/dist/number-input.js
CHANGED
|
@@ -1,58 +1,57 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as getLabelId, t as getControlId } from "./field.dom-CJQXpQbZ.js";
|
|
1
|
+
import { K as registerClientPropConverters, a as normalizeProps, at as Machine, o as mergeProps, s as FieldAwareComponent } from "./Client-HrMIqv7d.js";
|
|
3
2
|
import * as numberInput from "@zag-js/number-input";
|
|
4
3
|
|
|
5
4
|
//#region Resources/Private/Primitives/NumberInput/NumberInput.ts
|
|
5
|
+
registerClientPropConverters("numberInput", { formatOptions: (formatOptions) => formatOptions });
|
|
6
6
|
var NumberInput = class extends FieldAwareComponent {
|
|
7
|
-
static
|
|
8
|
-
propsWithField(props,
|
|
7
|
+
static componentName = "numberInput";
|
|
8
|
+
propsWithField(props, field) {
|
|
9
9
|
return {
|
|
10
10
|
...props,
|
|
11
|
-
disabled: props.disabled ??
|
|
12
|
-
readOnly: props.readOnly ??
|
|
13
|
-
required: props.required ??
|
|
14
|
-
invalid: props.invalid ??
|
|
15
|
-
name: props.name ??
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
disabled: props.disabled ?? field.disabled,
|
|
12
|
+
readOnly: props.readOnly ?? field.readOnly,
|
|
13
|
+
required: props.required ?? field.required,
|
|
14
|
+
invalid: props.invalid ?? field.invalid,
|
|
15
|
+
name: props.name ?? field.name
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
transformProps(props) {
|
|
19
|
+
return {
|
|
20
|
+
...props,
|
|
21
|
+
onValueChange: (details) => {
|
|
22
|
+
this.hydrator.query("input")?.dispatchEvent(new Event("input", { bubbles: true }));
|
|
23
|
+
props?.onValueChange?.(details);
|
|
20
24
|
}
|
|
21
25
|
};
|
|
22
26
|
}
|
|
23
27
|
initMachine(props) {
|
|
24
28
|
props = this.withFieldProps(props);
|
|
25
|
-
|
|
29
|
+
const [machineProps] = numberInput.splitProps(props);
|
|
30
|
+
return new Machine(numberInput.machine, machineProps);
|
|
26
31
|
}
|
|
27
32
|
initApi() {
|
|
28
33
|
return numberInput.connect(this.machine.service, normalizeProps);
|
|
29
34
|
}
|
|
30
35
|
render() {
|
|
31
36
|
this.subscribeToFieldService();
|
|
32
|
-
const rootEl = this.
|
|
37
|
+
const rootEl = this.hydrator.query("root");
|
|
33
38
|
if (rootEl) this.spreadProps(rootEl, this.api.getRootProps());
|
|
34
|
-
const labelEl = this.
|
|
39
|
+
const labelEl = this.hydrator.query("label");
|
|
35
40
|
if (labelEl) this.spreadProps(labelEl, this.api.getLabelProps());
|
|
36
|
-
const controlEl = this.
|
|
41
|
+
const controlEl = this.hydrator.query("control");
|
|
37
42
|
if (controlEl) this.spreadProps(controlEl, this.api.getControlProps());
|
|
38
|
-
const inputEl = this.
|
|
43
|
+
const inputEl = this.hydrator.query("input");
|
|
39
44
|
if (inputEl) {
|
|
40
|
-
const mergedProps = mergeProps(this.api.getInputProps(), { "aria-describedby": this.
|
|
45
|
+
const mergedProps = mergeProps(this.api.getInputProps(), { "aria-describedby": this.field?.ariaDescribedby });
|
|
41
46
|
this.spreadProps(inputEl, mergedProps);
|
|
42
47
|
}
|
|
43
|
-
const incrementTriggerEl = this.
|
|
44
|
-
if (incrementTriggerEl)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const decrementTriggerEl = this.getElement("decrement-trigger");
|
|
49
|
-
if (decrementTriggerEl) {
|
|
50
|
-
const triggerProps = mergeProps(this.api.getDecrementTriggerProps(), { "aria-label": this.userProps?.translations?.decrementLabel || null });
|
|
51
|
-
this.spreadProps(decrementTriggerEl, triggerProps);
|
|
52
|
-
}
|
|
53
|
-
const valueTextEl = this.getElement("value-text");
|
|
48
|
+
const incrementTriggerEl = this.hydrator.query("incrementTrigger");
|
|
49
|
+
if (incrementTriggerEl) this.spreadProps(incrementTriggerEl, this.api.getIncrementTriggerProps());
|
|
50
|
+
const decrementTriggerEl = this.hydrator.query("decrementTrigger");
|
|
51
|
+
if (decrementTriggerEl) this.spreadProps(decrementTriggerEl, this.api.getDecrementTriggerProps());
|
|
52
|
+
const valueTextEl = this.hydrator.query("valueText");
|
|
54
53
|
if (valueTextEl) this.spreadProps(valueTextEl, this.api.getValueTextProps());
|
|
55
|
-
const scrubberEl = this.
|
|
54
|
+
const scrubberEl = this.hydrator.query("scrubber");
|
|
56
55
|
if (scrubberEl) this.spreadProps(scrubberEl, this.api.getScrubberProps());
|
|
57
56
|
}
|
|
58
57
|
};
|
package/dist/popover.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as popover from "@zag-js/popover";
|
|
1
|
+
import { X as ConverterMachineProps, c as Machine, z as Component } from "./index-B06gIN_k.js";
|
|
3
2
|
import * as _$_zag_js_types0 from "@zag-js/types";
|
|
3
|
+
import * as popover from "@zag-js/popover";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/Popover/Popover.d.ts
|
|
6
|
+
declare const popoverPropConverters: {
|
|
7
|
+
positioning: (positioning: popover.Props["positioning"]) => popover.PositioningOptions | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare module 'fluid-primitives' {
|
|
10
|
+
interface HydrationPropsOverrides {
|
|
11
|
+
popover: ConverterMachineProps<typeof popoverPropConverters>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
6
14
|
declare class Popover extends Component<popover.Props, popover.Api> {
|
|
7
|
-
static
|
|
15
|
+
static componentName: string;
|
|
8
16
|
initMachine(props: popover.Props): Machine<any>;
|
|
9
17
|
initApi(): popover.Api<_$_zag_js_types0.PropTypes<{
|
|
10
18
|
[x: string]: any;
|
package/dist/popover.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as registerClientPropConverters, a as normalizeProps, at as Machine, rt as Component } from "./Client-HrMIqv7d.js";
|
|
2
2
|
import * as popover from "@zag-js/popover";
|
|
3
3
|
|
|
4
4
|
//#region Resources/Private/Primitives/Popover/Popover.ts
|
|
5
|
+
registerClientPropConverters("popover", { positioning: (positioning) => positioning });
|
|
5
6
|
var Popover = class extends Component {
|
|
6
|
-
static
|
|
7
|
+
static componentName = "popover";
|
|
7
8
|
initMachine(props) {
|
|
9
|
+
const [machineProps] = popover.splitProps(props);
|
|
8
10
|
return new Machine(popover.machine, {
|
|
9
|
-
...
|
|
11
|
+
...machineProps,
|
|
10
12
|
positioning: {
|
|
11
13
|
gutter: 6,
|
|
12
|
-
...
|
|
14
|
+
...machineProps.positioning
|
|
13
15
|
}
|
|
14
16
|
});
|
|
15
17
|
}
|
|
@@ -17,26 +19,23 @@ var Popover = class extends Component {
|
|
|
17
19
|
return popover.connect(this.machine.service, normalizeProps);
|
|
18
20
|
}
|
|
19
21
|
render() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const positionerEl = this.getElement("positioner");
|
|
22
|
+
this.spreadPropsByOptionalValue("trigger", ({ value }) => this.api.getTriggerProps({ value }));
|
|
23
|
+
const positionerEl = this.hydrator.query("positioner");
|
|
23
24
|
if (positionerEl) this.spreadProps(positionerEl, this.api.getPositionerProps());
|
|
24
|
-
const arrowEl = this.
|
|
25
|
+
const arrowEl = this.hydrator.query("arrow");
|
|
25
26
|
if (arrowEl) this.spreadProps(arrowEl, this.api.getArrowProps());
|
|
26
|
-
const arrowTipEl = this.
|
|
27
|
+
const arrowTipEl = this.hydrator.query("arrowTip");
|
|
27
28
|
if (arrowTipEl) this.spreadProps(arrowTipEl, this.api.getArrowTipProps());
|
|
28
|
-
const contentEl = this.
|
|
29
|
+
const contentEl = this.hydrator.query("content");
|
|
29
30
|
if (contentEl) this.spreadProps(contentEl, this.api.getContentProps());
|
|
30
|
-
const titleEl = this.
|
|
31
|
+
const titleEl = this.hydrator.query("title");
|
|
31
32
|
if (titleEl) this.spreadProps(titleEl, this.api.getTitleProps());
|
|
32
|
-
const descriptionEl = this.
|
|
33
|
+
const descriptionEl = this.hydrator.query("description");
|
|
33
34
|
if (descriptionEl) this.spreadProps(descriptionEl, this.api.getDescriptionProps());
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
const indicatorEl = this.getElement("indicator");
|
|
35
|
+
this.hydrator.queryAll("closeTrigger").forEach((closeTriggerEl) => {
|
|
36
|
+
this.spreadProps(closeTriggerEl, this.api.getCloseTriggerProps());
|
|
37
|
+
});
|
|
38
|
+
const indicatorEl = this.hydrator.query("indicator");
|
|
40
39
|
if (indicatorEl) this.spreadProps(indicatorEl, this.api.getIndicatorProps());
|
|
41
40
|
}
|
|
42
41
|
};
|
package/dist/radio-group.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as radioGroup from "@zag-js/radio-group";
|
|
1
|
+
import { b as FieldClientApi, c as Machine, y as FieldAwareComponent } from "./index-B06gIN_k.js";
|
|
3
2
|
import * as _$_zag_js_types0 from "@zag-js/types";
|
|
3
|
+
import * as radioGroup from "@zag-js/radio-group";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/RadioGroup/RadioGroup.d.ts
|
|
6
6
|
declare class RadioGroup extends FieldAwareComponent<radioGroup.Props, radioGroup.Api> {
|
|
7
|
-
static
|
|
8
|
-
propsWithField(props: radioGroup.Props,
|
|
7
|
+
static componentName: string;
|
|
8
|
+
propsWithField(props: radioGroup.Props, field: FieldClientApi): radioGroup.Props;
|
|
9
9
|
initMachine(props: radioGroup.Props): Machine<any>;
|
|
10
10
|
initApi(): radioGroup.Api<_$_zag_js_types0.PropTypes<{
|
|
11
11
|
[x: string]: any;
|
package/dist/radio-group.js
CHANGED
|
@@ -1,64 +1,57 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as normalizeProps, at as Machine, o as mergeProps, s as FieldAwareComponent } from "./Client-HrMIqv7d.js";
|
|
2
2
|
import * as radioGroup from "@zag-js/radio-group";
|
|
3
3
|
|
|
4
4
|
//#region Resources/Private/Primitives/RadioGroup/RadioGroup.ts
|
|
5
5
|
var RadioGroup = class extends FieldAwareComponent {
|
|
6
|
-
static
|
|
7
|
-
propsWithField(props,
|
|
6
|
+
static componentName = "radioGroup";
|
|
7
|
+
propsWithField(props, field) {
|
|
8
8
|
return {
|
|
9
9
|
...props,
|
|
10
|
-
disabled: props.disabled ??
|
|
11
|
-
readOnly: props.readOnly ??
|
|
12
|
-
required: props.required ??
|
|
13
|
-
invalid: props.invalid ??
|
|
14
|
-
name: props.name ??
|
|
10
|
+
disabled: props.disabled ?? field.disabled,
|
|
11
|
+
readOnly: props.readOnly ?? field.readOnly,
|
|
12
|
+
required: props.required ?? field.required,
|
|
13
|
+
invalid: props.invalid ?? field.invalid,
|
|
14
|
+
name: props.name ?? field.name
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
initMachine(props) {
|
|
18
18
|
props = this.withFieldProps(props);
|
|
19
|
-
|
|
19
|
+
const [machineProps] = radioGroup.splitProps(props);
|
|
20
|
+
return new Machine(radioGroup.machine, machineProps);
|
|
20
21
|
}
|
|
21
22
|
initApi() {
|
|
22
23
|
return radioGroup.connect(this.machine.service, normalizeProps);
|
|
23
24
|
}
|
|
24
25
|
render() {
|
|
25
26
|
this.subscribeToFieldService();
|
|
26
|
-
const rootEl = this.
|
|
27
|
+
const rootEl = this.hydrator.query("root");
|
|
27
28
|
if (rootEl) this.spreadProps(rootEl, mergeProps(this.api.getRootProps(), {
|
|
28
|
-
"aria-invalid": this.
|
|
29
|
-
"aria-describedby": this.
|
|
29
|
+
"aria-invalid": this.field?.invalid || void 0,
|
|
30
|
+
"aria-describedby": this.field?.ariaDescribedby
|
|
30
31
|
}));
|
|
31
|
-
const labelEl = this.
|
|
32
|
+
const labelEl = this.hydrator.query("label");
|
|
32
33
|
if (labelEl) this.spreadProps(labelEl, this.api.getLabelProps());
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.getElements("item-hidden-input").forEach((itemHiddenInputEl) => {
|
|
55
|
-
this.spreadProps(itemHiddenInputEl, this.api.getItemHiddenInputProps({
|
|
56
|
-
value: itemHiddenInputEl.dataset.value,
|
|
57
|
-
disabled: itemHiddenInputEl.getAttribute("data-disabled") === "true",
|
|
58
|
-
invalid: itemHiddenInputEl.getAttribute("data-invalid") === "true"
|
|
59
|
-
}));
|
|
60
|
-
});
|
|
61
|
-
const indicatorEl = this.getElement("indicator");
|
|
34
|
+
this.spreadPropsByValue("item", ({ el, value }) => this.api.getItemProps({
|
|
35
|
+
value,
|
|
36
|
+
disabled: el.hasAttribute("data-disabled"),
|
|
37
|
+
invalid: el.hasAttribute("data-invalid")
|
|
38
|
+
}));
|
|
39
|
+
this.spreadPropsByValue("itemText", ({ el, value }) => this.api.getItemTextProps({
|
|
40
|
+
value,
|
|
41
|
+
disabled: el.hasAttribute("data-disabled"),
|
|
42
|
+
invalid: el.hasAttribute("data-invalid")
|
|
43
|
+
}));
|
|
44
|
+
this.spreadPropsByValue("itemControl", ({ el, value }) => this.api.getItemControlProps({
|
|
45
|
+
value,
|
|
46
|
+
disabled: el.hasAttribute("data-disabled"),
|
|
47
|
+
invalid: el.hasAttribute("data-invalid")
|
|
48
|
+
}));
|
|
49
|
+
this.spreadPropsByValue("itemHiddenInput", ({ el, value }) => this.api.getItemHiddenInputProps({
|
|
50
|
+
value,
|
|
51
|
+
disabled: el.hasAttribute("data-disabled"),
|
|
52
|
+
invalid: el.hasAttribute("data-invalid")
|
|
53
|
+
}));
|
|
54
|
+
const indicatorEl = this.hydrator.query("indicator");
|
|
62
55
|
if (indicatorEl) this.spreadProps(indicatorEl, this.api.getIndicatorProps());
|
|
63
56
|
}
|
|
64
57
|
};
|
package/dist/scroll-area.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as scrollArea from "@zag-js/scroll-area";
|
|
1
|
+
import { c as Machine, z as Component } from "./index-B06gIN_k.js";
|
|
3
2
|
import { PropTypes } from "@zag-js/types";
|
|
3
|
+
import * as scrollArea from "@zag-js/scroll-area";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/ScrollArea/ScrollArea.d.ts
|
|
6
6
|
declare class ScrollArea extends Component<scrollArea.Props, scrollArea.Api<PropTypes>> {
|
|
7
|
-
static
|
|
7
|
+
static componentName: string;
|
|
8
8
|
initMachine(props: scrollArea.Props): Machine<any>;
|
|
9
9
|
initApi(): scrollArea.Api<PropTypes<{
|
|
10
10
|
[x: string]: any;
|
package/dist/scroll-area.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as normalizeProps, at as Machine, rt as Component } from "./Client-HrMIqv7d.js";
|
|
2
2
|
import * as scrollArea from "@zag-js/scroll-area";
|
|
3
3
|
|
|
4
4
|
//#region Resources/Private/Primitives/ScrollArea/ScrollArea.ts
|
|
5
5
|
var ScrollArea = class extends Component {
|
|
6
|
-
static
|
|
6
|
+
static componentName = "scrollArea";
|
|
7
7
|
initMachine(props) {
|
|
8
|
-
|
|
8
|
+
const [machineProps] = scrollArea.splitProps(props);
|
|
9
|
+
return new Machine(scrollArea.machine, machineProps);
|
|
9
10
|
}
|
|
10
11
|
initApi() {
|
|
11
12
|
return scrollArea.connect(this.machine.service, normalizeProps);
|
|
12
13
|
}
|
|
13
14
|
render() {
|
|
14
|
-
const rootEl = this.
|
|
15
|
+
const rootEl = this.hydrator.query("root");
|
|
15
16
|
if (rootEl) this.spreadProps(rootEl, this.api.getRootProps());
|
|
16
|
-
const viewportEl = this.
|
|
17
|
+
const viewportEl = this.hydrator.query("viewport");
|
|
17
18
|
if (viewportEl) this.spreadProps(viewportEl, this.api.getViewportProps());
|
|
18
|
-
const contentEl = this.
|
|
19
|
+
const contentEl = this.hydrator.query("content");
|
|
19
20
|
if (contentEl) this.spreadProps(contentEl, this.api.getContentProps());
|
|
20
|
-
this.
|
|
21
|
+
this.hydrator.queryAll("scrollbar").forEach((scrollbarEl) => {
|
|
21
22
|
this.spreadProps(scrollbarEl, this.api.getScrollbarProps({ orientation: scrollbarEl.getAttribute("data-orientation") }));
|
|
22
23
|
});
|
|
23
|
-
const cornerEl = this.
|
|
24
|
+
const cornerEl = this.hydrator.query("corner");
|
|
24
25
|
if (cornerEl) this.spreadProps(cornerEl, this.api.getCornerProps());
|
|
25
|
-
this.
|
|
26
|
+
this.hydrator.queryAll("thumb").forEach((thumbEl) => {
|
|
26
27
|
this.spreadProps(thumbEl, this.api.getThumbProps({ orientation: thumbEl.getAttribute("data-orientation") }));
|
|
27
28
|
});
|
|
28
29
|
}
|
package/dist/select.d.ts
CHANGED
|
@@ -1,59 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { X as ConverterMachineProps, b as FieldClientApi, c as Machine, h as getListCollectionFromHydrationData, y as FieldAwareComponent } from "./index-B06gIN_k.js";
|
|
2
2
|
import * as _$_zag_js_collection0 from "@zag-js/collection";
|
|
3
|
-
import * as select from "@zag-js/select";
|
|
4
3
|
import * as _$_zag_js_types0 from "@zag-js/types";
|
|
4
|
+
import * as select from "@zag-js/select";
|
|
5
5
|
|
|
6
6
|
//#region Resources/Private/Primitives/Select/Select.d.ts
|
|
7
|
+
declare const selectPropConverters: {
|
|
8
|
+
collection: (collection: Parameters<typeof getListCollectionFromHydrationData>[0]) => _$_zag_js_collection0.ListCollection<unknown>;
|
|
9
|
+
positioning: (positioning: select.Props["positioning"]) => select.PositioningOptions | undefined;
|
|
10
|
+
};
|
|
11
|
+
declare module 'fluid-primitives' {
|
|
12
|
+
interface HydrationPropsOverrides {
|
|
13
|
+
select: ConverterMachineProps<typeof selectPropConverters>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
7
16
|
declare class Select extends FieldAwareComponent<select.Props, select.Api> {
|
|
8
|
-
static
|
|
9
|
-
propsWithField(props: select.Props,
|
|
10
|
-
transformProps(props: select.Props): {
|
|
11
|
-
collection: _$_zag_js_collection0.ListCollection<any>;
|
|
12
|
-
translations?: select.IntlTranslations | undefined;
|
|
13
|
-
ids?: Partial<{
|
|
14
|
-
root: string;
|
|
15
|
-
content: string;
|
|
16
|
-
control: string;
|
|
17
|
-
trigger: string;
|
|
18
|
-
clearTrigger: string;
|
|
19
|
-
label: string;
|
|
20
|
-
hiddenSelect: string;
|
|
21
|
-
positioner: string;
|
|
22
|
-
item: (id: string | number) => string;
|
|
23
|
-
itemGroup: (id: string | number) => string;
|
|
24
|
-
itemGroupLabel: (id: string | number) => string;
|
|
25
|
-
}> | undefined;
|
|
26
|
-
name?: string | undefined;
|
|
27
|
-
form?: string | undefined;
|
|
28
|
-
autoComplete?: string | undefined;
|
|
29
|
-
disabled?: boolean | undefined;
|
|
30
|
-
invalid?: boolean | undefined;
|
|
31
|
-
readOnly?: boolean | undefined;
|
|
32
|
-
required?: boolean | undefined;
|
|
33
|
-
closeOnSelect?: boolean | undefined;
|
|
34
|
-
onSelect?: ((details: select.SelectionDetails) => void) | undefined;
|
|
35
|
-
onHighlightChange?: ((details: select.HighlightChangeDetails<any>) => void) | undefined;
|
|
36
|
-
onValueChange?: ((details: select.ValueChangeDetails<any>) => void) | undefined;
|
|
37
|
-
onOpenChange?: ((details: select.OpenChangeDetails) => void) | undefined;
|
|
38
|
-
positioning?: select.PositioningOptions | undefined;
|
|
39
|
-
value?: string[] | undefined;
|
|
40
|
-
defaultValue?: string[] | undefined;
|
|
41
|
-
highlightedValue?: string | null | undefined;
|
|
42
|
-
defaultHighlightedValue?: string | null | undefined;
|
|
43
|
-
loopFocus?: boolean | undefined;
|
|
44
|
-
multiple?: boolean | undefined;
|
|
45
|
-
open?: boolean | undefined;
|
|
46
|
-
defaultOpen?: boolean | undefined;
|
|
47
|
-
scrollToIndexFn?: ((details: select.ScrollToIndexDetails) => void) | undefined;
|
|
48
|
-
composite?: boolean | undefined;
|
|
49
|
-
deselectable?: boolean | undefined;
|
|
50
|
-
dir?: "ltr" | "rtl" | undefined;
|
|
51
|
-
id: string;
|
|
52
|
-
getRootNode?: (() => ShadowRoot | Document | Node) | undefined;
|
|
53
|
-
onPointerDownOutside?: ((event: select.PointerDownOutsideEvent) => void) | undefined;
|
|
54
|
-
onFocusOutside?: ((event: select.FocusOutsideEvent) => void) | undefined;
|
|
55
|
-
onInteractOutside?: ((event: select.InteractOutsideEvent) => void) | undefined;
|
|
56
|
-
};
|
|
17
|
+
static componentName: string;
|
|
18
|
+
propsWithField(props: select.Props, field: FieldClientApi): select.Props;
|
|
57
19
|
initMachine(props: select.Props): Machine<any>;
|
|
58
20
|
initApi(): select.Api<_$_zag_js_types0.PropTypes<{
|
|
59
21
|
[x: string]: any;
|
package/dist/select.js
CHANGED
|
@@ -1,84 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as getLabelId, t as getControlId } from "./field.dom-CJQXpQbZ.js";
|
|
1
|
+
import { $ as getListCollectionFromHydrationData, K as registerClientPropConverters, a as normalizeProps, at as Machine, o as mergeProps, s as FieldAwareComponent } from "./Client-HrMIqv7d.js";
|
|
3
2
|
import * as select from "@zag-js/select";
|
|
4
3
|
|
|
5
4
|
//#region Resources/Private/Primitives/Select/Select.ts
|
|
5
|
+
registerClientPropConverters("select", {
|
|
6
|
+
collection: (collection) => getListCollectionFromHydrationData(collection),
|
|
7
|
+
positioning: (positioning) => positioning
|
|
8
|
+
});
|
|
6
9
|
var Select = class extends FieldAwareComponent {
|
|
7
|
-
static
|
|
8
|
-
propsWithField(props,
|
|
10
|
+
static componentName = "select";
|
|
11
|
+
propsWithField(props, field) {
|
|
9
12
|
return {
|
|
10
13
|
...props,
|
|
11
|
-
disabled: props.disabled ??
|
|
12
|
-
readOnly: props.readOnly ??
|
|
13
|
-
required: props.required ??
|
|
14
|
-
invalid: props.invalid ??
|
|
15
|
-
name: props.name ??
|
|
16
|
-
ids: {
|
|
17
|
-
...props.ids,
|
|
18
|
-
label: getLabelId(fieldMachine.scope),
|
|
19
|
-
hiddenSelect: getControlId(fieldMachine.scope)
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
transformProps(props) {
|
|
24
|
-
return {
|
|
25
|
-
...props,
|
|
26
|
-
get collection() {
|
|
27
|
-
return getListCollectionFromHydrationData(props.collection);
|
|
28
|
-
}
|
|
14
|
+
disabled: props.disabled ?? field.disabled,
|
|
15
|
+
readOnly: props.readOnly ?? field.readOnly,
|
|
16
|
+
required: props.required ?? field.required,
|
|
17
|
+
invalid: props.invalid ?? field.invalid,
|
|
18
|
+
name: props.name ?? field.name
|
|
29
19
|
};
|
|
30
20
|
}
|
|
31
21
|
initMachine(props) {
|
|
32
|
-
|
|
33
|
-
return new Machine(select.machine,
|
|
22
|
+
const [machineProps] = select.splitProps(this.withFieldProps(props));
|
|
23
|
+
return new Machine(select.machine, machineProps);
|
|
34
24
|
}
|
|
35
25
|
initApi() {
|
|
36
26
|
return select.connect(this.machine.service, normalizeProps);
|
|
37
27
|
}
|
|
38
28
|
render = () => {
|
|
39
29
|
this.subscribeToFieldService();
|
|
40
|
-
const rootEl = this.
|
|
30
|
+
const rootEl = this.hydrator.query("root");
|
|
41
31
|
if (rootEl) this.spreadProps(rootEl, this.api.getRootProps());
|
|
42
|
-
const controlEl = this.
|
|
32
|
+
const controlEl = this.hydrator.query("control");
|
|
43
33
|
if (controlEl) this.spreadProps(controlEl, this.api.getControlProps());
|
|
44
|
-
const hiddenSelectEl = this.
|
|
34
|
+
const hiddenSelectEl = this.hydrator.query("hiddenSelect");
|
|
45
35
|
if (hiddenSelectEl) {
|
|
46
|
-
|
|
47
|
-
this.
|
|
36
|
+
this.spreadProps(hiddenSelectEl, this.api.getHiddenSelectProps());
|
|
37
|
+
const isValueEmpty = this.api.value.length === 0;
|
|
38
|
+
const defaultOption = hiddenSelectEl.querySelector("option");
|
|
39
|
+
if (defaultOption) defaultOption.selected = isValueEmpty;
|
|
48
40
|
}
|
|
49
|
-
const labelEl = this.
|
|
41
|
+
const labelEl = this.hydrator.query("label");
|
|
50
42
|
if (labelEl) this.spreadProps(labelEl, this.api.getLabelProps());
|
|
51
|
-
const triggerEl = this.
|
|
52
|
-
if (triggerEl)
|
|
53
|
-
|
|
43
|
+
const triggerEl = this.hydrator.query("trigger");
|
|
44
|
+
if (triggerEl) {
|
|
45
|
+
const mergedProps = mergeProps(this.api.getTriggerProps(), { "aria-describedby": this.field?.ariaDescribedby });
|
|
46
|
+
this.spreadProps(triggerEl, mergedProps);
|
|
47
|
+
}
|
|
48
|
+
const positionerEl = this.hydrator.query("positioner");
|
|
54
49
|
if (positionerEl) this.spreadProps(positionerEl, this.api.getPositionerProps());
|
|
55
|
-
const contentEl = this.
|
|
50
|
+
const contentEl = this.hydrator.query("content");
|
|
56
51
|
if (contentEl) this.spreadProps(contentEl, this.api.getContentProps());
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
52
|
+
const listEl = this.hydrator.query("list");
|
|
53
|
+
if (listEl) this.spreadProps(listEl, this.api.getListProps());
|
|
54
|
+
const valueTextEl = this.hydrator.query("valueText");
|
|
55
|
+
if (valueTextEl) {
|
|
56
|
+
const currentText = valueTextEl.textContent || valueTextEl.dataset.placeholder || "";
|
|
57
|
+
const nextValue = this.api.valueAsString || valueTextEl.dataset.placeholder || "";
|
|
58
|
+
this.spreadProps(valueTextEl, mergeProps(this.api.getValueTextProps(), { children: nextValue }));
|
|
59
|
+
if (nextValue !== currentText) queueMicrotask(() => {
|
|
60
|
+
const el = this.hydrator.query("valueText");
|
|
61
|
+
if (el?.isConnected) {
|
|
62
|
+
const next = el.cloneNode(true);
|
|
63
|
+
el.replaceWith(next);
|
|
64
|
+
next.replaceWith(el);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
this.spreadPropsByValue("itemGroup", ({ value }) => {
|
|
69
|
+
return this.api.getItemGroupProps({ id: value });
|
|
63
70
|
});
|
|
64
|
-
this.
|
|
65
|
-
|
|
66
|
-
if (item) this.spreadProps(itemEl, this.api.getItemProps({ item }));
|
|
71
|
+
this.spreadPropsByValue("itemGroupLabel", ({ value }) => {
|
|
72
|
+
return this.api.getItemGroupLabelProps({ htmlFor: value });
|
|
67
73
|
});
|
|
68
|
-
this.
|
|
69
|
-
const item = this.api.collection.find(
|
|
70
|
-
|
|
74
|
+
this.spreadPropsByValue("item", ({ value }) => {
|
|
75
|
+
const item = this.api.collection.find(value);
|
|
76
|
+
return item ? this.api.getItemProps({ item }) : null;
|
|
71
77
|
});
|
|
72
|
-
this.
|
|
73
|
-
const item = this.api.collection.find(
|
|
74
|
-
|
|
78
|
+
this.spreadPropsByValue("itemText", ({ value }) => {
|
|
79
|
+
const item = this.api.collection.find(value);
|
|
80
|
+
return item ? this.api.getItemTextProps({ item }) : null;
|
|
75
81
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
this.spreadPropsByValue("itemIndicator", ({ value }) => {
|
|
83
|
+
const item = this.api.collection.find(value);
|
|
84
|
+
return item ? this.api.getItemIndicatorProps({ item }) : null;
|
|
85
|
+
});
|
|
86
|
+
const clearTriggerEl = this.hydrator.query("clearTrigger");
|
|
87
|
+
if (clearTriggerEl) this.spreadProps(clearTriggerEl, this.api.getClearTriggerProps());
|
|
88
|
+
const indicatorEl = this.hydrator.query("indicator");
|
|
82
89
|
if (indicatorEl) this.spreadProps(indicatorEl, this.api.getIndicatorProps());
|
|
83
90
|
};
|
|
84
91
|
};
|
package/dist/slider.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { X as ConverterMachineProps, b as FieldClientApi, c as Machine, y as FieldAwareComponent } from "./index-B06gIN_k.js";
|
|
2
|
+
import * as _$_zag_js_types0 from "@zag-js/types";
|
|
3
|
+
import * as slider from "@zag-js/slider";
|
|
4
|
+
|
|
5
|
+
//#region Resources/Private/Primitives/Slider/Slider.d.ts
|
|
6
|
+
declare const sliderPropConverters: {
|
|
7
|
+
thumbSize: (thumbSize: slider.Props["thumbSize"]) => {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
} | undefined;
|
|
11
|
+
};
|
|
12
|
+
declare module 'fluid-primitives' {
|
|
13
|
+
interface HydrationPropsOverrides {
|
|
14
|
+
slider: ConverterMachineProps<typeof sliderPropConverters>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare class Slider extends FieldAwareComponent<slider.Props, slider.Api> {
|
|
18
|
+
static componentName: string;
|
|
19
|
+
propsWithField(props: slider.Props, field: FieldClientApi): slider.Props;
|
|
20
|
+
initMachine(props: slider.Props): Machine<any>;
|
|
21
|
+
initApi(): slider.Api<_$_zag_js_types0.PropTypes<{
|
|
22
|
+
[x: string]: any;
|
|
23
|
+
}>>;
|
|
24
|
+
render(): void;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Slider };
|