@mantine/core 9.4.1 → 9.4.3-alpha.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.
Files changed (66) hide show
  1. package/cjs/components/Accordion/Accordion.cjs +5 -3
  2. package/cjs/components/Accordion/Accordion.cjs.map +1 -1
  3. package/cjs/components/Accordion/Accordion.context.cjs.map +1 -1
  4. package/cjs/components/Accordion/AccordionPanel/AccordionPanel.cjs +2 -1
  5. package/cjs/components/Accordion/AccordionPanel/AccordionPanel.cjs.map +1 -1
  6. package/cjs/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.cjs +2 -2
  7. package/cjs/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.cjs.map +1 -1
  8. package/cjs/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.cjs +2 -2
  9. package/cjs/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.cjs.map +1 -1
  10. package/cjs/components/Collapse/Collapse.cjs +23 -10
  11. package/cjs/components/Collapse/Collapse.cjs.map +1 -1
  12. package/cjs/components/Menubar/MenubarTarget/MenubarTarget.cjs +1 -1
  13. package/cjs/components/Menubar/MenubarTarget/MenubarTarget.cjs.map +1 -1
  14. package/cjs/components/ModalBase/ModalBase.cjs +3 -2
  15. package/cjs/components/ModalBase/ModalBase.cjs.map +1 -1
  16. package/cjs/components/Transition/Transition.cjs.map +1 -1
  17. package/cjs/components/Tree/FlatTreeNode.cjs +16 -3
  18. package/cjs/components/Tree/FlatTreeNode.cjs.map +1 -1
  19. package/cjs/components/Tree/Tree.module.cjs.map +1 -1
  20. package/cjs/components/Tree/TreeNode.cjs +17 -5
  21. package/cjs/components/Tree/TreeNode.cjs.map +1 -1
  22. package/cjs/components/Tree/flatten-tree-data/flatten-tree-data.cjs +1 -1
  23. package/cjs/components/Tree/flatten-tree-data/flatten-tree-data.cjs.map +1 -1
  24. package/cjs/components/TreeSelect/TreeSelectOption.cjs +5 -3
  25. package/cjs/components/TreeSelect/TreeSelectOption.cjs.map +1 -1
  26. package/cjs/components/TreeSelect/flatten-tree-select-data.cjs +1 -1
  27. package/cjs/components/TreeSelect/flatten-tree-select-data.cjs.map +1 -1
  28. package/esm/components/Accordion/Accordion.context.mjs.map +1 -1
  29. package/esm/components/Accordion/Accordion.mjs +5 -3
  30. package/esm/components/Accordion/Accordion.mjs.map +1 -1
  31. package/esm/components/Accordion/AccordionPanel/AccordionPanel.mjs +2 -1
  32. package/esm/components/Accordion/AccordionPanel/AccordionPanel.mjs.map +1 -1
  33. package/esm/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.mjs +2 -2
  34. package/esm/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.mjs.map +1 -1
  35. package/esm/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.mjs +2 -2
  36. package/esm/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.mjs.map +1 -1
  37. package/esm/components/Collapse/Collapse.mjs +23 -10
  38. package/esm/components/Collapse/Collapse.mjs.map +1 -1
  39. package/esm/components/Menubar/MenubarTarget/MenubarTarget.mjs +1 -1
  40. package/esm/components/Menubar/MenubarTarget/MenubarTarget.mjs.map +1 -1
  41. package/esm/components/ModalBase/ModalBase.mjs +3 -2
  42. package/esm/components/ModalBase/ModalBase.mjs.map +1 -1
  43. package/esm/components/Transition/Transition.mjs.map +1 -1
  44. package/esm/components/Tree/FlatTreeNode.mjs +16 -3
  45. package/esm/components/Tree/FlatTreeNode.mjs.map +1 -1
  46. package/esm/components/Tree/Tree.module.mjs.map +1 -1
  47. package/esm/components/Tree/TreeNode.mjs +17 -5
  48. package/esm/components/Tree/TreeNode.mjs.map +1 -1
  49. package/esm/components/Tree/flatten-tree-data/flatten-tree-data.mjs +1 -1
  50. package/esm/components/Tree/flatten-tree-data/flatten-tree-data.mjs.map +1 -1
  51. package/esm/components/TreeSelect/TreeSelectOption.mjs +5 -3
  52. package/esm/components/TreeSelect/TreeSelectOption.mjs.map +1 -1
  53. package/esm/components/TreeSelect/flatten-tree-select-data.mjs +1 -1
  54. package/esm/components/TreeSelect/flatten-tree-select-data.mjs.map +1 -1
  55. package/lib/components/Accordion/Accordion.context.d.ts +1 -0
  56. package/lib/components/Accordion/Accordion.d.ts +2 -0
  57. package/lib/components/Accordion/AccordionPanel/AccordionPanel.d.ts +2 -0
  58. package/lib/components/Collapse/Collapse.d.ts +6 -0
  59. package/lib/components/ModalBase/ModalBase.d.ts +7 -1
  60. package/lib/components/Transition/Transition.d.ts +2 -2
  61. package/lib/components/TreeSelect/TreeSelectOption.d.ts +4 -0
  62. package/package.json +2 -2
  63. package/styles/Tree.css +1 -1
  64. package/styles/Tree.layer.css +1 -1
  65. package/styles.css +1 -1
  66. package/styles.layer.css +1 -1
@@ -23,7 +23,8 @@ const defaultProps = {
23
23
  chevronPosition: "right",
24
24
  variant: "default",
25
25
  chevronSize: "auto",
26
- chevronIconSize: 16
26
+ chevronIconSize: 16,
27
+ keepMountedMode: "activity"
27
28
  };
28
29
  const varsResolver = require_create_vars_resolver.createVarsResolver((_, { transitionDuration, chevronSize, radius }) => ({ root: {
29
30
  "--accordion-transition-duration": transitionDuration === void 0 ? void 0 : `${transitionDuration}ms`,
@@ -32,7 +33,7 @@ const varsResolver = require_create_vars_resolver.createVarsResolver((_, { trans
32
33
  } }));
33
34
  const Accordion = require_factory.genericFactory((_props) => {
34
35
  const props = require_use_props.useProps("Accordion", defaultProps, _props);
35
- const { classNames, className, style, styles, unstyled, vars, children, multiple, value, defaultValue, onChange, id, loop, transitionDuration, disableChevronRotation, chevronPosition, chevronSize, order, chevron, variant, radius, chevronIconSize, attributes, keepMounted, ...others } = props;
36
+ const { classNames, className, style, styles, unstyled, vars, children, multiple, value, defaultValue, onChange, id, loop, transitionDuration, disableChevronRotation, chevronPosition, chevronSize, order, chevron, variant, radius, chevronIconSize, attributes, keepMounted, keepMountedMode, ...others } = props;
36
37
  const uid = (0, _mantine_hooks.useId)(id);
37
38
  const [_value, handleChange] = (0, _mantine_hooks.useUncontrolled)({
38
39
  value,
@@ -72,7 +73,8 @@ const Accordion = require_factory.genericFactory((_props) => {
72
73
  getStyles,
73
74
  variant,
74
75
  unstyled,
75
- keepMounted
76
+ keepMounted,
77
+ keepMountedMode
76
78
  },
77
79
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
78
80
  ...getStyles("root"),
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.cjs","names":["createVarsResolver","rem","getRadius","genericFactory","useProps","useStyles","AccordionProvider","getSafeId","AccordionChevron","Box","classes","AccordionItem","AccordionPanel","AccordionControl"],"sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n Factory,\n genericFactory,\n getRadius,\n getSafeId,\n MantineRadius,\n rem,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { AccordionProvider } from './Accordion.context';\nimport { AccordionChevronPosition, AccordionHeadingOrder, AccordionValue } from './Accordion.types';\nimport { AccordionChevron } from './AccordionChevron';\nimport { AccordionControl, type AccordionControlProps } from './AccordionControl/AccordionControl';\nimport { AccordionItem, type AccordionItemProps } from './AccordionItem/AccordionItem';\nimport { AccordionPanel, type AccordionPanelProps } from './AccordionPanel/AccordionPanel';\nimport classes from './Accordion.module.css';\nimport type { AccordionItemContextValue } from './AccordionItem.context';\nexport type AccordionStylesNames =\n | 'root'\n | 'content'\n | 'item'\n | 'panel'\n | 'icon'\n | 'chevron'\n | 'label'\n | 'itemTitle'\n | 'control';\n\nexport type AccordionVariant = 'default' | 'contained' | 'filled' | 'separated';\nexport type AccordionCssVariables = {\n root: '--accordion-transition-duration' | '--accordion-chevron-size' | '--accordion-radius';\n};\n\nexport interface AccordionProps<Multiple extends boolean = false>\n extends\n BoxProps,\n StylesApiProps<AccordionFactory>,\n ElementProps<'div', 'value' | 'defaultValue' | 'onChange'> {\n /** If set, multiple items can be opened at the same time @default false */\n multiple?: Multiple;\n\n /** Controlled component value */\n value?: AccordionValue<Multiple>;\n\n /** Uncontrolled component default value */\n defaultValue?: AccordionValue<Multiple>;\n\n /** Called when value changes, payload type depends on `multiple` prop */\n onChange?: (value: AccordionValue<Multiple>) => void;\n\n /** If set, arrow keys loop through items (first to last and last to first) @default true */\n loop?: boolean;\n\n /** Transition duration in ms @default 200 */\n transitionDuration?: number;\n\n /** If set, chevron rotation is disabled @default false */\n disableChevronRotation?: boolean;\n\n /** Position of the chevron relative to the item label @default right */\n chevronPosition?: AccordionChevronPosition;\n\n /** Size of the chevron icon container @default auto */\n chevronSize?: number | string;\n\n /** Size of the default chevron icon. Ignored when `chevron` prop is set. Use `chevronSize` instead when using custom chevron. @default 16 */\n chevronIconSize?: number | string;\n\n /** Sets heading level (h2-h6) for `Accordion.Control` elements. Wraps each control in the corresponding heading tag, recommended to meet WAI-ARIA accessibility requirements. Has no visual effect. */\n order?: AccordionHeadingOrder;\n\n /** Custom chevron icon */\n chevron?: React.ReactNode;\n\n /** Key of `theme.radius` or any valid CSS value to set border-radius. Numbers are converted to rem. @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set to `false`, panels are unmounted when collapsed. By default, panels stay mounted when collapsed. @default true */\n keepMounted?: boolean;\n}\n\nexport type AccordionFactory = Factory<{\n props: AccordionProps;\n ref: HTMLDivElement;\n stylesNames: AccordionStylesNames;\n vars: AccordionCssVariables;\n variant: AccordionVariant;\n signature: <Multiple extends boolean = false>(\n props: AccordionProps<Multiple>\n ) => React.JSX.Element;\n staticComponents: {\n Item: typeof AccordionItem;\n Panel: typeof AccordionPanel;\n Control: typeof AccordionControl;\n Chevron: typeof AccordionChevron;\n };\n}>;\n\nconst defaultProps = {\n multiple: false,\n loop: true,\n disableChevronRotation: false,\n chevronPosition: 'right',\n variant: 'default',\n chevronSize: 'auto',\n chevronIconSize: 16,\n} satisfies Partial<AccordionProps>;\n\nconst varsResolver = createVarsResolver<AccordionFactory>(\n (_, { transitionDuration, chevronSize, radius }) => ({\n root: {\n '--accordion-transition-duration':\n transitionDuration === undefined ? undefined : `${transitionDuration}ms`,\n '--accordion-chevron-size': chevronSize === undefined ? undefined : rem(chevronSize),\n '--accordion-radius': radius === undefined ? undefined : getRadius(radius),\n },\n })\n);\n\nexport const Accordion = genericFactory<AccordionFactory>((_props) => {\n const props = useProps('Accordion', defaultProps as any, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n children,\n multiple,\n value,\n defaultValue,\n onChange,\n id,\n loop,\n transitionDuration,\n disableChevronRotation,\n chevronPosition,\n chevronSize,\n order,\n chevron,\n variant,\n radius,\n chevronIconSize,\n attributes,\n keepMounted,\n ...others\n } = props;\n\n const uid = useId(id);\n const [_value, handleChange] = useUncontrolled({\n value,\n defaultValue,\n finalValue: multiple ? ([] as any) : null,\n onChange,\n });\n\n const isItemActive = (itemValue: string) =>\n Array.isArray(_value) ? _value.includes(itemValue) : itemValue === _value;\n\n const handleItemChange = (itemValue: string) => {\n const nextValue = Array.isArray(_value)\n ? _value.includes(itemValue)\n ? _value.filter((selectedValue) => selectedValue !== itemValue)\n : [..._value, itemValue]\n : itemValue === _value\n ? null\n : (itemValue as any);\n\n handleChange(nextValue);\n };\n\n const getStyles = useStyles<AccordionFactory>({\n name: 'Accordion',\n classes,\n props: props as AccordionProps,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n return (\n <AccordionProvider\n value={{\n isItemActive,\n onChange: handleItemChange,\n getControlId: getSafeId(\n `${uid}-control`,\n 'Accordion.Item component was rendered with invalid value or without value'\n ),\n getRegionId: getSafeId(\n `${uid}-panel`,\n 'Accordion.Item component was rendered with invalid value or without value'\n ),\n chevron: chevron === null ? null : chevron || <AccordionChevron size={chevronIconSize} />,\n transitionDuration,\n disableChevronRotation,\n chevronPosition,\n order,\n loop,\n getStyles,\n variant,\n unstyled,\n keepMounted,\n }}\n >\n <Box {...getStyles('root')} id={uid} {...others} variant={variant} data-accordion>\n {children}\n </Box>\n </AccordionProvider>\n );\n});\n\nAccordion.classes = classes;\nAccordion.varsResolver = varsResolver;\nAccordion.displayName = '@mantine/core/Accordion';\nAccordion.Item = AccordionItem;\nAccordion.Panel = AccordionPanel;\nAccordion.Control = AccordionControl;\nAccordion.Chevron = AccordionChevron;\n\nexport namespace Accordion {\n export type Props = AccordionProps;\n export type StylesNames = AccordionStylesNames;\n export type CssVariables = AccordionCssVariables;\n export type Factory = AccordionFactory;\n export type Variant = AccordionVariant;\n\n export namespace Control {\n export type Props = AccordionControlProps;\n }\n\n export namespace Item {\n export type Props = AccordionItemProps;\n export type Context = AccordionItemContextValue;\n }\n\n export namespace Panel {\n export type Props = AccordionPanelProps;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyGA,MAAM,eAAe;CACnB,UAAU;CACV,MAAM;CACN,wBAAwB;CACxB,iBAAiB;CACjB,SAAS;CACT,aAAa;CACb,iBAAiB;AACnB;AAEA,MAAM,eAAeA,6BAAAA,oBAClB,GAAG,EAAE,oBAAoB,aAAa,cAAc,EACnD,MAAM;CACJ,mCACE,uBAAuB,KAAA,IAAY,KAAA,IAAY,GAAG,mBAAmB;CACvE,4BAA4B,gBAAgB,KAAA,IAAY,KAAA,IAAYC,YAAAA,IAAI,WAAW;CACnF,sBAAsB,WAAW,KAAA,IAAY,KAAA,IAAYC,iBAAAA,UAAU,MAAM;AAC3E,EACF,EACF;AAEA,MAAa,YAAYC,gBAAAA,gBAAkC,WAAW;CACpE,MAAM,QAAQC,kBAAAA,SAAS,aAAa,cAAqB,MAAM;CAC/D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,UACA,UACA,OACA,cACA,UACA,IACA,MACA,oBACA,wBACA,iBACA,aACA,OACA,SACA,SACA,QACA,iBACA,YACA,aACA,GAAG,WACD;CAEJ,MAAM,OAAA,GAA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"Accordion.cjs","names":["createVarsResolver","rem","getRadius","genericFactory","useProps","useStyles","AccordionProvider","getSafeId","AccordionChevron","Box","classes","AccordionItem","AccordionPanel","AccordionControl"],"sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n Factory,\n genericFactory,\n getRadius,\n getSafeId,\n MantineRadius,\n rem,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { AccordionProvider } from './Accordion.context';\nimport { AccordionChevronPosition, AccordionHeadingOrder, AccordionValue } from './Accordion.types';\nimport { AccordionChevron } from './AccordionChevron';\nimport { AccordionControl, type AccordionControlProps } from './AccordionControl/AccordionControl';\nimport { AccordionItem, type AccordionItemProps } from './AccordionItem/AccordionItem';\nimport { AccordionPanel, type AccordionPanelProps } from './AccordionPanel/AccordionPanel';\nimport classes from './Accordion.module.css';\nimport type { AccordionItemContextValue } from './AccordionItem.context';\nexport type AccordionStylesNames =\n | 'root'\n | 'content'\n | 'item'\n | 'panel'\n | 'icon'\n | 'chevron'\n | 'label'\n | 'itemTitle'\n | 'control';\n\nexport type AccordionVariant = 'default' | 'contained' | 'filled' | 'separated';\nexport type AccordionCssVariables = {\n root: '--accordion-transition-duration' | '--accordion-chevron-size' | '--accordion-radius';\n};\n\nexport interface AccordionProps<Multiple extends boolean = false>\n extends\n BoxProps,\n StylesApiProps<AccordionFactory>,\n ElementProps<'div', 'value' | 'defaultValue' | 'onChange'> {\n /** If set, multiple items can be opened at the same time @default false */\n multiple?: Multiple;\n\n /** Controlled component value */\n value?: AccordionValue<Multiple>;\n\n /** Uncontrolled component default value */\n defaultValue?: AccordionValue<Multiple>;\n\n /** Called when value changes, payload type depends on `multiple` prop */\n onChange?: (value: AccordionValue<Multiple>) => void;\n\n /** If set, arrow keys loop through items (first to last and last to first) @default true */\n loop?: boolean;\n\n /** Transition duration in ms @default 200 */\n transitionDuration?: number;\n\n /** If set, chevron rotation is disabled @default false */\n disableChevronRotation?: boolean;\n\n /** Position of the chevron relative to the item label @default right */\n chevronPosition?: AccordionChevronPosition;\n\n /** Size of the chevron icon container @default auto */\n chevronSize?: number | string;\n\n /** Size of the default chevron icon. Ignored when `chevron` prop is set. Use `chevronSize` instead when using custom chevron. @default 16 */\n chevronIconSize?: number | string;\n\n /** Sets heading level (h2-h6) for `Accordion.Control` elements. Wraps each control in the corresponding heading tag, recommended to meet WAI-ARIA accessibility requirements. Has no visual effect. */\n order?: AccordionHeadingOrder;\n\n /** Custom chevron icon */\n chevron?: React.ReactNode;\n\n /** Key of `theme.radius` or any valid CSS value to set border-radius. Numbers are converted to rem. @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set to `false`, panels are unmounted when collapsed. By default, panels stay mounted when collapsed. @default true */\n keepMounted?: boolean;\n\n /** Controls how inactive panels content is hidden when `keepMounted` is `true`, `'activity'` – hidden with `Activity` component, `'display-none'` – hidden with `display: none` styles @default 'activity' */\n keepMountedMode?: 'activity' | 'display-none';\n}\n\nexport type AccordionFactory = Factory<{\n props: AccordionProps;\n ref: HTMLDivElement;\n stylesNames: AccordionStylesNames;\n vars: AccordionCssVariables;\n variant: AccordionVariant;\n signature: <Multiple extends boolean = false>(\n props: AccordionProps<Multiple>\n ) => React.JSX.Element;\n staticComponents: {\n Item: typeof AccordionItem;\n Panel: typeof AccordionPanel;\n Control: typeof AccordionControl;\n Chevron: typeof AccordionChevron;\n };\n}>;\n\nconst defaultProps = {\n multiple: false,\n loop: true,\n disableChevronRotation: false,\n chevronPosition: 'right',\n variant: 'default',\n chevronSize: 'auto',\n chevronIconSize: 16,\n keepMountedMode: 'activity',\n} satisfies Partial<AccordionProps>;\n\nconst varsResolver = createVarsResolver<AccordionFactory>(\n (_, { transitionDuration, chevronSize, radius }) => ({\n root: {\n '--accordion-transition-duration':\n transitionDuration === undefined ? undefined : `${transitionDuration}ms`,\n '--accordion-chevron-size': chevronSize === undefined ? undefined : rem(chevronSize),\n '--accordion-radius': radius === undefined ? undefined : getRadius(radius),\n },\n })\n);\n\nexport const Accordion = genericFactory<AccordionFactory>((_props) => {\n const props = useProps('Accordion', defaultProps as any, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n children,\n multiple,\n value,\n defaultValue,\n onChange,\n id,\n loop,\n transitionDuration,\n disableChevronRotation,\n chevronPosition,\n chevronSize,\n order,\n chevron,\n variant,\n radius,\n chevronIconSize,\n attributes,\n keepMounted,\n keepMountedMode,\n ...others\n } = props;\n\n const uid = useId(id);\n const [_value, handleChange] = useUncontrolled({\n value,\n defaultValue,\n finalValue: multiple ? ([] as any) : null,\n onChange,\n });\n\n const isItemActive = (itemValue: string) =>\n Array.isArray(_value) ? _value.includes(itemValue) : itemValue === _value;\n\n const handleItemChange = (itemValue: string) => {\n const nextValue = Array.isArray(_value)\n ? _value.includes(itemValue)\n ? _value.filter((selectedValue) => selectedValue !== itemValue)\n : [..._value, itemValue]\n : itemValue === _value\n ? null\n : (itemValue as any);\n\n handleChange(nextValue);\n };\n\n const getStyles = useStyles<AccordionFactory>({\n name: 'Accordion',\n classes,\n props: props as AccordionProps,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n return (\n <AccordionProvider\n value={{\n isItemActive,\n onChange: handleItemChange,\n getControlId: getSafeId(\n `${uid}-control`,\n 'Accordion.Item component was rendered with invalid value or without value'\n ),\n getRegionId: getSafeId(\n `${uid}-panel`,\n 'Accordion.Item component was rendered with invalid value or without value'\n ),\n chevron: chevron === null ? null : chevron || <AccordionChevron size={chevronIconSize} />,\n transitionDuration,\n disableChevronRotation,\n chevronPosition,\n order,\n loop,\n getStyles,\n variant,\n unstyled,\n keepMounted,\n keepMountedMode,\n }}\n >\n <Box {...getStyles('root')} id={uid} {...others} variant={variant} data-accordion>\n {children}\n </Box>\n </AccordionProvider>\n );\n});\n\nAccordion.classes = classes;\nAccordion.varsResolver = varsResolver;\nAccordion.displayName = '@mantine/core/Accordion';\nAccordion.Item = AccordionItem;\nAccordion.Panel = AccordionPanel;\nAccordion.Control = AccordionControl;\nAccordion.Chevron = AccordionChevron;\n\nexport namespace Accordion {\n export type Props = AccordionProps;\n export type StylesNames = AccordionStylesNames;\n export type CssVariables = AccordionCssVariables;\n export type Factory = AccordionFactory;\n export type Variant = AccordionVariant;\n\n export namespace Control {\n export type Props = AccordionControlProps;\n }\n\n export namespace Item {\n export type Props = AccordionItemProps;\n export type Context = AccordionItemContextValue;\n }\n\n export namespace Panel {\n export type Props = AccordionPanelProps;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4GA,MAAM,eAAe;CACnB,UAAU;CACV,MAAM;CACN,wBAAwB;CACxB,iBAAiB;CACjB,SAAS;CACT,aAAa;CACb,iBAAiB;CACjB,iBAAiB;AACnB;AAEA,MAAM,eAAeA,6BAAAA,oBAClB,GAAG,EAAE,oBAAoB,aAAa,cAAc,EACnD,MAAM;CACJ,mCACE,uBAAuB,KAAA,IAAY,KAAA,IAAY,GAAG,mBAAmB;CACvE,4BAA4B,gBAAgB,KAAA,IAAY,KAAA,IAAYC,YAAAA,IAAI,WAAW;CACnF,sBAAsB,WAAW,KAAA,IAAY,KAAA,IAAYC,iBAAAA,UAAU,MAAM;AAC3E,EACF,EACF;AAEA,MAAa,YAAYC,gBAAAA,gBAAkC,WAAW;CACpE,MAAM,QAAQC,kBAAAA,SAAS,aAAa,cAAqB,MAAM;CAC/D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,UACA,UACA,OACA,cACA,UACA,IACA,MACA,oBACA,wBACA,iBACA,aACA,OACA,SACA,SACA,QACA,iBACA,YACA,aACA,iBACA,GAAG,WACD;CAEJ,MAAM,OAAA,GAAA,eAAA,MAAA,CAAY,EAAE;CACpB,MAAM,CAAC,QAAQ,iBAAA,GAAA,eAAA,gBAAA,CAAgC;EAC7C;EACA;EACA,YAAY,WAAY,CAAC,IAAY;EACrC;CACF,CAAC;CAED,MAAM,gBAAgB,cACpB,MAAM,QAAQ,MAAM,IAAI,OAAO,SAAS,SAAS,IAAI,cAAc;CAErE,MAAM,oBAAoB,cAAsB;EAS9C,aARkB,MAAM,QAAQ,MAAM,IAClC,OAAO,SAAS,SAAS,IACvB,OAAO,QAAQ,kBAAkB,kBAAkB,SAAS,IAC5D,CAAC,GAAG,QAAQ,SAAS,IACvB,cAAc,SACZ,OACC,SAEe;CACxB;CAEA,MAAM,YAAYC,mBAAAA,UAA4B;EAC5C,MAAM;EACN,SAAA,yBAAA;EACO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,0BAAAA,mBAAD;EACE,OAAO;GACL;GACA,UAAU;GACV,cAAcC,oBAAAA,UACZ,GAAG,IAAI,WACP,2EACF;GACA,aAAaA,oBAAAA,UACX,GAAG,IAAI,SACP,2EACF;GACA,SAAS,YAAY,OAAO,OAAO,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAACC,yBAAAA,kBAAD,EAAkB,MAAM,gBAAkB,CAAA;GACxF;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;YAEA,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;GAAK,GAAI,UAAU,MAAM;GAAG,IAAI;GAAK,GAAI;GAAiB;GAAS,kBAAA;GAChE;EACE,CAAA;CACY,CAAA;AAEvB,CAAC;AAED,UAAU,UAAUC,yBAAAA;AACpB,UAAU,eAAe;AACzB,UAAU,cAAc;AACxB,UAAU,OAAOC,sBAAAA;AACjB,UAAU,QAAQC,uBAAAA;AAClB,UAAU,UAAUC,yBAAAA;AACpB,UAAU,UAAUL,yBAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.context.cjs","names":["createSafeContext"],"sources":["../../../src/components/Accordion/Accordion.context.ts"],"sourcesContent":["import { createSafeContext, GetStylesApi } from '../../core';\nimport type { AccordionFactory } from './Accordion';\nimport { AccordionChevronPosition, AccordionHeadingOrder } from './Accordion.types';\n\nexport interface AccordionContextValue {\n loop: boolean | undefined;\n transitionDuration: number | undefined;\n disableChevronRotation: boolean | undefined;\n chevronPosition: AccordionChevronPosition | undefined;\n order: AccordionHeadingOrder | undefined;\n chevron: React.ReactNode;\n onChange: (value: string) => void;\n isItemActive: (value: string) => boolean;\n getControlId: (value: string) => string;\n getRegionId: (value: string) => string;\n getStyles: GetStylesApi<AccordionFactory>;\n variant: string | undefined;\n unstyled: boolean | undefined;\n keepMounted: boolean | undefined;\n}\n\nexport const [AccordionProvider, useAccordionContext] = createSafeContext<AccordionContextValue>(\n 'Accordion component was not found in the tree'\n);\n"],"mappings":";;AAqBA,MAAa,CAAC,mBAAmB,6FAAuBA,CAAAA,CAAAA,kBACtD,+CACF"}
1
+ {"version":3,"file":"Accordion.context.cjs","names":["createSafeContext"],"sources":["../../../src/components/Accordion/Accordion.context.ts"],"sourcesContent":["import { createSafeContext, GetStylesApi } from '../../core';\nimport type { AccordionFactory } from './Accordion';\nimport { AccordionChevronPosition, AccordionHeadingOrder } from './Accordion.types';\n\nexport interface AccordionContextValue {\n loop: boolean | undefined;\n transitionDuration: number | undefined;\n disableChevronRotation: boolean | undefined;\n chevronPosition: AccordionChevronPosition | undefined;\n order: AccordionHeadingOrder | undefined;\n chevron: React.ReactNode;\n onChange: (value: string) => void;\n isItemActive: (value: string) => boolean;\n getControlId: (value: string) => string;\n getRegionId: (value: string) => string;\n getStyles: GetStylesApi<AccordionFactory>;\n variant: string | undefined;\n unstyled: boolean | undefined;\n keepMounted: boolean | undefined;\n keepMountedMode: 'activity' | 'display-none' | undefined;\n}\n\nexport const [AccordionProvider, useAccordionContext] = createSafeContext<AccordionContextValue>(\n 'Accordion component was not found in the tree'\n);\n"],"mappings":";;AAsBA,MAAa,CAAC,mBAAmB,6FAAuBA,CAAAA,CAAAA,kBACtD,+CACF"}
@@ -8,7 +8,7 @@ const require_Accordion_module = require("../Accordion.module.cjs");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  //#region packages/@mantine/core/src/components/Accordion/AccordionPanel/AccordionPanel.tsx
10
10
  const AccordionPanel = require_factory.factory((props) => {
11
- const { classNames, className, style, styles, vars, children, keepMounted, ...others } = require_use_props.useProps("AccordionPanel", null, props);
11
+ const { classNames, className, style, styles, vars, children, keepMounted, keepMountedMode, ...others } = require_use_props.useProps("AccordionPanel", null, props);
12
12
  const { value } = require_AccordionItem_context.useAccordionItemContext();
13
13
  const ctx = require_Accordion_context.useAccordionContext();
14
14
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Collapse.Collapse, {
@@ -24,6 +24,7 @@ const AccordionPanel = require_factory.factory((props) => {
24
24
  id: ctx.getRegionId(value),
25
25
  "aria-labelledby": ctx.getControlId(value),
26
26
  keepMounted: keepMounted ?? ctx.keepMounted,
27
+ keepMountedMode: keepMountedMode ?? ctx.keepMountedMode,
27
28
  ...others,
28
29
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
29
30
  ...ctx.getStyles("content", {
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionPanel.cjs","names":["factory","useProps","useAccordionItemContext","useAccordionContext","Collapse","classes"],"sources":["../../../../src/components/Accordion/AccordionPanel/AccordionPanel.tsx"],"sourcesContent":["import {\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n useProps,\n} from '../../../core';\nimport { Collapse } from '../../Collapse';\nimport { useAccordionContext } from '../Accordion.context';\nimport { useAccordionItemContext } from '../AccordionItem.context';\nimport classes from '../Accordion.module.css';\n\nexport type AccordionPanelStylesNames = 'panel' | 'content';\n\nexport interface AccordionPanelProps\n extends BoxProps, CompoundStylesApiProps<AccordionPanelFactory>, ElementProps<'div'> {\n /** Called when the panel animation completes */\n onTransitionEnd?: () => void;\n\n /** Called when the panel animation starts */\n onTransitionStart?: () => void;\n\n /** If set, overrides the Accordion-level `keepMounted` value. When undefined (default), uses Accordion's `keepMounted` setting. */\n keepMounted?: boolean;\n}\n\nexport type AccordionPanelFactory = Factory<{\n props: AccordionPanelProps;\n ref: HTMLDivElement;\n stylesNames: AccordionPanelStylesNames;\n compound: true;\n}>;\n\nexport const AccordionPanel = factory<AccordionPanelFactory>((props) => {\n const { classNames, className, style, styles, vars, children, keepMounted, ...others } = useProps(\n 'AccordionPanel',\n null,\n props\n );\n\n const { value } = useAccordionItemContext();\n const ctx = useAccordionContext();\n\n return (\n <Collapse\n {...ctx.getStyles('panel', { className, classNames, style, styles })}\n expanded={ctx.isItemActive(value)}\n transitionDuration={ctx.transitionDuration ?? 200}\n role=\"region\"\n id={ctx.getRegionId(value)}\n aria-labelledby={ctx.getControlId(value)}\n keepMounted={keepMounted ?? ctx.keepMounted}\n {...others}\n >\n <div {...ctx.getStyles('content', { classNames, styles })}>{children}</div>\n </Collapse>\n );\n});\n\nAccordionPanel.displayName = '@mantine/core/AccordionPanel';\nAccordionPanel.classes = classes;\n"],"mappings":";;;;;;;;;AAkCA,MAAa,iBAAiBA,gBAAAA,SAAgC,UAAU;CACtE,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,UAAU,aAAa,GAAG,WAAWC,kBAAAA,SACvF,kBACA,MACA,KACF;CAEA,MAAM,EAAE,UAAUC,8BAAAA,wBAAwB;CAC1C,MAAM,MAAMC,0BAAAA,oBAAoB;CAEhC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,UAAD;EACE,GAAI,IAAI,UAAU,SAAS;GAAE;GAAW;GAAY;GAAO;EAAO,CAAC;EACnE,UAAU,IAAI,aAAa,KAAK;EAChC,oBAAoB,IAAI,sBAAsB;EAC9C,MAAK;EACL,IAAI,IAAI,YAAY,KAAK;EACzB,mBAAiB,IAAI,aAAa,KAAK;EACvC,aAAa,eAAe,IAAI;EAChC,GAAI;YAEJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,GAAI,IAAI,UAAU,WAAW;IAAE;IAAY;GAAO,CAAC;GAAI;EAAc,CAAA;CAClE,CAAA;AAEd,CAAC;AAED,eAAe,cAAc;AAC7B,eAAe,UAAUC,yBAAAA"}
1
+ {"version":3,"file":"AccordionPanel.cjs","names":["factory","useProps","useAccordionItemContext","useAccordionContext","Collapse","classes"],"sources":["../../../../src/components/Accordion/AccordionPanel/AccordionPanel.tsx"],"sourcesContent":["import {\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n useProps,\n} from '../../../core';\nimport { Collapse } from '../../Collapse';\nimport { useAccordionContext } from '../Accordion.context';\nimport { useAccordionItemContext } from '../AccordionItem.context';\nimport classes from '../Accordion.module.css';\n\nexport type AccordionPanelStylesNames = 'panel' | 'content';\n\nexport interface AccordionPanelProps\n extends BoxProps, CompoundStylesApiProps<AccordionPanelFactory>, ElementProps<'div'> {\n /** Called when the panel animation completes */\n onTransitionEnd?: () => void;\n\n /** Called when the panel animation starts */\n onTransitionStart?: () => void;\n\n /** If set, overrides the Accordion-level `keepMounted` value. When undefined (default), uses Accordion's `keepMounted` setting. */\n keepMounted?: boolean;\n\n /** If set, overrides the Accordion-level `keepMountedMode` value. When undefined (default), uses Accordion's `keepMountedMode` setting. */\n keepMountedMode?: 'activity' | 'display-none';\n}\n\nexport type AccordionPanelFactory = Factory<{\n props: AccordionPanelProps;\n ref: HTMLDivElement;\n stylesNames: AccordionPanelStylesNames;\n compound: true;\n}>;\n\nexport const AccordionPanel = factory<AccordionPanelFactory>((props) => {\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n children,\n keepMounted,\n keepMountedMode,\n ...others\n } = useProps('AccordionPanel', null, props);\n\n const { value } = useAccordionItemContext();\n const ctx = useAccordionContext();\n\n return (\n <Collapse\n {...ctx.getStyles('panel', { className, classNames, style, styles })}\n expanded={ctx.isItemActive(value)}\n transitionDuration={ctx.transitionDuration ?? 200}\n role=\"region\"\n id={ctx.getRegionId(value)}\n aria-labelledby={ctx.getControlId(value)}\n keepMounted={keepMounted ?? ctx.keepMounted}\n keepMountedMode={keepMountedMode ?? ctx.keepMountedMode}\n {...others}\n >\n <div {...ctx.getStyles('content', { classNames, styles })}>{children}</div>\n </Collapse>\n );\n});\n\nAccordionPanel.displayName = '@mantine/core/AccordionPanel';\nAccordionPanel.classes = classes;\n"],"mappings":";;;;;;;;;AAqCA,MAAa,iBAAiBA,gBAAAA,SAAgC,UAAU;CACtE,MAAM,EACJ,YACA,WACA,OACA,QACA,MACA,UACA,aACA,iBACA,GAAG,WACDC,kBAAAA,SAAS,kBAAkB,MAAM,KAAK;CAE1C,MAAM,EAAE,UAAUC,8BAAAA,wBAAwB;CAC1C,MAAM,MAAMC,0BAAAA,oBAAoB;CAEhC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,UAAD;EACE,GAAI,IAAI,UAAU,SAAS;GAAE;GAAW;GAAY;GAAO;EAAO,CAAC;EACnE,UAAU,IAAI,aAAa,KAAK;EAChC,oBAAoB,IAAI,sBAAsB;EAC9C,MAAK;EACL,IAAI,IAAI,YAAY,KAAK;EACzB,mBAAiB,IAAI,aAAa,KAAK;EACvC,aAAa,eAAe,IAAI;EAChC,iBAAiB,mBAAmB,IAAI;EACxC,GAAI;YAEJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,GAAI,IAAI,UAAU,WAAW;IAAE;IAAY;GAAO,CAAC;GAAI;EAAc,CAAA;CAClE,CAAA;AAEd,CAAC;AAED,eAAe,cAAc;AAC7B,eAAe,UAAUC,yBAAAA"}
@@ -10,7 +10,7 @@ function assignAsideVariables({ baseStyles, minMediaStyles, maxMediaStyles, asid
10
10
  const asideWidth = aside?.width;
11
11
  const collapsedAsideTransform = "translateX(var(--app-shell-aside-width))";
12
12
  const collapsedAsideTransformRtl = "translateX(calc(var(--app-shell-aside-width) * -1))";
13
- if (aside?.breakpoint && !aside?.collapsed?.mobile) {
13
+ if (aside?.breakpoint !== void 0 && !aside?.collapsed?.mobile) {
14
14
  maxMediaStyles[aside?.breakpoint] = maxMediaStyles[aside?.breakpoint] || {};
15
15
  if (mode === "fixed") {
16
16
  maxMediaStyles[aside?.breakpoint]["--app-shell-aside-width"] = "100%";
@@ -38,7 +38,7 @@ function assignAsideVariables({ baseStyles, minMediaStyles, maxMediaStyles, asid
38
38
  }
39
39
  });
40
40
  }
41
- if (aside?.breakpoint && mode === "static") {
41
+ if (aside?.breakpoint !== void 0 && mode === "static") {
42
42
  minMediaStyles[aside.breakpoint] = minMediaStyles[aside.breakpoint] || {};
43
43
  minMediaStyles[aside.breakpoint]["--app-shell-aside-position"] = "sticky";
44
44
  minMediaStyles[aside.breakpoint]["--app-shell-aside-grid-row"] = "2";
@@ -1 +1 @@
1
- {"version":3,"file":"assign-aside-variables.cjs","names":["isPrimitiveSize","rem","getBaseSize","isResponsiveSize","getBreakpointValue"],"sources":["../../../../../src/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.ts"],"sourcesContent":["import { getBreakpointValue, keys, MantineTheme, rem } from '../../../../core';\nimport type { AppShellProps } from '../../AppShell';\nimport { getBaseSize } from '../get-base-size/get-base-size';\nimport type { CSSVariables, MediaQueryVariables } from '../get-variables/get-variables';\nimport { isPrimitiveSize } from '../is-primitive-size/is-primitive-size';\nimport { isResponsiveSize } from '../is-responsive-size/is-responsive-size';\n\ninterface AssignAsideVariablesInput {\n baseStyles: CSSVariables;\n minMediaStyles: MediaQueryVariables;\n maxMediaStyles: MediaQueryVariables;\n aside: AppShellProps['aside'] | undefined;\n theme: MantineTheme;\n mode: 'fixed' | 'static';\n}\n\nexport function assignAsideVariables({\n baseStyles,\n minMediaStyles,\n maxMediaStyles,\n aside,\n theme,\n mode,\n}: AssignAsideVariablesInput) {\n const asideWidth = aside?.width;\n const collapsedAsideTransform = 'translateX(var(--app-shell-aside-width))';\n const collapsedAsideTransformRtl = 'translateX(calc(var(--app-shell-aside-width) * -1))';\n\n if (aside?.breakpoint && !aside?.collapsed?.mobile) {\n maxMediaStyles[aside?.breakpoint] = maxMediaStyles[aside?.breakpoint] || {};\n if (mode === 'fixed') {\n maxMediaStyles[aside?.breakpoint]['--app-shell-aside-width'] = '100%';\n maxMediaStyles[aside?.breakpoint]['--app-shell-aside-offset'] = '0px';\n } else {\n maxMediaStyles[aside?.breakpoint]['--app-shell-aside-width'] = '0px';\n maxMediaStyles[aside?.breakpoint]['--app-shell-aside-offset'] = '0px';\n }\n }\n\n if (isPrimitiveSize(asideWidth)) {\n const baseSize = rem(getBaseSize(asideWidth));\n baseStyles['--app-shell-aside-width'] = baseSize;\n baseStyles['--app-shell-aside-offset'] = baseSize;\n }\n\n if (isResponsiveSize(asideWidth)) {\n if (typeof asideWidth.base !== 'undefined') {\n baseStyles['--app-shell-aside-width'] = rem(asideWidth.base);\n baseStyles['--app-shell-aside-offset'] = rem(asideWidth.base);\n }\n\n keys(asideWidth).forEach((key) => {\n if (key !== 'base') {\n minMediaStyles[key] = minMediaStyles[key] || {};\n minMediaStyles[key]['--app-shell-aside-width'] = rem(asideWidth![key]);\n minMediaStyles[key]['--app-shell-aside-offset'] = rem(asideWidth![key]);\n }\n });\n }\n\n if (aside?.breakpoint && mode === 'static') {\n minMediaStyles[aside.breakpoint] = minMediaStyles[aside.breakpoint] || {};\n minMediaStyles[aside.breakpoint]['--app-shell-aside-position'] = 'sticky';\n minMediaStyles[aside.breakpoint]['--app-shell-aside-grid-row'] = '2';\n minMediaStyles[aside.breakpoint]['--app-shell-aside-grid-column'] = '3';\n // Adjust main column end when aside is visible\n minMediaStyles[aside.breakpoint]['--app-shell-main-column-end'] = '3';\n }\n\n if (aside?.collapsed?.desktop) {\n const breakpointValue = aside!.breakpoint;\n minMediaStyles[breakpointValue] = minMediaStyles[breakpointValue] || {};\n minMediaStyles[breakpointValue]['--app-shell-aside-transform'] = collapsedAsideTransform;\n minMediaStyles[breakpointValue]['--app-shell-aside-transform-rtl'] = collapsedAsideTransformRtl;\n if (mode === 'fixed') {\n minMediaStyles[breakpointValue]['--app-shell-aside-offset'] = '0px !important';\n } else {\n minMediaStyles[breakpointValue]['--app-shell-aside-width'] = '0px';\n minMediaStyles[breakpointValue]['--app-shell-aside-display'] = 'none';\n minMediaStyles[breakpointValue]['--app-shell-main-column-end'] = '-1';\n }\n minMediaStyles[breakpointValue]['--app-shell-aside-scroll-locked-visibility'] = 'hidden';\n }\n\n if (aside?.collapsed?.mobile) {\n const breakpointValue = getBreakpointValue(aside!.breakpoint, theme.breakpoints) - 0.1;\n maxMediaStyles[breakpointValue] = maxMediaStyles[breakpointValue] || {};\n if (mode === 'fixed') {\n maxMediaStyles[breakpointValue]['--app-shell-aside-width'] = '100%';\n maxMediaStyles[breakpointValue]['--app-shell-aside-offset'] = '0px';\n } else {\n maxMediaStyles[breakpointValue]['--app-shell-aside-width'] = '0px';\n }\n maxMediaStyles[breakpointValue]['--app-shell-aside-transform'] = collapsedAsideTransform;\n maxMediaStyles[breakpointValue]['--app-shell-aside-transform-rtl'] = collapsedAsideTransformRtl;\n maxMediaStyles[breakpointValue]['--app-shell-aside-scroll-locked-visibility'] = 'hidden';\n }\n}\n"],"mappings":";;;;;;;;AAgBA,SAAgB,qBAAqB,EACnC,YACA,gBACA,gBACA,OACA,OACA,QAC4B;CAC5B,MAAM,aAAa,OAAO;CAC1B,MAAM,0BAA0B;CAChC,MAAM,6BAA6B;CAEnC,IAAI,OAAO,cAAc,CAAC,OAAO,WAAW,QAAQ;EAClD,eAAe,OAAO,cAAc,eAAe,OAAO,eAAe,CAAC;EAC1E,IAAI,SAAS,SAAS;GACpB,eAAe,OAAO,WAAW,CAAC,6BAA6B;GAC/D,eAAe,OAAO,WAAW,CAAC,8BAA8B;EAClE,OAAO;GACL,eAAe,OAAO,WAAW,CAAC,6BAA6B;GAC/D,eAAe,OAAO,WAAW,CAAC,8BAA8B;EAClE;CACF;CAEA,IAAIA,0BAAAA,gBAAgB,UAAU,GAAG;EAC/B,MAAM,WAAWC,YAAAA,IAAIC,sBAAAA,YAAY,UAAU,CAAC;EAC5C,WAAW,6BAA6B;EAC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E,IAAI,SAAS,SAAS;GACpB,eAAe,gBAAgB,CAAC,6BAA6B;GAC7D,eAAe,gBAAgB,CAAC,8BAA8B;EAChE,OACE,eAAe,gBAAgB,CAAC,6BAA6B;EAE/D,eAAe,gBAAgB,CAAC,iCAAiC;EACjE,eAAe,gBAAgB,CAAC,qCAAqC;EACrE,eAAe,gBAAgB,CAAC,gDAAgD;CAClF;AACF"}
1
+ {"version":3,"file":"assign-aside-variables.cjs","names":["isPrimitiveSize","rem","getBaseSize","isResponsiveSize","getBreakpointValue"],"sources":["../../../../../src/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.ts"],"sourcesContent":["import { getBreakpointValue, keys, MantineTheme, rem } from '../../../../core';\nimport type { AppShellProps } from '../../AppShell';\nimport { getBaseSize } from '../get-base-size/get-base-size';\nimport type { CSSVariables, MediaQueryVariables } from '../get-variables/get-variables';\nimport { isPrimitiveSize } from '../is-primitive-size/is-primitive-size';\nimport { isResponsiveSize } from '../is-responsive-size/is-responsive-size';\n\ninterface AssignAsideVariablesInput {\n baseStyles: CSSVariables;\n minMediaStyles: MediaQueryVariables;\n maxMediaStyles: MediaQueryVariables;\n aside: AppShellProps['aside'] | undefined;\n theme: MantineTheme;\n mode: 'fixed' | 'static';\n}\n\nexport function assignAsideVariables({\n baseStyles,\n minMediaStyles,\n maxMediaStyles,\n aside,\n theme,\n mode,\n}: AssignAsideVariablesInput) {\n const asideWidth = aside?.width;\n const collapsedAsideTransform = 'translateX(var(--app-shell-aside-width))';\n const collapsedAsideTransformRtl = 'translateX(calc(var(--app-shell-aside-width) * -1))';\n\n if (aside?.breakpoint !== undefined && !aside?.collapsed?.mobile) {\n maxMediaStyles[aside?.breakpoint] = maxMediaStyles[aside?.breakpoint] || {};\n if (mode === 'fixed') {\n maxMediaStyles[aside?.breakpoint]['--app-shell-aside-width'] = '100%';\n maxMediaStyles[aside?.breakpoint]['--app-shell-aside-offset'] = '0px';\n } else {\n maxMediaStyles[aside?.breakpoint]['--app-shell-aside-width'] = '0px';\n maxMediaStyles[aside?.breakpoint]['--app-shell-aside-offset'] = '0px';\n }\n }\n\n if (isPrimitiveSize(asideWidth)) {\n const baseSize = rem(getBaseSize(asideWidth));\n baseStyles['--app-shell-aside-width'] = baseSize;\n baseStyles['--app-shell-aside-offset'] = baseSize;\n }\n\n if (isResponsiveSize(asideWidth)) {\n if (typeof asideWidth.base !== 'undefined') {\n baseStyles['--app-shell-aside-width'] = rem(asideWidth.base);\n baseStyles['--app-shell-aside-offset'] = rem(asideWidth.base);\n }\n\n keys(asideWidth).forEach((key) => {\n if (key !== 'base') {\n minMediaStyles[key] = minMediaStyles[key] || {};\n minMediaStyles[key]['--app-shell-aside-width'] = rem(asideWidth![key]);\n minMediaStyles[key]['--app-shell-aside-offset'] = rem(asideWidth![key]);\n }\n });\n }\n\n if (aside?.breakpoint !== undefined && mode === 'static') {\n minMediaStyles[aside.breakpoint] = minMediaStyles[aside.breakpoint] || {};\n minMediaStyles[aside.breakpoint]['--app-shell-aside-position'] = 'sticky';\n minMediaStyles[aside.breakpoint]['--app-shell-aside-grid-row'] = '2';\n minMediaStyles[aside.breakpoint]['--app-shell-aside-grid-column'] = '3';\n // Adjust main column end when aside is visible\n minMediaStyles[aside.breakpoint]['--app-shell-main-column-end'] = '3';\n }\n\n if (aside?.collapsed?.desktop) {\n const breakpointValue = aside!.breakpoint;\n minMediaStyles[breakpointValue] = minMediaStyles[breakpointValue] || {};\n minMediaStyles[breakpointValue]['--app-shell-aside-transform'] = collapsedAsideTransform;\n minMediaStyles[breakpointValue]['--app-shell-aside-transform-rtl'] = collapsedAsideTransformRtl;\n if (mode === 'fixed') {\n minMediaStyles[breakpointValue]['--app-shell-aside-offset'] = '0px !important';\n } else {\n minMediaStyles[breakpointValue]['--app-shell-aside-width'] = '0px';\n minMediaStyles[breakpointValue]['--app-shell-aside-display'] = 'none';\n minMediaStyles[breakpointValue]['--app-shell-main-column-end'] = '-1';\n }\n minMediaStyles[breakpointValue]['--app-shell-aside-scroll-locked-visibility'] = 'hidden';\n }\n\n if (aside?.collapsed?.mobile) {\n const breakpointValue = getBreakpointValue(aside!.breakpoint, theme.breakpoints) - 0.1;\n maxMediaStyles[breakpointValue] = maxMediaStyles[breakpointValue] || {};\n if (mode === 'fixed') {\n maxMediaStyles[breakpointValue]['--app-shell-aside-width'] = '100%';\n maxMediaStyles[breakpointValue]['--app-shell-aside-offset'] = '0px';\n } else {\n maxMediaStyles[breakpointValue]['--app-shell-aside-width'] = '0px';\n }\n maxMediaStyles[breakpointValue]['--app-shell-aside-transform'] = collapsedAsideTransform;\n maxMediaStyles[breakpointValue]['--app-shell-aside-transform-rtl'] = collapsedAsideTransformRtl;\n maxMediaStyles[breakpointValue]['--app-shell-aside-scroll-locked-visibility'] = 'hidden';\n }\n}\n"],"mappings":";;;;;;;;AAgBA,SAAgB,qBAAqB,EACnC,YACA,gBACA,gBACA,OACA,OACA,QAC4B;CAC5B,MAAM,aAAa,OAAO;CAC1B,MAAM,0BAA0B;CAChC,MAAM,6BAA6B;CAEnC,IAAI,OAAO,eAAe,KAAA,KAAa,CAAC,OAAO,WAAW,QAAQ;EAChE,eAAe,OAAO,cAAc,eAAe,OAAO,eAAe,CAAC;EAC1E,IAAI,SAAS,SAAS;GACpB,eAAe,OAAO,WAAW,CAAC,6BAA6B;GAC/D,eAAe,OAAO,WAAW,CAAC,8BAA8B;EAClE,OAAO;GACL,eAAe,OAAO,WAAW,CAAC,6BAA6B;GAC/D,eAAe,OAAO,WAAW,CAAC,8BAA8B;EAClE;CACF;CAEA,IAAIA,0BAAAA,gBAAgB,UAAU,GAAG;EAC/B,MAAM,WAAWC,YAAAA,IAAIC,sBAAAA,YAAY,UAAU,CAAC;EAC5C,WAAW,6BAA6B;EACxC,WAAW,8BAA8B;CAC3C;CAEA,IAAIC,2BAAAA,iBAAiB,UAAU,GAAG;EAChC,IAAI,OAAO,WAAW,SAAS,aAAa;GAC1C,WAAW,6BAA6BF,YAAAA,IAAI,WAAW,IA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,eAAe,gBAAgB,CAAC,iCAAiC;EACjE,eAAe,gBAAgB,CAAC,qCAAqC;EACrE,eAAe,gBAAgB,CAAC,gDAAgD;CAClF;AACF"}
@@ -10,7 +10,7 @@ function assignNavbarVariables({ baseStyles, minMediaStyles, maxMediaStyles, nav
10
10
  const navbarWidth = navbar?.width;
11
11
  const collapsedNavbarTransform = "translateX(calc(var(--app-shell-navbar-width) * -1))";
12
12
  const collapsedNavbarTransformRtl = "translateX(var(--app-shell-navbar-width))";
13
- if (navbar?.breakpoint && !navbar?.collapsed?.mobile) {
13
+ if (navbar?.breakpoint !== void 0 && !navbar?.collapsed?.mobile) {
14
14
  maxMediaStyles[navbar?.breakpoint] = maxMediaStyles[navbar?.breakpoint] || {};
15
15
  maxMediaStyles[navbar?.breakpoint]["--app-shell-navbar-offset"] = "0px";
16
16
  maxMediaStyles[navbar?.breakpoint]["--app-shell-navbar-width"] = "100%";
@@ -37,7 +37,7 @@ function assignNavbarVariables({ baseStyles, minMediaStyles, maxMediaStyles, nav
37
37
  }
38
38
  });
39
39
  }
40
- if (navbar?.breakpoint && mode === "static") {
40
+ if (navbar?.breakpoint !== void 0 && mode === "static") {
41
41
  minMediaStyles[navbar.breakpoint] = minMediaStyles[navbar.breakpoint] || {};
42
42
  minMediaStyles[navbar.breakpoint]["--app-shell-navbar-position"] = "sticky";
43
43
  minMediaStyles[navbar.breakpoint]["--app-shell-navbar-grid-row"] = "2";
@@ -1 +1 @@
1
- {"version":3,"file":"assign-navbar-variables.cjs","names":["isPrimitiveSize","rem","getBaseSize","isResponsiveSize","getBreakpointValue"],"sources":["../../../../../src/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.ts"],"sourcesContent":["import { getBreakpointValue, keys, MantineTheme, rem } from '../../../../core';\nimport type { AppShellProps } from '../../AppShell';\nimport { getBaseSize } from '../get-base-size/get-base-size';\nimport type { CSSVariables, MediaQueryVariables } from '../get-variables/get-variables';\nimport { isPrimitiveSize } from '../is-primitive-size/is-primitive-size';\nimport { isResponsiveSize } from '../is-responsive-size/is-responsive-size';\n\ninterface AssignNavbarVariablesInput {\n baseStyles: CSSVariables;\n minMediaStyles: MediaQueryVariables;\n maxMediaStyles: MediaQueryVariables;\n navbar: AppShellProps['navbar'] | undefined;\n theme: MantineTheme;\n mode: 'fixed' | 'static';\n}\n\nexport function assignNavbarVariables({\n baseStyles,\n minMediaStyles,\n maxMediaStyles,\n navbar,\n theme,\n mode,\n}: AssignNavbarVariablesInput) {\n const navbarWidth = navbar?.width;\n const collapsedNavbarTransform = 'translateX(calc(var(--app-shell-navbar-width) * -1))';\n const collapsedNavbarTransformRtl = 'translateX(var(--app-shell-navbar-width))';\n\n if (navbar?.breakpoint && !navbar?.collapsed?.mobile) {\n maxMediaStyles[navbar?.breakpoint] = maxMediaStyles[navbar?.breakpoint] || {};\n maxMediaStyles[navbar?.breakpoint]['--app-shell-navbar-offset'] = '0px';\n maxMediaStyles[navbar?.breakpoint]['--app-shell-navbar-width'] = '100%';\n if (mode === 'static') {\n maxMediaStyles[navbar?.breakpoint]['--app-shell-navbar-grid-width'] = '0px';\n }\n }\n\n if (isPrimitiveSize(navbarWidth)) {\n const baseSize = rem(getBaseSize(navbarWidth));\n baseStyles['--app-shell-navbar-width'] = baseSize;\n baseStyles['--app-shell-navbar-offset'] = baseSize;\n if (mode === 'static') {\n baseStyles['--app-shell-navbar-grid-width'] = baseSize;\n }\n }\n\n if (isResponsiveSize(navbarWidth)) {\n if (typeof navbarWidth.base !== 'undefined') {\n baseStyles['--app-shell-navbar-width'] = rem(navbarWidth.base);\n baseStyles['--app-shell-navbar-offset'] = rem(navbarWidth.base);\n if (mode === 'static') {\n baseStyles['--app-shell-navbar-grid-width'] = rem(navbarWidth.base);\n }\n }\n\n keys(navbarWidth).forEach((key) => {\n if (key !== 'base') {\n minMediaStyles[key] = minMediaStyles[key] || {};\n minMediaStyles[key]['--app-shell-navbar-width'] = rem(navbarWidth![key]);\n minMediaStyles[key]['--app-shell-navbar-offset'] = rem(navbarWidth![key]);\n if (mode === 'static') {\n minMediaStyles[key]['--app-shell-navbar-grid-width'] = rem(navbarWidth![key]);\n }\n }\n });\n }\n\n if (navbar?.breakpoint && mode === 'static') {\n minMediaStyles[navbar.breakpoint] = minMediaStyles[navbar.breakpoint] || {};\n minMediaStyles[navbar.breakpoint]['--app-shell-navbar-position'] = 'sticky';\n minMediaStyles[navbar.breakpoint]['--app-shell-navbar-grid-row'] = '2';\n minMediaStyles[navbar.breakpoint]['--app-shell-navbar-grid-column'] = '1';\n minMediaStyles[navbar.breakpoint]['--app-shell-main-column-start'] = '2';\n }\n\n if (navbar?.collapsed?.desktop) {\n const breakpointValue = navbar!.breakpoint;\n minMediaStyles[breakpointValue] = minMediaStyles[breakpointValue] || {};\n minMediaStyles[breakpointValue]['--app-shell-navbar-transform'] = collapsedNavbarTransform;\n minMediaStyles[breakpointValue]['--app-shell-navbar-transform-rtl'] =\n collapsedNavbarTransformRtl;\n if (mode === 'fixed') {\n minMediaStyles[breakpointValue]['--app-shell-navbar-offset'] = '0px !important';\n } else {\n // In static mode, hide the element completely so grid column collapses\n minMediaStyles[breakpointValue]['--app-shell-navbar-width'] = '0px';\n minMediaStyles[breakpointValue]['--app-shell-navbar-display'] = 'none';\n minMediaStyles[breakpointValue]['--app-shell-main-column-start'] = '1';\n }\n }\n\n if (navbar?.collapsed?.mobile) {\n const breakpointValue = getBreakpointValue(navbar!.breakpoint, theme.breakpoints) - 0.1;\n maxMediaStyles[breakpointValue] = maxMediaStyles[breakpointValue] || {};\n maxMediaStyles[breakpointValue]['--app-shell-navbar-width'] = '100%';\n maxMediaStyles[breakpointValue]['--app-shell-navbar-offset'] = '0px';\n if (mode === 'static') {\n maxMediaStyles[breakpointValue]['--app-shell-navbar-grid-width'] = '0px';\n }\n maxMediaStyles[breakpointValue]['--app-shell-navbar-transform'] = collapsedNavbarTransform;\n maxMediaStyles[breakpointValue]['--app-shell-navbar-transform-rtl'] =\n collapsedNavbarTransformRtl;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Ac,eAAe,OAAO,eAAe,CAAC;EAC1E,eAAe,OAAO,WAAW,CAAC,iCAAiC;EACnE,eAAe,OAAO,WAAW,CAAC,iCAAiC;EACnE,eAAe,OAAO,WAAW,CAAC,oCAAoC;EACtE,eAAe,OAAO,WAAW,CAAC,mCAAmC;CACvE;CAEA,IAAI,QAAQ,WAAW,SAAS;EAC9B,MAAM,kBAAkB,OAAQ;EAChC,eAAe,mBAAmB,eAAe,oBAAoB,CAAC;EACtE,eAAe,gBAAgB,CAAC,kCAAkC;EAClE,eAAe,gBAAgB,CAAC,sCAC9B;EACF,IAAI,SAAS,SACX,eAAe,gBAAgB,CAAC,+BAA+B;OAC1D;GAEL,eAAe,gBAAgB,CAAC,8BAA8B;GAC9D,eAAe,gBAAgB,CAAC,gCAAgC;GAChE,eAAe,gBAAgB,CAAC,mCAAmC;EACrE;CACF;CAEA,IAAI,QAAQ,WAAW,QAAQ;EAC7B,MAAM,kBAAkBG,6BAAAA,mBAAmB,OAAQ,YAAY,MAAM,WAAW,IAAI;EACpF,eAAe,mBAAmB,eAAe,oBAAoB,CAAC;EACtE,eAAe,gBAAgB,CAAC,8BAA8B;EAC9D,eAAe,gBAAgB,CAAC,+BAA+B;EAC/D,IAAI,SAAS,UACX,eAAe,gBAAgB,CAAC,mCAAmC;EAErE,eAAe,gBAAgB,CAAC,kCAAkC;EAClE,eAAe,gBAAgB,CAAC,sCAC9B;CACJ;AACF"}
1
+ {"version":3,"file":"assign-navbar-variables.cjs","names":["isPrimitiveSize","rem","getBaseSize","isResponsiveSize","getBreakpointValue"],"sources":["../../../../../src/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.ts"],"sourcesContent":["import { getBreakpointValue, keys, MantineTheme, rem } from '../../../../core';\nimport type { AppShellProps } from '../../AppShell';\nimport { getBaseSize } from '../get-base-size/get-base-size';\nimport type { CSSVariables, MediaQueryVariables } from '../get-variables/get-variables';\nimport { isPrimitiveSize } from '../is-primitive-size/is-primitive-size';\nimport { isResponsiveSize } from '../is-responsive-size/is-responsive-size';\n\ninterface AssignNavbarVariablesInput {\n baseStyles: CSSVariables;\n minMediaStyles: MediaQueryVariables;\n maxMediaStyles: MediaQueryVariables;\n navbar: AppShellProps['navbar'] | undefined;\n theme: MantineTheme;\n mode: 'fixed' | 'static';\n}\n\nexport function assignNavbarVariables({\n baseStyles,\n minMediaStyles,\n maxMediaStyles,\n navbar,\n theme,\n mode,\n}: AssignNavbarVariablesInput) {\n const navbarWidth = navbar?.width;\n const collapsedNavbarTransform = 'translateX(calc(var(--app-shell-navbar-width) * -1))';\n const collapsedNavbarTransformRtl = 'translateX(var(--app-shell-navbar-width))';\n\n if (navbar?.breakpoint !== undefined && !navbar?.collapsed?.mobile) {\n maxMediaStyles[navbar?.breakpoint] = maxMediaStyles[navbar?.breakpoint] || {};\n maxMediaStyles[navbar?.breakpoint]['--app-shell-navbar-offset'] = '0px';\n maxMediaStyles[navbar?.breakpoint]['--app-shell-navbar-width'] = '100%';\n if (mode === 'static') {\n maxMediaStyles[navbar?.breakpoint]['--app-shell-navbar-grid-width'] = '0px';\n }\n }\n\n if (isPrimitiveSize(navbarWidth)) {\n const baseSize = rem(getBaseSize(navbarWidth));\n baseStyles['--app-shell-navbar-width'] = baseSize;\n baseStyles['--app-shell-navbar-offset'] = baseSize;\n if (mode === 'static') {\n baseStyles['--app-shell-navbar-grid-width'] = baseSize;\n }\n }\n\n if (isResponsiveSize(navbarWidth)) {\n if (typeof navbarWidth.base !== 'undefined') {\n baseStyles['--app-shell-navbar-width'] = rem(navbarWidth.base);\n baseStyles['--app-shell-navbar-offset'] = rem(navbarWidth.base);\n if (mode === 'static') {\n baseStyles['--app-shell-navbar-grid-width'] = rem(navbarWidth.base);\n }\n }\n\n keys(navbarWidth).forEach((key) => {\n if (key !== 'base') {\n minMediaStyles[key] = minMediaStyles[key] || {};\n minMediaStyles[key]['--app-shell-navbar-width'] = rem(navbarWidth![key]);\n minMediaStyles[key]['--app-shell-navbar-offset'] = rem(navbarWidth![key]);\n if (mode === 'static') {\n minMediaStyles[key]['--app-shell-navbar-grid-width'] = rem(navbarWidth![key]);\n }\n }\n });\n }\n\n if (navbar?.breakpoint !== undefined && mode === 'static') {\n minMediaStyles[navbar.breakpoint] = minMediaStyles[navbar.breakpoint] || {};\n minMediaStyles[navbar.breakpoint]['--app-shell-navbar-position'] = 'sticky';\n minMediaStyles[navbar.breakpoint]['--app-shell-navbar-grid-row'] = '2';\n minMediaStyles[navbar.breakpoint]['--app-shell-navbar-grid-column'] = '1';\n minMediaStyles[navbar.breakpoint]['--app-shell-main-column-start'] = '2';\n }\n\n if (navbar?.collapsed?.desktop) {\n const breakpointValue = navbar!.breakpoint;\n minMediaStyles[breakpointValue] = minMediaStyles[breakpointValue] || {};\n minMediaStyles[breakpointValue]['--app-shell-navbar-transform'] = collapsedNavbarTransform;\n minMediaStyles[breakpointValue]['--app-shell-navbar-transform-rtl'] =\n collapsedNavbarTransformRtl;\n if (mode === 'fixed') {\n minMediaStyles[breakpointValue]['--app-shell-navbar-offset'] = '0px !important';\n } else {\n // In static mode, hide the element completely so grid column collapses\n minMediaStyles[breakpointValue]['--app-shell-navbar-width'] = '0px';\n minMediaStyles[breakpointValue]['--app-shell-navbar-display'] = 'none';\n minMediaStyles[breakpointValue]['--app-shell-main-column-start'] = '1';\n }\n }\n\n if (navbar?.collapsed?.mobile) {\n const breakpointValue = getBreakpointValue(navbar!.breakpoint, theme.breakpoints) - 0.1;\n maxMediaStyles[breakpointValue] = maxMediaStyles[breakpointValue] || {};\n maxMediaStyles[breakpointValue]['--app-shell-navbar-width'] = '100%';\n maxMediaStyles[breakpointValue]['--app-shell-navbar-offset'] = '0px';\n if (mode === 'static') {\n maxMediaStyles[breakpointValue]['--app-shell-navbar-grid-width'] = '0px';\n }\n maxMediaStyles[breakpointValue]['--app-shell-navbar-transform'] = collapsedNavbarTransform;\n maxMediaStyles[breakpointValue]['--app-shell-navbar-transform-rtl'] =\n collapsedNavbarTransformRtl;\n }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ACzD,eAAe,OAAO,cAAc,eAAe,OAAO,eAAe,CAAC;EAC1E,eAAe,OAAO,WAAW,CAAC,iCAAiC;EACnE,eAAe,OAAO,WAAW,CAAC,iCAAiC;EACnE,eAAe,OAAO,WAAW,CAAC,oCAAoC;EACtE,eAAe,OAAO,WAAW,CAAC,mCAAmC;CACvE;CAEA,IAAI,QAAQ,WAAW,SAAS;EAC9B,MAAM,kBAAkB,OAAQ;EAChC,eAAe,mBAAmB,eAAe,oBAAoB,CAAC;EACtE,eAAe,gBAAgB,CAAC,kCAAkC;EAClE,eAAe,gBAAgB,CAAC,sCAC9B;EACF,IAAI,SAAS,SACX,eAAe,gBAAgB,CAAC,+BAA+B;OAC1D;GAEL,eAAe,gBAAgB,CAAC,8BAA8B;GAC9D,eAAe,gBAAgB,CAAC,gCAAgC;GAChE,eAAe,gBAAgB,CAAC,mCAAmC;EACrE;CACF;CAEA,IAAI,QAAQ,WAAW,QAAQ;EAC7B,MAAM,kBAAkBG,6BAAAA,mBAAmB,OAAQ,YAAY,MAAM,WAAW,IAAI;EACpF,eAAe,mBAAmB,eAAe,oBAAoB,CAAC;EACtE,eAAe,gBAAgB,CAAC,8BAA8B;EAC9D,eAAe,gBAAgB,CAAC,+BAA+B;EAC/D,IAAI,SAAS,UACX,eAAe,gBAAgB,CAAC,mCAAmC;EAErE,eAAe,gBAAgB,CAAC,kCAAkC;EAClE,eAAe,gBAAgB,CAAC,sCAC9B;CACJ;AACF"}
@@ -14,10 +14,11 @@ const defaultProps = {
14
14
  transitionTimingFunction: "ease",
15
15
  animateOpacity: true,
16
16
  orientation: "vertical",
17
- keepMounted: true
17
+ keepMounted: true,
18
+ keepMountedMode: "activity"
18
19
  };
19
20
  const Collapse = require_factory.factory((props) => {
20
- const { children, expanded, transitionDuration, transitionTimingFunction, style, onTransitionEnd, onTransitionStart, animateOpacity, keepMounted, ref, orientation, ...others } = require_use_props.useProps("Collapse", defaultProps, props);
21
+ const { children, expanded, transitionDuration, transitionTimingFunction, style, onTransitionEnd, onTransitionStart, animateOpacity, keepMounted, keepMountedMode, ref, orientation, ...others } = require_use_props.useProps("Collapse", defaultProps, props);
21
22
  const env = require_Mantine_context.useMantineEnv();
22
23
  const theme = require_MantineThemeProvider.useMantineTheme();
23
24
  const shouldReduceMotion = (0, _mantine_hooks.useReducedMotion)();
@@ -31,15 +32,26 @@ const Collapse = require_factory.factory((props) => {
31
32
  keepMounted: false
32
33
  });
33
34
  if (duration === 0) {
34
- if (keepMounted === true && env !== "test") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Activity, {
35
- mode: expanded ? "visible" : "hidden",
36
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
35
+ if (keepMounted === true && (keepMountedMode === "display-none" || env !== "test")) {
36
+ if (keepMountedMode === "display-none") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
37
37
  ...others,
38
- style,
38
+ style: {
39
+ ...require_get_style_object.getStyleObject(style, theme),
40
+ ...!expanded ? { display: "none" } : {}
41
+ },
39
42
  ref,
40
43
  children
41
- })
42
- });
44
+ });
45
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Activity, {
46
+ mode: expanded ? "visible" : "hidden",
47
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
48
+ ...others,
49
+ style,
50
+ ref,
51
+ children
52
+ })
53
+ });
54
+ }
43
55
  return expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
44
56
  ...others,
45
57
  style,
@@ -50,7 +62,7 @@ const Collapse = require_factory.factory((props) => {
50
62
  const isExited = collapse.state === "exited";
51
63
  let content;
52
64
  if (keepMounted === false) content = isExited ? null : children;
53
- else if (keepMounted === true) content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Activity, {
65
+ else if (keepMounted === true) content = keepMountedMode === "display-none" ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Activity, {
54
66
  mode: isExited ? "hidden" : "visible",
55
67
  children
56
68
  });
@@ -61,7 +73,8 @@ const Collapse = require_factory.factory((props) => {
61
73
  style: {
62
74
  opacity: expanded || !animateOpacity ? 1 : 0,
63
75
  transition: animateOpacity ? `opacity ${duration}ms ${transitionTimingFunction}` : "none",
64
- ...require_get_style_object.getStyleObject(style, theme)
76
+ ...require_get_style_object.getStyleObject(style, theme),
77
+ ...keepMounted && keepMountedMode === "display-none" && isExited ? { display: "none" } : {}
65
78
  },
66
79
  ref
67
80
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"Collapse.cjs","names":["factory","useProps","useMantineEnv","useMantineTheme","useHorizontalCollapse","useCollapse","Activity","Box","getStyleObject"],"sources":["../../../src/components/Collapse/Collapse.tsx"],"sourcesContent":["import { Activity } from 'react';\nimport { useCollapse, useHorizontalCollapse, useReducedMotion } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n Factory,\n factory,\n getStyleObject,\n useMantineEnv,\n useMantineTheme,\n useProps,\n} from '../../core';\n\nexport interface CollapseProps extends BoxProps, Omit<React.ComponentProps<'div'>, keyof BoxProps> {\n /** Collapse orientation @default 'vertical' */\n orientation?: 'vertical' | 'horizontal';\n\n /** Expanded state */\n expanded: boolean;\n\n /** Called when the transition ends */\n onTransitionEnd?: () => void;\n\n /** Called when transition starts */\n onTransitionStart?: () => void;\n\n /** Transition duration in ms @default 200 */\n transitionDuration?: number;\n\n /** Transition timing function @default ease */\n transitionTimingFunction?: string;\n\n /** Determines whether the opacity is animated @default true */\n animateOpacity?: boolean;\n\n /** If set, the element is kept in the DOM when collapsed. When `true`, React 19 `Activity` is used to preserve state while collapsed. When `false`, the element is unmounted after the exit animation. @default true */\n keepMounted?: boolean;\n}\n\nexport type CollapseFactory = Factory<{\n props: CollapseProps;\n ref: HTMLDivElement;\n}>;\n\nconst defaultProps = {\n transitionDuration: 200,\n transitionTimingFunction: 'ease',\n animateOpacity: true,\n orientation: 'vertical',\n keepMounted: true,\n} satisfies Partial<CollapseProps>;\n\nexport const Collapse = factory<CollapseFactory>((props) => {\n const {\n children,\n expanded,\n transitionDuration,\n transitionTimingFunction,\n style,\n onTransitionEnd,\n onTransitionStart,\n animateOpacity,\n keepMounted,\n ref,\n orientation,\n ...others\n } = useProps('Collapse', defaultProps, props);\n\n const env = useMantineEnv();\n const theme = useMantineTheme();\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const duration = reduceMotion ? 0 : transitionDuration;\n const hook = orientation === 'horizontal' ? useHorizontalCollapse : useCollapse;\n\n const collapse = hook({\n expanded,\n transitionDuration: duration,\n transitionTimingFunction,\n onTransitionEnd,\n onTransitionStart,\n keepMounted: false,\n });\n\n if (duration === 0) {\n if (keepMounted === true && env !== 'test') {\n return (\n <Activity mode={expanded ? 'visible' : 'hidden'}>\n <Box {...others} style={style} ref={ref}>\n {children}\n </Box>\n </Activity>\n );\n }\n\n return expanded ? (\n <Box {...others} style={style} ref={ref}>\n {children}\n </Box>\n ) : null;\n }\n\n const isExited = collapse.state === 'exited';\n\n let content: React.ReactNode;\n if (keepMounted === false) {\n content = isExited ? null : children;\n } else if (keepMounted === true) {\n content = <Activity mode={isExited ? 'hidden' : 'visible'}>{children}</Activity>;\n } else {\n content = children;\n }\n\n return (\n <Box\n {...others}\n {...collapse.getCollapseProps({\n style: {\n opacity: expanded || !animateOpacity ? 1 : 0,\n transition: animateOpacity ? `opacity ${duration}ms ${transitionTimingFunction}` : 'none',\n ...getStyleObject(style, theme),\n },\n ref,\n })}\n >\n {content}\n </Box>\n );\n});\n\nCollapse.displayName = '@mantine/core/Collapse';\n\nexport namespace Collapse {\n export type Props = CollapseProps;\n export type Factory = CollapseFactory;\n}\n"],"mappings":";;;;;;;;;;;AA4CA,MAAM,eAAe;CACnB,oBAAoB;CACpB,0BAA0B;CAC1B,gBAAgB;CAChB,aAAa;CACb,aAAa;AACf;AAEA,MAAa,WAAWA,gBAAAA,SAA0B,UAAU;CAC1D,MAAM,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EACF,CAAC;YAEA;CACE,CAAA;AAET,CAAC;AAED,SAAS,cAAc"}
1
+ {"version":3,"file":"Collapse.cjs","names":["factory","useProps","useMantineEnv","useMantineTheme","useHorizontalCollapse","useCollapse","Box","getStyleObject","Activity"],"sources":["../../../src/components/Collapse/Collapse.tsx"],"sourcesContent":["import { Activity } from 'react';\nimport { useCollapse, useHorizontalCollapse, useReducedMotion } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n Factory,\n factory,\n getStyleObject,\n useMantineEnv,\n useMantineTheme,\n useProps,\n} from '../../core';\n\nexport interface CollapseProps extends BoxProps, Omit<React.ComponentProps<'div'>, keyof BoxProps> {\n /** Collapse orientation @default 'vertical' */\n orientation?: 'vertical' | 'horizontal';\n\n /** Expanded state */\n expanded: boolean;\n\n /** Called when the transition ends */\n onTransitionEnd?: () => void;\n\n /** Called when transition starts */\n onTransitionStart?: () => void;\n\n /** Transition duration in ms @default 200 */\n transitionDuration?: number;\n\n /** Transition timing function @default ease */\n transitionTimingFunction?: string;\n\n /** Determines whether the opacity is animated @default true */\n animateOpacity?: boolean;\n\n /** If set, the element is kept in the DOM when collapsed. When `true`, React 19 `Activity` is used to preserve state while collapsed. When `false`, the element is unmounted after the exit animation. @default true */\n keepMounted?: boolean;\n\n /** Controls how the element is hidden when `keepMounted` is set:\n * `'activity'` – hidden with React 19 `Activity` component,\n * `'display-none'` – hidden with `display: none` styles\n * @default 'activity'\n */\n keepMountedMode?: 'activity' | 'display-none';\n}\n\nexport type CollapseFactory = Factory<{\n props: CollapseProps;\n ref: HTMLDivElement;\n}>;\n\nconst defaultProps = {\n transitionDuration: 200,\n transitionTimingFunction: 'ease',\n animateOpacity: true,\n orientation: 'vertical',\n keepMounted: true,\n keepMountedMode: 'activity',\n} satisfies Partial<CollapseProps>;\n\nexport const Collapse = factory<CollapseFactory>((props) => {\n const {\n children,\n expanded,\n transitionDuration,\n transitionTimingFunction,\n style,\n onTransitionEnd,\n onTransitionStart,\n animateOpacity,\n keepMounted,\n keepMountedMode,\n ref,\n orientation,\n ...others\n } = useProps('Collapse', defaultProps, props);\n\n const env = useMantineEnv();\n const theme = useMantineTheme();\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const duration = reduceMotion ? 0 : transitionDuration;\n const hook = orientation === 'horizontal' ? useHorizontalCollapse : useCollapse;\n\n const collapse = hook({\n expanded,\n transitionDuration: duration,\n transitionTimingFunction,\n onTransitionEnd,\n onTransitionStart,\n keepMounted: false,\n });\n\n if (duration === 0) {\n if (keepMounted === true && (keepMountedMode === 'display-none' || env !== 'test')) {\n if (keepMountedMode === 'display-none') {\n return (\n <Box\n {...others}\n style={{\n ...getStyleObject(style, theme),\n ...(!expanded ? { display: 'none' } : {}),\n }}\n ref={ref}\n >\n {children}\n </Box>\n );\n }\n\n return (\n <Activity mode={expanded ? 'visible' : 'hidden'}>\n <Box {...others} style={style} ref={ref}>\n {children}\n </Box>\n </Activity>\n );\n }\n\n return expanded ? (\n <Box {...others} style={style} ref={ref}>\n {children}\n </Box>\n ) : null;\n }\n\n const isExited = collapse.state === 'exited';\n\n let content: React.ReactNode;\n if (keepMounted === false) {\n content = isExited ? null : children;\n } else if (keepMounted === true) {\n content =\n keepMountedMode === 'display-none' ? (\n children\n ) : (\n <Activity mode={isExited ? 'hidden' : 'visible'}>{children}</Activity>\n );\n } else {\n content = children;\n }\n\n return (\n <Box\n {...others}\n {...collapse.getCollapseProps({\n style: {\n opacity: expanded || !animateOpacity ? 1 : 0,\n transition: animateOpacity ? `opacity ${duration}ms ${transitionTimingFunction}` : 'none',\n ...getStyleObject(style, theme),\n ...(keepMounted && keepMountedMode === 'display-none' && isExited\n ? { display: 'none' }\n : {}),\n },\n ref,\n })}\n >\n {content}\n </Box>\n );\n});\n\nCollapse.displayName = '@mantine/core/Collapse';\n\nexport namespace Collapse {\n export type Props = CollapseProps;\n export type Factory = CollapseFactory;\n}\n"],"mappings":";;;;;;;;;;;AAmDA,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gBAAgB,OAClB,UAAU,WAAW,OAAO;MACvB,IAAI,gBAAgB,MACzB,UACE,oBAAoB,iBAClB,WAEA,iBAAA,GAAA,kBAAA,IAAA,CAACE,MAAAA,UAAD;EAAU,MAAM,WAAW,WAAW;EAAY;CAAmB,CAAA;MAGzE,UAAU;CAGZ,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,YAAAA,KAAD;EACE,GAAI;EACJ,GAAI,SAAS,iBAAiB;GAC5B,OAAO;IACL,SAAS,YAAY,CAAC,iBAAiB,IAAI;IAC3C,YAAY,iBAAiB,WAAW,SAAS,KAAK,6BAA6B;IACnF,GAAGC,yBAAAA,eAAe,OAAO,KAAK;IAC9B,GAAI,eAAe,oBAAoB,kBAAkB,WACrD,EAAE,SAAS,OAAO,IAClB,CAAC;GACP;GACA;EACF,CAAC;YAEA;CACE,CAAA;AAET,CAAC;AAED,SAAS,cAAc"}
@@ -64,7 +64,7 @@ function MenubarTarget(props) {
64
64
  ctx.openMenu(menuCtx.index, "hover");
65
65
  ctx.setActiveIndex(menuCtx.index);
66
66
  } else if (ctx.openIndex !== null && ctx.openIndex !== menuCtx.index) {
67
- ctx.openMenu(menuCtx.index, "hover");
67
+ ctx.openMenu(menuCtx.index, "click");
68
68
  ctx.setActiveIndex(menuCtx.index);
69
69
  }
70
70
  });
@@ -1 +1 @@
1
- {"version":3,"file":"MenubarTarget.cjs","names":["useProps","useMenubarContext","useMenubarMenuContext","useDirection","createEventHandler","Popover","UnstyledButton"],"sources":["../../../../src/components/Menubar/MenubarTarget/MenubarTarget.tsx"],"sourcesContent":["import {\n createEventHandler,\n ElementProps,\n MantineStyleProp,\n useDirection,\n useProps,\n} from '../../../core';\nimport { Popover } from '../../Popover';\nimport { UnstyledButton } from '../../UnstyledButton';\nimport { useMenubarContext, useMenubarMenuContext } from '../Menubar.context';\n\nexport interface MenubarTargetProps extends ElementProps<'button'> {\n 'data-disabled'?: boolean;\n\n /** Target label */\n children: React.ReactNode;\n\n /** Inline styles applied to the target button */\n style?: MantineStyleProp;\n\n /** Key of the prop used to get element ref, useful for forwarding refs to custom components @default 'ref' */\n refProp?: string;\n}\n\nconst defaultProps = {\n refProp: 'ref',\n} satisfies Partial<MenubarTargetProps>;\n\nfunction isPrintableKey(event: React.KeyboardEvent) {\n return (\n event.key.length === 1 && event.key !== ' ' && !event.ctrlKey && !event.metaKey && !event.altKey\n );\n}\n\nfunction getTargetLabel(node: HTMLElement) {\n return (node.textContent ?? '').trim().toLowerCase();\n}\n\nexport function MenubarTarget(props: MenubarTargetProps) {\n const {\n children,\n refProp,\n className,\n style,\n disabled,\n 'data-disabled': dataDisabled,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onKeyDown,\n ...others\n } = useProps('MenubarTarget', defaultProps, props);\n\n const ctx = useMenubarContext();\n const menuCtx = useMenubarMenuContext();\n const { dir } = useDirection();\n\n const isDisabled = disabled || dataDisabled;\n const isActive = ctx.activeIndex === menuCtx.index;\n\n // Before the menu indexes resolve from the DOM (first render / SSR HTML), every target\n // would otherwise compute `tabIndex={-1}`, leaving the menubar with no tab stop until\n // effects run. Keep unresolved targets focusable so keyboard users can enter the menubar.\n const isUnresolvedTabStop = menuCtx.index === -1 && !isDisabled;\n\n const moveToAdjacent = (direction: 1 | -1) => {\n const nextIndex = ctx.getAdjacentIndex(menuCtx.index, direction);\n ctx.setActiveIndex(nextIndex);\n ctx.focusTarget(nextIndex);\n if (ctx.openIndex !== null) {\n ctx.openMenu(nextIndex, 'click');\n }\n };\n\n const openAndFocusItem = (itemPosition: 'first' | 'last') => {\n ctx.openMenu(menuCtx.index, 'click');\n ctx.setActiveIndex(menuCtx.index);\n ctx.focusMenuItem(menuCtx.index, itemPosition);\n };\n\n const typeAhead = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n const targets = ctx.getTargets();\n if (targets.length === 0) {\n return;\n }\n\n const char = event.key.toLowerCase();\n for (let offset = 1; offset <= targets.length; offset += 1) {\n const index = (menuCtx.index + offset) % targets.length;\n const node = targets[index];\n if (\n node &&\n !node.disabled &&\n !node.hasAttribute('data-disabled') &&\n getTargetLabel(node).startsWith(char)\n ) {\n event.preventDefault();\n ctx.setActiveIndex(index);\n node.focus();\n if (ctx.openIndex !== null) {\n ctx.openMenu(index, 'click');\n }\n break;\n }\n }\n };\n\n const handleClick = createEventHandler<any>(onClick, () => {\n if (isDisabled) {\n return;\n }\n if (ctx.openIndex === menuCtx.index && ctx.getOpenSource() !== 'hover') {\n ctx.closeMenu();\n } else {\n ctx.openMenu(menuCtx.index, 'click');\n ctx.setActiveIndex(menuCtx.index);\n }\n });\n\n const handleMouseEnter = createEventHandler<any>(onMouseEnter, () => {\n if (isDisabled) {\n return;\n }\n ctx.cancelClose();\n if (ctx.trigger === 'hover') {\n ctx.openMenu(menuCtx.index, 'hover');\n ctx.setActiveIndex(menuCtx.index);\n } else if (ctx.openIndex !== null && ctx.openIndex !== menuCtx.index) {\n ctx.openMenu(menuCtx.index, 'hover');\n ctx.setActiveIndex(menuCtx.index);\n }\n });\n\n const handleMouseLeave = createEventHandler<any>(onMouseLeave, () => {\n if (ctx.trigger === 'hover') {\n ctx.scheduleClose();\n }\n });\n\n const handleFocus = createEventHandler<any>(onFocus, () => ctx.setActiveIndex(menuCtx.index));\n\n const handleKeyDown = createEventHandler<any>(onKeyDown, (event) => {\n if (isDisabled) {\n return;\n }\n const forwardKey = dir === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n const backKey = dir === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n\n if (event.key === forwardKey) {\n event.preventDefault();\n moveToAdjacent(1);\n } else if (event.key === backKey) {\n event.preventDefault();\n moveToAdjacent(-1);\n } else if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n openAndFocusItem('first');\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n openAndFocusItem('last');\n } else if (event.key === 'Home') {\n event.preventDefault();\n const enabled = ctx.getEnabledIndexes();\n if (enabled.length > 0) {\n ctx.setActiveIndex(enabled[0]);\n ctx.focusTarget(enabled[0]);\n }\n } else if (event.key === 'End') {\n event.preventDefault();\n const enabled = ctx.getEnabledIndexes();\n if (enabled.length > 0) {\n const last = enabled[enabled.length - 1];\n ctx.setActiveIndex(last);\n ctx.focusTarget(last);\n }\n } else if (event.key === 'Escape') {\n if (menuCtx.opened) {\n ctx.closeMenu();\n }\n } else if (event.key === 'Tab') {\n if (menuCtx.opened) {\n ctx.closeMenu();\n }\n } else if (isPrintableKey(event)) {\n typeAhead(event);\n }\n });\n\n return (\n <Popover.Target refProp={refProp} popupType=\"menu\">\n <UnstyledButton\n {...others}\n unstyled={ctx.unstyled}\n role=\"menuitem\"\n tabIndex={isActive || isUnresolvedTabStop ? 0 : -1}\n disabled={disabled}\n data-menubar-target\n data-menubar-id={menuCtx.id}\n data-disabled={dataDisabled || undefined}\n data-expanded={menuCtx.opened || undefined}\n data-mantine-stop-propagation={menuCtx.opened || undefined}\n {...ctx.getStyles('target', { className, style })}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n >\n {children}\n </UnstyledButton>\n </Popover.Target>\n );\n}\n\nMenubarTarget.displayName = '@mantine/core/MenubarTarget';\n"],"mappings":";;;;;;;;;AAwBA,MAAM,eAAe,EACnB,SAAS,MACX;AAEA,SAAS,eAAe,OAA4B;CAClD,OACE,MAAM,IAAI,WAAW,KAAK,MAAM,QAAQ,OAAO,CAAC,MAAM,WAAW,CAAC,MAAM,WAAW,CAAC,MAAM;AAE9F;AAEA,SAAS,eAAe,MAAmB;CACzC,QAAQ,KAAK,eAAe,GAAA,CAAI,KAAK,CAAC,CAAC,YAAY;AACrD;AAEA,SAAgB,cAAc,OAA2B;CACvD,MAAM,EACJ,UACA,SACA,WACA,OACA,UACA,iBAAiB,cACjB,SACA,cACA,cACA,SACA,WACA,GAAG,WACDA,kBAAAA,SAAS,iBAAiB,cAAc,KA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,OAAO,IAAI,MAAM,QAAQ,OAAO;GAC9B,MAAM,eAAe;GACrB,MAAM,UAAU,IAAI,kBAAkB;GACtC,IAAI,QAAQ,SAAS,GAAG;IACtB,MAAM,OAAO,QAAQ,QAAQ,SAAS;IACtC,IAAI,eAAe,IAAI;IACvB,IAAI,YAAY,IAAI;GACtB;EACF,OAAO,IAAI,MAAM,QAAQ;OACnB,QAAQ,QACV,IAAI,UAAU;EAAA,OAEX,IAAI,MAAM,QAAQ;OACnB,QAAQ,QACV,IAAI,UAAU;EAAA,OAEX,IAAI,eAAe,KAAK,GAC7B,UAAU,KAAK;CAEnB,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,QAAQ,QAAT;EAAyB;EAAS,WAAU;YAC1C,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,gBAAD;GACE,GAAI;GACJ,UAAU,IAAI;GACd,MAAK;GACL,UAAU,YAAY,sBAAsB,IAAI;GACtC;GACV,uBAAA;GACA,mBAAiB,QAAQ;GACzB,iBAAe,gBAAgB,KAAA;GAC/B,iBAAe,QAAQ,UAAU,KAAA;GACjC,iCAA+B,QAAQ,UAAU,KAAA;GACjD,GAAI,IAAI,UAAU,UAAU;IAAE;IAAW;GAAM,CAAC;GAChD,SAAS;GACT,cAAc;GACd,cAAc;GACd,SAAS;GACT,WAAW;GAEV;EACa,CAAA;CACF,CAAA;AAEpB;AAEA,cAAc,cAAc"}
1
+ {"version":3,"file":"MenubarTarget.cjs","names":["useProps","useMenubarContext","useMenubarMenuContext","useDirection","createEventHandler","Popover","UnstyledButton"],"sources":["../../../../src/components/Menubar/MenubarTarget/MenubarTarget.tsx"],"sourcesContent":["import {\n createEventHandler,\n ElementProps,\n MantineStyleProp,\n useDirection,\n useProps,\n} from '../../../core';\nimport { Popover } from '../../Popover';\nimport { UnstyledButton } from '../../UnstyledButton';\nimport { useMenubarContext, useMenubarMenuContext } from '../Menubar.context';\n\nexport interface MenubarTargetProps extends ElementProps<'button'> {\n 'data-disabled'?: boolean;\n\n /** Target label */\n children: React.ReactNode;\n\n /** Inline styles applied to the target button */\n style?: MantineStyleProp;\n\n /** Key of the prop used to get element ref, useful for forwarding refs to custom components @default 'ref' */\n refProp?: string;\n}\n\nconst defaultProps = {\n refProp: 'ref',\n} satisfies Partial<MenubarTargetProps>;\n\nfunction isPrintableKey(event: React.KeyboardEvent) {\n return (\n event.key.length === 1 && event.key !== ' ' && !event.ctrlKey && !event.metaKey && !event.altKey\n );\n}\n\nfunction getTargetLabel(node: HTMLElement) {\n return (node.textContent ?? '').trim().toLowerCase();\n}\n\nexport function MenubarTarget(props: MenubarTargetProps) {\n const {\n children,\n refProp,\n className,\n style,\n disabled,\n 'data-disabled': dataDisabled,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onKeyDown,\n ...others\n } = useProps('MenubarTarget', defaultProps, props);\n\n const ctx = useMenubarContext();\n const menuCtx = useMenubarMenuContext();\n const { dir } = useDirection();\n\n const isDisabled = disabled || dataDisabled;\n const isActive = ctx.activeIndex === menuCtx.index;\n\n // Before the menu indexes resolve from the DOM (first render / SSR HTML), every target\n // would otherwise compute `tabIndex={-1}`, leaving the menubar with no tab stop until\n // effects run. Keep unresolved targets focusable so keyboard users can enter the menubar.\n const isUnresolvedTabStop = menuCtx.index === -1 && !isDisabled;\n\n const moveToAdjacent = (direction: 1 | -1) => {\n const nextIndex = ctx.getAdjacentIndex(menuCtx.index, direction);\n ctx.setActiveIndex(nextIndex);\n ctx.focusTarget(nextIndex);\n if (ctx.openIndex !== null) {\n ctx.openMenu(nextIndex, 'click');\n }\n };\n\n const openAndFocusItem = (itemPosition: 'first' | 'last') => {\n ctx.openMenu(menuCtx.index, 'click');\n ctx.setActiveIndex(menuCtx.index);\n ctx.focusMenuItem(menuCtx.index, itemPosition);\n };\n\n const typeAhead = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n const targets = ctx.getTargets();\n if (targets.length === 0) {\n return;\n }\n\n const char = event.key.toLowerCase();\n for (let offset = 1; offset <= targets.length; offset += 1) {\n const index = (menuCtx.index + offset) % targets.length;\n const node = targets[index];\n if (\n node &&\n !node.disabled &&\n !node.hasAttribute('data-disabled') &&\n getTargetLabel(node).startsWith(char)\n ) {\n event.preventDefault();\n ctx.setActiveIndex(index);\n node.focus();\n if (ctx.openIndex !== null) {\n ctx.openMenu(index, 'click');\n }\n break;\n }\n }\n };\n\n const handleClick = createEventHandler<any>(onClick, () => {\n if (isDisabled) {\n return;\n }\n if (ctx.openIndex === menuCtx.index && ctx.getOpenSource() !== 'hover') {\n ctx.closeMenu();\n } else {\n ctx.openMenu(menuCtx.index, 'click');\n ctx.setActiveIndex(menuCtx.index);\n }\n });\n\n const handleMouseEnter = createEventHandler<any>(onMouseEnter, () => {\n if (isDisabled) {\n return;\n }\n ctx.cancelClose();\n if (ctx.trigger === 'hover') {\n ctx.openMenu(menuCtx.index, 'hover');\n ctx.setActiveIndex(menuCtx.index);\n } else if (ctx.openIndex !== null && ctx.openIndex !== menuCtx.index) {\n // Hover-switching with trigger=\"click\" continues a click-driven interaction:\n // keep 'click' as the open source so that the next click on the target\n // closes the menu, same as a click-opened menu (desktop application pattern)\n ctx.openMenu(menuCtx.index, 'click');\n ctx.setActiveIndex(menuCtx.index);\n }\n });\n\n const handleMouseLeave = createEventHandler<any>(onMouseLeave, () => {\n if (ctx.trigger === 'hover') {\n ctx.scheduleClose();\n }\n });\n\n const handleFocus = createEventHandler<any>(onFocus, () => ctx.setActiveIndex(menuCtx.index));\n\n const handleKeyDown = createEventHandler<any>(onKeyDown, (event) => {\n if (isDisabled) {\n return;\n }\n const forwardKey = dir === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n const backKey = dir === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n\n if (event.key === forwardKey) {\n event.preventDefault();\n moveToAdjacent(1);\n } else if (event.key === backKey) {\n event.preventDefault();\n moveToAdjacent(-1);\n } else if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n openAndFocusItem('first');\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n openAndFocusItem('last');\n } else if (event.key === 'Home') {\n event.preventDefault();\n const enabled = ctx.getEnabledIndexes();\n if (enabled.length > 0) {\n ctx.setActiveIndex(enabled[0]);\n ctx.focusTarget(enabled[0]);\n }\n } else if (event.key === 'End') {\n event.preventDefault();\n const enabled = ctx.getEnabledIndexes();\n if (enabled.length > 0) {\n const last = enabled[enabled.length - 1];\n ctx.setActiveIndex(last);\n ctx.focusTarget(last);\n }\n } else if (event.key === 'Escape') {\n if (menuCtx.opened) {\n ctx.closeMenu();\n }\n } else if (event.key === 'Tab') {\n if (menuCtx.opened) {\n ctx.closeMenu();\n }\n } else if (isPrintableKey(event)) {\n typeAhead(event);\n }\n });\n\n return (\n <Popover.Target refProp={refProp} popupType=\"menu\">\n <UnstyledButton\n {...others}\n unstyled={ctx.unstyled}\n role=\"menuitem\"\n tabIndex={isActive || isUnresolvedTabStop ? 0 : -1}\n disabled={disabled}\n data-menubar-target\n data-menubar-id={menuCtx.id}\n data-disabled={dataDisabled || undefined}\n data-expanded={menuCtx.opened || undefined}\n data-mantine-stop-propagation={menuCtx.opened || undefined}\n {...ctx.getStyles('target', { className, style })}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n >\n {children}\n </UnstyledButton>\n </Popover.Target>\n );\n}\n\nMenubarTarget.displayName = '@mantine/core/MenubarTarget';\n"],"mappings":";;;;;;;;;AAwBA,MAAM,eAAe,EACnB,SAAS,MACX;AAEA,SAAS,eAAe,OAA4B;CAClD,OACE,MAAM,IAAI,WAAW,KAAK,MAAM,QAAQ,OAAO,CAAC,MAAM,WAAW,CAAC,MAAM,WAAW,CAAC,MAAM;AAE9F;AAEA,SAAS,eAAe,MAAmB;CACzC,QAAQ,KAAK,eAAe,GAAA,CAAI,KAAK,CAAC,CAAC,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AAQ;GAC/B,MAAM,eAAe;GACrB,MAAM,UAAU,IAAI,kBAAkB;GACtC,IAAI,QAAQ,SAAS,GAAG;IACtB,IAAI,eAAe,QAAQ,EAAE;IAC7B,IAAI,YAAY,QAAQ,EAAE;GAC5B;EACF,OAAO,IAAI,MAAM,QAAQ,OAAO;GAC9B,MAAM,eAAe;GACrB,MAAM,UAAU,IAAI,kBAAkB;GACtC,IAAI,QAAQ,SAAS,GAAG;IACtB,MAAM,OAAO,QAAQ,QAAQ,SAAS;IACtC,IAAI,eAAe,IAAI;IACvB,IAAI,YAAY,IAAI;GACtB;EACF,OAAO,IAAI,MAAM,QAAQ;OACnB,QAAQ,QACV,IAAI,UAAU;EAAA,OAEX,IAAI,MAAM,QAAQ;OACnB,QAAQ,QACV,IAAI,UAAU;EAAA,OAEX,IAAI,eAAe,KAAK,GAC7B,UAAU,KAAK;CAEnB,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,QAAQ,QAAT;EAAyB;EAAS,WAAU;YAC1C,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,gBAAD;GACE,GAAI;GACJ,UAAU,IAAI;GACd,MAAK;GACL,UAAU,YAAY,sBAAsB,IAAI;GACtC;GACV,uBAAA;GACA,mBAAiB,QAAQ;GACzB,iBAAe,gBAAgB,KAAA;GAC/B,iBAAe,QAAQ,UAAU,KAAA;GACjC,iCAA+B,QAAQ,UAAU,KAAA;GACjD,GAAI,IAAI,UAAU,UAAU;IAAE;IAAW;GAAM,CAAC;GAChD,SAAS;GACT,cAAc;GACd,cAAc;GACd,SAAS;GACT,WAAW;GAEV;EACa,CAAA;CACF,CAAA;AAEpB;AAEA,cAAc,cAAc"}
@@ -8,7 +8,7 @@ const require_use_modal = require("./use-modal.cjs");
8
8
  let react_remove_scroll = require("react-remove-scroll");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  //#region packages/@mantine/core/src/components/ModalBase/ModalBase.tsx
11
- function ModalBase({ keepMounted, opened, onClose, id, transitionProps, onExitTransitionEnd, onEnterTransitionEnd, trapFocus, closeOnEscape, returnFocus, closeOnClickOutside, withinPortal, portalProps, lockScroll, children, zIndex, shadow, padding, __vars, unstyled, removeScrollProps, ...others }) {
11
+ function ModalBase({ keepMounted, keepMountedMode = "activity", opened, onClose, id, transitionProps, onExitTransitionEnd, onEnterTransitionEnd, trapFocus, closeOnEscape, returnFocus, closeOnClickOutside, withinPortal, portalProps, lockScroll, children, zIndex, shadow, padding, __vars, unstyled, removeScrollProps, ...others }) {
12
12
  const { _id, titleMounted, bodyMounted, shouldLockScroll, setTitleMounted, setBodyMounted } = require_use_modal.useModal({
13
13
  id,
14
14
  transitionProps,
@@ -31,7 +31,8 @@ function ModalBase({ keepMounted, opened, onClose, id, transitionProps, onExitTr
31
31
  onEnterTransitionEnd,
32
32
  transitionProps: {
33
33
  ...transitionProps,
34
- keepMounted
34
+ keepMounted,
35
+ keepMountedMode
35
36
  },
36
37
  getTitleId: () => `${_id}-title`,
37
38
  getBodyId: () => `${_id}-body`,
@@ -1 +1 @@
1
- {"version":3,"file":"ModalBase.cjs","names":["useModal","OptionalPortal","ModalBaseProvider","RemoveScroll","Box","getDefaultZIndex","getShadow","getSpacing"],"sources":["../../../src/components/ModalBase/ModalBase.tsx"],"sourcesContent":["import { RemoveScroll } from 'react-remove-scroll';\nimport {\n Box,\n BoxProps,\n ElementProps,\n getDefaultZIndex,\n getShadow,\n getSpacing,\n MantineShadow,\n MantineSize,\n MantineSpacing,\n} from '../../core';\nimport { BasePortalProps, OptionalPortal } from '../Portal';\nimport { TransitionOverride } from '../Transition';\nimport { ModalBaseProvider } from './ModalBase.context';\nimport { useModal } from './use-modal';\n\ntype RemoveScrollProps = Omit<React.ComponentProps<typeof RemoveScroll>, 'children'>;\n\nexport interface ModalBaseProps extends BoxProps, ElementProps<'div', 'title'> {\n unstyled?: boolean;\n\n /** If set modal/drawer is not unmounted from the DOM when hidden. `display: none` styles are applied instead. @default false */\n keepMounted?: boolean;\n\n /** Controls opened state */\n opened: boolean;\n\n /** Called when modal/drawer is closed */\n onClose: () => void;\n\n /** Id used to connect modal/drawer with body and title */\n id?: string;\n\n /** If set, scroll is locked when `opened={true}` @default true */\n lockScroll?: boolean;\n\n /** If set, focus is trapped within the modal/drawer @default true */\n trapFocus?: boolean;\n\n /** If set, the component is rendered inside `Portal` @default true */\n withinPortal?: boolean;\n\n /** Props passed down to the Portal component when `withinPortal` is set */\n portalProps?: BasePortalProps;\n\n /** Modal/drawer content */\n children?: React.ReactNode;\n\n /** If set, the modal/drawer is closed when user clicks on the overlay @default true */\n closeOnClickOutside?: boolean;\n\n /** Props added to the `Transition` component that used to animate overlay and body, use to configure duration and animation type, `{ duration: 200, transition: 'fade-down' }` by default */\n transitionProps?: TransitionOverride;\n\n /** Called when exit transition ends */\n onExitTransitionEnd?: () => void;\n\n /** Called when enter transition ends */\n onEnterTransitionEnd?: () => void;\n\n /** If set, `onClose` is called when user presses the escape key @default true */\n closeOnEscape?: boolean;\n\n /** If set, focus is returned to the last active element when `onClose` is called @default true */\n returnFocus?: boolean;\n\n /** `z-index` CSS property of the root element @default 200 */\n zIndex?: string | number;\n\n /** Key of `theme.shadows` or any valid CSS box-shadow value @default 'xl' */\n shadow?: MantineShadow;\n\n /** Key of `theme.spacing` or any valid CSS value to set content, header and footer padding @default 'md' */\n padding?: MantineSpacing;\n\n /** Controls width of the content area @default 'md' */\n size?: MantineSize | (string & {}) | number;\n\n /** Props passed down to react-remove-scroll, can be used to customize scroll lock behavior */\n removeScrollProps?: RemoveScrollProps;\n}\n\nexport function ModalBase({\n keepMounted,\n opened,\n onClose,\n id,\n transitionProps,\n onExitTransitionEnd,\n onEnterTransitionEnd,\n trapFocus,\n closeOnEscape,\n returnFocus,\n closeOnClickOutside,\n withinPortal,\n portalProps,\n lockScroll,\n children,\n zIndex,\n shadow,\n padding,\n __vars,\n unstyled,\n removeScrollProps,\n ...others\n}: ModalBaseProps) {\n const { _id, titleMounted, bodyMounted, shouldLockScroll, setTitleMounted, setBodyMounted } =\n useModal({ id, transitionProps, opened, trapFocus, closeOnEscape, onClose, returnFocus });\n\n const { key: removeScrollKey, ...otherRemoveScrollProps } = removeScrollProps || {};\n\n return (\n <OptionalPortal {...portalProps} withinPortal={withinPortal}>\n <ModalBaseProvider\n value={{\n opened,\n onClose,\n closeOnClickOutside,\n onExitTransitionEnd,\n onEnterTransitionEnd,\n transitionProps: { ...transitionProps, keepMounted },\n getTitleId: () => `${_id}-title`,\n getBodyId: () => `${_id}-body`,\n titleMounted,\n bodyMounted,\n setTitleMounted,\n setBodyMounted,\n trapFocus,\n closeOnEscape,\n zIndex,\n unstyled,\n }}\n >\n <RemoveScroll\n enabled={shouldLockScroll && lockScroll}\n key={removeScrollKey}\n {...otherRemoveScrollProps}\n >\n <Box\n {...others}\n id={_id}\n __vars={{\n ...__vars,\n '--mb-z-index': (zIndex || getDefaultZIndex('modal')).toString(),\n '--mb-shadow': getShadow(shadow),\n '--mb-padding': getSpacing(padding),\n }}\n >\n {children}\n </Box>\n </RemoveScroll>\n </ModalBaseProvider>\n </OptionalPortal>\n );\n}\n\nModalBase.displayName = '@mantine/core/ModalBase';\n"],"mappings":";;;;;;;;;;AAmFA,SAAgB,UAAU,EACxB,aACA,QACA,SACA,IACA,iBACA,qBACA,sBACA,WACA,eACA,aACA,qBACA,cACA,aACA,YACA,UACA,QACA,QACA,SACA,QACA,UACA,mBACA,GAAG,UACc;CACjB,MAAM,EAAE,KAAK,cAAc,aAAa,kBAAkB,iBAAiB,mBACzEA,kBAAAA,SAAS;EAAE;EAAI;EAAiB;EAAQ;EAAW;EAAe;EAAS;CAAY,CAAC;CAE1F,MAAM,EAAE,KAAK,iBAAiB,GAAG,2BAA2B,qBAAqB,CAAC;CAElF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,gBAAD;EAAgB,GAAI;EAA2B;YAC7C,iBAAA,GAAA,kBAAA,IAAA,CAACC,0BAAAA,mBAAD;GACE,OAAO;IACL;IACA;IACA;IACA;IACA;IACA,iBAAiB;KAAE,GAAG;KAAiB;IAAY;IACnD,kBAAkB,GAAG,IAAI;IACzB,iBAAiB,GAAG,IAAI;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;aAEA,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,cAAD;IACE,SAAS,oBAAoB;IAE7B,GAAI;cAEJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;KACE,GAAI;KACJ,IAAI;KACJ,QAAQ;MACN,GAAG;MACH,iBAAiB,UAAUC,4BAAAA,iBAAiB,OAAO,EAAA,CAAG,SAAS;MAC/D,eAAeC,iBAAAA,UAAU,MAAM;MAC/B,gBAAgBC,iBAAAA,WAAW,OAAO;KACpC;KAEC;IACE,CAAA;GACO,GAfP,eAeO;EACG,CAAA;CACL,CAAA;AAEpB;AAEA,UAAU,cAAc"}
1
+ {"version":3,"file":"ModalBase.cjs","names":["useModal","OptionalPortal","ModalBaseProvider","RemoveScroll","Box","getDefaultZIndex","getShadow","getSpacing"],"sources":["../../../src/components/ModalBase/ModalBase.tsx"],"sourcesContent":["import { RemoveScroll } from 'react-remove-scroll';\nimport {\n Box,\n BoxProps,\n ElementProps,\n getDefaultZIndex,\n getShadow,\n getSpacing,\n MantineShadow,\n MantineSize,\n MantineSpacing,\n} from '../../core';\nimport { BasePortalProps, OptionalPortal } from '../Portal';\nimport { TransitionOverride } from '../Transition';\nimport { ModalBaseProvider } from './ModalBase.context';\nimport { useModal } from './use-modal';\n\ntype RemoveScrollProps = Omit<React.ComponentProps<typeof RemoveScroll>, 'children'>;\n\nexport interface ModalBaseProps extends BoxProps, ElementProps<'div', 'title'> {\n unstyled?: boolean;\n\n /** If set modal/drawer is not unmounted from the DOM when hidden. `display: none` styles are applied instead. @default false */\n keepMounted?: boolean;\n\n /** Controls how the modal/drawer is hidden when `keepMounted` is set:\n * `'activity'` - hidden with React 19 `Activity` component,\n * `'display-none'` - hidden with `display: none` styles\n * @default 'activity'\n */\n keepMountedMode?: 'activity' | 'display-none';\n\n /** Controls opened state */\n opened: boolean;\n\n /** Called when modal/drawer is closed */\n onClose: () => void;\n\n /** Id used to connect modal/drawer with body and title */\n id?: string;\n\n /** If set, scroll is locked when `opened={true}` @default true */\n lockScroll?: boolean;\n\n /** If set, focus is trapped within the modal/drawer @default true */\n trapFocus?: boolean;\n\n /** If set, the component is rendered inside `Portal` @default true */\n withinPortal?: boolean;\n\n /** Props passed down to the Portal component when `withinPortal` is set */\n portalProps?: BasePortalProps;\n\n /** Modal/drawer content */\n children?: React.ReactNode;\n\n /** If set, the modal/drawer is closed when user clicks on the overlay @default true */\n closeOnClickOutside?: boolean;\n\n /** Props added to the `Transition` component that used to animate overlay and body, use to configure duration and animation type, `{ duration: 200, transition: 'fade-down' }` by default */\n transitionProps?: TransitionOverride;\n\n /** Called when exit transition ends */\n onExitTransitionEnd?: () => void;\n\n /** Called when enter transition ends */\n onEnterTransitionEnd?: () => void;\n\n /** If set, `onClose` is called when user presses the escape key @default true */\n closeOnEscape?: boolean;\n\n /** If set, focus is returned to the last active element when `onClose` is called @default true */\n returnFocus?: boolean;\n\n /** `z-index` CSS property of the root element @default 200 */\n zIndex?: string | number;\n\n /** Key of `theme.shadows` or any valid CSS box-shadow value @default 'xl' */\n shadow?: MantineShadow;\n\n /** Key of `theme.spacing` or any valid CSS value to set content, header and footer padding @default 'md' */\n padding?: MantineSpacing;\n\n /** Controls width of the content area @default 'md' */\n size?: MantineSize | (string & {}) | number;\n\n /** Props passed down to react-remove-scroll, can be used to customize scroll lock behavior */\n removeScrollProps?: RemoveScrollProps;\n}\n\nexport function ModalBase({\n keepMounted,\n keepMountedMode = 'activity',\n opened,\n onClose,\n id,\n transitionProps,\n onExitTransitionEnd,\n onEnterTransitionEnd,\n trapFocus,\n closeOnEscape,\n returnFocus,\n closeOnClickOutside,\n withinPortal,\n portalProps,\n lockScroll,\n children,\n zIndex,\n shadow,\n padding,\n __vars,\n unstyled,\n removeScrollProps,\n ...others\n}: ModalBaseProps) {\n const { _id, titleMounted, bodyMounted, shouldLockScroll, setTitleMounted, setBodyMounted } =\n useModal({ id, transitionProps, opened, trapFocus, closeOnEscape, onClose, returnFocus });\n\n const { key: removeScrollKey, ...otherRemoveScrollProps } = removeScrollProps || {};\n\n return (\n <OptionalPortal {...portalProps} withinPortal={withinPortal}>\n <ModalBaseProvider\n value={{\n opened,\n onClose,\n closeOnClickOutside,\n onExitTransitionEnd,\n onEnterTransitionEnd,\n transitionProps: { ...transitionProps, keepMounted, keepMountedMode },\n getTitleId: () => `${_id}-title`,\n getBodyId: () => `${_id}-body`,\n titleMounted,\n bodyMounted,\n setTitleMounted,\n setBodyMounted,\n trapFocus,\n closeOnEscape,\n zIndex,\n unstyled,\n }}\n >\n <RemoveScroll\n enabled={shouldLockScroll && lockScroll}\n key={removeScrollKey}\n {...otherRemoveScrollProps}\n >\n <Box\n {...others}\n id={_id}\n __vars={{\n ...__vars,\n '--mb-z-index': (zIndex || getDefaultZIndex('modal')).toString(),\n '--mb-shadow': getShadow(shadow),\n '--mb-padding': getSpacing(padding),\n }}\n >\n {children}\n </Box>\n </RemoveScroll>\n </ModalBaseProvider>\n </OptionalPortal>\n );\n}\n\nModalBase.displayName = '@mantine/core/ModalBase';\n"],"mappings":";;;;;;;;;;AA0FA,SAAgB,UAAU,EACxB,aACA,kBAAkB,YAClB,QACA,SACA,IACA,iBACA,qBACA,sBACA,WACA,eACA,aACA,qBACA,cACA,aACA,YACA,UACA,QACA,QACA,SACA,QACA,UACA,mBACA,GAAG,UACc;CACjB,MAAM,EAAE,KAAK,cAAc,aAAa,kBAAkB,iBAAiB,mBACzEA,kBAAAA,SAAS;EAAE;EAAI;EAAiB;EAAQ;EAAW;EAAe;EAAS;CAAY,CAAC;CAE1F,MAAM,EAAE,KAAK,iBAAiB,GAAG,2BAA2B,qBAAqB,CAAC;CAElF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,gBAAD;EAAgB,GAAI;EAA2B;YAC7C,iBAAA,GAAA,kBAAA,IAAA,CAACC,0BAAAA,mBAAD;GACE,OAAO;IACL;IACA;IACA;IACA;IACA;IACA,iBAAiB;KAAE,GAAG;KAAiB;KAAa;IAAgB;IACpE,kBAAkB,GAAG,IAAI;IACzB,iBAAiB,GAAG,IAAI;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;aAEA,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,cAAD;IACE,SAAS,oBAAoB;IAE7B,GAAI;cAEJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;KACE,GAAI;KACJ,IAAI;KACJ,QAAQ;MACN,GAAG;MACH,iBAAiB,UAAUC,4BAAAA,iBAAiB,OAAO,EAAA,CAAG,SAAS;MAC/D,eAAeC,iBAAAA,UAAU,MAAM;MAC/B,gBAAgBC,iBAAAA,WAAW,OAAO;KACpC;KAEC;IACE,CAAA;GACO,GAfP,eAeO;EACG,CAAA;CACL,CAAA;AAEpB;AAEA,UAAU,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Transition.cjs","names":["useMantineEnv","useTransition","Activity","getTransitionStyles"],"sources":["../../../src/components/Transition/Transition.tsx"],"sourcesContent":["import { Activity } from 'react';\nimport { useMantineEnv } from '../../core';\nimport { getTransitionStyles } from './get-transition-styles/get-transition-styles';\nimport { MantineTransition } from './transitions';\nimport { useTransition } from './use-transition';\n\nexport interface TransitionProps {\n /** If set, the element is kept in the DOM when hidden. React 19 `Activity` is used to preserve state while the element is not visible. */\n keepMounted?: boolean;\n\n /**\n * Controls how the element is hidden when `keepMounted` is set:\n * `'activity'` – hidden with React 19 `Activity` component,\n * `'display-none'` – hidden with `display: none` styles\n * @default 'activity'\n */\n keepMountedMode?: 'activity' | 'display-none';\n\n /** Transition name or object */\n transition?: MantineTransition;\n\n /** Transition duration in ms @default 250 */\n duration?: number;\n\n /** Exit transition duration in ms @default 250 */\n exitDuration?: number;\n\n /** Transition timing function @default theme.transitionTimingFunction */\n timingFunction?: string;\n\n /** Determines whether component should be mounted to the DOM */\n mounted: boolean;\n\n /** Render function with transition styles argument */\n children: (styles: React.CSSProperties) => React.JSX.Element;\n\n /** Called when exit transition ends */\n onExited?: () => void;\n\n /** Called when exit transition starts */\n onExit?: () => void;\n\n /** Called when enter transition starts */\n onEnter?: () => void;\n\n /** Called when enter transition ends */\n onEntered?: () => void;\n\n /** Delay in ms before enter transition starts */\n enterDelay?: number;\n\n /** Delay in ms before exit transition starts */\n exitDelay?: number;\n}\n\nexport type TransitionOverride = Partial<Omit<TransitionProps, 'mounted'>>;\n\nexport function Transition({\n keepMounted,\n keepMountedMode = 'activity',\n transition = 'fade',\n duration = 250,\n exitDuration = duration,\n mounted,\n children,\n timingFunction = 'ease',\n onExit,\n onEntered,\n onEnter,\n onExited,\n enterDelay,\n exitDelay,\n}: TransitionProps) {\n const env = useMantineEnv();\n const { transitionDuration, transitionStatus, transitionTimingFunction } = useTransition({\n mounted,\n exitDuration,\n duration,\n timingFunction,\n onExit,\n onEntered,\n onEnter,\n onExited,\n enterDelay,\n exitDelay,\n });\n\n if (env === 'test') {\n return mounted ? <>{children({})}</> : keepMounted ? children({ display: 'none' }) : null;\n }\n\n if (transitionDuration === 0) {\n if (keepMounted) {\n if (keepMountedMode === 'display-none') {\n return mounted ? <>{children({})}</> : children({ display: 'none' });\n }\n\n return <Activity mode={mounted ? 'visible' : 'hidden'}>{children({})}</Activity>;\n }\n return mounted ? <>{children({})}</> : null;\n }\n\n const isExited = transitionStatus === 'exited';\n\n if (keepMounted) {\n const keepMountedChildren = children(\n isExited\n ? keepMountedMode === 'display-none'\n ? { display: 'none' }\n : {}\n : getTransitionStyles({\n transition,\n duration: transitionDuration,\n state: transitionStatus,\n timingFunction: transitionTimingFunction,\n })\n );\n\n if (keepMountedMode === 'display-none') {\n return keepMountedChildren;\n }\n\n return <Activity mode={isExited ? 'hidden' : 'visible'}>{keepMountedChildren}</Activity>;\n }\n\n return isExited ? null : (\n <>\n {children(\n getTransitionStyles({\n transition,\n duration: transitionDuration,\n state: transitionStatus,\n timingFunction: transitionTimingFunction,\n })\n )}\n </>\n );\n}\n\nTransition.displayName = '@mantine/core/Transition';\n\nexport namespace Transition {\n export type Props = TransitionProps;\n export type Override = TransitionOverride;\n}\n"],"mappings":";;;;;;;AAyDA,SAAgB,WAAW,EACzB,aACA,kBAAkB,YAClB,aAAa,QACb,WAAW,KACX,eAAe,UACf,SACA,UACA,iBAAiB,QACjB,QACA,WACA,SACA,UACA,YACA,aACkB;CAClB,MAAM,MAAMA,wBAAAA,cAAc;CAC1B,MAAM,EAAE,oBAAoB,kBAAkB,6BAA6BC,uBAAAA,cAAc;EACvF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,IAAI,QAAQ,QACV,OAAO,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UAAG,SAAS,CAAC,CAAC,EAAI,CAAA,IAAI,cAAc,SAAS,EAAE,SAAS,OAAO,CAAC,IAAI;CAGvF,IAAI,uBAAuB,GAAG;EAC5B,IAAI,aAAa;GACf,IAAI,oBAAoB,gBACtB,OAAO,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UAAG,SAAS,CAAC,CAAC,EAAI,CAAA,IAAI,SAAS,EAAE,SAAS,OAAO,CAAC;GAGrE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,MAAAA,UAAD;IAAU,MAAM,UAAU,YAAY;cAAW,SAAS,CAAC,CAAC;GAAY,CAAA;EACjF;EACA,OAAO,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UAAG,SAAS,CAAC,CAAC,EAAI,CAAA,IAAI;CACzC;CAEA,MAAM,WAAW,qBAAqB;CAEtC,IAAI,aAAa;EACf,MAAM,sBAAsB,SAC1B,WACI,oBAAoB,iBAClB,EAAE,SAAS,OAAO,IAClB,CAAC,IACHC,8BAAAA,oBAAoB;GAClB;GACA,UAAU;GACV,OAAO;GACP,gBAAgB;EAClB,CAAC,CACP;EAEA,IAAI,oBAAoB,gBACtB,OAAO;EAGT,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACD,MAAAA,UAAD;GAAU,MAAM,WAAW,WAAW;aAAY;EAA8B,CAAA;CACzF;CAEA,OAAO,WAAW,OAChB,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UACG,SACCC,8BAAAA,oBAAoB;EAClB;EACA,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB,CAAC,CACH,EACA,CAAA;AAEN;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"Transition.cjs","names":["useMantineEnv","useTransition","Activity","getTransitionStyles"],"sources":["../../../src/components/Transition/Transition.tsx"],"sourcesContent":["import { Activity } from 'react';\nimport { useMantineEnv } from '../../core';\nimport { getTransitionStyles } from './get-transition-styles/get-transition-styles';\nimport { MantineTransition } from './transitions';\nimport { useTransition } from './use-transition';\n\nexport interface TransitionProps {\n /** If set, the element is kept in the DOM when hidden. React 19 `Activity` is used to preserve state while the element is not visible. */\n keepMounted?: boolean;\n\n /**\n * Controls how the element is hidden when `keepMounted` is set:\n * `'activity'` - hidden with React 19 `Activity` component,\n * `'display-none'` - hidden with `display: none` styles\n * @default 'activity'\n */\n keepMountedMode?: 'activity' | 'display-none';\n\n /** Transition name or object */\n transition?: MantineTransition;\n\n /** Transition duration in ms @default 250 */\n duration?: number;\n\n /** Exit transition duration in ms @default 250 */\n exitDuration?: number;\n\n /** Transition timing function @default theme.transitionTimingFunction */\n timingFunction?: string;\n\n /** Determines whether component should be mounted to the DOM */\n mounted: boolean;\n\n /** Render function with transition styles argument */\n children: (styles: React.CSSProperties) => React.JSX.Element;\n\n /** Called when exit transition ends */\n onExited?: () => void;\n\n /** Called when exit transition starts */\n onExit?: () => void;\n\n /** Called when enter transition starts */\n onEnter?: () => void;\n\n /** Called when enter transition ends */\n onEntered?: () => void;\n\n /** Delay in ms before enter transition starts */\n enterDelay?: number;\n\n /** Delay in ms before exit transition starts */\n exitDelay?: number;\n}\n\nexport type TransitionOverride = Partial<Omit<TransitionProps, 'mounted'>>;\n\nexport function Transition({\n keepMounted,\n keepMountedMode = 'activity',\n transition = 'fade',\n duration = 250,\n exitDuration = duration,\n mounted,\n children,\n timingFunction = 'ease',\n onExit,\n onEntered,\n onEnter,\n onExited,\n enterDelay,\n exitDelay,\n}: TransitionProps) {\n const env = useMantineEnv();\n const { transitionDuration, transitionStatus, transitionTimingFunction } = useTransition({\n mounted,\n exitDuration,\n duration,\n timingFunction,\n onExit,\n onEntered,\n onEnter,\n onExited,\n enterDelay,\n exitDelay,\n });\n\n if (env === 'test') {\n return mounted ? <>{children({})}</> : keepMounted ? children({ display: 'none' }) : null;\n }\n\n if (transitionDuration === 0) {\n if (keepMounted) {\n if (keepMountedMode === 'display-none') {\n return mounted ? <>{children({})}</> : children({ display: 'none' });\n }\n\n return <Activity mode={mounted ? 'visible' : 'hidden'}>{children({})}</Activity>;\n }\n return mounted ? <>{children({})}</> : null;\n }\n\n const isExited = transitionStatus === 'exited';\n\n if (keepMounted) {\n const keepMountedChildren = children(\n isExited\n ? keepMountedMode === 'display-none'\n ? { display: 'none' }\n : {}\n : getTransitionStyles({\n transition,\n duration: transitionDuration,\n state: transitionStatus,\n timingFunction: transitionTimingFunction,\n })\n );\n\n if (keepMountedMode === 'display-none') {\n return keepMountedChildren;\n }\n\n return <Activity mode={isExited ? 'hidden' : 'visible'}>{keepMountedChildren}</Activity>;\n }\n\n return isExited ? null : (\n <>\n {children(\n getTransitionStyles({\n transition,\n duration: transitionDuration,\n state: transitionStatus,\n timingFunction: transitionTimingFunction,\n })\n )}\n </>\n );\n}\n\nTransition.displayName = '@mantine/core/Transition';\n\nexport namespace Transition {\n export type Props = TransitionProps;\n export type Override = TransitionOverride;\n}\n"],"mappings":";;;;;;;AAyDA,SAAg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A;CACzF;CAEA,OAAO,WAAW,OAChB,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UACG,SACCC,8BAAAA,oBAAoB;EAClB;EACA,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB,CAAC,CACH,EACA,CAAA;AAEN;AAEA,WAAW,cAAc"}
@@ -23,14 +23,22 @@ const FlatTreeNode = (0, react.memo)(function FlatTreeNode({ node, level, parent
23
23
  const root = require_find_element_ancestor.findElementAncestor(event.currentTarget, "[data-tree-root]");
24
24
  const nodes = root ? Array.from(root.querySelectorAll("[role=treeitem]")).filter((treeNode) => treeNode.style.display !== "none") : [];
25
25
  const index = nodes.indexOf(event.currentTarget);
26
- if (index !== -1) nodes[index + 1]?.focus();
26
+ if (index !== -1) {
27
+ const nextNode = nodes[index + 1];
28
+ nextNode?.setAttribute("data-focus-ring", "true");
29
+ nextNode?.focus();
30
+ }
27
31
  } else if (hasChildren) tree.expand(node.value);
28
32
  }
29
33
  if (event.nativeEvent.code === "ArrowLeft") {
30
34
  event.stopPropagation();
31
35
  event.preventDefault();
32
36
  if (expanded && hasChildren) tree.collapse(node.value);
33
- else if (parent) (require_find_element_ancestor.findElementAncestor(event.currentTarget, "[data-tree-root]")?.querySelector(`[role=treeitem][data-value="${CSS.escape(parent)}"]`))?.focus();
37
+ else if (parent) {
38
+ const parentElement = require_find_element_ancestor.findElementAncestor(event.currentTarget, "[data-tree-root]")?.querySelector(`[role=treeitem][data-value="${CSS.escape(parent)}"]`);
39
+ parentElement?.setAttribute("data-focus-ring", "true");
40
+ parentElement?.focus();
41
+ }
34
42
  }
35
43
  if (event.nativeEvent.code === "ArrowDown" || event.nativeEvent.code === "ArrowUp") {
36
44
  const root = require_find_element_ancestor.findElementAncestor(event.currentTarget, "[data-tree-root]");
@@ -40,7 +48,9 @@ const FlatTreeNode = (0, react.memo)(function FlatTreeNode({ node, level, parent
40
48
  const nodes = Array.from(root.querySelectorAll("[role=treeitem]")).filter((treeNode) => treeNode.style.display !== "none");
41
49
  const index = nodes.indexOf(event.currentTarget);
42
50
  if (index === -1) return;
43
- nodes[event.nativeEvent.code === "ArrowDown" ? index + 1 : index - 1]?.focus();
51
+ const nextNode = nodes[event.nativeEvent.code === "ArrowDown" ? index + 1 : index - 1];
52
+ nextNode?.setAttribute("data-focus-ring", "true");
53
+ nextNode?.focus();
44
54
  }
45
55
  if (event.nativeEvent.code === "Space") {
46
56
  if (expandOnSpace) {
@@ -78,6 +88,9 @@ const FlatTreeNode = (0, react.memo)(function FlatTreeNode({ node, level, parent
78
88
  "data-level": level,
79
89
  tabIndex,
80
90
  onKeyDown: handleKeyDown,
91
+ onBlur: (event) => {
92
+ if (!event.currentTarget.contains(event.relatedTarget)) event.currentTarget.removeAttribute("data-focus-ring");
93
+ },
81
94
  children: [linesPath?.map((state, idx) => {
82
95
  if (state === "none") return null;
83
96
  const column = idx + 2;
@@ -1 +1 @@
1
- {"version":3,"file":"FlatTreeNode.cjs","names":["findElementAncestor","classes"],"sources":["../../../src/components/Tree/FlatTreeNode.tsx"],"sourcesContent":["import { memo, useRef } from 'react';\nimport { findElementAncestor } from '../../core';\nimport type { FlatTreeLineState } from './flatten-tree-data/flatten-tree-data';\nimport type { RenderNode, TreeNodeData } from './Tree';\nimport type { TreeController } from './use-tree';\nimport classes from './Tree.module.css';\n\nexport interface FlatTreeNodeProps {\n /** Node data from tree data */\n node: TreeNodeData;\n\n /** Nesting level of the node, starts at 1 */\n level: number;\n\n /** Value of the parent node, `null` for root nodes */\n parent: string | null;\n\n /** Whether the node has children */\n hasChildren: boolean;\n\n /** Whether the node is expanded */\n expanded: boolean;\n\n /** Tree controller instance, return value of `useTree` hook */\n tree: TreeController;\n\n /** If set, tree node with children is expanded on click @default true */\n expandOnClick?: boolean;\n\n /** If set, tree node is selected on click @default false */\n selectOnClick?: boolean;\n\n /** If set, tree node with children is expanded on space key press @default true */\n expandOnSpace?: boolean;\n\n /** If set, tree node is checked on space key press @default false */\n checkOnSpace?: boolean;\n\n /** A function to render tree node label */\n renderNode?: RenderNode;\n\n /** Style to apply to the root element, used for virtualizer positioning */\n style?: React.CSSProperties;\n\n /** Tab index for the node */\n tabIndex?: number;\n\n /** Line state per ancestor + own level, computed by `flattenTreeData`.\n * When provided and the tree root has `data-with-lines`, connector lines are rendered. */\n linesPath?: FlatTreeLineState[];\n}\n\nexport const FlatTreeNode = memo(function FlatTreeNode({\n node,\n level,\n parent,\n hasChildren,\n expanded,\n tree,\n expandOnClick = true,\n selectOnClick,\n expandOnSpace = true,\n checkOnSpace,\n renderNode,\n style,\n tabIndex = -1,\n linesPath,\n}: FlatTreeNodeProps) {\n const ref = useRef<HTMLDivElement>(null);\n const isLoading = tree.isNodeLoading(node.value);\n const loadError = tree.getNodeLoadError(node.value);\n const selected = tree.selectedState.includes(node.value);\n\n const handleClick = (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (expandOnClick && hasChildren) {\n tree.toggleExpanded(node.value);\n }\n\n if (selectOnClick) {\n tree.select(node.value);\n }\n\n ref.current?.focus();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.nativeEvent.code === 'ArrowRight') {\n event.stopPropagation();\n event.preventDefault();\n\n if (expanded && hasChildren) {\n const root = findElementAncestor(event.currentTarget as HTMLElement, '[data-tree-root]');\n const nodes = root\n ? Array.from(root.querySelectorAll<HTMLElement>('[role=treeitem]')).filter(\n (treeNode) => treeNode.style.display !== 'none'\n )\n : [];\n const index = nodes.indexOf(event.currentTarget as HTMLElement);\n if (index !== -1) {\n nodes[index + 1]?.focus();\n }\n } else if (hasChildren) {\n tree.expand(node.value);\n }\n }\n\n if (event.nativeEvent.code === 'ArrowLeft') {\n event.stopPropagation();\n event.preventDefault();\n\n if (expanded && hasChildren) {\n tree.collapse(node.value);\n } else if (parent) {\n const root = findElementAncestor(event.currentTarget as HTMLElement, '[data-tree-root]');\n const parentElement = root?.querySelector<HTMLElement>(\n `[role=treeitem][data-value=\"${CSS.escape(parent)}\"]`\n );\n parentElement?.focus();\n }\n }\n\n if (event.nativeEvent.code === 'ArrowDown' || event.nativeEvent.code === 'ArrowUp') {\n const root = findElementAncestor(event.currentTarget as HTMLElement, '[data-tree-root]');\n\n if (!root) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n const nodes = Array.from(root.querySelectorAll<HTMLElement>('[role=treeitem]')).filter(\n (treeNode) => treeNode.style.display !== 'none'\n );\n const index = nodes.indexOf(event.currentTarget as HTMLElement);\n\n if (index === -1) {\n return;\n }\n\n const nextIndex = event.nativeEvent.code === 'ArrowDown' ? index + 1 : index - 1;\n nodes[nextIndex]?.focus();\n }\n\n if (event.nativeEvent.code === 'Space') {\n if (expandOnSpace) {\n event.stopPropagation();\n event.preventDefault();\n tree.toggleExpanded(node.value);\n }\n\n if (checkOnSpace) {\n event.stopPropagation();\n event.preventDefault();\n if (tree.isNodeChecked(node.value)) {\n tree.uncheckNode(node.value);\n } else {\n tree.checkNode(node.value);\n }\n }\n }\n };\n\n const elementProps = {\n className: classes.label,\n style: {} as React.CSSProperties,\n onClick: handleClick,\n 'data-selected': selected || undefined,\n 'data-value': node.value,\n };\n\n return (\n <div\n ref={ref}\n className={classes.node}\n style={{\n ...({\n '--label-offset': `calc(var(--level-offset, var(--mantine-spacing-lg)) * ${level - 1})`,\n } as React.CSSProperties),\n ...style,\n }}\n role=\"treeitem\"\n aria-selected={selected}\n aria-expanded={hasChildren ? expanded : undefined}\n data-value={node.value}\n data-selected={selected || undefined}\n data-level={level}\n tabIndex={tabIndex}\n onKeyDown={handleKeyDown}\n >\n {linesPath?.map((state, idx) => {\n if (state === 'none') {\n return null;\n }\n const column = idx + 2;\n return (\n <span\n key={column}\n aria-hidden\n className={`${classes.flatLine}${state === 'closing' ? ` ${classes.flatLineClosing}` : ''}`}\n style={{ '--flat-line-column': column } as React.CSSProperties}\n />\n );\n })}\n {typeof renderNode === 'function' ? (\n renderNode({\n node,\n level,\n selected,\n isRoot: level === 1,\n tree,\n expanded,\n hasChildren,\n isLoading,\n loadError,\n elementProps,\n dragHandleProps: undefined,\n })\n ) : (\n <div {...elementProps}>{node.label}</div>\n )}\n </div>\n );\n});\n\nFlatTreeNode.displayName = '@mantine/core/FlatTreeNode';\n"],"mappings":";;;;;;AAoDA,MAAa,gBAAA,GAAA,MAAA,KAAA,CAAoB,SAAS,aAAa,EACrD,MACA,OACA,QACA,aACA,UACA,MACA,gBAAgB,MAChB,eACA,gBAAgB,MAChB,cACA,YACA,OACA,WAAW,IACX,aACoB;CACpB,MAAM,OAAA,GAAA,MAAA,OAAA,CAA6B,IAAI;CACvC,MAAM,YAAY,KAAK,cAAc,KAAK,KAAK;CAC/C,MAAM,YAAY,KAAK,iBAAiB,KAAK,KAAK;CAClD,MAAM,WAAW,KAAK,cAAc,SAAS,KAAK,KAAK;CAEvD,MAAM,eAAe,UAA4B;EAC/C,MAAM,gBAAgB;EAEtB,IAAI,iBAAiB,aACnB,KAAK,eAAe,KAAK,KAAK;EAGhC,IAAI,eACF,KAAK,OAAO,KAAK,KAAK;EAGxB,IAAI,SAAS,MAAM;CACrB;CAEA,MAAM,iBAAiB,UAA+B;EACpD,IAAI,MAAM,YAAY,SAAS,cAAc;GAC3C,MAAM,gBAAgB;GACtB,MAAM,eAAe;GAErB,IAAI,YAAY,aAAa;IAC3B,MAAM,OAAOA,8BAAAA,oBAAoB,MAAM,eAA8B,kBAAkB;IACvF,MAAM,QAAQ,OACV,MAAM,KAAK,KAAK,iBAA8B,iBAAiB,CAAC,CAAC,CAAC,QAC/D,aAAa,SAAS,MAAM,YAAY,MAC3C,IACA,CAAC;IACL,MAAM,QAAQ,MAAM,QAAQ,MAAM,aAA4B;IAC9D,IAAI,UAAU,IACZ,MAAM,QAAQ,EAAE,EAAE,MAAM;GAE5B,OAAO,IAAI,aACT,KAAK,OAAO,KAAK,KAAK;EAE1B;EAEA,IAAI,MAAM,YAAY,SAAS,aAAa;GAC1C,MAAM,gBAAgB;GACtB,MAAM,eAAe;GAErB,IAAI,YAAY,aAC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WAAW,KAAA;EACxC,cAAY,KAAK;EACjB,iBAAe,YAAY,KAAA;EAC3B,cAAY;EACF;EACV,WAAW;YAhBb,CAkBG,WAAW,KAAK,OAAO,QAAQ;GAC9B,IAAI,UAAU,QACZ,OAAO;GAET,MAAM,SAAS,MAAM;GACrB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAEE,eAAA;IACA,WAAW,GAAGA,oBAAAA,QAAQ,WAAW,UAAU,YAAY,IAAIA,oBAAAA,QAAQ,oBAAoB;IACvF,OAAO,EAAE,sBAAsB,OAAO;GACvC,GAJM,MAIN;EAEL,CAAC,GACA,OAAO,eAAe,aACrB,WAAW;GACT;GACA;GACA;GACA,QAAQ,UAAU;GAClB;GACA;GACA;GACA;GACA;GACA;GACA,iBAAiB,KAAA;EACnB,CAAC,IAED,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,GAAI;aAAe,KAAK;EAAW,CAAA,CAEvC;;AAET,CAAC;AAED,aAAa,cAAc"}
1
+ {"version":3,"file":"FlatTreeNode.cjs","names":["findElementAncestor","classes"],"sources":["../../../src/components/Tree/FlatTreeNode.tsx"],"sourcesContent":["import { memo, useRef } from 'react';\nimport { findElementAncestor } from '../../core';\nimport type { FlatTreeLineState } from './flatten-tree-data/flatten-tree-data';\nimport type { RenderNode, TreeNodeData } from './Tree';\nimport type { TreeController } from './use-tree';\nimport classes from './Tree.module.css';\n\nexport interface FlatTreeNodeProps {\n /** Node data from tree data */\n node: TreeNodeData;\n\n /** Nesting level of the node, starts at 1 */\n level: number;\n\n /** Value of the parent node, `null` for root nodes */\n parent: string | null;\n\n /** Whether the node has children */\n hasChildren: boolean;\n\n /** Whether the node is expanded */\n expanded: boolean;\n\n /** Tree controller instance, return value of `useTree` hook */\n tree: TreeController;\n\n /** If set, tree node with children is expanded on click @default true */\n expandOnClick?: boolean;\n\n /** If set, tree node is selected on click @default false */\n selectOnClick?: boolean;\n\n /** If set, tree node with children is expanded on space key press @default true */\n expandOnSpace?: boolean;\n\n /** If set, tree node is checked on space key press @default false */\n checkOnSpace?: boolean;\n\n /** A function to render tree node label */\n renderNode?: RenderNode;\n\n /** Style to apply to the root element, used for virtualizer positioning */\n style?: React.CSSProperties;\n\n /** Tab index for the node */\n tabIndex?: number;\n\n /** Line state per ancestor + own level, computed by `flattenTreeData`.\n * When provided and the tree root has `data-with-lines`, connector lines are rendered. */\n linesPath?: FlatTreeLineState[];\n}\n\nexport const FlatTreeNode = memo(function FlatTreeNode({\n node,\n level,\n parent,\n hasChildren,\n expanded,\n tree,\n expandOnClick = true,\n selectOnClick,\n expandOnSpace = true,\n checkOnSpace,\n renderNode,\n style,\n tabIndex = -1,\n linesPath,\n}: FlatTreeNodeProps) {\n const ref = useRef<HTMLDivElement>(null);\n const isLoading = tree.isNodeLoading(node.value);\n const loadError = tree.getNodeLoadError(node.value);\n const selected = tree.selectedState.includes(node.value);\n\n const handleClick = (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (expandOnClick && hasChildren) {\n tree.toggleExpanded(node.value);\n }\n\n if (selectOnClick) {\n tree.select(node.value);\n }\n\n ref.current?.focus();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.nativeEvent.code === 'ArrowRight') {\n event.stopPropagation();\n event.preventDefault();\n\n if (expanded && hasChildren) {\n const root = findElementAncestor(event.currentTarget as HTMLElement, '[data-tree-root]');\n const nodes = root\n ? Array.from(root.querySelectorAll<HTMLElement>('[role=treeitem]')).filter(\n (treeNode) => treeNode.style.display !== 'none'\n )\n : [];\n const index = nodes.indexOf(event.currentTarget as HTMLElement);\n if (index !== -1) {\n const nextNode = nodes[index + 1];\n nextNode?.setAttribute('data-focus-ring', 'true');\n nextNode?.focus();\n }\n } else if (hasChildren) {\n tree.expand(node.value);\n }\n }\n\n if (event.nativeEvent.code === 'ArrowLeft') {\n event.stopPropagation();\n event.preventDefault();\n\n if (expanded && hasChildren) {\n tree.collapse(node.value);\n } else if (parent) {\n const root = findElementAncestor(event.currentTarget as HTMLElement, '[data-tree-root]');\n const parentElement = root?.querySelector<HTMLElement>(\n `[role=treeitem][data-value=\"${CSS.escape(parent)}\"]`\n );\n parentElement?.setAttribute('data-focus-ring', 'true');\n parentElement?.focus();\n }\n }\n\n if (event.nativeEvent.code === 'ArrowDown' || event.nativeEvent.code === 'ArrowUp') {\n const root = findElementAncestor(event.currentTarget as HTMLElement, '[data-tree-root]');\n\n if (!root) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n const nodes = Array.from(root.querySelectorAll<HTMLElement>('[role=treeitem]')).filter(\n (treeNode) => treeNode.style.display !== 'none'\n );\n const index = nodes.indexOf(event.currentTarget as HTMLElement);\n\n if (index === -1) {\n return;\n }\n\n const nextIndex = event.nativeEvent.code === 'ArrowDown' ? index + 1 : index - 1;\n const nextNode = nodes[nextIndex];\n nextNode?.setAttribute('data-focus-ring', 'true');\n nextNode?.focus();\n }\n\n if (event.nativeEvent.code === 'Space') {\n if (expandOnSpace) {\n event.stopPropagation();\n event.preventDefault();\n tree.toggleExpanded(node.value);\n }\n\n if (checkOnSpace) {\n event.stopPropagation();\n event.preventDefault();\n if (tree.isNodeChecked(node.value)) {\n tree.uncheckNode(node.value);\n } else {\n tree.checkNode(node.value);\n }\n }\n }\n };\n\n const elementProps = {\n className: classes.label,\n style: {} as React.CSSProperties,\n onClick: handleClick,\n 'data-selected': selected || undefined,\n 'data-value': node.value,\n };\n\n return (\n <div\n ref={ref}\n className={classes.node}\n style={{\n ...({\n '--label-offset': `calc(var(--level-offset, var(--mantine-spacing-lg)) * ${level - 1})`,\n } as React.CSSProperties),\n ...style,\n }}\n role=\"treeitem\"\n aria-selected={selected}\n aria-expanded={hasChildren ? expanded : undefined}\n data-value={node.value}\n data-selected={selected || undefined}\n data-level={level}\n tabIndex={tabIndex}\n onKeyDown={handleKeyDown}\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as HTMLElement)) {\n event.currentTarget.removeAttribute('data-focus-ring');\n }\n }}\n >\n {linesPath?.map((state, idx) => {\n if (state === 'none') {\n return null;\n }\n const column = idx + 2;\n return (\n <span\n key={column}\n aria-hidden\n className={`${classes.flatLine}${state === 'closing' ? ` ${classes.flatLineClosing}` : ''}`}\n style={{ '--flat-line-column': column } as React.CSSProperties}\n />\n );\n })}\n {typeof renderNode === 'function' ? (\n renderNode({\n node,\n level,\n selected,\n isRoot: level === 1,\n tree,\n expanded,\n hasChildren,\n isLoading,\n loadError,\n elementProps,\n dragHandleProps: undefined,\n })\n ) : (\n <div {...elementProps}>{node.label}</div>\n )}\n </div>\n );\n});\n\nFlatTreeNode.displayName = '@mantine/core/FlatTreeNode';\n"],"mappings":";;;;;;AAoDA,MAAa,gBAAA,GAAA,MAAA,KAAA,CAAoB,SAAS,aAAa,EACrD,MACA,OACA,QACA,aACA,UACA,MACA,gBAAgB,MAChB,eACA,gBAAgB,MAChB,cACA,YACA,OACA,WAAW,IACX,aACoB;CACpB,MAAM,OAAA,GAAA,MAAA,OAAA,CAA6B,IAAI;CACvC,MAAM,YAAY,KAAK,cAAc,KAAK,KAAK;CAC/C,MAAM,YAAY,KAAK,iBAAiB,KAAK,KAAK;CAClD,MAAM,WAAW,KAAK,cAAc,SAAS,KAAK,KAAK;CAEvD,MAAM,eAAe,UAA4B;EAC/C,MAAM,gBAAgB;EAEtB,IAAI,iBAAiB,aACnB,KAAK,eAAe,KAAK,KAAK;EAGhC,IAAI,eACF,KAAK,OAAO,KAAK,KAAK;EAGxB,IAAI,SAAS,MAAM;CACrB;CAEA,MAAM,iBAAiB,UAA+B;EACpD,IAAI,MAAM,YAAY,SAAS,cAAc;GAC3C,MAAM,gBAAgB;GACtB,MAAM,eAAe;GAErB,IAAI,YAAY,aAAa;IAC3B,MAAM,OAAOA,8BAAAA,oBAAoB,MAAM,eAA8B,kBAAkB;IACvF,MAAM,QAAQ,OACV,MAAM,KAAK,KAAK,iBAA8B,iBAAiB,CAAC,CAAC,CAAC,QAC/D,aAAa,SAAS,MAAM,Y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