@tamagui/toggle-group 2.0.0-rc.4 → 2.0.0-rc.40

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.
Files changed (93) hide show
  1. package/dist/cjs/Toggle.cjs +129 -125
  2. package/dist/cjs/Toggle.native.js +132 -128
  3. package/dist/cjs/Toggle.native.js.map +1 -1
  4. package/dist/cjs/ToggleGroup.cjs +218 -202
  5. package/dist/cjs/ToggleGroup.native.js +232 -222
  6. package/dist/cjs/ToggleGroup.native.js.map +1 -1
  7. package/dist/cjs/context.cjs +18 -14
  8. package/dist/cjs/context.native.js +20 -18
  9. package/dist/cjs/context.native.js.map +1 -1
  10. package/dist/cjs/index.cjs +13 -11
  11. package/dist/cjs/index.native.js +13 -11
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/types.cjs +7 -5
  14. package/dist/cjs/types.native.js +7 -5
  15. package/dist/cjs/types.native.js.map +1 -1
  16. package/dist/esm/Toggle.mjs +98 -96
  17. package/dist/esm/Toggle.mjs.map +1 -1
  18. package/dist/esm/Toggle.native.js +102 -100
  19. package/dist/esm/Toggle.native.js.map +1 -1
  20. package/dist/esm/ToggleGroup.mjs +182 -168
  21. package/dist/esm/ToggleGroup.mjs.map +1 -1
  22. package/dist/esm/ToggleGroup.native.js +197 -189
  23. package/dist/esm/ToggleGroup.native.js.map +1 -1
  24. package/dist/esm/context.mjs +6 -4
  25. package/dist/esm/context.mjs.map +1 -1
  26. package/dist/esm/context.native.js +6 -6
  27. package/dist/esm/context.native.js.map +1 -1
  28. package/dist/esm/index.js +3 -5
  29. package/dist/esm/index.js.map +1 -6
  30. package/dist/jsx/Toggle.mjs +98 -96
  31. package/dist/jsx/Toggle.mjs.map +1 -1
  32. package/dist/jsx/Toggle.native.js +132 -128
  33. package/dist/jsx/Toggle.native.js.map +1 -1
  34. package/dist/jsx/ToggleGroup.mjs +182 -168
  35. package/dist/jsx/ToggleGroup.mjs.map +1 -1
  36. package/dist/jsx/ToggleGroup.native.js +232 -222
  37. package/dist/jsx/ToggleGroup.native.js.map +1 -1
  38. package/dist/jsx/context.mjs +6 -4
  39. package/dist/jsx/context.mjs.map +1 -1
  40. package/dist/jsx/context.native.js +20 -18
  41. package/dist/jsx/context.native.js.map +1 -1
  42. package/dist/jsx/index.js +3 -5
  43. package/dist/jsx/index.js.map +1 -6
  44. package/dist/jsx/index.native.js +13 -11
  45. package/dist/jsx/types.native.js +7 -5
  46. package/package.json +18 -21
  47. package/src/Toggle.tsx +0 -1
  48. package/types/Toggle.d.ts.map +1 -1
  49. package/types/ToggleGroup.d.ts +2 -2
  50. package/dist/cjs/Toggle.js +0 -138
  51. package/dist/cjs/Toggle.js.map +0 -6
  52. package/dist/cjs/ToggleGroup.js +0 -196
  53. package/dist/cjs/ToggleGroup.js.map +0 -6
  54. package/dist/cjs/context.js +0 -26
  55. package/dist/cjs/context.js.map +0 -6
  56. package/dist/cjs/index.js +0 -22
  57. package/dist/cjs/index.js.map +0 -6
  58. package/dist/cjs/types.js +0 -14
  59. package/dist/cjs/types.js.map +0 -6
  60. package/dist/cjs/useToggleGroupItem.cjs +0 -27
  61. package/dist/cjs/useToggleGroupItem.js +0 -22
  62. package/dist/cjs/useToggleGroupItem.js.map +0 -6
  63. package/dist/cjs/useToggleGroupItem.native.js +0 -30
  64. package/dist/cjs/useToggleGroupItem.native.js.map +0 -1
  65. package/dist/esm/Toggle.js +0 -119
  66. package/dist/esm/Toggle.js.map +0 -6
  67. package/dist/esm/ToggleGroup.js +0 -182
  68. package/dist/esm/ToggleGroup.js.map +0 -6
  69. package/dist/esm/context.js +0 -10
  70. package/dist/esm/context.js.map +0 -6
  71. package/dist/esm/types.js +0 -1
  72. package/dist/esm/types.js.map +0 -6
  73. package/dist/esm/useToggleGroupItem.js +0 -6
  74. package/dist/esm/useToggleGroupItem.js.map +0 -6
  75. package/dist/esm/useToggleGroupItem.mjs +0 -4
  76. package/dist/esm/useToggleGroupItem.mjs.map +0 -1
  77. package/dist/esm/useToggleGroupItem.native.js +0 -4
  78. package/dist/esm/useToggleGroupItem.native.js.map +0 -1
  79. package/dist/jsx/Toggle.js +0 -119
  80. package/dist/jsx/Toggle.js.map +0 -6
  81. package/dist/jsx/ToggleGroup.js +0 -182
  82. package/dist/jsx/ToggleGroup.js.map +0 -6
  83. package/dist/jsx/context.js +0 -10
  84. package/dist/jsx/context.js.map +0 -6
  85. package/dist/jsx/types.js +0 -1
  86. package/dist/jsx/types.js.map +0 -6
  87. package/dist/jsx/useToggleGroupItem.js +0 -6
  88. package/dist/jsx/useToggleGroupItem.js.map +0 -6
  89. package/dist/jsx/useToggleGroupItem.mjs +0 -4
  90. package/dist/jsx/useToggleGroupItem.mjs.map +0 -1
  91. package/dist/jsx/useToggleGroupItem.native.js +0 -30
  92. package/dist/jsx/useToggleGroupItem.native.js.map +0 -1
  93. package/types/useToggleGroupItem.d.ts.map +0 -1
@@ -2,228 +2,244 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var ToggleGroup_exports = {};
33
35
  __export(ToggleGroup_exports, {
34
36
  ToggleGroup: () => ToggleGroup
35
37
  });
36
38
  module.exports = __toCommonJS(ToggleGroup_exports);
37
- var import_constants = require("@tamagui/constants"),
38
- import_focusable = require("@tamagui/focusable"),
39
- import_helpers = require("@tamagui/helpers"),
40
- import_roving_focus = require("@tamagui/roving-focus"),
41
- import_use_controllable_state = require("@tamagui/use-controllable-state"),
42
- import_use_direction = require("@tamagui/use-direction"),
43
- import_web = require("@tamagui/web"),
44
- import_react = __toESM(require("react"), 1),
45
- import_Toggle = require("./Toggle.cjs"),
46
- import_context = require("./context.cjs"),
47
- import_jsx_runtime = require("react/jsx-runtime");
48
- const TOGGLE_GROUP_NAME = "ToggleGroup",
49
- TOGGLE_GROUP_ITEM_NAME = "ToggleGroupItem",
50
- TOGGLE_GROUP_CONTEXT = "ToggleGroup",
51
- {
52
- Provider: ToggleGroupItemProvider
53
- } = (0, import_web.createStyledContext)(),
54
- {
55
- Provider: ToggleGroupContext,
56
- useStyledContext: useToggleGroupContext
57
- } = (0, import_web.createStyledContext)({}),
58
- ToggleGroupItem = import_Toggle.ToggleFrame.styleable((props, forwardedRef) => {
59
- const valueContext = useToggleGroupValueContext(props.__scopeToggleGroup),
60
- context = useToggleGroupContext(props.__scopeToggleGroup),
61
- toggleContext = import_context.context.useStyledContext(props.__scopeToggleGroup),
62
- active = valueContext?.value.includes(props.value),
63
- color = props.color || toggleContext.color,
64
- disabled = context.disabled || props.disabled || !1,
65
- inner = /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupItemImpl, {
66
- ref: forwardedRef,
67
- tabIndex: disabled ? -1 : 0,
68
- ...props,
69
- active,
70
- disabled
71
- });
72
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupItemProvider, {
73
- scope: props.__scopeToggleGroup,
74
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.context.Provider, {
75
- color,
39
+ var import_constants = require("@tamagui/constants");
40
+ var import_focusable = require("@tamagui/focusable");
41
+ var import_helpers = require("@tamagui/helpers");
42
+ var import_roving_focus = require("@tamagui/roving-focus");
43
+ var import_use_controllable_state = require("@tamagui/use-controllable-state");
44
+ var import_use_direction = require("@tamagui/use-direction");
45
+ var import_web = require("@tamagui/web");
46
+ var import_react = __toESM(require("react"), 1);
47
+ var import_Toggle = require("./Toggle.cjs");
48
+ var import_context = require("./context.cjs");
49
+ var import_jsx_runtime = require("react/jsx-runtime");
50
+ const TOGGLE_GROUP_NAME = "ToggleGroup";
51
+ const TOGGLE_GROUP_ITEM_NAME = "ToggleGroupItem";
52
+ const TOGGLE_GROUP_CONTEXT = "ToggleGroup";
53
+ const {
54
+ Provider: ToggleGroupItemProvider
55
+ } = (0, import_web.createStyledContext)();
56
+ const {
57
+ Provider: ToggleGroupContext,
58
+ useStyledContext: useToggleGroupContext
59
+ } = (0, import_web.createStyledContext)({});
60
+ const ToggleGroupItem = import_Toggle.ToggleFrame.styleable((props, forwardedRef) => {
61
+ const valueContext = useToggleGroupValueContext(props.__scopeToggleGroup);
62
+ const context = useToggleGroupContext(props.__scopeToggleGroup);
63
+ const toggleContext = import_context.context.useStyledContext(props.__scopeToggleGroup);
64
+ const active = valueContext?.value.includes(props.value);
65
+ const color = props.color || toggleContext.color;
66
+ const disabled = context.disabled || props.disabled || false;
67
+ const inner = /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupItemImpl, {
68
+ ref: forwardedRef,
69
+ tabIndex: disabled ? -1 : 0,
70
+ ...props,
71
+ active,
72
+ disabled
73
+ });
74
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupItemProvider, {
75
+ scope: props.__scopeToggleGroup,
76
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.context.Provider, {
77
+ color,
78
+ active,
79
+ children: context.rovingFocus ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
80
+ asChild: "except-style",
81
+ __scopeRovingFocusGroup: props.__scopeToggleGroup || TOGGLE_GROUP_CONTEXT,
82
+ focusable: !disabled,
76
83
  active,
77
- children: context.rovingFocus ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
78
- asChild: "except-style",
79
- __scopeRovingFocusGroup: props.__scopeToggleGroup || TOGGLE_GROUP_CONTEXT,
80
- focusable: !disabled,
81
- active,
82
- children: inner
83
- }) : inner
84
- })
85
- });
84
+ children: inner
85
+ }) : inner
86
+ })
86
87
  });
88
+ });
87
89
  ToggleGroupItem.displayName = TOGGLE_GROUP_ITEM_NAME;
88
90
  const ToggleGroupItemImpl = import_react.default.forwardRef((props, forwardedRef) => {
89
- const {
90
- __scopeToggleGroup,
91
- value,
92
- ...itemProps
93
- } = props,
94
- valueContext = useToggleGroupValueContext(__scopeToggleGroup),
95
- singleProps = {
96
- "aria-pressed": void 0
97
- },
98
- typeProps = valueContext.type === "single" ? singleProps : void 0;
99
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Toggle.Toggle, {
100
- ...typeProps,
101
- ...itemProps,
102
- ref: forwardedRef,
103
- onActiveChange: pressed => {
104
- pressed ? valueContext.onItemActivate(value) : valueContext.onItemDeactivate(value);
91
+ const {
92
+ __scopeToggleGroup,
93
+ value,
94
+ ...itemProps
95
+ } = props;
96
+ const valueContext = useToggleGroupValueContext(__scopeToggleGroup);
97
+ const singleProps = {
98
+ "aria-pressed": void 0
99
+ };
100
+ const typeProps = valueContext.type === "single" ? singleProps : void 0;
101
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Toggle.Toggle, {
102
+ ...typeProps,
103
+ ...itemProps,
104
+ ref: forwardedRef,
105
+ onActiveChange: pressed => {
106
+ if (pressed) {
107
+ valueContext.onItemActivate(value);
108
+ } else {
109
+ valueContext.onItemDeactivate(value);
105
110
  }
106
- });
107
- }),
108
- ToggleGroup = (0, import_helpers.withStaticProperties)(import_react.default.forwardRef((props, forwardedRef) => {
109
- const {
110
- type,
111
- ...toggleGroupProps
112
- } = props;
113
- if (import_constants.isWeb || import_react.default.useEffect(() => {
114
- if (props.id) return (0, import_focusable.registerFocusable)(props.id, {
111
+ }
112
+ });
113
+ });
114
+ const ToggleGroup = (0, import_helpers.withStaticProperties)(import_react.default.forwardRef((props, forwardedRef) => {
115
+ const {
116
+ type,
117
+ ...toggleGroupProps
118
+ } = props;
119
+ if (!import_constants.isWeb) {
120
+ import_react.default.useEffect(() => {
121
+ if (!props.id) return;
122
+ return (0, import_focusable.registerFocusable)(props.id, {
115
123
  focus: () => {}
116
124
  });
117
- }, [props.id]), type === "single") return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImplSingle, {
118
- ...toggleGroupProps,
125
+ }, [props.id]);
126
+ }
127
+ if (type === "single") {
128
+ const singleProps = toggleGroupProps;
129
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImplSingle, {
130
+ ...singleProps,
119
131
  ref: forwardedRef
120
132
  });
121
- if (type === "multiple") return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImplMultiple, {
122
- ...toggleGroupProps,
133
+ }
134
+ if (type === "multiple") {
135
+ const multipleProps = toggleGroupProps;
136
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImplMultiple, {
137
+ ...multipleProps,
123
138
  ref: forwardedRef
124
139
  });
125
- throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
126
- }), {
127
- Item: ToggleGroupItem
128
- });
140
+ }
141
+ throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
142
+ }), {
143
+ Item: ToggleGroupItem
144
+ });
129
145
  ToggleGroup.displayName = TOGGLE_GROUP_NAME;
130
146
  const {
131
- Provider: ToggleGroupValueProvider,
132
- useStyledContext: useToggleGroupValueContext
133
- } = (0, import_web.createStyledContext)(),
134
- ToggleGroupImplSingle = import_react.default.forwardRef((props, forwardedRef) => {
135
- const {
136
- value: valueProp,
137
- defaultValue,
138
- onValueChange = () => {},
139
- disableDeactivation = !1,
140
- children,
141
- ...toggleGroupSingleProps
142
- } = props,
143
- [value, setValue] = (0, import_use_controllable_state.useControllableState)({
144
- prop: valueProp,
145
- defaultProp: defaultValue,
146
- onChange: onValueChange
147
- });
148
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupValueProvider, {
149
- scope: props.__scopeToggleGroup,
150
- type: "single",
151
- value: value ? [value] : [],
152
- defaultValue: value,
153
- onItemActivate: setValue,
154
- onItemDeactivate: import_react.default.useCallback(() => disableDeactivation ? null : setValue(""), [setValue, disableDeactivation]),
155
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImpl, {
156
- ...toggleGroupSingleProps,
157
- ref: forwardedRef,
158
- children
159
- })
160
- });
161
- }),
162
- ToggleGroupImplMultiple = import_react.default.forwardRef((props, forwardedRef) => {
163
- const {
164
- value: valueProp,
165
- defaultValue,
166
- onValueChange = () => {},
167
- disableDeactivation,
168
- children,
169
- ...toggleGroupMultipleProps
170
- } = props,
171
- [value = [], setValue] = (0, import_use_controllable_state.useControllableState)({
172
- prop: valueProp,
173
- defaultProp: defaultValue,
174
- onChange: onValueChange
175
- }),
176
- handleButtonActivate = import_react.default.useCallback(itemValue => setValue((prevValue = []) => [...prevValue, itemValue]), [setValue]),
177
- handleButtonDeactivate = import_react.default.useCallback(itemValue => setValue((prevValue = []) => prevValue.filter(value2 => value2 !== itemValue)), [setValue]);
178
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupValueProvider, {
179
- scope: props.__scopeToggleGroup,
180
- type: "multiple",
181
- value,
182
- defaultValue: value,
183
- onItemActivate: handleButtonActivate,
184
- onItemDeactivate: handleButtonDeactivate,
185
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImpl, {
186
- ...toggleGroupMultipleProps,
187
- ref: forwardedRef,
188
- children
189
- })
190
- });
191
- }),
192
- ToggleGroupFrame = (0, import_web.styled)(import_web.View, {
193
- name: TOGGLE_GROUP_NAME
194
- }),
195
- ToggleGroupImpl = ToggleGroupFrame.styleable((props, forwardedRef) => {
196
- const {
197
- __scopeToggleGroup,
198
- disabled = !1,
199
- orientation = "horizontal",
200
- dir,
201
- rovingFocus = !0,
202
- loop = !0,
203
- color,
204
- ...toggleGroupProps
205
- } = props,
206
- direction = (0, import_use_direction.useDirection)(dir),
207
- content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupFrame, {
208
- role: "group",
209
- ref: forwardedRef,
210
- "data-disabled": disabled ? "" : void 0,
211
- ...toggleGroupProps
212
- });
213
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupContext, {
214
- scope: __scopeToggleGroup,
215
- rovingFocus,
216
- disabled,
217
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.context.Provider, {
218
- color,
219
- children: rovingFocus ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
220
- asChild: "except-style",
221
- __scopeRovingFocusGroup: __scopeToggleGroup || TOGGLE_GROUP_CONTEXT,
222
- orientation,
223
- dir: direction,
224
- loop,
225
- children: content
226
- }) : content
227
- })
228
- });
229
- });
147
+ Provider: ToggleGroupValueProvider,
148
+ useStyledContext: useToggleGroupValueContext
149
+ } = (0, import_web.createStyledContext)();
150
+ const ToggleGroupImplSingle = import_react.default.forwardRef((props, forwardedRef) => {
151
+ const {
152
+ value: valueProp,
153
+ defaultValue,
154
+ onValueChange = () => {},
155
+ disableDeactivation = false,
156
+ children,
157
+ ...toggleGroupSingleProps
158
+ } = props;
159
+ const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
160
+ prop: valueProp,
161
+ defaultProp: defaultValue,
162
+ onChange: onValueChange
163
+ });
164
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupValueProvider, {
165
+ scope: props.__scopeToggleGroup,
166
+ type: "single",
167
+ value: value ? [value] : [],
168
+ defaultValue: value,
169
+ onItemActivate: setValue,
170
+ onItemDeactivate: import_react.default.useCallback(() => disableDeactivation ? null : setValue(""), [setValue, disableDeactivation]),
171
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImpl, {
172
+ ...toggleGroupSingleProps,
173
+ ref: forwardedRef,
174
+ children
175
+ })
176
+ });
177
+ });
178
+ const ToggleGroupImplMultiple = import_react.default.forwardRef((props, forwardedRef) => {
179
+ const {
180
+ value: valueProp,
181
+ defaultValue,
182
+ onValueChange = () => {},
183
+ disableDeactivation,
184
+ children,
185
+ ...toggleGroupMultipleProps
186
+ } = props;
187
+ const [value = [], setValue] = (0, import_use_controllable_state.useControllableState)({
188
+ prop: valueProp,
189
+ defaultProp: defaultValue,
190
+ onChange: onValueChange
191
+ });
192
+ const handleButtonActivate = import_react.default.useCallback(itemValue => setValue((prevValue = []) => [...prevValue, itemValue]), [setValue]);
193
+ const handleButtonDeactivate = import_react.default.useCallback(itemValue => setValue((prevValue = []) => prevValue.filter(value2 => value2 !== itemValue)), [setValue]);
194
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupValueProvider, {
195
+ scope: props.__scopeToggleGroup,
196
+ type: "multiple",
197
+ value,
198
+ defaultValue: value,
199
+ onItemActivate: handleButtonActivate,
200
+ onItemDeactivate: handleButtonDeactivate,
201
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupImpl, {
202
+ ...toggleGroupMultipleProps,
203
+ ref: forwardedRef,
204
+ children
205
+ })
206
+ });
207
+ });
208
+ const ToggleGroupFrame = (0, import_web.styled)(import_web.View, {
209
+ name: TOGGLE_GROUP_NAME
210
+ });
211
+ const ToggleGroupImpl = ToggleGroupFrame.styleable((props, forwardedRef) => {
212
+ const {
213
+ __scopeToggleGroup,
214
+ disabled = false,
215
+ orientation = "horizontal",
216
+ dir,
217
+ rovingFocus = true,
218
+ loop = true,
219
+ color,
220
+ ...toggleGroupProps
221
+ } = props;
222
+ const direction = (0, import_use_direction.useDirection)(dir);
223
+ const content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupFrame, {
224
+ role: "group",
225
+ ref: forwardedRef,
226
+ "data-disabled": disabled ? "" : void 0,
227
+ ...toggleGroupProps
228
+ });
229
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToggleGroupContext, {
230
+ scope: __scopeToggleGroup,
231
+ rovingFocus,
232
+ disabled,
233
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.context.Provider, {
234
+ color,
235
+ children: rovingFocus ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
236
+ asChild: "except-style",
237
+ __scopeRovingFocusGroup: __scopeToggleGroup || TOGGLE_GROUP_CONTEXT,
238
+ orientation,
239
+ dir: direction,
240
+ loop,
241
+ children: content
242
+ }) : content
243
+ })
244
+ });
245
+ });