@fluentui/react-tree 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.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 +77 -19
- package/README.md +12 -0
- package/lib/components/FlatTree/FlatTree.js.map +1 -1
- package/lib/components/FlatTree/FlatTree.module.css +7 -0
- package/lib/components/FlatTree/FlatTree.types.js.map +1 -1
- package/lib/components/FlatTree/index.js.map +1 -1
- package/lib/components/FlatTree/renderFlatTree.js.map +1 -1
- package/lib/components/FlatTree/useFlatControllableCheckedItems.js.map +1 -1
- package/lib/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib/components/FlatTree/useFlatTreeContextValues.js.map +1 -1
- package/lib/components/FlatTree/useFlatTreeStyles.styles.css.js +9 -0
- package/lib/components/FlatTree/useFlatTreeStyles.styles.css.js.map +1 -0
- package/lib/components/FlatTree/useFlatTreeStyles.styles.raw.css.js +9 -0
- package/lib/components/FlatTree/useFlatTreeStyles.styles.raw.css.js.map +1 -0
- package/lib/components/FlatTree/useFlatTreeStyles.styles.raw.js.map +1 -1
- package/lib/components/FlatTree/useHeadlessFlatTree.js.map +1 -1
- package/lib/components/FlatTreeItem/FlatTreeItem.js.map +1 -1
- package/lib/components/FlatTreeItem/FlatTreeItem.types.js.map +1 -1
- package/lib/components/FlatTreeItem/index.js.map +1 -1
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/Tree.module.css +11 -0
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/Tree/renderTree.js +2 -2
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/components/Tree/useNestedControllableCheckedItems.js.map +1 -1
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/Tree/useTreeStyles.styles.css.js +9 -0
- package/lib/components/Tree/useTreeStyles.styles.css.js.map +1 -0
- package/lib/components/Tree/useTreeStyles.styles.raw.css.js +9 -0
- package/lib/components/Tree/useTreeStyles.styles.raw.css.js.map +1 -0
- package/lib/components/Tree/useTreeStyles.styles.raw.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.module.css +65 -0
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/index.js.map +1 -1
- package/lib/components/TreeItem/renderTreeItem.js +2 -2
- package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +1 -1
- package/lib/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemStyles.styles.css.js +17 -0
- package/lib/components/TreeItem/useTreeItemStyles.styles.css.js.map +1 -0
- package/lib/components/TreeItem/useTreeItemStyles.styles.raw.css.js +17 -0
- package/lib/components/TreeItem/useTreeItemStyles.styles.raw.css.js.map +1 -0
- package/lib/components/TreeItem/useTreeItemStyles.styles.raw.js.map +1 -1
- package/lib/components/TreeItemChevron.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.module.css +137 -0
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib/components/TreeItemLayout/index.js.map +1 -1
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js +2 -2
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.js +51 -0
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.js.map +1 -0
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.css.js +51 -0
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.css.js.map +1 -0
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.module.css +149 -0
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/index.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +2 -2
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.css.js +51 -0
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.css.js.map +1 -0
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.css.js +51 -0
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.css.js.map +1 -0
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.js.map +1 -1
- package/lib/components/TreeProvider.js.map +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/subtreeContext.js.map +1 -1
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/contexts/treeItemContext.js.map +1 -1
- package/lib/hooks/useControllableOpenItems.js.map +1 -1
- package/lib/hooks/useFlatTreeNavigation.js.map +1 -1
- package/lib/hooks/useHTMLElementWalkerRef.js.map +1 -1
- package/lib/hooks/useRootTree.js +1 -1
- package/lib/hooks/useRootTree.js.map +1 -1
- package/lib/hooks/useRovingTabIndexes.js.map +1 -1
- package/lib/hooks/useSubtree.js.map +1 -1
- package/lib/hooks/useTreeNavigation.js.map +1 -1
- package/lib/utils/ImmutableMap.js.map +1 -1
- package/lib/utils/ImmutableSet.js.map +1 -1
- package/lib/utils/assert.js.map +1 -1
- package/lib/utils/createCheckedItems.js.map +1 -1
- package/lib/utils/createHTMLElementWalker.js +2 -2
- package/lib/utils/createHTMLElementWalker.js.map +1 -1
- package/lib/utils/createHeadlessTree.js +4 -4
- package/lib/utils/createHeadlessTree.js.map +1 -1
- package/lib/utils/flattenTree.js.map +1 -1
- package/lib/utils/getTreeItemValueFromElement.js.map +1 -1
- package/lib/utils/nextTypeAheadElement.js.map +1 -1
- package/lib/utils/normalizeOpenItems.js.map +1 -1
- package/lib/utils/tokens.js.map +1 -1
- package/lib/utils/treeItemFilter.js.map +1 -1
- package/lib-commonjs/FlatTree.cjs +8 -8
- package/lib-commonjs/Tree.cjs +7 -7
- package/lib-commonjs/TreeItem.cjs +7 -7
- package/lib-commonjs/TreeItemLayout.cjs +6 -6
- package/lib-commonjs/TreeItemPersonaLayout.cjs +6 -6
- package/lib-commonjs/components/FlatTree/FlatTree.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/FlatTree.module.css +7 -0
- package/lib-commonjs/components/FlatTree/FlatTree.types.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/index.cjs +8 -8
- package/lib-commonjs/components/FlatTree/index.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/renderFlatTree.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.cjs +3 -3
- package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTree.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTreeContextValues.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.cjs +3 -3
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.css.cjs +28 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.raw.css.cjs +28 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.cjs.map +1 -1
- package/lib-commonjs/components/FlatTreeItem/FlatTreeItem.cjs.map +1 -1
- package/lib-commonjs/components/FlatTreeItem/FlatTreeItem.types.cjs.map +1 -1
- package/lib-commonjs/components/FlatTreeItem/index.cjs.map +1 -1
- package/lib-commonjs/components/Tree/Tree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/Tree.module.css +11 -0
- package/lib-commonjs/components/Tree/Tree.types.cjs.map +1 -1
- package/lib-commonjs/components/Tree/index.cjs +7 -7
- package/lib-commonjs/components/Tree/index.cjs.map +1 -1
- package/lib-commonjs/components/Tree/renderTree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useNestedControllableCheckedItems.cjs +3 -3
- package/lib-commonjs/components/Tree/useNestedControllableCheckedItems.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTreeStyles.styles.cjs +3 -3
- package/lib-commonjs/components/Tree/useTreeStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTreeStyles.styles.css.cjs +28 -0
- package/lib-commonjs/components/Tree/useTreeStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/Tree/useTreeStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/Tree/useTreeStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTreeStyles.styles.raw.css.cjs +28 -0
- package/lib-commonjs/components/Tree/useTreeStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/TreeItem/TreeItem.cjs.map +1 -1
- package/lib-commonjs/components/TreeItem/TreeItem.module.css +65 -0
- package/lib-commonjs/components/TreeItem/TreeItem.types.cjs.map +1 -1
- package/lib-commonjs/components/TreeItem/index.cjs +7 -7
- package/lib-commonjs/components/TreeItem/index.cjs.map +1 -1
- package/lib-commonjs/components/TreeItem/renderTreeItem.cjs.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.cjs +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.cjs.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.cjs.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.cjs +3 -3
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.css.cjs +36 -0
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.raw.css.cjs +36 -0
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/TreeItemChevron.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.module.css +137 -0
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/index.cjs +6 -6
- package/lib-commonjs/components/TreeItemLayout/index.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.cjs +3 -3
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.cjs +70 -0
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.css.cjs +70 -0
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.module.css +149 -0
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/index.cjs +6 -6
- package/lib-commonjs/components/TreeItemPersonaLayout/index.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.cjs +3 -3
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.css.cjs +70 -0
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.css.cjs +70 -0
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/TreeProvider.cjs +3 -3
- package/lib-commonjs/components/TreeProvider.cjs.map +1 -1
- package/lib-commonjs/contexts/index.cjs +7 -7
- package/lib-commonjs/contexts/index.cjs.map +1 -1
- package/lib-commonjs/contexts/subtreeContext.cjs +3 -3
- package/lib-commonjs/contexts/subtreeContext.cjs.map +1 -1
- package/lib-commonjs/contexts/treeContext.cjs +3 -3
- package/lib-commonjs/contexts/treeContext.cjs.map +1 -1
- package/lib-commonjs/contexts/treeItemContext.cjs +3 -3
- package/lib-commonjs/contexts/treeItemContext.cjs.map +1 -1
- package/lib-commonjs/hooks/useControllableOpenItems.cjs +3 -3
- package/lib-commonjs/hooks/useControllableOpenItems.cjs.map +1 -1
- package/lib-commonjs/hooks/useFlatTreeNavigation.cjs.map +1 -1
- package/lib-commonjs/hooks/useHTMLElementWalkerRef.cjs.map +1 -1
- package/lib-commonjs/hooks/useRootTree.cjs +1 -1
- package/lib-commonjs/hooks/useRootTree.cjs.map +1 -1
- package/lib-commonjs/hooks/useRovingTabIndexes.cjs.map +1 -1
- package/lib-commonjs/hooks/useSubtree.cjs.map +1 -1
- package/lib-commonjs/hooks/useTreeNavigation.cjs.map +1 -1
- package/lib-commonjs/index.cjs +40 -40
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/utils/ImmutableMap.cjs.map +1 -1
- package/lib-commonjs/utils/ImmutableSet.cjs.map +1 -1
- package/lib-commonjs/utils/assert.cjs.map +1 -1
- package/lib-commonjs/utils/createCheckedItems.cjs.map +1 -1
- package/lib-commonjs/utils/createHTMLElementWalker.cjs +2 -2
- package/lib-commonjs/utils/createHTMLElementWalker.cjs.map +1 -1
- package/lib-commonjs/utils/createHeadlessTree.cjs +7 -7
- package/lib-commonjs/utils/createHeadlessTree.cjs.map +1 -1
- package/lib-commonjs/utils/flattenTree.cjs.map +1 -1
- package/lib-commonjs/utils/getTreeItemValueFromElement.cjs +3 -3
- package/lib-commonjs/utils/getTreeItemValueFromElement.cjs.map +1 -1
- package/lib-commonjs/utils/nextTypeAheadElement.cjs.map +1 -1
- package/lib-commonjs/utils/normalizeOpenItems.cjs.map +1 -1
- package/lib-commonjs/utils/tokens.cjs +4 -4
- package/lib-commonjs/utils/tokens.cjs.map +1 -1
- package/lib-commonjs/utils/treeItemFilter.cjs.map +1 -1
- package/package.json +22 -22
- package/dist/metadata/api/api-root.json +0 -1
- package/dist/metadata/index.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TreeItemLayout/renderTreeItemLayout.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TreeItemLayoutState, TreeItemLayoutSlots } from './TreeItemLayout.types';\nimport { ButtonContextProvider } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of TreeItemLayout\n */\nexport const renderTreeItemLayout_unstable = (state: TreeItemLayoutState): JSXElement => {\n assertSlots<TreeItemLayoutSlots>(state);\n\n return (\n <state.root>\n {state.expandIcon && <state.expandIcon />}\n {state.selector && <state.selector />}\n {state.iconBefore && <state.iconBefore />}\n <state.main>{state.root.children}</state.main>\n {state.iconAfter && <state.iconAfter />}\n <ButtonContextProvider value={state.buttonContextValue}>\n {state.actions && <state.actions />}\n {state.aside && <state.aside />}\n </ButtonContextProvider>\n </state.root>\n );\n};\n"],"names":["assertSlots","ButtonContextProvider","renderTreeItemLayout_unstable","state","root","expandIcon","selector","iconBefore","main","children","iconAfter","value","buttonContextValue","actions","aside"],"mappings":";;;;+BAUaE;;;;;;;gCATb,gDAAiD,GACjD,SAASF,WAAW,QAAQ,4BAA4B;6BAGlB,yBAAyB;AAKxD,sCAAsC,CAACG;QAC5CH,2BAAAA,EAAiCG;IAEjC,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,UAAU,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,UAAU,EAAA,CAAA;YACrCF,MAAMG,QAAQ,IAAA,WAAA,GAAI,mBAAA,EAACH,MAAMG,QAAQ,EAAA,CAAA;YACjCH,MAAMI,UAAU,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,UAAU,EAAA,CAAA;8BACtC,eAAA,EAACJ,MAAMK,IAAI,EAAA;0BAAEL,MAAMC,IAAI,CAACK,QAAQ;;YAC/BN,MAAMO,SAAS,IAAA,WAAA,OAAI,eAAA,EAACP,MAAMO,SAAS,EAAA,CAAA;8BACpC,gBAAA,EAACT,kCAAAA,EAAAA;gBAAsBU,OAAOR,MAAMS,kBAAkB;;oBACnDT,MAAMU,OAAO,IAAA,WAAA,OAAI,eAAA,EAACV,MAAMU,OAAO,EAAA,CAAA;oBAC/BV,MAAMW,KAAK,IAAA,WAAA,OAAI,eAAA,EAACX,MAAMW,KAAK,EAAA,CAAA;;;;;AAIpC,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TreeItemLayout/useTreeItemLayout.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isResolvedShorthand,\n useMergedRefs,\n slot,\n useEventCallback,\n elementContains,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport { useTreeItemContext_unstable, useTreeContext_unstable } from '../../contexts';\nimport type {\n TreeItemLayoutActionSlotProps,\n TreeItemLayoutActionVisibilityChangeData,\n TreeItemLayoutProps,\n TreeItemLayoutState,\n} from './TreeItemLayout.types';\nimport type { CheckboxProps } from '@fluentui/react-checkbox';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport type { RadioProps } from '@fluentui/react-radio';\nimport { Radio } from '@fluentui/react-radio';\nimport { TreeItemChevron } from '../TreeItemChevron';\nimport { useArrowNavigationGroup, useIsNavigatingWithKeyboard } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render TreeItemLayout.\n *\n * The returned state can be modified with hooks such as useTreeItemLayoutStyles_unstable,\n * before being passed to renderTreeItemLayout_unstable.\n *\n * @param props - props from this instance of TreeItemLayout\n * @param ref - reference to root HTMLElement of TreeItemLayout\n */\nexport const useTreeItemLayout_unstable = (\n props: TreeItemLayoutProps,\n ref: React.Ref<HTMLElement>,\n): TreeItemLayoutState => {\n const { main, iconAfter, iconBefore } = props;\n\n const layoutRef = useTreeItemContext_unstable(ctx => ctx.layoutRef);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n const navigationMode = useTreeContext_unstable(ctx => ctx.navigationMode ?? 'tree');\n\n const [isActionsVisibleFromProps, onActionVisibilityChange]: [\n TreeItemLayoutActionSlotProps['visible'],\n TreeItemLayoutActionSlotProps['onVisibilityChange'],\n ] = isResolvedShorthand(props.actions)\n ? // .visible .onVisibilityChange prop should not be propagated to the DOM\n [props.actions.visible, props.actions.onVisibilityChange]\n : [undefined, undefined];\n\n const [isActionsVisible, setIsActionsVisible] = useControllableState({\n state: isActionsVisibleFromProps,\n initialState: false,\n });\n\n const selectionRef = useTreeItemContext_unstable(ctx => ctx.selectionRef);\n const expandIconRef = useTreeItemContext_unstable(ctx => ctx.expandIconRef);\n const actionsRef = useTreeItemContext_unstable(ctx => ctx.actionsRef);\n const actionsRefInternal = React.useRef<HTMLDivElement>(null);\n const treeItemRef = useTreeItemContext_unstable(ctx => ctx.treeItemRef);\n const subtreeRef = useTreeItemContext_unstable(ctx => ctx.subtreeRef);\n const checked = useTreeItemContext_unstable(ctx => ctx.checked);\n const isBranch = useTreeItemContext_unstable(ctx => ctx.itemType === 'branch');\n\n const mainShorthand = isResolvedShorthand(main) ? main : undefined;\n const mainContentId = useId('fui-TreeItemLayout__main-', mainShorthand?.id);\n\n // Link the selector to the main content unless the consumer provided an accessible name\n const selectorShorthand = isResolvedShorthand(props.selector) ? props.selector : undefined;\n const selectorAriaLabelledBy =\n selectorShorthand?.['aria-label'] || selectorShorthand?.['aria-labelledby'] ? undefined : mainContentId;\n\n const selector = slot.optional(props.selector, {\n renderByDefault: selectionMode !== 'none',\n defaultProps: {\n checked,\n tabIndex: -1,\n ref: selectionRef,\n 'aria-labelledby': selectorAriaLabelledBy,\n // casting here to a union between checkbox and radio\n // since ref is not present on the selector signature\n // FIXME: look into Slot type to see if we can make this work\n } as CheckboxProps | RadioProps,\n elementType: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n });\n const mainSlot = slot.always(main, {\n defaultProps: { id: selector ? mainContentId : undefined },\n elementType: 'div',\n });\n\n // FIXME: Asserting is required here, as converting this to RefObject on context type would be a breaking change\n // eslint-disable-next-line react-hooks/refs\n assertIsRefObject(treeItemRef);\n // FIXME: Asserting is required here, as converting this to RefObject on context type would be a breaking change\n // eslint-disable-next-line react-hooks/refs\n assertIsRefObject(subtreeRef);\n\n const setActionsVisibleIfNotFromSubtree = React.useCallback(\n (event: MouseEvent | FocusEvent) => {\n const isTargetFromSubtree = Boolean(\n subtreeRef.current && elementContains(subtreeRef.current, event.target as Node),\n );\n if (!isTargetFromSubtree) {\n onActionVisibilityChange?.(event, {\n visible: true,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(true);\n }\n },\n [subtreeRef, setIsActionsVisible, onActionVisibilityChange],\n );\n\n const { targetDocument } = useFluent();\n const isNavigatingWithKeyboard = useIsNavigatingWithKeyboard();\n\n const setActionsInvisibleIfNotFromSubtree = React.useCallback(\n (event: FocusEvent | MouseEvent) => {\n const isRelatedTargetFromActions = () =>\n Boolean(actionsRefInternal.current && elementContains(actionsRefInternal.current, event.relatedTarget as Node));\n const isRelatedTargetFromTreeItem = () =>\n Boolean(treeItemRef.current && elementContains(treeItemRef.current, event.relatedTarget as Node));\n const isTargetFromActions = () => Boolean(actionsRefInternal.current?.contains(event.target as Node));\n if (isRelatedTargetFromActions()) {\n onActionVisibilityChange?.(event, {\n visible: true,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(true);\n return;\n }\n if (isTargetFromActions() && isRelatedTargetFromTreeItem()) {\n return;\n }\n // when a mouseout event happens during keyboard interaction\n // we should not hide the actions if the activeElement is the treeitem or an action\n // as the focus on the treeitem takes precedence over the mouseout event\n if (\n event.type === 'mouseout' &&\n isNavigatingWithKeyboard() &&\n (targetDocument?.activeElement === treeItemRef.current ||\n elementContains(actionsRefInternal.current, targetDocument?.activeElement as Node))\n ) {\n return;\n }\n onActionVisibilityChange?.(event, {\n visible: false,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(false);\n },\n [setIsActionsVisible, onActionVisibilityChange, treeItemRef, isNavigatingWithKeyboard, targetDocument],\n );\n\n const expandIconRefs = useMergedRefs(expandIconRef);\n const expandIcon = slot.optional(props.expandIcon, {\n renderByDefault: isBranch,\n defaultProps: {\n children: <TreeItemChevron />,\n 'aria-hidden': true,\n ref: expandIconRefs,\n },\n elementType: 'div',\n });\n const arrowNavigationProps = useArrowNavigationGroup({ circular: navigationMode === 'tree', axis: 'horizontal' });\n\n const handleActionsBlur = useEventCallback((event: React.FocusEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.actions)) {\n props.actions.onBlur?.(event);\n }\n const isRelatedTargetFromActions = Boolean(elementContains(event.currentTarget, event.relatedTarget as Node));\n onActionVisibilityChange?.(event, {\n visible: isRelatedTargetFromActions,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n setIsActionsVisible(isRelatedTargetFromActions);\n });\n\n const actionsRefs = useMergedRefs(actionsRef, actionsRefInternal);\n const actions = isActionsVisible\n ? slot.optional(props.actions, {\n defaultProps: {\n ...arrowNavigationProps,\n role: 'toolbar',\n ref: actionsRefs,\n onBlur: handleActionsBlur,\n },\n elementType: 'div',\n })\n : undefined;\n\n const hasActions = Boolean(props.actions);\n\n React.useEffect(() => {\n if (treeItemRef.current && hasActions) {\n const treeItemElement = treeItemRef.current;\n\n const handleMouseOver = setActionsVisibleIfNotFromSubtree;\n const handleMouseOut = setActionsInvisibleIfNotFromSubtree;\n const handleFocus = setActionsVisibleIfNotFromSubtree;\n const handleBlur = setActionsInvisibleIfNotFromSubtree;\n\n treeItemElement.addEventListener('mouseover', handleMouseOver);\n treeItemElement.addEventListener('mouseout', handleMouseOut);\n treeItemElement.addEventListener('focus', handleFocus);\n treeItemElement.addEventListener('blur', handleBlur);\n\n return () => {\n treeItemElement.removeEventListener('mouseover', handleMouseOver);\n treeItemElement.removeEventListener('mouseout', handleMouseOut);\n treeItemElement.removeEventListener('focus', handleFocus);\n treeItemElement.removeEventListener('blur', handleBlur);\n };\n }\n }, [hasActions, treeItemRef, setActionsVisibleIfNotFromSubtree, setActionsInvisibleIfNotFromSubtree]);\n\n return {\n components: {\n root: 'div',\n expandIcon: 'div',\n iconBefore: 'div',\n main: 'div',\n iconAfter: 'div',\n actions: 'div',\n aside: 'div',\n // Casting here to a union between checkbox and radio\n selector: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n },\n buttonContextValue: { size: 'small' },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ...props,\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, layoutRef) as React.Ref<HTMLDivElement>,\n }),\n {\n elementType: 'div',\n },\n ),\n iconBefore: slot.optional(iconBefore, { elementType: 'div' }),\n main: mainSlot,\n iconAfter: slot.optional(iconAfter, { elementType: 'div' }),\n aside: !isActionsVisible ? slot.optional(props.aside, { elementType: 'div' }) : undefined,\n actions,\n expandIcon,\n selector,\n };\n};\n\nfunction assertIsRefObject<Value>(ref?: React.Ref<Value>): asserts ref is React.RefObject<Value> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof ref !== 'object' || ref === null || !('current' in ref)) {\n throw new Error(`\n @fluentui/react-tree [${useTreeItemLayout_unstable.name}]:\n Internal Error: contextual ref is not a RefObject! Please report this bug immediately, as contextual refs should be RefObjects.\n `);\n }\n }\n}\n"],"names":["React","getIntrinsicElementProps","isResolvedShorthand","useMergedRefs","slot","useEventCallback","elementContains","useControllableState","useId","useTreeItemContext_unstable","useTreeContext_unstable","Checkbox","Radio","TreeItemChevron","useArrowNavigationGroup","useIsNavigatingWithKeyboard","useFluent_unstable","useFluent","useTreeItemLayout_unstable","props","ref","main","iconAfter","iconBefore","layoutRef","ctx","selectionMode","navigationMode","isActionsVisibleFromProps","onActionVisibilityChange","actions","visible","onVisibilityChange","undefined","isActionsVisible","setIsActionsVisible","state","initialState","selectionRef","expandIconRef","actionsRef","actionsRefInternal","useRef","treeItemRef","subtreeRef","checked","isBranch","itemType","mainShorthand","mainContentId","id","selectorShorthand","selector","selectorAriaLabelledBy","optional","renderByDefault","defaultProps","tabIndex","elementType","mainSlot","always","assertIsRefObject","setActionsVisibleIfNotFromSubtree","useCallback","event","isTargetFromSubtree","Boolean","current","target","type","defaultPrevented","targetDocument","isNavigatingWithKeyboard","setActionsInvisibleIfNotFromSubtree","isRelatedTargetFromActions","relatedTarget","isRelatedTargetFromTreeItem","isTargetFromActions","contains","activeElement","expandIconRefs","expandIcon","children","arrowNavigationProps","circular","axis","handleActionsBlur","onBlur","currentTarget","actionsRefs","role","hasActions","useEffect","treeItemElement","handleMouseOver","handleMouseOut","handleFocus","handleBlur","addEventListener","removeEventListener","components","root","aside","buttonContextValue","size","process","env","NODE_ENV","Error","name"],"mappings":"AAAA;;;;;+BAqCakB;;;;;;;iEAnCU,QAAQ;gCAUxB,4BAA4B;uBACkC,0BAAiB;+BAQ7D,2BAA2B;4BAE9B,wBAAwB;iCACd,wBAAqB;8BACgB,0BAA0B;qCAC/C,kCAAkC;AAW3E,mCAAmC,CACxCC,OACAC;IAEA,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAE,GAAGJ;IAExC,MAAMK,YAAYf,sCAAAA,EAA4BgB,CAAAA,MAAOA,IAAID,SAAS;IAClE,MAAME,oBAAgBhB,8BAAAA,EAAwBe,CAAAA,MAAOA,IAAIC,aAAa;IACtE,MAAMC,qBAAiBjB,8BAAAA,EAAwBe,CAAAA;YAAOA;eAAAA,uBAAAA,IAAIE,cAAAA,AAAc,MAAA,QAAlBF,wBAAAA,KAAAA,IAAAA,sBAAsB;;IAE5E,MAAM,CAACG,2BAA2BC,yBAAyB,OAGvD3B,mCAAAA,EAAoBiB,MAAMW,OAAO,IAEjC;QAACX,MAAMW,OAAO,CAACC,OAAO;QAAEZ,MAAMW,OAAO,CAACE,kBAAkB;KAAC,GACzD;QAACC;QAAWA;KAAU;IAE1B,MAAM,CAACC,kBAAkBC,oBAAoB,OAAG5B,oCAAAA,EAAqB;QACnE6B,OAAOR;QACPS,cAAc;IAChB;IAEA,MAAMC,mBAAe7B,kCAAAA,EAA4BgB,CAAAA,MAAOA,IAAIa,YAAY;IACxE,MAAMC,oBAAgB9B,kCAAAA,EAA4BgB,CAAAA,MAAOA,IAAIc,aAAa;IAC1E,MAAMC,iBAAa/B,kCAAAA,EAA4BgB,CAAAA,MAAOA,IAAIe,UAAU;IACpE,MAAMC,qBAAqBzC,OAAM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AAM;YACNC,WAAW;YACXQ,SAAS;YACTwE,OAAO;YACP,qDAAqD;YACrDlD,UAAW1B,kBAAkB,gBAAgBf,uBAAAA,GAAWC,iBAAAA;QAC1D;QACA2F,oBAAoB;YAAEC,MAAM;QAAQ;QACpCH,MAAMjG,oBAAAA,CAAKwD,MAAM,KACf3D,wCAAAA,EAAyB,OAAO;YAC9B,GAAGkB,KAAK;YACR,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FC,SAAKjB,6BAAAA,EAAciB,KAAKI;QAC1B,IACA;YACEkC,aAAa;QACf;QAEFnC,YAAYnB,oBAAAA,CAAKkD,QAAQ,CAAC/B,YAAY;YAAEmC,aAAa;QAAM;QAC3DrC,MAAMsC;QACNrC,WAAWlB,oBAAAA,CAAKkD,QAAQ,CAAChC,WAAW;YAAEoC,aAAa;QAAM;QACzD4C,OAAO,CAACpE,mBAAmB9B,oBAAAA,CAAKkD,QAAQ,CAACnC,MAAMmF,KAAK,EAAE;YAAE5C,aAAa;QAAM,KAAKzB;QAChFH;QACAmD;QACA7B;IACF;AACF,EAAE;AAEF,SAASS,kBAAyBzC,GAAsB;IACtD,IAAIqF,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,OAAOvF,QAAQ,YAAYA,QAAQ,QAAQ,CAAE,CAAA,aAAaA,GAAAA,CAAE,EAAI;YAClE,MAAM,IAAIwF,MAAM,CAAC;8BACO,EAAE1F,2BAA2B2F,IAAI,CAAC;;MAE1D,CAAC;QACH;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TreeItemLayout/useTreeItemLayout.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isResolvedShorthand,\n useMergedRefs,\n slot,\n useEventCallback,\n elementContains,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport { useTreeItemContext_unstable, useTreeContext_unstable } from '../../contexts';\nimport type {\n TreeItemLayoutActionSlotProps,\n TreeItemLayoutActionVisibilityChangeData,\n TreeItemLayoutProps,\n TreeItemLayoutState,\n} from './TreeItemLayout.types';\nimport type { CheckboxProps } from '@fluentui/react-checkbox';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport type { RadioProps } from '@fluentui/react-radio';\nimport { Radio } from '@fluentui/react-radio';\nimport { TreeItemChevron } from '../TreeItemChevron';\nimport { useArrowNavigationGroup, useIsNavigatingWithKeyboard } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render TreeItemLayout.\n *\n * The returned state can be modified with hooks such as useTreeItemLayoutStyles_unstable,\n * before being passed to renderTreeItemLayout_unstable.\n *\n * @param props - props from this instance of TreeItemLayout\n * @param ref - reference to root HTMLElement of TreeItemLayout\n */\nexport const useTreeItemLayout_unstable = (\n props: TreeItemLayoutProps,\n ref: React.Ref<HTMLElement>,\n): TreeItemLayoutState => {\n const { main, iconAfter, iconBefore } = props;\n\n const layoutRef = useTreeItemContext_unstable(ctx => ctx.layoutRef);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n const navigationMode = useTreeContext_unstable(ctx => ctx.navigationMode ?? 'tree');\n\n const [isActionsVisibleFromProps, onActionVisibilityChange]: [\n TreeItemLayoutActionSlotProps['visible'],\n TreeItemLayoutActionSlotProps['onVisibilityChange'],\n ] = isResolvedShorthand(props.actions)\n ? // .visible .onVisibilityChange prop should not be propagated to the DOM\n [props.actions.visible, props.actions.onVisibilityChange]\n : [undefined, undefined];\n\n const [isActionsVisible, setIsActionsVisible] = useControllableState({\n state: isActionsVisibleFromProps,\n initialState: false,\n });\n\n const selectionRef = useTreeItemContext_unstable(ctx => ctx.selectionRef);\n const expandIconRef = useTreeItemContext_unstable(ctx => ctx.expandIconRef);\n const actionsRef = useTreeItemContext_unstable(ctx => ctx.actionsRef);\n const actionsRefInternal = React.useRef<HTMLDivElement>(null);\n const treeItemRef = useTreeItemContext_unstable(ctx => ctx.treeItemRef);\n const subtreeRef = useTreeItemContext_unstable(ctx => ctx.subtreeRef);\n const checked = useTreeItemContext_unstable(ctx => ctx.checked);\n const isBranch = useTreeItemContext_unstable(ctx => ctx.itemType === 'branch');\n\n const mainShorthand = isResolvedShorthand(main) ? main : undefined;\n const mainContentId = useId('fui-TreeItemLayout__main-', mainShorthand?.id);\n\n // Link the selector to the main content unless the consumer provided an accessible name\n const selectorShorthand = isResolvedShorthand(props.selector) ? props.selector : undefined;\n const selectorAriaLabelledBy =\n selectorShorthand?.['aria-label'] || selectorShorthand?.['aria-labelledby'] ? undefined : mainContentId;\n\n const selector = slot.optional(props.selector, {\n renderByDefault: selectionMode !== 'none',\n defaultProps: {\n checked,\n tabIndex: -1,\n ref: selectionRef,\n 'aria-labelledby': selectorAriaLabelledBy,\n // casting here to a union between checkbox and radio\n // since ref is not present on the selector signature\n // FIXME: look into Slot type to see if we can make this work\n } as CheckboxProps | RadioProps,\n elementType: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n });\n const mainSlot = slot.always(main, {\n defaultProps: { id: selector ? mainContentId : undefined },\n elementType: 'div',\n });\n\n // FIXME: Asserting is required here, as converting this to RefObject on context type would be a breaking change\n // eslint-disable-next-line react-hooks/refs\n assertIsRefObject(treeItemRef);\n // FIXME: Asserting is required here, as converting this to RefObject on context type would be a breaking change\n // eslint-disable-next-line react-hooks/refs\n assertIsRefObject(subtreeRef);\n\n const setActionsVisibleIfNotFromSubtree = React.useCallback(\n (event: MouseEvent | FocusEvent) => {\n const isTargetFromSubtree = Boolean(\n subtreeRef.current && elementContains(subtreeRef.current, event.target as Node),\n );\n if (!isTargetFromSubtree) {\n onActionVisibilityChange?.(event, {\n visible: true,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(true);\n }\n },\n [subtreeRef, setIsActionsVisible, onActionVisibilityChange],\n );\n\n const { targetDocument } = useFluent();\n const isNavigatingWithKeyboard = useIsNavigatingWithKeyboard();\n\n const setActionsInvisibleIfNotFromSubtree = React.useCallback(\n (event: FocusEvent | MouseEvent) => {\n const isRelatedTargetFromActions = () =>\n Boolean(actionsRefInternal.current && elementContains(actionsRefInternal.current, event.relatedTarget as Node));\n const isRelatedTargetFromTreeItem = () =>\n Boolean(treeItemRef.current && elementContains(treeItemRef.current, event.relatedTarget as Node));\n const isTargetFromActions = () => Boolean(actionsRefInternal.current?.contains(event.target as Node));\n if (isRelatedTargetFromActions()) {\n onActionVisibilityChange?.(event, {\n visible: true,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(true);\n return;\n }\n if (isTargetFromActions() && isRelatedTargetFromTreeItem()) {\n return;\n }\n // when a mouseout event happens during keyboard interaction\n // we should not hide the actions if the activeElement is the treeitem or an action\n // as the focus on the treeitem takes precedence over the mouseout event\n if (\n event.type === 'mouseout' &&\n isNavigatingWithKeyboard() &&\n (targetDocument?.activeElement === treeItemRef.current ||\n elementContains(actionsRefInternal.current, targetDocument?.activeElement as Node))\n ) {\n return;\n }\n onActionVisibilityChange?.(event, {\n visible: false,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(false);\n },\n [setIsActionsVisible, onActionVisibilityChange, treeItemRef, isNavigatingWithKeyboard, targetDocument],\n );\n\n const expandIconRefs = useMergedRefs(expandIconRef);\n const expandIcon = slot.optional(props.expandIcon, {\n renderByDefault: isBranch,\n defaultProps: {\n children: <TreeItemChevron />,\n 'aria-hidden': true,\n ref: expandIconRefs,\n },\n elementType: 'div',\n });\n const arrowNavigationProps = useArrowNavigationGroup({ circular: navigationMode === 'tree', axis: 'horizontal' });\n\n const handleActionsBlur = useEventCallback((event: React.FocusEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.actions)) {\n props.actions.onBlur?.(event);\n }\n const isRelatedTargetFromActions = Boolean(elementContains(event.currentTarget, event.relatedTarget as Node));\n onActionVisibilityChange?.(event, {\n visible: isRelatedTargetFromActions,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n setIsActionsVisible(isRelatedTargetFromActions);\n });\n\n const actionsRefs = useMergedRefs(actionsRef, actionsRefInternal);\n const actions = isActionsVisible\n ? slot.optional(props.actions, {\n defaultProps: {\n ...arrowNavigationProps,\n role: 'toolbar',\n ref: actionsRefs,\n onBlur: handleActionsBlur,\n },\n elementType: 'div',\n })\n : undefined;\n\n const hasActions = Boolean(props.actions);\n\n React.useEffect(() => {\n if (treeItemRef.current && hasActions) {\n const treeItemElement = treeItemRef.current;\n\n const handleMouseOver = setActionsVisibleIfNotFromSubtree;\n const handleMouseOut = setActionsInvisibleIfNotFromSubtree;\n const handleFocus = setActionsVisibleIfNotFromSubtree;\n const handleBlur = setActionsInvisibleIfNotFromSubtree;\n\n treeItemElement.addEventListener('mouseover', handleMouseOver);\n treeItemElement.addEventListener('mouseout', handleMouseOut);\n treeItemElement.addEventListener('focus', handleFocus);\n treeItemElement.addEventListener('blur', handleBlur);\n\n return () => {\n treeItemElement.removeEventListener('mouseover', handleMouseOver);\n treeItemElement.removeEventListener('mouseout', handleMouseOut);\n treeItemElement.removeEventListener('focus', handleFocus);\n treeItemElement.removeEventListener('blur', handleBlur);\n };\n }\n }, [hasActions, treeItemRef, setActionsVisibleIfNotFromSubtree, setActionsInvisibleIfNotFromSubtree]);\n\n return {\n components: {\n root: 'div',\n expandIcon: 'div',\n iconBefore: 'div',\n main: 'div',\n iconAfter: 'div',\n actions: 'div',\n aside: 'div',\n // Casting here to a union between checkbox and radio\n selector: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n },\n buttonContextValue: { size: 'small' },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ...props,\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, layoutRef) as React.Ref<HTMLDivElement>,\n }),\n {\n elementType: 'div',\n },\n ),\n iconBefore: slot.optional(iconBefore, { elementType: 'div' }),\n main: mainSlot,\n iconAfter: slot.optional(iconAfter, { elementType: 'div' }),\n aside: !isActionsVisible ? slot.optional(props.aside, { elementType: 'div' }) : undefined,\n actions,\n expandIcon,\n selector,\n };\n};\n\nfunction assertIsRefObject<Value>(ref?: React.Ref<Value>): asserts ref is React.RefObject<Value> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof ref !== 'object' || ref === null || !('current' in ref)) {\n throw new Error(`\n @fluentui/react-tree [${useTreeItemLayout_unstable.name}]:\n Internal Error: contextual ref is not a RefObject! Please report this bug immediately, as contextual refs should be RefObjects.\n `);\n }\n }\n}\n"],"names":["React","getIntrinsicElementProps","isResolvedShorthand","useMergedRefs","slot","useEventCallback","elementContains","useControllableState","useId","useTreeItemContext_unstable","useTreeContext_unstable","Checkbox","Radio","TreeItemChevron","useArrowNavigationGroup","useIsNavigatingWithKeyboard","useFluent_unstable","useFluent","useTreeItemLayout_unstable","props","ref","main","iconAfter","iconBefore","layoutRef","ctx","selectionMode","navigationMode","isActionsVisibleFromProps","onActionVisibilityChange","actions","visible","onVisibilityChange","undefined","isActionsVisible","setIsActionsVisible","state","initialState","selectionRef","expandIconRef","actionsRef","actionsRefInternal","useRef","treeItemRef","subtreeRef","checked","isBranch","itemType","mainShorthand","mainContentId","id","selectorShorthand","selector","selectorAriaLabelledBy","optional","renderByDefault","defaultProps","tabIndex","elementType","mainSlot","always","assertIsRefObject","setActionsVisibleIfNotFromSubtree","useCallback","event","isTargetFromSubtree","Boolean","current","target","type","defaultPrevented","targetDocument","isNavigatingWithKeyboard","setActionsInvisibleIfNotFromSubtree","isRelatedTargetFromActions","relatedTarget","isRelatedTargetFromTreeItem","isTargetFromActions","contains","activeElement","expandIconRefs","expandIcon","children","arrowNavigationProps","circular","axis","handleActionsBlur","onBlur","currentTarget","actionsRefs","role","hasActions","useEffect","treeItemElement","handleMouseOver","handleMouseOut","handleFocus","handleBlur","addEventListener","removeEventListener","components","root","aside","buttonContextValue","size","process","env","NODE_ENV","Error","name"],"mappings":"AAAA;;;;;+BAqCakB;;;;;;;iEAnCU,QAAQ;gCAUxB,4BAA4B;uBACkC,0BAAiB;+BAQ7D,2BAA2B;4BAE9B,wBAAwB;iCACd,wBAAqB;8BACgB,0BAA0B;qCAC/C,kCAAkC;AAW3E,mCAAmC,CACxCC,OACAC;IAEA,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAE,GAAGJ;IAExC,MAAMK,YAAYf,sCAAAA,EAA4BgB,CAAAA,MAAOA,IAAID,SAAS;IAClE,MAAME,oBAAgBhB,8BAAAA,EAAwBe,CAAAA,MAAOA,IAAIC,aAAa;IACtE,MAAMC,qBAAiBjB,8BAAAA,EAAwBe,CAAAA;YAAOA;eAAAA,uBAAAA,IAAIE,cAAAA,AAAc,MAAA,QAAlBF,wBAAAA,KAAAA,IAAAA,sBAAsB;;IAE5E,MAAM,CAACG,2BAA2BC,yBAAyB,OAGvD3B,mCAAAA,EAAoBiB,MAAMW,OAAO,IAEjC;QAACX,MAAMW,OAAO,CAACC,OAAO;QAAEZ,MAAMW,OAAO,CAACE,kBAAkB;KAAC,GACzD;QAACC;QAAWA;KAAU;IAE1B,MAAM,CAACC,kBAAkBC,oBAAoB,OAAG5B,oCAAAA,EAAqB;QACnE6B,OAAOR;QACPS,cAAc;IAChB;IAEA,MAAMC,mBAAe7B,kCAAAA,EAA4BgB,CAAAA,MAAOA,IAAIa,YAAY;IACxE,MAAMC,oBAAgB9B,kCAAAA,EAA4BgB,CAAAA,MAAOA,IAAIc,aAAa;IAC1E,MAAMC,iBAAa/B,kCAAAA,EAA4BgB,CAAAA,MAAOA,IAAIe,UAAU;IACp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Y;YACZ1D,YAAY;YACZF,MAAM;YACNC,WAAW;YACXQ,SAAS;YACTwE,OAAO;YACP,qDAAqD;YACrDlD,UAAW1B,kBAAkB,gBAAgBf,uBAAAA,GAAWC,iBAAAA;QAC1D;QACA2F,oBAAoB;YAAEC,MAAM;QAAQ;QACpCH,MAAMjG,oBAAAA,CAAKwD,MAAM,KACf3D,wCAAAA,EAAyB,OAAO;YAC9B,GAAGkB,KAAK;YACR,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FC,SAAKjB,6BAAAA,EAAciB,KAAKI;QAC1B,IACA;YACEkC,aAAa;QACf;QAEFnC,YAAYnB,oBAAAA,CAAKkD,QAAQ,CAAC/B,YAAY;YAAEmC,aAAa;QAAM;QAC3DrC,MAAMsC;QACNrC,WAAWlB,oBAAAA,CAAKkD,QAAQ,CAAChC,WAAW;YAAEoC,aAAa;QAAM;QACzD4C,OAAO,CAACpE,mBAAmB9B,oBAAAA,CAAKkD,QAAQ,CAACnC,MAAMmF,KAAK,EAAE;YAAE5C,aAAa;QAAM,KAAKzB;QAChFH;QACAmD;QACA7B;IACF;AACF,EAAE;AAEF,SAASS,kBAAyBzC,GAAsB;IACtD,IAAIqF,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,OAAOvF,QAAQ,YAAYA,QAAQ,QAAQ,CAAE,CAAA,aAAaA,GAAAA,CAAE,EAAI;YAClE,MAAM,IAAIwF,MAAM,CAAC;8BACO,EAAE1F,2BAA2B2F,IAAI,CAAC;;MAE1D,CAAC;QACH;IACF;AACF"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
treeItemLayoutClassNames
|
|
13
|
+
get treeItemLayoutClassNames () {
|
|
14
14
|
return treeItemLayoutClassNames;
|
|
15
15
|
},
|
|
16
|
-
useTreeItemLayoutStyles_unstable
|
|
16
|
+
get useTreeItemLayoutStyles_unstable () {
|
|
17
17
|
return useTreeItemLayoutStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTreeItemLayoutStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens, typographyStyles } from \"@fluentui/react-theme\";\nimport { useTreeContext_unstable } from \"../../contexts/treeContext.js\";\nimport { treeItemLevelToken } from \"../../utils/tokens.js\";\nimport { useTreeItemContext_unstable } from \"../../contexts/treeItemContext.js\";\nexport const treeItemLayoutClassNames = {\n root: 'fui-TreeItemLayout',\n iconBefore: 'fui-TreeItemLayout__iconBefore',\n main: 'fui-TreeItemLayout__main',\n iconAfter: 'fui-TreeItemLayout__iconAfter',\n expandIcon: 'fui-TreeItemLayout__expandIcon',\n aside: 'fui-TreeItemLayout__aside',\n actions: 'fui-TreeItemLayout__actions',\n selector: 'fui-TreeItemLayout__selector'\n};\nconst useRootBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n minHeight: '32px',\n boxSizing: 'border-box',\n gridArea: 'layout',\n ':hover': {\n color: tokens.colorNeutralForeground2Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n // TODO: stop using treeItemLayoutClassNames.expandIcon for styling\n [`& .${treeItemLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Hover\n }\n },\n ':active': {\n color: tokens.colorNeutralForeground2Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n // TODO: stop using treeItemLayoutClassNames.expandIcon for styling\n [`& .${treeItemLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Pressed\n }\n }\n});\n/**\n * Styles for the root slot\n */ const useRootStyles = makeStyles({\n leaf: {\n paddingLeft: `calc(var(${treeItemLevelToken}, 1) * ${tokens.spacingHorizontalXXL})`\n },\n branch: {\n paddingLeft: `calc((var(${treeItemLevelToken}, 1) - 1) * ${tokens.spacingHorizontalXXL})`\n },\n medium: {\n ...typographyStyles.body1\n },\n small: {\n minHeight: '24px',\n ...typographyStyles.caption1\n },\n // Appearance variations\n subtle: {},\n 'subtle-alpha': {\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundLightAlphaHover\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundLightAlphaPressed\n }\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed\n }\n }\n});\n/**\n * Styles for the action icon slot\n */ const useActionsBaseStyles = makeResetStyles({\n display: 'flex',\n marginLeft: 'auto',\n position: 'relative',\n zIndex: 1,\n gridArea: 'aside',\n padding: `0 ${tokens.spacingHorizontalS}`\n});\n/**\n * Styles for the action icon slot\n */ const useAsideBaseStyles = makeResetStyles({\n display: 'flex',\n marginLeft: 'auto',\n alignItems: 'center',\n zIndex: 0,\n gridArea: 'aside',\n padding: `0 ${tokens.spacingHorizontalM}`,\n gap: tokens.spacingHorizontalXS\n});\n/**\n * Styles for the expand icon slot\n */ const useExpandIconBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '24px',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground3,\n flex: `0 0 auto`,\n padding: `${tokens.spacingVerticalXS} 0`\n});\n/**\n * Styles for the content slot\n */ const useMainBaseStyles = makeResetStyles({\n padding: `0 ${tokens.spacingHorizontalXXS}`\n});\n/**\n * Styles for the before/after icon slot\n */ const useIconBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n color: tokens.colorNeutralForeground2,\n lineHeight: tokens.lineHeightBase500,\n fontSize: tokens.fontSizeBase500\n});\nconst useIconBeforeStyles = makeStyles({\n medium: {\n paddingRight: tokens.spacingHorizontalXS\n },\n small: {\n paddingRight: tokens.spacingHorizontalXXS\n }\n});\nconst useIconAfterStyles = makeStyles({\n medium: {\n paddingLeft: tokens.spacingHorizontalXS\n },\n small: {\n paddingLeft: tokens.spacingHorizontalXXS\n }\n});\n/**\n * Apply styling to the TreeItemLayout slots based on the state\n */ export const useTreeItemLayoutStyles_unstable = (state)=>{\n const { main, iconAfter, iconBefore, expandIcon, root, aside, actions, selector } = state;\n const rootStyles = useRootStyles();\n const rootBaseStyles = useRootBaseStyles();\n const actionsBaseStyles = useActionsBaseStyles();\n const asideBaseStyles = useAsideBaseStyles();\n const mainBaseStyles = useMainBaseStyles();\n const expandIconBaseStyles = useExpandIconBaseStyles();\n const iconBaseStyles = useIconBaseStyles();\n const iconBeforeStyles = useIconBeforeStyles();\n const iconAfterStyles = useIconAfterStyles();\n const size = useTreeContext_unstable((ctx)=>ctx.size);\n const appearance = useTreeContext_unstable((ctx)=>ctx.appearance);\n const itemType = useTreeItemContext_unstable((ctx)=>ctx.itemType);\n // eslint-disable-next-line react-hooks/immutability\n root.className = mergeClasses(treeItemLayoutClassNames.root, rootBaseStyles, rootStyles[appearance], rootStyles[size], rootStyles[itemType], root.className);\n // eslint-disable-next-line react-hooks/immutability\n main.className = mergeClasses(treeItemLayoutClassNames.main, mainBaseStyles, main.className);\n if (expandIcon) {\n // eslint-disable-next-line react-hooks/immutability\n expandIcon.className = mergeClasses(treeItemLayoutClassNames.expandIcon, expandIconBaseStyles, expandIcon.className);\n }\n if (iconBefore) {\n // eslint-disable-next-line react-hooks/immutability\n iconBefore.className = mergeClasses(treeItemLayoutClassNames.iconBefore, iconBaseStyles, iconBeforeStyles[size], iconBefore.className);\n }\n if (iconAfter) {\n // eslint-disable-next-line react-hooks/immutability\n iconAfter.className = mergeClasses(treeItemLayoutClassNames.iconAfter, iconBaseStyles, iconAfterStyles[size], iconAfter.className);\n }\n if (actions) {\n // eslint-disable-next-line react-hooks/immutability\n actions.className = mergeClasses(treeItemLayoutClassNames.actions, actionsBaseStyles, actions.className);\n }\n if (aside) {\n // eslint-disable-next-line react-hooks/immutability\n aside.className = mergeClasses(treeItemLayoutClassNames.aside, asideBaseStyles, aside.className);\n }\n if (selector) {\n // eslint-disable-next-line react-hooks/immutability\n selector.className = mergeClasses(treeItemLayoutClassNames.selector, selector.className);\n }\n return state;\n};\n"],"names":["__resetStyles","__styles","mergeClasses","tokens","typographyStyles","useTreeContext_unstable","treeItemLevelToken","useTreeItemContext_unstable","treeItemLayoutClassNames","root","iconBefore","main","iconAfter","expandIcon","aside","actions","selector","useRootBaseStyles","useRootStyles","leaf","uwmqm3","branch","medium","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","small","sshi5w","subtle","Jwef8y","ecr2s2","transparent","De3pzq","d","h","a","useActionsBaseStyles","useAsideBaseStyles","useExpandIconBaseStyles","useMainBaseStyles","useIconBaseStyles","useIconBeforeStyles","z189sj","useIconAfterStyles","useTreeItemLayoutStyles_unstable","state","rootStyles","rootBaseStyles","actionsBaseStyles","asideBaseStyles","mainBaseStyles","expandIconBaseStyles","iconBaseStyles","iconBeforeStyles","iconAfterStyles","size","ctx","appearance","itemType","className"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAMCQ,wBAAwB;;;oCAsIY;eAAhCqC;;;uBA3IyC,gBAAgB;6BAElC,+BAA+B;iCAE3B,mCAAmC;AACxE,iCAAiC;IACpCpC,IAAI,EAAE,oBAAoB;IAC1BC,UAAU,EAAE,gCAAgC;IAC5CC,IAAI,EAAE,0BAA0B;IAChCC,SAAS,EAAE,+BAA+B;IAC1CC,UAAU,EAAE,gCAAgC;IAC5CC,KAAK,EAAE,2BAA2B;IAClCC,OAAO,EAAE,6BAA6B;IACtCC,QAAQ,EAAE;AACd,CAAC;AACD,MAAMC,iBAAiB,GAAA,WAAA,OAAGjB,oBAAA,EAAA,WAAA,MAAA;IA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D,mBAAY,EAACM,wBAAwB,CAACO,OAAO,EAAEkC,iBAAiB,EAAElC,OAAO,CAAC6C,SAAS,CAAC;IAC5G;IACA,IAAI9C,KAAK,EAAE;QACP,oDAAA;QACAA,KAAK,CAAC8C,SAAS,OAAG1D,mBAAY,EAACM,wBAAwB,CAACM,KAAK,EAAEoC,eAAe,EAAEpC,KAAK,CAAC8C,SAAS,CAAC;IACpG;IACA,IAAI5C,QAAQ,EAAE;QACV,oDAAA;QACAA,QAAQ,CAAC4C,SAAS,OAAG1D,mBAAY,EAACM,wBAAwB,CAACQ,QAAQ,EAAEA,QAAQ,CAAC4C,SAAS,CAAC;IAC5F;IACA,OAAOd,KAAK;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"sources":["useTreeItemLayoutStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens, typographyStyles } from \"@fluentui/react-theme\";\nimport { useTreeContext_unstable } from \"../../contexts/treeContext.js\";\nimport { treeItemLevelToken } from \"../../utils/tokens.js\";\nimport { useTreeItemContext_unstable } from \"../../contexts/treeItemContext.js\";\nexport const treeItemLayoutClassNames = {\n root: 'fui-TreeItemLayout',\n iconBefore: 'fui-TreeItemLayout__iconBefore',\n main: 'fui-TreeItemLayout__main',\n iconAfter: 'fui-TreeItemLayout__iconAfter',\n expandIcon: 'fui-TreeItemLayout__expandIcon',\n aside: 'fui-TreeItemLayout__aside',\n actions: 'fui-TreeItemLayout__actions',\n selector: 'fui-TreeItemLayout__selector'\n};\nconst useRootBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n minHeight: '32px',\n boxSizing: 'border-box',\n gridArea: 'layout',\n ':hover': {\n color: tokens.colorNeutralForeground2Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n // TODO: stop using treeItemLayoutClassNames.expandIcon for styling\n [`& .${treeItemLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Hover\n }\n },\n ':active': {\n color: tokens.colorNeutralForeground2Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n // TODO: stop using treeItemLayoutClassNames.expandIcon for styling\n [`& .${treeItemLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Pressed\n }\n }\n});\n/**\n * Styles for the root slot\n */ const useRootStyles = makeStyles({\n leaf: {\n paddingLeft: `calc(var(${treeItemLevelToken}, 1) * ${tokens.spacingHorizontalXXL})`\n },\n branch: {\n paddingLeft: `calc((var(${treeItemLevelToken}, 1) - 1) * ${tokens.spacingHorizontalXXL})`\n },\n medium: {\n ...typographyStyles.body1\n },\n small: {\n minHeight: '24px',\n ...typographyStyles.caption1\n },\n // Appearance variations\n subtle: {},\n 'subtle-alpha': {\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundLightAlphaHover\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundLightAlphaPressed\n }\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed\n }\n }\n});\n/**\n * Styles for the action icon slot\n */ const useActionsBaseStyles = makeResetStyles({\n display: 'flex',\n marginLeft: 'auto',\n position: 'relative',\n zIndex: 1,\n gridArea: 'aside',\n padding: `0 ${tokens.spacingHorizontalS}`\n});\n/**\n * Styles for the action icon slot\n */ const useAsideBaseStyles = makeResetStyles({\n display: 'flex',\n marginLeft: 'auto',\n alignItems: 'center',\n zIndex: 0,\n gridArea: 'aside',\n padding: `0 ${tokens.spacingHorizontalM}`,\n gap: tokens.spacingHorizontalXS\n});\n/**\n * Styles for the expand icon slot\n */ const useExpandIconBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '24px',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground3,\n flex: `0 0 auto`,\n padding: `${tokens.spacingVerticalXS} 0`\n});\n/**\n * Styles for the content slot\n */ const useMainBaseStyles = makeResetStyles({\n padding: `0 ${tokens.spacingHorizontalXXS}`\n});\n/**\n * Styles for the before/after icon slot\n */ const useIconBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n color: tokens.colorNeutralForeground2,\n lineHeight: tokens.lineHeightBase500,\n fontSize: tokens.fontSizeBase500\n});\nconst useIconBeforeStyles = makeStyles({\n medium: {\n paddingRight: tokens.spacingHorizontalXS\n },\n small: {\n paddingRight: tokens.spacingHorizontalXXS\n }\n});\nconst useIconAfterStyles = makeStyles({\n medium: {\n paddingLeft: tokens.spacingHorizontalXS\n },\n small: {\n paddingLeft: tokens.spacingHorizontalXXS\n }\n});\n/**\n * Apply styling to the TreeItemLayout slots based on the state\n */ export const useTreeItemLayoutStyles_unstable = (state)=>{\n const { main, iconAfter, iconBefore, expandIcon, root, aside, actions, selector } = state;\n const rootStyles = useRootStyles();\n const rootBaseStyles = useRootBaseStyles();\n const actionsBaseStyles = useActionsBaseStyles();\n const asideBaseStyles = useAsideBaseStyles();\n const mainBaseStyles = useMainBaseStyles();\n const expandIconBaseStyles = useExpandIconBaseStyles();\n const iconBaseStyles = useIconBaseStyles();\n const iconBeforeStyles = useIconBeforeStyles();\n const iconAfterStyles = useIconAfterStyles();\n const size = useTreeContext_unstable((ctx)=>ctx.size);\n const appearance = useTreeContext_unstable((ctx)=>ctx.appearance);\n const itemType = useTreeItemContext_unstable((ctx)=>ctx.itemType);\n // eslint-disable-next-line react-hooks/immutability\n root.className = mergeClasses(treeItemLayoutClassNames.root, rootBaseStyles, rootStyles[appearance], rootStyles[size], rootStyles[itemType], root.className);\n // eslint-disable-next-line react-hooks/immutability\n main.className = mergeClasses(treeItemLayoutClassNames.main, mainBaseStyles, main.className);\n if (expandIcon) {\n // eslint-disable-next-line react-hooks/immutability\n expandIcon.className = mergeClasses(treeItemLayoutClassNames.expandIcon, expandIconBaseStyles, expandIcon.className);\n }\n if (iconBefore) {\n // eslint-disable-next-line react-hooks/immutability\n iconBefore.className = mergeClasses(treeItemLayoutClassNames.iconBefore, iconBaseStyles, iconBeforeStyles[size], iconBefore.className);\n }\n if (iconAfter) {\n // eslint-disable-next-line react-hooks/immutability\n iconAfter.className = mergeClasses(treeItemLayoutClassNames.iconAfter, iconBaseStyles, iconAfterStyles[size], iconAfter.className);\n }\n if (actions) {\n // eslint-disable-next-line react-hooks/immutability\n actions.className = mergeClasses(treeItemLayoutClassNames.actions, actionsBaseStyles, actions.className);\n }\n if (aside) {\n // eslint-disable-next-line react-hooks/immutability\n aside.className = mergeClasses(treeItemLayoutClassNames.aside, asideBaseStyles, aside.className);\n }\n if (selector) {\n // eslint-disable-next-line react-hooks/immutability\n selector.className = mergeClasses(treeItemLayoutClassNames.selector, selector.className);\n }\n return state;\n};\n"],"names":["__resetStyles","__styles","mergeClasses","tokens","typographyStyles","useTreeContext_unstable","treeItemLevelToken","useTreeItemContext_unstable","treeItemLayoutClassNames","root","iconBefore","main","iconAfter","expandIcon","aside","actions","selector","useRootBaseStyles","useRootStyles","leaf","uwmqm3","branch","medium","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","small","sshi5w","subtle","Jwef8y","ecr2s2","transparent","De3pzq","d","h","a","useActionsBaseStyles","useAsideBaseStyles","useExpandIconBaseStyles","useMainBaseStyles","useIconBaseStyles","useIconBeforeStyles","z189sj","useIconAfterStyles","useTreeItemLayoutStyles_unstable","state","rootStyles","rootBaseStyles","actionsBaseStyles","asideBaseStyles","mainBaseStyles","expandIconBaseStyles","iconBaseStyles","iconBeforeStyles","iconAfterStyles","size","ctx","appearance","itemType","className"],"mappings":"AAAA,YAAY;;;;;;;;;;;;QAMCQ,wBAAwB;;;;eAsIpBqC,gCAAgC;;;uBA3IS,gBAAgB;6BAElC,+BAA+B;iCAE3B,mCAAmC;AACxE,iCAAiC;IACpCpC,IAAI,EAAE,oBAAoB;IAC1BC,UAAU,EAAE,gCAAgC;IAC5CC,IAAI,EAAE,0BAA0B;IAChCC,SAAS,EA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OAAG1D,mBAAY,EAACM,wBAAwB,CAACI,SAAS,EAAEyC,cAAc,EAAEE,eAAe,CAACC,IAAI,CAAC,EAAE5C,SAAS,CAACgD,SAAS,CAAC;IACtI;IACA,IAAI7C,OAAO,EAAE;QACT,oDAAA;QACAA,OAAO,CAAC6C,SAAS,GAAG1D,uBAAY,EAACM,wBAAwB,CAACO,OAAO,EAAEkC,iBAAiB,EAAElC,OAAO,CAAC6C,SAAS,CAAC;IAC5G;IACA,IAAI9C,KAAK,EAAE;QACP,oDAAA;QACAA,KAAK,CAAC8C,SAAS,OAAG1D,mBAAY,EAACM,wBAAwB,CAACM,KAAK,EAAEoC,eAAe,EAAEpC,KAAK,CAAC8C,SAAS,CAAC;IACpG;IACA,IAAI5C,QAAQ,EAAE;QACV,oDAAA;QACAA,QAAQ,CAAC4C,SAAS,OAAG1D,mBAAY,EAACM,wBAAwB,CAACQ,QAAQ,EAAEA,QAAQ,CAAC4C,SAAS,CAAC;IAC5F;IACA,OAAOd,KAAK;AAChB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
get treeItemLayoutClassNames () {
|
|
14
|
+
return treeItemLayoutClassNames;
|
|
15
|
+
},
|
|
16
|
+
get useTreeItemLayoutStyles_unstable () {
|
|
17
|
+
return useTreeItemLayoutStyles_unstable;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
21
|
+
const _clsx = require("clsx");
|
|
22
|
+
const _treeContext = require("../../contexts/treeContext.cjs");
|
|
23
|
+
const _treeItemContext = require("../../contexts/treeItemContext.cjs");
|
|
24
|
+
const _TreeItemLayoutmodulecss = /*#__PURE__*/ _interop_require_default._(require("./TreeItemLayout.module.css"));
|
|
25
|
+
const treeItemLayoutClassNames = {
|
|
26
|
+
root: 'fui-TreeItemLayout',
|
|
27
|
+
iconBefore: 'fui-TreeItemLayout__iconBefore',
|
|
28
|
+
main: 'fui-TreeItemLayout__main',
|
|
29
|
+
iconAfter: 'fui-TreeItemLayout__iconAfter',
|
|
30
|
+
expandIcon: 'fui-TreeItemLayout__expandIcon',
|
|
31
|
+
aside: 'fui-TreeItemLayout__aside',
|
|
32
|
+
actions: 'fui-TreeItemLayout__actions',
|
|
33
|
+
selector: 'fui-TreeItemLayout__selector'
|
|
34
|
+
};
|
|
35
|
+
const useTreeItemLayoutStyles_unstable = (state)=>{
|
|
36
|
+
const size = (0, _treeContext.useTreeContext_unstable)((ctx)=>ctx.size);
|
|
37
|
+
const appearance = (0, _treeContext.useTreeContext_unstable)((ctx)=>ctx.appearance);
|
|
38
|
+
const itemType = (0, _treeItemContext.useTreeItemContext_unstable)((ctx)=>ctx.itemType);
|
|
39
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
40
|
+
state.root.className = (0, _clsx.clsx)(treeItemLayoutClassNames.root, _TreeItemLayoutmodulecss.default.root, _TreeItemLayoutmodulecss.default[itemType], _TreeItemLayoutmodulecss.default[appearance], _TreeItemLayoutmodulecss.default[size], state.root.className);
|
|
41
|
+
if (state.main) {
|
|
42
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
43
|
+
state.main.className = (0, _clsx.clsx)(treeItemLayoutClassNames.main, _TreeItemLayoutmodulecss.default.main, state.main.className);
|
|
44
|
+
}
|
|
45
|
+
if (state.expandIcon) {
|
|
46
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
47
|
+
state.expandIcon.className = (0, _clsx.clsx)(treeItemLayoutClassNames.expandIcon, _TreeItemLayoutmodulecss.default.expandIcon, state.expandIcon.className);
|
|
48
|
+
}
|
|
49
|
+
if (state.iconBefore) {
|
|
50
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
51
|
+
state.iconBefore.className = (0, _clsx.clsx)(treeItemLayoutClassNames.iconBefore, _TreeItemLayoutmodulecss.default.iconBefore, state.iconBefore.className);
|
|
52
|
+
}
|
|
53
|
+
if (state.iconAfter) {
|
|
54
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
55
|
+
state.iconAfter.className = (0, _clsx.clsx)(treeItemLayoutClassNames.iconAfter, _TreeItemLayoutmodulecss.default.iconAfter, state.iconAfter.className);
|
|
56
|
+
}
|
|
57
|
+
if (state.actions) {
|
|
58
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
59
|
+
state.actions.className = (0, _clsx.clsx)(treeItemLayoutClassNames.actions, _TreeItemLayoutmodulecss.default.actions, state.actions.className);
|
|
60
|
+
}
|
|
61
|
+
if (state.aside) {
|
|
62
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
63
|
+
state.aside.className = (0, _clsx.clsx)(treeItemLayoutClassNames.aside, _TreeItemLayoutmodulecss.default.aside, state.aside.className);
|
|
64
|
+
}
|
|
65
|
+
if (state.selector) {
|
|
66
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
67
|
+
state.selector.className = (0, _clsx.clsx)(treeItemLayoutClassNames.selector, state.selector.className);
|
|
68
|
+
}
|
|
69
|
+
return state;
|
|
70
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.ts"],"sourcesContent":["'use client';\n\nimport { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { TreeItemLayoutState, TreeItemLayoutSlots } from './TreeItemLayout.types';\nimport { useTreeContext_unstable } from '../../contexts/treeContext';\nimport { useTreeItemContext_unstable } from '../../contexts/treeItemContext';\nimport styles from './TreeItemLayout.module.css';\n\nexport const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutSlots> = {\n root: 'fui-TreeItemLayout',\n iconBefore: 'fui-TreeItemLayout__iconBefore',\n main: 'fui-TreeItemLayout__main',\n iconAfter: 'fui-TreeItemLayout__iconAfter',\n expandIcon: 'fui-TreeItemLayout__expandIcon',\n aside: 'fui-TreeItemLayout__aside',\n actions: 'fui-TreeItemLayout__actions',\n selector: 'fui-TreeItemLayout__selector',\n};\n\nexport const useTreeItemLayoutStyles_unstable = (state: TreeItemLayoutState): TreeItemLayoutState => {\n const size = useTreeContext_unstable(ctx => ctx.size);\n const appearance = useTreeContext_unstable(ctx => ctx.appearance);\n const itemType = useTreeItemContext_unstable(ctx => ctx.itemType);\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = clsx(\n treeItemLayoutClassNames.root,\n styles.root,\n styles[itemType],\n styles[appearance],\n styles[size],\n state.root.className,\n );\n if (state.main) {\n // eslint-disable-next-line react-hooks/immutability\n state.main.className = clsx(treeItemLayoutClassNames.main, styles.main, state.main.className);\n }\n if (state.expandIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.expandIcon.className = clsx(\n treeItemLayoutClassNames.expandIcon,\n styles.expandIcon,\n state.expandIcon.className,\n );\n }\n if (state.iconBefore) {\n // eslint-disable-next-line react-hooks/immutability\n state.iconBefore.className = clsx(\n treeItemLayoutClassNames.iconBefore,\n styles.iconBefore,\n state.iconBefore.className,\n );\n }\n if (state.iconAfter) {\n // eslint-disable-next-line react-hooks/immutability\n state.iconAfter.className = clsx(treeItemLayoutClassNames.iconAfter, styles.iconAfter, state.iconAfter.className);\n }\n if (state.actions) {\n // eslint-disable-next-line react-hooks/immutability\n state.actions.className = clsx(treeItemLayoutClassNames.actions, styles.actions, state.actions.className);\n }\n if (state.aside) {\n // eslint-disable-next-line react-hooks/immutability\n state.aside.className = clsx(treeItemLayoutClassNames.aside, styles.aside, state.aside.className);\n }\n if (state.selector) {\n // eslint-disable-next-line react-hooks/immutability\n state.selector.className = clsx(treeItemLayoutClassNames.selector, state.selector.className);\n }\n return state;\n};\n"],"names":["clsx","useTreeContext_unstable","useTreeItemContext_unstable","styles","treeItemLayoutClassNames","root","iconBefore","main","iconAfter","expandIcon","aside","actions","selector","useTreeItemLayoutStyles_unstable","state","size","ctx","appearance","itemType","className"],"mappings":"AAAA;;;;;;;;;;;;QASaI;;;;;;;;sBAPQ,OAAO;6BAGY,gCAA6B;iCACzB,oCAAiC;kFAC1D,8BAA8B;AAE1C,iCAAsE;IAC3EC,MAAM;IACNC,YAAY;IACZC,MAAM;IACNC,WAAW;IACXC,YAAY;IACZC,OAAO;IACPC,SAAS;IACTC,UAAU;AACZ,EAAE;AAEK,MAAMC,mCAAmC,CAACC;IAC/C,MAAMC,WAAOd,oCAAAA,EAAwBe,CAAAA,MAAOA,IAAID,IAAI;IACpD,MAAME,iBAAahB,oCAAAA,EAAwBe,CAAAA,MAAOA,IAAIC,UAAU;IAChE,MAAMC,eAAWhB,4CAAAA,EAA4Bc,CAAAA,MAAOA,IAAIE,QAAQ;IAChE,oDAAoD;IACpDJ,MAAMT,IAAI,CAACc,SAAS,OAAGnB,UAAAA,EACrBI,yBAAyBC,IAAI,EAC7BF,gCAAAA,CAAOE,IAAI,EACXF,gCAAM,CAACe,SAAS,EAChBf,gCAAM,CAACc,WAAW,EAClBd,gCAAM,CAACY,KAAK,EACZD,MAAMT,IAAI,CAACc,SAAS;IAEtB,IAAIL,MAAMP,IAAI,EAAE;QACd,oDAAoD;QACpDO,MAAMP,IAAI,CAACY,SAAS,OAAGnB,UAAAA,EAAKI,yBAAyBG,IAAI,EAAEJ,gCAAAA,CAAOI,IAAI,EAAEO,MAAMP,IAAI,CAACY,SAAS;IAC9F;IACA,IAAIL,MAAML,UAAU,EAAE;QACpB,oDAAoD;QACpDK,MAAML,UAAU,CAACU,SAAS,OAAGnB,UAAAA,EAC3BI,yBAAyBK,UAAU,EACnCN,gCAAAA,CAAOM,UAAU,EACjBK,MAAML,UAAU,CAACU,SAAS;IAE9B;IACA,IAAIL,MAAMR,UAAU,EAAE;QACpB,oDAAoD;QACpDQ,MAAMR,UAAU,CAACa,SAAS,OAAGnB,UAAAA,EAC3BI,yBAAyBE,UAAU,EACnCH,gCAAAA,CAAOG,UAAU,EACjBQ,MAAMR,UAAU,CAACa,SAAS;IAE9B;IACA,IAAIL,MAAMN,SAAS,EAAE;QACnB,oDAAoD;QACpDM,MAAMN,SAAS,CAACW,SAAS,OAAGnB,UAAAA,EAAKI,yBAAyBI,SAAS,EAAEL,gCAAAA,CAAOK,SAAS,EAAEM,MAAMN,SAAS,CAACW,SAAS;IAClH;IACA,IAAIL,MAAMH,OAAO,EAAE;QACjB,oDAAoD;QACpDG,MAAMH,OAAO,CAACQ,SAAS,OAAGnB,UAAAA,EAAKI,yBAAyBO,OAAO,EAAER,gCAAAA,CAAOQ,OAAO,EAAEG,MAAMH,OAAO,CAACQ,SAAS;IAC1G;IACA,IAAIL,MAAMJ,KAAK,EAAE;QACf,oDAAoD;QACpDI,MAAMJ,KAAK,CAACS,SAAS,OAAGnB,UAAAA,EAAKI,yBAAyBM,KAAK,EAAEP,gCAAAA,CAAOO,KAAK,EAAEI,MAAMJ,KAAK,CAACS,SAAS;IAClG;IACA,IAAIL,MAAMF,QAAQ,EAAE;QAClB,oDAAoD;QACpDE,MAAMF,QAAQ,CAACO,SAAS,OAAGnB,UAAAA,EAAKI,yBAAyBQ,QAAQ,EAAEE,MAAMF,QAAQ,CAACO,SAAS;IAC7F;IACA,OAAOL;AACT,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
treeItemLayoutClassNames
|
|
13
|
+
get treeItemLayoutClassNames () {
|
|
14
14
|
return treeItemLayoutClassNames;
|
|
15
15
|
},
|
|
16
|
-
useTreeItemLayoutStyles_unstable
|
|
16
|
+
get useTreeItemLayoutStyles_unstable () {
|
|
17
17
|
return useTreeItemLayoutStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TreeItemLayout/useTreeItemLayoutStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { TreeItemLayoutSlots, TreeItemLayoutState } from './TreeItemLayout.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { useTreeContext_unstable } from '../../contexts/treeContext';\nimport { treeItemLevelToken } from '../../utils/tokens';\nimport { useTreeItemContext_unstable } from '../../contexts/treeItemContext';\n\nexport const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutSlots> = {\n root: 'fui-TreeItemLayout',\n iconBefore: 'fui-TreeItemLayout__iconBefore',\n main: 'fui-TreeItemLayout__main',\n iconAfter: 'fui-TreeItemLayout__iconAfter',\n expandIcon: 'fui-TreeItemLayout__expandIcon',\n aside: 'fui-TreeItemLayout__aside',\n actions: 'fui-TreeItemLayout__actions',\n selector: 'fui-TreeItemLayout__selector',\n};\n\nconst useRootBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n minHeight: '32px',\n boxSizing: 'border-box',\n gridArea: 'layout',\n ':hover': {\n color: tokens.colorNeutralForeground2Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n // TODO: stop using treeItemLayoutClassNames.expandIcon for styling\n [`& .${treeItemLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Hover,\n },\n },\n ':active': {\n color: tokens.colorNeutralForeground2Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n // TODO: stop using treeItemLayoutClassNames.expandIcon for styling\n [`& .${treeItemLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n },\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n leaf: {\n paddingLeft: `calc(var(${treeItemLevelToken}, 1) * ${tokens.spacingHorizontalXXL})`,\n },\n branch: {\n paddingLeft: `calc((var(${treeItemLevelToken}, 1) - 1) * ${tokens.spacingHorizontalXXL})`,\n },\n medium: {\n ...typographyStyles.body1,\n },\n small: {\n minHeight: '24px',\n ...typographyStyles.caption1,\n },\n // Appearance variations\n subtle: {},\n 'subtle-alpha': {\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundLightAlphaHover,\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundLightAlphaPressed,\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n});\n\n/**\n * Styles for the action icon slot\n */\nconst useActionsBaseStyles = makeResetStyles({\n display: 'flex',\n marginLeft: 'auto',\n position: 'relative',\n zIndex: 1,\n gridArea: 'aside',\n padding: `0 ${tokens.spacingHorizontalS}`,\n});\n/**\n * Styles for the action icon slot\n */\nconst useAsideBaseStyles = makeResetStyles({\n display: 'flex',\n marginLeft: 'auto',\n alignItems: 'center',\n zIndex: 0,\n gridArea: 'aside',\n padding: `0 ${tokens.spacingHorizontalM}`,\n gap: tokens.spacingHorizontalXS,\n});\n\n/**\n * Styles for the expand icon slot\n */\nconst useExpandIconBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '24px',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground3,\n flex: `0 0 auto`,\n padding: `${tokens.spacingVerticalXS} 0`,\n});\n\n/**\n * Styles for the content slot\n */\nconst useMainBaseStyles = makeResetStyles({\n padding: `0 ${tokens.spacingHorizontalXXS}`,\n});\n\n/**\n * Styles for the before/after icon slot\n */\nconst useIconBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n color: tokens.colorNeutralForeground2,\n lineHeight: tokens.lineHeightBase500,\n fontSize: tokens.fontSizeBase500,\n});\n\nconst useIconBeforeStyles = makeStyles({\n medium: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n small: {\n paddingRight: tokens.spacingHorizontalXXS,\n },\n});\n\nconst useIconAfterStyles = makeStyles({\n medium: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n small: {\n paddingLeft: tokens.spacingHorizontalXXS,\n },\n});\n\n/**\n * Apply styling to the TreeItemLayout slots based on the state\n */\nexport const useTreeItemLayoutStyles_unstable = (state: TreeItemLayoutState): TreeItemLayoutState => {\n const { main, iconAfter, iconBefore, expandIcon, root, aside, actions, selector } = state;\n const rootStyles = useRootStyles();\n const rootBaseStyles = useRootBaseStyles();\n const actionsBaseStyles = useActionsBaseStyles();\n const asideBaseStyles = useAsideBaseStyles();\n\n const mainBaseStyles = useMainBaseStyles();\n\n const expandIconBaseStyles = useExpandIconBaseStyles();\n const iconBaseStyles = useIconBaseStyles();\n const iconBeforeStyles = useIconBeforeStyles();\n const iconAfterStyles = useIconAfterStyles();\n\n const size = useTreeContext_unstable(ctx => ctx.size);\n const appearance = useTreeContext_unstable(ctx => ctx.appearance);\n const itemType = useTreeItemContext_unstable(ctx => ctx.itemType);\n\n // eslint-disable-next-line react-hooks/immutability\n root.className = mergeClasses(\n treeItemLayoutClassNames.root,\n rootBaseStyles,\n rootStyles[appearance],\n rootStyles[size],\n rootStyles[itemType],\n root.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n main.className = mergeClasses(treeItemLayoutClassNames.main, mainBaseStyles, main.className);\n\n if (expandIcon) {\n // eslint-disable-next-line react-hooks/immutability\n expandIcon.className = mergeClasses(\n treeItemLayoutClassNames.expandIcon,\n expandIconBaseStyles,\n expandIcon.className,\n );\n }\n\n if (iconBefore) {\n // eslint-disable-next-line react-hooks/immutability\n iconBefore.className = mergeClasses(\n treeItemLayoutClassNames.iconBefore,\n iconBaseStyles,\n iconBeforeStyles[size],\n iconBefore.className,\n );\n }\n\n if (iconAfter) {\n // eslint-disable-next-line react-hooks/immutability\n iconAfter.className = mergeClasses(\n treeItemLayoutClassNames.iconAfter,\n iconBaseStyles,\n iconAfterStyles[size],\n iconAfter.className,\n );\n }\n\n if (actions) {\n // eslint-disable-next-line react-hooks/immutability\n actions.className = mergeClasses(treeItemLayoutClassNames.actions, actionsBaseStyles, actions.className);\n }\n if (aside) {\n // eslint-disable-next-line react-hooks/immutability\n aside.className = mergeClasses(treeItemLayoutClassNames.aside, asideBaseStyles, aside.className);\n }\n if (selector) {\n // eslint-disable-next-line react-hooks/immutability\n selector.className = mergeClasses(treeItemLayoutClassNames.selector, selector.className);\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","useTreeContext_unstable","treeItemLevelToken","useTreeItemContext_unstable","treeItemLayoutClassNames","root","iconBefore","main","iconAfter","expandIcon","aside","actions","selector","useRootBaseStyles","display","alignItems","minHeight","boxSizing","gridArea","color","colorNeutralForeground2Hover","backgroundColor","colorSubtleBackgroundHover","colorNeutralForeground3Hover","colorNeutralForeground2Pressed","colorSubtleBackgroundPressed","colorNeutralForeground3Pressed","useRootStyles","leaf","paddingLeft","spacingHorizontalXXL","branch","medium","body1","small","caption1","subtle","colorSubtleBackgroundLightAlphaHover","colorSubtleBackgroundLightAlphaPressed","transparent","colorTransparentBackground","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","useActionsBaseStyles","marginLeft","position","zIndex","padding","spacingHorizontalS","useAsideBaseStyles","spacingHorizontalM","gap","spacingHorizontalXS","useExpandIconBaseStyles","justifyContent","minWidth","colorNeutralForeground3","flex","spacingVerticalXS","useMainBaseStyles","spacingHorizontalXXS","useIconBaseStyles","colorNeutralForeground2","lineHeight","lineHeightBase500","fontSize","fontSizeBase500","useIconBeforeStyles","paddingRight","useIconAfterStyles","useTreeItemLayoutStyles_unstable","state","rootStyles","rootBaseStyles","actionsBaseStyles","asideBaseStyles","mainBaseStyles","expandIconBaseStyles","iconBaseStyles","iconBeforeStyles","iconAfterStyles","size","ctx","appearance","itemType","className"],"mappings":"AAAA;;;;;;;;;;;;IAUaQ,wBAAAA;;;IAsJAkE,gCAAAA;;;;uBA9J6C,iBAAiB;4BAGlC,wBAAwB;6BACzB,gCAA6B;wBAClC,wBAAqB;iCACZ,oCAAiC;AAEtE,iCAAsE;IAC3EjE,MAAM;IACNC,YAAY;IACZC,MAAM;IACNC,WAAW;IACXC,YAAY;IACZC,OAAO;IACPC,SAAS;IACTC,UAAU;AACZ,EAAE;AAEF,MAAMC,oBAAoBjB,0BAAAA,EAAgB;IACxCkB,SAAS;IACTC,YAAY;IACZC,WAAW;IACXC,WAAW;IACXC,UAAU;IACV,UAAU;QACRC,OAAOpB,kBAAAA,CAAOqB,4BAA4B;QAC1CC,iBAAiBtB,kBAAAA,CAAOuB,0BAA0B;QAClD,oEAAoE;QACpE,CAAC,CAAC,GAAG,EAAElB,yBAAyBK,UAAU,EAAE,CAAC,EAAE;YAC7CU,OAAOpB,kBAAAA,CAAOwB,4BAA4B;QAC5C;IACF;IACA,WAAW;QACTJ,OAAOpB,kBAAAA,CAAOyB,8BAA8B;QAC5CH,iBAAiBtB,kBAAAA,CAAO0B,4BAA4B;QACpD,mEAAmE;QACnE,CAAC,CAAC,GAAG,EAAErB,yBAAyBK,UAAU,EAAE,CAAC,EAAE;YAC7CU,OAAOpB,kBAAAA,CAAO2B,8BAA8B;QAC9C;IACF;AACF;AAEA;;CAEC,GACD,MAAMC,oBAAgB9B,iBAAAA,EAAW;IAC/B+B,MAAM;QACJC,aAAa,CAAC,SAAS,EAAE3B,0BAAAA,CAAmB,OAAO,EAAEH,kBAAAA,CAAO+B,oBAAoB,CAAC,CAAC,CAAC;IACrF;IACAC,QAAQ;QACNF,aAAa,CAAC,UAAU,EAAE3B,0BAAAA,CAAm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emLayout/useTreeItemLayoutStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { TreeItemLayoutSlots, TreeItemLayoutState } from './TreeItemLayout.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { useTreeContext_unstable } from '../../contexts/treeContext';\nimport { treeItemLevelToken } from '../../utils/tokens';\nimport { useTreeItemContext_unstable } from '../../contexts/treeItemContext';\n\nexport const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutSlots> = {\n root: 'fui-TreeItemLayout',\n iconBefore: 'fui-TreeItemLayout__iconBefore',\n main: 'fui-TreeItemLayout__main',\n iconAfter: 'fui-TreeItemLayout__iconAfter',\n expandIcon: 'fui-TreeItemLayout__expandIcon',\n aside: 'fui-TreeItemLayout__aside',\n actions: 'fui-TreeItemLayout__actions',\n selector: 'fui-TreeItemLayout__selector',\n};\n\nconst useRootBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n minHeight: '32px',\n boxSizing: 'border-box',\n gridArea: 'layout',\n ':hover': {\n color: tokens.colorNeutralForeground2Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n // TODO: stop using treeItemLayoutClassNames.expandIcon for styling\n [`& .${treeItemLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Hover,\n },\n },\n ':active': {\n color: tokens.colorNeutralForeground2Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n // TODO: stop using treeItemLayoutClassNames.expandIcon for styling\n [`& .${treeItemLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n },\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n leaf: {\n paddingLeft: `calc(var(${treeItemLevelToken}, 1) * ${tokens.spacingHorizontalXXL})`,\n },\n branch: {\n paddingLeft: `calc((var(${treeItemLevelToken}, 1) - 1) * ${tokens.spacingHorizontalXXL})`,\n },\n medium: {\n ...typographyStyles.body1,\n },\n small: {\n minHeight: '24px',\n ...typographyStyles.caption1,\n },\n // Appearance variations\n subtle: {},\n 'subtle-alpha': {\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundLightAlphaHover,\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundLightAlphaPressed,\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n});\n\n/**\n * Styles for the action icon slot\n */\nconst useActionsBaseStyles = makeResetStyles({\n display: 'flex',\n marginLeft: 'auto',\n position: 'relative',\n zIndex: 1,\n gridArea: 'aside',\n padding: `0 ${tokens.spacingHorizontalS}`,\n});\n/**\n * Styles for the action icon slot\n */\nconst useAsideBaseStyles = makeResetStyles({\n display: 'flex',\n marginLeft: 'auto',\n alignItems: 'center',\n zIndex: 0,\n gridArea: 'aside',\n padding: `0 ${tokens.spacingHorizontalM}`,\n gap: tokens.spacingHorizontalXS,\n});\n\n/**\n * Styles for the expand icon slot\n */\nconst useExpandIconBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '24px',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground3,\n flex: `0 0 auto`,\n padding: `${tokens.spacingVerticalXS} 0`,\n});\n\n/**\n * Styles for the content slot\n */\nconst useMainBaseStyles = makeResetStyles({\n padding: `0 ${tokens.spacingHorizontalXXS}`,\n});\n\n/**\n * Styles for the before/after icon slot\n */\nconst useIconBaseStyles = makeResetStyles({\n display: 'flex',\n alignItems: 'center',\n color: tokens.colorNeutralForeground2,\n lineHeight: tokens.lineHeightBase500,\n fontSize: tokens.fontSizeBase500,\n});\n\nconst useIconBeforeStyles = makeStyles({\n medium: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n small: {\n paddingRight: tokens.spacingHorizontalXXS,\n },\n});\n\nconst useIconAfterStyles = makeStyles({\n medium: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n small: {\n paddingLeft: tokens.spacingHorizontalXXS,\n },\n});\n\n/**\n * Apply styling to the TreeItemLayout slots based on the state\n */\nexport const useTreeItemLayoutStyles_unstable = (state: TreeItemLayoutState): TreeItemLayoutState => {\n const { main, iconAfter, iconBefore, expandIcon, root, aside, actions, selector } = state;\n const rootStyles = useRootStyles();\n const rootBaseStyles = useRootBaseStyles();\n const actionsBaseStyles = useActionsBaseStyles();\n const asideBaseStyles = useAsideBaseStyles();\n\n const mainBaseStyles = useMainBaseStyles();\n\n const expandIconBaseStyles = useExpandIconBaseStyles();\n const iconBaseStyles = useIconBaseStyles();\n const iconBeforeStyles = useIconBeforeStyles();\n const iconAfterStyles = useIconAfterStyles();\n\n const size = useTreeContext_unstable(ctx => ctx.size);\n const appearance = useTreeContext_unstable(ctx => ctx.appearance);\n const itemType = useTreeItemContext_unstable(ctx => ctx.itemType);\n\n // eslint-disable-next-line react-hooks/immutability\n root.className = mergeClasses(\n treeItemLayoutClassNames.root,\n rootBaseStyles,\n rootStyles[appearance],\n rootStyles[size],\n rootStyles[itemType],\n root.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n main.className = mergeClasses(treeItemLayoutClassNames.main, mainBaseStyles, main.className);\n\n if (expandIcon) {\n // eslint-disable-next-line react-hooks/immutability\n expandIcon.className = mergeClasses(\n treeItemLayoutClassNames.expandIcon,\n expandIconBaseStyles,\n expandIcon.className,\n );\n }\n\n if (iconBefore) {\n // eslint-disable-next-line react-hooks/immutability\n iconBefore.className = mergeClasses(\n treeItemLayoutClassNames.iconBefore,\n iconBaseStyles,\n iconBeforeStyles[size],\n iconBefore.className,\n );\n }\n\n if (iconAfter) {\n // eslint-disable-next-line react-hooks/immutability\n iconAfter.className = mergeClasses(\n treeItemLayoutClassNames.iconAfter,\n iconBaseStyles,\n iconAfterStyles[size],\n iconAfter.className,\n );\n }\n\n if (actions) {\n // eslint-disable-next-line react-hooks/immutability\n actions.className = mergeClasses(treeItemLayoutClassNames.actions, actionsBaseStyles, actions.className);\n }\n if (aside) {\n // eslint-disable-next-line react-hooks/immutability\n aside.className = mergeClasses(treeItemLayoutClassNames.aside, asideBaseStyles, aside.className);\n }\n if (selector) {\n // eslint-disable-next-line react-hooks/immutability\n selector.className = mergeClasses(treeItemLayoutClassNames.selector, selector.className);\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","useTreeContext_unstable","treeItemLevelToken","useTreeItemContext_unstable","treeItemLayoutClassNames","root","iconBefore","main","iconAfter","expandIcon","aside","actions","selector","useRootBaseStyles","display","alignItems","minHeight","boxSizing","gridArea","color","colorNeutralForeground2Hover","backgroundColor","colorSubtleBackgroundHover","colorNeutralForeground3Hover","colorNeutralForeground2Pressed","colorSubtleBackgroundPressed","colorNeutralForeground3Pressed","useRootStyles","leaf","paddingLeft","spacingHorizontalXXL","branch","medium","body1","small","caption1","subtle","colorSubtleBackgroundLightAlphaHover","colorSubtleBackgroundLightAlphaPressed","transparent","colorTransparentBackground","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","useActionsBaseStyles","marginLeft","position","zIndex","padding","spacingHorizontalS","useAsideBaseStyles","spacingHorizontalM","gap","spacingHorizontalXS","useExpandIconBaseStyles","justifyContent","minWidth","colorNeutralForeground3","flex","spacingVerticalXS","useMainBaseStyles","spacingHorizontalXXS","useIconBaseStyles","colorNeutralForeground2","lineHeight","lineHeightBase500","fontSize","fontSizeBase500","useIconBeforeStyles","paddingRight","useIconAfterStyles","useTreeItemLayoutStyles_unstable","state","rootStyles","rootBaseStyles","actionsBaseStyles","asideBaseStyles","mainBaseStyles","expandIconBaseStyles","iconBaseStyles","iconBeforeStyles","iconAfterStyles","size","ctx","appearance","itemType","className"],"mappings":"AAAA;;;;;;;;;;;;QAUaQ;;;QAsJAkE;;;;uBA9J6C,iBAAiB;4BAGlC,wBAAwB;6BAC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AAA,EAAaM,yBAAyBG,IAAI,EAAEqE,gBAAgBrE,KAAK8E,SAAS;IAE3F,IAAI5E,YAAY;QACd,oDAAoD;QACpDA,WAAW4E,SAAS,OAAGvF,mBAAAA,EACrBM,yBAAyBK,UAAU,EACnCoE,sBACApE,WAAW4E,SAAS;IAExB;IAEA,IAAI/E,YAAY;QACd,oDAAoD;QACpDA,WAAW+E,SAAS,OAAGvF,mBAAAA,EACrBM,yBAAyBE,UAAU,EACnCwE,gBACAC,gBAAgB,CAACE,KAAK,EACtB3E,WAAW+E,SAAS;IAExB;IAEA,IAAI7E,WAAW;QACb,oDAAoD;QACpDA,UAAU6E,SAAS,OAAGvF,mBAAAA,EACpBM,yBAAyBI,SAAS,EAClCsE,gBACAE,eAAe,CAACC,KAAK,EACrBzE,UAAU6E,SAAS;IAEvB;IAEA,IAAI1E,SAAS;QACX,oDAAoD;QACpDA,QAAQ0E,SAAS,OAAGvF,mBAAAA,EAAaM,yBAAyBO,OAAO,EAAE+D,mBAAmB/D,QAAQ0E,SAAS;IACzG;IACA,IAAI3E,OAAO;QACT,oDAAoD;QACpDA,MAAM2E,SAAS,OAAGvF,mBAAAA,EAAaM,yBAAyBM,KAAK,EAAEiE,iBAAiBjE,MAAM2E,SAAS;IACjG;IACA,IAAIzE,UAAU;QACZ,oDAAoD;QACpDA,SAASyE,SAAS,OAAGvF,mBAAAA,EAAaM,yBAAyBQ,QAAQ,EAAEA,SAASyE,SAAS;IACzF;IAEA,OAAOd;AACT,EAAE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
get treeItemLayoutClassNames () {
|
|
14
|
+
return treeItemLayoutClassNames;
|
|
15
|
+
},
|
|
16
|
+
get useTreeItemLayoutStyles_unstable () {
|
|
17
|
+
return useTreeItemLayoutStyles_unstable;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
21
|
+
const _clsx = require("clsx");
|
|
22
|
+
const _treeContext = require("../../contexts/treeContext.cjs");
|
|
23
|
+
const _treeItemContext = require("../../contexts/treeItemContext.cjs");
|
|
24
|
+
const _TreeItemLayoutmodulecss = /*#__PURE__*/ _interop_require_default._(require("./TreeItemLayout.module.css"));
|
|
25
|
+
const treeItemLayoutClassNames = {
|
|
26
|
+
root: 'fui-TreeItemLayout',
|
|
27
|
+
iconBefore: 'fui-TreeItemLayout__iconBefore',
|
|
28
|
+
main: 'fui-TreeItemLayout__main',
|
|
29
|
+
iconAfter: 'fui-TreeItemLayout__iconAfter',
|
|
30
|
+
expandIcon: 'fui-TreeItemLayout__expandIcon',
|
|
31
|
+
aside: 'fui-TreeItemLayout__aside',
|
|
32
|
+
actions: 'fui-TreeItemLayout__actions',
|
|
33
|
+
selector: 'fui-TreeItemLayout__selector'
|
|
34
|
+
};
|
|
35
|
+
const useTreeItemLayoutStyles_unstable = (state)=>{
|
|
36
|
+
const size = (0, _treeContext.useTreeContext_unstable)((ctx)=>ctx.size);
|
|
37
|
+
const appearance = (0, _treeContext.useTreeContext_unstable)((ctx)=>ctx.appearance);
|
|
38
|
+
const itemType = (0, _treeItemContext.useTreeItemContext_unstable)((ctx)=>ctx.itemType);
|
|
39
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
40
|
+
state.root.className = (0, _clsx.clsx)(treeItemLayoutClassNames.root, _TreeItemLayoutmodulecss.default.root, _TreeItemLayoutmodulecss.default[itemType], _TreeItemLayoutmodulecss.default[appearance], _TreeItemLayoutmodulecss.default[size], state.root.className);
|
|
41
|
+
if (state.main) {
|
|
42
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
43
|
+
state.main.className = (0, _clsx.clsx)(treeItemLayoutClassNames.main, _TreeItemLayoutmodulecss.default.main, state.main.className);
|
|
44
|
+
}
|
|
45
|
+
if (state.expandIcon) {
|
|
46
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
47
|
+
state.expandIcon.className = (0, _clsx.clsx)(treeItemLayoutClassNames.expandIcon, _TreeItemLayoutmodulecss.default.expandIcon, state.expandIcon.className);
|
|
48
|
+
}
|
|
49
|
+
if (state.iconBefore) {
|
|
50
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
51
|
+
state.iconBefore.className = (0, _clsx.clsx)(treeItemLayoutClassNames.iconBefore, _TreeItemLayoutmodulecss.default.iconBefore, state.iconBefore.className);
|
|
52
|
+
}
|
|
53
|
+
if (state.iconAfter) {
|
|
54
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
55
|
+
state.iconAfter.className = (0, _clsx.clsx)(treeItemLayoutClassNames.iconAfter, _TreeItemLayoutmodulecss.default.iconAfter, state.iconAfter.className);
|
|
56
|
+
}
|
|
57
|
+
if (state.actions) {
|
|
58
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
59
|
+
state.actions.className = (0, _clsx.clsx)(treeItemLayoutClassNames.actions, _TreeItemLayoutmodulecss.default.actions, state.actions.className);
|
|
60
|
+
}
|
|
61
|
+
if (state.aside) {
|
|
62
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
63
|
+
state.aside.className = (0, _clsx.clsx)(treeItemLayoutClassNames.aside, _TreeItemLayoutmodulecss.default.aside, state.aside.className);
|
|
64
|
+
}
|
|
65
|
+
if (state.selector) {
|
|
66
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
67
|
+
state.selector.className = (0, _clsx.clsx)(treeItemLayoutClassNames.selector, state.selector.className);
|
|
68
|
+
}
|
|
69
|
+
return state;
|
|
70
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.ts"],"sourcesContent":["'use client';\n\nimport { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { TreeItemLayoutState, TreeItemLayoutSlots } from './TreeItemLayout.types';\nimport { useTreeContext_unstable } from '../../contexts/treeContext';\nimport { useTreeItemContext_unstable } from '../../contexts/treeItemContext';\nimport styles from './TreeItemLayout.module.css';\n\nexport const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutSlots> = {\n root: 'fui-TreeItemLayout',\n iconBefore: 'fui-TreeItemLayout__iconBefore',\n main: 'fui-TreeItemLayout__main',\n iconAfter: 'fui-TreeItemLayout__iconAfter',\n expandIcon: 'fui-TreeItemLayout__expandIcon',\n aside: 'fui-TreeItemLayout__aside',\n actions: 'fui-TreeItemLayout__actions',\n selector: 'fui-TreeItemLayout__selector',\n};\n\nexport const useTreeItemLayoutStyles_unstable = (state: TreeItemLayoutState): TreeItemLayoutState => {\n const size = useTreeContext_unstable(ctx => ctx.size);\n const appearance = useTreeContext_unstable(ctx => ctx.appearance);\n const itemType = useTreeItemContext_unstable(ctx => ctx.itemType);\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = clsx(\n treeItemLayoutClassNames.root,\n styles.root,\n styles[itemType],\n styles[appearance],\n styles[size],\n state.root.className,\n );\n if (state.main) {\n // eslint-disable-next-line react-hooks/immutability\n state.main.className = clsx(treeItemLayoutClassNames.main, styles.main, state.main.className);\n }\n if (state.expandIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.expandIcon.className = clsx(\n treeItemLayoutClassNames.expandIcon,\n styles.expandIcon,\n state.expandIcon.className,\n );\n }\n if (state.iconBefore) {\n // eslint-disable-next-line react-hooks/immutability\n state.iconBefore.className = clsx(\n treeItemLayoutClassNames.iconBefore,\n styles.iconBefore,\n state.iconBefore.className,\n );\n }\n if (state.iconAfter) {\n // eslint-disable-next-line react-hooks/immutability\n state.iconAfter.className = clsx(treeItemLayoutClassNames.iconAfter, styles.iconAfter, state.iconAfter.className);\n }\n if (state.actions) {\n // eslint-disable-next-line react-hooks/immutability\n state.actions.className = clsx(treeItemLayoutClassNames.actions, styles.actions, state.actions.className);\n }\n if (state.aside) {\n // eslint-disable-next-line react-hooks/immutability\n state.aside.className = clsx(treeItemLayoutClassNames.aside, styles.aside, state.aside.className);\n }\n if (state.selector) {\n // eslint-disable-next-line react-hooks/immutability\n state.selector.className = clsx(treeItemLayoutClassNames.selector, state.selector.className);\n }\n return state;\n};\n"],"names":["clsx","useTreeContext_unstable","useTreeItemContext_unstable","styles","treeItemLayoutClassNames","root","iconBefore","main","iconAfter","expandIcon","aside","actions","selector","useTreeItemLayoutStyles_unstable","state","size","ctx","appearance","itemType","className"],"mappings":"AAAA;;;;;;;;;;;;QASaI;;;;;;;;sBAPQ,OAAO;6BAGY,gCAA6B;iCACzB,oCAAiC;kFAC1D,8BAA8B;AAE1C,iCAAsE;IAC3EC,MAAM;IACNC,YAAY;IACZC,MAAM;IACNC,WAAW;IACXC,YAAY;IACZC,OAAO;IACPC,SAAS;IACTC,UAAU;AACZ,EAAE;AAEK,MAAMC,mCAAmC,CAACC;IAC/C,MAAMC,WAAOd,oCAAAA,EAAwBe,CAAAA,MAAOA,IAAID,IAAI;IACpD,MAAME,iBAAahB,oCAAAA,EAAwBe,CAAAA,MAAOA,IAAIC,UAAU;IAChE,MAAMC,eAAWhB,4CAAAA,EAA4Bc,CAAAA,MAAOA,IAAIE,QAAQ;IAChE,oDAAoD;IACpDJ,MAAMT,IAAI,CAACc,SAAS,OAAGnB,UAAAA,EACrBI,yBAAyBC,IAAI,EAC7BF,gCAAAA,CAAOE,IAAI,EACXF,gCAAM,CAACe,SAAS,EAChBf,gCAAM,CAACc,WAAW,EAClBd,gCAAM,CAACY,KAAK,EACZD,MAAMT,IAAI,CAACc,SAAS;IAEtB,IAAIL,MAAMP,IAAI,EAAE;QACd,oDAAoD;QACpDO,MAAMP,IAAI,CAACY,SAA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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TreeItemPersonaLayout/TreeItemPersonaLayout.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useTreeItemPersonaLayout_unstable } from './useTreeItemPersonaLayout';\nimport { renderTreeItemPersonaLayout_unstable } from './renderTreeItemPersonaLayout';\nimport { useTreeItemPersonaLayoutStyles_unstable } from './useTreeItemPersonaLayoutStyles.styles';\nimport type { TreeItemPersonaLayoutProps } from './TreeItemPersonaLayout.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTreeItemPersonaLayoutContextValues_unstable } from './useTreeItemPersonaLayoutContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * The `TreeItemPersonaLayout` component is used as a child of `TreeItem` to display a `TreeItem` with a media (typically an avatar) and a description.\n * It provides a more visually appealing representation of a `TreeItem` and is typically used to display a list of people or topics.\n * This component should only be used as a direct child of `TreeItem`.\n */\nexport const TreeItemPersonaLayout: ForwardRefComponent<TreeItemPersonaLayoutProps> = React.forwardRef((props, ref) => {\n const state = useTreeItemPersonaLayout_unstable(props, ref);\n\n useTreeItemPersonaLayoutStyles_unstable(state);\n useCustomStyleHook_unstable('useTreeItemPersonaLayoutStyles_unstable')(state);\n\n const contextValues = useTreeItemPersonaLayoutContextValues_unstable(state);\n\n return renderTreeItemPersonaLayout_unstable(state, contextValues);\n});\n\nTreeItemPersonaLayout.displayName = 'TreeItemPersonaLayout';\n"],"names":["React","useTreeItemPersonaLayout_unstable","renderTreeItemPersonaLayout_unstable","useTreeItemPersonaLayoutStyles_unstable","useTreeItemPersonaLayoutContextValues_unstable","useCustomStyleHook_unstable","TreeItemPersonaLayout","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;0CACmB,gCAA6B;6CAC1B,mCAAgC;sDAC7B,6CAA0C;uDAGnC,6CAA0C;qCAC7D,kCAAkC;AAOvE,MAAMM,wBAAAA,WAAAA,GAAyEN,OAAMO,UAAU,CAAC,CAACC,OAAOC;IAC7G,MAAMC,YAAQT,2DAAAA,EAAkCO,OAAOC;QAEvDN,6EAAAA,EAAwCO;QACxCL,gDAAAA,EAA4B,2CAA2CK;IAEvE,MAAMC,oBAAgBP,qFAAAA,EAA+CM;IAErE,WAAOR,iEAAAA,EAAqCQ,OAAOC;AACrD,GAAG;AAEHL,sBAAsBM,WAAW,GAAG"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.root {
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-rows: 1fr auto;
|
|
5
|
+
grid-template-columns: auto auto 1fr auto;
|
|
6
|
+
grid-template-areas:
|
|
7
|
+
'expandIcon media main aside'
|
|
8
|
+
'expandIcon media description aside';
|
|
9
|
+
align-items: center;
|
|
10
|
+
font-family: var(--fontFamilyBase);
|
|
11
|
+
font-size: var(--fontSizeBase300);
|
|
12
|
+
font-weight: var(--fontWeightRegular);
|
|
13
|
+
line-height: var(--lineHeightBase300);
|
|
14
|
+
|
|
15
|
+
/* Preserve the original reset: hover takes precedence while active. */
|
|
16
|
+
&:active {
|
|
17
|
+
color: var(--colorNeutralForeground2Pressed);
|
|
18
|
+
background-color: var(--colorSubtleBackgroundPressed);
|
|
19
|
+
& :global(.fui-TreeItemPersonaLayout__expandIcon) {
|
|
20
|
+
color: var(--colorNeutralForeground3Pressed);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&:hover {
|
|
24
|
+
color: var(--colorNeutralForeground2Hover);
|
|
25
|
+
background-color: var(--colorSubtleBackgroundHover);
|
|
26
|
+
& :global(.fui-TreeItemPersonaLayout__expandIcon) {
|
|
27
|
+
color: var(--colorNeutralForeground3Hover);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.leaf {
|
|
33
|
+
padding-inline-start: calc(var(--fluent-TreeItem--level, 1) * var(--spacingHorizontalXXL));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.branch {
|
|
37
|
+
padding-inline-start: calc((var(--fluent-TreeItem--level, 1) - 1) * var(--spacingHorizontalXXL));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.medium {
|
|
41
|
+
font-family: var(--fontFamilyBase);
|
|
42
|
+
font-size: var(--fontSizeBase300);
|
|
43
|
+
font-weight: var(--fontWeightRegular);
|
|
44
|
+
line-height: var(--lineHeightBase300);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.small {
|
|
48
|
+
min-height: var(--spacingHorizontalXXL);
|
|
49
|
+
font-family: var(--fontFamilyBase);
|
|
50
|
+
font-size: var(--fontSizeBase200);
|
|
51
|
+
font-weight: var(--fontWeightRegular);
|
|
52
|
+
line-height: var(--lineHeightBase200);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.subtle {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.subtle-alpha {
|
|
59
|
+
&:hover {
|
|
60
|
+
background-color: var(--colorSubtleBackgroundLightAlphaHover);
|
|
61
|
+
}
|
|
62
|
+
&:active {
|
|
63
|
+
background-color: var(--colorSubtleBackgroundLightAlphaPressed);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.transparent {
|
|
68
|
+
background-color: var(--colorTransparentBackground);
|
|
69
|
+
&:hover {
|
|
70
|
+
background-color: var(--colorTransparentBackgroundHover);
|
|
71
|
+
}
|
|
72
|
+
&:active {
|
|
73
|
+
background-color: var(--colorTransparentBackgroundPressed);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.media {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
width: var(--spacingHorizontalXXXL);
|
|
81
|
+
height: var(--spacingHorizontalXXXL);
|
|
82
|
+
grid-area: media;
|
|
83
|
+
padding-top: 0;
|
|
84
|
+
padding-inline-end: var(--spacingHorizontalXS);
|
|
85
|
+
padding-bottom: 0;
|
|
86
|
+
padding-inline-start: var(--spacingHorizontalXXS);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.main {
|
|
90
|
+
grid-area: main;
|
|
91
|
+
padding-top: var(--spacingVerticalMNudge);
|
|
92
|
+
padding-inline-end: var(--spacingHorizontalXS);
|
|
93
|
+
padding-bottom: var(--spacingVerticalMNudge);
|
|
94
|
+
padding-inline-start: var(--spacingHorizontalS);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.description {
|
|
98
|
+
grid-area: description;
|
|
99
|
+
font-family: var(--fontFamilyBase);
|
|
100
|
+
font-size: var(--fontSizeBase200);
|
|
101
|
+
font-weight: var(--fontWeightRegular);
|
|
102
|
+
line-height: var(--lineHeightBase200);
|
|
103
|
+
padding-top: 0;
|
|
104
|
+
padding-inline-end: var(--spacingHorizontalXS);
|
|
105
|
+
padding-bottom: var(--spacingVerticalMNudge);
|
|
106
|
+
padding-inline-start: var(--spacingHorizontalS);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.actions {
|
|
110
|
+
display: flex;
|
|
111
|
+
margin-inline-start: auto;
|
|
112
|
+
position: relative;
|
|
113
|
+
z-index: 1;
|
|
114
|
+
grid-area: aside;
|
|
115
|
+
padding: 0 var(--spacingHorizontalS);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.aside {
|
|
119
|
+
display: flex;
|
|
120
|
+
margin-inline-start: auto;
|
|
121
|
+
align-items: center;
|
|
122
|
+
z-index: 0;
|
|
123
|
+
grid-area: aside;
|
|
124
|
+
padding: 0 var(--spacingHorizontalM);
|
|
125
|
+
gap: var(--spacingHorizontalXS);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.expandIcon {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
min-width: var(--spacingHorizontalXXL);
|
|
133
|
+
box-sizing: border-box;
|
|
134
|
+
color: var(--colorNeutralForeground3);
|
|
135
|
+
grid-area: expandIcon;
|
|
136
|
+
flex: 0 0 auto;
|
|
137
|
+
padding: var(--spacingVerticalXS) 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.selector {
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:where(.withDescription) > .main {
|
|
144
|
+
padding-top: var(--spacingVerticalMNudge);
|
|
145
|
+
padding-inline-end: var(--spacingHorizontalXS);
|
|
146
|
+
padding-bottom: 0;
|
|
147
|
+
padding-inline-start: var(--spacingHorizontalS);
|
|
148
|
+
}
|
|
149
|
+
}
|