@clickhouse/click-ui 0.15.0-canary.gfae77ae0.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/click-ui.css +17 -0
- package/dist/cjs/components/Dropdown/Dropdown.css +1 -0
- package/dist/cjs/components/Dropdown/index.cjs +25 -27
- package/dist/cjs/components/Dropdown/index.cjs.map +1 -1
- package/dist/cjs/components/Table/Table.css +16 -0
- package/dist/cjs/components/Table/index.cjs +78 -47
- package/dist/cjs/components/Table/index.cjs.map +1 -1
- package/dist/cjs/components/Tooltip/index.cjs +14 -3
- package/dist/cjs/components/Tooltip/index.cjs.map +1 -1
- package/dist/esm/click-ui.css +17 -0
- package/dist/esm/components/Dropdown/Dropdown.css +1 -0
- package/dist/esm/components/Dropdown/index.js +25 -27
- package/dist/esm/components/Dropdown/index.js.map +1 -1
- package/dist/esm/components/Table/Table.css +16 -0
- package/dist/esm/components/Table/index.js +78 -47
- package/dist/esm/components/Table/index.js.map +1 -1
- package/dist/esm/components/Tooltip/index.js +14 -3
- package/dist/esm/components/Tooltip/index.js.map +1 -1
- package/dist/types/components/Dropdown/Dropdown.d.ts +1 -4
- package/dist/types/components/Table/Table.d.ts +1 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -4
- package/package.json +1 -1
package/dist/cjs/click-ui.css
CHANGED
|
@@ -1342,6 +1342,7 @@
|
|
|
1342
1342
|
display: flex;
|
|
1343
1343
|
position: relative;
|
|
1344
1344
|
min-height: 32px;
|
|
1345
|
+
flex-shrink: 0;
|
|
1345
1346
|
}
|
|
1346
1347
|
|
|
1347
1348
|
.dropdown-trigger__FUHvM {
|
|
@@ -10590,7 +10591,23 @@ body {
|
|
|
10590
10591
|
}
|
|
10591
10592
|
|
|
10592
10593
|
.table__header-content_interactive__7lV67 {
|
|
10594
|
+
width: 100%;
|
|
10595
|
+
margin: 0;
|
|
10596
|
+
padding: 0;
|
|
10597
|
+
border: 0;
|
|
10598
|
+
background: none;
|
|
10599
|
+
color: inherit;
|
|
10600
|
+
font: inherit;
|
|
10601
|
+
letter-spacing: inherit;
|
|
10602
|
+
text-align: inherit;
|
|
10603
|
+
text-transform: inherit;
|
|
10593
10604
|
cursor: pointer;
|
|
10605
|
+
word-spacing: inherit;
|
|
10606
|
+
}
|
|
10607
|
+
|
|
10608
|
+
.table__header-content_interactive__7lV67:focus-visible {
|
|
10609
|
+
outline: 2px solid var(--click-global-color-outline-default);
|
|
10610
|
+
outline-offset: 2px;
|
|
10594
10611
|
}
|
|
10595
10612
|
|
|
10596
10613
|
.table__resizer__m6w0b {
|
|
@@ -36,6 +36,7 @@ function _interopNamespace(e) {
|
|
|
36
36
|
|
|
37
37
|
const DropdownMenu__namespace = /*#__PURE__*/_interopNamespace(DropdownMenu);
|
|
38
38
|
|
|
39
|
+
const COLLISION_PADDING = 8;
|
|
39
40
|
const Dropdown = (props) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Root, { ...props });
|
|
40
41
|
const _DropdownMenuItem = ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
41
42
|
GenericMenu.GenericMenuItem,
|
|
@@ -116,7 +117,7 @@ const DropdownContent = ({
|
|
|
116
117
|
sideOffset: 4,
|
|
117
118
|
loop: true,
|
|
118
119
|
avoidCollisions: responsivePositioning,
|
|
119
|
-
collisionPadding: responsivePositioning ?
|
|
120
|
+
collisionPadding: responsivePositioning ? COLLISION_PADDING : void 0,
|
|
120
121
|
...inputModalityProps,
|
|
121
122
|
children: [
|
|
122
123
|
showArrow && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -152,32 +153,29 @@ const DropdownSub = (props) => {
|
|
|
152
153
|
};
|
|
153
154
|
DropdownSub.displayName = "DropdownSub";
|
|
154
155
|
Dropdown.Sub = DropdownSub;
|
|
155
|
-
const DropdownItem = (
|
|
156
|
-
icon,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
};
|
|
156
|
+
const DropdownItem = react.forwardRef(
|
|
157
|
+
({ icon, iconDir, type = "default", tooltipProps, ...props }, ref) => {
|
|
158
|
+
const renderLabel = (label) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
159
|
+
IconWrapper.IconWrapper,
|
|
160
|
+
{
|
|
161
|
+
icon,
|
|
162
|
+
iconDir,
|
|
163
|
+
tooltipProps: { side: "right", ...tooltipProps },
|
|
164
|
+
children: label
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
168
|
+
DropdownMenuItem,
|
|
169
|
+
{
|
|
170
|
+
ref,
|
|
171
|
+
as: DropdownMenu__namespace.Item,
|
|
172
|
+
type,
|
|
173
|
+
...props,
|
|
174
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slottable, { child: props.children, children: renderLabel })
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
181
179
|
DropdownItem.displayName = "DropdownItem";
|
|
182
180
|
Dropdown.Item = DropdownItem;
|
|
183
181
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import * as DropdownMenu from '@radix-ui/react-dropdown-menu';\nimport { Slottable } from '@radix-ui/react-slot';\nimport {\n ComponentProps,\n ComponentPropsWithRef,\n ElementType,\n ReactNode,\n forwardRef,\n} from 'react';\nimport { Arrow, GenericMenuItem, GenericMenuPanel } from '@/components/GenericMenu';\nimport { cn } from '@/lib/cva';\nimport { useInputModality } from '@/hooks/internal';\nimport Popover_Arrow from '@/components/Assets/Icons/Popover-Arrow';\nimport { IconWrapper } from '@/components/IconWrapper';\nimport type { IconWrapperProps } from '@/components/IconWrapper';\nimport { Icon } from '@/components/Icon';\nimport type { IconName } from '@/components/Icon';\nimport type { HorizontalDirection } from '@/types';\nimport { useResolvedPortalContainer } from '@/providers/PortalContext';\nimport type { ArrowProps, DropdownItemProps } from './Dropdown.types';\nimport styles from './Dropdown.module.css';\n\nexport const Dropdown = (props: DropdownMenu.DropdownMenuProps) => (\n <DropdownMenu.Root {...props} />\n);\n\ntype DropdownMenuItemComponent = <T extends ElementType = 'div'>(\n props: ComponentProps<typeof GenericMenuItem<T>>\n) => ReactNode;\n\nconst _DropdownMenuItem = <T extends ElementType = 'div'>(\n { className, ...props }: ComponentProps<typeof GenericMenuItem<T>>,\n ref: ComponentPropsWithRef<T>['ref']\n) => (\n <GenericMenuItem\n ref={ref}\n {...(props as ComponentProps<typeof GenericMenuItem>)}\n className={cn(styles['dropdown-menu-item'], className)}\n />\n);\n\nconst DropdownMenuItem: DropdownMenuItemComponent = forwardRef(_DropdownMenuItem);\n\n// `sub` alone discriminates the two shapes of Trigger and Content. The label\n// fields live separately so only the sub-trigger accepts them — Content spreads\n// what it does not read straight onto the Radix element, i.e. into the DOM.\ninterface SubDiscriminant {\n sub?: true;\n}\n\ninterface SubTriggerFields {\n icon?: IconName;\n iconDir?: HorizontalDirection;\n /**\n * Positions the tooltip shown when the label is truncated. Defaults to\n * `side: 'right'` so the tooltip does not cover the items above it.\n */\n tooltipProps?: IconWrapperProps['tooltipProps'];\n}\n\ninterface MainDropdownProps {\n sub?: never;\n}\n\ntype DropdownSubTriggerProps = DropdownMenu.DropdownMenuSubTriggerProps &\n SubDiscriminant &\n SubTriggerFields;\ntype DropdownTriggerProps = DropdownMenu.DropdownMenuTriggerProps & MainDropdownProps;\n\nconst DropdownTrigger = ({\n sub,\n children,\n ...props\n}: DropdownSubTriggerProps | DropdownTriggerProps) => {\n if (sub) {\n const { icon, iconDir, tooltipProps, ...menuProps } =\n props as DropdownSubTriggerProps;\n return (\n <DropdownMenuItem\n as={DropdownMenu.SubTrigger}\n {...menuProps}\n >\n <IconWrapper\n icon={icon}\n iconDir={iconDir}\n tooltipProps={{ side: 'right', ...tooltipProps }}\n >\n {children}\n </IconWrapper>\n <Icon name=\"chevron-right\" />\n </DropdownMenuItem>\n );\n }\n\n const { className, ...triggerProps } = props as DropdownTriggerProps;\n return (\n <DropdownMenu.Trigger\n asChild\n {...triggerProps}\n className={cn(styles['dropdown-trigger'], className)}\n >\n <div>{children}</div>\n </DropdownMenu.Trigger>\n );\n};\n\nDropdownTrigger.displayName = 'DropdownTrigger';\nDropdown.Trigger = DropdownTrigger;\n\ninterface StyledDropdownContentProps extends DropdownMenu.DropdownMenuContentProps {\n children?: ReactNode;\n container?: HTMLElement | null;\n responsivePositioning?: boolean;\n}\n\ninterface StyledDropdownSubContentProps extends DropdownMenu.DropdownMenuSubContentProps {\n children?: ReactNode;\n container?: HTMLElement | null;\n responsivePositioning?: boolean;\n}\n\ntype DropdownContentProps = StyledDropdownContentProps & SubDiscriminant & ArrowProps;\ntype DropdownSubContentProps = StyledDropdownSubContentProps &\n MainDropdownProps &\n ArrowProps;\n\ntype DropdownMenuContentComponent = <T extends ElementType = 'div'>(\n props: ComponentProps<typeof GenericMenuPanel<T>>\n) => ReactNode;\n\nconst _DropdownMenuContent = <T extends ElementType = 'div'>(\n { className, ...props }: ComponentProps<typeof GenericMenuPanel<T>>,\n ref: ComponentPropsWithRef<T>['ref']\n) => (\n <GenericMenuPanel\n ref={ref}\n {...(props as ComponentProps<typeof GenericMenuPanel>)}\n className={cn(styles['dropdown-menu-content'], className)}\n />\n);\n\nconst DropdownMenuContent: DropdownMenuContentComponent =\n forwardRef(_DropdownMenuContent);\n\nconst DropdownContent = ({\n sub,\n children,\n container,\n showArrow,\n responsivePositioning = true,\n ...props\n}: DropdownContentProps | DropdownSubContentProps) => {\n const ContentElement = sub ? DropdownMenu.SubContent : DropdownMenu.Content;\n const inputModalityProps = useInputModality();\n const portalContainer = useResolvedPortalContainer(container);\n\n return (\n <DropdownMenu.Portal container={portalContainer}>\n <DropdownMenuContent\n {...props}\n type=\"dropdown-menu\"\n showArrow={showArrow}\n as={ContentElement}\n sideOffset={4}\n loop\n avoidCollisions={responsivePositioning}\n collisionPadding={responsivePositioning ? 100 : undefined}\n {...inputModalityProps}\n >\n {showArrow && (\n <Arrow\n asChild\n as={DropdownMenu.Arrow}\n width={20}\n height={10}\n >\n <Popover_Arrow />\n </Arrow>\n )}\n {children}\n </DropdownMenuContent>\n </DropdownMenu.Portal>\n );\n};\n\nDropdownContent.displayName = 'DropdownContent';\nDropdown.Content = DropdownContent;\n\nconst DropdownGroup = ({ className, ...props }: DropdownMenu.DropdownMenuGroupProps) => {\n return (\n <DropdownMenu.Group\n {...props}\n className={cn(styles['dropdown-group'], className)}\n />\n );\n};\n\nDropdownGroup.displayName = 'DropdownGroup';\nDropdown.Group = DropdownGroup;\n\n// DropdownMenu.Sub renders no DOM node, so it takes only Radix's sub-menu props.\nconst DropdownSub = (props: DropdownMenu.DropdownMenuSubProps) => {\n return <DropdownMenu.Sub {...props} />;\n};\n\nDropdownSub.displayName = 'DropdownSub';\nDropdown.Sub = DropdownSub;\n\nconst DropdownItem = ({\n icon,\n iconDir,\n type = 'default',\n tooltipProps,\n ...props\n}: DropdownItemProps) => {\n const renderLabel = (label: ReactNode) => (\n <IconWrapper\n icon={icon}\n iconDir={iconDir}\n tooltipProps={{ side: 'right', ...tooltipProps }}\n >\n {label}\n </IconWrapper>\n );\n\n return (\n <DropdownMenuItem\n as={DropdownMenu.Item}\n type={type}\n {...props}\n >\n <Slottable child={props.children}>{renderLabel}</Slottable>\n </DropdownMenuItem>\n );\n};\n\nDropdownItem.displayName = 'DropdownItem';\nDropdown.Item = DropdownItem;\n\nexport default Dropdown;\n"],"names":["jsx","DropdownMenu","GenericMenuItem","cn","styles","forwardRef","jsxs","IconWrapper","Icon","GenericMenuPanel","useInputModality","useResolvedPortalContainer","Arrow","Popover_Arrow","Slottable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,MAAM,QAAA,GAAW,CAAC,KAAA,qBACvBA,cAAA,CAACC,wBAAa,IAAA,EAAb,EAAmB,GAAG,KAAA,EAAO;AAOhC,MAAM,oBAAoB,CACxB,EAAE,WAAW,GAAG,KAAA,IAChB,GAAA,qBAEAD,cAAA;AAAA,EAACE,2BAAA;AAAA,EAAA;AAAA,IACC,GAAA;AAAA,IACC,GAAI,KAAA;AAAA,IACL,SAAA,EAAWC,MAAA,CAAGC,uBAAA,CAAO,oBAAoB,GAAG,SAAS;AAAA;AACvD,CAAA;AAGF,MAAM,gBAAA,GAA8CC,iBAAW,iBAAiB,CAAA;AA4BhF,MAAM,kBAAkB,CAAC;AAAA,EACvB,GAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAsD;AACpD,EAAA,IAAI,GAAA,EAAK;AACP,IAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,YAAA,EAAc,GAAG,WAAU,GAChD,KAAA;AACF,IAAA,uBACEC,eAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,IAAIL,uBAAA,CAAa,UAAA;AAAA,QAChB,GAAG,SAAA;AAAA,QAEJ,QAAA,EAAA;AAAA,0BAAAD,cAAA;AAAA,YAACO,uBAAA;AAAA,YAAA;AAAA,cACC,IAAA;AAAA,cACA,OAAA;AAAA,cACA,YAAA,EAAc,EAAE,IAAA,EAAM,OAAA,EAAS,GAAG,YAAA,EAAa;AAAA,cAE9C;AAAA;AAAA,WACH;AAAA,0BACAP,cAAA,CAACQ,SAAA,EAAA,EAAK,IAAA,EAAK,eAAA,EAAgB;AAAA;AAAA;AAAA,KAC7B;AAAA,EAEJ;AAEA,EAAA,MAAM,EAAE,SAAA,EAAW,GAAG,YAAA,EAAa,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A;AAAA,EACP,YAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAyB;AACvB,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,qBACnBD,cAAA;AAAA,IAACO,uBAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,OAAA;AAAA,MACA,YAAA,EAAc,EAAE,IAAA,EAAM,OAAA,EAAS,GAAG,YAAA,EAAa;AAAA,MAE9C,QAAA,EAAA;AAAA;AAAA,GACH;AAGF,EAAA,uBACEP,cAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,IAAIC,uBAAA,CAAa,IAAA;AAAA,MACjB,IAAA;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAAD,cAAA,CAACc,mBAAA,EAAA,EAAU,KAAA,EAAO,KAAA,CAAM,UAAW,QAAA,EAAA,WAAA,EAAY;AAAA;AAAA,GACjD;AAEJ,CAAA;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;AAC3B,QAAA,CAAS,IAAA,GAAO,YAAA;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import * as DropdownMenu from '@radix-ui/react-dropdown-menu';\nimport { Slottable } from '@radix-ui/react-slot';\nimport {\n ComponentProps,\n ComponentPropsWithRef,\n ElementType,\n ForwardedRef,\n ReactNode,\n forwardRef,\n} from 'react';\nimport { Arrow, GenericMenuItem, GenericMenuPanel } from '@/components/GenericMenu';\nimport { cn } from '@/lib/cva';\nimport { useInputModality } from '@/hooks/internal';\nimport Popover_Arrow from '@/components/Assets/Icons/Popover-Arrow';\nimport { IconWrapper } from '@/components/IconWrapper';\nimport type { IconWrapperProps } from '@/components/IconWrapper';\nimport { Icon } from '@/components/Icon';\nimport type { IconName } from '@/components/Icon';\nimport type { HorizontalDirection } from '@/types';\nimport { useResolvedPortalContainer } from '@/providers/PortalContext';\nimport type { ArrowProps, DropdownItemProps } from './Dropdown.types';\nimport styles from './Dropdown.module.css';\n\n// Radix takes the padding as a number of pixels, so it cannot come from a CSS token.\nconst COLLISION_PADDING = 8;\n\nexport const Dropdown = (props: DropdownMenu.DropdownMenuProps) => (\n <DropdownMenu.Root {...props} />\n);\n\ntype DropdownMenuItemComponent = <T extends ElementType = 'div'>(\n props: ComponentProps<typeof GenericMenuItem<T>>\n) => ReactNode;\n\nconst _DropdownMenuItem = <T extends ElementType = 'div'>(\n { className, ...props }: ComponentProps<typeof GenericMenuItem<T>>,\n ref: ComponentPropsWithRef<T>['ref']\n) => (\n <GenericMenuItem\n ref={ref}\n {...(props as ComponentProps<typeof GenericMenuItem>)}\n className={cn(styles['dropdown-menu-item'], className)}\n />\n);\n\nconst DropdownMenuItem: DropdownMenuItemComponent = forwardRef(_DropdownMenuItem);\n\n// `sub` alone discriminates the two shapes of Trigger and Content. The label\n// fields live separately so only the sub-trigger accepts them — Content spreads\n// what it does not read straight onto the Radix element, i.e. into the DOM.\ninterface SubDiscriminant {\n sub?: true;\n}\n\ninterface SubTriggerFields {\n icon?: IconName;\n iconDir?: HorizontalDirection;\n /**\n * Positions the tooltip shown when the label is truncated. Defaults to\n * `side: 'right'` so the tooltip does not cover the items above it.\n */\n tooltipProps?: IconWrapperProps['tooltipProps'];\n}\n\ninterface MainDropdownProps {\n sub?: never;\n}\n\ntype DropdownSubTriggerProps = DropdownMenu.DropdownMenuSubTriggerProps &\n SubDiscriminant &\n SubTriggerFields;\ntype DropdownTriggerProps = DropdownMenu.DropdownMenuTriggerProps & MainDropdownProps;\n\nconst DropdownTrigger = ({\n sub,\n children,\n ...props\n}: DropdownSubTriggerProps | DropdownTriggerProps) => {\n if (sub) {\n const { icon, iconDir, tooltipProps, ...menuProps } =\n props as DropdownSubTriggerProps;\n return (\n <DropdownMenuItem\n as={DropdownMenu.SubTrigger}\n {...menuProps}\n >\n <IconWrapper\n icon={icon}\n iconDir={iconDir}\n tooltipProps={{ side: 'right', ...tooltipProps }}\n >\n {children}\n </IconWrapper>\n <Icon name=\"chevron-right\" />\n </DropdownMenuItem>\n );\n }\n\n const { className, ...triggerProps } = props as DropdownTriggerProps;\n return (\n <DropdownMenu.Trigger\n asChild\n {...triggerProps}\n className={cn(styles['dropdown-trigger'], className)}\n >\n <div>{children}</div>\n </DropdownMenu.Trigger>\n );\n};\n\nDropdownTrigger.displayName = 'DropdownTrigger';\nDropdown.Trigger = DropdownTrigger;\n\ninterface StyledDropdownContentProps extends DropdownMenu.DropdownMenuContentProps {\n children?: ReactNode;\n container?: HTMLElement | null;\n responsivePositioning?: boolean;\n}\n\ninterface StyledDropdownSubContentProps extends DropdownMenu.DropdownMenuSubContentProps {\n children?: ReactNode;\n container?: HTMLElement | null;\n responsivePositioning?: boolean;\n}\n\ntype DropdownContentProps = StyledDropdownContentProps & SubDiscriminant & ArrowProps;\ntype DropdownSubContentProps = StyledDropdownSubContentProps &\n MainDropdownProps &\n ArrowProps;\n\ntype DropdownMenuContentComponent = <T extends ElementType = 'div'>(\n props: ComponentProps<typeof GenericMenuPanel<T>>\n) => ReactNode;\n\nconst _DropdownMenuContent = <T extends ElementType = 'div'>(\n { className, ...props }: ComponentProps<typeof GenericMenuPanel<T>>,\n ref: ComponentPropsWithRef<T>['ref']\n) => (\n <GenericMenuPanel\n ref={ref}\n {...(props as ComponentProps<typeof GenericMenuPanel>)}\n className={cn(styles['dropdown-menu-content'], className)}\n />\n);\n\nconst DropdownMenuContent: DropdownMenuContentComponent =\n forwardRef(_DropdownMenuContent);\n\nconst DropdownContent = ({\n sub,\n children,\n container,\n showArrow,\n responsivePositioning = true,\n ...props\n}: DropdownContentProps | DropdownSubContentProps) => {\n const ContentElement = sub ? DropdownMenu.SubContent : DropdownMenu.Content;\n const inputModalityProps = useInputModality();\n const portalContainer = useResolvedPortalContainer(container);\n\n return (\n <DropdownMenu.Portal container={portalContainer}>\n <DropdownMenuContent\n {...props}\n type=\"dropdown-menu\"\n showArrow={showArrow}\n as={ContentElement}\n sideOffset={4}\n loop\n avoidCollisions={responsivePositioning}\n collisionPadding={responsivePositioning ? COLLISION_PADDING : undefined}\n {...inputModalityProps}\n >\n {showArrow && (\n <Arrow\n asChild\n as={DropdownMenu.Arrow}\n width={20}\n height={10}\n >\n <Popover_Arrow />\n </Arrow>\n )}\n {children}\n </DropdownMenuContent>\n </DropdownMenu.Portal>\n );\n};\n\nDropdownContent.displayName = 'DropdownContent';\nDropdown.Content = DropdownContent;\n\nconst DropdownGroup = ({ className, ...props }: DropdownMenu.DropdownMenuGroupProps) => {\n return (\n <DropdownMenu.Group\n {...props}\n className={cn(styles['dropdown-group'], className)}\n />\n );\n};\n\nDropdownGroup.displayName = 'DropdownGroup';\nDropdown.Group = DropdownGroup;\n\n// DropdownMenu.Sub renders no DOM node, so it takes only Radix's sub-menu props.\nconst DropdownSub = (props: DropdownMenu.DropdownMenuSubProps) => {\n return <DropdownMenu.Sub {...props} />;\n};\n\nDropdownSub.displayName = 'DropdownSub';\nDropdown.Sub = DropdownSub;\n\nconst DropdownItem = forwardRef<HTMLElement, DropdownItemProps>(\n ({ icon, iconDir, type = 'default', tooltipProps, ...props }, ref) => {\n const renderLabel = (label: ReactNode) => (\n <IconWrapper\n icon={icon}\n iconDir={iconDir}\n tooltipProps={{ side: 'right', ...tooltipProps }}\n >\n {label}\n </IconWrapper>\n );\n\n return (\n <DropdownMenuItem\n ref={ref as ForwardedRef<HTMLDivElement>}\n as={DropdownMenu.Item}\n type={type}\n {...props}\n >\n <Slottable child={props.children}>{renderLabel}</Slottable>\n </DropdownMenuItem>\n );\n }\n);\n\nDropdownItem.displayName = 'DropdownItem';\nDropdown.Item = DropdownItem;\n\nexport default Dropdown;\n"],"names":["jsx","DropdownMenu","GenericMenuItem","cn","styles","forwardRef","jsxs","IconWrapper","Icon","GenericMenuPanel","useInputModality","useResolvedPortalContainer","Arrow","Popover_Arrow","Slottable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,iBAAA,GAAoB,CAAA;AAEnB,M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AAA;AAAA,QACC,IAAA;AAAA,QACA,OAAA;AAAA,QACA,YAAA,EAAc,EAAE,IAAA,EAAM,OAAA,EAAS,GAAG,YAAA,EAAa;AAAA,QAE9C,QAAA,EAAA;AAAA;AAAA,KACH;AAGF,IAAA,uBACEP,cAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,IAAIC,uBAAA,CAAa,IAAA;AAAA,QACjB,IAAA;AAAA,QACC,GAAG,KAAA;AAAA,QAEJ,QAAA,kBAAAD,cAAA,CAACc,mBAAA,EAAA,EAAU,KAAA,EAAO,KAAA,CAAM,UAAW,QAAA,EAAA,WAAA,EAAY;AAAA;AAAA,KACjD;AAAA,EAEJ;AACF,CAAA;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;AAC3B,QAAA,CAAS,IAAA,GAAO,YAAA;;"}
|
|
@@ -82,7 +82,23 @@
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
.table__header-content_interactive__7lV67 {
|
|
85
|
+
width: 100%;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0;
|
|
88
|
+
border: 0;
|
|
89
|
+
background: none;
|
|
90
|
+
color: inherit;
|
|
91
|
+
font: inherit;
|
|
92
|
+
letter-spacing: inherit;
|
|
93
|
+
text-align: inherit;
|
|
94
|
+
text-transform: inherit;
|
|
85
95
|
cursor: pointer;
|
|
96
|
+
word-spacing: inherit;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.table__header-content_interactive__7lV67:focus-visible {
|
|
100
|
+
outline: 2px solid var(--click-global-color-outline-default);
|
|
101
|
+
outline-offset: 2px;
|
|
86
102
|
}
|
|
87
103
|
|
|
88
104
|
.table__resizer__m6w0b {
|
|
@@ -15,6 +15,7 @@ const Text = require('../Text/index.cjs');
|
|
|
15
15
|
const EllipsisContent = require('../EllipsisContent/index.cjs');
|
|
16
16
|
const classVarianceAuthority = require('class-variance-authority');
|
|
17
17
|
|
|
18
|
+
const MIN_COLUMN_WIDTH = 120;
|
|
18
19
|
const headerVariants = classVarianceAuthority.cva(Table_module.default.table__header, {
|
|
19
20
|
variants: {
|
|
20
21
|
size: {
|
|
@@ -50,8 +51,12 @@ const TableHeader = ({
|
|
|
50
51
|
showResizer,
|
|
51
52
|
onResizeStart,
|
|
52
53
|
onKeyboardResize,
|
|
54
|
+
columnWidth,
|
|
55
|
+
nextColumnWidth,
|
|
53
56
|
overflowMode,
|
|
54
57
|
className,
|
|
58
|
+
"aria-label": ariaLabel,
|
|
59
|
+
"aria-labelledby": ariaLabelledBy,
|
|
55
60
|
...props
|
|
56
61
|
}) => {
|
|
57
62
|
if (overflowMode === "wrap" && resizable) {
|
|
@@ -91,42 +96,56 @@ const TableHeader = ({
|
|
|
91
96
|
break;
|
|
92
97
|
}
|
|
93
98
|
};
|
|
99
|
+
const ariaSort = isSorted && isSortable ? sortDir === "asc" ? "ascending" : "descending" : void 0;
|
|
100
|
+
const isMeasured = columnWidth !== void 0;
|
|
101
|
+
const maxColumnWidth = isMeasured && nextColumnWidth !== void 0 ? Math.round(columnWidth + nextColumnWidth - MIN_COLUMN_WIDTH) : void 0;
|
|
102
|
+
const headerContentClassName = cva.cn(
|
|
103
|
+
Table_module.default["table__header-content"],
|
|
104
|
+
isInteractive && Table_module.default["table__header-content_interactive"]
|
|
105
|
+
);
|
|
106
|
+
const headerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
107
|
+
isSorted && isSortable && sortPosition == "start" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
+
Icon.Icon,
|
|
109
|
+
{
|
|
110
|
+
name: "arrow-down",
|
|
111
|
+
size: "sm",
|
|
112
|
+
"aria-hidden": "true",
|
|
113
|
+
className: cva.cn(sortIconVariants({ dir: sortDir }))
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
label,
|
|
117
|
+
isSorted && isSortable && sortPosition == "end" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
Icon.Icon,
|
|
119
|
+
{
|
|
120
|
+
name: "arrow-down",
|
|
121
|
+
size: "sm",
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
className: cva.cn(sortIconVariants({ dir: sortDir }))
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] });
|
|
94
127
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
95
128
|
"th",
|
|
96
129
|
{
|
|
130
|
+
"aria-sort": ariaSort,
|
|
131
|
+
"aria-label": ariaLabel,
|
|
132
|
+
"aria-labelledby": ariaLabelledBy,
|
|
97
133
|
...props,
|
|
98
134
|
className: cva.cn(headerVariants({ size, resizable }), className),
|
|
99
135
|
children: [
|
|
100
|
-
/* @__PURE__ */ jsxRuntime.
|
|
101
|
-
"
|
|
136
|
+
isInteractive ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
137
|
+
"button",
|
|
102
138
|
{
|
|
139
|
+
type: "button",
|
|
103
140
|
onClick: onHeaderClick,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
children: [
|
|
109
|
-
isSorted && isSortable && sortPosition == "start" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
110
|
-
Icon.Icon,
|
|
111
|
-
{
|
|
112
|
-
name: "arrow-down",
|
|
113
|
-
size: "sm",
|
|
114
|
-
className: cva.cn(sortIconVariants({ dir: sortDir }))
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
label,
|
|
118
|
-
isSorted && isSortable && sortPosition == "end" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
-
Icon.Icon,
|
|
120
|
-
{
|
|
121
|
-
name: "arrow-down",
|
|
122
|
-
size: "sm",
|
|
123
|
-
className: cva.cn(sortIconVariants({ dir: sortDir }))
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
]
|
|
141
|
+
"aria-label": ariaLabel,
|
|
142
|
+
"aria-labelledby": ariaLabelledBy,
|
|
143
|
+
className: headerContentClassName,
|
|
144
|
+
children: headerContent
|
|
127
145
|
}
|
|
128
|
-
),
|
|
129
|
-
showResizer &&
|
|
146
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: headerContentClassName, children: headerContent }),
|
|
147
|
+
showResizer && // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a focusable separator is a widget (WAI-ARIA 1.2 window splitter); jsx-a11y models it as static
|
|
148
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
130
149
|
"div",
|
|
131
150
|
{
|
|
132
151
|
ref: resizerRef,
|
|
@@ -134,7 +153,11 @@ const TableHeader = ({
|
|
|
134
153
|
role: "separator",
|
|
135
154
|
"aria-orientation": "vertical",
|
|
136
155
|
"aria-label": `Resize ${typeof label === "string" ? label : "column"}`,
|
|
137
|
-
|
|
156
|
+
"aria-valuenow": isMeasured ? Math.round(columnWidth) : void 0,
|
|
157
|
+
"aria-valuemin": MIN_COLUMN_WIDTH,
|
|
158
|
+
"aria-valuemax": maxColumnWidth,
|
|
159
|
+
"aria-valuetext": isMeasured ? `${Math.round(columnWidth)} pixels` : void 0,
|
|
160
|
+
tabIndex: isMeasured ? 0 : void 0,
|
|
138
161
|
onKeyDown: onResizerKeyDown,
|
|
139
162
|
className: cva.cn(Table_module.default.table__resizer)
|
|
140
163
|
}
|
|
@@ -155,13 +178,14 @@ const Thead = ({
|
|
|
155
178
|
resizableColumns,
|
|
156
179
|
onResizeStart,
|
|
157
180
|
theadRef,
|
|
158
|
-
onKeyboardResize
|
|
181
|
+
onKeyboardResize,
|
|
182
|
+
columnWidths
|
|
159
183
|
}) => {
|
|
160
|
-
const onSort = (header, headerIndex) => () => {
|
|
161
|
-
if (
|
|
184
|
+
const onSort = typeof onSortProp === "function" ? (header, headerIndex) => () => {
|
|
185
|
+
if (header.isSortable) {
|
|
162
186
|
onSortProp(header.sortDir === "asc" ? "desc" : "asc", header, headerIndex);
|
|
163
187
|
}
|
|
164
|
-
};
|
|
188
|
+
} : void 0;
|
|
165
189
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
190
|
"thead",
|
|
167
191
|
{
|
|
@@ -183,19 +207,26 @@ const Thead = ({
|
|
|
183
207
|
)
|
|
184
208
|
}
|
|
185
209
|
),
|
|
186
|
-
headers.map((headerProps, index) =>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
210
|
+
headers.map((headerProps, index) => {
|
|
211
|
+
const headerLabel = typeof headerProps.label === "string" ? headerProps.label : `__index_${index}`;
|
|
212
|
+
const nextHeader = headers[index + 1];
|
|
213
|
+
const nextHeaderLabel = typeof nextHeader?.label === "string" ? nextHeader.label : `__index_${index + 1}`;
|
|
214
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
215
|
+
TableHeader,
|
|
216
|
+
{
|
|
217
|
+
onSort: onSort?.(headerProps, index),
|
|
218
|
+
size,
|
|
219
|
+
resizable: resizableColumns,
|
|
220
|
+
showResizer: resizableColumns && index < headers.length - 1,
|
|
221
|
+
onResizeStart: onResizeStart?.(index),
|
|
222
|
+
onKeyboardResize: onKeyboardResize?.(index),
|
|
223
|
+
columnWidth: columnWidths?.get(headerLabel),
|
|
224
|
+
nextColumnWidth: nextHeader ? columnWidths?.get(nextHeaderLabel) : void 0,
|
|
225
|
+
...headerProps
|
|
226
|
+
},
|
|
227
|
+
`table-header-${index}`
|
|
228
|
+
);
|
|
229
|
+
}),
|
|
199
230
|
actionsList.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
200
231
|
"th",
|
|
201
232
|
{
|
|
@@ -409,7 +440,6 @@ const CustomTableRow = ({
|
|
|
409
440
|
}
|
|
410
441
|
) });
|
|
411
442
|
};
|
|
412
|
-
const MIN_COLUMN_WIDTH = 120;
|
|
413
443
|
const Table = react.forwardRef(
|
|
414
444
|
({
|
|
415
445
|
headers,
|
|
@@ -649,7 +679,8 @@ const Table = react.forwardRef(
|
|
|
649
679
|
resizableColumns,
|
|
650
680
|
onResizeStart: resizableColumns ? handleResizeStart : void 0,
|
|
651
681
|
theadRef,
|
|
652
|
-
onKeyboardResize: resizableColumns ? onKeyboardResize : void 0
|
|
682
|
+
onKeyboardResize: resizableColumns ? onKeyboardResize : void 0,
|
|
683
|
+
columnWidths: resizableColumns ? columnWidths : void 0
|
|
653
684
|
}
|
|
654
685
|
),
|
|
655
686
|
/* @__PURE__ */ jsxRuntime.jsxs("tbody", { className: cva.cn(Table_module.default.table__tbody), children: [
|