@wirekyt/react 0.0.1 → 0.0.2
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.cjs +209 -0
- package/dist/accordion.d.cts +69 -0
- package/dist/accordion.d.ts +69 -0
- package/dist/accordion.js +184 -0
- package/dist/angle-slider.cjs +193 -0
- package/dist/angle-slider.d.cts +73 -0
- package/dist/angle-slider.d.ts +73 -0
- package/dist/angle-slider.js +168 -0
- package/dist/avatar.cjs +120 -0
- package/dist/avatar.d.cts +48 -0
- package/dist/avatar.d.ts +48 -0
- package/dist/avatar.js +100 -0
- package/dist/carousel.cjs +246 -0
- package/dist/carousel.d.cts +94 -0
- package/dist/carousel.d.ts +94 -0
- package/dist/carousel.js +223 -0
- package/dist/checkbox.cjs +284 -0
- package/dist/checkbox.d.cts +115 -0
- package/dist/checkbox.d.ts +115 -0
- package/dist/checkbox.js +263 -0
- package/dist/client-only.cjs +12 -0
- package/dist/client-only.d.cts +8 -0
- package/dist/client-only.d.ts +8 -0
- package/dist/client-only.js +11 -0
- package/dist/clipboard.cjs +174 -0
- package/dist/clipboard.d.cts +70 -0
- package/dist/clipboard.d.ts +70 -0
- package/dist/clipboard.js +150 -0
- package/dist/collapsible-B62i_oPJ.cjs +185 -0
- package/dist/collapsible-CiTNjCNf.js +131 -0
- package/dist/collapsible.cjs +23 -0
- package/dist/collapsible.d.cts +56 -0
- package/dist/collapsible.d.ts +56 -0
- package/dist/collapsible.js +2 -0
- package/dist/collection-BFjWNdUS.cjs +223 -0
- package/dist/collection-BJOl6a4H.js +180 -0
- package/dist/collection.cjs +9 -0
- package/dist/collection.d.cts +2 -0
- package/dist/collection.d.ts +2 -0
- package/dist/collection.js +2 -0
- package/dist/color-picker.cjs +575 -0
- package/dist/color-picker.d.cts +179 -0
- package/dist/color-picker.d.ts +179 -0
- package/dist/color-picker.js +530 -0
- package/dist/combobox.cjs +390 -0
- package/dist/combobox.d.cts +128 -0
- package/dist/combobox.d.ts +128 -0
- package/dist/combobox.js +359 -0
- package/dist/core-CBFAnVIP.cjs +375 -0
- package/dist/core-CEYOEcVI.js +357 -0
- package/dist/date-input.cjs +217 -0
- package/dist/date-input.d.cts +69 -0
- package/dist/date-input.d.ts +69 -0
- package/dist/date-input.js +193 -0
- package/dist/date-picker.cjs +588 -0
- package/dist/date-picker.d.cts +190 -0
- package/dist/date-picker.d.ts +190 -0
- package/dist/date-picker.js +543 -0
- package/dist/dialog.cjs +199 -0
- package/dist/dialog.d.cts +78 -0
- package/dist/dialog.d.ts +78 -0
- package/dist/dialog.js +174 -0
- package/dist/download-trigger.cjs +53 -0
- package/dist/download-trigger.d.cts +22 -0
- package/dist/download-trigger.d.ts +22 -0
- package/dist/download-trigger.js +51 -0
- package/dist/drawer.cjs +296 -0
- package/dist/drawer.d.cts +115 -0
- package/dist/drawer.d.ts +115 -0
- package/dist/drawer.js +264 -0
- package/dist/editable.cjs +228 -0
- package/dist/editable.d.cts +79 -0
- package/dist/editable.d.ts +79 -0
- package/dist/editable.js +202 -0
- package/dist/environment-B6IaCAuQ.cjs +59 -0
- package/dist/environment-BTgKwk5E.js +42 -0
- package/dist/factory--dkoVnFK.d.cts +14 -0
- package/dist/factory--dkoVnFK.d.ts +14 -0
- package/dist/factory-CFFufs5e.cjs +59 -0
- package/dist/factory-Nm__-4xn.js +48 -0
- package/dist/field-Cy1E02DH.js +349 -0
- package/dist/field-x8H5uXB9.cjs +438 -0
- package/dist/field.cjs +22 -0
- package/dist/field.d.cts +129 -0
- package/dist/field.d.ts +129 -0
- package/dist/field.js +2 -0
- package/dist/fieldset-DWZXj1t5.cjs +232 -0
- package/dist/fieldset-fx44GCtM.js +178 -0
- package/dist/fieldset.cjs +18 -0
- package/dist/fieldset.d.cts +71 -0
- package/dist/fieldset.d.ts +71 -0
- package/dist/fieldset.js +3 -0
- package/dist/file-upload.cjs +328 -0
- package/dist/file-upload.d.cts +101 -0
- package/dist/file-upload.d.ts +101 -0
- package/dist/file-upload.js +298 -0
- package/dist/floating-panel.cjs +271 -0
- package/dist/floating-panel.d.cts +98 -0
- package/dist/floating-panel.d.ts +98 -0
- package/dist/floating-panel.js +242 -0
- package/dist/format.cjs +64 -0
- package/dist/format.d.cts +44 -0
- package/dist/format.d.ts +44 -0
- package/dist/format.js +54 -0
- package/dist/frame.cjs +85 -0
- package/dist/frame.d.cts +12 -0
- package/dist/frame.d.ts +12 -0
- package/dist/frame.js +84 -0
- package/dist/highlight.cjs +29 -0
- package/dist/highlight.d.cts +13 -0
- package/dist/highlight.d.ts +13 -0
- package/dist/highlight.js +27 -0
- package/dist/hover-card.cjs +154 -0
- package/dist/hover-card.d.cts +68 -0
- package/dist/hover-card.d.ts +68 -0
- package/dist/hover-card.js +131 -0
- package/dist/image-cropper.cjs +0 -0
- package/dist/image-cropper.d.cts +1 -0
- package/dist/image-cropper.d.ts +1 -0
- package/dist/image-cropper.js +0 -0
- package/dist/index-3Al0R5bH.d.cts +73 -0
- package/dist/index-B7wAg5Wf.d.ts +146 -0
- package/dist/index-BAn8qiCM.d.ts +73 -0
- package/dist/index-BSX88T_g.d.cts +146 -0
- package/dist/index-CQAbOgb7.d.cts +23 -0
- package/dist/index-CUyHBXOI.d.cts +33 -0
- package/dist/index-CW-Aj6aT.d.ts +95 -0
- package/dist/index-CxWYgVJk.d.ts +23 -0
- package/dist/index-D7JH9e9E.d.ts +33 -0
- package/dist/index-DTLK6Fuh.d.cts +95 -0
- package/dist/index-srZfUQNt.d.cts +20 -0
- package/dist/index-srZfUQNt.d.ts +20 -0
- package/dist/index.cjs +45 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/json-tree-view.cjs +244 -0
- package/dist/json-tree-view.d.cts +45 -0
- package/dist/json-tree-view.d.ts +45 -0
- package/dist/json-tree-view.js +234 -0
- package/dist/listbox.cjs +290 -0
- package/dist/listbox.d.cts +109 -0
- package/dist/listbox.d.ts +109 -0
- package/dist/listbox.js +264 -0
- package/dist/marquee.cjs +164 -0
- package/dist/marquee.d.cts +60 -0
- package/dist/marquee.d.ts +60 -0
- package/dist/marquee.js +142 -0
- package/dist/menu.cjs +506 -0
- package/dist/menu.d.cts +162 -0
- package/dist/menu.d.ts +162 -0
- package/dist/menu.js +469 -0
- package/dist/navigation-menu.cjs +331 -0
- package/dist/navigation-menu.d.cts +89 -0
- package/dist/navigation-menu.d.ts +89 -0
- package/dist/navigation-menu.js +303 -0
- package/dist/number-input.cjs +222 -0
- package/dist/number-input.d.cts +73 -0
- package/dist/number-input.d.ts +73 -0
- package/dist/number-input.js +197 -0
- package/dist/pagination.cjs +183 -0
- package/dist/pagination.d.cts +68 -0
- package/dist/pagination.d.ts +68 -0
- package/dist/pagination.js +159 -0
- package/dist/password-input.cjs +179 -0
- package/dist/password-input.d.cts +65 -0
- package/dist/password-input.d.ts +65 -0
- package/dist/password-input.js +156 -0
- package/dist/pin-input.cjs +180 -0
- package/dist/pin-input.d.cts +58 -0
- package/dist/pin-input.d.ts +58 -0
- package/dist/pin-input.js +158 -0
- package/dist/popover.cjs +222 -0
- package/dist/popover.d.cts +93 -0
- package/dist/popover.d.ts +93 -0
- package/dist/popover.js +194 -0
- package/dist/portal-6_XzBXiA.cjs +33 -0
- package/dist/portal-QYL_2wB0.js +28 -0
- package/dist/portal.cjs +3 -0
- package/dist/portal.d.cts +9 -0
- package/dist/portal.d.ts +9 -0
- package/dist/portal.js +2 -0
- package/dist/presence-BOs-D6Cv.cjs +96 -0
- package/dist/presence-I8Rceflw.js +65 -0
- package/dist/presence.cjs +7 -0
- package/dist/presence.d.cts +2 -0
- package/dist/presence.d.ts +2 -0
- package/dist/presence.js +2 -0
- package/dist/progress.cjs +206 -0
- package/dist/progress.d.cts +78 -0
- package/dist/progress.d.ts +78 -0
- package/dist/progress.js +180 -0
- package/dist/providers-DrJEJcrE.cjs +128 -0
- package/dist/providers-FEHnDTvb.js +87 -0
- package/dist/qr-code.cjs +154 -0
- package/dist/qr-code.d.cts +58 -0
- package/dist/qr-code.d.ts +58 -0
- package/dist/qr-code.js +132 -0
- package/dist/radio-group.cjs +222 -0
- package/dist/radio-group.d.cts +78 -0
- package/dist/radio-group.d.ts +78 -0
- package/dist/radio-group.js +196 -0
- package/dist/rating-group.cjs +186 -0
- package/dist/rating-group.d.cts +68 -0
- package/dist/rating-group.d.ts +68 -0
- package/dist/rating-group.js +162 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/rolldown-runtime-DakpK96I.cjs +43 -0
- package/dist/scroll-area.cjs +166 -0
- package/dist/scroll-area.d.cts +67 -0
- package/dist/scroll-area.d.ts +67 -0
- package/dist/scroll-area.js +143 -0
- package/dist/segment-group.cjs +215 -0
- package/dist/segment-group.d.cts +81 -0
- package/dist/segment-group.d.ts +81 -0
- package/dist/segment-group.js +194 -0
- package/dist/select.cjs +395 -0
- package/dist/select.d.cts +132 -0
- package/dist/select.d.ts +132 -0
- package/dist/select.js +358 -0
- package/dist/signature-pad.cjs +197 -0
- package/dist/signature-pad.d.cts +68 -0
- package/dist/signature-pad.d.ts +68 -0
- package/dist/signature-pad.js +173 -0
- package/dist/slider.cjs +260 -0
- package/dist/slider.d.cts +88 -0
- package/dist/slider.d.ts +88 -0
- package/dist/slider.js +232 -0
- package/dist/steps.cjs +271 -0
- package/dist/steps.d.cts +104 -0
- package/dist/steps.d.ts +104 -0
- package/dist/steps.js +241 -0
- package/dist/swap.cjs +134 -0
- package/dist/swap.d.cts +49 -0
- package/dist/swap.d.ts +49 -0
- package/dist/swap.js +121 -0
- package/dist/switch.cjs +166 -0
- package/dist/switch.d.cts +58 -0
- package/dist/switch.d.ts +58 -0
- package/dist/switch.js +144 -0
- package/dist/tabs.cjs +177 -0
- package/dist/tabs.d.cts +59 -0
- package/dist/tabs.d.ts +59 -0
- package/dist/tabs.js +155 -0
- package/dist/tags-input.cjs +298 -0
- package/dist/tags-input.d.cts +98 -0
- package/dist/tags-input.d.ts +98 -0
- package/dist/tags-input.js +268 -0
- package/dist/timer.cjs +167 -0
- package/dist/timer.d.cts +63 -0
- package/dist/timer.d.ts +63 -0
- package/dist/timer.js +144 -0
- package/dist/toast.cjs +154 -0
- package/dist/toast.d.cts +59 -0
- package/dist/toast.d.ts +59 -0
- package/dist/toast.js +132 -0
- package/dist/toggle-group.cjs +118 -0
- package/dist/toggle-group.d.cts +43 -0
- package/dist/toggle-group.d.ts +43 -0
- package/dist/toggle-group.js +99 -0
- package/dist/toggle.cjs +85 -0
- package/dist/toggle.d.cts +38 -0
- package/dist/toggle.d.ts +38 -0
- package/dist/toggle.js +71 -0
- package/dist/tooltip.cjs +154 -0
- package/dist/tooltip.d.cts +68 -0
- package/dist/tooltip.d.ts +68 -0
- package/dist/tooltip.js +131 -0
- package/dist/tour.cjs +290 -0
- package/dist/tour.d.cts +112 -0
- package/dist/tour.d.ts +112 -0
- package/dist/tour.js +246 -0
- package/dist/tree-view-CNTEWXlu.js +339 -0
- package/dist/tree-view-CU4Hl5X1.cjs +484 -0
- package/dist/tree-view.cjs +41 -0
- package/dist/tree-view.d.cts +3 -0
- package/dist/tree-view.d.ts +3 -0
- package/dist/tree-view.js +3 -0
- package/dist/types-BQQfrr86.d.cts +6 -0
- package/dist/types-BQQfrr86.d.ts +6 -0
- package/dist/use-context-38DKWHsx.cjs +20 -0
- package/dist/use-context-CITa6pn9.js +10 -0
- package/dist/utils-Cfwm9WW1.cjs +166 -0
- package/dist/utils-CqLmqrgj.js +107 -0
- package/package.json +274 -6
package/dist/switch.cjs
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
|
|
3
|
+
const require_utils = require("./utils-Cfwm9WW1.cjs");
|
|
4
|
+
const require_environment = require("./environment-B6IaCAuQ.cjs");
|
|
5
|
+
const require_core = require("./core-CBFAnVIP.cjs");
|
|
6
|
+
const require_factory = require("./factory-CFFufs5e.cjs");
|
|
7
|
+
const require_providers = require("./providers-DrJEJcrE.cjs");
|
|
8
|
+
const require_field = require("./field-x8H5uXB9.cjs");
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let _wirekyt_dom_machines_switch = require("@wirekyt/dom/machines/switch");
|
|
12
|
+
_wirekyt_dom_machines_switch = require_rolldown_runtime.__toESM(_wirekyt_dom_machines_switch, 1);
|
|
13
|
+
let _wirekyt_dom = require("@wirekyt/dom");
|
|
14
|
+
//#region src/components/switch/use-context.ts
|
|
15
|
+
const [SwitchProvider, useSwitchContext] = require_utils.createContext({
|
|
16
|
+
name: "SwitchContext",
|
|
17
|
+
hookName: "useSwitchContext",
|
|
18
|
+
providerName: "<SwitchProvider />"
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/switch/context.tsx
|
|
22
|
+
const SwitchContext = (props) => props.children(useSwitchContext());
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/components/switch/control.tsx
|
|
25
|
+
const SwitchControl = (0, react.forwardRef)((props, ref) => {
|
|
26
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(useSwitchContext().getControlProps(), props);
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.span, {
|
|
28
|
+
...mergedProps,
|
|
29
|
+
ref
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
SwitchControl.displayName = "SwitchControl";
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/switch/hidden-input.tsx
|
|
35
|
+
const SwitchHiddenInput = (0, react.forwardRef)((props, ref) => {
|
|
36
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(useSwitchContext().getHiddenInputProps(), props);
|
|
37
|
+
const field = require_field.useFieldContext();
|
|
38
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.input, {
|
|
39
|
+
"aria-describedby": field?.ariaDescribedby,
|
|
40
|
+
...mergedProps,
|
|
41
|
+
ref
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
SwitchHiddenInput.displayName = "SwitchHiddenInput";
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/components/switch/label.tsx
|
|
47
|
+
const SwitchLabel = (0, react.forwardRef)((props, ref) => {
|
|
48
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(useSwitchContext().getLabelProps(), props);
|
|
49
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.span, {
|
|
50
|
+
...mergedProps,
|
|
51
|
+
ref
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
SwitchLabel.displayName = "SwitchLabel";
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/components/switch/use.ts
|
|
57
|
+
const useSwitch = (props) => {
|
|
58
|
+
const id = (0, react.useId)();
|
|
59
|
+
const { getRootNode } = require_environment.useEnvironmentContext();
|
|
60
|
+
const { dir } = require_providers.useLocaleContext();
|
|
61
|
+
const field = require_field.useFieldContext();
|
|
62
|
+
const machineProps = {
|
|
63
|
+
id,
|
|
64
|
+
ids: {
|
|
65
|
+
label: field?.ids.label,
|
|
66
|
+
hiddenInput: field?.ids.control
|
|
67
|
+
},
|
|
68
|
+
dir,
|
|
69
|
+
disabled: field?.disabled,
|
|
70
|
+
readOnly: field?.readOnly,
|
|
71
|
+
invalid: field?.invalid,
|
|
72
|
+
required: field?.required,
|
|
73
|
+
getRootNode,
|
|
74
|
+
...props
|
|
75
|
+
};
|
|
76
|
+
const service = require_core.useMachine(_wirekyt_dom_machines_switch.machine, machineProps);
|
|
77
|
+
return _wirekyt_dom_machines_switch.connect(service, require_core.normalizeProps);
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/components/switch/root.tsx
|
|
81
|
+
const splitRootProps = require_utils.createSplitProps();
|
|
82
|
+
const SwitchRoot = (0, react.forwardRef)((props, ref) => {
|
|
83
|
+
const [useSwitchProps, localProps] = splitRootProps(props, [
|
|
84
|
+
"checked",
|
|
85
|
+
"defaultChecked",
|
|
86
|
+
"disabled",
|
|
87
|
+
"form",
|
|
88
|
+
"id",
|
|
89
|
+
"ids",
|
|
90
|
+
"invalid",
|
|
91
|
+
"label",
|
|
92
|
+
"name",
|
|
93
|
+
"onCheckedChange",
|
|
94
|
+
"readOnly",
|
|
95
|
+
"required",
|
|
96
|
+
"value"
|
|
97
|
+
]);
|
|
98
|
+
const switchContext = useSwitch(useSwitchProps);
|
|
99
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(switchContext.getRootProps(), localProps);
|
|
100
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SwitchProvider, {
|
|
101
|
+
value: switchContext,
|
|
102
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.label, {
|
|
103
|
+
...mergedProps,
|
|
104
|
+
ref
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
SwitchRoot.displayName = "SwitchRoot";
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/components/switch/root-provider.tsx
|
|
111
|
+
const splitRootProviderProps = require_utils.createSplitProps();
|
|
112
|
+
const SwitchRootProvider = (0, react.forwardRef)((props, ref) => {
|
|
113
|
+
const [{ value: api }, localProps] = splitRootProviderProps(props, ["value"]);
|
|
114
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(api.getRootProps(), localProps);
|
|
115
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SwitchProvider, {
|
|
116
|
+
value: api,
|
|
117
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.label, {
|
|
118
|
+
...mergedProps,
|
|
119
|
+
ref
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
SwitchRootProvider.displayName = "SwitchRootProvider";
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/components/switch/thumb.tsx
|
|
126
|
+
const SwitchThumb = (0, react.forwardRef)((props, ref) => {
|
|
127
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(useSwitchContext().getThumbProps(), props);
|
|
128
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.span, {
|
|
129
|
+
...mergedProps,
|
|
130
|
+
ref
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
SwitchThumb.displayName = "SwitchThumb";
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/components/switch/switch.ts
|
|
136
|
+
var switch_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
137
|
+
Context: () => SwitchContext,
|
|
138
|
+
Control: () => SwitchControl,
|
|
139
|
+
HiddenInput: () => SwitchHiddenInput,
|
|
140
|
+
Label: () => SwitchLabel,
|
|
141
|
+
Root: () => SwitchRoot,
|
|
142
|
+
RootProvider: () => SwitchRootProvider,
|
|
143
|
+
Thumb: () => SwitchThumb
|
|
144
|
+
});
|
|
145
|
+
//#endregion
|
|
146
|
+
Object.defineProperty(exports, "Switch", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function() {
|
|
149
|
+
return switch_exports;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
exports.SwitchContext = SwitchContext;
|
|
153
|
+
exports.SwitchControl = SwitchControl;
|
|
154
|
+
exports.SwitchHiddenInput = SwitchHiddenInput;
|
|
155
|
+
exports.SwitchLabel = SwitchLabel;
|
|
156
|
+
exports.SwitchRoot = SwitchRoot;
|
|
157
|
+
exports.SwitchRootProvider = SwitchRootProvider;
|
|
158
|
+
exports.SwitchThumb = SwitchThumb;
|
|
159
|
+
Object.defineProperty(exports, "switchAnatomy", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function() {
|
|
162
|
+
return _wirekyt_dom_machines_switch.anatomy;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
exports.useSwitch = useSwitch;
|
|
166
|
+
exports.useSwitchContext = useSwitchContext;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { a as PropTypes } from "./index-CQAbOgb7.cjs";
|
|
2
|
+
import { r as Optional } from "./types-BQQfrr86.cjs";
|
|
3
|
+
import { r as PolymorphicProps, t as HTMLProps } from "./factory--dkoVnFK.cjs";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
import * as wireSwitch from "@wirekyt/dom/machines/switch";
|
|
6
|
+
import { CheckedChangeDetails, CheckedChangeDetails as SwitchCheckedChangeDetails, anatomy as switchAnatomy } from "@wirekyt/dom/machines/switch";
|
|
7
|
+
//#region src/components/switch/use.d.ts
|
|
8
|
+
interface UseSwitchProps extends Optional<Omit<wireSwitch.Props, "dir" | "getRootNode">, "id"> {}
|
|
9
|
+
interface UseSwitchReturn extends wireSwitch.Api<PropTypes> {}
|
|
10
|
+
declare const useSwitch: (props?: UseSwitchProps) => UseSwitchReturn;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/switch/use-context.d.ts
|
|
13
|
+
interface UseSwitchContext extends UseSwitchReturn {}
|
|
14
|
+
declare const SwitchProvider: import("react").Provider<UseSwitchContext>, useSwitchContext: () => UseSwitchContext;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/switch/context.d.ts
|
|
17
|
+
interface SwitchContextProps {
|
|
18
|
+
children: (context: UseSwitchContext) => ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const SwitchContext: (props: SwitchContextProps) => ReactNode;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/switch/control.d.ts
|
|
23
|
+
interface SwitchControlBaseProps extends PolymorphicProps {}
|
|
24
|
+
interface SwitchControlProps extends HTMLProps<"span">, SwitchControlBaseProps {}
|
|
25
|
+
declare const SwitchControl: import("react").ForwardRefExoticComponent<SwitchControlProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/switch/hidden-input.d.ts
|
|
28
|
+
interface SwitchHiddenInputBaseProps extends PolymorphicProps {}
|
|
29
|
+
interface SwitchHiddenInputProps extends HTMLProps<"input">, SwitchHiddenInputBaseProps {}
|
|
30
|
+
declare const SwitchHiddenInput: import("react").ForwardRefExoticComponent<SwitchHiddenInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/switch/label.d.ts
|
|
33
|
+
interface SwitchLabelBaseProps extends PolymorphicProps {}
|
|
34
|
+
interface SwitchLabelProps extends HTMLProps<"span">, SwitchLabelBaseProps {}
|
|
35
|
+
declare const SwitchLabel: import("react").ForwardRefExoticComponent<SwitchLabelProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/components/switch/root.d.ts
|
|
38
|
+
interface SwitchRootBaseProps extends UseSwitchProps, PolymorphicProps {}
|
|
39
|
+
interface SwitchRootProps extends HTMLProps<"label">, SwitchRootBaseProps {}
|
|
40
|
+
declare const SwitchRoot: import("react").ForwardRefExoticComponent<SwitchRootProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/components/switch/root-provider.d.ts
|
|
43
|
+
interface RootProviderProps {
|
|
44
|
+
value: UseSwitchReturn;
|
|
45
|
+
}
|
|
46
|
+
interface SwitchRootProviderBaseProps extends RootProviderProps, PolymorphicProps {}
|
|
47
|
+
interface SwitchRootProviderProps extends HTMLProps<"label">, SwitchRootProviderBaseProps {}
|
|
48
|
+
declare const SwitchRootProvider: import("react").ForwardRefExoticComponent<SwitchRootProviderProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/components/switch/thumb.d.ts
|
|
51
|
+
interface SwitchThumbBaseProps extends PolymorphicProps {}
|
|
52
|
+
interface SwitchThumbProps extends HTMLProps<"span">, SwitchThumbBaseProps {}
|
|
53
|
+
declare const SwitchThumb: import("react").ForwardRefExoticComponent<SwitchThumbProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
54
|
+
declare namespace switch_d_exports {
|
|
55
|
+
export { CheckedChangeDetails, SwitchContext as Context, SwitchContextProps as ContextProps, SwitchControl as Control, SwitchControlBaseProps as ControlBaseProps, SwitchControlProps as ControlProps, SwitchHiddenInput as HiddenInput, SwitchHiddenInputBaseProps as HiddenInputBaseProps, SwitchHiddenInputProps as HiddenInputProps, SwitchLabel as Label, SwitchLabelBaseProps as LabelBaseProps, SwitchLabelProps as LabelProps, SwitchRoot as Root, SwitchRootBaseProps as RootBaseProps, SwitchRootProps as RootProps, SwitchRootProvider as RootProvider, SwitchRootProviderBaseProps as RootProviderBaseProps, SwitchRootProviderProps as RootProviderProps, SwitchThumb as Thumb, SwitchThumbBaseProps as ThumbBaseProps, SwitchThumbProps as ThumbProps };
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { switch_d_exports as Switch, type SwitchCheckedChangeDetails, SwitchContext, type SwitchContextProps, SwitchControl, type SwitchControlBaseProps, type SwitchControlProps, SwitchHiddenInput, type SwitchHiddenInputBaseProps, type SwitchHiddenInputProps, SwitchLabel, type SwitchLabelBaseProps, type SwitchLabelProps, SwitchRoot, type SwitchRootBaseProps, type SwitchRootProps, SwitchRootProvider, type SwitchRootProviderBaseProps, type SwitchRootProviderProps, SwitchThumb, type SwitchThumbBaseProps, type SwitchThumbProps, type UseSwitchContext, type UseSwitchProps, type UseSwitchReturn, switchAnatomy, useSwitch, useSwitchContext };
|
package/dist/switch.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { a as PropTypes } from "./index-CxWYgVJk.js";
|
|
2
|
+
import { r as Optional } from "./types-BQQfrr86.js";
|
|
3
|
+
import { r as PolymorphicProps, t as HTMLProps } from "./factory--dkoVnFK.js";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
import * as wireSwitch from "@wirekyt/dom/machines/switch";
|
|
6
|
+
import { CheckedChangeDetails, CheckedChangeDetails as SwitchCheckedChangeDetails, anatomy as switchAnatomy } from "@wirekyt/dom/machines/switch";
|
|
7
|
+
//#region src/components/switch/use.d.ts
|
|
8
|
+
interface UseSwitchProps extends Optional<Omit<wireSwitch.Props, "dir" | "getRootNode">, "id"> {}
|
|
9
|
+
interface UseSwitchReturn extends wireSwitch.Api<PropTypes> {}
|
|
10
|
+
declare const useSwitch: (props?: UseSwitchProps) => UseSwitchReturn;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/switch/use-context.d.ts
|
|
13
|
+
interface UseSwitchContext extends UseSwitchReturn {}
|
|
14
|
+
declare const SwitchProvider: import("react").Provider<UseSwitchContext>, useSwitchContext: () => UseSwitchContext;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/switch/context.d.ts
|
|
17
|
+
interface SwitchContextProps {
|
|
18
|
+
children: (context: UseSwitchContext) => ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const SwitchContext: (props: SwitchContextProps) => ReactNode;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/switch/control.d.ts
|
|
23
|
+
interface SwitchControlBaseProps extends PolymorphicProps {}
|
|
24
|
+
interface SwitchControlProps extends HTMLProps<"span">, SwitchControlBaseProps {}
|
|
25
|
+
declare const SwitchControl: import("react").ForwardRefExoticComponent<SwitchControlProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/switch/hidden-input.d.ts
|
|
28
|
+
interface SwitchHiddenInputBaseProps extends PolymorphicProps {}
|
|
29
|
+
interface SwitchHiddenInputProps extends HTMLProps<"input">, SwitchHiddenInputBaseProps {}
|
|
30
|
+
declare const SwitchHiddenInput: import("react").ForwardRefExoticComponent<SwitchHiddenInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/switch/label.d.ts
|
|
33
|
+
interface SwitchLabelBaseProps extends PolymorphicProps {}
|
|
34
|
+
interface SwitchLabelProps extends HTMLProps<"span">, SwitchLabelBaseProps {}
|
|
35
|
+
declare const SwitchLabel: import("react").ForwardRefExoticComponent<SwitchLabelProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/components/switch/root.d.ts
|
|
38
|
+
interface SwitchRootBaseProps extends UseSwitchProps, PolymorphicProps {}
|
|
39
|
+
interface SwitchRootProps extends HTMLProps<"label">, SwitchRootBaseProps {}
|
|
40
|
+
declare const SwitchRoot: import("react").ForwardRefExoticComponent<SwitchRootProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/components/switch/root-provider.d.ts
|
|
43
|
+
interface RootProviderProps {
|
|
44
|
+
value: UseSwitchReturn;
|
|
45
|
+
}
|
|
46
|
+
interface SwitchRootProviderBaseProps extends RootProviderProps, PolymorphicProps {}
|
|
47
|
+
interface SwitchRootProviderProps extends HTMLProps<"label">, SwitchRootProviderBaseProps {}
|
|
48
|
+
declare const SwitchRootProvider: import("react").ForwardRefExoticComponent<SwitchRootProviderProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/components/switch/thumb.d.ts
|
|
51
|
+
interface SwitchThumbBaseProps extends PolymorphicProps {}
|
|
52
|
+
interface SwitchThumbProps extends HTMLProps<"span">, SwitchThumbBaseProps {}
|
|
53
|
+
declare const SwitchThumb: import("react").ForwardRefExoticComponent<SwitchThumbProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
54
|
+
declare namespace switch_d_exports {
|
|
55
|
+
export { CheckedChangeDetails, SwitchContext as Context, SwitchContextProps as ContextProps, SwitchControl as Control, SwitchControlBaseProps as ControlBaseProps, SwitchControlProps as ControlProps, SwitchHiddenInput as HiddenInput, SwitchHiddenInputBaseProps as HiddenInputBaseProps, SwitchHiddenInputProps as HiddenInputProps, SwitchLabel as Label, SwitchLabelBaseProps as LabelBaseProps, SwitchLabelProps as LabelProps, SwitchRoot as Root, SwitchRootBaseProps as RootBaseProps, SwitchRootProps as RootProps, SwitchRootProvider as RootProvider, SwitchRootProviderBaseProps as RootProviderBaseProps, SwitchRootProviderProps as RootProviderProps, SwitchThumb as Thumb, SwitchThumbBaseProps as ThumbBaseProps, SwitchThumbProps as ThumbProps };
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { switch_d_exports as Switch, type SwitchCheckedChangeDetails, SwitchContext, type SwitchContextProps, SwitchControl, type SwitchControlBaseProps, type SwitchControlProps, SwitchHiddenInput, type SwitchHiddenInputBaseProps, type SwitchHiddenInputProps, SwitchLabel, type SwitchLabelBaseProps, type SwitchLabelProps, SwitchRoot, type SwitchRootBaseProps, type SwitchRootProps, SwitchRootProvider, type SwitchRootProviderBaseProps, type SwitchRootProviderProps, SwitchThumb, type SwitchThumbBaseProps, type SwitchThumbProps, type UseSwitchContext, type UseSwitchProps, type UseSwitchReturn, switchAnatomy, useSwitch, useSwitchContext };
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { c as createSplitProps, u as createContext$1 } from "./utils-CqLmqrgj.js";
|
|
3
|
+
import { n as useEnvironmentContext } from "./environment-BTgKwk5E.js";
|
|
4
|
+
import { a as useMachine, i as normalizeProps, t as mergeProps } from "./core-CEYOEcVI.js";
|
|
5
|
+
import { n as wire } from "./factory-Nm__-4xn.js";
|
|
6
|
+
import { a as useLocaleContext } from "./providers-FEHnDTvb.js";
|
|
7
|
+
import { h as useFieldContext } from "./field-Cy1E02DH.js";
|
|
8
|
+
import { forwardRef, useId } from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
import * as wireSwitch from "@wirekyt/dom/machines/switch";
|
|
11
|
+
import { anatomy as switchAnatomy } from "@wirekyt/dom/machines/switch";
|
|
12
|
+
//#region src/components/switch/use-context.ts
|
|
13
|
+
const [SwitchProvider, useSwitchContext] = createContext$1({
|
|
14
|
+
name: "SwitchContext",
|
|
15
|
+
hookName: "useSwitchContext",
|
|
16
|
+
providerName: "<SwitchProvider />"
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/switch/context.tsx
|
|
20
|
+
const SwitchContext = (props) => props.children(useSwitchContext());
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/switch/control.tsx
|
|
23
|
+
const SwitchControl = forwardRef((props, ref) => {
|
|
24
|
+
const mergedProps = mergeProps(useSwitchContext().getControlProps(), props);
|
|
25
|
+
return /* @__PURE__ */ jsx(wire.span, {
|
|
26
|
+
...mergedProps,
|
|
27
|
+
ref
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
SwitchControl.displayName = "SwitchControl";
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/switch/hidden-input.tsx
|
|
33
|
+
const SwitchHiddenInput = forwardRef((props, ref) => {
|
|
34
|
+
const mergedProps = mergeProps(useSwitchContext().getHiddenInputProps(), props);
|
|
35
|
+
const field = useFieldContext();
|
|
36
|
+
return /* @__PURE__ */ jsx(wire.input, {
|
|
37
|
+
"aria-describedby": field?.ariaDescribedby,
|
|
38
|
+
...mergedProps,
|
|
39
|
+
ref
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
SwitchHiddenInput.displayName = "SwitchHiddenInput";
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/switch/label.tsx
|
|
45
|
+
const SwitchLabel = forwardRef((props, ref) => {
|
|
46
|
+
const mergedProps = mergeProps(useSwitchContext().getLabelProps(), props);
|
|
47
|
+
return /* @__PURE__ */ jsx(wire.span, {
|
|
48
|
+
...mergedProps,
|
|
49
|
+
ref
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
SwitchLabel.displayName = "SwitchLabel";
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/components/switch/use.ts
|
|
55
|
+
const useSwitch = (props) => {
|
|
56
|
+
const id = useId();
|
|
57
|
+
const { getRootNode } = useEnvironmentContext();
|
|
58
|
+
const { dir } = useLocaleContext();
|
|
59
|
+
const field = useFieldContext();
|
|
60
|
+
const machineProps = {
|
|
61
|
+
id,
|
|
62
|
+
ids: {
|
|
63
|
+
label: field?.ids.label,
|
|
64
|
+
hiddenInput: field?.ids.control
|
|
65
|
+
},
|
|
66
|
+
dir,
|
|
67
|
+
disabled: field?.disabled,
|
|
68
|
+
readOnly: field?.readOnly,
|
|
69
|
+
invalid: field?.invalid,
|
|
70
|
+
required: field?.required,
|
|
71
|
+
getRootNode,
|
|
72
|
+
...props
|
|
73
|
+
};
|
|
74
|
+
const service = useMachine(wireSwitch.machine, machineProps);
|
|
75
|
+
return wireSwitch.connect(service, normalizeProps);
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/components/switch/root.tsx
|
|
79
|
+
const splitRootProps = createSplitProps();
|
|
80
|
+
const SwitchRoot = forwardRef((props, ref) => {
|
|
81
|
+
const [useSwitchProps, localProps] = splitRootProps(props, [
|
|
82
|
+
"checked",
|
|
83
|
+
"defaultChecked",
|
|
84
|
+
"disabled",
|
|
85
|
+
"form",
|
|
86
|
+
"id",
|
|
87
|
+
"ids",
|
|
88
|
+
"invalid",
|
|
89
|
+
"label",
|
|
90
|
+
"name",
|
|
91
|
+
"onCheckedChange",
|
|
92
|
+
"readOnly",
|
|
93
|
+
"required",
|
|
94
|
+
"value"
|
|
95
|
+
]);
|
|
96
|
+
const switchContext = useSwitch(useSwitchProps);
|
|
97
|
+
const mergedProps = mergeProps(switchContext.getRootProps(), localProps);
|
|
98
|
+
return /* @__PURE__ */ jsx(SwitchProvider, {
|
|
99
|
+
value: switchContext,
|
|
100
|
+
children: /* @__PURE__ */ jsx(wire.label, {
|
|
101
|
+
...mergedProps,
|
|
102
|
+
ref
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
SwitchRoot.displayName = "SwitchRoot";
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/components/switch/root-provider.tsx
|
|
109
|
+
const splitRootProviderProps = createSplitProps();
|
|
110
|
+
const SwitchRootProvider = forwardRef((props, ref) => {
|
|
111
|
+
const [{ value: api }, localProps] = splitRootProviderProps(props, ["value"]);
|
|
112
|
+
const mergedProps = mergeProps(api.getRootProps(), localProps);
|
|
113
|
+
return /* @__PURE__ */ jsx(SwitchProvider, {
|
|
114
|
+
value: api,
|
|
115
|
+
children: /* @__PURE__ */ jsx(wire.label, {
|
|
116
|
+
...mergedProps,
|
|
117
|
+
ref
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
SwitchRootProvider.displayName = "SwitchRootProvider";
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/components/switch/thumb.tsx
|
|
124
|
+
const SwitchThumb = forwardRef((props, ref) => {
|
|
125
|
+
const mergedProps = mergeProps(useSwitchContext().getThumbProps(), props);
|
|
126
|
+
return /* @__PURE__ */ jsx(wire.span, {
|
|
127
|
+
...mergedProps,
|
|
128
|
+
ref
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
SwitchThumb.displayName = "SwitchThumb";
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/components/switch/switch.ts
|
|
134
|
+
var switch_exports = /* @__PURE__ */ __exportAll({
|
|
135
|
+
Context: () => SwitchContext,
|
|
136
|
+
Control: () => SwitchControl,
|
|
137
|
+
HiddenInput: () => SwitchHiddenInput,
|
|
138
|
+
Label: () => SwitchLabel,
|
|
139
|
+
Root: () => SwitchRoot,
|
|
140
|
+
RootProvider: () => SwitchRootProvider,
|
|
141
|
+
Thumb: () => SwitchThumb
|
|
142
|
+
});
|
|
143
|
+
//#endregion
|
|
144
|
+
export { switch_exports as Switch, SwitchContext, SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchRootProvider, SwitchThumb, switchAnatomy, useSwitch, useSwitchContext };
|
package/dist/tabs.cjs
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
|
|
3
|
+
const require_utils = require("./utils-Cfwm9WW1.cjs");
|
|
4
|
+
const require_environment = require("./environment-B6IaCAuQ.cjs");
|
|
5
|
+
const require_core = require("./core-CBFAnVIP.cjs");
|
|
6
|
+
const require_factory = require("./factory-CFFufs5e.cjs");
|
|
7
|
+
const require_providers = require("./providers-DrJEJcrE.cjs");
|
|
8
|
+
const require_presence = require("./presence-BOs-D6Cv.cjs");
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let _wirekyt_dom_machines_tabs = require("@wirekyt/dom/machines/tabs");
|
|
12
|
+
_wirekyt_dom_machines_tabs = require_rolldown_runtime.__toESM(_wirekyt_dom_machines_tabs, 1);
|
|
13
|
+
let _wirekyt_dom = require("@wirekyt/dom");
|
|
14
|
+
//#region src/components/tabs/use-context.ts
|
|
15
|
+
const [TabsProvider, useTabsContext] = require_utils.createContext({
|
|
16
|
+
name: "TabsContext",
|
|
17
|
+
hookName: "useTabsContext",
|
|
18
|
+
providerName: "<TabsProvider />"
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/tabs/tab-content.tsx
|
|
22
|
+
const splitContentProps = require_utils.createSplitProps();
|
|
23
|
+
const TabContent = (0, react.forwardRef)((props, ref) => {
|
|
24
|
+
const [contentProps, localProps] = splitContentProps(props, ["value"]);
|
|
25
|
+
const tabs = useTabsContext();
|
|
26
|
+
const presence = require_presence.usePresence({
|
|
27
|
+
...require_utils.useRenderStrategyPropsContext(),
|
|
28
|
+
present: tabs.value === props.value,
|
|
29
|
+
immediate: true
|
|
30
|
+
});
|
|
31
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(tabs.getContentProps(contentProps), presence.getPresenceProps(), localProps);
|
|
32
|
+
const composedRefs = require_utils.useComposedRefs(presence.ref, ref);
|
|
33
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_presence.PresenceProvider, {
|
|
34
|
+
value: presence,
|
|
35
|
+
children: presence.unmounted ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.div, {
|
|
36
|
+
...mergedProps,
|
|
37
|
+
ref: composedRefs
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
TabContent.displayName = "TabContent";
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/tabs/tab-indicator.tsx
|
|
44
|
+
const TabIndicator = (0, react.forwardRef)((props, ref) => {
|
|
45
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(useTabsContext().getIndicatorProps(), props);
|
|
46
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.div, {
|
|
47
|
+
...mergedProps,
|
|
48
|
+
ref
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
TabIndicator.displayName = "TabIndicator";
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/components/tabs/tab-list.tsx
|
|
54
|
+
const TabList = (0, react.forwardRef)((props, ref) => {
|
|
55
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(useTabsContext().getListProps(), props);
|
|
56
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.div, {
|
|
57
|
+
...mergedProps,
|
|
58
|
+
ref
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
TabList.displayName = "TabList";
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/components/tabs/tab-trigger.tsx
|
|
64
|
+
const splitTriggerProps = require_utils.createSplitProps();
|
|
65
|
+
const TabTrigger = (0, react.forwardRef)((props, ref) => {
|
|
66
|
+
const [tabProps, localProps] = splitTriggerProps(props, ["disabled", "value"]);
|
|
67
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(useTabsContext().getTriggerProps(tabProps), localProps);
|
|
68
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.button, {
|
|
69
|
+
...mergedProps,
|
|
70
|
+
ref
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
TabTrigger.displayName = "TabTrigger";
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/components/tabs/context.tsx
|
|
76
|
+
const TabsContext = (props) => props.children(useTabsContext());
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/components/tabs/use.ts
|
|
79
|
+
const useTabs = (props) => {
|
|
80
|
+
const id = (0, react.useId)();
|
|
81
|
+
const { getRootNode } = require_environment.useEnvironmentContext();
|
|
82
|
+
const { dir } = require_providers.useLocaleContext();
|
|
83
|
+
const machineProps = {
|
|
84
|
+
id,
|
|
85
|
+
dir,
|
|
86
|
+
getRootNode,
|
|
87
|
+
...props
|
|
88
|
+
};
|
|
89
|
+
const service = require_core.useMachine(_wirekyt_dom_machines_tabs.machine, machineProps);
|
|
90
|
+
return _wirekyt_dom_machines_tabs.connect(service, require_core.normalizeProps);
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/components/tabs/root.tsx
|
|
94
|
+
const splitRootProps = require_utils.createSplitProps();
|
|
95
|
+
const TabsRoot = (0, react.forwardRef)((props, ref) => {
|
|
96
|
+
const [renderStrategyProps, tabsProps] = require_utils.splitRenderStrategyProps(props);
|
|
97
|
+
const [useTabsProps, localProps] = splitRootProps(tabsProps, [
|
|
98
|
+
"activationMode",
|
|
99
|
+
"composite",
|
|
100
|
+
"defaultValue",
|
|
101
|
+
"deselectable",
|
|
102
|
+
"id",
|
|
103
|
+
"ids",
|
|
104
|
+
"loopFocus",
|
|
105
|
+
"navigate",
|
|
106
|
+
"onFocusChange",
|
|
107
|
+
"onValueChange",
|
|
108
|
+
"orientation",
|
|
109
|
+
"translations",
|
|
110
|
+
"value"
|
|
111
|
+
]);
|
|
112
|
+
const tabs = useTabs(useTabsProps);
|
|
113
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(tabs.getRootProps(), localProps);
|
|
114
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabsProvider, {
|
|
115
|
+
value: tabs,
|
|
116
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_utils.RenderStrategyPropsProvider, {
|
|
117
|
+
value: renderStrategyProps,
|
|
118
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.div, {
|
|
119
|
+
...mergedProps,
|
|
120
|
+
ref
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
TabsRoot.displayName = "TabsRoot";
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/components/tabs/root-provider.tsx
|
|
128
|
+
const splitRootProviderProps = require_utils.createSplitProps();
|
|
129
|
+
const TabsRootProvider = (0, react.forwardRef)((props, ref) => {
|
|
130
|
+
const [renderStrategyProps, tabsProps] = require_utils.splitRenderStrategyProps(props);
|
|
131
|
+
const [{ value: tabs }, localProps] = splitRootProviderProps(tabsProps, ["value"]);
|
|
132
|
+
const mergedProps = (0, _wirekyt_dom.mergeProps)(tabs.getRootProps(), localProps);
|
|
133
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabsProvider, {
|
|
134
|
+
value: tabs,
|
|
135
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_utils.RenderStrategyPropsProvider, {
|
|
136
|
+
value: renderStrategyProps,
|
|
137
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.wire.div, {
|
|
138
|
+
...mergedProps,
|
|
139
|
+
ref
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
TabsRootProvider.displayName = "TabsRootProvider";
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/components/tabs/tabs.ts
|
|
147
|
+
var tabs_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
148
|
+
Content: () => TabContent,
|
|
149
|
+
Context: () => TabsContext,
|
|
150
|
+
Indicator: () => TabIndicator,
|
|
151
|
+
List: () => TabList,
|
|
152
|
+
Root: () => TabsRoot,
|
|
153
|
+
RootProvider: () => TabsRootProvider,
|
|
154
|
+
Trigger: () => TabTrigger
|
|
155
|
+
});
|
|
156
|
+
//#endregion
|
|
157
|
+
exports.TabContent = TabContent;
|
|
158
|
+
exports.TabIndicator = TabIndicator;
|
|
159
|
+
exports.TabList = TabList;
|
|
160
|
+
exports.TabTrigger = TabTrigger;
|
|
161
|
+
Object.defineProperty(exports, "Tabs", {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
get: function() {
|
|
164
|
+
return tabs_exports;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
exports.TabsContext = TabsContext;
|
|
168
|
+
exports.TabsRoot = TabsRoot;
|
|
169
|
+
exports.TabsRootProvider = TabsRootProvider;
|
|
170
|
+
Object.defineProperty(exports, "tabsAnatomy", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function() {
|
|
173
|
+
return _wirekyt_dom_machines_tabs.anatomy;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
exports.useTabs = useTabs;
|
|
177
|
+
exports.useTabsContext = useTabsContext;
|
package/dist/tabs.d.cts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { a as PropTypes } from "./index-CQAbOgb7.cjs";
|
|
2
|
+
import { r as Optional, t as Assign } from "./types-BQQfrr86.cjs";
|
|
3
|
+
import { r as PolymorphicProps, t as HTMLProps } from "./factory--dkoVnFK.cjs";
|
|
4
|
+
import { r as RenderStrategyProps } from "./index-srZfUQNt.cjs";
|
|
5
|
+
import { ReactNode } from "react";
|
|
6
|
+
import * as tabs from "@wirekyt/dom/machines/tabs";
|
|
7
|
+
import { ContentProps, FocusChangeDetails, FocusChangeDetails as TabsFocusChangeDetails, TriggerProps, ValueChangeDetails, ValueChangeDetails as TabsValueChangeDetails, anatomy as tabsAnatomy } from "@wirekyt/dom/machines/tabs";
|
|
8
|
+
//#region src/components/tabs/tab-content.d.ts
|
|
9
|
+
interface TabContentBaseProps extends ContentProps, PolymorphicProps {}
|
|
10
|
+
interface TabContentProps extends HTMLProps<"div">, TabContentBaseProps {}
|
|
11
|
+
declare const TabContent: import("react").ForwardRefExoticComponent<TabContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/tabs/tab-indicator.d.ts
|
|
14
|
+
interface TabIndicatorBaseProps extends PolymorphicProps {}
|
|
15
|
+
interface TabIndicatorProps extends HTMLProps<"div">, TabIndicatorBaseProps {}
|
|
16
|
+
declare const TabIndicator: import("react").ForwardRefExoticComponent<TabIndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/components/tabs/tab-list.d.ts
|
|
19
|
+
interface TabListBaseProps extends PolymorphicProps {}
|
|
20
|
+
interface TabListProps extends HTMLProps<"div">, TabListBaseProps {}
|
|
21
|
+
declare const TabList: import("react").ForwardRefExoticComponent<TabListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/tabs/tab-trigger.d.ts
|
|
24
|
+
interface TabTriggerBaseProps extends TriggerProps, PolymorphicProps {}
|
|
25
|
+
interface TabTriggerProps extends Assign<HTMLProps<"button">, TabTriggerBaseProps> {}
|
|
26
|
+
declare const TabTrigger: import("react").ForwardRefExoticComponent<TabTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/components/tabs/use.d.ts
|
|
29
|
+
interface UseTabsProps extends Optional<Omit<tabs.Props, "dir" | "getRootNode">, "id"> {}
|
|
30
|
+
interface UseTabsReturn extends tabs.Api<PropTypes> {}
|
|
31
|
+
declare const useTabs: (props?: UseTabsProps) => UseTabsReturn;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/tabs/use-context.d.ts
|
|
34
|
+
interface UseTabsContext extends UseTabsReturn {}
|
|
35
|
+
declare const TabsProvider: import("react").Provider<UseTabsContext>, useTabsContext: () => UseTabsContext;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/components/tabs/context.d.ts
|
|
38
|
+
interface TabsContextProps {
|
|
39
|
+
children: (context: UseTabsContext) => ReactNode;
|
|
40
|
+
}
|
|
41
|
+
declare const TabsContext: (props: TabsContextProps) => ReactNode;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/tabs/root.d.ts
|
|
44
|
+
interface TabsRootBaseProps extends UseTabsProps, RenderStrategyProps, PolymorphicProps {}
|
|
45
|
+
interface TabsRootProps extends Assign<HTMLProps<"div">, TabsRootBaseProps> {}
|
|
46
|
+
declare const TabsRoot: import("react").ForwardRefExoticComponent<TabsRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/tabs/root-provider.d.ts
|
|
49
|
+
interface RootProviderProps {
|
|
50
|
+
value: UseTabsReturn;
|
|
51
|
+
}
|
|
52
|
+
interface TabsRootProviderBaseProps extends RootProviderProps, RenderStrategyProps, PolymorphicProps {}
|
|
53
|
+
interface TabsRootProviderProps extends HTMLProps<"div">, TabsRootProviderBaseProps {}
|
|
54
|
+
declare const TabsRootProvider: import("react").ForwardRefExoticComponent<TabsRootProviderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
|
+
declare namespace tabs_d_exports {
|
|
56
|
+
export { TabContent as Content, TabContentBaseProps as ContentBaseProps, TabContentProps as ContentProps, TabsContext as Context, TabsContextProps as ContextProps, FocusChangeDetails, TabIndicator as Indicator, TabIndicatorBaseProps as IndicatorBaseProps, TabIndicatorProps as IndicatorProps, TabList as List, TabListBaseProps as ListBaseProps, TabListProps as ListProps, TabsRoot as Root, TabsRootBaseProps as RootBaseProps, TabsRootProps as RootProps, TabsRootProvider as RootProvider, TabsRootProviderBaseProps as RootProviderBaseProps, TabsRootProviderProps as RootProviderProps, TabTrigger as Trigger, TabTriggerBaseProps as TriggerBaseProps, TabTriggerProps as TriggerProps, ValueChangeDetails };
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { TabContent, type TabContentBaseProps, type TabContentProps, TabIndicator, type TabIndicatorBaseProps, type TabIndicatorProps, TabList, type TabListBaseProps, type TabListProps, TabTrigger, type TabTriggerBaseProps, type TabTriggerProps, tabs_d_exports as Tabs, TabsContext, type TabsContextProps, type TabsFocusChangeDetails, TabsRoot, type TabsRootBaseProps, type TabsRootProps, TabsRootProvider, type TabsRootProviderBaseProps, type TabsRootProviderProps, type TabsValueChangeDetails, type UseTabsContext, type UseTabsProps, type UseTabsReturn, tabsAnatomy, useTabs, useTabsContext };
|