@hanzogui/toggle-group 7.0.0 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +40 -19
- package/dist/cjs/Toggle.cjs +150 -0
- package/dist/cjs/Toggle.native.js +159 -0
- package/dist/cjs/Toggle.native.js.map +1 -0
- package/dist/cjs/ToggleGroup.cjs +245 -0
- package/dist/cjs/ToggleGroup.native.js +262 -0
- package/dist/cjs/ToggleGroup.native.js.map +1 -0
- package/dist/cjs/context.cjs +36 -0
- package/dist/cjs/context.native.js +39 -0
- package/dist/cjs/context.native.js.map +1 -0
- package/dist/cjs/index.cjs +30 -0
- package/dist/cjs/index.native.js +33 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/types.cjs +18 -0
- package/dist/cjs/types.native.js +21 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/esm/Toggle.mjs +113 -0
- package/dist/esm/Toggle.mjs.map +1 -0
- package/dist/esm/Toggle.native.js +119 -0
- package/dist/esm/Toggle.native.js.map +1 -0
- package/dist/esm/ToggleGroup.mjs +209 -0
- package/dist/esm/ToggleGroup.mjs.map +1 -0
- package/dist/esm/ToggleGroup.native.js +223 -0
- package/dist/esm/ToggleGroup.native.js.map +1 -0
- package/dist/esm/context.mjs +10 -0
- package/dist/esm/context.mjs.map +1 -0
- package/dist/esm/context.native.js +10 -0
- package/dist/esm/context.native.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +4 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -0
- package/dist/esm/types.native.js.map +1 -0
- package/dist/jsx/Toggle.mjs +113 -0
- package/dist/jsx/Toggle.mjs.map +1 -0
- package/dist/jsx/Toggle.native.js +159 -0
- package/dist/jsx/Toggle.native.js.map +1 -0
- package/dist/jsx/ToggleGroup.mjs +209 -0
- package/dist/jsx/ToggleGroup.mjs.map +1 -0
- package/dist/jsx/ToggleGroup.native.js +262 -0
- package/dist/jsx/ToggleGroup.native.js.map +1 -0
- package/dist/jsx/context.mjs +10 -0
- package/dist/jsx/context.mjs.map +1 -0
- package/dist/jsx/context.native.js +39 -0
- package/dist/jsx/context.native.js.map +1 -0
- package/dist/jsx/index.js +4 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/index.mjs +4 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +33 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/dist/jsx/types.mjs +2 -0
- package/dist/jsx/types.mjs.map +1 -0
- package/dist/jsx/types.native.js +21 -0
- package/dist/jsx/types.native.js.map +1 -0
- package/package.json +23 -21
- package/src/Toggle.tsx +3 -3
- package/src/ToggleGroup.tsx +6 -6
- package/types/Toggle.d.ts +9 -9
- package/types/Toggle.d.ts.map +1 -0
- package/types/ToggleGroup.d.ts +19 -19
- package/types/ToggleGroup.d.ts.map +1 -0
- package/types/context.d.ts.map +1 -0
- package/types/index.d.ts.map +1 -0
- package/types/types.d.ts.map +1 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
36
|
+
var ToggleGroup_exports = {};
|
|
37
|
+
__export(ToggleGroup_exports, {
|
|
38
|
+
ToggleGroup: () => ToggleGroup
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(ToggleGroup_exports);
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var import_constants = require("@hanzogui/constants");
|
|
43
|
+
var import_focusable = require("@hanzogui/focusable");
|
|
44
|
+
var import_helpers = require("@hanzogui/helpers");
|
|
45
|
+
var import_roving_focus = require("@hanzogui/roving-focus");
|
|
46
|
+
var import_use_controllable_state = require("@hanzogui/use-controllable-state");
|
|
47
|
+
var import_use_direction = require("@hanzogui/use-direction");
|
|
48
|
+
var import_web = require("@hanzogui/web");
|
|
49
|
+
var import_react = __toESM(require("react"), 1);
|
|
50
|
+
var import_Toggle = require("./Toggle.native.js");
|
|
51
|
+
var import_context = require("./context.native.js");
|
|
52
|
+
var TOGGLE_GROUP_NAME = "ToggleGroup";
|
|
53
|
+
var TOGGLE_GROUP_ITEM_NAME = "ToggleGroupItem";
|
|
54
|
+
var TOGGLE_GROUP_CONTEXT = "ToggleGroup";
|
|
55
|
+
var {
|
|
56
|
+
Provider: ToggleGroupItemProvider
|
|
57
|
+
} = (0, import_web.createStyledContext)();
|
|
58
|
+
var {
|
|
59
|
+
Provider: ToggleGroupContext,
|
|
60
|
+
useStyledContext: useToggleGroupContext
|
|
61
|
+
} = (0, import_web.createStyledContext)({});
|
|
62
|
+
var ToggleGroupItem = import_Toggle.ToggleFrame.styleable(function (props, forwardedRef) {
|
|
63
|
+
var valueContext = useToggleGroupValueContext(props.__scopeToggleGroup);
|
|
64
|
+
var context = useToggleGroupContext(props.__scopeToggleGroup);
|
|
65
|
+
var toggleContext = import_context.context.useStyledContext(props.__scopeToggleGroup);
|
|
66
|
+
var active = valueContext === null || valueContext === void 0 ? void 0 : valueContext.value.includes(props.value);
|
|
67
|
+
var color = props.color || toggleContext.color;
|
|
68
|
+
var disabled = context.disabled || props.disabled || false;
|
|
69
|
+
var inner = /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupItemImpl, {
|
|
70
|
+
ref: forwardedRef,
|
|
71
|
+
tabIndex: disabled ? -1 : 0,
|
|
72
|
+
...props,
|
|
73
|
+
active,
|
|
74
|
+
disabled
|
|
75
|
+
});
|
|
76
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupItemProvider, {
|
|
77
|
+
scope: props.__scopeToggleGroup,
|
|
78
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.context.Provider, {
|
|
79
|
+
color,
|
|
80
|
+
active,
|
|
81
|
+
children: context.rovingFocus ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
82
|
+
asChild: "except-style",
|
|
83
|
+
__scopeRovingFocusGroup: props.__scopeToggleGroup || TOGGLE_GROUP_CONTEXT,
|
|
84
|
+
focusable: !disabled,
|
|
85
|
+
active,
|
|
86
|
+
children: inner
|
|
87
|
+
}) : inner
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
ToggleGroupItem.displayName = TOGGLE_GROUP_ITEM_NAME;
|
|
92
|
+
var ToggleGroupItemImpl = /* @__PURE__ */import_react.default.forwardRef(function (props, forwardedRef) {
|
|
93
|
+
var {
|
|
94
|
+
__scopeToggleGroup,
|
|
95
|
+
value,
|
|
96
|
+
...itemProps
|
|
97
|
+
} = props;
|
|
98
|
+
var valueContext = useToggleGroupValueContext(__scopeToggleGroup);
|
|
99
|
+
var singleProps = {
|
|
100
|
+
"aria-pressed": void 0
|
|
101
|
+
};
|
|
102
|
+
var typeProps = valueContext.type === "single" ? singleProps : void 0;
|
|
103
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Toggle.Toggle, {
|
|
104
|
+
...typeProps,
|
|
105
|
+
...itemProps,
|
|
106
|
+
ref: forwardedRef,
|
|
107
|
+
onActiveChange: function (pressed) {
|
|
108
|
+
if (pressed) {
|
|
109
|
+
valueContext.onItemActivate(value);
|
|
110
|
+
} else {
|
|
111
|
+
valueContext.onItemDeactivate(value);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
var ToggleGroup = (0, import_helpers.withStaticProperties)(/* @__PURE__ */import_react.default.forwardRef(function (props, forwardedRef) {
|
|
117
|
+
var {
|
|
118
|
+
type,
|
|
119
|
+
...toggleGroupProps
|
|
120
|
+
} = props;
|
|
121
|
+
if (!import_constants.isWeb) {
|
|
122
|
+
import_react.default.useEffect(function () {
|
|
123
|
+
if (!props.id) return;
|
|
124
|
+
return (0, import_focusable.registerFocusable)(props.id, {
|
|
125
|
+
focus: function () {}
|
|
126
|
+
});
|
|
127
|
+
}, [props.id]);
|
|
128
|
+
}
|
|
129
|
+
if (type === "single") {
|
|
130
|
+
var singleProps = toggleGroupProps;
|
|
131
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImplSingle, {
|
|
132
|
+
...singleProps,
|
|
133
|
+
ref: forwardedRef
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (type === "multiple") {
|
|
137
|
+
var multipleProps = toggleGroupProps;
|
|
138
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImplMultiple, {
|
|
139
|
+
...multipleProps,
|
|
140
|
+
ref: forwardedRef
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
|
|
144
|
+
}), {
|
|
145
|
+
Item: ToggleGroupItem
|
|
146
|
+
});
|
|
147
|
+
ToggleGroup.displayName = TOGGLE_GROUP_NAME;
|
|
148
|
+
var {
|
|
149
|
+
Provider: ToggleGroupValueProvider,
|
|
150
|
+
useStyledContext: useToggleGroupValueContext
|
|
151
|
+
} = (0, import_web.createStyledContext)();
|
|
152
|
+
var ToggleGroupImplSingle = /* @__PURE__ */import_react.default.forwardRef(function (props, forwardedRef) {
|
|
153
|
+
var {
|
|
154
|
+
value: valueProp,
|
|
155
|
+
defaultValue,
|
|
156
|
+
onValueChange = function () {},
|
|
157
|
+
disableDeactivation = false,
|
|
158
|
+
children,
|
|
159
|
+
...toggleGroupSingleProps
|
|
160
|
+
} = props;
|
|
161
|
+
var [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
162
|
+
prop: valueProp,
|
|
163
|
+
defaultProp: defaultValue,
|
|
164
|
+
onChange: onValueChange
|
|
165
|
+
});
|
|
166
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupValueProvider, {
|
|
167
|
+
scope: props.__scopeToggleGroup,
|
|
168
|
+
type: "single",
|
|
169
|
+
value: value ? [value] : [],
|
|
170
|
+
defaultValue: value,
|
|
171
|
+
onItemActivate: setValue,
|
|
172
|
+
onItemDeactivate: import_react.default.useCallback(function () {
|
|
173
|
+
return disableDeactivation ? null : setValue("");
|
|
174
|
+
}, [setValue, disableDeactivation]),
|
|
175
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImpl, {
|
|
176
|
+
...toggleGroupSingleProps,
|
|
177
|
+
ref: forwardedRef,
|
|
178
|
+
children
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
var ToggleGroupImplMultiple = /* @__PURE__ */import_react.default.forwardRef(function (props, forwardedRef) {
|
|
183
|
+
var {
|
|
184
|
+
value: valueProp,
|
|
185
|
+
defaultValue,
|
|
186
|
+
onValueChange = function () {},
|
|
187
|
+
disableDeactivation,
|
|
188
|
+
children,
|
|
189
|
+
...toggleGroupMultipleProps
|
|
190
|
+
} = props;
|
|
191
|
+
var [value = [], setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
192
|
+
prop: valueProp,
|
|
193
|
+
defaultProp: defaultValue,
|
|
194
|
+
onChange: onValueChange
|
|
195
|
+
});
|
|
196
|
+
var handleButtonActivate = import_react.default.useCallback(function (itemValue) {
|
|
197
|
+
return setValue(function () {
|
|
198
|
+
var prevValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
199
|
+
return [...prevValue, itemValue];
|
|
200
|
+
});
|
|
201
|
+
}, [setValue]);
|
|
202
|
+
var handleButtonDeactivate = import_react.default.useCallback(function (itemValue) {
|
|
203
|
+
return setValue(function () {
|
|
204
|
+
var prevValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
205
|
+
return prevValue.filter(function (value2) {
|
|
206
|
+
return value2 !== itemValue;
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
}, [setValue]);
|
|
210
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupValueProvider, {
|
|
211
|
+
scope: props.__scopeToggleGroup,
|
|
212
|
+
type: "multiple",
|
|
213
|
+
value,
|
|
214
|
+
defaultValue: value,
|
|
215
|
+
onItemActivate: handleButtonActivate,
|
|
216
|
+
onItemDeactivate: handleButtonDeactivate,
|
|
217
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImpl, {
|
|
218
|
+
...toggleGroupMultipleProps,
|
|
219
|
+
ref: forwardedRef,
|
|
220
|
+
children
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
var ToggleGroupFrame = (0, import_web.styled)(import_web.View, {
|
|
225
|
+
name: TOGGLE_GROUP_NAME
|
|
226
|
+
});
|
|
227
|
+
var ToggleGroupImpl = ToggleGroupFrame.styleable(function (props, forwardedRef) {
|
|
228
|
+
var {
|
|
229
|
+
__scopeToggleGroup,
|
|
230
|
+
disabled = false,
|
|
231
|
+
orientation = "horizontal",
|
|
232
|
+
dir,
|
|
233
|
+
rovingFocus = true,
|
|
234
|
+
loop = true,
|
|
235
|
+
color,
|
|
236
|
+
...toggleGroupProps
|
|
237
|
+
} = props;
|
|
238
|
+
var direction = (0, import_use_direction.useDirection)(dir);
|
|
239
|
+
var content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupFrame, {
|
|
240
|
+
role: "group",
|
|
241
|
+
ref: forwardedRef,
|
|
242
|
+
"data-disabled": disabled ? "" : void 0,
|
|
243
|
+
...toggleGroupProps
|
|
244
|
+
});
|
|
245
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupContext, {
|
|
246
|
+
scope: __scopeToggleGroup,
|
|
247
|
+
rovingFocus,
|
|
248
|
+
disabled,
|
|
249
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.context.Provider, {
|
|
250
|
+
color,
|
|
251
|
+
children: rovingFocus ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
252
|
+
asChild: "except-style",
|
|
253
|
+
__scopeRovingFocusGroup: __scopeToggleGroup || TOGGLE_GROUP_CONTEXT,
|
|
254
|
+
orientation,
|
|
255
|
+
dir: direction,
|
|
256
|
+
loop,
|
|
257
|
+
children: content
|
|
258
|
+
}) : content
|
|
259
|
+
})
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
//# sourceMappingURL=ToggleGroup.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","ToggleGroup_exports","ToggleGroup","module","exports","import_jsx_runtime","require","import_constants","import_focusable","import_helpers","import_roving_focus","import_use_controllable_state","import_use_direction","import_web","import_react","import_Toggle","import_context","TOGGLE_GROUP_NAME","TOGGLE_GROUP_ITEM_NAME","TOGGLE_GROUP_CONTEXT","Provider","ToggleGroupItemProvider","createStyledContext","ToggleGroupContext","useStyledContext","useToggleGroupContext","ToggleGroupItem","ToggleFrame","styleable","props","forwardedRef","valueContext","useToggleGroupValueContext","__scopeToggleGroup","context","toggleContext","active","includes","color","disabled","inner","jsx","ToggleGroupItemImpl","ref","tabIndex","scope","children","rovingFocus","RovingFocusGroup","Item","asChild","__scopeRovingFocusGroup","focusable","displayName","default","forwardRef","itemProps","singleProps","typeProps","type","Toggle","onActiveChange","pressed","onItemActivate","onItemDeactivate","withStaticProperties","toggleGroupProps","isWeb","useEffect","id","registerFocusable","focus","ToggleGroupImplSingle","multipleProps","ToggleGroupImplMultiple","Error","ToggleGroupValueProvider","valueProp","defaultValue","onValueChange","disableDeactivation","toggleGroupSingleProps","setValue","useControllableState","prop","defaultProp","onChange","useCallback","ToggleGroupImpl","toggleGroupMultipleProps","handleButtonActivate","itemValue","prevValue","arguments","length","handleButtonDeactivate","filter","value2","ToggleGroupFrame","styled","View","orientation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S;AACuC,IAAAoD,gBAC/C,OAAArF,UAAA,CAAAsF,MAAA,EAAAtF,UAAA,CAAAuF,IAAA;EAAAnH,IAAA,EAAAgC;AACK;AACL,IAAAuE,eAEC,GAAAU,gBAAA,CAAAtE,SAAA,WAAAC,KAAA,EAAAC,YAAA;EAAA;IAAAG,kBAAA;IAAAM,QAAA;IAAA8D,WAAA;IAAAC,GAAA;IAAAvD,WAAA;IAAAwD,IAAA;IAAAjE,KAAA;IAAA,GAAA4B;EAAA,IAAArC,KAAA;EAAA,IAAA2E,SAGH,OAEJ5F,oBAAA,CAAA6F,YAAA,EAAAH,GAAA;EAAA,IAAAI,OAAA,sBAAArG,kBAAA,CAAAoC,GAAA,EAAAyD,gBAAA;IACFS,IAAA;IAEJhE,GAAA,EAAAb,YAAA;IACF,iBAAAS,QAAA","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createStyledContext } from "@hanzogui/web";
|
|
2
|
+
const context = createStyledContext({
|
|
3
|
+
color: "",
|
|
4
|
+
active: false
|
|
5
|
+
});
|
|
6
|
+
const useToggleGroupItem = () => {
|
|
7
|
+
return context.useStyledContext();
|
|
8
|
+
};
|
|
9
|
+
export { context, useToggleGroupItem };
|
|
10
|
+
//# sourceMappingURL=context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createStyledContext","context","color","active","useToggleGroupItem","useStyledContext"],"sources":["../../src/context.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,mBAAA,QAA2B;AAE7B,MAAMC,OAAA,GAAUD,mBAAA,CAAoB;EACzCE,KAAA,EAAO;EACPC,MAAA,EAAQ;AACV,CAAC;AAEM,MAAMC,kBAAA,GAAqBA,CAAA,KAAM;EACtC,OAAOH,OAAA,CAAQI,gBAAA,CAAiB;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var context_exports = {};
|
|
26
|
+
__export(context_exports, {
|
|
27
|
+
context: () => context,
|
|
28
|
+
useToggleGroupItem: () => useToggleGroupItem
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(context_exports);
|
|
31
|
+
var import_web = require("@hanzogui/web");
|
|
32
|
+
var context = (0, import_web.createStyledContext)({
|
|
33
|
+
color: "",
|
|
34
|
+
active: false
|
|
35
|
+
});
|
|
36
|
+
var useToggleGroupItem = function () {
|
|
37
|
+
return context.useStyledContext();
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=context.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable"],"sources":["../../src/context.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AAEF,IAAAA,SAAM,GAAUC,MAAA,CAAAC,cAAoB;AAAA,IACzCC,gBAAO,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IACPC,iBAAQ,GAAAJ,MAAA,CAAAK,mBAAA;AACV,IAACC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAEM,IAAAC,QAAM,GAAAA,CAAAC,MAAA,EAAAC,GAAqB;EAChC,SAAOC,IAAA,IAAQD,GAAA,EACjBZ,SAAA,CAAAW,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useToggleGroupItem"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,SAASA,kBAAA,QAA0B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useToggleGroupItem"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,SAASA,kBAAA,QAA0B","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
24
|
+
value: true
|
|
25
|
+
}), mod);
|
|
26
|
+
var index_exports = {};
|
|
27
|
+
__export(index_exports, {
|
|
28
|
+
useToggleGroupItem: () => import_context.useToggleGroupItem
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
|
+
__reExport(index_exports, require("./ToggleGroup.native.js"), module.exports);
|
|
32
|
+
var import_context = require("./context.native.js");
|
|
33
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;AACA,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAA0B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
}), mod);
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(types_exports);
|
|
21
|
+
//# sourceMappingURL=types.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/toggle-group",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -30,32 +30,34 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "
|
|
34
|
-
"watch": "
|
|
35
|
-
"clean": "
|
|
36
|
-
"clean:build": "
|
|
33
|
+
"build": "gui-build",
|
|
34
|
+
"watch": "gui-build --watch",
|
|
35
|
+
"clean": "gui-build clean",
|
|
36
|
+
"clean:build": "gui-build clean:build"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@hanzogui/constants": "
|
|
40
|
-
"@hanzogui/create-context": "
|
|
41
|
-
"@hanzogui/focusable": "
|
|
42
|
-
"@hanzogui/get-token": "
|
|
43
|
-
"@hanzogui/helpers": "
|
|
44
|
-
"@hanzogui/component-helpers": "
|
|
45
|
-
"@hanzogui/roving-focus": "
|
|
46
|
-
"@hanzogui/sizable-context": "
|
|
47
|
-
"@hanzogui/stacks": "
|
|
48
|
-
"@hanzogui/use-controllable-state": "
|
|
49
|
-
"@hanzogui/use-direction": "
|
|
50
|
-
"@hanzogui/font-size": "
|
|
51
|
-
"@hanzogui/web": "
|
|
39
|
+
"@hanzogui/constants": "7.3.1",
|
|
40
|
+
"@hanzogui/create-context": "7.3.1",
|
|
41
|
+
"@hanzogui/focusable": "7.3.1",
|
|
42
|
+
"@hanzogui/get-token": "7.3.1",
|
|
43
|
+
"@hanzogui/helpers": "7.3.1",
|
|
44
|
+
"@hanzogui/component-helpers": "7.3.1",
|
|
45
|
+
"@hanzogui/roving-focus": "7.3.1",
|
|
46
|
+
"@hanzogui/sizable-context": "7.3.1",
|
|
47
|
+
"@hanzogui/stacks": "7.3.1",
|
|
48
|
+
"@hanzogui/use-controllable-state": "7.3.1",
|
|
49
|
+
"@hanzogui/use-direction": "7.3.1",
|
|
50
|
+
"@hanzogui/font-size": "7.3.1",
|
|
51
|
+
"@hanzogui/web": "7.3.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@hanzogui/build": "
|
|
54
|
+
"@hanzogui/build": "7.3.1",
|
|
55
55
|
"react": ">=19"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": ">=19"
|
|
59
59
|
},
|
|
60
|
-
"module:jsx": "dist/jsx"
|
|
61
|
-
|
|
60
|
+
"module:jsx": "dist/jsx",
|
|
61
|
+
"license": "BSD-3-Clause",
|
|
62
|
+
"author": "Hanzo AI <dev@hanzo.ai>"
|
|
63
|
+
}
|
package/src/Toggle.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { composeEventHandlers } from '@hanzogui/helpers'
|
|
2
2
|
import { useControllableState } from '@hanzogui/use-controllable-state'
|
|
3
|
-
import type { GetProps,
|
|
3
|
+
import type { GetProps, GuiElement, ViewStyle } from '@hanzogui/web'
|
|
4
4
|
import { styled, View } from '@hanzogui/web'
|
|
5
5
|
import * as React from 'react'
|
|
6
6
|
import { context } from './context'
|
|
@@ -74,7 +74,7 @@ export const ToggleFrame = styled(
|
|
|
74
74
|
} as const,
|
|
75
75
|
|
|
76
76
|
defaultVariants: {
|
|
77
|
-
unstyled: process.env.
|
|
77
|
+
unstyled: process.env.GUI_HEADLESS === '1',
|
|
78
78
|
},
|
|
79
79
|
},
|
|
80
80
|
{
|
|
@@ -99,7 +99,7 @@ type ToggleItemExtraProps = {
|
|
|
99
99
|
|
|
100
100
|
export type ToggleProps = ToggleFrameProps & ToggleItemExtraProps
|
|
101
101
|
|
|
102
|
-
export const Toggle = React.forwardRef<
|
|
102
|
+
export const Toggle = React.forwardRef<GuiElement, ToggleProps>(
|
|
103
103
|
function Toggle(props, forwardedRef) {
|
|
104
104
|
const {
|
|
105
105
|
active: activeProp,
|
package/src/ToggleGroup.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { withStaticProperties } from '@hanzogui/helpers'
|
|
|
4
4
|
import { RovingFocusGroup } from '@hanzogui/roving-focus'
|
|
5
5
|
import { useControllableState } from '@hanzogui/use-controllable-state'
|
|
6
6
|
import { useDirection } from '@hanzogui/use-direction'
|
|
7
|
-
import type { GetProps,
|
|
7
|
+
import type { GetProps, GuiElement } from '@hanzogui/web'
|
|
8
8
|
import { createStyledContext, styled, View } from '@hanzogui/web'
|
|
9
9
|
import React from 'react'
|
|
10
10
|
|
|
@@ -82,7 +82,7 @@ type ToggleGroupItemImplProps = Omit<ToggleProps, 'defaultActive' | 'onActiveCha
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const ToggleGroupItemImpl = React.forwardRef<
|
|
85
|
-
|
|
85
|
+
GuiElement,
|
|
86
86
|
ScopedProps<ToggleGroupItemImplProps>
|
|
87
87
|
>((props, forwardedRef) => {
|
|
88
88
|
const { __scopeToggleGroup, value, ...itemProps } = props
|
|
@@ -123,7 +123,7 @@ interface ToggleGroupMultipleProps extends ToggleGroupImplMultipleProps {
|
|
|
123
123
|
type ToggleGroupProps = ToggleGroupSingleProps | ToggleGroupMultipleProps
|
|
124
124
|
|
|
125
125
|
const ToggleGroup = withStaticProperties(
|
|
126
|
-
React.forwardRef<
|
|
126
|
+
React.forwardRef<GuiElement, ScopedProps<ToggleGroupProps>>(
|
|
127
127
|
(props, forwardedRef) => {
|
|
128
128
|
const { type, ...toggleGroupProps } = props
|
|
129
129
|
|
|
@@ -183,7 +183,7 @@ interface ToggleGroupImplSingleProps extends ToggleGroupImplProps {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
const ToggleGroupImplSingle = React.forwardRef<
|
|
186
|
-
|
|
186
|
+
GuiElement,
|
|
187
187
|
ScopedProps<ToggleGroupImplSingleProps>
|
|
188
188
|
>((props: ScopedProps<ToggleGroupImplSingleProps>, forwardedRef) => {
|
|
189
189
|
const {
|
|
@@ -231,7 +231,7 @@ interface ToggleGroupImplMultipleProps extends ToggleGroupImplProps {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
const ToggleGroupImplMultiple = React.forwardRef<
|
|
234
|
-
|
|
234
|
+
GuiElement,
|
|
235
235
|
ToggleGroupImplMultipleProps
|
|
236
236
|
>((props: ScopedProps<ToggleGroupImplMultipleProps>, forwardedRef) => {
|
|
237
237
|
const {
|
|
@@ -297,7 +297,7 @@ type ToggleGroupImplProps = GetProps<typeof ToggleGroupFrame> & {
|
|
|
297
297
|
color?: string
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
const ToggleGroupImpl = ToggleGroupFrame.styleable<
|
|
300
|
+
const ToggleGroupImpl = ToggleGroupFrame.styleable<GuiElement, ToggleGroupImplProps>(
|
|
301
301
|
(props: ScopedProps<ToggleGroupImplProps>, forwardedRef) => {
|
|
302
302
|
const {
|
|
303
303
|
__scopeToggleGroup,
|
package/types/Toggle.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { GetProps,
|
|
1
|
+
import type { GetProps, GuiElement, ViewStyle } from '@hanzogui/web';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
export declare const ToggleFrame: import("@hanzogui/web").
|
|
4
|
-
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").
|
|
3
|
+
export declare const ToggleFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, GuiElement, import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase & {
|
|
4
|
+
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").GuiComponent<import("@hanzogui/web").ViewProps, GuiElement, import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {}, {}>, {
|
|
5
5
|
accept: {
|
|
6
6
|
readonly activeStyle: "style";
|
|
7
7
|
};
|
|
@@ -28,7 +28,7 @@ type ToggleItemExtraProps = {
|
|
|
28
28
|
};
|
|
29
29
|
export type ToggleProps = ToggleFrameProps & ToggleItemExtraProps;
|
|
30
30
|
export declare const Toggle: React.ForwardRefExoticComponent<Omit<import("@hanzogui/web").StackNonStyleProps, "unstyled" | keyof import("@hanzogui/web").StackStyleBase | "size" | "activeStyle" | "defaultActiveStyle"> & import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase & {
|
|
31
|
-
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").
|
|
31
|
+
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").GuiComponent<import("@hanzogui/web").ViewProps, GuiElement, import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {}, {}>, {
|
|
32
32
|
accept: {
|
|
33
33
|
readonly activeStyle: "style";
|
|
34
34
|
};
|
|
@@ -38,13 +38,13 @@ export declare const Toggle: React.ForwardRefExoticComponent<Omit<import("@hanzo
|
|
|
38
38
|
size?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
39
39
|
defaultActiveStyle?: boolean | undefined;
|
|
40
40
|
} & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase & {
|
|
41
|
-
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").
|
|
41
|
+
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").GuiComponent<import("@hanzogui/web").ViewProps, GuiElement, import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {}, {}>, {
|
|
42
42
|
accept: {
|
|
43
43
|
readonly activeStyle: "style";
|
|
44
44
|
};
|
|
45
45
|
}>> | undefined;
|
|
46
46
|
}>> & import("@hanzogui/web").WithPseudoProps<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase & {
|
|
47
|
-
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").
|
|
47
|
+
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").GuiComponent<import("@hanzogui/web").ViewProps, GuiElement, import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {}, {}>, {
|
|
48
48
|
accept: {
|
|
49
49
|
readonly activeStyle: "style";
|
|
50
50
|
};
|
|
@@ -54,13 +54,13 @@ export declare const Toggle: React.ForwardRefExoticComponent<Omit<import("@hanzo
|
|
|
54
54
|
size?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
55
55
|
defaultActiveStyle?: boolean | undefined;
|
|
56
56
|
} & import("@hanzogui/web").WithShorthands<import("@hanzogui/web").WithThemeValues<import("@hanzogui/web").StackStyleBase & {
|
|
57
|
-
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").
|
|
57
|
+
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").GuiComponent<import("@hanzogui/web").ViewProps, GuiElement, import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {}, {}>, {
|
|
58
58
|
accept: {
|
|
59
59
|
readonly activeStyle: "style";
|
|
60
60
|
};
|
|
61
61
|
}>> | undefined;
|
|
62
62
|
}>>> & import("@hanzogui/web").WithMediaProps<import("@hanzogui/web").WithThemeShorthandsAndPseudos<import("@hanzogui/web").StackStyleBase & {
|
|
63
|
-
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").
|
|
63
|
+
readonly activeStyle?: Partial<import("@hanzogui/web").InferStyleProps<import("@hanzogui/web").GuiComponent<import("@hanzogui/web").ViewProps, GuiElement, import("@hanzogui/web").StackNonStyleProps, import("@hanzogui/web").StackStyleBase, {}, {}>, {
|
|
64
64
|
accept: {
|
|
65
65
|
readonly activeStyle: "style";
|
|
66
66
|
};
|
|
@@ -69,6 +69,6 @@ export declare const Toggle: React.ForwardRefExoticComponent<Omit<import("@hanzo
|
|
|
69
69
|
unstyled?: boolean | undefined;
|
|
70
70
|
size?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
71
71
|
defaultActiveStyle?: boolean | undefined;
|
|
72
|
-
}>> & ToggleItemExtraProps & React.RefAttributes<
|
|
72
|
+
}>> & ToggleItemExtraProps & React.RefAttributes<GuiElement>>;
|
|
73
73
|
export {};
|
|
74
74
|
//# sourceMappingURL=Toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../src/Toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,eAAO,MAAM,WAAW;;;;;;;;;;;;;;EAuEvB,CAAA;AAED,KAAK,gBAAgB,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA;AAEpD,KAAK,oBAAoB,GAAG;IAC1B,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;IACtC,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,oBAAoB,CAAA;AAEjE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6DA8ClB,CAAA"}
|