@fluentui/react-toolbar 9.6.13 → 9.7.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/CHANGELOG.md +36 -2
- package/dist/index.d.ts +9 -4
- package/lib/Toolbar.js +1 -1
- package/lib/Toolbar.js.map +1 -1
- package/lib/ToolbarButton.js +1 -1
- package/lib/ToolbarButton.js.map +1 -1
- package/lib/ToolbarDivider.js +1 -1
- package/lib/ToolbarDivider.js.map +1 -1
- package/lib/ToolbarRadioButton.js +1 -1
- package/lib/ToolbarRadioButton.js.map +1 -1
- package/lib/ToolbarToggleButton.js +1 -1
- package/lib/ToolbarToggleButton.js.map +1 -1
- package/lib/components/Toolbar/Toolbar.types.js.map +1 -1
- package/lib/components/Toolbar/index.js +3 -1
- package/lib/components/Toolbar/index.js.map +1 -1
- package/lib/components/Toolbar/useToolbar.js +32 -10
- package/lib/components/Toolbar/useToolbar.js.map +1 -1
- package/lib/components/ToolbarButton/ToolbarButton.types.js +1 -3
- package/lib/components/ToolbarButton/ToolbarButton.types.js.map +1 -1
- package/lib/components/ToolbarButton/index.js +1 -1
- package/lib/components/ToolbarButton/index.js.map +1 -1
- package/lib/components/ToolbarButton/useToolbarButton.js +16 -0
- package/lib/components/ToolbarButton/useToolbarButton.js.map +1 -1
- package/lib/components/ToolbarDivider/ToolbarDivider.types.js +1 -3
- package/lib/components/ToolbarDivider/ToolbarDivider.types.js.map +1 -1
- package/lib/components/ToolbarDivider/index.js +1 -1
- package/lib/components/ToolbarDivider/index.js.map +1 -1
- package/lib/components/ToolbarDivider/useToolbarDivider.js +14 -0
- package/lib/components/ToolbarDivider/useToolbarDivider.js.map +1 -1
- package/lib/components/ToolbarGroup/index.js +1 -1
- package/lib/components/ToolbarGroup/index.js.map +1 -1
- package/lib/components/ToolbarGroup/useToolbarGroup.js +11 -1
- package/lib/components/ToolbarGroup/useToolbarGroup.js.map +1 -1
- package/lib/components/ToolbarRadioButton/ToolbarRadioButton.types.js +1 -3
- package/lib/components/ToolbarRadioButton/ToolbarRadioButton.types.js.map +1 -1
- package/lib/components/ToolbarRadioButton/index.js +1 -1
- package/lib/components/ToolbarRadioButton/index.js.map +1 -1
- package/lib/components/ToolbarRadioButton/useToolbarRadioButton.js +17 -2
- package/lib/components/ToolbarRadioButton/useToolbarRadioButton.js.map +1 -1
- package/lib/components/ToolbarToggleButton/ToolbarToggleButton.types.js +1 -3
- package/lib/components/ToolbarToggleButton/ToolbarToggleButton.types.js.map +1 -1
- package/lib/components/ToolbarToggleButton/index.js +1 -1
- package/lib/components/ToolbarToggleButton/index.js.map +1 -1
- package/lib/components/ToolbarToggleButton/useToolbarToggleButton.js +15 -1
- package/lib/components/ToolbarToggleButton/useToolbarToggleButton.js.map +1 -1
- package/lib/index.js +12 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Toolbar.js +9 -0
- package/lib-commonjs/Toolbar.js.map +1 -1
- package/lib-commonjs/ToolbarButton.js +3 -0
- package/lib-commonjs/ToolbarButton.js.map +1 -1
- package/lib-commonjs/ToolbarDivider.js +3 -0
- package/lib-commonjs/ToolbarDivider.js.map +1 -1
- package/lib-commonjs/ToolbarRadioButton.js +3 -0
- package/lib-commonjs/ToolbarRadioButton.js.map +1 -1
- package/lib-commonjs/ToolbarToggleButton.js +3 -0
- package/lib-commonjs/ToolbarToggleButton.js.map +1 -1
- package/lib-commonjs/components/Toolbar/Toolbar.types.js.map +1 -1
- package/lib-commonjs/components/Toolbar/index.js +11 -0
- package/lib-commonjs/components/Toolbar/index.js.map +1 -1
- package/lib-commonjs/components/Toolbar/useToolbar.js +34 -13
- package/lib-commonjs/components/Toolbar/useToolbar.js.map +1 -1
- package/lib-commonjs/components/ToolbarButton/ToolbarButton.types.js +1 -3
- package/lib-commonjs/components/ToolbarButton/ToolbarButton.types.js.map +1 -1
- package/lib-commonjs/components/ToolbarButton/index.js +3 -0
- package/lib-commonjs/components/ToolbarButton/index.js.map +1 -1
- package/lib-commonjs/components/ToolbarButton/useToolbarButton.js +20 -3
- package/lib-commonjs/components/ToolbarButton/useToolbarButton.js.map +1 -1
- package/lib-commonjs/components/ToolbarDivider/ToolbarDivider.types.js +1 -3
- package/lib-commonjs/components/ToolbarDivider/ToolbarDivider.types.js.map +1 -1
- package/lib-commonjs/components/ToolbarDivider/index.js +3 -0
- package/lib-commonjs/components/ToolbarDivider/index.js.map +1 -1
- package/lib-commonjs/components/ToolbarDivider/useToolbarDivider.js +18 -3
- package/lib-commonjs/components/ToolbarDivider/useToolbarDivider.js.map +1 -1
- package/lib-commonjs/components/ToolbarGroup/index.js +3 -0
- package/lib-commonjs/components/ToolbarGroup/index.js.map +1 -1
- package/lib-commonjs/components/ToolbarGroup/useToolbarGroup.js +15 -4
- package/lib-commonjs/components/ToolbarGroup/useToolbarGroup.js.map +1 -1
- package/lib-commonjs/components/ToolbarRadioButton/ToolbarRadioButton.types.js +1 -3
- package/lib-commonjs/components/ToolbarRadioButton/ToolbarRadioButton.types.js.map +1 -1
- package/lib-commonjs/components/ToolbarRadioButton/index.js +3 -0
- package/lib-commonjs/components/ToolbarRadioButton/index.js.map +1 -1
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButton.js +21 -5
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButton.js.map +1 -1
- package/lib-commonjs/components/ToolbarToggleButton/ToolbarToggleButton.types.js +1 -3
- package/lib-commonjs/components/ToolbarToggleButton/ToolbarToggleButton.types.js.map +1 -1
- package/lib-commonjs/components/ToolbarToggleButton/index.js +3 -0
- package/lib-commonjs/components/ToolbarToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToolbarToggleButton/useToolbarToggleButton.js +19 -4
- package/lib-commonjs/components/ToolbarToggleButton/useToolbarToggleButton.js.map +1 -1
- package/lib-commonjs/index.js +17 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -18
|
@@ -8,6 +8,20 @@ import { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';
|
|
|
8
8
|
* @param props - User provided props to the ToggleButton component.
|
|
9
9
|
* @param ref - User provided ref to be passed to the ToggleButton component.
|
|
10
10
|
*/ export const useToolbarToggleButton_unstable = (props, ref)=>{
|
|
11
|
+
const state = useToolbarToggleButtonBase_unstable(props, ref);
|
|
12
|
+
return {
|
|
13
|
+
appearance: 'subtle',
|
|
14
|
+
...state
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Base hook that builds Toolbar ToggleButton state for behavior and structure only.
|
|
19
|
+
* It does not provide any design-related defaults.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
* @param props - User provided props to the ToggleButton component.
|
|
23
|
+
* @param ref - User provided ref to be passed to the ToggleButton component.
|
|
24
|
+
*/ export const useToolbarToggleButtonBase_unstable = (props, ref)=>{
|
|
11
25
|
const handleToggleButton = useToolbarContext_unstable((ctx)=>ctx.handleToggleButton);
|
|
12
26
|
const checked = useToolbarContext_unstable((ctx)=>{
|
|
13
27
|
var _ctx_checkedValues_props_name;
|
|
@@ -24,7 +38,7 @@ import { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';
|
|
|
24
38
|
value: props.value
|
|
25
39
|
};
|
|
26
40
|
const handleOnClick = (e)=>{
|
|
27
|
-
if (state.disabled) {
|
|
41
|
+
if (state.disabled || state.disabledFocusable) {
|
|
28
42
|
e.preventDefault();
|
|
29
43
|
e.stopPropagation();
|
|
30
44
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarToggleButton/useToolbarToggleButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useToggleButton_unstable } from '@fluentui/react-button';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarToggleButton/useToolbarToggleButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useToggleButton_unstable } from '@fluentui/react-button';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\nimport type {\n ToolbarToggleButtonProps,\n ToolbarToggleButtonState,\n ToolbarToggleButtonBaseProps,\n ToolbarToggleButtonBaseState,\n} from './ToolbarToggleButton.types';\n\n/**\n * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToolbarToggleButton_unstable = (\n props: ToolbarToggleButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarToggleButtonState => {\n const state = useToolbarToggleButtonBase_unstable(props, ref);\n return {\n appearance: 'subtle',\n ...state,\n };\n};\n\n/**\n * Base hook that builds Toolbar ToggleButton state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToolbarToggleButtonBase_unstable = (\n props: ToolbarToggleButtonBaseProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarToggleButtonBaseState => {\n const handleToggleButton = useToolbarContext_unstable(ctx => ctx.handleToggleButton);\n const checked = useToolbarContext_unstable(ctx => !!ctx.checkedValues[props.name]?.includes(props.value));\n\n const { onClick: onClickOriginal } = props;\n const toggleButtonState = useToggleButton_unstable({ checked, ...props }, ref);\n const state: ToolbarToggleButtonBaseState = {\n ...toggleButtonState,\n name: props.name,\n value: props.value,\n };\n\n const handleOnClick = (\n e: React.MouseEvent<HTMLButtonElement, MouseEvent> & React.MouseEvent<HTMLAnchorElement, MouseEvent>,\n ) => {\n if (state.disabled || state.disabledFocusable) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n handleToggleButton?.(e, state.name, state.value, state.checked);\n onClickOriginal?.(e);\n };\n\n state.root.onClick = handleOnClick;\n return state;\n};\n"],"names":["React","useToggleButton_unstable","useToolbarContext_unstable","useToolbarToggleButton_unstable","props","ref","state","useToolbarToggleButtonBase_unstable","appearance","handleToggleButton","ctx","checked","checkedValues","name","includes","value","onClick","onClickOriginal","toggleButtonState","handleOnClick","e","disabled","disabledFocusable","preventDefault","stopPropagation","root"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,QAAQ,yBAAyB;AAClE,SAASC,0BAA0B,QAAQ,4BAA4B;AAQvE;;;;;CAKC,GACD,OAAO,MAAMC,kCAAkC,CAC7CC,OACAC;IAEA,MAAMC,QAAQC,oCAAoCH,OAAOC;IACzD,OAAO;QACLG,YAAY;QACZ,GAAGF,KAAK;IACV;AACF,EAAE;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMC,sCAAsC,CACjDH,OACAC;IAEA,MAAMI,qBAAqBP,2BAA2BQ,CAAAA,MAAOA,IAAID,kBAAkB;IACnF,MAAME,UAAUT,2BAA2BQ,CAAAA;YAASA;eAAF,CAAC,GAACA,gCAAAA,IAAIE,aAAa,CAACR,MAAMS,IAAI,CAAC,cAA7BH,oDAAAA,8BAA+BI,QAAQ,CAACV,MAAMW,KAAK;;IAEvG,MAAM,EAAEC,SAASC,eAAe,EAAE,GAAGb;IACrC,MAAMc,oBAAoBjB,yBAAyB;QAAEU;QAAS,GAAGP,KAAK;IAAC,GAAGC;IAC1E,MAAMC,QAAsC;QAC1C,GAAGY,iBAAiB;QACpBL,MAAMT,MAAMS,IAAI;QAChBE,OAAOX,MAAMW,KAAK;IACpB;IAEA,MAAMI,gBAAgB,CACpBC;QAEA,IAAId,MAAMe,QAAQ,IAAIf,MAAMgB,iBAAiB,EAAE;YAC7CF,EAAEG,cAAc;YAChBH,EAAEI,eAAe;YACjB;QACF;QAEAf,+BAAAA,yCAAAA,mBAAqBW,GAAGd,MAAMO,IAAI,EAAEP,MAAMS,KAAK,EAAET,MAAMK,OAAO;QAC9DM,4BAAAA,sCAAAA,gBAAkBG;IACpB;IAEAd,MAAMmB,IAAI,CAACT,OAAO,GAAGG;IACrB,OAAOb;AACT,EAAE"}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
export { Toolbar, renderToolbar_unstable, toolbarClassNames, useToolbarStyles_unstable, useToolbar_unstable } from './Toolbar';
|
|
1
|
+
export { Toolbar, renderToolbar_unstable, toolbarClassNames, useToolbarStyles_unstable, useToolbar_unstable, useToolbarContextValues_unstable, useToolbarContext_unstable } from './Toolbar';
|
|
2
2
|
export { ToolbarButton, useToolbarButtonStyles_unstable, useToolbarButton_unstable } from './ToolbarButton';
|
|
3
3
|
export { ToolbarDivider, useToolbarDividerStyles_unstable, useToolbarDivider_unstable } from './ToolbarDivider';
|
|
4
4
|
export { ToolbarToggleButton, useToolbarToggleButtonStyles_unstable, useToolbarToggleButton_unstable } from './ToolbarToggleButton';
|
|
5
5
|
export { ToolbarRadioButton, useToolbarRadioButtonStyles_unstable, useToolbarRadioButton_unstable } from './ToolbarRadioButton';
|
|
6
6
|
export { ToolbarGroup, useToolbarGroupStyles_unstable, useToolbarGroup_unstable, renderToolbarGroup_unstable, toolbarGroupClassNames } from './ToolbarGroup';
|
|
7
7
|
export { ToolbarRadioGroup } from './ToolbarRadioGroup';
|
|
8
|
+
// Experimental APIs
|
|
9
|
+
// export type { ToolbarBaseState, ToolbarBaseProps } from './Toolbar';
|
|
10
|
+
// export { useToolbarBase_unstable } from './Toolbar';
|
|
11
|
+
// export type { ToolbarButtonBaseState, ToolbarButtonBaseProps } from './ToolbarButton';
|
|
12
|
+
// export { useToolbarButtonBase_unstable } from './ToolbarButton';
|
|
13
|
+
// export type { ToolbarDividerBaseState, ToolbarDividerBaseProps } from './ToolbarDivider';
|
|
14
|
+
// export { useToolbarDividerBase_unstable } from './ToolbarDivider';
|
|
15
|
+
// export type { ToolbarRadioButtonBaseState, ToolbarRadioButtonBaseProps } from './ToolbarRadioButton';
|
|
16
|
+
// export { useToolbarRadioButtonBase_unstable } from './ToolbarRadioButton';
|
|
17
|
+
// export type { ToolbarToggleButtonBaseState, ToolbarToggleButtonBaseProps } from './ToolbarToggleButton';
|
|
18
|
+
// export { useToolbarToggleButtonBase_unstable } from './ToolbarToggleButton';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Toolbar,\n renderToolbar_unstable,\n toolbarClassNames,\n useToolbarStyles_unstable,\n useToolbar_unstable,\n} from './Toolbar';\nexport type { ToolbarContextValue, ToolbarContextValues, ToolbarProps, ToolbarSlots, ToolbarState } from './Toolbar';\nexport { ToolbarButton, useToolbarButtonStyles_unstable, useToolbarButton_unstable } from './ToolbarButton';\nexport type { ToolbarButtonProps, ToolbarButtonState } from './ToolbarButton';\nexport { ToolbarDivider, useToolbarDividerStyles_unstable, useToolbarDivider_unstable } from './ToolbarDivider';\nexport type { ToolbarDividerProps, ToolbarDividerState } from './ToolbarDivider';\nexport {\n ToolbarToggleButton,\n useToolbarToggleButtonStyles_unstable,\n useToolbarToggleButton_unstable,\n} from './ToolbarToggleButton';\nexport type { ToolbarToggleButtonProps, ToolbarToggleButtonState } from './ToolbarToggleButton';\nexport {\n ToolbarRadioButton,\n useToolbarRadioButtonStyles_unstable,\n useToolbarRadioButton_unstable,\n} from './ToolbarRadioButton';\nexport type { ToolbarRadioButtonProps, ToolbarRadioButtonState } from './ToolbarRadioButton';\nexport {\n ToolbarGroup,\n useToolbarGroupStyles_unstable,\n useToolbarGroup_unstable,\n renderToolbarGroup_unstable,\n toolbarGroupClassNames,\n} from './ToolbarGroup';\nexport type { ToolbarGroupProps, ToolbarGroupState } from './ToolbarGroup';\nexport { ToolbarRadioGroup } from './ToolbarRadioGroup';\nexport type { ToolbarRadioGroupProps, ToolbarRadioGroupState } from './ToolbarRadioGroup';\n"],"names":["Toolbar","renderToolbar_unstable","toolbarClassNames","useToolbarStyles_unstable","useToolbar_unstable","ToolbarButton","useToolbarButtonStyles_unstable","useToolbarButton_unstable","ToolbarDivider","useToolbarDividerStyles_unstable","useToolbarDivider_unstable","ToolbarToggleButton","useToolbarToggleButtonStyles_unstable","useToolbarToggleButton_unstable","ToolbarRadioButton","useToolbarRadioButtonStyles_unstable","useToolbarRadioButton_unstable","ToolbarGroup","useToolbarGroupStyles_unstable","useToolbarGroup_unstable","renderToolbarGroup_unstable","toolbarGroupClassNames","ToolbarRadioGroup"],"mappings":"AAAA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Toolbar,\n renderToolbar_unstable,\n toolbarClassNames,\n useToolbarStyles_unstable,\n useToolbar_unstable,\n useToolbarContextValues_unstable,\n useToolbarContext_unstable,\n} from './Toolbar';\nexport type { ToolbarContextValue, ToolbarContextValues, ToolbarProps, ToolbarSlots, ToolbarState } from './Toolbar';\nexport { ToolbarButton, useToolbarButtonStyles_unstable, useToolbarButton_unstable } from './ToolbarButton';\nexport type { ToolbarButtonProps, ToolbarButtonState } from './ToolbarButton';\nexport { ToolbarDivider, useToolbarDividerStyles_unstable, useToolbarDivider_unstable } from './ToolbarDivider';\nexport type { ToolbarDividerProps, ToolbarDividerState } from './ToolbarDivider';\nexport {\n ToolbarToggleButton,\n useToolbarToggleButtonStyles_unstable,\n useToolbarToggleButton_unstable,\n} from './ToolbarToggleButton';\nexport type { ToolbarToggleButtonProps, ToolbarToggleButtonState } from './ToolbarToggleButton';\nexport {\n ToolbarRadioButton,\n useToolbarRadioButtonStyles_unstable,\n useToolbarRadioButton_unstable,\n} from './ToolbarRadioButton';\nexport type { ToolbarRadioButtonProps, ToolbarRadioButtonState } from './ToolbarRadioButton';\nexport {\n ToolbarGroup,\n useToolbarGroupStyles_unstable,\n useToolbarGroup_unstable,\n renderToolbarGroup_unstable,\n toolbarGroupClassNames,\n} from './ToolbarGroup';\nexport type { ToolbarGroupProps, ToolbarGroupState } from './ToolbarGroup';\nexport { ToolbarRadioGroup } from './ToolbarRadioGroup';\nexport type { ToolbarRadioGroupProps, ToolbarRadioGroupState } from './ToolbarRadioGroup';\n\n// Experimental APIs\n// export type { ToolbarBaseState, ToolbarBaseProps } from './Toolbar';\n// export { useToolbarBase_unstable } from './Toolbar';\n// export type { ToolbarButtonBaseState, ToolbarButtonBaseProps } from './ToolbarButton';\n// export { useToolbarButtonBase_unstable } from './ToolbarButton';\n// export type { ToolbarDividerBaseState, ToolbarDividerBaseProps } from './ToolbarDivider';\n// export { useToolbarDividerBase_unstable } from './ToolbarDivider';\n// export type { ToolbarRadioButtonBaseState, ToolbarRadioButtonBaseProps } from './ToolbarRadioButton';\n// export { useToolbarRadioButtonBase_unstable } from './ToolbarRadioButton';\n// export type { ToolbarToggleButtonBaseState, ToolbarToggleButtonBaseProps } from './ToolbarToggleButton';\n// export { useToolbarToggleButtonBase_unstable } from './ToolbarToggleButton';\n"],"names":["Toolbar","renderToolbar_unstable","toolbarClassNames","useToolbarStyles_unstable","useToolbar_unstable","useToolbarContextValues_unstable","useToolbarContext_unstable","ToolbarButton","useToolbarButtonStyles_unstable","useToolbarButton_unstable","ToolbarDivider","useToolbarDividerStyles_unstable","useToolbarDivider_unstable","ToolbarToggleButton","useToolbarToggleButtonStyles_unstable","useToolbarToggleButton_unstable","ToolbarRadioButton","useToolbarRadioButtonStyles_unstable","useToolbarRadioButton_unstable","ToolbarGroup","useToolbarGroupStyles_unstable","useToolbarGroup_unstable","renderToolbarGroup_unstable","toolbarGroupClassNames","ToolbarRadioGroup"],"mappings":"AAAA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,mBAAmB,EACnBC,gCAAgC,EAChCC,0BAA0B,QACrB,YAAY;AAEnB,SAASC,aAAa,EAAEC,+BAA+B,EAAEC,yBAAyB,QAAQ,kBAAkB;AAE5G,SAASC,cAAc,EAAEC,gCAAgC,EAAEC,0BAA0B,QAAQ,mBAAmB;AAEhH,SACEC,mBAAmB,EACnBC,qCAAqC,EACrCC,+BAA+B,QAC1B,wBAAwB;AAE/B,SACEC,kBAAkB,EAClBC,oCAAoC,EACpCC,8BAA8B,QACzB,uBAAuB;AAE9B,SACEC,YAAY,EACZC,8BAA8B,EAC9BC,wBAAwB,EACxBC,2BAA2B,EAC3BC,sBAAsB,QACjB,iBAAiB;AAExB,SAASC,iBAAiB,QAAQ,sBAAsB;CAGxD,oBAAoB;CACpB,uEAAuE;CACvE,uDAAuD;CACvD,yFAAyF;CACzF,mEAAmE;CACnE,4FAA4F;CAC5F,qEAAqE;CACrE,wGAAwG;CACxG,6EAA6E;CAC7E,2GAA2G;CAC3G,+EAA+E"}
|
package/lib-commonjs/Toolbar.js
CHANGED
|
@@ -18,6 +18,15 @@ _export(exports, {
|
|
|
18
18
|
toolbarClassNames: function() {
|
|
19
19
|
return _index.toolbarClassNames;
|
|
20
20
|
},
|
|
21
|
+
useToolbarBase_unstable: function() {
|
|
22
|
+
return _index.useToolbarBase_unstable;
|
|
23
|
+
},
|
|
24
|
+
useToolbarContextValues_unstable: function() {
|
|
25
|
+
return _index.useToolbarContextValues_unstable;
|
|
26
|
+
},
|
|
27
|
+
useToolbarContext_unstable: function() {
|
|
28
|
+
return _index.useToolbarContext_unstable;
|
|
29
|
+
},
|
|
21
30
|
useToolbarStyles_unstable: function() {
|
|
22
31
|
return _index.useToolbarStyles_unstable;
|
|
23
32
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Toolbar.ts"],"sourcesContent":["export type {\n ToggableHandler,\n ToolbarCheckedValueChangeData,\n ToolbarCheckedValueChangeEvent,\n ToolbarContextValue,\n ToolbarContextValues,\n ToolbarProps,\n ToolbarSlots,\n ToolbarState,\n UninitializedToolbarState,\n} from './components/Toolbar/index';\nexport {\n Toolbar,\n renderToolbar_unstable,\n toolbarClassNames,\n useToolbarStyles_unstable,\n useToolbar_unstable,\n} from './components/Toolbar/index';\n"],"names":["Toolbar","renderToolbar_unstable","toolbarClassNames","useToolbarStyles_unstable","useToolbar_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/Toolbar.ts"],"sourcesContent":["export type {\n ToggableHandler,\n ToolbarCheckedValueChangeData,\n ToolbarCheckedValueChangeEvent,\n ToolbarContextValue,\n ToolbarContextValues,\n ToolbarBaseProps,\n ToolbarProps,\n ToolbarSlots,\n ToolbarBaseState,\n ToolbarState,\n UninitializedToolbarState,\n} from './components/Toolbar/index';\nexport {\n Toolbar,\n renderToolbar_unstable,\n toolbarClassNames,\n useToolbarStyles_unstable,\n useToolbar_unstable,\n useToolbarBase_unstable,\n useToolbarContext_unstable,\n useToolbarContextValues_unstable,\n} from './components/Toolbar/index';\n"],"names":["Toolbar","renderToolbar_unstable","toolbarClassNames","useToolbarStyles_unstable","useToolbar_unstable","useToolbarBase_unstable","useToolbarContext_unstable","useToolbarContextValues_unstable"],"mappings":";;;;;;;;;;;IAcEA;6BAAO;;;eACPC,6BAAsB;;;eACtBC,wBAAiB;;;eAGjBG,8BAAuB;;IAEvBE;sDAAgC;;;eADhCD,iCAA0B;;;eAH1BH,gCAAyB;;;eACzBC,0BAAmB;;;uBAId,6BAA6B"}
|
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
|
12
12
|
ToolbarButton: function() {
|
|
13
13
|
return _index.ToolbarButton;
|
|
14
14
|
},
|
|
15
|
+
useToolbarButtonBase_unstable: function() {
|
|
16
|
+
return _index.useToolbarButtonBase_unstable;
|
|
17
|
+
},
|
|
15
18
|
useToolbarButtonStyles_unstable: function() {
|
|
16
19
|
return _index.useToolbarButtonStyles_unstable;
|
|
17
20
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ToolbarButton.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/ToolbarButton.ts"],"sourcesContent":["export type {\n ToolbarButtonBaseState,\n ToolbarButtonProps,\n ToolbarButtonBaseProps,\n ToolbarButtonState,\n} from './components/ToolbarButton/index';\nexport {\n ToolbarButton,\n useToolbarButtonStyles_unstable,\n useToolbarButton_unstable,\n useToolbarButtonBase_unstable,\n} from './components/ToolbarButton/index';\n"],"names":["ToolbarButton","useToolbarButtonStyles_unstable","useToolbarButton_unstable","useToolbarButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAOEA,oBAAa;;;eAGbG,oCAA6B;;;eAF7BF,sCAA+B;;;eAC/BC,gCAAyB;;;uBAEpB,mCAAmC"}
|
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
|
12
12
|
ToolbarDivider: function() {
|
|
13
13
|
return _index.ToolbarDivider;
|
|
14
14
|
},
|
|
15
|
+
useToolbarDividerBase_unstable: function() {
|
|
16
|
+
return _index.useToolbarDividerBase_unstable;
|
|
17
|
+
},
|
|
15
18
|
useToolbarDividerStyles_unstable: function() {
|
|
16
19
|
return _index.useToolbarDividerStyles_unstable;
|
|
17
20
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ToolbarDivider.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/ToolbarDivider.ts"],"sourcesContent":["export type {\n ToolbarDividerBaseState,\n ToolbarDividerProps,\n ToolbarDividerBaseProps,\n ToolbarDividerState,\n} from './components/ToolbarDivider/index';\nexport {\n ToolbarDivider,\n useToolbarDividerStyles_unstable,\n useToolbarDivider_unstable,\n useToolbarDividerBase_unstable,\n} from './components/ToolbarDivider/index';\n"],"names":["ToolbarDivider","useToolbarDividerStyles_unstable","useToolbarDivider_unstable","useToolbarDividerBase_unstable"],"mappings":";;;;;;;;;;;;eAOEA,qBAAc;;;eAGdG,qCAA8B;;;eAF9BF,uCAAgC;;;eAChCC,iCAA0B;;;uBAErB,oCAAoC"}
|
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
|
12
12
|
ToolbarRadioButton: function() {
|
|
13
13
|
return _index.ToolbarRadioButton;
|
|
14
14
|
},
|
|
15
|
+
useToolbarRadioButtonBase_unstable: function() {
|
|
16
|
+
return _index.useToolbarRadioButtonBase_unstable;
|
|
17
|
+
},
|
|
15
18
|
useToolbarRadioButtonStyles_unstable: function() {
|
|
16
19
|
return _index.useToolbarRadioButtonStyles_unstable;
|
|
17
20
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ToolbarRadioButton.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/ToolbarRadioButton.ts"],"sourcesContent":["export type {\n ToolbarRadioButtonBaseProps,\n ToolbarRadioButtonProps,\n ToolbarRadioButtonBaseState,\n ToolbarRadioButtonState,\n} from './components/ToolbarRadioButton/index';\nexport {\n ToolbarRadioButton,\n useToolbarRadioButtonStyles_unstable,\n useToolbarRadioButton_unstable,\n useToolbarRadioButtonBase_unstable,\n} from './components/ToolbarRadioButton/index';\n"],"names":["ToolbarRadioButton","useToolbarRadioButtonStyles_unstable","useToolbarRadioButton_unstable","useToolbarRadioButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAOEA,yBAAkB;;;eAGlBG,yCAAkC;;;eAFlCF,2CAAoC;;;eACpCC,qCAA8B;;;uBAEzB,wCAAwC"}
|
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
|
12
12
|
ToolbarToggleButton: function() {
|
|
13
13
|
return _index.ToolbarToggleButton;
|
|
14
14
|
},
|
|
15
|
+
useToolbarToggleButtonBase_unstable: function() {
|
|
16
|
+
return _index.useToolbarToggleButtonBase_unstable;
|
|
17
|
+
},
|
|
15
18
|
useToolbarToggleButtonStyles_unstable: function() {
|
|
16
19
|
return _index.useToolbarToggleButtonStyles_unstable;
|
|
17
20
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ToolbarToggleButton.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/ToolbarToggleButton.ts"],"sourcesContent":["export type {\n ToolbarToggleButtonBaseProps,\n ToolbarToggleButtonProps,\n ToolbarToggleButtonBaseState,\n ToolbarToggleButtonState,\n} from './components/ToolbarToggleButton/index';\nexport {\n ToolbarToggleButton,\n useToolbarToggleButtonStyles_unstable,\n useToolbarToggleButton_unstable,\n useToolbarToggleButtonBase_unstable,\n} from './components/ToolbarToggleButton/index';\n"],"names":["ToolbarToggleButton","useToolbarToggleButtonStyles_unstable","useToolbarToggleButton_unstable","useToolbarToggleButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAOEA,0BAAmB;;;eAGnBG,0CAAmC;;;eAFnCF,4CAAqC;;;eACrCC,sCAA+B;;;uBAE1B,yCAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/Toolbar.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ToolbarSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToolbarCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type ToolbarCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\n/**\n * Toolbar Props\n */\nexport type ToolbarProps = ComponentProps<ToolbarSlots> & {\n /**\n * Toolbar can have small or medium size\n *\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Toolbar can be vertical styled\n * @default false\n */\n vertical?: boolean;\n\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onCheckedValueChange?: (e: ToolbarCheckedValueChangeEvent, data: ToolbarCheckedValueChangeData) => void;\n};\n\n/**\n * State used in rendering Toolbar\n */\nexport type ToolbarState = ComponentState<ToolbarSlots> &\n Required<Pick<ToolbarProps, 'size' | 'checkedValues' | 'vertical'>> &\n Pick<ToolbarProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {\n /*\n * Toggles the state of a ToggleButton item\n */\n handleToggleButton: ToggableHandler;\n /*\n * Toggles the state of a ToggleButton item\n */\n handleRadio: ToggableHandler;\n };\n\nexport type ToolbarContextValue = Pick<ToolbarState, 'size' | 'vertical' | 'checkedValues'> & {\n handleToggleButton?: ToggableHandler;\n handleRadio?: ToggableHandler;\n};\n\nexport type ToolbarContextValues = {\n toolbar: ToolbarContextValue;\n};\n\nexport type UninitializedToolbarState = Omit<
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/Toolbar.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ToolbarSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToolbarCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type ToolbarCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\n/**\n * Toolbar Props\n */\nexport type ToolbarProps = ComponentProps<ToolbarSlots> & {\n /**\n * Toolbar can have small or medium size\n *\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Toolbar can be vertical styled\n * @default false\n */\n vertical?: boolean;\n\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onCheckedValueChange?: (e: ToolbarCheckedValueChangeEvent, data: ToolbarCheckedValueChangeData) => void;\n};\n\nexport type ToolbarBaseProps = Omit<ToolbarProps, 'size'>;\n\n/**\n * State used in rendering Toolbar\n */\nexport type ToolbarState = ComponentState<ToolbarSlots> &\n Required<Pick<ToolbarProps, 'size' | 'checkedValues' | 'vertical'>> &\n Pick<ToolbarProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {\n /*\n * Toggles the state of a ToggleButton item\n */\n handleToggleButton: ToggableHandler;\n /*\n * Toggles the state of a ToggleButton item\n */\n handleRadio: ToggableHandler;\n };\n\nexport type ToolbarBaseState = Omit<ToolbarState, 'size'>;\n\nexport type ToolbarContextValue = Pick<ToolbarState, 'size' | 'vertical' | 'checkedValues'> & {\n handleToggleButton?: ToggableHandler;\n handleRadio?: ToggableHandler;\n};\n\nexport type ToolbarContextValues = {\n toolbar: ToolbarContextValue;\n};\n\nexport type UninitializedToolbarState = Omit<ToolbarBaseState, 'checkedValues' | 'handleToggleButton' | 'handleRadio'> &\n Partial<Pick<ToolbarState, 'checkedValues'>>;\n\nexport type ToggableHandler = (\n e: React.MouseEvent | React.KeyboardEvent,\n name: string,\n value: string,\n checked?: boolean,\n) => void;\n"],"names":["React"],"mappings":";;;;;iEAAuB,QAAQ"}
|
|
@@ -18,6 +18,15 @@ _export(exports, {
|
|
|
18
18
|
toolbarClassNames: function() {
|
|
19
19
|
return _useToolbarStylesstyles.toolbarClassNames;
|
|
20
20
|
},
|
|
21
|
+
useToolbarBase_unstable: function() {
|
|
22
|
+
return _useToolbar.useToolbarBase_unstable;
|
|
23
|
+
},
|
|
24
|
+
useToolbarContextValues_unstable: function() {
|
|
25
|
+
return _useToolbarContextValues.useToolbarContextValues_unstable;
|
|
26
|
+
},
|
|
27
|
+
useToolbarContext_unstable: function() {
|
|
28
|
+
return _ToolbarContext.useToolbarContext_unstable;
|
|
29
|
+
},
|
|
21
30
|
useToolbarStyles_unstable: function() {
|
|
22
31
|
return _useToolbarStylesstyles.useToolbarStyles_unstable;
|
|
23
32
|
},
|
|
@@ -25,7 +34,9 @@ _export(exports, {
|
|
|
25
34
|
return _useToolbar.useToolbar_unstable;
|
|
26
35
|
}
|
|
27
36
|
});
|
|
37
|
+
const _ToolbarContext = require("./ToolbarContext");
|
|
28
38
|
const _Toolbar = require("./Toolbar");
|
|
29
39
|
const _renderToolbar = require("./renderToolbar");
|
|
30
40
|
const _useToolbar = require("./useToolbar");
|
|
41
|
+
const _useToolbarContextValues = require("./useToolbarContextValues");
|
|
31
42
|
const _useToolbarStylesstyles = require("./useToolbarStyles.styles");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/index.ts"],"sourcesContent":["export { Toolbar } from './Toolbar';\nexport type {\n ToggableHandler,\n ToolbarCheckedValueChangeData,\n ToolbarCheckedValueChangeEvent,\n ToolbarContextValue,\n ToolbarContextValues,\n ToolbarProps,\n ToolbarSlots,\n ToolbarState,\n UninitializedToolbarState,\n} from './Toolbar.types';\nexport { renderToolbar_unstable } from './renderToolbar';\nexport { useToolbar_unstable } from './useToolbar';\nexport { toolbarClassNames, useToolbarStyles_unstable } from './useToolbarStyles.styles';\n"],"names":["Toolbar","renderToolbar_unstable","useToolbar_unstable","toolbarClassNames","useToolbarStyles_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/index.ts"],"sourcesContent":["export { useToolbarContext_unstable } from './ToolbarContext';\nexport { Toolbar } from './Toolbar';\nexport type {\n ToggableHandler,\n ToolbarCheckedValueChangeData,\n ToolbarCheckedValueChangeEvent,\n ToolbarContextValue,\n ToolbarContextValues,\n ToolbarBaseProps,\n ToolbarProps,\n ToolbarSlots,\n ToolbarBaseState,\n ToolbarState,\n UninitializedToolbarState,\n} from './Toolbar.types';\nexport { renderToolbar_unstable } from './renderToolbar';\nexport { useToolbar_unstable, useToolbarBase_unstable } from './useToolbar';\nexport { useToolbarContextValues_unstable } from './useToolbarContextValues';\nexport { toolbarClassNames, useToolbarStyles_unstable } from './useToolbarStyles.styles';\n"],"names":["useToolbarContext_unstable","Toolbar","renderToolbar_unstable","useToolbar_unstable","useToolbarBase_unstable","useToolbarContextValues_unstable","toolbarClassNames","useToolbarStyles_unstable"],"mappings":";;;;;;;;;;;IACSC;+BAAO;;;eAcPC,qCAAsB;;;eAGtBI,yCAAiB;;;eAFIF,mCAAuB;;;eAC5CC,yDAAgC;;;eAjBhCL,0CAA0B;;;eAkBPO,iDAAyB;;;eAF5CJ,+BAAmB;;;gCAhBe,mBAAmB;yBACtC,YAAY;+BAcG,kBAAkB;4BACI,eAAe;yCAC3B,4BAA4B;wCAChB,4BAA4B"}
|
|
@@ -3,9 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useToolbarArrowNavigationProps_unstable: function() {
|
|
14
|
+
return useToolbarArrowNavigationProps_unstable;
|
|
15
|
+
},
|
|
16
|
+
useToolbarBase_unstable: function() {
|
|
17
|
+
return useToolbarBase_unstable;
|
|
18
|
+
},
|
|
19
|
+
useToolbar_unstable: function() {
|
|
9
20
|
return useToolbar_unstable;
|
|
10
21
|
}
|
|
11
22
|
});
|
|
@@ -14,13 +25,21 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
|
14
25
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
15
26
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
16
27
|
const useToolbar_unstable = (props, ref)=>{
|
|
17
|
-
const { size = 'medium'
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
const initialState = {
|
|
28
|
+
const { size = 'medium' } = props;
|
|
29
|
+
const state = useToolbarBase_unstable(props, ref);
|
|
30
|
+
const arrowNavigationProps = useToolbarArrowNavigationProps_unstable();
|
|
31
|
+
return {
|
|
23
32
|
size,
|
|
33
|
+
...state,
|
|
34
|
+
root: {
|
|
35
|
+
...state.root,
|
|
36
|
+
...arrowNavigationProps
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const useToolbarBase_unstable = (props, ref)=>{
|
|
41
|
+
const { vertical = false } = props;
|
|
42
|
+
const initialState = {
|
|
24
43
|
vertical,
|
|
25
44
|
// TODO add appropriate props/defaults
|
|
26
45
|
components: {
|
|
@@ -31,14 +50,10 @@ const useToolbar_unstable = (props, ref)=>{
|
|
|
31
50
|
// mySlot: resolveShorthand(props.mySlot),
|
|
32
51
|
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
|
|
33
52
|
role: 'toolbar',
|
|
34
|
-
// FIXME:
|
|
35
|
-
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
|
|
36
|
-
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
|
|
37
53
|
ref: ref,
|
|
38
54
|
...vertical && {
|
|
39
55
|
'aria-orientation': 'vertical'
|
|
40
56
|
},
|
|
41
|
-
...arrowNavigationProps,
|
|
42
57
|
...props
|
|
43
58
|
}), {
|
|
44
59
|
elementType: 'div'
|
|
@@ -114,3 +129,9 @@ const useToolbar_unstable = (props, ref)=>{
|
|
|
114
129
|
onCheckedValueChange
|
|
115
130
|
];
|
|
116
131
|
};
|
|
132
|
+
const useToolbarArrowNavigationProps_unstable = ()=>{
|
|
133
|
+
return (0, _reacttabster.useArrowNavigationGroup)({
|
|
134
|
+
circular: true,
|
|
135
|
+
axis: 'both'
|
|
136
|
+
});
|
|
137
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/useToolbar.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useEventCallback, useControllableState, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/useToolbar.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useEventCallback, useControllableState, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n ToggableHandler,\n ToolbarBaseProps,\n ToolbarBaseState,\n ToolbarProps,\n ToolbarState,\n UninitializedToolbarState,\n} from './Toolbar.types';\nimport { TabsterDOMAttribute, useArrowNavigationGroup } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render Toolbar.\n *\n * The returned state can be modified with hooks such as useToolbarStyles_unstable,\n * before being passed to renderToolbar_unstable.\n *\n * @param props - props from this instance of Toolbar\n * @param ref - reference to root HTMLElement of Toolbar\n */\nexport const useToolbar_unstable = (props: ToolbarProps, ref: React.Ref<HTMLElement>): ToolbarState => {\n const { size = 'medium' } = props;\n const state = useToolbarBase_unstable(props, ref);\n const arrowNavigationProps = useToolbarArrowNavigationProps_unstable();\n\n return {\n size,\n ...state,\n root: {\n ...state.root,\n ...arrowNavigationProps,\n },\n };\n};\n\n/**\n * Base hook that builds Toolbar state for behavior and structure only.\n * It does not add arrow key navigation, which is handled by `useToolbar_unstable`.\n *\n * @internal\n * @param props - Props for this Toolbar instance.\n * @param ref - Ref to the root HTMLElement.\n */\nexport const useToolbarBase_unstable = (props: ToolbarBaseProps, ref: React.Ref<HTMLElement>): ToolbarBaseState => {\n const { vertical = false } = props;\n\n const initialState: UninitializedToolbarState = {\n vertical,\n // TODO add appropriate props/defaults\n components: {\n // TODO add each slot's element type or component\n root: 'div',\n },\n // TODO add appropriate slots, for example:\n // mySlot: resolveShorthand(props.mySlot),\n root: slot.always(\n getIntrinsicElementProps('div', {\n role: 'toolbar',\n ref: ref as React.Ref<HTMLDivElement>,\n ...(vertical && ({ 'aria-orientation': 'vertical' } as const)),\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n\n const [checkedValues, onCheckedValueChange] = useToolbarSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues: props.defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange,\n });\n\n const handleToggleButton: ToggableHandler = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked?: boolean) => {\n if (name && value) {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n onCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n }\n },\n );\n\n const handleRadio: ToggableHandler = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked?: boolean) => {\n if (name && value) {\n onCheckedValueChange?.(e, {\n name,\n checkedItems: [value],\n });\n }\n },\n );\n\n return {\n ...initialState,\n handleToggleButton,\n handleRadio,\n checkedValues: checkedValues ?? {},\n };\n};\n\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */\nconst useToolbarSelectableState = (\n state: Pick<ToolbarBaseProps, 'checkedValues' | 'defaultCheckedValues' | 'onCheckedValueChange'>,\n) => {\n const [checkedValues, setCheckedValues] = useControllableState({\n state: state.checkedValues,\n defaultState: state.defaultCheckedValues,\n initialState: {},\n });\n const { onCheckedValueChange: onCheckedValueChangeOriginal } = state;\n const onCheckedValueChange: ToolbarBaseState['onCheckedValueChange'] = useEventCallback(\n (e, { name, checkedItems }) => {\n if (onCheckedValueChangeOriginal) {\n onCheckedValueChangeOriginal(e, { name, checkedItems });\n }\n\n setCheckedValues(s => {\n return s ? { ...s, [name]: checkedItems } : { [name]: checkedItems };\n });\n },\n );\n\n return [checkedValues, onCheckedValueChange] as const;\n};\n\n/**\n * Hook to add arrow navigation props to the Toolbar.\n *\n * @internal\n * @returns - Tabster DOM attributes for arrow navigation\n */\nexport const useToolbarArrowNavigationProps_unstable = (): TabsterDOMAttribute => {\n return useArrowNavigationGroup({\n circular: true,\n axis: 'both',\n });\n};\n"],"names":["React","useEventCallback","useControllableState","getIntrinsicElementProps","slot","useArrowNavigationGroup","useToolbar_unstable","props","ref","size","state","useToolbarBase_unstable","arrowNavigationProps","useToolbarArrowNavigationProps_unstable","root","vertical","initialState","components","always","role","elementType","checkedValues","onCheckedValueChange","useToolbarSelectableState","defaultCheckedValues","handleToggleButton","e","name","value","checked","checkedItems","newCheckedItems","splice","indexOf","push","handleRadio","setCheckedValues","defaultState","onCheckedValueChangeOriginal","s","circular","axis"],"mappings":"AAAA;;;;;;;;;;;;2CA+Iaa;;;IAjGAF,uBAAAA;;;uBAvBAL;;;;;iEArBU,QAAQ;gCACwD,4BAA4B;8BAStD,0BAA0B;AAWhF,MAAMA,sBAAsB,CAACC,OAAqBC;IACvD,MAAM,EAAEC,OAAO,QAAQ,EAAE,GAAGF;IAC5B,MAAMG,QAAQC,wBAAwBJ,OAAOC;IAC7C,MAAMI,uBAAuBC;IAE7B,OAAO;QACLJ;QACA,GAAGC,KAAK;QACRI,MAAM;YACJ,GAAGJ,MAAMI,IAAI;YACb,GAAGF,oBAAoB;QACzB;IACF;AACF,EAAE;AAUK,gCAAgC,CAACL,OAAyBC;IAC/D,MAAM,EAAEO,WAAW,KAAK,EAAE,GAAGR;IAE7B,MAAMS,eAA0C;QAC9CD;QACA,sCAAsC;QACtCE,YAAY;YACV,iDAAiD;YACjDH,MAAM;QACR;QACA,2CAA2C;QAC3C,0CAA0C;QAC1CA,MAAMV,oBAAAA,CAAKc,MAAM,KACff,wCAAAA,EAAyB,OAAO;YAC9BgB,MAAM;YACNX,KAAKA;YACL,GAAIO,YAAa;gBAAE,oBAAoB;YAAW,CAAW;YAC7D,GAAGR,KAAK;QACV,IACA;YAAEa,aAAa;QAAM;IAEzB;IAEA,MAAM,CAACC,eAAeC,qBAAqB,GAAGC,0BAA0B;QACtEF,eAAed,MAAMc,aAAa;QAClCG,sBAAsBjB,MAAMiB,oBAAoB;QAChDF,sBAAsBf,MAAMe,oBAAoB;IAClD;IAEA,MAAMG,yBAAsCxB,gCAAAA,EAC1C,CAACyB,GAA2CC,MAAcC,OAAeC;QACvE,IAAIF,QAAQC,OAAO;YACjB,MAAME,eAAeT,CAAAA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAe,CAACM,KAAAA,AAAK,KAAI,EAAE;YAChD,MAAMI,kBAAkB;mBAAID;aAAa;YACzC,IAAID,SAAS;gBACXE,gBAAgBC,MAAM,CAACD,gBAAgBE,OAAO,CAACL,QAAQ;YACzD,OAAO;gBACLG,gBAAgBG,IAAI,CAACN;YACvB;YACAN,yBAAAA,QAAAA,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAuBI,GAAG;gBAAEC;gBAAMG,cAAcC;YAAgB;QAClE;IACF;IAGF,MAAMI,kBAA+BlC,gCAAAA,EACnC,CAACyB,GAA2CC,MAAcC,OAAeC;QACvE,IAAIF,QAAQC,OAAO;YACjBN,yBAAAA,QAAAA,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAuBI,GAAG;gBACxBC;gBACAG,cAAc;oBAACF;iBAAM;YACvB;QACF;IACF;IAGF,OAAO;QACL,GAAGZ,YAAY;QACfS;QACAU;QACAd,eAAeA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,gBAAiB,CAAC;IACnC;AACF,EAAE;AAEF;;;CAGC,GACD,MAAME,4BAA4B,CAChCb;IAEA,MAAM,CAACW,eAAee,iBAAiB,OAAGlC,oCAAAA,EAAqB;QAC7DQ,OAAOA,MAAMW,aAAa;QAC1BgB,cAAc3B,MAAMc,oBAAoB;QACxCR,cAAc,CAAC;IACjB;IACA,MAAM,EAAEM,sBAAsBgB,4BAA4B,EAAE,GAAG5B;IAC/D,MAAMY,2BAAiErB,gCAAAA,EACrE,CAACyB,GAAG,EAAEC,IAAI,EAAEG,YAAY,EAAE;QACxB,IAAIQ,8BAA8B;YAChCA,6BAA6BZ,GAAG;gBAAEC;gBAAMG;YAAa;QACvD;QAEAM,iBAAiBG,CAAAA;YACf,OAAOA,IAAI;gBAAE,GAAGA,CAAC;gBAAE,CAACZ,KAAK,EAAEG;YAAa,IAAI;gBAAE,CAACH,KAAK,EAAEG;YAAa;QACrE;IACF;IAGF,OAAO;QAACT;QAAeC;KAAqB;AAC9C;AAQO,MAAMT,0CAA0C;IACrD,WAAOR,qCAAAA,EAAwB;QAC7BmC,UAAU;QACVC,MAAM;IACR;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarButton/ToolbarButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { ButtonProps, ButtonSlots, ButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarButton Props\n */\nexport type ToolbarButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ButtonProps, 'disabled' | 'disabledFocusable'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n } & {\n vertical?: boolean;\n };\n\n/**\n * State used in rendering ToolbarButton\n */\nexport type ToolbarButtonState = ComponentState<Partial<ButtonSlots>> &\n ButtonState &\n Required<Pick<ToolbarButtonProps, 'vertical'>>;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarButton/ToolbarButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport { ButtonProps, ButtonSlots, ButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarButton Props\n */\nexport type ToolbarButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ButtonProps, 'disabled' | 'disabledFocusable'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n } & {\n vertical?: boolean;\n };\n\nexport type ToolbarButtonBaseProps = DistributiveOmit<ToolbarButtonProps, 'appearance'>;\n\n/**\n * State used in rendering ToolbarButton\n */\nexport type ToolbarButtonState = ComponentState<Partial<ButtonSlots>> &\n ButtonState &\n Required<Pick<ToolbarButtonProps, 'vertical'>>;\n\nexport type ToolbarButtonBaseState = DistributiveOmit<ToolbarButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":""}
|
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
|
12
12
|
ToolbarButton: function() {
|
|
13
13
|
return _ToolbarButton.ToolbarButton;
|
|
14
14
|
},
|
|
15
|
+
useToolbarButtonBase_unstable: function() {
|
|
16
|
+
return _useToolbarButton.useToolbarButtonBase_unstable;
|
|
17
|
+
},
|
|
15
18
|
useToolbarButtonStyles_unstable: function() {
|
|
16
19
|
return _useToolbarButtonStylesstyles.useToolbarButtonStyles_unstable;
|
|
17
20
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarButton/index.ts"],"sourcesContent":["export { ToolbarButton } from './ToolbarButton';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarButton/index.ts"],"sourcesContent":["export { ToolbarButton } from './ToolbarButton';\nexport type {\n ToolbarButtonBaseProps,\n ToolbarButtonProps,\n ToolbarButtonBaseState,\n ToolbarButtonState,\n} from './ToolbarButton.types';\nexport { useToolbarButton_unstable, useToolbarButtonBase_unstable } from './useToolbarButton';\nexport { useToolbarButtonStyles_unstable } from './useToolbarButtonStyles.styles';\n"],"names":["ToolbarButton","useToolbarButton_unstable","useToolbarButtonBase_unstable","useToolbarButtonStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,4BAAa;;;eAOcE,+CAA6B;;;eACxDC,6DAA+B;;;eAD/BF,2CAAyB;;;+BAPJ,kBAAkB;kCAOyB,qBAAqB;8CAC9C,kCAAkC"}
|
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useToolbarButtonBase_unstable: function() {
|
|
14
|
+
return useToolbarButtonBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useToolbarButton_unstable: function() {
|
|
9
17
|
return useToolbarButton_unstable;
|
|
10
18
|
}
|
|
11
19
|
});
|
|
@@ -13,6 +21,15 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
13
21
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
22
|
const _reactbutton = require("@fluentui/react-button");
|
|
15
23
|
const useToolbarButton_unstable = (props, ref)=>{
|
|
24
|
+
const state = useToolbarButtonBase_unstable(props, ref);
|
|
25
|
+
return {
|
|
26
|
+
appearance: 'subtle',
|
|
27
|
+
size: 'medium',
|
|
28
|
+
shape: 'rounded',
|
|
29
|
+
...state
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const useToolbarButtonBase_unstable = (props, ref)=>{
|
|
16
33
|
const { vertical = false, ...buttonProps } = props;
|
|
17
34
|
const state = (0, _reactbutton.useButton_unstable)({
|
|
18
35
|
appearance: 'subtle',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarButton/useToolbarButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useButton_unstable } from '@fluentui/react-button';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarButton/useToolbarButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useButton_unstable } from '@fluentui/react-button';\nimport type {\n ToolbarButtonBaseProps,\n ToolbarButtonBaseState,\n ToolbarButtonProps,\n ToolbarButtonState,\n} from './ToolbarButton.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useToolbarButton_unstable = (\n props: ToolbarButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarButtonState => {\n const state = useToolbarButtonBase_unstable(props, ref);\n\n return {\n appearance: 'subtle',\n size: 'medium',\n shape: 'rounded',\n ...state,\n };\n};\n\n/**\n * Base hook that builds Toolbar Button state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useToolbarButtonBase_unstable = (\n props: ToolbarButtonBaseProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarButtonBaseState => {\n const { vertical = false, ...buttonProps } = props;\n const state = useButton_unstable(\n {\n appearance: 'subtle',\n ...buttonProps,\n size: 'medium',\n },\n ref,\n );\n\n return {\n vertical,\n ...state,\n };\n};\n"],"names":["React","useButton_unstable","useToolbarButton_unstable","props","ref","state","useToolbarButtonBase_unstable","appearance","size","shape","vertical","buttonProps"],"mappings":"AAAA;;;;;;;;;;;;iCAuCaM;eAAAA;;6BAtBAJ;;;;;iEAfU,QAAQ;6BACI,yBAAyB;AAcrD,MAAMA,4BAA4B,CACvCC,OACAC;IAEA,MAAMC,QAAQC,8BAA8BH,OAAOC;IAEnD,OAAO;QACLG,YAAY;QACZC,MAAM;QACNC,OAAO;QACP,GAAGJ,KAAK;IACV;AACF,EAAE;AAUK,sCAAsC,CAC3CF,OACAC;IAEA,MAAM,EAAEM,WAAW,KAAK,EAAE,GAAGC,aAAa,GAAGR;IAC7C,MAAME,YAAQJ,+BAAAA,EACZ;QACEM,YAAY;QACZ,GAAGI,WAAW;QACdH,MAAM;IACR,GACAJ;IAGF,OAAO;QACLM;QACA,GAAGL,KAAK;IACV;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarDivider/ToolbarDivider.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { DividerSlots, DividerState } from '@fluentui/react-divider';\n\n/**\n * ToolbarDivider Props\n */\nexport type ToolbarDividerProps = ComponentProps<Partial<DividerSlots>> & {\n /**\n * A divider can be horizontal or vertical (default).\n *\n * @default true\n */\n vertical?: boolean;\n};\n\n/**\n * State used in rendering ToolbarDivider\n */\nexport type ToolbarDividerState = ComponentState<Partial<DividerSlots>> & DividerState;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarDivider/ToolbarDivider.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { DividerSlots, DividerState } from '@fluentui/react-divider';\n\n/**\n * ToolbarDivider Props\n */\nexport type ToolbarDividerProps = ComponentProps<Partial<DividerSlots>> & {\n /**\n * A divider can be horizontal or vertical (default).\n *\n * @default true\n */\n vertical?: boolean;\n};\n\nexport type ToolbarDividerBaseProps = ToolbarDividerProps;\n\n/**\n * State used in rendering ToolbarDivider\n */\nexport type ToolbarDividerState = ComponentState<Partial<DividerSlots>> & DividerState;\n\nexport type ToolbarDividerBaseState = Omit<ToolbarDividerState, 'appearance'>;\n"],"names":[],"mappings":""}
|
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
|
12
12
|
ToolbarDivider: function() {
|
|
13
13
|
return _ToolbarDivider.ToolbarDivider;
|
|
14
14
|
},
|
|
15
|
+
useToolbarDividerBase_unstable: function() {
|
|
16
|
+
return _useToolbarDivider.useToolbarDividerBase_unstable;
|
|
17
|
+
},
|
|
15
18
|
useToolbarDividerStyles_unstable: function() {
|
|
16
19
|
return _useToolbarDividerStylesstyles.useToolbarDividerStyles_unstable;
|
|
17
20
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarDivider/index.ts"],"sourcesContent":["export { ToolbarDivider } from './ToolbarDivider';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarDivider/index.ts"],"sourcesContent":["export { ToolbarDivider } from './ToolbarDivider';\nexport type {\n ToolbarDividerBaseProps,\n ToolbarDividerProps,\n ToolbarDividerBaseState,\n ToolbarDividerState,\n} from './ToolbarDivider.types';\nexport { useToolbarDividerStyles_unstable } from './useToolbarDividerStyles.styles';\nexport { useToolbarDivider_unstable, useToolbarDividerBase_unstable } from './useToolbarDivider';\n"],"names":["ToolbarDivider","useToolbarDividerStyles_unstable","useToolbarDivider_unstable","useToolbarDividerBase_unstable"],"mappings":";;;;;;;;;;;;eAASA,8BAAc;;;eAQcG,iDAA8B;;;eAD1DF,+DAAgC;;;eAChCC,6CAA0B;;;gCARJ,mBAAmB;+CAOD,mCAAmC;mCACT,sBAAsB"}
|
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useToolbarDividerBase_unstable: function() {
|
|
14
|
+
return useToolbarDividerBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useToolbarDivider_unstable: function() {
|
|
9
17
|
return useToolbarDivider_unstable;
|
|
10
18
|
}
|
|
11
19
|
});
|
|
@@ -14,6 +22,13 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
|
14
22
|
const _reactdivider = require("@fluentui/react-divider");
|
|
15
23
|
const _ToolbarContext = require("../Toolbar/ToolbarContext");
|
|
16
24
|
const useToolbarDivider_unstable = (props, ref)=>{
|
|
25
|
+
const state = useToolbarDividerBase_unstable(props, ref);
|
|
26
|
+
return {
|
|
27
|
+
...state,
|
|
28
|
+
appearance: 'default'
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const useToolbarDividerBase_unstable = (props, ref)=>{
|
|
17
32
|
const vertical = (0, _ToolbarContext.useToolbarContext_unstable)((ctx)=>ctx.vertical);
|
|
18
33
|
return (0, _reactdivider.useDivider_unstable)({
|
|
19
34
|
vertical: !vertical,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarDivider/useToolbarDivider.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarDivider/useToolbarDivider.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type {\n ToolbarDividerBaseProps,\n ToolbarDividerBaseState,\n ToolbarDividerProps,\n ToolbarDividerState,\n} from './ToolbarDivider.types';\nimport { useDivider_unstable } from '@fluentui/react-divider';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\n\n/**\n * Create the state required to render ToolbarDivider.\n *\n * The returned state can be modified with hooks such as useToolbarDividerStyles_unstable,\n * before being passed to renderToolbar_unstable.\n *\n * @param props - props from this instance of ToolbarDivider\n * @param ref - reference to root HTMLElement of ToolbarDivider\n */\nexport const useToolbarDivider_unstable = (\n props: ToolbarDividerProps,\n ref: React.Ref<HTMLElement>,\n): ToolbarDividerState => {\n const state = useToolbarDividerBase_unstable(props, ref);\n return {\n ...state,\n appearance: 'default',\n };\n};\n\n/**\n * Base hook that builds ToolbarDivider state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - props from this instance of ToolbarDivider\n * @param ref - reference to root HTMLElement of ToolbarDivider\n */\nexport const useToolbarDividerBase_unstable = (\n props: ToolbarDividerBaseProps,\n ref: React.Ref<HTMLElement>,\n): ToolbarDividerBaseState => {\n const vertical = useToolbarContext_unstable(ctx => ctx.vertical);\n return useDivider_unstable({ vertical: !vertical, ...props }, ref);\n};\n"],"names":["React","useDivider_unstable","useToolbarContext_unstable","useToolbarDivider_unstable","props","ref","state","useToolbarDividerBase_unstable","appearance","vertical","ctx"],"mappings":"AAAA;;;;;;;;;;;;kCAwCaO;;;8BAnBAJ;;;;;iEAnBU,QAAQ;8BAOK,0BAA0B;gCACnB,4BAA4B;AAWhE,MAAMA,6BAA6B,CACxCC,OACAC;IAEA,MAAMC,QAAQC,+BAA+BH,OAAOC;IACpD,OAAO;QACL,GAAGC,KAAK;QACRE,YAAY;IACd;AACF,EAAE;AAUK,MAAMD,iCAAiC,CAC5CH,OACAC;IAEA,MAAMI,eAAWP,0CAAAA,EAA2BQ,CAAAA,MAAOA,IAAID,QAAQ;IAC/D,WAAOR,iCAAAA,EAAoB;QAAEQ,UAAU,CAACA;QAAU,GAAGL,KAAK;IAAC,GAAGC;AAChE,EAAE"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
toolbarGroupClassNames: function() {
|
|
19
19
|
return _useToolbarGroupStylesstyles.toolbarGroupClassNames;
|
|
20
20
|
},
|
|
21
|
+
useToolbarGroupBase_unstable: function() {
|
|
22
|
+
return _useToolbarGroup.useToolbarGroupBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useToolbarGroupStyles_unstable: function() {
|
|
22
25
|
return _useToolbarGroupStylesstyles.useToolbarGroupStyles_unstable;
|
|
23
26
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarGroup/index.ts"],"sourcesContent":["export { ToolbarGroup } from './ToolbarGroup';\nexport type { ToolbarGroupProps, ToolbarGroupSlots, ToolbarGroupState } from './ToolbarGroup.types';\nexport { useToolbarGroup_unstable } from './useToolbarGroup';\nexport { toolbarGroupClassNames, useToolbarGroupStyles_unstable } from './useToolbarGroupStyles.styles';\nexport { renderToolbarGroup_unstable } from './renderToolbarGroup';\n"],"names":["ToolbarGroup","useToolbarGroup_unstable","toolbarGroupClassNames","useToolbarGroupStyles_unstable","renderToolbarGroup_unstable"],"mappings":";;;;;;;;;;;;eAASA,0BAAY;;;
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarGroup/index.ts"],"sourcesContent":["export { ToolbarGroup } from './ToolbarGroup';\nexport type { ToolbarGroupProps, ToolbarGroupSlots, ToolbarGroupState } from './ToolbarGroup.types';\nexport { useToolbarGroup_unstable, useToolbarGroupBase_unstable } from './useToolbarGroup';\nexport { toolbarGroupClassNames, useToolbarGroupStyles_unstable } from './useToolbarGroupStyles.styles';\nexport { renderToolbarGroup_unstable } from './renderToolbarGroup';\n"],"names":["ToolbarGroup","useToolbarGroup_unstable","useToolbarGroupBase_unstable","toolbarGroupClassNames","useToolbarGroupStyles_unstable","renderToolbarGroup_unstable"],"mappings":";;;;;;;;;;;;eAASA,0BAAY;;;eAIZK,+CAA2B;;;eAD3BF,mDAAsB;;;eADID,6CAA4B;;;eAC9BE,2DAA8B;;;eADtDH,yCAAwB;;;8BAFJ,iBAAiB;iCAEyB,oBAAoB;6CACpB,iCAAiC;oCAC5D,uBAAuB"}
|
|
@@ -3,17 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useToolbarGroupBase_unstable: function() {
|
|
14
|
+
return useToolbarGroupBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useToolbarGroup_unstable: function() {
|
|
9
17
|
return useToolbarGroup_unstable;
|
|
10
18
|
}
|
|
11
19
|
});
|
|
12
20
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
|
-
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
21
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
15
23
|
const _ToolbarContext = require("../Toolbar/ToolbarContext");
|
|
16
24
|
const useToolbarGroup_unstable = (props, ref)=>{
|
|
25
|
+
return useToolbarGroupBase_unstable(props, ref);
|
|
26
|
+
};
|
|
27
|
+
const useToolbarGroupBase_unstable = (props, ref)=>{
|
|
17
28
|
const vertical = (0, _ToolbarContext.useToolbarContext_unstable)((ctx)=>ctx.vertical);
|
|
18
29
|
return {
|
|
19
30
|
components: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarGroup/useToolbarGroup.ts"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarGroup/useToolbarGroup.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport type { ToolbarGroupProps, ToolbarGroupState } from './ToolbarGroup.types';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\n\n/**\n * Given user props, defines default props for the Group\n * @param props - User provided props to the Group component.\n * @param ref - User provided ref to be passed to the Group component.\n */\nexport const useToolbarGroup_unstable = (\n props: ToolbarGroupProps,\n ref: React.Ref<HTMLDivElement>,\n): ToolbarGroupState => {\n return useToolbarGroupBase_unstable(props, ref);\n};\n\n/**\n * Base hook that builds Toolbar Group state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - User provided props to the Group component.\n * @param ref - User provided ref to be passed to the Group component.\n */\nexport const useToolbarGroupBase_unstable = (\n props: ToolbarGroupProps,\n ref: React.Ref<HTMLDivElement>,\n): ToolbarGroupState => {\n const vertical = useToolbarContext_unstable(ctx => ctx.vertical);\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps<React.HTMLAttributes<HTMLDivElement>>('div', {\n ref,\n role: 'presentation',\n ...props,\n }),\n { elementType: 'div' },\n ),\n vertical,\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useToolbarContext_unstable","useToolbarGroup_unstable","props","ref","useToolbarGroupBase_unstable","vertical","ctx","components","root","always","role","elementType"],"mappings":"AAAA;;;;;;;;;;;;gCA4BaO;eAAAA;;4BAfAH;;;;;iEAXU,QAAQ;gCAGgB,4BAA4B;gCAChC,4BAA4B;AAOhE,MAAMA,2BAA2B,CACtCC,OACAC;IAEA,OAAOC,6BAA6BF,OAAOC;AAC7C,EAAE;AAUK,qCAAqC,CAC1CD,OACAC;IAEA,MAAME,eAAWL,0CAAAA,EAA2BM,CAAAA,MAAOA,IAAID,QAAQ;IAE/D,OAAO;QACLE,YAAY;YACVC,MAAM;QACR;QACAA,MAAMT,oBAAAA,CAAKU,MAAM,KACfX,wCAAAA,EAA+D,OAAO;YACpEK;YACAO,MAAM;YACN,GAAGR,KAAK;QACV,IACA;YAAES,aAAa;QAAM;QAEvBN;IACF;AACF,EAAE"}
|