@radix-ui/react-toolbar 0.0.13 → 0.1.0
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 +44 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +6 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,48 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { RovingFocusGroup } from "@radix-ui/react-roving-focus";
|
|
3
|
+
import * as Radix from "@radix-ui/react-primitive";
|
|
4
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
2
5
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
3
6
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export const
|
|
20
|
-
type
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
type RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup>;
|
|
8
|
+
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
9
|
+
export interface ToolbarProps extends PrimitiveDivProps {
|
|
10
|
+
orientation?: RovingFocusGroupProps['orientation'];
|
|
11
|
+
loop?: RovingFocusGroupProps['loop'];
|
|
12
|
+
dir?: RovingFocusGroupProps['dir'];
|
|
13
|
+
}
|
|
14
|
+
export const Toolbar: React.ForwardRefExoticComponent<ToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
type SeparatorProps = Radix.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>;
|
|
16
|
+
export interface ToolbarSeparatorProps extends SeparatorProps {
|
|
17
|
+
}
|
|
18
|
+
export const ToolbarSeparator: React.ForwardRefExoticComponent<ToolbarSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
20
|
+
export interface ToolbarButtonProps extends PrimitiveButtonProps {
|
|
21
|
+
}
|
|
22
|
+
export const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
type PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;
|
|
24
|
+
export interface ToolbarLinkProps extends PrimitiveLinkProps {
|
|
25
|
+
}
|
|
26
|
+
export const ToolbarLink: React.ForwardRefExoticComponent<ToolbarLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
27
|
+
type ToggleGroupProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>;
|
|
28
|
+
export interface ToolbarToggleGroupSingleProps extends Extract<ToggleGroupProps, {
|
|
29
|
+
type: 'single';
|
|
30
|
+
}> {
|
|
31
|
+
}
|
|
32
|
+
export interface ToolbarToggleGroupMultipleProps extends Extract<ToggleGroupProps, {
|
|
33
|
+
type: 'multiple';
|
|
34
|
+
}> {
|
|
35
|
+
}
|
|
36
|
+
export const ToolbarToggleGroup: React.ForwardRefExoticComponent<(ToolbarToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>) | (ToolbarToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>)>;
|
|
37
|
+
type ToggleGroupItemProps = Radix.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>;
|
|
38
|
+
export interface ToolbarToggleItemProps extends ToggleGroupItemProps {
|
|
39
|
+
}
|
|
40
|
+
export const ToolbarToggleItem: React.ForwardRefExoticComponent<ToolbarToggleItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
export const Root: React.ForwardRefExoticComponent<ToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
export const Separator: React.ForwardRefExoticComponent<ToolbarSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
export const Button: React.ForwardRefExoticComponent<ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
44
|
+
export const Link: React.ForwardRefExoticComponent<ToolbarLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
45
|
+
export const ToggleGroup: React.ForwardRefExoticComponent<(ToolbarToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>) | (ToolbarToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>)>;
|
|
46
|
+
export const ToggleItem: React.ForwardRefExoticComponent<ToolbarToggleItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
32
47
|
|
|
33
48
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"A;A;A;A;
|
|
1
|
+
{"mappings":"A;A;A;A;A;A;AAgBA,6BAA6B,MAAM,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;AAKrF,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,6BAAuB,SAAQ,iBAAiB;IAC9C,WAAW,CAAC,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACrC,GAAG,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;CACpC;AAED,OAAA,MAAM,4FASJ,CAAC;AASH,sBAAsB,MAAM,wBAAwB,CAAC,OAAO,mBAAmB,IAAI,CAAC,CAAC;AACrF,sCAAgC,SAAQ,cAAc;CAAG;AAEzD,OAAA,MAAM,8GAWL,CAAC;AAWF,4BAA4B,MAAM,wBAAwB,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC;AACpF,mCAA6B,SAAQ,oBAAoB;CAAG;AAE5D,OAAA,MAAM,2GAML,CAAC;AAWF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAC7E,iCAA2B,SAAQ,kBAAkB;CAAG;AAExD,OAAA,MAAM,uGAaL,CAAC;AAWF,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,qBAAqB,IAAI,CAAC,CAAC;AACzF,8CAAwC,SAAQ,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;CAAG;AAChG,gDAA0C,SAAQ,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;CAAG;AAEpG,OAAA,MAAM,oMAaJ,CAAC;AAWH,4BAA4B,MAAM,wBAAwB,CAAC,OAAO,qBAAqB,IAAI,CAAC,CAAC;AAC7F,uCAAiC,SAAQ,oBAAoB;CAAG;AAEhE,OAAA,MAAM,mHAML,CAAC;AAMF,OAAA,MAAM,yFAAc,CAAC;AACrB,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,oGAAsB,CAAC;AAC7B,OAAA,MAAM,gGAAkB,CAAC;AACzB,OAAA,MAAM,6LAAgC,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"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,r=
|
|
1
|
+
var e,r=d({},require("@radix-ui/react-toggle-group")),o=d({},require("@radix-ui/react-separator")),t=require("@radix-ui/react-primitive").Primitive,a=require("@radix-ui/react-roving-focus"),n=a.RovingFocusGroup,i=a.RovingFocusItem,l=require("@radix-ui/react-context").createContext,c=require("@radix-ui/primitive").composeEventHandlers,s=d({},require("react")),u=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function d(e,r){return Object.keys(r).forEach((function(o){"default"!==o&&"__esModule"!==o&&Object.defineProperty(e,o,{enumerable:!0,get:function(){return r[o]}})})),e}const[f,p]=l("Toolbar"),b=/*#__PURE__*/s.forwardRef(((e,r)=>{const{orientation:o="horizontal",dir:a="ltr",loop:i=!0,...l}=e;/*#__PURE__*/return s.createElement(f,{orientation:o},/*#__PURE__*/s.createElement(n,{asChild:!0,orientation:o,dir:a,loop:i},/*#__PURE__*/s.createElement(t.div,u({role:"toolbar",dir:a},l,{ref:r}))))}));exports.Toolbar=b;const m=/*#__PURE__*/s.forwardRef(((e,r)=>{const t=p("ToolbarSeparator");/*#__PURE__*/return s.createElement(o.Root,u({orientation:"horizontal"===t.orientation?"vertical":"horizontal"},e,{ref:r}))}));exports.ToolbarSeparator=m;const x=/*#__PURE__*/s.forwardRef(((e,r)=>/*#__PURE__*/s.createElement(i,{asChild:!0,focusable:!e.disabled},/*#__PURE__*/s.createElement(t.button,u({role:"toolbaritem"},e,{ref:r})))));exports.ToolbarButton=x;const g=/*#__PURE__*/s.forwardRef(((e,r)=>/*#__PURE__*/s.createElement(i,{asChild:!0,focusable:!0},/*#__PURE__*/s.createElement(t.a,u({role:"toolbaritem"},e,{ref:r,onKeyDown:c(e.onKeyDown,(e=>{" "===e.key&&e.currentTarget.click()}))})))));exports.ToolbarLink=g;const T=/*#__PURE__*/s.forwardRef(((e,o)=>{const t=p("ToolbarToggleGroup");/*#__PURE__*/return s.createElement(r.Root,u({"data-orientation":t.orientation},e,{ref:o,rovingFocus:!1}))}));exports.ToolbarToggleGroup=T;const E=/*#__PURE__*/s.forwardRef(((e,o)=>/*#__PURE__*/s.createElement(x,{asChild:!0,disabled:e.disabled},/*#__PURE__*/s.createElement(r.Item,u({},e,{ref:o})))));exports.ToolbarToggleItem=E;const v=b;exports.Root=v;const R=m;exports.Separator=R;const h=x;exports.Button=h;const q=g;exports.Link=q;const w=T;exports.ToggleGroup=w;const k=E;exports.ToggleItem=k;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"IAAgCA,8VAAAA,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,ECZT,MACMS,EAAsB,OAYrBC,EAAiBC,GAAqBC,EAbxB,WAefC,eAAUC,EAAMC,YAAW,CAACC,EAAOC,KACvC,MAAMC,GACJA,EAAKT,EADDU,YAEJA,EAAc,aAFVC,IAGJA,EAAM,MAHFC,KAIJA,GAAO,KACJC,GACDN,eAEJ,OACEO,EAAAC,cAACC,EAAD,CAAiBN,YAAaA,gBAC5BI,EAAAC,cAACE,EAADC,EAAA,CACEC,KAAK,UACLT,YAAaA,EACbC,IAAKA,EACLC,KAAMA,GACFC,EALN,CAMEJ,GAAIA,EACJW,IAAKZ,2BAUb,MAQMa,eAAmBhB,EAAMC,YAAW,CAACC,EAAOC,KAChD,MAAMc,EAAUpB,EATK,iCAWrB,OACEY,EAAAC,cAACQ,EAAmBC,KAApBN,EAAA,CACER,YAAqC,eAAxBY,EAAQZ,YAA+B,WAAa,cAC7DH,EAFN,CAGEa,IAAKZ,mCAWX,MACMiB,EAAqB,SAYrBC,eAAgBrB,EAAMC,YAAW,CAACC,EAAOC,KAC7C,MAAMC,GAAEA,EAAKgB,KAAuBE,GAAgBpB,eACpD,OACEO,EAAAC,cAACa,EAADV,EAAA,CACEC,KAAK,cACLU,WAAYtB,EAAMuB,UACdH,EAHN,CAIElB,GAAIA,EACJW,IAAKZ,gCAWX,MACMuB,EAAmB,IAQnBC,eAAc3B,EAAMC,YAAW,CAACC,EAAOC,KAC3C,MAAMC,GAAEA,EAAKsB,KAAqBE,GAAc1B,eAChD,OACEO,EAAAC,cAACW,EAADR,EAAA,GACMe,EADN,CAEExB,GAAIA,EACJW,IAAKZ,EACL0B,UAAWC,EAAqBF,EAAUC,WAAYE,IAClC,MAAdA,EAAMxC,KACRwC,EAAMC,cAAcC,uCAa9B,MAQMC,eAAqBlC,EAAMC,YAAW,CAACC,EAAOC,KAClD,MAAMc,EAAUpB,EATQ,mCAUxB,OACEY,EAAAC,cAACyB,EAAqBhB,KAAtBN,EAAA,CACEuB,mBAAkBnB,EAAQZ,aACtBH,EAFN,CAGEa,IAAKZ,EACLkC,aAAa,qCAWnB,MAWMC,eAAoBtC,EAAMC,YAAW,CAACC,EAAOC,iBACjDM,EAAAC,cAACW,EAAD,CAAejB,GAAImC,gBACjB9B,EAAAC,cAACyB,EAAqBK,KAAtB3B,EAAA,GAA+BX,EAA/B,CAAsCa,IAAKZ,oCAQ/C,MAAMgB,EAAOpB,iBACb,MAAM0C,EAAYzB,sBAClB,MAAM0B,EAASrB,mBACf,MAAMsB,EAAOhB,iBACb,MAAMiB,EAAcV,wBACpB,MAAMW,EAAaP","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 { createContext } from '@radix-ui/react-context';\nimport { RovingFocusGroup, RovingFocusItem } from '@radix-ui/react-roving-focus';\nimport { Slot } from '@radix-ui/react-slot';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\n\nimport type * as Polymorphic from '@radix-ui/react-polymorphic';\n\n/* -------------------------------------------------------------------------------------------------\n * Toolbar\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOOLBAR_NAME = 'Toolbar';\nconst TOOLBAR_DEFAULT_TAG = 'div';\n\ntype ToolbarOwnProps = Omit<\n Polymorphic.OwnProps<typeof RovingFocusGroup>,\n 'currentTabStopId' | 'defaultCurrentTabStopId' | 'onCurrentTabStopIdChange' | 'onEntryFocus'\n>;\ntype ToolbarPrimitive = Polymorphic.ForwardRefComponent<\n typeof TOOLBAR_DEFAULT_TAG,\n ToolbarOwnProps\n>;\n\ntype ToolbarContextValue = { orientation: ToolbarOwnProps['orientation'] };\nconst [ToolbarProvider, useToolbarContext] = createContext<ToolbarContextValue>(TOOLBAR_NAME);\n\nconst Toolbar = React.forwardRef((props, forwardedRef) => {\n const {\n as = TOOLBAR_DEFAULT_TAG,\n orientation = 'horizontal',\n dir = 'ltr',\n loop = true,\n ...toolbarProps\n } = props;\n\n return (\n <ToolbarProvider orientation={orientation}>\n <RovingFocusGroup\n role=\"toolbar\"\n orientation={orientation}\n dir={dir}\n loop={loop}\n {...toolbarProps}\n as={as}\n ref={forwardedRef}\n />\n </ToolbarProvider>\n );\n}) as ToolbarPrimitive;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ToolbarSeparator';\n\ntype ToolbarSeparatorOwnProps = Polymorphic.OwnProps<typeof SeparatorPrimitive.Root>;\ntype ToolbarSeparatorPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof SeparatorPrimitive.Root>,\n ToolbarSeparatorOwnProps\n>;\n\nconst ToolbarSeparator = React.forwardRef((props, forwardedRef) => {\n const context = useToolbarContext(SEPARATOR_NAME);\n\n return (\n <SeparatorPrimitive.Root\n orientation={context.orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n {...props}\n ref={forwardedRef}\n />\n );\n}) as ToolbarSeparatorPrimitive;\n\nToolbarSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUTTON_NAME = 'ToolbarButton';\nconst BUTTON_DEFAULT_TAG = 'button';\n\ntype ToolbarButtonOwnProps = Omit<\n Polymorphic.OwnProps<typeof RovingFocusItem>,\n 'focusable' | 'active'\n>;\n\ntype ToolbarButtonPrimitive = Polymorphic.ForwardRefComponent<\n typeof BUTTON_DEFAULT_TAG,\n ToolbarButtonOwnProps\n>;\n\nconst ToolbarButton = React.forwardRef((props, forwardedRef) => {\n const { as = BUTTON_DEFAULT_TAG, ...buttonProps } = props;\n return (\n <RovingFocusItem\n role=\"toolbaritem\"\n focusable={!props.disabled}\n {...buttonProps}\n as={as}\n ref={forwardedRef}\n />\n );\n}) as ToolbarButtonPrimitive;\n\nToolbarButton.displayName = BUTTON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarLink\n * -----------------------------------------------------------------------------------------------*/\n\nconst LINK_NAME = 'ToolbarLink';\nconst LINK_DEFAULT_TAG = 'a';\n\ntype ToolbarLinkOwnProps = Polymorphic.OwnProps<typeof ToolbarButton>;\ntype ToolbarLinkPrimitive = Polymorphic.ForwardRefComponent<\n typeof LINK_DEFAULT_TAG,\n ToolbarLinkOwnProps\n>;\n\nconst ToolbarLink = React.forwardRef((props, forwardedRef) => {\n const { as = LINK_DEFAULT_TAG, ...linkProps } = props;\n return (\n <ToolbarButton\n {...linkProps}\n as={as}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(linkProps.onKeyDown, (event) => {\n if (event.key === ' ') {\n event.currentTarget.click();\n }\n })}\n />\n );\n}) as ToolbarLinkPrimitive;\n\nToolbarLink.displayName = LINK_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_GROUP_NAME = 'ToolbarToggleGroup';\n\ntype ToolbarToggleGroupOwnProps = Polymorphic.OwnProps<typeof ToggleGroupPrimitive.Root>;\ntype ToolbarToggleGroupPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof ToggleGroupPrimitive.Root>,\n ToolbarToggleGroupOwnProps\n>;\n\nconst ToolbarToggleGroup = React.forwardRef((props, forwardedRef) => {\n const context = useToolbarContext(TOGGLE_GROUP_NAME);\n return (\n <ToggleGroupPrimitive.Root\n data-orientation={context.orientation}\n {...props}\n ref={forwardedRef}\n rovingFocus={false}\n />\n );\n}) as ToolbarToggleGroupPrimitive;\n\nToolbarToggleGroup.displayName = TOGGLE_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToolbarToggleItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOGGLE_ITEM_NAME = 'ToolbarToggleItem';\n\ntype ToolbarToggleItemOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof ToolbarButton>,\n Polymorphic.OwnProps<typeof ToggleGroupPrimitive.Item>\n>;\ntype ToolbarToggleItemPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof ToggleGroupPrimitive.Item>,\n ToolbarToggleItemOwnProps\n>;\n\nconst ToolbarToggleItem = React.forwardRef((props, forwardedRef) => (\n <ToolbarButton as={Slot}>\n <ToggleGroupPrimitive.Item {...props} ref={forwardedRef} />\n </ToolbarButton>\n)) as ToolbarToggleItemPrimitive;\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 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 ToolbarPrimitive,\n ToolbarSeparatorPrimitive,\n ToolbarButtonPrimitive,\n ToolbarLinkPrimitive,\n ToolbarToggleGroupPrimitive,\n ToolbarToggleItemPrimitive,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","TOOLBAR_DEFAULT_TAG","ToolbarProvider","useToolbarContext","createContext","Toolbar","React","forwardRef","props","forwardedRef","as","orientation","dir","loop","toolbarProps","_react","createElement","$ad2966449eadd63e15eb1cd256d5fc2$var$ToolbarProvider","RovingFocusGroup","_babelRuntimeHelpersExtends","role","ref","ToolbarSeparator","context","_radixUiReactSeparator","Root","BUTTON_DEFAULT_TAG","ToolbarButton","buttonProps","RovingFocusItem","focusable","disabled","LINK_DEFAULT_TAG","ToolbarLink","linkProps","onKeyDown","composeEventHandlers","event","currentTarget","click","ToolbarToggleGroup","_radixUiReactToggleGroup","data-orientation","rovingFocus","ToolbarToggleItem","Slot","Item","Separator","Button","Link","ToggleGroup","ToggleItem"],"version":3,"file":"index.js.map"}
|
|
1
|
+
{"mappings":"IAAgCA,wWAAAA,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,ECZT,MAIOS,EAAiBC,GAAqBC,EAJxB,WAcfC,eAAUC,EAAMC,YAAyC,CAACC,EAAOC,KACrE,MAAMC,YAAEA,EAAc,aAAhBC,IAA8BA,EAAM,MAApCC,KAA2CA,GAAO,KAASC,GAAiBL,eAClF,OACEM,EAAAC,cAACC,EAAD,CAAiBN,YAAaA,gBAC5BI,EAAAC,cAACE,EAAD,CAAkBC,SAAO,EAACR,YAAaA,EAAaC,IAAKA,EAAKC,KAAMA,gBAClEE,EAAAC,cAACI,EAAUC,IAAXC,EAAA,CAAeC,KAAK,UAAUX,IAAKA,GAASE,EAA5C,CAA0DU,IAAKd,4BAUvE,MAMMe,eAAmBlB,EAAMC,YAC7B,CAACC,EAAOC,KACN,MAAMgB,EAAUtB,EARG,iCASnB,OACEW,EAAAC,cAACW,EAAmBC,KAApBN,EAAA,CACEX,YAAqC,eAAxBe,EAAQf,YAA+B,WAAa,cAC7DF,EAFN,CAGEe,IAAKd,mCAYb,MAMMmB,eAAgBtB,EAAMC,YAC1B,CAACC,EAAOC,iBACNK,EAAAC,cAACc,EAAD,CAAiBX,SAAO,EAACY,WAAYtB,EAAMuB,uBACzCjB,EAAAC,cAACI,EAAUa,OAAXX,EAAA,CAAkBC,KAAK,eAAkBd,EAAzC,CAAgDe,IAAKd,gCAW3D,MAMMwB,eAAc3B,EAAMC,YACxB,CAACC,EAAOC,iBACNK,EAAAC,cAACc,EAAD,CAAiBX,SAAO,EAACY,WAAS,gBAChChB,EAAAC,cAACI,EAAU9B,EAAXgC,EAAA,CACEC,KAAK,eACDd,EAFN,CAGEe,IAAKd,EACLyB,UAAWC,EAAqB3B,EAAM0B,WAAYE,IAC9B,MAAdA,EAAMtC,KAAasC,EAAMC,cAAcC,uCAarD,MAOMC,eAAqBjC,EAAMC,YAG/B,CAACC,EAAOC,KACR,MAAMgB,EAAUtB,EAXQ,mCAYxB,OACEW,EAAAC,cAACyB,EAAqBb,KAAtBN,EAAA,CACE,mBAAkBI,EAAQf,aACtBF,EAFN,CAGEe,IAAKd,EACLgC,aAAa,qCAWnB,MAMMC,eAAoBpC,EAAMC,YAC9B,CAACC,EAAOC,iBACNK,EAAAC,cAACa,EAAD,CAAeV,SAAO,EAACa,SAAUvB,EAAMuB,uBACrCjB,EAAAC,cAACyB,EAAqBG,KAAtBtB,EAAA,GAA+Bb,EAA/B,CAAsCe,IAAKd,oCASjD,MAAMkB,EAAOtB,iBACb,MAAMuC,EAAYpB,sBAClB,MAAMqB,EAASjB,mBACf,MAAMkB,EAAOb,iBACb,MAAMc,EAAcR,wBACpB,MAAMS,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 { createContext } from '@radix-ui/react-context';\nimport { RovingFocusGroup, RovingFocusItem } 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';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * Toolbar\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOOLBAR_NAME = 'Toolbar';\n\ntype RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup>;\ntype ToolbarContextValue = { orientation: RovingFocusGroupProps['orientation'] };\nconst [ToolbarProvider, useToolbarContext] = createContext<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>((props, forwardedRef) => {\n const { orientation = 'horizontal', dir = 'ltr', loop = true, ...toolbarProps } = props;\n return (\n <ToolbarProvider orientation={orientation}>\n <RovingFocusGroup asChild orientation={orientation} dir={dir} loop={loop}>\n <Primitive.div role=\"toolbar\" dir={dir} {...toolbarProps} ref={forwardedRef} />\n </RovingFocusGroup>\n </ToolbarProvider>\n );\n});\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, forwardedRef) => {\n const context = useToolbarContext(SEPARATOR_NAME);\n return (\n <SeparatorPrimitive.Root\n orientation={context.orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n {...props}\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, forwardedRef) => (\n <RovingFocusItem asChild focusable={!props.disabled}>\n <Primitive.button role=\"toolbaritem\" {...props} ref={forwardedRef} />\n </RovingFocusItem>\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, forwardedRef) => (\n <RovingFocusItem asChild focusable>\n <Primitive.a\n role=\"toolbaritem\"\n {...props}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === ' ') event.currentTarget.click();\n })}\n />\n </RovingFocusItem>\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>((props, forwardedRef) => {\n const context = useToolbarContext(TOGGLE_GROUP_NAME);\n return (\n <ToggleGroupPrimitive.Root\n data-orientation={context.orientation}\n {...props}\n ref={forwardedRef}\n rovingFocus={false}\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, forwardedRef) => (\n <ToolbarButton asChild disabled={props.disabled}>\n <ToggleGroupPrimitive.Item {...props} ref={forwardedRef} />\n </ToolbarButton>\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 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","ToolbarProvider","useToolbarContext","createContext","Toolbar","React","forwardRef","props","forwardedRef","orientation","dir","loop","toolbarProps","_react","createElement","$ad2966449eadd63e15eb1cd256d5fc2$var$ToolbarProvider","RovingFocusGroup","asChild","Primitive","div","_babelRuntimeHelpersExtends","role","ref","ToolbarSeparator","context","_radixUiReactSeparator","Root","ToolbarButton","RovingFocusItem","focusable","disabled","button","ToolbarLink","onKeyDown","composeEventHandlers","event","currentTarget","click","ToolbarToggleGroup","_radixUiReactToggleGroup","rovingFocus","ToolbarToggleItem","Item","Separator","Button","Link","ToggleGroup","ToggleItem"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as o from"@radix-ui/react-toggle-group";import*as r from"@radix-ui/react-separator";import{
|
|
1
|
+
import*as o from"@radix-ui/react-toggle-group";import*as r from"@radix-ui/react-separator";import{Primitive as e}from"@radix-ui/react-primitive";import{RovingFocusGroup as t,RovingFocusItem as a}from"@radix-ui/react-roving-focus";import{createContext as n}from"@radix-ui/react-context";import{composeEventHandlers as i}from"@radix-ui/primitive";import*as l from"react";import c from"@babel/runtime/helpers/esm/extends";const[m,p]=n("Toolbar");export const Toolbar=/*#__PURE__*/l.forwardRef(((o,r)=>{const{orientation:a="horizontal",dir:n="ltr",loop:i=!0,...p}=o;/*#__PURE__*/return l.createElement(m,{orientation:a},/*#__PURE__*/l.createElement(t,{asChild:!0,orientation:a,dir:n,loop:i},/*#__PURE__*/l.createElement(e.div,c({role:"toolbar",dir:n},p,{ref:r}))))}));export const ToolbarSeparator=/*#__PURE__*/l.forwardRef(((o,e)=>{const t=p("ToolbarSeparator");/*#__PURE__*/return l.createElement(r.Root,c({orientation:"horizontal"===t.orientation?"vertical":"horizontal"},o,{ref:e}))}));/*#__PURE__*/export const ToolbarButton=/*#__PURE__*/l.forwardRef(((o,r)=>/*#__PURE__*/l.createElement(a,{asChild:!0,focusable:!o.disabled},/*#__PURE__*/l.createElement(e.button,c({role:"toolbaritem"},o,{ref:r})))));/*#__PURE__*/export const ToolbarLink=/*#__PURE__*/l.forwardRef(((o,r)=>/*#__PURE__*/l.createElement(a,{asChild:!0,focusable:!0},/*#__PURE__*/l.createElement(e.a,c({role:"toolbaritem"},o,{ref:r,onKeyDown:i(o.onKeyDown,(o=>{" "===o.key&&o.currentTarget.click()}))})))));/*#__PURE__*/export const ToolbarToggleGroup=/*#__PURE__*/l.forwardRef(((r,e)=>{const t=p("ToolbarToggleGroup");/*#__PURE__*/return l.createElement(o.Root,c({"data-orientation":t.orientation},r,{ref:e,rovingFocus:!1}))}));/*#__PURE__*/export const ToolbarToggleItem=/*#__PURE__*/l.forwardRef(((r,e)=>/*#__PURE__*/l.createElement(ToolbarButton,{asChild:!0,disabled:r.disabled},/*#__PURE__*/l.createElement(o.Item,c({},r,{ref:e})))));/*#__PURE__*/export const Root=Toolbar;export const Separator=ToolbarSeparator;export const Button=ToolbarButton;export const Link=ToolbarLink;export const ToggleGroup=ToolbarToggleGroup;export const ToggleItem=ToolbarToggleItem;
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"maAcA,MAIOA,EAAiBC,GAAqBC,EAJxB,kBAcrB,MAAMC,qBAAUC,EAAMC,YAAyC,CAACC,EAAOC,KACrE,MAAMC,YAAEA,EAAc,aAAhBC,IAA8BA,EAAM,MAApCC,KAA2CA,GAAO,KAASC,GAAiBL,eAClF,OACEM,EAAAC,cAACC,EAAD,CAAiBN,YAAaA,gBAC5BI,EAAAC,cAACE,EAAD,CAAkBC,SAAO,EAACR,YAAaA,EAAaC,IAAKA,EAAKC,KAAMA,gBAClEE,EAAAC,cAACI,EAAUC,IAAXC,EAAA,CAAeC,KAAK,UAAUX,IAAKA,GAASE,EAA5C,CAA0DU,IAAKd,iBAgBvE,MAAMe,8BAAmBlB,EAAMC,YAC7B,CAACC,EAAOC,KACN,MAAMgB,EAAUtB,EARG,iCASnB,OACEW,EAAAC,cAACW,EAAmBC,KAApBN,EAAA,CACEX,YAAqC,eAAxBe,EAAQf,YAA+B,WAAa,cAC7DF,EAFN,CAGEe,IAAKd,4BAkBb,MAAMmB,2BAAgBtB,EAAMC,YAC1B,CAACC,EAAOC,iBACNK,EAAAC,cAACc,EAAD,CAAiBX,SAAO,EAACY,WAAYtB,EAAMuB,uBACzCjB,EAAAC,cAACI,EAAUa,OAAXX,EAAA,CAAkBC,KAAK,eAAkBd,EAAzC,CAAgDe,IAAKd,4BAiB3D,MAAMwB,yBAAc3B,EAAMC,YACxB,CAACC,EAAOC,iBACNK,EAAAC,cAACc,EAAD,CAAiBX,SAAO,EAACY,WAAS,gBAChChB,EAAAC,cAACI,EAAUe,EAAXb,EAAA,CACEC,KAAK,eACDd,EAFN,CAGEe,IAAKd,EACL0B,UAAWC,EAAqB5B,EAAM2B,WAAYE,IAC9B,MAAdA,EAAMC,KAAaD,EAAME,cAAcC,qCAoBrD,MAAMC,gCAAqBnC,EAAMC,YAG/B,CAACC,EAAOC,KACR,MAAMgB,EAAUtB,EAXQ,mCAYxB,OACEW,EAAAC,cAAC2B,EAAqBf,KAAtBN,EAAA,CACE,mBAAkBI,EAAQf,aACtBF,EAFN,CAGEe,IAAKd,EACLkC,aAAa,4BAiBnB,MAAMC,+BAAoBtC,EAAMC,YAC9B,CAACC,EAAOC,iBACNK,EAAAC,cAACa,cAAD,CAAeV,SAAO,EAACa,SAAUvB,EAAMuB,uBACrCjB,EAAAC,cAAC2B,EAAqBG,KAAtBxB,EAAA,GAA+Bb,EAA/B,CAAsCe,IAAKd,4BASjD,MAAMkB,KAAOtB,eACb,MAAMyC,UAAYtB,wBAClB,MAAMuB,OAASnB,qBACf,MAAMoB,KAAOf,mBACb,MAAMgB,YAAcR,0BACpB,MAAMS,WAAaN","sources":["./packages/react/toolbar/src/Toolbar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContext } from '@radix-ui/react-context';\nimport { RovingFocusGroup, RovingFocusItem } 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';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * Toolbar\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOOLBAR_NAME = 'Toolbar';\n\ntype RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup>;\ntype ToolbarContextValue = { orientation: RovingFocusGroupProps['orientation'] };\nconst [ToolbarProvider, useToolbarContext] = createContext<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>((props, forwardedRef) => {\n const { orientation = 'horizontal', dir = 'ltr', loop = true, ...toolbarProps } = props;\n return (\n <ToolbarProvider orientation={orientation}>\n <RovingFocusGroup asChild orientation={orientation} dir={dir} loop={loop}>\n <Primitive.div role=\"toolbar\" dir={dir} {...toolbarProps} ref={forwardedRef} />\n </RovingFocusGroup>\n </ToolbarProvider>\n );\n});\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, forwardedRef) => {\n const context = useToolbarContext(SEPARATOR_NAME);\n return (\n <SeparatorPrimitive.Root\n orientation={context.orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n {...props}\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, forwardedRef) => (\n <RovingFocusItem asChild focusable={!props.disabled}>\n <Primitive.button role=\"toolbaritem\" {...props} ref={forwardedRef} />\n </RovingFocusItem>\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, forwardedRef) => (\n <RovingFocusItem asChild focusable>\n <Primitive.a\n role=\"toolbaritem\"\n {...props}\n ref={forwardedRef}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === ' ') event.currentTarget.click();\n })}\n />\n </RovingFocusItem>\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>((props, forwardedRef) => {\n const context = useToolbarContext(TOGGLE_GROUP_NAME);\n return (\n <ToggleGroupPrimitive.Root\n data-orientation={context.orientation}\n {...props}\n ref={forwardedRef}\n rovingFocus={false}\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, forwardedRef) => (\n <ToolbarButton asChild disabled={props.disabled}>\n <ToggleGroupPrimitive.Item {...props} ref={forwardedRef} />\n </ToolbarButton>\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 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":["ToolbarProvider","useToolbarContext","createContext","Toolbar","React","forwardRef","props","forwardedRef","orientation","dir","loop","toolbarProps","_react","createElement","$ad9457c173723bf8dc92def88a055d79$var$ToolbarProvider","RovingFocusGroup","asChild","Primitive","div","_babelRuntimeHelpersEsmExtends","role","ref","ToolbarSeparator","context","_radixUiReactSeparator","Root","ToolbarButton","RovingFocusItem","focusable","disabled","button","ToolbarLink","a","onKeyDown","composeEventHandlers","event","key","currentTarget","click","ToolbarToggleGroup","_radixUiReactToggleGroup","rovingFocus","ToolbarToggleItem","Item","Separator","Button","Link","ToggleGroup","ToggleItem"],"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.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,18 +13,15 @@
|
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"scripts": {
|
|
15
15
|
"clean": "rm -rf dist",
|
|
16
|
-
"prepublish": "yarn clean",
|
|
17
16
|
"version": "yarn version"
|
|
18
17
|
},
|
|
19
18
|
"dependencies": {
|
|
20
19
|
"@babel/runtime": "^7.13.10",
|
|
21
|
-
"@radix-ui/primitive": "0.0
|
|
22
|
-
"@radix-ui/react-context": "0.0
|
|
23
|
-
"@radix-ui/react-
|
|
24
|
-
"@radix-ui/react-
|
|
25
|
-
"@radix-ui/react-
|
|
26
|
-
"@radix-ui/react-slot": "0.0.12",
|
|
27
|
-
"@radix-ui/react-toggle-group": "0.0.10"
|
|
20
|
+
"@radix-ui/primitive": "0.1.0",
|
|
21
|
+
"@radix-ui/react-context": "0.1.0",
|
|
22
|
+
"@radix-ui/react-roving-focus": "0.1.0",
|
|
23
|
+
"@radix-ui/react-separator": "0.1.0",
|
|
24
|
+
"@radix-ui/react-toggle-group": "0.1.0"
|
|
28
25
|
},
|
|
29
26
|
"peerDependencies": {
|
|
30
27
|
"react": "^16.8 || ^17.0"
|