@wirekyt/solid 0.0.1 → 0.0.3
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.ts +68 -0
- package/dist/accordion.js +168 -0
- package/dist/accordion.jsx +143 -0
- package/dist/angle-slider.d.ts +72 -0
- package/dist/angle-slider.js +141 -0
- package/dist/angle-slider.jsx +130 -0
- package/dist/avatar.d.ts +47 -0
- package/dist/avatar.js +86 -0
- package/dist/avatar.jsx +79 -0
- package/dist/carousel.d.ts +92 -0
- package/dist/carousel.js +189 -0
- package/dist/carousel.jsx +174 -0
- package/dist/checkbox.d.ts +140 -0
- package/dist/checkbox.js +252 -0
- package/dist/checkbox.jsx +234 -0
- package/dist/client-only.d.ts +9 -0
- package/dist/client-only.js +22 -0
- package/dist/client-only.jsx +13 -0
- package/dist/clipboard.d.ts +70 -0
- package/dist/clipboard.js +137 -0
- package/dist/clipboard.jsx +120 -0
- package/dist/collapsible-BwNoH1At.jsx +106 -0
- package/dist/collapsible-Dp8aqjtN.js +118 -0
- package/dist/collapsible.d.ts +58 -0
- package/dist/collapsible.js +2 -0
- package/dist/collapsible.jsx +2 -0
- package/dist/collection-By8qgqkx.js +213 -0
- package/dist/collection-Mkvw6TyT.jsx +213 -0
- package/dist/collection.d.ts +2 -0
- package/dist/collection.js +2 -0
- package/dist/collection.jsx +2 -0
- package/dist/color-picker.d.ts +179 -0
- package/dist/color-picker.js +457 -0
- package/dist/color-picker.jsx +395 -0
- package/dist/combobox.d.ts +128 -0
- package/dist/combobox.js +326 -0
- package/dist/combobox.jsx +284 -0
- package/dist/core-7QKBNp9p.js +485 -0
- package/dist/core-7QKBNp9p.jsx +485 -0
- package/dist/date-input.d.ts +68 -0
- package/dist/date-input.js +178 -0
- package/dist/date-input.jsx +163 -0
- package/dist/date-picker.d.ts +191 -0
- package/dist/date-picker.js +506 -0
- package/dist/date-picker.jsx +430 -0
- package/dist/dialog.d.ts +77 -0
- package/dist/dialog.js +205 -0
- package/dist/dialog.jsx +159 -0
- package/dist/download-trigger.d.ts +22 -0
- package/dist/download-trigger.js +55 -0
- package/dist/download-trigger.jsx +51 -0
- package/dist/drawer.d.ts +114 -0
- package/dist/drawer.js +291 -0
- package/dist/drawer.jsx +237 -0
- package/dist/editable.d.ts +77 -0
- package/dist/editable.js +171 -0
- package/dist/editable.jsx +162 -0
- package/dist/factory-D2A7xdtl.js +34 -0
- package/dist/factory-DRw_slzE.jsx +34 -0
- package/dist/factory-wuwfJqbU.d.ts +15 -0
- package/dist/field-CQr_Dibp.js +317 -0
- package/dist/field-R5jVNdtK.jsx +282 -0
- package/dist/field.d.ts +194 -0
- package/dist/field.js +2 -0
- package/dist/field.jsx +2 -0
- package/dist/fieldset-5shfE0Z5.jsx +155 -0
- package/dist/fieldset-D5teGLZ9.js +170 -0
- package/dist/fieldset.d.ts +98 -0
- package/dist/fieldset.js +2 -0
- package/dist/fieldset.jsx +2 -0
- package/dist/file-upload.d.ts +100 -0
- package/dist/file-upload.js +254 -0
- package/dist/file-upload.jsx +232 -0
- package/dist/floating-panel.d.ts +97 -0
- package/dist/floating-panel.js +231 -0
- package/dist/floating-panel.jsx +199 -0
- package/dist/focus-trap.d.ts +12 -0
- package/dist/focus-trap.js +30 -0
- package/dist/focus-trap.jsx +26 -0
- package/dist/format.d.ts +32 -0
- package/dist/format.js +50 -0
- package/dist/format.jsx +53 -0
- package/dist/frame.d.ts +12 -0
- package/dist/frame.js +119 -0
- package/dist/frame.jsx +83 -0
- package/dist/image-cropper.d.ts +62 -0
- package/dist/image-cropper.js +137 -0
- package/dist/image-cropper.jsx +130 -0
- package/dist/index-B17eqq14.d.ts +32 -0
- package/dist/index-BZHmHI7d.d.ts +142 -0
- package/dist/index-CANuc1X0.d.ts +81 -0
- package/dist/index-CJwZCGOS.d.ts +75 -0
- package/dist/index-ClU-Lb8Z.d.ts +23 -0
- package/dist/index-J9N2CBHP.d.ts +21 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.jsx +5 -0
- package/dist/json-tree-view.d.ts +50 -0
- package/dist/json-tree-view.js +330 -0
- package/dist/json-tree-view.jsx +201 -0
- package/dist/listbox.d.ts +109 -0
- package/dist/listbox.js +237 -0
- package/dist/listbox.jsx +212 -0
- package/dist/marquee.d.ts +57 -0
- package/dist/marquee.js +125 -0
- package/dist/marquee.jsx +113 -0
- package/dist/menu.d.ts +158 -0
- package/dist/menu.js +441 -0
- package/dist/menu.jsx +362 -0
- package/dist/navigation-menu.d.ts +88 -0
- package/dist/navigation-menu.js +289 -0
- package/dist/navigation-menu.jsx +228 -0
- package/dist/number-input.d.ts +72 -0
- package/dist/number-input.js +166 -0
- package/dist/number-input.jsx +157 -0
- package/dist/pagination.d.ts +67 -0
- package/dist/pagination.js +131 -0
- package/dist/pagination.jsx +124 -0
- package/dist/password-input.d.ts +64 -0
- package/dist/password-input.js +144 -0
- package/dist/password-input.jsx +125 -0
- package/dist/pin-input.d.ts +57 -0
- package/dist/pin-input.js +138 -0
- package/dist/pin-input.jsx +129 -0
- package/dist/popover.d.ts +92 -0
- package/dist/popover.js +206 -0
- package/dist/popover.jsx +174 -0
- package/dist/presence-9UGkuyfn.jsx +59 -0
- package/dist/presence-CE6lXCu5.js +72 -0
- package/dist/presence.d.ts +2 -0
- package/dist/presence.js +2 -0
- package/dist/presence.jsx +2 -0
- package/dist/progress.d.ts +77 -0
- package/dist/progress.js +146 -0
- package/dist/progress.jsx +137 -0
- package/dist/providers-B-Vi5wQ7.js +124 -0
- package/dist/providers-CqNHqLpB.jsx +110 -0
- package/dist/qr-code.d.ts +57 -0
- package/dist/qr-code.js +111 -0
- package/dist/qr-code.jsx +104 -0
- package/dist/radio-group.d.ts +77 -0
- package/dist/radio-group.js +170 -0
- package/dist/radio-group.jsx +157 -0
- package/dist/rating-group.d.ts +67 -0
- package/dist/rating-group.js +142 -0
- package/dist/rating-group.jsx +131 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/rolldown-runtime-D7D4PA-g.jsx +13 -0
- package/dist/run-if-fn-CjvD7VzQ.js +5 -0
- package/dist/run-if-fn-CjvD7VzQ.jsx +5 -0
- package/dist/scroll-area.d.ts +61 -0
- package/dist/scroll-area.js +119 -0
- package/dist/scroll-area.jsx +109 -0
- package/dist/segment-group.d.ts +80 -0
- package/dist/segment-group.js +166 -0
- package/dist/segment-group.jsx +153 -0
- package/dist/select.d.ts +132 -0
- package/dist/select.js +337 -0
- package/dist/select.jsx +283 -0
- package/dist/signature-pad.d.ts +67 -0
- package/dist/signature-pad.js +159 -0
- package/dist/signature-pad.jsx +141 -0
- package/dist/slider.d.ts +87 -0
- package/dist/slider.js +191 -0
- package/dist/slider.jsx +179 -0
- package/dist/splitter.d.ts +57 -0
- package/dist/splitter.js +126 -0
- package/dist/splitter.jsx +116 -0
- package/dist/steps.d.ts +100 -0
- package/dist/steps.js +199 -0
- package/dist/steps.jsx +184 -0
- package/dist/swap.d.ts +51 -0
- package/dist/swap.js +123 -0
- package/dist/swap.jsx +106 -0
- package/dist/switch.d.ts +57 -0
- package/dist/switch.js +125 -0
- package/dist/switch.jsx +116 -0
- package/dist/tabs.d.ts +58 -0
- package/dist/tabs.js +146 -0
- package/dist/tabs.jsx +122 -0
- package/dist/tags-input.d.ts +97 -0
- package/dist/tags-input.js +228 -0
- package/dist/tags-input.jsx +213 -0
- package/dist/timer.d.ts +62 -0
- package/dist/timer.js +119 -0
- package/dist/timer.jsx +110 -0
- package/dist/toast.d.ts +60 -0
- package/dist/toast.js +120 -0
- package/dist/toast.jsx +106 -0
- package/dist/toggle-group.d.ts +42 -0
- package/dist/toggle-group.js +87 -0
- package/dist/toggle-group.jsx +80 -0
- package/dist/toggle.d.ts +38 -0
- package/dist/toggle.js +73 -0
- package/dist/toggle.jsx +61 -0
- package/dist/tooltip.d.ts +67 -0
- package/dist/tooltip.js +159 -0
- package/dist/tooltip.jsx +127 -0
- package/dist/tour.d.ts +112 -0
- package/dist/tour.js +256 -0
- package/dist/tour.jsx +192 -0
- package/dist/tree-view-ATyeBPXq.js +290 -0
- package/dist/tree-view-CoWx7osT.jsx +265 -0
- package/dist/tree-view.d.ts +3 -0
- package/dist/tree-view.js +3 -0
- package/dist/tree-view.jsx +3 -0
- package/package.json +324 -6
package/dist/timer.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { a as mergeProps$2, d as createContext$1, i as useMachine, l as createSplitProps, r as normalizeProps } from "./core-7QKBNp9p.js";
|
|
3
|
+
import { t as runIfFn } from "./run-if-fn-CjvD7VzQ.js";
|
|
4
|
+
import { t as wire } from "./factory-D2A7xdtl.js";
|
|
5
|
+
import { l as useEnvironmentContext } from "./providers-B-Vi5wQ7.js";
|
|
6
|
+
import { createMemo, createUniqueId } from "solid-js";
|
|
7
|
+
import { createComponent, mergeProps as mergeProps$1 } from "solid-js/web";
|
|
8
|
+
import * as timer from "@wirekyt/dom/machines/timer";
|
|
9
|
+
import { anatomy as timerAnatomy } from "@wirekyt/dom/machines/timer";
|
|
10
|
+
//#region src/components/timer/use-context.ts
|
|
11
|
+
const [TimerProvider, useTimerContext] = createContext$1({
|
|
12
|
+
hookName: "useTimerContext",
|
|
13
|
+
providerName: "<TimerProvider />"
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/timer/action-trigger.tsx
|
|
17
|
+
const TimerActionTrigger = (props) => {
|
|
18
|
+
const [actionTriggerProps, localProps] = createSplitProps()(props, ["action"]);
|
|
19
|
+
const timer = useTimerContext();
|
|
20
|
+
const mergedProps = mergeProps$2(() => timer().getActionTriggerProps(actionTriggerProps), localProps);
|
|
21
|
+
return createComponent(wire.button, mergedProps);
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/components/timer/area.tsx
|
|
25
|
+
const TimerArea = (props) => {
|
|
26
|
+
const timer = useTimerContext();
|
|
27
|
+
const mergedProps = mergeProps$2(() => timer().getAreaProps(), props);
|
|
28
|
+
return createComponent(wire.div, mergedProps);
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/components/timer/context.tsx
|
|
32
|
+
const TimerContext = (props) => props.children(useTimerContext());
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/timer/control.tsx
|
|
35
|
+
const TimerControl = (props) => {
|
|
36
|
+
const timer = useTimerContext();
|
|
37
|
+
const mergedProps = mergeProps$2(() => timer().getControlProps(), props);
|
|
38
|
+
return createComponent(wire.div, mergedProps);
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/timer/item.tsx
|
|
42
|
+
const TimerItem = (props) => {
|
|
43
|
+
const [itemProps, localProps] = createSplitProps()(props, ["type"]);
|
|
44
|
+
const timer = useTimerContext();
|
|
45
|
+
const mergedProps = mergeProps$2(() => timer().getItemProps(itemProps), localProps);
|
|
46
|
+
return createComponent(wire.div, mergeProps$1(mergedProps, { get children() {
|
|
47
|
+
return timer().formattedTime[itemProps.type];
|
|
48
|
+
} }));
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/components/timer/use.ts
|
|
52
|
+
const useTimer = (props) => {
|
|
53
|
+
const id = createUniqueId();
|
|
54
|
+
const environment = useEnvironmentContext();
|
|
55
|
+
const machineProps = createMemo(() => ({
|
|
56
|
+
id,
|
|
57
|
+
getRootNode: environment().getRootNode,
|
|
58
|
+
...runIfFn(props)
|
|
59
|
+
}));
|
|
60
|
+
const service = useMachine(timer.machine, machineProps);
|
|
61
|
+
return createMemo(() => timer.connect(service, normalizeProps));
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/components/timer/root.tsx
|
|
65
|
+
const TimerRoot = (props) => {
|
|
66
|
+
const [useTimerProps, localProps] = createSplitProps()(props, [
|
|
67
|
+
"id",
|
|
68
|
+
"ids",
|
|
69
|
+
"autoStart",
|
|
70
|
+
"interval",
|
|
71
|
+
"countdown",
|
|
72
|
+
"startMs",
|
|
73
|
+
"targetMs",
|
|
74
|
+
"translations",
|
|
75
|
+
"onComplete",
|
|
76
|
+
"onTick"
|
|
77
|
+
]);
|
|
78
|
+
const timer = useTimer(useTimerProps);
|
|
79
|
+
const mergedProps = mergeProps$2(() => timer().getRootProps(), localProps);
|
|
80
|
+
return createComponent(TimerProvider, {
|
|
81
|
+
value: timer,
|
|
82
|
+
get children() {
|
|
83
|
+
return createComponent(wire.div, mergedProps);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/components/timer/root-provider.tsx
|
|
89
|
+
const TimerRootProvider = (props) => {
|
|
90
|
+
const [{ value: timer }, localProps] = createSplitProps()(props, ["value"]);
|
|
91
|
+
const mergedProps = mergeProps$2(() => timer().getRootProps(), localProps);
|
|
92
|
+
return createComponent(TimerProvider, {
|
|
93
|
+
value: timer,
|
|
94
|
+
get children() {
|
|
95
|
+
return createComponent(wire.div, mergedProps);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/components/timer/separator.tsx
|
|
101
|
+
const TimerSeparator = (props) => {
|
|
102
|
+
const timer = useTimerContext();
|
|
103
|
+
const mergedProps = mergeProps$2(() => timer().getSeparatorProps(), props);
|
|
104
|
+
return createComponent(wire.div, mergedProps);
|
|
105
|
+
};
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/components/timer/timer.ts
|
|
108
|
+
var timer_exports = /* @__PURE__ */ __exportAll({
|
|
109
|
+
ActionTrigger: () => TimerActionTrigger,
|
|
110
|
+
Area: () => TimerArea,
|
|
111
|
+
Context: () => TimerContext,
|
|
112
|
+
Control: () => TimerControl,
|
|
113
|
+
Item: () => TimerItem,
|
|
114
|
+
Root: () => TimerRoot,
|
|
115
|
+
RootProvider: () => TimerRootProvider,
|
|
116
|
+
Separator: () => TimerSeparator
|
|
117
|
+
});
|
|
118
|
+
//#endregion
|
|
119
|
+
export { timer_exports as Timer, TimerActionTrigger, TimerArea, TimerContext, TimerControl, TimerItem, TimerRoot, TimerRootProvider, TimerSeparator, timerAnatomy, useTimer, useTimerContext };
|
package/dist/timer.jsx
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.jsx";
|
|
2
|
+
import { a as mergeProps$1, d as createContext$1, i as useMachine, l as createSplitProps, r as normalizeProps } from "./core-7QKBNp9p.jsx";
|
|
3
|
+
import { t as runIfFn } from "./run-if-fn-CjvD7VzQ.jsx";
|
|
4
|
+
import { t as wire } from "./factory-DRw_slzE.jsx";
|
|
5
|
+
import { l as useEnvironmentContext } from "./providers-CqNHqLpB.jsx";
|
|
6
|
+
import { createMemo, createUniqueId } from "solid-js";
|
|
7
|
+
import * as timer from "@wirekyt/dom/machines/timer";
|
|
8
|
+
import { anatomy as timerAnatomy } from "@wirekyt/dom/machines/timer";
|
|
9
|
+
//#region src/components/timer/use-context.ts
|
|
10
|
+
const [TimerProvider, useTimerContext] = createContext$1({
|
|
11
|
+
hookName: "useTimerContext",
|
|
12
|
+
providerName: "<TimerProvider />"
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/timer/action-trigger.tsx
|
|
16
|
+
const TimerActionTrigger = (props) => {
|
|
17
|
+
const [actionTriggerProps, localProps] = createSplitProps()(props, ["action"]);
|
|
18
|
+
const timer = useTimerContext();
|
|
19
|
+
const mergedProps = mergeProps$1(() => timer().getActionTriggerProps(actionTriggerProps), localProps);
|
|
20
|
+
return <wire.button {...mergedProps} />;
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/timer/area.tsx
|
|
24
|
+
const TimerArea = (props) => {
|
|
25
|
+
const timer = useTimerContext();
|
|
26
|
+
const mergedProps = mergeProps$1(() => timer().getAreaProps(), props);
|
|
27
|
+
return <wire.div {...mergedProps} />;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/timer/context.tsx
|
|
31
|
+
const TimerContext = (props) => props.children(useTimerContext());
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/timer/control.tsx
|
|
34
|
+
const TimerControl = (props) => {
|
|
35
|
+
const timer = useTimerContext();
|
|
36
|
+
const mergedProps = mergeProps$1(() => timer().getControlProps(), props);
|
|
37
|
+
return <wire.div {...mergedProps} />;
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/components/timer/item.tsx
|
|
41
|
+
const TimerItem = (props) => {
|
|
42
|
+
const [itemProps, localProps] = createSplitProps()(props, ["type"]);
|
|
43
|
+
const timer = useTimerContext();
|
|
44
|
+
const mergedProps = mergeProps$1(() => timer().getItemProps(itemProps), localProps);
|
|
45
|
+
return <wire.div {...mergedProps}>{timer().formattedTime[itemProps.type]}</wire.div>;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/timer/use.ts
|
|
49
|
+
const useTimer = (props) => {
|
|
50
|
+
const id = createUniqueId();
|
|
51
|
+
const environment = useEnvironmentContext();
|
|
52
|
+
const machineProps = createMemo(() => ({
|
|
53
|
+
id,
|
|
54
|
+
getRootNode: environment().getRootNode,
|
|
55
|
+
...runIfFn(props)
|
|
56
|
+
}));
|
|
57
|
+
const service = useMachine(timer.machine, machineProps);
|
|
58
|
+
return createMemo(() => timer.connect(service, normalizeProps));
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/components/timer/root.tsx
|
|
62
|
+
const TimerRoot = (props) => {
|
|
63
|
+
const [useTimerProps, localProps] = createSplitProps()(props, [
|
|
64
|
+
"id",
|
|
65
|
+
"ids",
|
|
66
|
+
"autoStart",
|
|
67
|
+
"interval",
|
|
68
|
+
"countdown",
|
|
69
|
+
"startMs",
|
|
70
|
+
"targetMs",
|
|
71
|
+
"translations",
|
|
72
|
+
"onComplete",
|
|
73
|
+
"onTick"
|
|
74
|
+
]);
|
|
75
|
+
const timer = useTimer(useTimerProps);
|
|
76
|
+
const mergedProps = mergeProps$1(() => timer().getRootProps(), localProps);
|
|
77
|
+
return <TimerProvider value={timer}>
|
|
78
|
+
<wire.div {...mergedProps} />
|
|
79
|
+
</TimerProvider>;
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/components/timer/root-provider.tsx
|
|
83
|
+
const TimerRootProvider = (props) => {
|
|
84
|
+
const [{ value: timer }, localProps] = createSplitProps()(props, ["value"]);
|
|
85
|
+
const mergedProps = mergeProps$1(() => timer().getRootProps(), localProps);
|
|
86
|
+
return <TimerProvider value={timer}>
|
|
87
|
+
<wire.div {...mergedProps} />
|
|
88
|
+
</TimerProvider>;
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/components/timer/separator.tsx
|
|
92
|
+
const TimerSeparator = (props) => {
|
|
93
|
+
const timer = useTimerContext();
|
|
94
|
+
const mergedProps = mergeProps$1(() => timer().getSeparatorProps(), props);
|
|
95
|
+
return <wire.div {...mergedProps} />;
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/components/timer/timer.ts
|
|
99
|
+
var timer_exports = /* @__PURE__ */ __exportAll({
|
|
100
|
+
ActionTrigger: () => TimerActionTrigger,
|
|
101
|
+
Area: () => TimerArea,
|
|
102
|
+
Context: () => TimerContext,
|
|
103
|
+
Control: () => TimerControl,
|
|
104
|
+
Item: () => TimerItem,
|
|
105
|
+
Root: () => TimerRoot,
|
|
106
|
+
RootProvider: () => TimerRootProvider,
|
|
107
|
+
Separator: () => TimerSeparator
|
|
108
|
+
});
|
|
109
|
+
//#endregion
|
|
110
|
+
export { timer_exports as Timer, TimerActionTrigger, TimerArea, TimerContext, TimerControl, TimerItem, TimerRoot, TimerRootProvider, TimerSeparator, timerAnatomy, useTimer, useTimerContext };
|
package/dist/toast.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { n as Assign, s as PropTypes } from "./index-ClU-Lb8Z.js";
|
|
2
|
+
import { r as PolymorphicProps, t as HTMLProps } from "./factory-wuwfJqbU.js";
|
|
3
|
+
import { Accessor, JSX } from "solid-js";
|
|
4
|
+
import * as toast from "@wirekyt/dom/machines/toast";
|
|
5
|
+
import { ActionOptions, ActionOptions as ToastActionOptions, Placement, Placement as ToastPlacement, PromiseOptions, PromiseOptions as ToastPromiseOptions, Status, Status as ToastStatus, StatusChangeDetails, StatusChangeDetails as ToastStatusChangeDetails, StoreProps, StoreProps as ToastStoreProps, Type, Type as ToastType, anatomy as toastAnatomy } from "@wirekyt/dom/machines/toast";
|
|
6
|
+
//#region src/components/toast/create-toaster.d.ts
|
|
7
|
+
interface CreateToasterProps extends Partial<toast.StoreProps> {
|
|
8
|
+
placement: toast.Placement;
|
|
9
|
+
}
|
|
10
|
+
interface CreateToasterReturn extends toast.Store<JSX.Element> {}
|
|
11
|
+
declare const createToaster: (props: CreateToasterProps) => CreateToasterReturn;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/toast/action-trigger.d.ts
|
|
14
|
+
interface ToastActionTriggerBaseProps extends PolymorphicProps<"button"> {}
|
|
15
|
+
interface ToastActionTriggerProps extends HTMLProps<"button">, ToastActionTriggerBaseProps {}
|
|
16
|
+
declare const ToastActionTrigger: (props: ToastActionTriggerProps) => import("solid-js").JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/components/toast/close-trigger.d.ts
|
|
19
|
+
interface ToastCloseTriggerBaseProps extends PolymorphicProps<"button"> {}
|
|
20
|
+
interface ToastCloseTriggerProps extends HTMLProps<"button">, ToastCloseTriggerBaseProps {}
|
|
21
|
+
declare const ToastCloseTrigger: (props: ToastCloseTriggerProps) => import("solid-js").JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/toast/use-context.d.ts
|
|
24
|
+
interface UseToastContext extends Accessor<toast.Api<PropTypes, JSX.Element>> {}
|
|
25
|
+
declare const ToastProvider: import("solid-js").ContextProviderComponent<UseToastContext>, useToastContext: () => UseToastContext;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/toast/context.d.ts
|
|
28
|
+
interface ToastContextProps {
|
|
29
|
+
children: (context: UseToastContext) => JSX.Element;
|
|
30
|
+
}
|
|
31
|
+
declare const ToastContext: (props: ToastContextProps) => JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/toast/description.d.ts
|
|
34
|
+
interface ToastDescriptionBaseProps extends PolymorphicProps<"div"> {}
|
|
35
|
+
interface ToastDescriptionProps extends HTMLProps<"div">, ToastDescriptionBaseProps {}
|
|
36
|
+
declare const ToastDescription: (props: ToastDescriptionProps) => import("solid-js").JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/toast/root.d.ts
|
|
39
|
+
interface ToastRootBaseProps extends PolymorphicProps<"div"> {}
|
|
40
|
+
interface ToastRootProps extends HTMLProps<"div">, ToastRootBaseProps {}
|
|
41
|
+
declare const ToastRoot: (props: ToastRootProps) => import("solid-js").JSX.Element;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/toast/title.d.ts
|
|
44
|
+
interface ToastTitleBaseProps extends PolymorphicProps<"div"> {}
|
|
45
|
+
interface ToastTitleProps extends HTMLProps<"div">, ToastTitleBaseProps {}
|
|
46
|
+
declare const ToastTitle: (props: ToastTitleProps) => import("solid-js").JSX.Element;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/toast/toaster.d.ts
|
|
49
|
+
type ToastOptions = toast.Options<JSX.Element>;
|
|
50
|
+
interface ToasterBaseProps extends PolymorphicProps<"div">, Omit<toast.GroupProps, "id" | "store"> {
|
|
51
|
+
toaster: CreateToasterReturn;
|
|
52
|
+
children: (toast: Accessor<ToastOptions>) => JSX.Element;
|
|
53
|
+
}
|
|
54
|
+
interface ToasterProps extends Assign<HTMLProps<"div">, ToasterBaseProps> {}
|
|
55
|
+
declare const Toaster: (props: ToasterProps) => JSX.Element;
|
|
56
|
+
declare namespace toast_d_exports {
|
|
57
|
+
export { ActionOptions, ToastActionTrigger as ActionTrigger, ToastActionTriggerBaseProps as ActionTriggerBaseProps, ToastActionTriggerProps as ActionTriggerProps, ToastCloseTrigger as CloseTrigger, ToastCloseTriggerBaseProps as CloseTriggerBaseProps, ToastCloseTriggerProps as CloseTriggerProps, ToastContext as Context, ToastContextProps as ContextProps, ToastDescription as Description, ToastDescriptionBaseProps as DescriptionBaseProps, ToastDescriptionProps as DescriptionProps, ToastOptions as Options, Placement, PromiseOptions, ToastRoot as Root, ToastRootBaseProps as RootBaseProps, ToastRootProps as RootProps, Status, StatusChangeDetails, StoreProps, ToastTitle as Title, ToastTitleBaseProps as TitleBaseProps, ToastTitleProps as TitleProps, Type };
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { type CreateToasterProps, type CreateToasterReturn, toast_d_exports as Toast, type ToastActionOptions, ToastActionTrigger, type ToastActionTriggerBaseProps, type ToastActionTriggerProps, ToastCloseTrigger, type ToastCloseTriggerBaseProps, type ToastCloseTriggerProps, ToastContext, type ToastContextProps, ToastDescription, type ToastDescriptionBaseProps, type ToastDescriptionProps, type ToastOptions, type ToastPlacement, type ToastPromiseOptions, ToastRoot, type ToastRootBaseProps, type ToastRootProps, type ToastStatus, type ToastStatusChangeDetails, type ToastStoreProps, ToastTitle, type ToastTitleBaseProps, type ToastTitleProps, type ToastType, Toaster, type ToasterBaseProps, type ToasterProps, type UseToastContext, createToaster, toastAnatomy, useToastContext };
|
package/dist/toast.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { a as mergeProps$2, d as createContext$1, i as useMachine, r as normalizeProps, t as Key } from "./core-7QKBNp9p.js";
|
|
3
|
+
import { t as wire } from "./factory-D2A7xdtl.js";
|
|
4
|
+
import { a as useLocaleContext, l as useEnvironmentContext } from "./providers-B-Vi5wQ7.js";
|
|
5
|
+
import { createMemo, createUniqueId, splitProps } from "solid-js";
|
|
6
|
+
import { createComponent, memo, mergeProps as mergeProps$1 } from "solid-js/web";
|
|
7
|
+
import * as toast from "@wirekyt/dom/machines/toast";
|
|
8
|
+
import { anatomy as toastAnatomy } from "@wirekyt/dom/machines/toast";
|
|
9
|
+
//#region src/components/toast/create-toaster.tsx
|
|
10
|
+
const createToaster = (props) => {
|
|
11
|
+
return toast.createStore(props);
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/components/toast/use-context.ts
|
|
15
|
+
const [ToastProvider, useToastContext] = createContext$1({
|
|
16
|
+
hookName: "useToastContext",
|
|
17
|
+
providerName: "<ToastProvider />"
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/components/toast/action-trigger.tsx
|
|
21
|
+
const ToastActionTrigger = (props) => {
|
|
22
|
+
const toast = useToastContext();
|
|
23
|
+
const mergedProps = mergeProps$2(() => toast().getActionTriggerProps(), props);
|
|
24
|
+
return createComponent(wire.button, mergedProps);
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/toast/close-trigger.tsx
|
|
28
|
+
const ToastCloseTrigger = (props) => {
|
|
29
|
+
const toast = useToastContext();
|
|
30
|
+
const mergedProps = mergeProps$2(() => toast().getCloseTriggerProps(), props);
|
|
31
|
+
return createComponent(wire.button, mergedProps);
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/toast/context.tsx
|
|
35
|
+
const ToastContext = (props) => props.children(useToastContext());
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/components/toast/description.tsx
|
|
38
|
+
const ToastDescription = (props) => {
|
|
39
|
+
const toast = useToastContext();
|
|
40
|
+
const mergedProps = mergeProps$2(() => toast().getDescriptionProps(), props);
|
|
41
|
+
return createComponent(wire.div, mergedProps);
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/toast/root.tsx
|
|
45
|
+
const ToastRoot = (props) => {
|
|
46
|
+
const toast = useToastContext();
|
|
47
|
+
const mergedProps = mergeProps$2(() => toast().getRootProps(), props);
|
|
48
|
+
return createComponent(wire.div, mergeProps$1(mergedProps, { get children() {
|
|
49
|
+
return [
|
|
50
|
+
createComponent(wire.div, mergeProps$1(() => toast().getGhostBeforeProps())),
|
|
51
|
+
memo(() => props.children),
|
|
52
|
+
createComponent(wire.div, mergeProps$1(() => toast().getGhostAfterProps()))
|
|
53
|
+
];
|
|
54
|
+
} }));
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/components/toast/title.tsx
|
|
58
|
+
const ToastTitle = (props) => {
|
|
59
|
+
const toast = useToastContext();
|
|
60
|
+
const mergedProps = mergeProps$2(() => toast().getTitleProps(), props);
|
|
61
|
+
return createComponent(wire.div, mergedProps);
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/components/toast/toaster.tsx
|
|
65
|
+
const Toaster = (props) => {
|
|
66
|
+
const [toasterProps, localProps] = splitProps(props, ["toaster", "children"]);
|
|
67
|
+
const locale = useLocaleContext();
|
|
68
|
+
const env = useEnvironmentContext();
|
|
69
|
+
const service = useMachine(toast.group.machine, () => ({
|
|
70
|
+
store: toasterProps.toaster,
|
|
71
|
+
id: createUniqueId(),
|
|
72
|
+
dir: locale()?.dir,
|
|
73
|
+
getRootNode: env()?.getRootNode
|
|
74
|
+
}));
|
|
75
|
+
const api = createMemo(() => toast.group.connect(service, normalizeProps));
|
|
76
|
+
const toasts = createMemo(() => api().getToasts());
|
|
77
|
+
const mergedProps = mergeProps$2(() => api().getGroupProps(), localProps);
|
|
78
|
+
return createComponent(wire.div, mergeProps$1(mergedProps, { get children() {
|
|
79
|
+
return createComponent(Key, {
|
|
80
|
+
get each() {
|
|
81
|
+
return toasts();
|
|
82
|
+
},
|
|
83
|
+
by: "id",
|
|
84
|
+
children: (toast, index) => createComponent(ToastActor, {
|
|
85
|
+
value: toast,
|
|
86
|
+
index,
|
|
87
|
+
parent: service,
|
|
88
|
+
children: (ctx) => toasterProps.children(ctx)
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
} }));
|
|
92
|
+
};
|
|
93
|
+
const ToastActor = (props) => {
|
|
94
|
+
const env = useEnvironmentContext();
|
|
95
|
+
const localProps = createMemo(() => ({
|
|
96
|
+
...props.value(),
|
|
97
|
+
parent: props.parent,
|
|
98
|
+
index: props.index(),
|
|
99
|
+
getRootNode: env().getRootNode
|
|
100
|
+
}));
|
|
101
|
+
const service = useMachine(toast.machine, localProps);
|
|
102
|
+
return createComponent(ToastProvider, {
|
|
103
|
+
value: createMemo(() => toast.connect(service, normalizeProps)),
|
|
104
|
+
get children() {
|
|
105
|
+
return props.children(props.value);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/components/toast/toast.ts
|
|
111
|
+
var toast_exports = /* @__PURE__ */ __exportAll({
|
|
112
|
+
ActionTrigger: () => ToastActionTrigger,
|
|
113
|
+
CloseTrigger: () => ToastCloseTrigger,
|
|
114
|
+
Context: () => ToastContext,
|
|
115
|
+
Description: () => ToastDescription,
|
|
116
|
+
Root: () => ToastRoot,
|
|
117
|
+
Title: () => ToastTitle
|
|
118
|
+
});
|
|
119
|
+
//#endregion
|
|
120
|
+
export { toast_exports as Toast, ToastActionTrigger, ToastCloseTrigger, ToastContext, ToastDescription, ToastRoot, ToastTitle, Toaster, createToaster, toastAnatomy, useToastContext };
|
package/dist/toast.jsx
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.jsx";
|
|
2
|
+
import { a as mergeProps$1, d as createContext$1, i as useMachine, r as normalizeProps, t as Key } from "./core-7QKBNp9p.jsx";
|
|
3
|
+
import { t as wire } from "./factory-DRw_slzE.jsx";
|
|
4
|
+
import { a as useLocaleContext, l as useEnvironmentContext } from "./providers-CqNHqLpB.jsx";
|
|
5
|
+
import { createMemo, createUniqueId, splitProps } from "solid-js";
|
|
6
|
+
import * as toast from "@wirekyt/dom/machines/toast";
|
|
7
|
+
import { anatomy as toastAnatomy } from "@wirekyt/dom/machines/toast";
|
|
8
|
+
//#region src/components/toast/create-toaster.tsx
|
|
9
|
+
const createToaster = (props) => {
|
|
10
|
+
return toast.createStore(props);
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/toast/use-context.ts
|
|
14
|
+
const [ToastProvider, useToastContext] = createContext$1({
|
|
15
|
+
hookName: "useToastContext",
|
|
16
|
+
providerName: "<ToastProvider />"
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/toast/action-trigger.tsx
|
|
20
|
+
const ToastActionTrigger = (props) => {
|
|
21
|
+
const toast = useToastContext();
|
|
22
|
+
const mergedProps = mergeProps$1(() => toast().getActionTriggerProps(), props);
|
|
23
|
+
return <wire.button {...mergedProps} />;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/toast/close-trigger.tsx
|
|
27
|
+
const ToastCloseTrigger = (props) => {
|
|
28
|
+
const toast = useToastContext();
|
|
29
|
+
const mergedProps = mergeProps$1(() => toast().getCloseTriggerProps(), props);
|
|
30
|
+
return <wire.button {...mergedProps} />;
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/toast/context.tsx
|
|
34
|
+
const ToastContext = (props) => props.children(useToastContext());
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/components/toast/description.tsx
|
|
37
|
+
const ToastDescription = (props) => {
|
|
38
|
+
const toast = useToastContext();
|
|
39
|
+
const mergedProps = mergeProps$1(() => toast().getDescriptionProps(), props);
|
|
40
|
+
return <wire.div {...mergedProps} />;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/toast/root.tsx
|
|
44
|
+
const ToastRoot = (props) => {
|
|
45
|
+
const toast = useToastContext();
|
|
46
|
+
const mergedProps = mergeProps$1(() => toast().getRootProps(), props);
|
|
47
|
+
return <wire.div {...mergedProps}>
|
|
48
|
+
<wire.div {...toast().getGhostBeforeProps()} />
|
|
49
|
+
{props.children}
|
|
50
|
+
<wire.div {...toast().getGhostAfterProps()} />
|
|
51
|
+
</wire.div>;
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/components/toast/title.tsx
|
|
55
|
+
const ToastTitle = (props) => {
|
|
56
|
+
const toast = useToastContext();
|
|
57
|
+
const mergedProps = mergeProps$1(() => toast().getTitleProps(), props);
|
|
58
|
+
return <wire.div {...mergedProps} />;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/components/toast/toaster.tsx
|
|
62
|
+
const Toaster = (props) => {
|
|
63
|
+
const [toasterProps, localProps] = splitProps(props, ["toaster", "children"]);
|
|
64
|
+
const locale = useLocaleContext();
|
|
65
|
+
const env = useEnvironmentContext();
|
|
66
|
+
const service = useMachine(toast.group.machine, () => ({
|
|
67
|
+
store: toasterProps.toaster,
|
|
68
|
+
id: createUniqueId(),
|
|
69
|
+
dir: locale()?.dir,
|
|
70
|
+
getRootNode: env()?.getRootNode
|
|
71
|
+
}));
|
|
72
|
+
const api = createMemo(() => toast.group.connect(service, normalizeProps));
|
|
73
|
+
const toasts = createMemo(() => api().getToasts());
|
|
74
|
+
const mergedProps = mergeProps$1(() => api().getGroupProps(), localProps);
|
|
75
|
+
return <wire.div {...mergedProps}>
|
|
76
|
+
<Key each={toasts()} by="id">
|
|
77
|
+
{(toast, index) => <ToastActor value={toast} index={index} parent={service}>
|
|
78
|
+
{(ctx) => toasterProps.children(ctx)}
|
|
79
|
+
</ToastActor>}
|
|
80
|
+
</Key>
|
|
81
|
+
</wire.div>;
|
|
82
|
+
};
|
|
83
|
+
const ToastActor = (props) => {
|
|
84
|
+
const env = useEnvironmentContext();
|
|
85
|
+
const localProps = createMemo(() => ({
|
|
86
|
+
...props.value(),
|
|
87
|
+
parent: props.parent,
|
|
88
|
+
index: props.index(),
|
|
89
|
+
getRootNode: env().getRootNode
|
|
90
|
+
}));
|
|
91
|
+
const service = useMachine(toast.machine, localProps);
|
|
92
|
+
const api = createMemo(() => toast.connect(service, normalizeProps));
|
|
93
|
+
return <ToastProvider value={api}>{props.children(props.value)}</ToastProvider>;
|
|
94
|
+
};
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/components/toast/toast.ts
|
|
97
|
+
var toast_exports = /* @__PURE__ */ __exportAll({
|
|
98
|
+
ActionTrigger: () => ToastActionTrigger,
|
|
99
|
+
CloseTrigger: () => ToastCloseTrigger,
|
|
100
|
+
Context: () => ToastContext,
|
|
101
|
+
Description: () => ToastDescription,
|
|
102
|
+
Root: () => ToastRoot,
|
|
103
|
+
Title: () => ToastTitle
|
|
104
|
+
});
|
|
105
|
+
//#endregion
|
|
106
|
+
export { toast_exports as Toast, ToastActionTrigger, ToastCloseTrigger, ToastContext, ToastDescription, ToastRoot, ToastTitle, Toaster, createToaster, toastAnatomy, useToastContext };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { a as Optional, n as Assign, r as MaybeAccessor, s as PropTypes } from "./index-ClU-Lb8Z.js";
|
|
2
|
+
import { r as PolymorphicProps, t as HTMLProps } from "./factory-wuwfJqbU.js";
|
|
3
|
+
import { Accessor, JSX } from "solid-js";
|
|
4
|
+
import * as toggleGroup from "@wirekyt/dom/machines/toggle-group";
|
|
5
|
+
import { ItemProps, ValueChangeDetails, ValueChangeDetails as ToggleGroupValueChangeDetails, anatomy as toggleGroupAnatomy } from "@wirekyt/dom/machines/toggle-group";
|
|
6
|
+
//#region src/components/toggle-group/use.d.ts
|
|
7
|
+
interface UseToggleGroupProps extends Optional<Omit<toggleGroup.Props, "dir" | "getRootNode">, "id"> {}
|
|
8
|
+
interface UseToggleGroupReturn extends Accessor<toggleGroup.Api<PropTypes>> {}
|
|
9
|
+
declare const useToggleGroup: (props?: MaybeAccessor<UseToggleGroupProps>) => UseToggleGroupReturn;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/components/toggle-group/use-context.d.ts
|
|
12
|
+
interface UseToggleGroupContext extends UseToggleGroupReturn {}
|
|
13
|
+
declare const ToggleGroupProvider: import("solid-js").ContextProviderComponent<UseToggleGroupContext>, useToggleGroupContext: () => UseToggleGroupContext;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/toggle-group/context.d.ts
|
|
16
|
+
interface ToggleGroupContextProps {
|
|
17
|
+
children: (context: UseToggleGroupContext) => JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
declare const ToggleGroupContext: (props: ToggleGroupContextProps) => JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/toggle-group/item.d.ts
|
|
22
|
+
interface ToggleGroupItemBaseProps extends ItemProps, PolymorphicProps<"button"> {}
|
|
23
|
+
interface ToggleGroupItemProps extends Assign<HTMLProps<"button">, ToggleGroupItemBaseProps> {}
|
|
24
|
+
declare const ToggleGroupItem: (props: ToggleGroupItemProps) => import("solid-js").JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/toggle-group/root.d.ts
|
|
27
|
+
interface ToggleGroupRootBaseProps extends UseToggleGroupProps, PolymorphicProps<"div"> {}
|
|
28
|
+
interface ToggleGroupRootProps extends HTMLProps<"div">, ToggleGroupRootBaseProps {}
|
|
29
|
+
declare const ToggleGroupRoot: (props: ToggleGroupRootProps) => import("solid-js").JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/components/toggle-group/root-provider.d.ts
|
|
32
|
+
interface RootProviderProps {
|
|
33
|
+
value: UseToggleGroupReturn;
|
|
34
|
+
}
|
|
35
|
+
interface ToggleGroupRootProviderBaseProps extends PolymorphicProps<"div"> {}
|
|
36
|
+
interface ToggleGroupRootProviderProps extends HTMLProps<"div">, RootProviderProps, ToggleGroupRootProviderBaseProps {}
|
|
37
|
+
declare const ToggleGroupRootProvider: (props: ToggleGroupRootProviderProps) => import("solid-js").JSX.Element;
|
|
38
|
+
declare namespace toggle_group_d_exports {
|
|
39
|
+
export { ToggleGroupContext as Context, ToggleGroupContextProps as ContextProps, ToggleGroupItem as Item, ToggleGroupItemBaseProps as ItemBaseProps, ToggleGroupItemProps as ItemProps, ToggleGroupRoot as Root, ToggleGroupRootBaseProps as RootBaseProps, ToggleGroupRootProps as RootProps, ToggleGroupRootProvider as RootProvider, ToggleGroupRootProviderBaseProps as RootProviderBaseProps, ToggleGroupRootProviderProps as RootProviderProps, ValueChangeDetails };
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { toggle_group_d_exports as ToggleGroup, ToggleGroupContext, type ToggleGroupContextProps, ToggleGroupItem, type ToggleGroupItemBaseProps, type ToggleGroupItemProps, ToggleGroupRoot, type ToggleGroupRootBaseProps, type ToggleGroupRootProps, ToggleGroupRootProvider, type ToggleGroupRootProviderBaseProps, type ToggleGroupRootProviderProps, type ToggleGroupValueChangeDetails, type UseToggleGroupContext, type UseToggleGroupProps, type UseToggleGroupReturn, toggleGroupAnatomy, useToggleGroup, useToggleGroupContext };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { a as mergeProps$2, d as createContext$1, i as useMachine, l as createSplitProps, r as normalizeProps } from "./core-7QKBNp9p.js";
|
|
3
|
+
import { t as runIfFn } from "./run-if-fn-CjvD7VzQ.js";
|
|
4
|
+
import { t as wire } from "./factory-D2A7xdtl.js";
|
|
5
|
+
import { a as useLocaleContext, l as useEnvironmentContext } from "./providers-B-Vi5wQ7.js";
|
|
6
|
+
import { createMemo, createUniqueId } from "solid-js";
|
|
7
|
+
import { createComponent } from "solid-js/web";
|
|
8
|
+
import * as toggleGroup from "@wirekyt/dom/machines/toggle-group";
|
|
9
|
+
import { anatomy as toggleGroupAnatomy } from "@wirekyt/dom/machines/toggle-group";
|
|
10
|
+
//#region src/components/toggle-group/use-context.ts
|
|
11
|
+
const [ToggleGroupProvider, useToggleGroupContext] = createContext$1({
|
|
12
|
+
hookName: "useToggleGroupContext",
|
|
13
|
+
providerName: "<ToggleGroupProvider />"
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/toggle-group/context.tsx
|
|
17
|
+
const ToggleGroupContext = (props) => props.children(useToggleGroupContext());
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/toggle-group/item.tsx
|
|
20
|
+
const ToggleGroupItem = (props) => {
|
|
21
|
+
const [toggleProps, restProps] = createSplitProps()(props, ["value", "disabled"]);
|
|
22
|
+
const api = useToggleGroupContext();
|
|
23
|
+
const mergedProps = mergeProps$2(() => api().getItemProps(toggleProps), restProps);
|
|
24
|
+
return createComponent(wire.button, mergedProps);
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/toggle-group/use.ts
|
|
28
|
+
const useToggleGroup = (props) => {
|
|
29
|
+
const id = createUniqueId();
|
|
30
|
+
const locale = useLocaleContext();
|
|
31
|
+
const environment = useEnvironmentContext();
|
|
32
|
+
const machineProps = createMemo(() => ({
|
|
33
|
+
id,
|
|
34
|
+
dir: locale().dir,
|
|
35
|
+
getRootNode: environment().getRootNode,
|
|
36
|
+
...runIfFn(props)
|
|
37
|
+
}));
|
|
38
|
+
const service = useMachine(toggleGroup.machine, machineProps);
|
|
39
|
+
return createMemo(() => toggleGroup.connect(service, normalizeProps));
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/components/toggle-group/root.tsx
|
|
43
|
+
const ToggleGroupRoot = (props) => {
|
|
44
|
+
const [useToggleGroupProps, restProps] = createSplitProps()(props, [
|
|
45
|
+
"defaultValue",
|
|
46
|
+
"deselectable",
|
|
47
|
+
"disabled",
|
|
48
|
+
"id",
|
|
49
|
+
"ids",
|
|
50
|
+
"loopFocus",
|
|
51
|
+
"multiple",
|
|
52
|
+
"onValueChange",
|
|
53
|
+
"orientation",
|
|
54
|
+
"rovingFocus",
|
|
55
|
+
"value"
|
|
56
|
+
]);
|
|
57
|
+
const api = useToggleGroup(useToggleGroupProps);
|
|
58
|
+
const mergedProps = mergeProps$2(() => api().getRootProps(), restProps);
|
|
59
|
+
return createComponent(ToggleGroupProvider, {
|
|
60
|
+
value: api,
|
|
61
|
+
get children() {
|
|
62
|
+
return createComponent(wire.div, mergedProps);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/components/toggle-group/root-provider.tsx
|
|
68
|
+
const ToggleGroupRootProvider = (props) => {
|
|
69
|
+
const [{ value: toggleGroup }, localProps] = createSplitProps()(props, ["value"]);
|
|
70
|
+
const mergedProps = mergeProps$2(() => toggleGroup().getRootProps(), localProps);
|
|
71
|
+
return createComponent(ToggleGroupProvider, {
|
|
72
|
+
value: toggleGroup,
|
|
73
|
+
get children() {
|
|
74
|
+
return createComponent(wire.div, mergedProps);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/components/toggle-group/toggle-group.ts
|
|
80
|
+
var toggle_group_exports = /* @__PURE__ */ __exportAll({
|
|
81
|
+
Context: () => ToggleGroupContext,
|
|
82
|
+
Item: () => ToggleGroupItem,
|
|
83
|
+
Root: () => ToggleGroupRoot,
|
|
84
|
+
RootProvider: () => ToggleGroupRootProvider
|
|
85
|
+
});
|
|
86
|
+
//#endregion
|
|
87
|
+
export { toggle_group_exports as ToggleGroup, ToggleGroupContext, ToggleGroupItem, ToggleGroupRoot, ToggleGroupRootProvider, toggleGroupAnatomy, useToggleGroup, useToggleGroupContext };
|