@radix-ui/react-toolbar 0.1.6-rc.5 → 0.1.6-rc.50
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/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +173 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +154 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +10 -9
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface ToolbarToggleGroupMultipleProps extends Extract<ToggleGroupProp
|
|
|
34
34
|
type: 'multiple';
|
|
35
35
|
}> {
|
|
36
36
|
}
|
|
37
|
-
export const ToolbarToggleGroup: React.ForwardRefExoticComponent<(ToolbarToggleGroupSingleProps
|
|
37
|
+
export const ToolbarToggleGroup: React.ForwardRefExoticComponent<(ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
38
38
|
type ToggleGroupItemProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>;
|
|
39
39
|
export interface ToolbarToggleItemProps extends ToggleGroupItemProps {
|
|
40
40
|
}
|
|
@@ -43,7 +43,7 @@ export const Root: React.ForwardRefExoticComponent<ToolbarProps & React.RefAttri
|
|
|
43
43
|
export const Separator: React.ForwardRefExoticComponent<ToolbarSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
44
44
|
export const Button: React.ForwardRefExoticComponent<ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
45
45
|
export const Link: React.ForwardRefExoticComponent<ToolbarLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
46
|
-
export const ToggleGroup: React.ForwardRefExoticComponent<(ToolbarToggleGroupSingleProps
|
|
46
|
+
export const ToggleGroup: React.ForwardRefExoticComponent<(ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
47
47
|
export const Toggle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EAAE,UAAU,CAAA;CAAE,CAAC;CAAG;AAEpG,OAAA,MAAM,4JAsBL,CAAC;AAWF,4BAA4B,MAAM,wBAAwB,CAAC,OAAO,qBAAqB,IAAI,CAAC,CAAC;AAC7F,uCAAiC,SAAQ,oBAAoB;CAAG;AAEhE,OAAA,MAAM,mHAUL,CAAC;AAMF,OAAA,MAAM,yFAAc,CAAC;AACrB,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,oGAAsB,CAAC;AAC7B,OAAA,MAAM,gGAAkB,CAAC;AACzB,OAAA,MAAM,qJAAgC,CAAC;AACvC,OAAA,MAAM,4GAA8B,CAAC","sources":["packages/react/toolbar/src/packages/react/toolbar/src/Toolbar.tsx","packages/react/toolbar/src/packages/react/toolbar/src/index.ts","packages/react/toolbar/src/index.ts"],"sourcesContent":[null,null,"export {\n createToolbarScope,\n //\n Toolbar,\n ToolbarSeparator,\n ToolbarButton,\n ToolbarLink,\n ToolbarToggleGroup,\n ToolbarToggleItem,\n //\n Root,\n Separator,\n Button,\n Link,\n ToggleGroup,\n ToggleItem,\n} from './Toolbar';\nexport type {\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarButtonProps,\n ToolbarLinkProps,\n ToolbarToggleGroupSingleProps,\n ToolbarToggleGroupMultipleProps,\n ToolbarToggleItemProps,\n} from './Toolbar';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,174 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $ds9gm$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
|
|
2
|
+
var $ds9gm$react = require("react");
|
|
3
|
+
var $ds9gm$radixuiprimitive = require("@radix-ui/primitive");
|
|
4
|
+
var $ds9gm$radixuireactcontext = require("@radix-ui/react-context");
|
|
5
|
+
var $ds9gm$radixuireactrovingfocus = require("@radix-ui/react-roving-focus");
|
|
6
|
+
var $ds9gm$radixuireactprimitive = require("@radix-ui/react-primitive");
|
|
7
|
+
var $ds9gm$radixuireactseparator = require("@radix-ui/react-separator");
|
|
8
|
+
var $ds9gm$radixuireacttogglegroup = require("@radix-ui/react-toggle-group");
|
|
9
|
+
var $ds9gm$radixuireactdirection = require("@radix-ui/react-direction");
|
|
10
|
+
|
|
11
|
+
function $parcel$export(e, n, v, s) {
|
|
12
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
+
}
|
|
14
|
+
function $parcel$interopDefault(a) {
|
|
15
|
+
return a && a.__esModule ? a.default : a;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
$parcel$export(module.exports, "createToolbarScope", () => $ac268fe8f3257fa7$export$233e637670877d91);
|
|
19
|
+
$parcel$export(module.exports, "Toolbar", () => $ac268fe8f3257fa7$export$4c260019440d418f);
|
|
20
|
+
$parcel$export(module.exports, "ToolbarSeparator", () => $ac268fe8f3257fa7$export$291e1a31e8ec7868);
|
|
21
|
+
$parcel$export(module.exports, "ToolbarButton", () => $ac268fe8f3257fa7$export$e5c1a33878e86e9e);
|
|
22
|
+
$parcel$export(module.exports, "ToolbarLink", () => $ac268fe8f3257fa7$export$ff5714eba66809fd);
|
|
23
|
+
$parcel$export(module.exports, "ToolbarToggleGroup", () => $ac268fe8f3257fa7$export$aeae28cb17562c0b);
|
|
24
|
+
$parcel$export(module.exports, "ToolbarToggleItem", () => $ac268fe8f3257fa7$export$546b879b639844a1);
|
|
25
|
+
$parcel$export(module.exports, "Root", () => $ac268fe8f3257fa7$export$be92b6f5f03c0fe9);
|
|
26
|
+
$parcel$export(module.exports, "Separator", () => $ac268fe8f3257fa7$export$1ff3c3f08ae963c0);
|
|
27
|
+
$parcel$export(module.exports, "Button", () => $ac268fe8f3257fa7$export$353f5b6fc5456de1);
|
|
28
|
+
$parcel$export(module.exports, "Link", () => $ac268fe8f3257fa7$export$a6c7ac8248d6e38a);
|
|
29
|
+
$parcel$export(module.exports, "ToggleGroup", () => $ac268fe8f3257fa7$export$af3ec21f6cfb5e30);
|
|
30
|
+
$parcel$export(module.exports, "ToggleItem", () => $ac268fe8f3257fa7$export$920ad4cf87b18fc7);
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
/* -------------------------------------------------------------------------------------------------
|
|
43
|
+
* Toolbar
|
|
44
|
+
* -----------------------------------------------------------------------------------------------*/ const $ac268fe8f3257fa7$var$TOOLBAR_NAME = 'Toolbar';
|
|
45
|
+
const [$ac268fe8f3257fa7$var$createToolbarContext, $ac268fe8f3257fa7$export$233e637670877d91] = $ds9gm$radixuireactcontext.createContextScope($ac268fe8f3257fa7$var$TOOLBAR_NAME, [
|
|
46
|
+
$ds9gm$radixuireactrovingfocus.createRovingFocusGroupScope,
|
|
47
|
+
$ds9gm$radixuireacttogglegroup.createToggleGroupScope
|
|
48
|
+
]);
|
|
49
|
+
const $ac268fe8f3257fa7$var$useRovingFocusGroupScope = $ds9gm$radixuireactrovingfocus.createRovingFocusGroupScope();
|
|
50
|
+
const $ac268fe8f3257fa7$var$useToggleGroupScope = $ds9gm$radixuireacttogglegroup.createToggleGroupScope();
|
|
51
|
+
const [$ac268fe8f3257fa7$var$ToolbarProvider, $ac268fe8f3257fa7$var$useToolbarContext] = $ac268fe8f3257fa7$var$createToolbarContext($ac268fe8f3257fa7$var$TOOLBAR_NAME);
|
|
52
|
+
const $ac268fe8f3257fa7$export$4c260019440d418f = /*#__PURE__*/ $ds9gm$react.forwardRef((props, forwardedRef)=>{
|
|
53
|
+
const { __scopeToolbar: __scopeToolbar , orientation: orientation = 'horizontal' , dir: dir , loop: loop = true , ...toolbarProps } = props;
|
|
54
|
+
const rovingFocusGroupScope = $ac268fe8f3257fa7$var$useRovingFocusGroupScope(__scopeToolbar);
|
|
55
|
+
const direction = $ds9gm$radixuireactdirection.useDirection(dir);
|
|
56
|
+
return /*#__PURE__*/ $ds9gm$react.createElement($ac268fe8f3257fa7$var$ToolbarProvider, {
|
|
57
|
+
scope: __scopeToolbar,
|
|
58
|
+
orientation: orientation,
|
|
59
|
+
dir: direction
|
|
60
|
+
}, /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireactrovingfocus.Root, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({
|
|
61
|
+
asChild: true
|
|
62
|
+
}, rovingFocusGroupScope, {
|
|
63
|
+
orientation: orientation,
|
|
64
|
+
dir: direction,
|
|
65
|
+
loop: loop
|
|
66
|
+
}), /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({
|
|
67
|
+
role: "toolbar",
|
|
68
|
+
"aria-orientation": orientation,
|
|
69
|
+
dir: direction
|
|
70
|
+
}, toolbarProps, {
|
|
71
|
+
ref: forwardedRef
|
|
72
|
+
}))));
|
|
73
|
+
});
|
|
74
|
+
/*#__PURE__*/ Object.assign($ac268fe8f3257fa7$export$4c260019440d418f, {
|
|
75
|
+
displayName: $ac268fe8f3257fa7$var$TOOLBAR_NAME
|
|
76
|
+
});
|
|
77
|
+
/* -------------------------------------------------------------------------------------------------
|
|
78
|
+
* ToolbarSeparator
|
|
79
|
+
* -----------------------------------------------------------------------------------------------*/ const $ac268fe8f3257fa7$var$SEPARATOR_NAME = 'ToolbarSeparator';
|
|
80
|
+
const $ac268fe8f3257fa7$export$291e1a31e8ec7868 = /*#__PURE__*/ $ds9gm$react.forwardRef((props, forwardedRef)=>{
|
|
81
|
+
const { __scopeToolbar: __scopeToolbar , ...separatorProps } = props;
|
|
82
|
+
const context = $ac268fe8f3257fa7$var$useToolbarContext($ac268fe8f3257fa7$var$SEPARATOR_NAME, __scopeToolbar);
|
|
83
|
+
return /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireactseparator.Root, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({
|
|
84
|
+
orientation: context.orientation === 'horizontal' ? 'vertical' : 'horizontal'
|
|
85
|
+
}, separatorProps, {
|
|
86
|
+
ref: forwardedRef
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
/*#__PURE__*/ Object.assign($ac268fe8f3257fa7$export$291e1a31e8ec7868, {
|
|
90
|
+
displayName: $ac268fe8f3257fa7$var$SEPARATOR_NAME
|
|
91
|
+
});
|
|
92
|
+
/* -------------------------------------------------------------------------------------------------
|
|
93
|
+
* ToolbarButton
|
|
94
|
+
* -----------------------------------------------------------------------------------------------*/ const $ac268fe8f3257fa7$var$BUTTON_NAME = 'ToolbarButton';
|
|
95
|
+
const $ac268fe8f3257fa7$export$e5c1a33878e86e9e = /*#__PURE__*/ $ds9gm$react.forwardRef((props, forwardedRef)=>{
|
|
96
|
+
const { __scopeToolbar: __scopeToolbar , ...buttonProps } = props;
|
|
97
|
+
const rovingFocusGroupScope = $ac268fe8f3257fa7$var$useRovingFocusGroupScope(__scopeToolbar);
|
|
98
|
+
return /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireactrovingfocus.Item, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({
|
|
99
|
+
asChild: true
|
|
100
|
+
}, rovingFocusGroupScope, {
|
|
101
|
+
focusable: !props.disabled
|
|
102
|
+
}), /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({
|
|
103
|
+
type: "button"
|
|
104
|
+
}, buttonProps, {
|
|
105
|
+
ref: forwardedRef
|
|
106
|
+
})));
|
|
107
|
+
});
|
|
108
|
+
/*#__PURE__*/ Object.assign($ac268fe8f3257fa7$export$e5c1a33878e86e9e, {
|
|
109
|
+
displayName: $ac268fe8f3257fa7$var$BUTTON_NAME
|
|
110
|
+
});
|
|
111
|
+
/* -------------------------------------------------------------------------------------------------
|
|
112
|
+
* ToolbarLink
|
|
113
|
+
* -----------------------------------------------------------------------------------------------*/ const $ac268fe8f3257fa7$var$LINK_NAME = 'ToolbarLink';
|
|
114
|
+
const $ac268fe8f3257fa7$export$ff5714eba66809fd = /*#__PURE__*/ $ds9gm$react.forwardRef((props, forwardedRef)=>{
|
|
115
|
+
const { __scopeToolbar: __scopeToolbar , ...linkProps } = props;
|
|
116
|
+
const rovingFocusGroupScope = $ac268fe8f3257fa7$var$useRovingFocusGroupScope(__scopeToolbar);
|
|
117
|
+
return /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireactrovingfocus.Item, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({
|
|
118
|
+
asChild: true
|
|
119
|
+
}, rovingFocusGroupScope, {
|
|
120
|
+
focusable: true
|
|
121
|
+
}), /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireactprimitive.Primitive.a, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({}, linkProps, {
|
|
122
|
+
ref: forwardedRef,
|
|
123
|
+
onKeyDown: $ds9gm$radixuiprimitive.composeEventHandlers(props.onKeyDown, (event)=>{
|
|
124
|
+
if (event.key === ' ') event.currentTarget.click();
|
|
125
|
+
})
|
|
126
|
+
})));
|
|
127
|
+
});
|
|
128
|
+
/*#__PURE__*/ Object.assign($ac268fe8f3257fa7$export$ff5714eba66809fd, {
|
|
129
|
+
displayName: $ac268fe8f3257fa7$var$LINK_NAME
|
|
130
|
+
});
|
|
131
|
+
/* -------------------------------------------------------------------------------------------------
|
|
132
|
+
* ToolbarToggleGroup
|
|
133
|
+
* -----------------------------------------------------------------------------------------------*/ const $ac268fe8f3257fa7$var$TOGGLE_GROUP_NAME = 'ToolbarToggleGroup';
|
|
134
|
+
const $ac268fe8f3257fa7$export$aeae28cb17562c0b = /*#__PURE__*/ $ds9gm$react.forwardRef((props, forwardedRef)=>{
|
|
135
|
+
const { __scopeToolbar: __scopeToolbar , ...toggleGroupProps } = props;
|
|
136
|
+
const context = $ac268fe8f3257fa7$var$useToolbarContext($ac268fe8f3257fa7$var$TOGGLE_GROUP_NAME, __scopeToolbar);
|
|
137
|
+
const toggleGroupScope = $ac268fe8f3257fa7$var$useToggleGroupScope(__scopeToolbar);
|
|
138
|
+
return /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireacttogglegroup.Root, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({
|
|
139
|
+
"data-orientation": context.orientation,
|
|
140
|
+
dir: context.dir
|
|
141
|
+
}, toggleGroupScope, toggleGroupProps, {
|
|
142
|
+
ref: forwardedRef,
|
|
143
|
+
rovingFocus: false
|
|
144
|
+
}));
|
|
145
|
+
});
|
|
146
|
+
/*#__PURE__*/ Object.assign($ac268fe8f3257fa7$export$aeae28cb17562c0b, {
|
|
147
|
+
displayName: $ac268fe8f3257fa7$var$TOGGLE_GROUP_NAME
|
|
148
|
+
});
|
|
149
|
+
/* -------------------------------------------------------------------------------------------------
|
|
150
|
+
* ToolbarToggleItem
|
|
151
|
+
* -----------------------------------------------------------------------------------------------*/ const $ac268fe8f3257fa7$var$TOGGLE_ITEM_NAME = 'ToolbarToggleItem';
|
|
152
|
+
const $ac268fe8f3257fa7$export$546b879b639844a1 = /*#__PURE__*/ $ds9gm$react.forwardRef((props, forwardedRef)=>{
|
|
153
|
+
const { __scopeToolbar: __scopeToolbar , ...toggleItemProps } = props;
|
|
154
|
+
const toggleGroupScope = $ac268fe8f3257fa7$var$useToggleGroupScope(__scopeToolbar);
|
|
155
|
+
return /*#__PURE__*/ $ds9gm$react.createElement($ac268fe8f3257fa7$export$e5c1a33878e86e9e, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({
|
|
156
|
+
asChild: true
|
|
157
|
+
}, props), /*#__PURE__*/ $ds9gm$react.createElement($ds9gm$radixuireacttogglegroup.Item, ($parcel$interopDefault($ds9gm$babelruntimehelpersextends))({}, toggleGroupScope, toggleItemProps, {
|
|
158
|
+
ref: forwardedRef
|
|
159
|
+
})));
|
|
160
|
+
});
|
|
161
|
+
/*#__PURE__*/ Object.assign($ac268fe8f3257fa7$export$546b879b639844a1, {
|
|
162
|
+
displayName: $ac268fe8f3257fa7$var$TOGGLE_ITEM_NAME
|
|
163
|
+
});
|
|
164
|
+
/* ---------------------------------------------------------------------------------------------- */ const $ac268fe8f3257fa7$export$be92b6f5f03c0fe9 = $ac268fe8f3257fa7$export$4c260019440d418f;
|
|
165
|
+
const $ac268fe8f3257fa7$export$1ff3c3f08ae963c0 = $ac268fe8f3257fa7$export$291e1a31e8ec7868;
|
|
166
|
+
const $ac268fe8f3257fa7$export$353f5b6fc5456de1 = $ac268fe8f3257fa7$export$e5c1a33878e86e9e;
|
|
167
|
+
const $ac268fe8f3257fa7$export$a6c7ac8248d6e38a = $ac268fe8f3257fa7$export$ff5714eba66809fd;
|
|
168
|
+
const $ac268fe8f3257fa7$export$af3ec21f6cfb5e30 = $ac268fe8f3257fa7$export$aeae28cb17562c0b;
|
|
169
|
+
const $ac268fe8f3257fa7$export$920ad4cf87b18fc7 = $ac268fe8f3257fa7$export$546b879b639844a1;
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
2
174
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"IAAgCA,icAAAA,8CAClBA,EAAEC,WAAaD,EAAEE,QAAUF,EAWzC,SAASG,EAAuBC,EAAMC,GAcpC,OAbAC,OAAOC,KAAKF,GAAQG,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeN,EAAMK,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOP,EAAOI,SAKbL,ECRT,MAGOS,EAAsBC,GAAsBC,EAH9B,UAG+D,CAClFC,EACAC,iCAEF,MAAMC,EAA2BF,IAC3BG,EAAsBF,KAOrBG,EAAiBC,GACtBR,EAhBmB,WA0BfS,eAAUC,EAAMC,YACpB,CAACC,EAAkCC,KACjC,MAAMC,eAAEA,EAAFC,YAAkBA,EAAc,aAAhCC,IAA8CA,EA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EACLkC,UAAWC,EAAqBpC,EAAMmC,WAAYE,IAC9B,MAAdA,EAAMrD,KAAaqD,EAAMC,cAAcC,wCAcvD,MAOMC,eAAqB1C,EAAMC,YAI/B,CACEC,EACAC,KAEA,MAAMC,eAAEA,KAAmBuC,GAAqBzC,EAC1CwB,EAAU5B,EAhBM,qBAgB+BM,GAC/CwC,EAAmBhD,EAAoBQ,gBAC7C,OACEQ,EAAAC,cAACgC,EAAqB5B,KAAtBC,EAAA,CACE,mBAAkBQ,EAAQrB,YAC1BC,IAAKoB,EAAQpB,KACTsC,EACAD,EAJN,CAKEpB,IAAKpB,EACL2C,aAAa,qCAYrB,MAMMC,eAAoB/C,EAAMC,YAC9B,CAACC,EAA4CC,KAC3C,MAAMC,eAAEA,KAAmB4C,GAAoB9C,EACzC0C,EAAmBhD,EAAoBQ,gBAC7C,OACEQ,EAAAC,cAACe,EAADV,EAAA,CAAeC,SAAO,GAAKjB,gBACzBU,EAAAC,cAACgC,EAAqBf,KAAtBZ,EAAA,GAA+B0B,EAAsBI,EAArD,CAAsEzB,IAAKpB,qCAUnF,MAAMc,EAAOlB,iBACb,MAAMkD,EAAYzB,sBAClB,MAAM0B,EAAStB,mBACf,MAAMuB,EAAOhB,iBACb,MAAMiB,EAAcV,wBACpB,MAAMW,EAAaN","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/toolbar/src/Toolbar.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\nimport { createToggleGroupScope } from '@radix-ui/react-toggle-group';\nimport { useDirection } from '@radix-ui/react-direction';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Toolbar\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOOLBAR_NAME = 'Toolbar';\n\ntype ScopedProps<P> = P & { __scopeToolbar?: Scope };\nconst [createToolbarContext, createToolbarScope] = createContextScope(TOOLBAR_NAME, [\n createRovingFocusGroupScope,\n createToggleGroupScope,\n]);\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useToggleGroupScope = createToggleGroupScope();\n\ntype RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;\ntype ToolbarContextValue = {\n orientation: RovingFocusGroupProps['orientation'];\n dir: RovingFocusGroupProps['dir'];\n};\nconst [ToolbarProvider, useToolbarContext] =\n createToolbarContext<ToolbarContextValue>(TOOLBAR_NAME);\n\ntype ToolbarElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface ToolbarProps extends PrimitiveDivProps {\n orientation?: RovingFocusGroupProps['orientation'];\n loop?: RovingFocusGroupProps['loop'];\n dir?: RovingFocusGroupProps['dir'];\n}\n\nconst Toolbar = React.forwardRef<ToolbarElement, ToolbarProps>(\n (props: ScopedProps<ToolbarProps>, forwardedRef) => {\n const { __scopeToolbar, orientation = 'horizontal', dir, loop = true, ...toolbarProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n const direction = useDirection(dir);\n return (\n <ToolbarProvider scope={__scopeToolbar} orientation={orientation} dir={direction}>\n <RovingFocusGroup.Root\n asChild\n {...rovingFocusGroupScope}\n orientation={orientation}\n dir={direction}\n loop={loop}\n >\n <Primitive.div\n role=\"toolbar\"\n aria-orientation={orientation}\n dir={direction}\n {...toolbarProps}\n ref={forwardedRef}\n />\n </RovingFocusGroup.Root>\n </ToolbarProvider>\n );\n }\n);\n\nToolbar.displayName = TOOLBAR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ToolbarSeparator';\n\ntype ToolbarSeparatorElement = React.ElementRef<typeof SeparatorPrimitive.Root>;\ntype SeparatorProps = Radix.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>;\ninterface ToolbarSeparatorProps extends SeparatorProps {}\n\nconst ToolbarSeparator = React.forwardRef<ToolbarSeparatorElement, ToolbarSeparatorProps>(\n (props: ScopedProps<ToolbarSeparatorProps>, forwardedRef) => {\n const { __scopeToolbar, ...separatorProps } = props;\n const context = useToolbarContext(SEPARATOR_NAME, __scopeToolbar);\n return (\n <SeparatorPrimitive.Root\n orientation={context.orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n {...separatorProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nToolbarSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUTTON_NAME = 'ToolbarButton';\n\ntype ToolbarButtonElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface ToolbarButtonProps extends PrimitiveButtonProps {}\n\nconst ToolbarButton = React.forwardRef<ToolbarButtonElement, ToolbarButtonProps>(\n (props: ScopedProps<ToolbarButtonProps>, forwardedRef) => {\n const { __scopeToolbar, ...buttonProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable={!props.disabled}>\n <Primitive.button type=\"button\" {...buttonProps} ref={forwardedRef} />\n </RovingFocusGroup.Item>\n );\n }\n);\n\nToolbarButton.displayName = BUTTON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarLink\n * -----------------------------------------------------------------------------------------------*/\n\nconst LINK_NAME = 'ToolbarLink';\n\ntype ToolbarLinkElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface ToolbarLinkProps extends PrimitiveLinkProps {}\n\nconst ToolbarLink = React.forwardRef<ToolbarLinkElement, ToolbarLinkProps>(\n (props: ScopedProps<ToolbarLinkProps>, forwardedRef) => {\n const { __scopeToolbar, ...linkProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable>\n <Primitive.a\n {...linkProps}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === ' ') event.currentTarget.click();\n })}\n />\n </RovingFocusGroup.Item>\n );\n }\n);\n\nToolbarLink.displayName = LINK_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_GROUP_NAME = 'ToolbarToggleGroup';\n\ntype ToolbarToggleGroupElement = React.ElementRef<typeof ToggleGroupPrimitive.Root>;\ntype ToggleGroupProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>;\ninterface ToolbarToggleGroupSingleProps extends Extract<ToggleGroupProps, { type: 'single' }> {}\ninterface ToolbarToggleGroupMultipleProps extends Extract<ToggleGroupProps, { type: 'multiple' }> {}\n\nconst ToolbarToggleGroup = React.forwardRef<\n ToolbarToggleGroupElement,\n ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps\n>(\n (\n props: ScopedProps<ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps>,\n forwardedRef\n ) => {\n const { __scopeToolbar, ...toggleGroupProps } = props;\n const context = useToolbarContext(TOGGLE_GROUP_NAME, __scopeToolbar);\n const toggleGroupScope = useToggleGroupScope(__scopeToolbar);\n return (\n <ToggleGroupPrimitive.Root\n data-orientation={context.orientation}\n dir={context.dir}\n {...toggleGroupScope}\n {...toggleGroupProps}\n ref={forwardedRef}\n rovingFocus={false}\n />\n );\n }\n);\n\nToolbarToggleGroup.displayName = TOGGLE_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_ITEM_NAME = 'ToolbarToggleItem';\n\ntype ToolbarToggleItemElement = React.ElementRef<typeof ToggleGroupPrimitive.Item>;\ntype ToggleGroupItemProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>;\ninterface ToolbarToggleItemProps extends ToggleGroupItemProps {}\n\nconst ToolbarToggleItem = React.forwardRef<ToolbarToggleItemElement, ToolbarToggleItemProps>(\n (props: ScopedProps<ToolbarToggleItemProps>, forwardedRef) => {\n const { __scopeToolbar, ...toggleItemProps } = props;\n const toggleGroupScope = useToggleGroupScope(__scopeToolbar);\n return (\n <ToolbarButton asChild {...props}>\n <ToggleGroupPrimitive.Item {...toggleGroupScope} {...toggleItemProps} ref={forwardedRef} />\n </ToolbarButton>\n );\n }\n);\n\nToolbarToggleItem.displayName = TOGGLE_ITEM_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst Root = Toolbar;\nconst Separator = ToolbarSeparator;\nconst Button = ToolbarButton;\nconst Link = ToolbarLink;\nconst ToggleGroup = ToolbarToggleGroup;\nconst ToggleItem = ToolbarToggleItem;\n\nexport {\n createToolbarScope,\n //\n Toolbar,\n ToolbarSeparator,\n ToolbarButton,\n ToolbarLink,\n ToolbarToggleGroup,\n ToolbarToggleItem,\n //\n Root,\n Separator,\n Button,\n Link,\n ToggleGroup,\n ToggleItem,\n};\nexport type {\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarButtonProps,\n ToolbarLinkProps,\n ToolbarToggleGroupSingleProps,\n ToolbarToggleGroupMultipleProps,\n ToolbarToggleItemProps,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","createToolbarContext","createToolbarScope","createContextScope","createRovingFocusGroupScope","createToggleGroupScope","useRovingFocusGroupScope","useToggleGroupScope","ToolbarProvider","useToolbarContext","Toolbar","React","forwardRef","props","forwardedRef","__scopeToolbar","orientation","dir","loop","toolbarProps","rovingFocusGroupScope","direction","useDirection","_react","createElement","$ad2966449eadd63e15eb1cd256d5fc2$var$ToolbarProvider","scope","_radixUiReactRovingFocus","Root","_babelRuntimeHelpersExtends","asChild","Primitive","div","role","ref","ToolbarSeparator","separatorProps","context","_radixUiReactSeparator","ToolbarButton","buttonProps","Item","focusable","disabled","button","type","ToolbarLink","linkProps","onKeyDown","composeEventHandlers","event","currentTarget","click","ToolbarToggleGroup","toggleGroupProps","toggleGroupScope","_radixUiReactToggleGroup","rovingFocus","ToolbarToggleItem","toggleItemProps","Separator","Button","Link","ToggleGroup","ToggleItem"],"version":3,"file":"index.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;ACcA;;oGAEA,CAEA,MAAMuB,kCAAY,GAAG,SAArB,AAAA;AAGA,MAAM,CAACC,0CAAD,EAAuBxB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,CAAA,CADF,CADF,CAEI;CANkB,CAA1B,AASG;AAGH,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,WAAA,EAAA,sCAAA;CAAA,CAAA,CAAA;AAEA,oGAAA,CAEA,MAAMxB,yCAAI,GAAGN,yCAAb,AAAA;AACA,MAAMO,yCAAS,GAAGN,yCAAlB,AAAA;AACA,MAAMO,yCAAM,GAAGN,yCAAf,AAAA;AACA,MAAMO,yCAAI,GAAGN,yCAAb,AAAA;AACA,MAAMO,yCAAW,GAAGN,yCAApB,AAAA;AACA,MAAMO,yCAAU,GAAGN,yCAAnB,AAAA;;AD7NA","sources":["packages/react/toolbar/src/index.ts","packages/react/toolbar/src/Toolbar.tsx"],"sourcesContent":["export {\n createToolbarScope,\n //\n Toolbar,\n ToolbarSeparator,\n ToolbarButton,\n ToolbarLink,\n ToolbarToggleGroup,\n ToolbarToggleItem,\n //\n Root,\n Separator,\n Button,\n Link,\n ToggleGroup,\n ToggleItem,\n} from './Toolbar';\nexport type {\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarButtonProps,\n ToolbarLinkProps,\n ToolbarToggleGroupSingleProps,\n ToolbarToggleGroupMultipleProps,\n ToolbarToggleItemProps,\n} from './Toolbar';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\nimport { createToggleGroupScope } from '@radix-ui/react-toggle-group';\nimport { useDirection } from '@radix-ui/react-direction';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Toolbar\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOOLBAR_NAME = 'Toolbar';\n\ntype ScopedProps<P> = P & { __scopeToolbar?: Scope };\nconst [createToolbarContext, createToolbarScope] = createContextScope(TOOLBAR_NAME, [\n createRovingFocusGroupScope,\n createToggleGroupScope,\n]);\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useToggleGroupScope = createToggleGroupScope();\n\ntype RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;\ntype ToolbarContextValue = {\n orientation: RovingFocusGroupProps['orientation'];\n dir: RovingFocusGroupProps['dir'];\n};\nconst [ToolbarProvider, useToolbarContext] =\n createToolbarContext<ToolbarContextValue>(TOOLBAR_NAME);\n\ntype ToolbarElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface ToolbarProps extends PrimitiveDivProps {\n orientation?: RovingFocusGroupProps['orientation'];\n loop?: RovingFocusGroupProps['loop'];\n dir?: RovingFocusGroupProps['dir'];\n}\n\nconst Toolbar = React.forwardRef<ToolbarElement, ToolbarProps>(\n (props: ScopedProps<ToolbarProps>, forwardedRef) => {\n const { __scopeToolbar, orientation = 'horizontal', dir, loop = true, ...toolbarProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n const direction = useDirection(dir);\n return (\n <ToolbarProvider scope={__scopeToolbar} orientation={orientation} dir={direction}>\n <RovingFocusGroup.Root\n asChild\n {...rovingFocusGroupScope}\n orientation={orientation}\n dir={direction}\n loop={loop}\n >\n <Primitive.div\n role=\"toolbar\"\n aria-orientation={orientation}\n dir={direction}\n {...toolbarProps}\n ref={forwardedRef}\n />\n </RovingFocusGroup.Root>\n </ToolbarProvider>\n );\n }\n);\n\nToolbar.displayName = TOOLBAR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ToolbarSeparator';\n\ntype ToolbarSeparatorElement = React.ElementRef<typeof SeparatorPrimitive.Root>;\ntype SeparatorProps = Radix.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>;\ninterface ToolbarSeparatorProps extends SeparatorProps {}\n\nconst ToolbarSeparator = React.forwardRef<ToolbarSeparatorElement, ToolbarSeparatorProps>(\n (props: ScopedProps<ToolbarSeparatorProps>, forwardedRef) => {\n const { __scopeToolbar, ...separatorProps } = props;\n const context = useToolbarContext(SEPARATOR_NAME, __scopeToolbar);\n return (\n <SeparatorPrimitive.Root\n orientation={context.orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n {...separatorProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nToolbarSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUTTON_NAME = 'ToolbarButton';\n\ntype ToolbarButtonElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface ToolbarButtonProps extends PrimitiveButtonProps {}\n\nconst ToolbarButton = React.forwardRef<ToolbarButtonElement, ToolbarButtonProps>(\n (props: ScopedProps<ToolbarButtonProps>, forwardedRef) => {\n const { __scopeToolbar, ...buttonProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable={!props.disabled}>\n <Primitive.button type=\"button\" {...buttonProps} ref={forwardedRef} />\n </RovingFocusGroup.Item>\n );\n }\n);\n\nToolbarButton.displayName = BUTTON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarLink\n * -----------------------------------------------------------------------------------------------*/\n\nconst LINK_NAME = 'ToolbarLink';\n\ntype ToolbarLinkElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface ToolbarLinkProps extends PrimitiveLinkProps {}\n\nconst ToolbarLink = React.forwardRef<ToolbarLinkElement, ToolbarLinkProps>(\n (props: ScopedProps<ToolbarLinkProps>, forwardedRef) => {\n const { __scopeToolbar, ...linkProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable>\n <Primitive.a\n {...linkProps}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === ' ') event.currentTarget.click();\n })}\n />\n </RovingFocusGroup.Item>\n );\n }\n);\n\nToolbarLink.displayName = LINK_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_GROUP_NAME = 'ToolbarToggleGroup';\n\ntype ToolbarToggleGroupElement = React.ElementRef<typeof ToggleGroupPrimitive.Root>;\ntype ToggleGroupProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>;\ninterface ToolbarToggleGroupSingleProps extends Extract<ToggleGroupProps, { type: 'single' }> {}\ninterface ToolbarToggleGroupMultipleProps extends Extract<ToggleGroupProps, { type: 'multiple' }> {}\n\nconst ToolbarToggleGroup = React.forwardRef<\n ToolbarToggleGroupElement,\n ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps\n>(\n (\n props: ScopedProps<ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps>,\n forwardedRef\n ) => {\n const { __scopeToolbar, ...toggleGroupProps } = props;\n const context = useToolbarContext(TOGGLE_GROUP_NAME, __scopeToolbar);\n const toggleGroupScope = useToggleGroupScope(__scopeToolbar);\n return (\n <ToggleGroupPrimitive.Root\n data-orientation={context.orientation}\n dir={context.dir}\n {...toggleGroupScope}\n {...toggleGroupProps}\n ref={forwardedRef}\n rovingFocus={false}\n />\n );\n }\n);\n\nToolbarToggleGroup.displayName = TOGGLE_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_ITEM_NAME = 'ToolbarToggleItem';\n\ntype ToolbarToggleItemElement = React.ElementRef<typeof ToggleGroupPrimitive.Item>;\ntype ToggleGroupItemProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>;\ninterface ToolbarToggleItemProps extends ToggleGroupItemProps {}\n\nconst ToolbarToggleItem = React.forwardRef<ToolbarToggleItemElement, ToolbarToggleItemProps>(\n (props: ScopedProps<ToolbarToggleItemProps>, forwardedRef) => {\n const { __scopeToolbar, ...toggleItemProps } = props;\n const toggleGroupScope = useToggleGroupScope(__scopeToolbar);\n return (\n <ToolbarButton asChild {...props}>\n <ToggleGroupPrimitive.Item {...toggleGroupScope} {...toggleItemProps} ref={forwardedRef} />\n </ToolbarButton>\n );\n }\n);\n\nToolbarToggleItem.displayName = TOGGLE_ITEM_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst Root = Toolbar;\nconst Separator = ToolbarSeparator;\nconst Button = ToolbarButton;\nconst Link = ToolbarLink;\nconst ToggleGroup = ToolbarToggleGroup;\nconst ToggleItem = ToolbarToggleItem;\n\nexport {\n createToolbarScope,\n //\n Toolbar,\n ToolbarSeparator,\n ToolbarButton,\n ToolbarLink,\n ToolbarToggleGroup,\n ToolbarToggleItem,\n //\n Root,\n Separator,\n Button,\n Link,\n ToggleGroup,\n ToggleItem,\n};\nexport type {\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarButtonProps,\n ToolbarLinkProps,\n ToolbarToggleGroupSingleProps,\n ToolbarToggleGroupMultipleProps,\n ToolbarToggleItemProps,\n};\n"],"names":["createToolbarScope","Toolbar","ToolbarSeparator","ToolbarButton","ToolbarLink","ToolbarToggleGroup","ToolbarToggleItem","Root","Separator","Button","Link","ToggleGroup","ToggleItem","React","composeEventHandlers","createContextScope","RovingFocusGroup","createRovingFocusGroupScope","Primitive","SeparatorPrimitive","ToggleGroupPrimitive","createToggleGroupScope","useDirection","TOOLBAR_NAME","createToolbarContext","useRovingFocusGroupScope","useToggleGroupScope","ToolbarProvider","useToolbarContext","forwardRef","props","forwardedRef","__scopeToolbar","orientation","dir","loop","toolbarProps","rovingFocusGroupScope","direction","SEPARATOR_NAME","separatorProps","context","BUTTON_NAME","buttonProps","disabled","LINK_NAME","linkProps","onKeyDown","event","key","currentTarget","click","TOGGLE_GROUP_NAME","toggleGroupProps","toggleGroupScope","TOGGLE_ITEM_NAME","toggleItemProps"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,155 @@
|
|
|
1
|
-
import
|
|
1
|
+
import $72MJ6$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import {forwardRef as $72MJ6$forwardRef, createElement as $72MJ6$createElement} from "react";
|
|
3
|
+
import {composeEventHandlers as $72MJ6$composeEventHandlers} from "@radix-ui/primitive";
|
|
4
|
+
import {createContextScope as $72MJ6$createContextScope} from "@radix-ui/react-context";
|
|
5
|
+
import {createRovingFocusGroupScope as $72MJ6$createRovingFocusGroupScope, Root as $72MJ6$Root, Item as $72MJ6$Item} from "@radix-ui/react-roving-focus";
|
|
6
|
+
import {Primitive as $72MJ6$Primitive} from "@radix-ui/react-primitive";
|
|
7
|
+
import {Root as $72MJ6$Root1} from "@radix-ui/react-separator";
|
|
8
|
+
import {createToggleGroupScope as $72MJ6$createToggleGroupScope, Root as $72MJ6$Root2, Item as $72MJ6$Item1} from "@radix-ui/react-toggle-group";
|
|
9
|
+
import {useDirection as $72MJ6$useDirection} from "@radix-ui/react-direction";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/* -------------------------------------------------------------------------------------------------
|
|
23
|
+
* Toolbar
|
|
24
|
+
* -----------------------------------------------------------------------------------------------*/ const $3dc4ded751c8bdfb$var$TOOLBAR_NAME = 'Toolbar';
|
|
25
|
+
const [$3dc4ded751c8bdfb$var$createToolbarContext, $3dc4ded751c8bdfb$export$233e637670877d91] = $72MJ6$createContextScope($3dc4ded751c8bdfb$var$TOOLBAR_NAME, [
|
|
26
|
+
$72MJ6$createRovingFocusGroupScope,
|
|
27
|
+
$72MJ6$createToggleGroupScope
|
|
28
|
+
]);
|
|
29
|
+
const $3dc4ded751c8bdfb$var$useRovingFocusGroupScope = $72MJ6$createRovingFocusGroupScope();
|
|
30
|
+
const $3dc4ded751c8bdfb$var$useToggleGroupScope = $72MJ6$createToggleGroupScope();
|
|
31
|
+
const [$3dc4ded751c8bdfb$var$ToolbarProvider, $3dc4ded751c8bdfb$var$useToolbarContext] = $3dc4ded751c8bdfb$var$createToolbarContext($3dc4ded751c8bdfb$var$TOOLBAR_NAME);
|
|
32
|
+
const $3dc4ded751c8bdfb$export$4c260019440d418f = /*#__PURE__*/ $72MJ6$forwardRef((props, forwardedRef)=>{
|
|
33
|
+
const { __scopeToolbar: __scopeToolbar , orientation: orientation = 'horizontal' , dir: dir , loop: loop = true , ...toolbarProps } = props;
|
|
34
|
+
const rovingFocusGroupScope = $3dc4ded751c8bdfb$var$useRovingFocusGroupScope(__scopeToolbar);
|
|
35
|
+
const direction = $72MJ6$useDirection(dir);
|
|
36
|
+
return /*#__PURE__*/ $72MJ6$createElement($3dc4ded751c8bdfb$var$ToolbarProvider, {
|
|
37
|
+
scope: __scopeToolbar,
|
|
38
|
+
orientation: orientation,
|
|
39
|
+
dir: direction
|
|
40
|
+
}, /*#__PURE__*/ $72MJ6$createElement($72MJ6$Root, $72MJ6$babelruntimehelpersesmextends({
|
|
41
|
+
asChild: true
|
|
42
|
+
}, rovingFocusGroupScope, {
|
|
43
|
+
orientation: orientation,
|
|
44
|
+
dir: direction,
|
|
45
|
+
loop: loop
|
|
46
|
+
}), /*#__PURE__*/ $72MJ6$createElement($72MJ6$Primitive.div, $72MJ6$babelruntimehelpersesmextends({
|
|
47
|
+
role: "toolbar",
|
|
48
|
+
"aria-orientation": orientation,
|
|
49
|
+
dir: direction
|
|
50
|
+
}, toolbarProps, {
|
|
51
|
+
ref: forwardedRef
|
|
52
|
+
}))));
|
|
53
|
+
});
|
|
54
|
+
/*#__PURE__*/ Object.assign($3dc4ded751c8bdfb$export$4c260019440d418f, {
|
|
55
|
+
displayName: $3dc4ded751c8bdfb$var$TOOLBAR_NAME
|
|
56
|
+
});
|
|
57
|
+
/* -------------------------------------------------------------------------------------------------
|
|
58
|
+
* ToolbarSeparator
|
|
59
|
+
* -----------------------------------------------------------------------------------------------*/ const $3dc4ded751c8bdfb$var$SEPARATOR_NAME = 'ToolbarSeparator';
|
|
60
|
+
const $3dc4ded751c8bdfb$export$291e1a31e8ec7868 = /*#__PURE__*/ $72MJ6$forwardRef((props, forwardedRef)=>{
|
|
61
|
+
const { __scopeToolbar: __scopeToolbar , ...separatorProps } = props;
|
|
62
|
+
const context = $3dc4ded751c8bdfb$var$useToolbarContext($3dc4ded751c8bdfb$var$SEPARATOR_NAME, __scopeToolbar);
|
|
63
|
+
return /*#__PURE__*/ $72MJ6$createElement($72MJ6$Root1, $72MJ6$babelruntimehelpersesmextends({
|
|
64
|
+
orientation: context.orientation === 'horizontal' ? 'vertical' : 'horizontal'
|
|
65
|
+
}, separatorProps, {
|
|
66
|
+
ref: forwardedRef
|
|
67
|
+
}));
|
|
68
|
+
});
|
|
69
|
+
/*#__PURE__*/ Object.assign($3dc4ded751c8bdfb$export$291e1a31e8ec7868, {
|
|
70
|
+
displayName: $3dc4ded751c8bdfb$var$SEPARATOR_NAME
|
|
71
|
+
});
|
|
72
|
+
/* -------------------------------------------------------------------------------------------------
|
|
73
|
+
* ToolbarButton
|
|
74
|
+
* -----------------------------------------------------------------------------------------------*/ const $3dc4ded751c8bdfb$var$BUTTON_NAME = 'ToolbarButton';
|
|
75
|
+
const $3dc4ded751c8bdfb$export$e5c1a33878e86e9e = /*#__PURE__*/ $72MJ6$forwardRef((props, forwardedRef)=>{
|
|
76
|
+
const { __scopeToolbar: __scopeToolbar , ...buttonProps } = props;
|
|
77
|
+
const rovingFocusGroupScope = $3dc4ded751c8bdfb$var$useRovingFocusGroupScope(__scopeToolbar);
|
|
78
|
+
return /*#__PURE__*/ $72MJ6$createElement($72MJ6$Item, $72MJ6$babelruntimehelpersesmextends({
|
|
79
|
+
asChild: true
|
|
80
|
+
}, rovingFocusGroupScope, {
|
|
81
|
+
focusable: !props.disabled
|
|
82
|
+
}), /*#__PURE__*/ $72MJ6$createElement($72MJ6$Primitive.button, $72MJ6$babelruntimehelpersesmextends({
|
|
83
|
+
type: "button"
|
|
84
|
+
}, buttonProps, {
|
|
85
|
+
ref: forwardedRef
|
|
86
|
+
})));
|
|
87
|
+
});
|
|
88
|
+
/*#__PURE__*/ Object.assign($3dc4ded751c8bdfb$export$e5c1a33878e86e9e, {
|
|
89
|
+
displayName: $3dc4ded751c8bdfb$var$BUTTON_NAME
|
|
90
|
+
});
|
|
91
|
+
/* -------------------------------------------------------------------------------------------------
|
|
92
|
+
* ToolbarLink
|
|
93
|
+
* -----------------------------------------------------------------------------------------------*/ const $3dc4ded751c8bdfb$var$LINK_NAME = 'ToolbarLink';
|
|
94
|
+
const $3dc4ded751c8bdfb$export$ff5714eba66809fd = /*#__PURE__*/ $72MJ6$forwardRef((props, forwardedRef)=>{
|
|
95
|
+
const { __scopeToolbar: __scopeToolbar , ...linkProps } = props;
|
|
96
|
+
const rovingFocusGroupScope = $3dc4ded751c8bdfb$var$useRovingFocusGroupScope(__scopeToolbar);
|
|
97
|
+
return /*#__PURE__*/ $72MJ6$createElement($72MJ6$Item, $72MJ6$babelruntimehelpersesmextends({
|
|
98
|
+
asChild: true
|
|
99
|
+
}, rovingFocusGroupScope, {
|
|
100
|
+
focusable: true
|
|
101
|
+
}), /*#__PURE__*/ $72MJ6$createElement($72MJ6$Primitive.a, $72MJ6$babelruntimehelpersesmextends({}, linkProps, {
|
|
102
|
+
ref: forwardedRef,
|
|
103
|
+
onKeyDown: $72MJ6$composeEventHandlers(props.onKeyDown, (event)=>{
|
|
104
|
+
if (event.key === ' ') event.currentTarget.click();
|
|
105
|
+
})
|
|
106
|
+
})));
|
|
107
|
+
});
|
|
108
|
+
/*#__PURE__*/ Object.assign($3dc4ded751c8bdfb$export$ff5714eba66809fd, {
|
|
109
|
+
displayName: $3dc4ded751c8bdfb$var$LINK_NAME
|
|
110
|
+
});
|
|
111
|
+
/* -------------------------------------------------------------------------------------------------
|
|
112
|
+
* ToolbarToggleGroup
|
|
113
|
+
* -----------------------------------------------------------------------------------------------*/ const $3dc4ded751c8bdfb$var$TOGGLE_GROUP_NAME = 'ToolbarToggleGroup';
|
|
114
|
+
const $3dc4ded751c8bdfb$export$aeae28cb17562c0b = /*#__PURE__*/ $72MJ6$forwardRef((props, forwardedRef)=>{
|
|
115
|
+
const { __scopeToolbar: __scopeToolbar , ...toggleGroupProps } = props;
|
|
116
|
+
const context = $3dc4ded751c8bdfb$var$useToolbarContext($3dc4ded751c8bdfb$var$TOGGLE_GROUP_NAME, __scopeToolbar);
|
|
117
|
+
const toggleGroupScope = $3dc4ded751c8bdfb$var$useToggleGroupScope(__scopeToolbar);
|
|
118
|
+
return /*#__PURE__*/ $72MJ6$createElement($72MJ6$Root2, $72MJ6$babelruntimehelpersesmextends({
|
|
119
|
+
"data-orientation": context.orientation,
|
|
120
|
+
dir: context.dir
|
|
121
|
+
}, toggleGroupScope, toggleGroupProps, {
|
|
122
|
+
ref: forwardedRef,
|
|
123
|
+
rovingFocus: false
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
126
|
+
/*#__PURE__*/ Object.assign($3dc4ded751c8bdfb$export$aeae28cb17562c0b, {
|
|
127
|
+
displayName: $3dc4ded751c8bdfb$var$TOGGLE_GROUP_NAME
|
|
128
|
+
});
|
|
129
|
+
/* -------------------------------------------------------------------------------------------------
|
|
130
|
+
* ToolbarToggleItem
|
|
131
|
+
* -----------------------------------------------------------------------------------------------*/ const $3dc4ded751c8bdfb$var$TOGGLE_ITEM_NAME = 'ToolbarToggleItem';
|
|
132
|
+
const $3dc4ded751c8bdfb$export$546b879b639844a1 = /*#__PURE__*/ $72MJ6$forwardRef((props, forwardedRef)=>{
|
|
133
|
+
const { __scopeToolbar: __scopeToolbar , ...toggleItemProps } = props;
|
|
134
|
+
const toggleGroupScope = $3dc4ded751c8bdfb$var$useToggleGroupScope(__scopeToolbar);
|
|
135
|
+
return /*#__PURE__*/ $72MJ6$createElement($3dc4ded751c8bdfb$export$e5c1a33878e86e9e, $72MJ6$babelruntimehelpersesmextends({
|
|
136
|
+
asChild: true
|
|
137
|
+
}, props), /*#__PURE__*/ $72MJ6$createElement($72MJ6$Item1, $72MJ6$babelruntimehelpersesmextends({}, toggleGroupScope, toggleItemProps, {
|
|
138
|
+
ref: forwardedRef
|
|
139
|
+
})));
|
|
140
|
+
});
|
|
141
|
+
/*#__PURE__*/ Object.assign($3dc4ded751c8bdfb$export$546b879b639844a1, {
|
|
142
|
+
displayName: $3dc4ded751c8bdfb$var$TOGGLE_ITEM_NAME
|
|
143
|
+
});
|
|
144
|
+
/* ---------------------------------------------------------------------------------------------- */ const $3dc4ded751c8bdfb$export$be92b6f5f03c0fe9 = $3dc4ded751c8bdfb$export$4c260019440d418f;
|
|
145
|
+
const $3dc4ded751c8bdfb$export$1ff3c3f08ae963c0 = $3dc4ded751c8bdfb$export$291e1a31e8ec7868;
|
|
146
|
+
const $3dc4ded751c8bdfb$export$353f5b6fc5456de1 = $3dc4ded751c8bdfb$export$e5c1a33878e86e9e;
|
|
147
|
+
const $3dc4ded751c8bdfb$export$a6c7ac8248d6e38a = $3dc4ded751c8bdfb$export$ff5714eba66809fd;
|
|
148
|
+
const $3dc4ded751c8bdfb$export$af3ec21f6cfb5e30 = $3dc4ded751c8bdfb$export$aeae28cb17562c0b;
|
|
149
|
+
const $3dc4ded751c8bdfb$export$920ad4cf87b18fc7 = $3dc4ded751c8bdfb$export$546b879b639844a1;
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
export {$3dc4ded751c8bdfb$export$233e637670877d91 as createToolbarScope, $3dc4ded751c8bdfb$export$4c260019440d418f as Toolbar, $3dc4ded751c8bdfb$export$291e1a31e8ec7868 as ToolbarSeparator, $3dc4ded751c8bdfb$export$e5c1a33878e86e9e as ToolbarButton, $3dc4ded751c8bdfb$export$ff5714eba66809fd as ToolbarLink, $3dc4ded751c8bdfb$export$aeae28cb17562c0b as ToolbarToggleGroup, $3dc4ded751c8bdfb$export$546b879b639844a1 as ToolbarToggleItem, $3dc4ded751c8bdfb$export$be92b6f5f03c0fe9 as Root, $3dc4ded751c8bdfb$export$1ff3c3f08ae963c0 as Separator, $3dc4ded751c8bdfb$export$353f5b6fc5456de1 as Button, $3dc4ded751c8bdfb$export$a6c7ac8248d6e38a as Link, $3dc4ded751c8bdfb$export$af3ec21f6cfb5e30 as ToggleGroup, $3dc4ded751c8bdfb$export$920ad4cf87b18fc7 as ToggleItem};
|
|
2
155
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"4kBAkBA,MAGOA,EAAsBC,GAAsBC,EAH9B,UAG+D,CAClFC,EACAC,oCAEF,MAAMC,EAA2BF,IAC3BG,EAAsBF,KAOrBG,EAAiBC,GACtBR,EAhBmB,kBA0BrB,MAAMS,qBAAUC,EAAMC,YACpB,CAACC,EAAkCC,KACjC,MAAMC,eAAEA,EAAFC,YAAkBA,EAAc,aAAhCC,IAA8CA,EAA9CC,KAAmDA,GAAO,KAASC,GAAiBN,EACpFO,EAAwBd,EAAyBS,GACjDM,EAAYC,EAAaL,gBAC/B,OACEM,EAAAC,cAACC,EAAD,CAAiBC,MAAOX,EAAgBC,YAAaA,EAAaC,IAAKI,gBACrEE,EAAAC,cAACG,EAAiBC,KAAlBC,EAAA,CACEC,SAAO,GACHV,EAFN,CAGEJ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,EAAoBQ,gBAC7C,OACEQ,EAAAC,cAACkC,EAAqB9B,KAAtBC,EAAA,CACE,mBAAkBQ,EAAQrB,YAC1BC,IAAKoB,EAAQpB,KACTwC,EACAD,EAJN,CAKEtB,IAAKpB,EACL6C,aAAa,4BAkBrB,MAAMC,+BAAoBjD,EAAMC,YAC9B,CAACC,EAA4CC,KAC3C,MAAMC,eAAEA,KAAmB8C,GAAoBhD,EACzC4C,EAAmBlD,EAAoBQ,gBAC7C,OACEQ,EAAAC,cAACe,cAADV,EAAA,CAAeC,SAAO,GAAKjB,gBACzBU,EAAAC,cAACkC,EAAqBjB,KAAtBZ,EAAA,GAA+B4B,EAAsBI,EAArD,CAAsE3B,IAAKpB,6BAUnF,MAAMc,KAAOlB,eACb,MAAMoD,UAAY3B,wBAClB,MAAM4B,OAASxB,qBACf,MAAMyB,KAAOlB,mBACb,MAAMmB,YAAcV,0BACpB,MAAMW,WAAaN","sources":["./packages/react/toolbar/src/Toolbar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\nimport { createToggleGroupScope } from '@radix-ui/react-toggle-group';\nimport { useDirection } from '@radix-ui/react-direction';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Toolbar\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOOLBAR_NAME = 'Toolbar';\n\ntype ScopedProps<P> = P & { __scopeToolbar?: Scope };\nconst [createToolbarContext, createToolbarScope] = createContextScope(TOOLBAR_NAME, [\n createRovingFocusGroupScope,\n createToggleGroupScope,\n]);\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useToggleGroupScope = createToggleGroupScope();\n\ntype RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;\ntype ToolbarContextValue = {\n orientation: RovingFocusGroupProps['orientation'];\n dir: RovingFocusGroupProps['dir'];\n};\nconst [ToolbarProvider, useToolbarContext] =\n createToolbarContext<ToolbarContextValue>(TOOLBAR_NAME);\n\ntype ToolbarElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface ToolbarProps extends PrimitiveDivProps {\n orientation?: RovingFocusGroupProps['orientation'];\n loop?: RovingFocusGroupProps['loop'];\n dir?: RovingFocusGroupProps['dir'];\n}\n\nconst Toolbar = React.forwardRef<ToolbarElement, ToolbarProps>(\n (props: ScopedProps<ToolbarProps>, forwardedRef) => {\n const { __scopeToolbar, orientation = 'horizontal', dir, loop = true, ...toolbarProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n const direction = useDirection(dir);\n return (\n <ToolbarProvider scope={__scopeToolbar} orientation={orientation} dir={direction}>\n <RovingFocusGroup.Root\n asChild\n {...rovingFocusGroupScope}\n orientation={orientation}\n dir={direction}\n loop={loop}\n >\n <Primitive.div\n role=\"toolbar\"\n aria-orientation={orientation}\n dir={direction}\n {...toolbarProps}\n ref={forwardedRef}\n />\n </RovingFocusGroup.Root>\n </ToolbarProvider>\n );\n }\n);\n\nToolbar.displayName = TOOLBAR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ToolbarSeparator';\n\ntype ToolbarSeparatorElement = React.ElementRef<typeof SeparatorPrimitive.Root>;\ntype SeparatorProps = Radix.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>;\ninterface ToolbarSeparatorProps extends SeparatorProps {}\n\nconst ToolbarSeparator = React.forwardRef<ToolbarSeparatorElement, ToolbarSeparatorProps>(\n (props: ScopedProps<ToolbarSeparatorProps>, forwardedRef) => {\n const { __scopeToolbar, ...separatorProps } = props;\n const context = useToolbarContext(SEPARATOR_NAME, __scopeToolbar);\n return (\n <SeparatorPrimitive.Root\n orientation={context.orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n {...separatorProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nToolbarSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUTTON_NAME = 'ToolbarButton';\n\ntype ToolbarButtonElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface ToolbarButtonProps extends PrimitiveButtonProps {}\n\nconst ToolbarButton = React.forwardRef<ToolbarButtonElement, ToolbarButtonProps>(\n (props: ScopedProps<ToolbarButtonProps>, forwardedRef) => {\n const { __scopeToolbar, ...buttonProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable={!props.disabled}>\n <Primitive.button type=\"button\" {...buttonProps} ref={forwardedRef} />\n </RovingFocusGroup.Item>\n );\n }\n);\n\nToolbarButton.displayName = BUTTON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarLink\n * -----------------------------------------------------------------------------------------------*/\n\nconst LINK_NAME = 'ToolbarLink';\n\ntype ToolbarLinkElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface ToolbarLinkProps extends PrimitiveLinkProps {}\n\nconst ToolbarLink = React.forwardRef<ToolbarLinkElement, ToolbarLinkProps>(\n (props: ScopedProps<ToolbarLinkProps>, forwardedRef) => {\n const { __scopeToolbar, ...linkProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable>\n <Primitive.a\n {...linkProps}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === ' ') event.currentTarget.click();\n })}\n />\n </RovingFocusGroup.Item>\n );\n }\n);\n\nToolbarLink.displayName = LINK_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_GROUP_NAME = 'ToolbarToggleGroup';\n\ntype ToolbarToggleGroupElement = React.ElementRef<typeof ToggleGroupPrimitive.Root>;\ntype ToggleGroupProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>;\ninterface ToolbarToggleGroupSingleProps extends Extract<ToggleGroupProps, { type: 'single' }> {}\ninterface ToolbarToggleGroupMultipleProps extends Extract<ToggleGroupProps, { type: 'multiple' }> {}\n\nconst ToolbarToggleGroup = React.forwardRef<\n ToolbarToggleGroupElement,\n ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps\n>(\n (\n props: ScopedProps<ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps>,\n forwardedRef\n ) => {\n const { __scopeToolbar, ...toggleGroupProps } = props;\n const context = useToolbarContext(TOGGLE_GROUP_NAME, __scopeToolbar);\n const toggleGroupScope = useToggleGroupScope(__scopeToolbar);\n return (\n <ToggleGroupPrimitive.Root\n data-orientation={context.orientation}\n dir={context.dir}\n {...toggleGroupScope}\n {...toggleGroupProps}\n ref={forwardedRef}\n rovingFocus={false}\n />\n );\n }\n);\n\nToolbarToggleGroup.displayName = TOGGLE_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_ITEM_NAME = 'ToolbarToggleItem';\n\ntype ToolbarToggleItemElement = React.ElementRef<typeof ToggleGroupPrimitive.Item>;\ntype ToggleGroupItemProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>;\ninterface ToolbarToggleItemProps extends ToggleGroupItemProps {}\n\nconst ToolbarToggleItem = React.forwardRef<ToolbarToggleItemElement, ToolbarToggleItemProps>(\n (props: ScopedProps<ToolbarToggleItemProps>, forwardedRef) => {\n const { __scopeToolbar, ...toggleItemProps } = props;\n const toggleGroupScope = useToggleGroupScope(__scopeToolbar);\n return (\n <ToolbarButton asChild {...props}>\n <ToggleGroupPrimitive.Item {...toggleGroupScope} {...toggleItemProps} ref={forwardedRef} />\n </ToolbarButton>\n );\n }\n);\n\nToolbarToggleItem.displayName = TOGGLE_ITEM_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst Root = Toolbar;\nconst Separator = ToolbarSeparator;\nconst Button = ToolbarButton;\nconst Link = ToolbarLink;\nconst ToggleGroup = ToolbarToggleGroup;\nconst ToggleItem = ToolbarToggleItem;\n\nexport {\n createToolbarScope,\n //\n Toolbar,\n ToolbarSeparator,\n ToolbarButton,\n ToolbarLink,\n ToolbarToggleGroup,\n ToolbarToggleItem,\n //\n Root,\n Separator,\n Button,\n Link,\n ToggleGroup,\n ToggleItem,\n};\nexport type {\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarButtonProps,\n ToolbarLinkProps,\n ToolbarToggleGroupSingleProps,\n ToolbarToggleGroupMultipleProps,\n ToolbarToggleItemProps,\n};\n"],"names":["createToolbarContext","createToolbarScope","createContextScope","createRovingFocusGroupScope","createToggleGroupScope","useRovingFocusGroupScope","useToggleGroupScope","ToolbarProvider","useToolbarContext","Toolbar","React","forwardRef","props","forwardedRef","__scopeToolbar","orientation","dir","loop","toolbarProps","rovingFocusGroupScope","direction","useDirection","_react","createElement","$ad9457c173723bf8dc92def88a055d79$var$ToolbarProvider","scope","_radixUiReactRovingFocus","Root","_babelRuntimeHelpersEsmExtends","asChild","Primitive","div","role","ref","ToolbarSeparator","separatorProps","context","_radixUiReactSeparator","ToolbarButton","buttonProps","Item","focusable","disabled","button","type","ToolbarLink","linkProps","a","onKeyDown","composeEventHandlers","event","key","currentTarget","click","ToolbarToggleGroup","toggleGroupProps","toggleGroupScope","_radixUiReactToggleGroup","rovingFocus","ToolbarToggleItem","toggleItemProps","Separator","Button","Link","ToggleGroup","ToggleItem"],"version":3,"file":"index.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;A;;;;;;;;;;;ACcA;;oGAEA,CAEA,MAAMuB,kCAAY,GAAG,SAArB,AAAA;AAGA,MAAM,CAACC,0CAAD,EAAuBxB,yCAAvB,CAAA,GAA6Ce,yBAAkB,CAACQ,kCAAD,EAAe;IAClFN,kCADkF;IAElFI,6BAFkF;CAAf,CAArE,AAAA;AAIA,MAAMI,8CAAwB,GAAGR,kCAA2B,EAA5D,AAAA;AACA,MAAMS,yCAAmB,GAAGL,6BAAsB,EAAlD,AAAA;AAOA,MAAM,CAACM,qCAAD,EAAkBC,uCAAlB,CAAA,GACJJ,0CAAoB,CAAsBD,kCAAtB,CADtB,AAAA;AAWA,MAAMtB,yCAAO,GAAA,aAAGY,CAAAA,iBAAA,CACd,CAACiB,KAAD,EAAmCC,YAAnC,GAAoD;IAClD,MAAM,E,gBAAEC,cAAF,CAAA,eAAkBC,WAAW,GAAG,YAAhC,G,KAA8CC,GAA9C,CAAA,QAAmDC,IAAI,GAAG,IAA1D,GAAgE,GAAGC,YAAH,EAAhE,GAAoFN,KAA1F,AAAM;IACN,MAAMO,qBAAqB,GAAGZ,8CAAwB,CAACO,cAAD,CAAtD,AAAA;IACA,MAAMM,SAAS,GAAGhB,mBAAY,CAACY,GAAD,CAA9B,AAAA;IACA,OAAA,aACE,CAAA,oBAAA,CAAC,qCAAD,EADF;QACmB,KAAK,EAAEF,cAAxB;QAAwC,WAAW,EAAEC,WAArD;QAAkE,GAAG,EAAEK,SAAL;KAAlE,EAAA,aACE,CAAA,oBAAA,CAAC,WAAD,EADF,oCAAA,CAAA;QAEI,OAAO,EAAP,IAAA;KADF,EAEMD,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,GAAyC1B,KAA/C,AAAM;IACN,MAAMwB,gBAAgB,GAAG5B,yCAAmB,CAACM,cAAD,CAA5C,AAAA;IACA,OAAA,aACE,CAAA,oBAAA,CAAC,yCAAD,EADF,oCAAA,CAAA;QACiB,OAAO,EAAP,IAAA;KAAf,EAA2BF,KAA3B,CAAA,EAAA,aACE,CAAA,oBAAA,CAAC,YAAD,EAAA,oCAAA,CAAA,EAAA,EAA+BwB,gBAA/B,EAAqDE,eAArD,EADF;QACwE,GAAG,EAAEzB,YAAL;KAAtE,CAAA,CADF,CADF,CAEI;CANkB,CAA1B,AASG;AAGH,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,WAAA,EAAA,sCAAA;CAAA,CAAA,CAAA;AAEA,oGAAA,CAEA,MAAMxB,yCAAI,GAAGN,yCAAb,AAAA;AACA,MAAMO,yCAAS,GAAGN,yCAAlB,AAAA;AACA,MAAMO,yCAAM,GAAGN,yCAAf,AAAA;AACA,MAAMO,yCAAI,GAAGN,yCAAb,AAAA;AACA,MAAMO,yCAAW,GAAGN,yCAApB,AAAA;AACA,MAAMO,yCAAU,GAAGN,yCAAnB,AAAA;;AD7NA","sources":["packages/react/toolbar/src/index.ts","packages/react/toolbar/src/Toolbar.tsx"],"sourcesContent":["export {\n createToolbarScope,\n //\n Toolbar,\n ToolbarSeparator,\n ToolbarButton,\n ToolbarLink,\n ToolbarToggleGroup,\n ToolbarToggleItem,\n //\n Root,\n Separator,\n Button,\n Link,\n ToggleGroup,\n ToggleItem,\n} from './Toolbar';\nexport type {\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarButtonProps,\n ToolbarLinkProps,\n ToolbarToggleGroupSingleProps,\n ToolbarToggleGroupMultipleProps,\n ToolbarToggleItemProps,\n} from './Toolbar';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\nimport { createToggleGroupScope } from '@radix-ui/react-toggle-group';\nimport { useDirection } from '@radix-ui/react-direction';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Toolbar\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOOLBAR_NAME = 'Toolbar';\n\ntype ScopedProps<P> = P & { __scopeToolbar?: Scope };\nconst [createToolbarContext, createToolbarScope] = createContextScope(TOOLBAR_NAME, [\n createRovingFocusGroupScope,\n createToggleGroupScope,\n]);\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useToggleGroupScope = createToggleGroupScope();\n\ntype RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;\ntype ToolbarContextValue = {\n orientation: RovingFocusGroupProps['orientation'];\n dir: RovingFocusGroupProps['dir'];\n};\nconst [ToolbarProvider, useToolbarContext] =\n createToolbarContext<ToolbarContextValue>(TOOLBAR_NAME);\n\ntype ToolbarElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface ToolbarProps extends PrimitiveDivProps {\n orientation?: RovingFocusGroupProps['orientation'];\n loop?: RovingFocusGroupProps['loop'];\n dir?: RovingFocusGroupProps['dir'];\n}\n\nconst Toolbar = React.forwardRef<ToolbarElement, ToolbarProps>(\n (props: ScopedProps<ToolbarProps>, forwardedRef) => {\n const { __scopeToolbar, orientation = 'horizontal', dir, loop = true, ...toolbarProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n const direction = useDirection(dir);\n return (\n <ToolbarProvider scope={__scopeToolbar} orientation={orientation} dir={direction}>\n <RovingFocusGroup.Root\n asChild\n {...rovingFocusGroupScope}\n orientation={orientation}\n dir={direction}\n loop={loop}\n >\n <Primitive.div\n role=\"toolbar\"\n aria-orientation={orientation}\n dir={direction}\n {...toolbarProps}\n ref={forwardedRef}\n />\n </RovingFocusGroup.Root>\n </ToolbarProvider>\n );\n }\n);\n\nToolbar.displayName = TOOLBAR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ToolbarSeparator';\n\ntype ToolbarSeparatorElement = React.ElementRef<typeof SeparatorPrimitive.Root>;\ntype SeparatorProps = Radix.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>;\ninterface ToolbarSeparatorProps extends SeparatorProps {}\n\nconst ToolbarSeparator = React.forwardRef<ToolbarSeparatorElement, ToolbarSeparatorProps>(\n (props: ScopedProps<ToolbarSeparatorProps>, forwardedRef) => {\n const { __scopeToolbar, ...separatorProps } = props;\n const context = useToolbarContext(SEPARATOR_NAME, __scopeToolbar);\n return (\n <SeparatorPrimitive.Root\n orientation={context.orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n {...separatorProps}\n ref={forwardedRef}\n />\n );\n }\n);\n\nToolbarSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUTTON_NAME = 'ToolbarButton';\n\ntype ToolbarButtonElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface ToolbarButtonProps extends PrimitiveButtonProps {}\n\nconst ToolbarButton = React.forwardRef<ToolbarButtonElement, ToolbarButtonProps>(\n (props: ScopedProps<ToolbarButtonProps>, forwardedRef) => {\n const { __scopeToolbar, ...buttonProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable={!props.disabled}>\n <Primitive.button type=\"button\" {...buttonProps} ref={forwardedRef} />\n </RovingFocusGroup.Item>\n );\n }\n);\n\nToolbarButton.displayName = BUTTON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarLink\n * -----------------------------------------------------------------------------------------------*/\n\nconst LINK_NAME = 'ToolbarLink';\n\ntype ToolbarLinkElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface ToolbarLinkProps extends PrimitiveLinkProps {}\n\nconst ToolbarLink = React.forwardRef<ToolbarLinkElement, ToolbarLinkProps>(\n (props: ScopedProps<ToolbarLinkProps>, forwardedRef) => {\n const { __scopeToolbar, ...linkProps } = props;\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToolbar);\n return (\n <RovingFocusGroup.Item asChild {...rovingFocusGroupScope} focusable>\n <Primitive.a\n {...linkProps}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === ' ') event.currentTarget.click();\n })}\n />\n </RovingFocusGroup.Item>\n );\n }\n);\n\nToolbarLink.displayName = LINK_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_GROUP_NAME = 'ToolbarToggleGroup';\n\ntype ToolbarToggleGroupElement = React.ElementRef<typeof ToggleGroupPrimitive.Root>;\ntype ToggleGroupProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>;\ninterface ToolbarToggleGroupSingleProps extends Extract<ToggleGroupProps, { type: 'single' }> {}\ninterface ToolbarToggleGroupMultipleProps extends Extract<ToggleGroupProps, { type: 'multiple' }> {}\n\nconst ToolbarToggleGroup = React.forwardRef<\n ToolbarToggleGroupElement,\n ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps\n>(\n (\n props: ScopedProps<ToolbarToggleGroupSingleProps | ToolbarToggleGroupMultipleProps>,\n forwardedRef\n ) => {\n const { __scopeToolbar, ...toggleGroupProps } = props;\n const context = useToolbarContext(TOGGLE_GROUP_NAME, __scopeToolbar);\n const toggleGroupScope = useToggleGroupScope(__scopeToolbar);\n return (\n <ToggleGroupPrimitive.Root\n data-orientation={context.orientation}\n dir={context.dir}\n {...toggleGroupScope}\n {...toggleGroupProps}\n ref={forwardedRef}\n rovingFocus={false}\n />\n );\n }\n);\n\nToolbarToggleGroup.displayName = TOGGLE_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_ITEM_NAME = 'ToolbarToggleItem';\n\ntype ToolbarToggleItemElement = React.ElementRef<typeof ToggleGroupPrimitive.Item>;\ntype ToggleGroupItemProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>;\ninterface ToolbarToggleItemProps extends ToggleGroupItemProps {}\n\nconst ToolbarToggleItem = React.forwardRef<ToolbarToggleItemElement, ToolbarToggleItemProps>(\n (props: ScopedProps<ToolbarToggleItemProps>, forwardedRef) => {\n const { __scopeToolbar, ...toggleItemProps } = props;\n const toggleGroupScope = useToggleGroupScope(__scopeToolbar);\n return (\n <ToolbarButton asChild {...props}>\n <ToggleGroupPrimitive.Item {...toggleGroupScope} {...toggleItemProps} ref={forwardedRef} />\n </ToolbarButton>\n );\n }\n);\n\nToolbarToggleItem.displayName = TOGGLE_ITEM_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst Root = Toolbar;\nconst Separator = ToolbarSeparator;\nconst Button = ToolbarButton;\nconst Link = ToolbarLink;\nconst ToggleGroup = ToolbarToggleGroup;\nconst ToggleItem = ToolbarToggleItem;\n\nexport {\n createToolbarScope,\n //\n Toolbar,\n ToolbarSeparator,\n ToolbarButton,\n ToolbarLink,\n ToolbarToggleGroup,\n ToolbarToggleItem,\n //\n Root,\n Separator,\n Button,\n Link,\n ToggleGroup,\n ToggleItem,\n};\nexport type {\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarButtonProps,\n ToolbarLinkProps,\n ToolbarToggleGroupSingleProps,\n ToolbarToggleGroupMultipleProps,\n ToolbarToggleItemProps,\n};\n"],"names":["createToolbarScope","Toolbar","ToolbarSeparator","ToolbarButton","ToolbarLink","ToolbarToggleGroup","ToolbarToggleItem","Root","Separator","Button","Link","ToggleGroup","ToggleItem","React","composeEventHandlers","createContextScope","RovingFocusGroup","createRovingFocusGroupScope","Primitive","SeparatorPrimitive","ToggleGroupPrimitive","createToggleGroupScope","useDirection","TOOLBAR_NAME","createToolbarContext","useRovingFocusGroupScope","useToggleGroupScope","ToolbarProvider","useToolbarContext","forwardRef","props","forwardedRef","__scopeToolbar","orientation","dir","loop","toolbarProps","rovingFocusGroupScope","direction","SEPARATOR_NAME","separatorProps","context","BUTTON_NAME","buttonProps","disabled","LINK_NAME","linkProps","onKeyDown","event","key","currentTarget","click","TOGGLE_GROUP_NAME","toggleGroupProps","toggleGroupScope","TOGGLE_ITEM_NAME","toggleItemProps"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-toolbar",
|
|
3
|
-
"version": "0.1.6-rc.
|
|
3
|
+
"version": "0.1.6-rc.50",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,16 +17,17 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.13.10",
|
|
20
|
-
"@radix-ui/primitive": "0.1.
|
|
21
|
-
"@radix-ui/react-context": "0.1.2-rc.
|
|
22
|
-
"@radix-ui/react-direction": "0.1.0-rc.
|
|
23
|
-
"@radix-ui/react-primitive": "0.1.5-rc.
|
|
24
|
-
"@radix-ui/react-roving-focus": "0.1.6-rc.
|
|
25
|
-
"@radix-ui/react-separator": "0.1.5-rc.
|
|
26
|
-
"@radix-ui/react-toggle-group": "0.1.6-rc.
|
|
20
|
+
"@radix-ui/primitive": "0.1.1-rc.7",
|
|
21
|
+
"@radix-ui/react-context": "0.1.2-rc.47",
|
|
22
|
+
"@radix-ui/react-direction": "0.1.0-rc.50",
|
|
23
|
+
"@radix-ui/react-primitive": "0.1.5-rc.47",
|
|
24
|
+
"@radix-ui/react-roving-focus": "0.1.6-rc.50",
|
|
25
|
+
"@radix-ui/react-separator": "0.1.5-rc.47",
|
|
26
|
+
"@radix-ui/react-toggle-group": "0.1.6-rc.50"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"react": "^16.8 || ^17.0 || ^18.0"
|
|
29
|
+
"react": "^16.8 || ^17.0 || ^18.0",
|
|
30
|
+
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
30
31
|
},
|
|
31
32
|
"homepage": "https://radix-ui.com/primitives",
|
|
32
33
|
"repository": {
|