@koobiq/react-components 0.24.0 → 0.26.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 (94) hide show
  1. package/dist/components/ActionsPanel/ActionPanel.module.css.js +17 -0
  2. package/dist/components/ActionsPanel/ActionsPanel.d.ts +11 -0
  3. package/dist/components/ActionsPanel/ActionsPanel.js +170 -0
  4. package/dist/components/ActionsPanel/ActionsPanelContext.d.ts +3 -0
  5. package/dist/components/ActionsPanel/ActionsPanelContext.js +6 -0
  6. package/dist/components/ActionsPanel/components/ActionsPanelAction/ActionsPanelAction.d.ts +2 -0
  7. package/dist/components/ActionsPanel/components/ActionsPanelAction/ActionsPanelAction.js +22 -0
  8. package/dist/components/ActionsPanel/components/ActionsPanelAction/ActionsPanelAction.module.css.js +8 -0
  9. package/dist/components/ActionsPanel/components/ActionsPanelAction/index.d.ts +2 -0
  10. package/dist/components/ActionsPanel/components/ActionsPanelAction/types.d.ts +5 -0
  11. package/dist/components/ActionsPanel/components/ActionsPanelClearButton/ActionsPanelClearButton.d.ts +5 -0
  12. package/dist/components/ActionsPanel/components/ActionsPanelClearButton/ActionsPanelClearButton.js +30 -0
  13. package/dist/components/ActionsPanel/components/ActionsPanelClearButton/ActionsPanelClearButton.module.css.js +8 -0
  14. package/dist/components/ActionsPanel/components/ActionsPanelClearButton/index.d.ts +1 -0
  15. package/dist/components/ActionsPanel/components/ActionsPanelContainer/ActionPanelContainer.module.css.js +11 -0
  16. package/dist/components/ActionsPanel/components/ActionsPanelContainer/ActionsPanelContainer.d.ts +2 -0
  17. package/dist/components/ActionsPanel/components/ActionsPanelContainer/ActionsPanelContainer.js +32 -0
  18. package/dist/components/ActionsPanel/components/ActionsPanelContainer/index.d.ts +2 -0
  19. package/dist/components/ActionsPanel/components/ActionsPanelContainer/types.d.ts +5 -0
  20. package/dist/components/ActionsPanel/components/ActionsPanelCounter/ActionsPanelCounter.d.ts +6 -0
  21. package/dist/components/ActionsPanel/components/ActionsPanelCounter/ActionsPanelCounter.js +44 -0
  22. package/dist/components/ActionsPanel/components/ActionsPanelCounter/ActionsPanelCounter.module.css.js +17 -0
  23. package/dist/components/ActionsPanel/components/ActionsPanelCounter/index.d.ts +1 -0
  24. package/dist/components/ActionsPanel/components/ActionsPanelDivider/ActionsPanelDivider.d.ts +3 -0
  25. package/dist/components/ActionsPanel/components/ActionsPanelDivider/ActionsPanelDivider.js +18 -0
  26. package/dist/components/ActionsPanel/components/ActionsPanelDivider/ActionsPanelDivider.module.css.js +8 -0
  27. package/dist/components/ActionsPanel/components/ActionsPanelDivider/index.d.ts +1 -0
  28. package/dist/components/ActionsPanel/components/ActionsPanelMoreAction/ActionsPanelMoreAction.d.ts +2 -0
  29. package/dist/components/ActionsPanel/components/ActionsPanelMoreAction/ActionsPanelMoreAction.js +72 -0
  30. package/dist/components/ActionsPanel/components/ActionsPanelMoreAction/ActionsPanelMoreAction.module.css.js +14 -0
  31. package/dist/components/ActionsPanel/components/ActionsPanelMoreAction/index.d.ts +2 -0
  32. package/dist/components/ActionsPanel/components/ActionsPanelMoreAction/types.d.ts +9 -0
  33. package/dist/components/ActionsPanel/components/index.d.ts +4 -0
  34. package/dist/components/ActionsPanel/hooks/index.d.ts +1 -0
  35. package/dist/components/ActionsPanel/hooks/useInlinePaddingSize.d.ts +6 -0
  36. package/dist/components/ActionsPanel/hooks/useInlinePaddingSize.js +17 -0
  37. package/dist/components/ActionsPanel/index.d.ts +5 -0
  38. package/dist/components/ActionsPanel/intl.json.js +7 -0
  39. package/dist/components/ActionsPanel/types.d.ts +47 -0
  40. package/dist/components/Breadcrumbs/components/BreadcrumbsCollapse/BreadcrumbsCollapse.js +9 -5
  41. package/dist/components/Breadcrumbs/intl.json.js +7 -0
  42. package/dist/components/Breadcrumbs/types.d.ts +2 -0
  43. package/dist/components/ContenPanel/ContentPanel.d.ts +3 -2
  44. package/dist/components/ContenPanel/ContentPanel.js +9 -9
  45. package/dist/components/Divider/Divider.d.ts +14 -4
  46. package/dist/components/Divider/Divider.js +23 -8
  47. package/dist/components/Divider/types.d.ts +4 -3
  48. package/dist/components/Navbar/components/NavbarItem.d.ts +4 -0
  49. package/dist/components/Navbar/components/NavbarItem.js +11 -1
  50. package/dist/components/SearchInput/SearchInput.d.ts +1 -1
  51. package/dist/components/Select/Select.d.ts +4 -0
  52. package/dist/components/SelectNext/Select.d.ts +13 -0
  53. package/dist/components/SelectNext/Select.js +258 -0
  54. package/dist/components/SelectNext/Select.module.css.js +23 -0
  55. package/dist/components/SelectNext/SelectContext.d.ts +2 -0
  56. package/dist/components/SelectNext/SelectContext.js +5 -0
  57. package/dist/components/SelectNext/components/SelectList/SelectList.d.ts +37 -0
  58. package/dist/components/SelectNext/components/SelectList/SelectList.js +131 -0
  59. package/dist/components/SelectNext/components/SelectList/SelectList.module.css.js +11 -0
  60. package/dist/components/SelectNext/components/SelectList/index.d.ts +1 -0
  61. package/dist/components/SelectNext/components/SelectOption/SelectOption.d.ts +37 -0
  62. package/dist/components/SelectNext/components/SelectOption/SelectOption.js +48 -0
  63. package/dist/components/SelectNext/components/SelectOption/index.d.ts +1 -0
  64. package/dist/components/SelectNext/components/SelectSection/SelectSection.d.ts +9 -0
  65. package/dist/components/SelectNext/components/SelectSection/SelectSection.js +51 -0
  66. package/dist/components/SelectNext/components/SelectSection/index.d.ts +1 -0
  67. package/dist/components/SelectNext/components/Tag/Tag.d.ts +18 -0
  68. package/dist/components/SelectNext/components/Tag/Tag.js +67 -0
  69. package/dist/components/SelectNext/components/Tag/index.d.ts +1 -0
  70. package/dist/components/SelectNext/components/Tag/intl.json.js +7 -0
  71. package/dist/components/SelectNext/components/Tag/utils.d.ts +3 -0
  72. package/dist/components/SelectNext/components/Tag/utils.js +9 -0
  73. package/dist/components/SelectNext/components/TagGroup/TagGroup.d.ts +13 -0
  74. package/dist/components/SelectNext/components/TagGroup/TagGroup.js +25 -0
  75. package/dist/components/SelectNext/components/TagGroup/TagGroup.module.css.js +20 -0
  76. package/dist/components/SelectNext/components/TagGroup/TagGroupMultiline.d.ts +3 -0
  77. package/dist/components/SelectNext/components/TagGroup/TagGroupMultiline.js +44 -0
  78. package/dist/components/SelectNext/components/TagGroup/TagGroupResponsive.d.ts +3 -0
  79. package/dist/components/SelectNext/components/TagGroup/TagGroupResponsive.js +65 -0
  80. package/dist/components/SelectNext/components/TagGroup/index.d.ts +1 -0
  81. package/dist/components/SelectNext/components/TagGroup/utils.d.ts +1 -0
  82. package/dist/components/SelectNext/components/TagGroup/utils.js +4 -0
  83. package/dist/components/SelectNext/components/index.d.ts +5 -0
  84. package/dist/components/SelectNext/index.d.ts +2 -0
  85. package/dist/components/SelectNext/intl.d.ts +2 -0
  86. package/dist/components/SelectNext/intl.js +21 -0
  87. package/dist/components/SelectNext/types.d.ts +99 -0
  88. package/dist/components/SelectNext/types.js +12 -0
  89. package/dist/components/SelectNext/utils.d.ts +9 -0
  90. package/dist/components/SelectNext/utils.js +26 -0
  91. package/dist/components/index.d.ts +3 -1
  92. package/dist/index.js +14 -1
  93. package/dist/style.css +324 -47
  94. package/package.json +5 -5
@@ -0,0 +1,17 @@
1
+ const base = "kbq-actionpanel-f0ec9d";
2
+ const container = "kbq-actionpanel-container-b084cf";
3
+ const actions = "kbq-actionpanel-actions-0c0847";
4
+ const more = "kbq-actionpanel-more-1622be";
5
+ const s = {
6
+ base,
7
+ container,
8
+ actions,
9
+ more
10
+ };
11
+ export {
12
+ actions,
13
+ base,
14
+ container,
15
+ s as default,
16
+ more
17
+ };
@@ -0,0 +1,11 @@
1
+ import { ActionsPanelAction } from './components';
2
+ import type { ActionsPanelProps } from './index';
3
+ declare const ActionsPanelComponent: {
4
+ (props: ActionsPanelProps): import("react/jsx-runtime").JSX.Element;
5
+ displayName: string;
6
+ };
7
+ type CompoundedComponent = typeof ActionsPanelComponent & {
8
+ Action: typeof ActionsPanelAction;
9
+ };
10
+ export declare const ActionsPanel: CompoundedComponent;
11
+ export {};
@@ -0,0 +1,170 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useRef, useState, useEffect, Children, cloneElement } from "react";
4
+ import { useElementSize, useHideOverflowItems, mergeProps, useMultiRef } from "@koobiq/react-core";
5
+ import { useContextProps, useToolbar, useOverlayTriggerState, useOverlay, Overlay } from "@koobiq/react-primitives";
6
+ import { Transition } from "react-transition-group";
7
+ import s from "./ActionPanel.module.css.js";
8
+ import { ActionsPanelContext } from "./ActionsPanelContext.js";
9
+ import { useInlinePaddingSize } from "./hooks/useInlinePaddingSize.js";
10
+ import { ActionsPanelAction } from "./components/ActionsPanelAction/ActionsPanelAction.js";
11
+ import { ActionsPanelCounter } from "./components/ActionsPanelCounter/ActionsPanelCounter.js";
12
+ import { ActionsPanelMoreAction } from "./components/ActionsPanelMoreAction/ActionsPanelMoreAction.js";
13
+ import { ActionsPanelClearButton } from "./components/ActionsPanelClearButton/ActionsPanelClearButton.js";
14
+ const ActionsPanelComponent = (props) => {
15
+ const [panelProps, panelRef] = useContextProps(
16
+ props,
17
+ props.ref,
18
+ ActionsPanelContext
19
+ );
20
+ const {
21
+ children,
22
+ onAction,
23
+ slotProps,
24
+ onClearSelection,
25
+ selectedItemCount,
26
+ selectedExtraCount,
27
+ portalContainer,
28
+ disableExitOnEscapeKeyDown,
29
+ ...other
30
+ } = panelProps;
31
+ const overlayRef = useRef(null);
32
+ const actionsRef = useRef(null);
33
+ const actionsInlinePadding = useInlinePaddingSize(actionsRef);
34
+ const [shownCount, setShownCount] = useState(selectedItemCount);
35
+ const { toolbarProps } = useToolbar({ orientation: "horizontal" }, panelRef);
36
+ const { ref: clearBtnRef, width: clearBtnWidth } = useElementSize();
37
+ const state = useOverlayTriggerState({
38
+ isOpen: !!selectedItemCount,
39
+ onOpenChange: onClearSelection
40
+ });
41
+ const { isOpen: isOpenState, close } = state;
42
+ useEffect(() => {
43
+ if (isOpenState) {
44
+ setShownCount(selectedItemCount);
45
+ }
46
+ }, [isOpenState, selectedItemCount]);
47
+ const elements = [];
48
+ const elementKeys = [];
49
+ Children.forEach(children, (child) => {
50
+ if (!child || typeof child !== "object") return;
51
+ const el = child;
52
+ elements.push(el);
53
+ elementKeys.push(el.key);
54
+ });
55
+ const { length } = elements;
56
+ const { parentRef, visibleMap, itemsRefs } = useHideOverflowItems({
57
+ length: length + 2,
58
+ busy: clearBtnWidth + actionsInlinePadding,
59
+ deps: [isOpenState, clearBtnWidth, actionsInlinePadding]
60
+ });
61
+ const counterIndex = length;
62
+ const moreIndex = length + 1;
63
+ const { overlayProps } = useOverlay(
64
+ {
65
+ onClose: close,
66
+ isOpen: isOpenState,
67
+ isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
68
+ },
69
+ overlayRef
70
+ );
71
+ const transitionProps = mergeProps(
72
+ {
73
+ timeout: 300,
74
+ in: isOpenState,
75
+ nodeRef: panelRef,
76
+ unmountOnExit: true
77
+ },
78
+ slotProps?.transition
79
+ );
80
+ const items = [];
81
+ const collapsedItems = [];
82
+ for (let idx = 0; idx < elements.length; idx += 1) {
83
+ const element = elements[idx];
84
+ const isAction = element.type === ActionsPanelAction;
85
+ const isHidden = !visibleMap[idx];
86
+ if (!isAction) {
87
+ items.push(element);
88
+ } else {
89
+ const itemKey = elementKeys[idx] ?? String(idx);
90
+ if (isHidden) {
91
+ collapsedItems.push({
92
+ element,
93
+ index: idx,
94
+ key: itemKey,
95
+ props: element.props,
96
+ children: element.props.children
97
+ });
98
+ }
99
+ items.push(
100
+ cloneElement(element, {
101
+ ref: itemsRefs[idx],
102
+ "aria-hidden": isHidden || void 0,
103
+ onPress: (e) => {
104
+ element.props?.onPress?.(e);
105
+ onAction?.(itemKey);
106
+ }
107
+ })
108
+ );
109
+ }
110
+ }
111
+ const isOnlyCounterHidden = collapsedItems.length === 0 && !visibleMap[counterIndex];
112
+ const rootRef = useMultiRef([panelRef, overlayRef]);
113
+ const rootProps = mergeProps(
114
+ { className: s.base },
115
+ other,
116
+ toolbarProps,
117
+ overlayProps
118
+ );
119
+ const containerProps = mergeProps(
120
+ { className: s.container, ref: parentRef },
121
+ slotProps?.container
122
+ );
123
+ const actionsProps = mergeProps(
124
+ {
125
+ ref: actionsRef,
126
+ className: s.actions,
127
+ "data-only-counter-hidden": isOnlyCounterHidden || void 0
128
+ },
129
+ slotProps?.actions
130
+ );
131
+ const counterProps = mergeProps(
132
+ {
133
+ selectedExtraCount,
134
+ ref: itemsRefs[counterIndex],
135
+ selectedItemCount: shownCount,
136
+ "aria-hidden": !visibleMap[counterIndex] || void 0
137
+ },
138
+ slotProps?.counter
139
+ );
140
+ const moreProps = mergeProps(
141
+ {
142
+ onAction,
143
+ collapsedItems,
144
+ className: s.more,
145
+ selectedExtraCount,
146
+ ref: itemsRefs[moreIndex],
147
+ selectedItemCount: shownCount,
148
+ "aria-hidden": !visibleMap[moreIndex] || void 0
149
+ },
150
+ slotProps?.more
151
+ );
152
+ return /* @__PURE__ */ jsx(Transition, { ...transitionProps, children: (transition) => /* @__PURE__ */ jsx(Overlay, { portalContainer: portalContainer || void 0, children: /* @__PURE__ */ jsx("div", { "data-transition": transition, ...rootProps, ref: rootRef, children: /* @__PURE__ */ jsx("div", { ...containerProps, children: /* @__PURE__ */ jsxs("div", { ...actionsProps, children: [
153
+ items,
154
+ /* @__PURE__ */ jsx(ActionsPanelCounter, { ...counterProps }),
155
+ /* @__PURE__ */ jsx(ActionsPanelMoreAction, { ...moreProps }),
156
+ /* @__PURE__ */ jsx(
157
+ ActionsPanelClearButton,
158
+ {
159
+ ref: clearBtnRef,
160
+ onClearSelection
161
+ }
162
+ )
163
+ ] }) }) }) }) });
164
+ };
165
+ ActionsPanelComponent.displayName = "ActionsPanel";
166
+ const ActionsPanel = ActionsPanelComponent;
167
+ ActionsPanel.Action = ActionsPanelAction;
168
+ export {
169
+ ActionsPanel
170
+ };
@@ -0,0 +1,3 @@
1
+ import type { ContextValue } from '@koobiq/react-primitives';
2
+ import type { ActionsPanelProps } from './types';
3
+ export declare const ActionsPanelContext: import("react").Context<ContextValue<ActionsPanelProps, HTMLDivElement>>;
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { createContext } from "react";
3
+ const ActionsPanelContext = createContext(null);
4
+ export {
5
+ ActionsPanelContext
6
+ };
@@ -0,0 +1,2 @@
1
+ import type { ActionsPanelActionProps } from './types';
2
+ export declare const ActionsPanelAction: (props: ActionsPanelActionProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { clsx } from "@koobiq/react-core";
4
+ import s from "./ActionsPanelAction.module.css.js";
5
+ import { Button } from "../../../Button/Button.js";
6
+ const ActionsPanelAction = (props) => {
7
+ const { children, ref, className, icon, ...other } = props;
8
+ return /* @__PURE__ */ jsx(
9
+ Button,
10
+ {
11
+ ref,
12
+ "data-slot": "action",
13
+ startIcon: icon,
14
+ className: clsx(s.base, className),
15
+ ...other,
16
+ children
17
+ }
18
+ );
19
+ };
20
+ export {
21
+ ActionsPanelAction
22
+ };
@@ -0,0 +1,8 @@
1
+ const base = "kbq-actionspanelaction-da3850";
2
+ const s = {
3
+ base
4
+ };
5
+ export {
6
+ base,
7
+ s as default
8
+ };
@@ -0,0 +1,2 @@
1
+ export * from './ActionsPanelAction';
2
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ButtonProps } from '../../../Button';
3
+ export type ActionsPanelActionProps = Omit<ButtonProps, 'startIcon' | 'endIcon'> & {
4
+ icon?: ReactNode;
5
+ };
@@ -0,0 +1,5 @@
1
+ import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
2
+ export type ActionsPanelClearButtonProps = ExtendableComponentPropsWithRef<{
3
+ onClearSelection?: () => void;
4
+ }, 'div'>;
5
+ export declare const ActionsPanelClearButton: ({ onClearSelection, className, ...other }: ActionsPanelClearButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useLocalizedStringFormatter, clsx } from "@koobiq/react-core";
3
+ import { IconCircleXmark16 } from "@koobiq/react-icons";
4
+ import intlMessages from "../../intl.json.js";
5
+ import s from "./ActionsPanelClearButton.module.css.js";
6
+ import { FlexBox } from "../../../FlexBox/FlexBox.js";
7
+ import { ActionsPanelDivider } from "../ActionsPanelDivider/ActionsPanelDivider.js";
8
+ import { Button } from "../../../Button/Button.js";
9
+ const ActionsPanelClearButton = ({
10
+ onClearSelection,
11
+ className,
12
+ ...other
13
+ }) => {
14
+ const t = useLocalizedStringFormatter(intlMessages);
15
+ return /* @__PURE__ */ jsxs(FlexBox, { className: clsx(s.base, className), alignItems: "center", ...other, children: [
16
+ /* @__PURE__ */ jsx(ActionsPanelDivider, {}),
17
+ /* @__PURE__ */ jsx(
18
+ Button,
19
+ {
20
+ "aria-label": t.format("clear selection"),
21
+ onPress: onClearSelection,
22
+ startIcon: /* @__PURE__ */ jsx(IconCircleXmark16, {}),
23
+ onlyIcon: true
24
+ }
25
+ )
26
+ ] });
27
+ };
28
+ export {
29
+ ActionsPanelClearButton
30
+ };
@@ -0,0 +1,8 @@
1
+ const base = "kbq-actionspanelclearbutton-2a7ca4";
2
+ const s = {
3
+ base
4
+ };
5
+ export {
6
+ base,
7
+ s as default
8
+ };
@@ -0,0 +1 @@
1
+ export * from './ActionsPanelClearButton';
@@ -0,0 +1,11 @@
1
+ const base = "kbq-actionpanelcontainer-2fad9f";
2
+ const panel = "kbq-actionpanelcontainer-panel-0ab5be";
3
+ const s = {
4
+ base,
5
+ panel
6
+ };
7
+ export {
8
+ base,
9
+ s as default,
10
+ panel
11
+ };
@@ -0,0 +1,2 @@
1
+ import type { ActionsPanelContainerProps } from './types';
2
+ export declare const ActionsPanelContainer: (props: ActionsPanelContainerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { useMultiRef, clsx } from "@koobiq/react-core";
5
+ import { Provider } from "@koobiq/react-primitives";
6
+ import { ActionsPanelContext } from "../../ActionsPanelContext.js";
7
+ import s from "./ActionPanelContainer.module.css.js";
8
+ const ActionsPanelContainer = (props) => {
9
+ const { children, className, ref, ...other } = props;
10
+ const [portalContainer, setPortalContainer] = useState(
11
+ null
12
+ );
13
+ const domRef = useMultiRef([ref, setPortalContainer]);
14
+ return /* @__PURE__ */ jsx(
15
+ Provider,
16
+ {
17
+ values: [
18
+ [
19
+ ActionsPanelContext,
20
+ {
21
+ className: s.panel,
22
+ portalContainer
23
+ }
24
+ ]
25
+ ],
26
+ children: /* @__PURE__ */ jsx("div", { className: clsx(s.base, className), ref: domRef, ...other, children })
27
+ }
28
+ );
29
+ };
30
+ export {
31
+ ActionsPanelContainer
32
+ };
@@ -0,0 +1,2 @@
1
+ export * from './ActionsPanelContainer';
2
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { DataAttributeProps, ExtendableComponentPropsWithRef } from '@koobiq/react-core';
3
+ export type ActionsPanelContainerProps = ExtendableComponentPropsWithRef<{
4
+ children?: ReactNode;
5
+ } & DataAttributeProps, 'div'>;
@@ -0,0 +1,6 @@
1
+ import { type DataAttributeProps, type ExtendableComponentPropsWithRef } from '@koobiq/react-core';
2
+ export type ActionsPanelCounterProps = ExtendableComponentPropsWithRef<{
3
+ selectedItemCount?: number | 'all';
4
+ selectedExtraCount?: number;
5
+ } & DataAttributeProps, 'div'>;
6
+ export declare const ActionsPanelCounter: ({ selectedItemCount, selectedExtraCount, className, ...other }: ActionsPanelCounterProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useLocalizedStringFormatter, clsx, isNumber } from "@koobiq/react-core";
3
+ import intlMessages from "../../intl.json.js";
4
+ import s from "./ActionsPanelCounter.module.css.js";
5
+ import { Badge } from "../../../Badge/Badge.js";
6
+ import { FlexBox } from "../../../FlexBox/FlexBox.js";
7
+ import { Typography } from "../../../Typography/Typography.js";
8
+ import { ActionsPanelDivider } from "../ActionsPanelDivider/ActionsPanelDivider.js";
9
+ const ActionsPanelCounter = ({
10
+ selectedItemCount,
11
+ selectedExtraCount,
12
+ className,
13
+ ...other
14
+ }) => {
15
+ const t = useLocalizedStringFormatter(intlMessages);
16
+ const isAll = selectedItemCount === "all";
17
+ return /* @__PURE__ */ jsxs(FlexBox, { alignItems: "center", className: clsx(s.base, className), ...other, children: [
18
+ /* @__PURE__ */ jsxs(
19
+ Typography,
20
+ {
21
+ as: "div",
22
+ className: s.text,
23
+ ellipsis: true,
24
+ color: "on-contrast",
25
+ variant: "text-normal-medium",
26
+ children: [
27
+ isAll ? t.format("all selected") : /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ t.format("selected"),
29
+ " ",
30
+ /* @__PURE__ */ jsx("span", { className: s.counterValue, children: selectedItemCount })
31
+ ] }),
32
+ isNumber(selectedExtraCount) && /* @__PURE__ */ jsxs(Badge, { variant: "outline-fade-contrast", className: s.extraCounter, children: [
33
+ "+",
34
+ selectedExtraCount
35
+ ] })
36
+ ]
37
+ }
38
+ ),
39
+ /* @__PURE__ */ jsx(ActionsPanelDivider, {})
40
+ ] });
41
+ };
42
+ export {
43
+ ActionsPanelCounter
44
+ };
@@ -0,0 +1,17 @@
1
+ const base = "kbq-actionspanelcounter-a1a48c";
2
+ const text = "kbq-actionspanelcounter-text-378809";
3
+ const counterValue = "kbq-actionspanelcounter-counterValue-bbeca7";
4
+ const extraCounter = "kbq-actionspanelcounter-extraCounter-feb01d";
5
+ const s = {
6
+ base,
7
+ text,
8
+ counterValue,
9
+ extraCounter
10
+ };
11
+ export {
12
+ base,
13
+ counterValue,
14
+ s as default,
15
+ extraCounter,
16
+ text
17
+ };
@@ -0,0 +1 @@
1
+ export * from './ActionsPanelCounter';
@@ -0,0 +1,3 @@
1
+ import type { DividerProps } from '../../../Divider';
2
+ export type ActionsPanelCounterProps = DividerProps;
3
+ export declare const ActionsPanelDivider: ({ className, ...other }: ActionsPanelCounterProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { clsx } from "@koobiq/react-core";
3
+ import s from "./ActionsPanelDivider.module.css.js";
4
+ import { Divider } from "../../../Divider/Divider.js";
5
+ const ActionsPanelDivider = ({
6
+ className,
7
+ ...other
8
+ }) => /* @__PURE__ */ jsx(
9
+ Divider,
10
+ {
11
+ orientation: "vertical",
12
+ className: clsx(s.base, className),
13
+ ...other
14
+ }
15
+ );
16
+ export {
17
+ ActionsPanelDivider
18
+ };
@@ -0,0 +1,8 @@
1
+ const base = "kbq-actionspaneldivider-b8d764";
2
+ const s = {
3
+ base
4
+ };
5
+ export {
6
+ base,
7
+ s as default
8
+ };
@@ -0,0 +1 @@
1
+ export * from './ActionsPanelDivider';
@@ -0,0 +1,2 @@
1
+ import type { ActionsPanelMoreActionProps } from './types';
2
+ export declare const ActionsPanelMoreAction: (props: ActionsPanelMoreActionProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
+ import { useLocalizedStringFormatter, isNumber, isString, mergeProps, clsx, mergeRefs } from "@koobiq/react-core";
4
+ import { IconEllipsisVertical16 } from "@koobiq/react-icons";
5
+ import intlMessages from "../../intl.json.js";
6
+ import s from "./ActionsPanelMoreAction.module.css.js";
7
+ import { Menu } from "../../../Menu/Menu.js";
8
+ import { Typography } from "../../../Typography/Typography.js";
9
+ import { Badge } from "../../../Badge/Badge.js";
10
+ import { Button } from "../../../Button/Button.js";
11
+ const ActionsPanelMoreAction = (props) => {
12
+ const {
13
+ ref,
14
+ onAction,
15
+ children,
16
+ className,
17
+ collapsedItems,
18
+ selectedItemCount,
19
+ selectedExtraCount,
20
+ ...other
21
+ } = props;
22
+ const t = useLocalizedStringFormatter(intlMessages);
23
+ const isAll = selectedItemCount === "all";
24
+ const hasItems = collapsedItems.length > 0;
25
+ const renderButton = ({
26
+ ref: controlRef,
27
+ ...controlProps
28
+ }) => /* @__PURE__ */ jsx(
29
+ Button,
30
+ {
31
+ "data-slot": "more-action",
32
+ ref: mergeRefs(ref, controlRef),
33
+ "aria-label": t.format("show more actions"),
34
+ className: clsx(s.base, className),
35
+ startIcon: /* @__PURE__ */ jsx(IconEllipsisVertical16, {}),
36
+ ...mergeProps(other, controlProps),
37
+ onlyIcon: true,
38
+ children
39
+ }
40
+ );
41
+ if (!hasItems) {
42
+ return renderButton({});
43
+ }
44
+ return /* @__PURE__ */ jsxs(Menu, { onAction, control: (props2) => renderButton(props2), children: [
45
+ /* @__PURE__ */ jsx(Menu.Header, { children: /* @__PURE__ */ jsxs(Typography, { variant: "text-normal-strong", className: s.menuTitle, children: [
46
+ isAll ? t.format("all selected") : /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ t.format("selected"),
48
+ " ",
49
+ selectedItemCount
50
+ ] }),
51
+ isNumber(selectedExtraCount) && /* @__PURE__ */ jsxs(Badge, { variant: "fade-contrast", className: s.extraCounter, children: [
52
+ "+",
53
+ selectedExtraCount
54
+ ] })
55
+ ] }) }),
56
+ /* @__PURE__ */ jsx(Menu.Divider, {}),
57
+ /* @__PURE__ */ jsx(Fragment, { children: collapsedItems.map((item, index) => /* @__PURE__ */ jsxs(
58
+ Menu.Item,
59
+ {
60
+ textValue: isString(item.children) ? item.children : `${index}`,
61
+ children: [
62
+ item.props.icon,
63
+ /* @__PURE__ */ jsx(Menu.ItemText, { children: item.children })
64
+ ]
65
+ },
66
+ item.key
67
+ )) })
68
+ ] });
69
+ };
70
+ export {
71
+ ActionsPanelMoreAction
72
+ };
@@ -0,0 +1,14 @@
1
+ const base = "kbq-actionspanelmoreaction-4f2721";
2
+ const menuTitle = "kbq-actionspanelmoreaction-menuTitle-06612f";
3
+ const extraCounter = "kbq-actionspanelmoreaction-extraCounter-9d3cb2";
4
+ const s = {
5
+ base,
6
+ menuTitle,
7
+ extraCounter
8
+ };
9
+ export {
10
+ base,
11
+ s as default,
12
+ extraCounter,
13
+ menuTitle
14
+ };
@@ -0,0 +1,2 @@
1
+ export * from './ActionsPanelMoreAction';
2
+ export * from './types';
@@ -0,0 +1,9 @@
1
+ import type { Key } from '../../../../index';
2
+ import type { ButtonProps } from '../../../Button';
3
+ import type { ActionsPanelActionRenderItem } from '../../types';
4
+ export type ActionsPanelMoreActionProps = ButtonProps & {
5
+ selectedItemCount?: number | 'all';
6
+ collapsedItems: ActionsPanelActionRenderItem[];
7
+ onAction?: (key: Key) => void;
8
+ selectedExtraCount?: number;
9
+ };
@@ -0,0 +1,4 @@
1
+ export * from './ActionsPanelContainer';
2
+ export * from './ActionsPanelAction';
3
+ export * from './ActionsPanelClearButton';
4
+ export * from './ActionsPanelCounter';
@@ -0,0 +1 @@
1
+ export * from './useInlinePaddingSize';
@@ -0,0 +1,6 @@
1
+ import type { RefObject } from 'react';
2
+ /**
3
+ * Returns sum of inline paddings (start + end) in px for a given element ref.
4
+ * Updates on ResizeObserver notifications.
5
+ */
6
+ export declare function useInlinePaddingSize<Element extends HTMLElement | SVGGraphicsElement>(ref: RefObject<Element | null>): number;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useMemo } from "react";
3
+ import { useResizeObserverRefs } from "@koobiq/react-core";
4
+ function useInlinePaddingSize(ref) {
5
+ const refs = useMemo(() => [ref], [ref]);
6
+ const [paddingInline] = useResizeObserverRefs(refs, (el) => {
7
+ if (!el) return 0;
8
+ const cs = getComputedStyle(el);
9
+ const start = parseFloat(cs.paddingInlineStart || cs.paddingLeft) || 0;
10
+ const end = parseFloat(cs.paddingInlineEnd || cs.paddingRight) || 0;
11
+ return start + end;
12
+ });
13
+ return paddingInline ?? 0;
14
+ }
15
+ export {
16
+ useInlinePaddingSize
17
+ };
@@ -0,0 +1,5 @@
1
+ export * from './ActionsPanel';
2
+ export * from './components/ActionsPanelContainer';
3
+ export * from './components/ActionsPanelAction/types';
4
+ export * from './ActionsPanelContext';
5
+ export * from './types';
@@ -0,0 +1,7 @@
1
+ const intlMessages = {
2
+ "ru-RU": { "selected": "Выбрано:", "all selected": "Выбраны все", "clear selection": "Очистить выделение", "show more actions": "Показать остальные действия" },
3
+ "en-US": { "selected": "Selected:", "all selected": "All selected", "clear selection": "Clear selection", "show more actions": "Show more actions" }
4
+ };
5
+ export {
6
+ intlMessages as default
7
+ };