@koobiq/react-components 0.0.1-beta.1 → 0.0.1-beta.11

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 (115) hide show
  1. package/README.md +14 -31
  2. package/dist/components/Alert/Alert.js +1 -1
  3. package/dist/components/Alert/components/AlertIcon/utils.js +1 -1
  4. package/dist/components/Alert/intl.json.js +2 -6
  5. package/dist/components/AnimatedIcon/AnimatedIcon.d.ts +4 -0
  6. package/dist/components/AnimatedIcon/AnimatedIcon.js +50 -0
  7. package/dist/components/AnimatedIcon/AnimatedIcon.module.css.js +11 -0
  8. package/dist/components/AnimatedIcon/index.d.ts +2 -0
  9. package/dist/components/AnimatedIcon/types.d.ts +19 -0
  10. package/dist/components/Button/Button.js +1 -1
  11. package/dist/components/Button/Button.module.css.js +2 -2
  12. package/dist/components/Checkbox/Checkbox.js +18 -8
  13. package/dist/components/Container/Container.js +2 -1
  14. package/dist/components/Container/utils.d.ts +1 -1
  15. package/dist/components/Dialog/DialogContext.js +1 -1
  16. package/dist/components/Dialog/components/DialogContent.js +1 -1
  17. package/dist/components/Dialog/intl.json.js +2 -6
  18. package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroup.d.ts +8 -2
  19. package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroup.js +32 -30
  20. package/dist/components/FieldComponents/FieldSelect/FieldSelect.d.ts +12 -0
  21. package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +37 -0
  22. package/dist/components/FieldComponents/FieldSelect/FieldSelect.module.css.js +20 -0
  23. package/dist/components/FieldComponents/FieldSelect/index.d.ts +1 -0
  24. package/dist/components/FieldComponents/index.d.ts +1 -0
  25. package/dist/components/FlexBox/FlexBox.d.ts +4 -0
  26. package/dist/components/FlexBox/FlexBox.js +47 -0
  27. package/dist/components/FlexBox/index.d.ts +2 -0
  28. package/dist/components/FlexBox/types.d.ts +27 -0
  29. package/dist/components/Input/Input.d.ts +1 -0
  30. package/dist/components/Input/Input.js +11 -11
  31. package/dist/components/Input/types.d.ts +2 -1
  32. package/dist/components/Link/Link.js +13 -15
  33. package/dist/components/List/List.d.ts +9 -0
  34. package/dist/components/List/List.js +46 -0
  35. package/dist/components/List/List.module.css.js +11 -0
  36. package/dist/components/List/ListItem.d.ts +6 -0
  37. package/dist/components/List/ListItem.js +11 -0
  38. package/dist/components/List/ListSection.d.ts +16 -0
  39. package/dist/components/List/ListSection.js +11 -0
  40. package/dist/components/List/components/ListItemText/ListItemText.d.ts +16 -0
  41. package/dist/components/List/components/ListItemText/index.d.ts +1 -0
  42. package/dist/components/List/components/ListOption/ListOption.d.ts +5 -0
  43. package/dist/components/List/components/ListOption/ListOption.js +44 -0
  44. package/dist/components/List/components/ListOption/ListOption.module.css.js +23 -0
  45. package/dist/components/List/components/ListOption/index.d.ts +1 -0
  46. package/dist/components/List/components/ListSection/ListSection.d.ts +5 -0
  47. package/dist/components/List/components/ListSection/ListSection.js +33 -0
  48. package/dist/components/List/components/ListSection/ListSection.module.css.js +11 -0
  49. package/dist/components/List/components/ListSection/index.d.ts +1 -0
  50. package/dist/components/List/components/index.d.ts +3 -0
  51. package/dist/components/List/index.d.ts +4 -0
  52. package/dist/components/List/types.d.ts +57 -0
  53. package/dist/components/List/types.js +4 -0
  54. package/dist/components/Modal/Modal.js +14 -12
  55. package/dist/components/Modal/types.d.ts +7 -0
  56. package/dist/components/Popover/Popover.d.ts +4 -2
  57. package/dist/components/Popover/Popover.js +137 -127
  58. package/dist/components/Popover/Popover.module.css.js +3 -0
  59. package/dist/components/Popover/types.d.ts +25 -3
  60. package/dist/components/ProgressBar/ProgressBar.module.css.js +1 -2
  61. package/dist/components/ProgressSpinner/ProgressSpinner.module.css.js +1 -2
  62. package/dist/components/Provider/BreakpointsProvider.d.ts +2 -1
  63. package/dist/components/Provider/BreakpointsProvider.js +8 -1
  64. package/dist/components/Provider/Provider.d.ts +1 -1
  65. package/dist/components/Provider/Provider.js +9 -1
  66. package/dist/components/Provider/types.d.ts +5 -0
  67. package/dist/components/Provider/utils/useBreakpoints.d.ts +2 -1
  68. package/dist/components/Provider/utils/useBreakpoints.js +2 -2
  69. package/dist/components/RadioGroup/RadioContext.js +1 -0
  70. package/dist/components/RadioGroup/RadioGroup.js +2 -1
  71. package/dist/components/RadioGroup/components/Radio/Radio.js +3 -2
  72. package/dist/components/RadioGroup/components/Radio/Radio.module.css.js +3 -0
  73. package/dist/components/Select/Select.d.ts +2 -0
  74. package/dist/components/Select/Select.js +172 -0
  75. package/dist/components/Select/Select.module.css.js +20 -0
  76. package/dist/components/Select/index.d.ts +2 -0
  77. package/dist/components/Select/types.d.ts +87 -0
  78. package/dist/components/SidePanel/SidePanel.js +17 -15
  79. package/dist/components/SidePanel/types.d.ts +7 -0
  80. package/dist/components/SkeletonBlock/SkeletonBlock.module.css.js +0 -1
  81. package/dist/components/SkeletonTypography/utils.js +3 -0
  82. package/dist/components/Toggle/Toggle.js +1 -1
  83. package/dist/components/Tooltip/Tooltip.d.ts +2 -1
  84. package/dist/components/Tooltip/Tooltip.js +9 -8
  85. package/dist/components/Tooltip/types.d.ts +9 -4
  86. package/dist/components/Typography/Typography.js +2 -2
  87. package/dist/components/Typography/Typography.module.css.js +2 -1
  88. package/dist/components/Typography/types.d.ts +1 -1
  89. package/dist/components/Typography/types.js +2 -1
  90. package/dist/components/index.d.ts +4 -0
  91. package/dist/components/layout/flex/flex.d.ts +15 -4
  92. package/dist/components/layout/flex/flex.js +6 -1
  93. package/dist/components/layout/flex/flex.module.css.js +78 -39
  94. package/dist/index.d.ts +2 -1
  95. package/dist/index.js +16 -1
  96. package/dist/style.css +484 -223
  97. package/dist/styles/utility.js +0 -1
  98. package/dist/styles/utility.module.css.js +0 -1
  99. package/dist/types.d.ts +1 -0
  100. package/package.json +6 -6
  101. package/dist/components/Input/components/FieldAddon/FieldAddon.d.ts +0 -10
  102. package/dist/components/Input/components/FieldAddon/index.d.ts +0 -1
  103. package/dist/components/Input/components/FieldCaption/FieldCaption.d.ts +0 -6
  104. package/dist/components/Input/components/FieldCaption/index.d.ts +0 -1
  105. package/dist/components/Input/components/FieldControl/FieldControl.d.ts +0 -9
  106. package/dist/components/Input/components/FieldControl/index.d.ts +0 -1
  107. package/dist/components/Input/components/FieldError/FieldError.d.ts +0 -7
  108. package/dist/components/Input/components/FieldError/index.d.ts +0 -1
  109. package/dist/components/Input/components/FieldInput/FieldInput.d.ts +0 -9
  110. package/dist/components/Input/components/FieldInput/index.d.ts +0 -1
  111. package/dist/components/Input/components/FieldInputGroup/FieldInputGroup.d.ts +0 -7
  112. package/dist/components/Input/components/FieldInputGroup/index.d.ts +0 -1
  113. package/dist/components/Input/components/FieldLabel/FieldLabel.d.ts +0 -9
  114. package/dist/components/Input/components/FieldLabel/index.d.ts +0 -1
  115. package/dist/components/Input/components/index.d.ts +0 -7
@@ -0,0 +1,172 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useDOMRef, useBoolean, mergeProps, clsx, useElementSize } from "@koobiq/react-core";
4
+ import { IconChevronDownS16 } from "@koobiq/react-icons";
5
+ import { useSelectState, useSelect, HiddenSelect } from "@koobiq/react-primitives";
6
+ import { ListInner } from "../List/List.js";
7
+ import s from "./Select.module.css.js";
8
+ import { FieldSelect } from "../FieldComponents/FieldSelect/FieldSelect.js";
9
+ import { PopoverInner } from "../Popover/Popover.js";
10
+ import { FieldLabel } from "../FieldComponents/FieldLabel/FieldLabel.js";
11
+ import { FieldInputGroup } from "../FieldComponents/FieldInputGroup/FieldInputGroup.js";
12
+ import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
13
+ import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
14
+ function SelectRender(props, ref) {
15
+ const {
16
+ fullWidth = false,
17
+ hiddenLabel = false,
18
+ "data-testid": testId,
19
+ open,
20
+ onOpenChange,
21
+ defaultOpen,
22
+ items,
23
+ error,
24
+ caption,
25
+ endAddon,
26
+ required,
27
+ disabled,
28
+ children,
29
+ slotProps,
30
+ startAddon,
31
+ selectedKey,
32
+ placeholder,
33
+ errorMessage,
34
+ disabledKeys,
35
+ onSelectionChange,
36
+ defaultSelectedKey,
37
+ renderValue: renderValueProp,
38
+ ...other
39
+ } = props;
40
+ const state = useSelectState({
41
+ ...other,
42
+ items,
43
+ defaultOpen,
44
+ onOpenChange,
45
+ isOpen: open,
46
+ placeholder,
47
+ selectedKey,
48
+ disabledKeys,
49
+ errorMessage,
50
+ isInvalid: error,
51
+ onSelectionChange,
52
+ defaultSelectedKey,
53
+ isRequired: required,
54
+ isDisabled: disabled,
55
+ children
56
+ });
57
+ const domRef = useDOMRef(ref);
58
+ const [opened, { on, off }] = useBoolean(state.isOpen);
59
+ const {
60
+ menuProps,
61
+ valueProps,
62
+ triggerProps,
63
+ labelProps: labelPropsCommon
64
+ } = useSelect(
65
+ {
66
+ ...other,
67
+ placeholder,
68
+ errorMessage,
69
+ disabledKeys,
70
+ isInvalid: error,
71
+ isRequired: required,
72
+ isDisabled: disabled
73
+ },
74
+ { ...state, isOpen: state.isOpen || opened },
75
+ domRef
76
+ );
77
+ const rootProps = mergeProps(
78
+ {
79
+ "data-testid": testId,
80
+ "data-fullwidth": fullWidth,
81
+ "data-disabled": disabled,
82
+ "data-required": required,
83
+ "data-error": error,
84
+ className: clsx(s.base, fullWidth && s.fullWidth)
85
+ },
86
+ other
87
+ );
88
+ const { ref: containerRef, width } = useElementSize();
89
+ const listProps = mergeProps(
90
+ { className: s.list, state },
91
+ slotProps?.list,
92
+ menuProps
93
+ );
94
+ const labelProps = mergeProps(
95
+ { hidden: hiddenLabel, required },
96
+ slotProps?.label,
97
+ labelPropsCommon
98
+ );
99
+ const groupProps = mergeProps(
100
+ {
101
+ slotProps: {
102
+ end: { className: s.addon },
103
+ start: { className: s.addon }
104
+ },
105
+ startAddon,
106
+ endAddon: /* @__PURE__ */ jsxs(Fragment, { children: [
107
+ endAddon,
108
+ /* @__PURE__ */ jsx(IconChevronDownS16, {})
109
+ ] }),
110
+ error,
111
+ ref: containerRef
112
+ },
113
+ slotProps?.group
114
+ );
115
+ const controlProps = mergeProps(
116
+ {
117
+ error,
118
+ disabled,
119
+ ref: domRef,
120
+ placeholder
121
+ },
122
+ slotProps?.control,
123
+ valueProps,
124
+ triggerProps
125
+ );
126
+ const captionProps = slotProps?.caption;
127
+ const errorProps = mergeProps({ error }, slotProps?.errorMessage);
128
+ const popoverProps = mergeProps(
129
+ {
130
+ state,
131
+ offset: 4,
132
+ size: width,
133
+ hideArrow: true,
134
+ anchorRef: domRef,
135
+ className: s.popover,
136
+ placement: "bottom start",
137
+ type: "listbox",
138
+ slotProps: {
139
+ transition: {
140
+ onEnter: on,
141
+ onExited: off
142
+ }
143
+ }
144
+ },
145
+ slotProps?.popover
146
+ );
147
+ const renderDefaultValue = (selectedItem) => selectedItem?.rendered;
148
+ const renderValue = renderValueProp || renderDefaultValue;
149
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
150
+ /* @__PURE__ */ jsxs("div", { ...rootProps, children: [
151
+ /* @__PURE__ */ jsx(FieldLabel, { ...labelProps, children: props.label }),
152
+ /* @__PURE__ */ jsx(
153
+ HiddenSelect,
154
+ {
155
+ state,
156
+ isDisabled: disabled,
157
+ triggerRef: domRef,
158
+ label: props.label,
159
+ name: props.name
160
+ }
161
+ ),
162
+ /* @__PURE__ */ jsx(FieldInputGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldSelect, { ...controlProps, children: renderValue(state?.selectedItem) }) }),
163
+ /* @__PURE__ */ jsx(FieldCaption, { ...captionProps, children: captionProps?.children || caption }),
164
+ /* @__PURE__ */ jsx(FieldError, { ...errorProps, children: errorProps.children || errorMessage })
165
+ ] }),
166
+ /* @__PURE__ */ jsx(PopoverInner, { ...popoverProps, children: /* @__PURE__ */ jsx(ListInner, { ...listProps }) })
167
+ ] });
168
+ }
169
+ const Select = forwardRef(SelectRender);
170
+ export {
171
+ Select
172
+ };
@@ -0,0 +1,20 @@
1
+ const base = "kbq-select-6d31ad";
2
+ const fullWidth = "kbq-select-fullWidth-1dfc13";
3
+ const addon = "kbq-select-addon-cbc524";
4
+ const popover = "kbq-select-popover-79fc05";
5
+ const list = "kbq-select-list-8ffac0";
6
+ const s = {
7
+ base,
8
+ fullWidth,
9
+ addon,
10
+ popover,
11
+ list
12
+ };
13
+ export {
14
+ addon,
15
+ base,
16
+ s as default,
17
+ fullWidth,
18
+ list,
19
+ popover
20
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Select';
2
+ export * from './types';
@@ -0,0 +1,87 @@
1
+ import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
2
+ import type { Node } from '@koobiq/react-primitives';
3
+ import type { FieldErrorProps, FieldLabelProps, FieldSelectProps, FieldCaptionProps, FieldInputGroupProps } from '../FieldComponents';
4
+ import type { ListPropItems, ListPropChildren, ListPropDisabledKeys } from '../List';
5
+ import type { PopoverProps } from '../Popover';
6
+ export type SelectKey = string | number;
7
+ export type SelectPropOnSelectionChange = (selected: SelectKey) => void;
8
+ export type SelectProps<T extends object> = {
9
+ /** Additional CSS-classes. */
10
+ className?: string;
11
+ /** The content to display as the label. */
12
+ label?: ReactNode;
13
+ /** The contents of the collection. */
14
+ children?: ListPropChildren<T>;
15
+ /** Item objects in the collection. */
16
+ items?: ListPropItems<T>;
17
+ /** Addon placed before the children. */
18
+ startAddon?: ReactNode;
19
+ /** Addon placed after the children. */
20
+ endAddon?: ReactNode;
21
+ /** Inline styles. */
22
+ style?: CSSProperties;
23
+ /** The text appears in a control until the user puts focus on the field. */
24
+ placeholder?: string;
25
+ /**
26
+ * If `true`, the input will indicate an error.
27
+ * @default false
28
+ * */
29
+ error?: boolean;
30
+ /** Message for the error state */
31
+ errorMessage?: string | number;
32
+ /**
33
+ * If `true`, the label is hidden. Be sure to add aria-label to the input element.
34
+ * @default false
35
+ * */
36
+ hiddenLabel?: boolean;
37
+ /** The helper text content. */
38
+ caption?: string | number;
39
+ /**
40
+ * If true, the input will take up the full width of its container.
41
+ * @default false
42
+ * */
43
+ fullWidth?: boolean;
44
+ /**
45
+ * If `true`, the component is disabled.
46
+ * @default false
47
+ * */
48
+ disabled?: boolean;
49
+ /**
50
+ * If `true`, the label is displayed as required and the input element is required.
51
+ * @default false
52
+ * */
53
+ required?: boolean;
54
+ /** Unique identifier for testing purposes. */
55
+ 'data-testid'?: string | number;
56
+ /** Ref to the control */
57
+ ref?: Ref<HTMLButtonElement>;
58
+ /** The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with. */
59
+ disabledKeys?: ListPropDisabledKeys<T>;
60
+ /** The initial selected key in the collection (uncontrolled). */
61
+ defaultSelectedKey?: SelectKey;
62
+ /** The currently selected key in the collection (controlled). */
63
+ selectedKey?: SelectKey | null;
64
+ /** Handler that is called when the selection changes. */
65
+ onSelectionChange?: SelectPropOnSelectionChange;
66
+ /** Sets the open state of the menu. */
67
+ open?: boolean;
68
+ /** Sets the default open state of the menu. */
69
+ defaultOpen?: boolean;
70
+ /** Method that is called when the open state of the menu changes. */
71
+ onOpenChange?: (isOpen: boolean) => void;
72
+ /** A render function for displaying the selected value. */
73
+ renderValue?: (props: Node<T> | null) => ReactElement;
74
+ name?: string;
75
+ /** The props used for each slot inside. */
76
+ slotProps?: {
77
+ popover?: PopoverProps;
78
+ label?: FieldLabelProps;
79
+ list?: ListPropChildren<T>;
80
+ control?: FieldSelectProps;
81
+ caption?: FieldCaptionProps;
82
+ group?: FieldInputGroupProps;
83
+ errorMessage?: FieldErrorProps;
84
+ };
85
+ };
86
+ export type SelectComponent = <T extends object>(props: SelectProps<T>) => ReactElement | null;
87
+ export type SelectRef = ComponentRef<'button'>;
@@ -10,20 +10,21 @@ import { Dialog } from "../Dialog/Dialog.js";
10
10
  const SidePanel = forwardRef(
11
11
  (props, ref) => {
12
12
  const {
13
- hideCloseButton = false,
14
- position = "left",
15
13
  size = "medium",
16
- disableExitOnEscapeKeyDown,
17
- disableExitOnClickOutside,
18
- disableFocusManagement,
19
- portalContainer,
20
- open: openProp,
21
- hideBackdrop,
22
- onOpenChange,
23
- defaultOpen,
24
- children,
14
+ position = "left",
15
+ hideCloseButton = false,
25
16
  control,
17
+ children,
26
18
  slotProps,
19
+ defaultOpen,
20
+ onOpenChange,
21
+ hideBackdrop,
22
+ open: openProp,
23
+ portalContainer,
24
+ disableFocusManagement,
25
+ disableExitOnClickOutside,
26
+ disableExitOnEscapeKeyDown,
27
+ shouldCloseOnInteractOutside,
27
28
  ...other
28
29
  } = props;
29
30
  const state = useOverlayTriggerState({
@@ -43,6 +44,7 @@ const SidePanel = forwardRef(
43
44
  const { modalProps: modalCommonProps, underlayProps } = useModalOverlay(
44
45
  {
45
46
  ...props,
47
+ shouldCloseOnInteractOutside,
46
48
  isDismissable: !disableExitOnClickOutside,
47
49
  isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
48
50
  },
@@ -57,10 +59,10 @@ const SidePanel = forwardRef(
57
59
  };
58
60
  const containerProps = mergeProps(
59
61
  {
60
- className: clsx(s.base, s[size], s[position]),
62
+ ref: containerRef,
61
63
  "data-size": size,
62
64
  "data-position": position,
63
- ref: containerRef
65
+ className: clsx(s.base, s[size], s[position])
64
66
  },
65
67
  other
66
68
  );
@@ -81,8 +83,8 @@ const SidePanel = forwardRef(
81
83
  const panelProps = mergeProps(
82
84
  modalCommonProps,
83
85
  {
84
- className: s.panel,
85
- ref: modalRef
86
+ ref: modalRef,
87
+ className: s.panel
86
88
  },
87
89
  slotProps?.panel
88
90
  );
@@ -65,6 +65,13 @@ export type SidePanelProps = {
65
65
  * @default false
66
66
  */
67
67
  disableFocusManagement?: boolean;
68
+ /**
69
+ * When user interacts with the argument element outside of the overlay ref,
70
+ * return true if onClose should be called. This gives you a chance to filter
71
+ * out interaction with elements that should not dismiss the overlay.
72
+ * By default, onClose will always be called on interaction outside the overlay ref.
73
+ */
74
+ shouldCloseOnInteractOutside?: (element: Element) => boolean;
68
75
  /** The props used for each slot inside. */
69
76
  slotProps?: {
70
77
  dialog?: DialogProps;
@@ -2,7 +2,6 @@ const base = "kbq-skeletonblock-e98401";
2
2
  const hasChildren = "kbq-skeletonblock-hasChildren-88ab53";
3
3
  const s = {
4
4
  base,
5
- "skeleton-wave": "kbq-skeletonblock-skeleton-wave-3094a0",
6
5
  hasChildren
7
6
  };
8
7
  export {
@@ -4,10 +4,13 @@ const getRowWidth = (idx, rows = 0) => {
4
4
  return "50%";
5
5
  }
6
6
  switch (idx % 3) {
7
+ // The first, fourth etc.
7
8
  case 0:
8
9
  return "95%";
10
+ // The second, fifth etc.
9
11
  case 1:
10
12
  return "100%";
13
+ // The third, sixth etc.
11
14
  case 2:
12
15
  return "90%";
13
16
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { forwardRef } from "react";
4
- import { clsx, mergeProps, isNotNil } from "@koobiq/react-core";
4
+ import { mergeProps, isNotNil, clsx } from "@koobiq/react-core";
5
5
  import { Toggle as Toggle$1 } from "@koobiq/react-primitives";
6
6
  import s from "./Toggle.module.css.js";
7
7
  const Toggle = forwardRef(
@@ -7,7 +7,7 @@ export declare const Tooltip: import("react").ForwardRefExoticComponent<{
7
7
  children?: import("react").ReactNode;
8
8
  control?: import("./types").TooltipPropControl;
9
9
  placement?: import("./types").TooltipPropPlacement;
10
- anchorRef?: import("react").RefObject<HTMLElement>;
10
+ anchorRef?: import("react").RefObject<HTMLElement | null>;
11
11
  arrowBoundaryOffset?: number;
12
12
  offset?: number;
13
13
  crossOffset?: number;
@@ -17,4 +17,5 @@ export declare const Tooltip: import("react").ForwardRefExoticComponent<{
17
17
  trigger?: "focus";
18
18
  id?: string;
19
19
  className?: string;
20
+ portalContainer?: Element;
20
21
  } & import("@koobiq/react-core").DataAttributeProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
3
  import { forwardRef, useRef } from "react";
4
- import { useDOMRef, useBoolean, FocusableProvider, mergeProps, clsx } from "@koobiq/react-core";
4
+ import { useDOMRef, useMultiRef, useBoolean, FocusableProvider, clsx, mergeProps } from "@koobiq/react-core";
5
5
  import { useTooltipTriggerState, useTooltipTrigger, useOverlayPosition, useTooltip, Overlay } from "@koobiq/react-primitives";
6
6
  import { Transition } from "react-transition-group";
7
7
  import { utilClasses } from "../../styles/utility.js";
@@ -10,17 +10,18 @@ const Tooltip = forwardRef((props, ref) => {
10
10
  const {
11
11
  delay = 120,
12
12
  disabled = false,
13
- defaultOpen,
14
13
  closeDelay = 120,
15
14
  hideArrow = false,
16
15
  variant = "contrast",
17
- onOpenChange,
18
16
  placement: placementProp = "top",
19
17
  control,
20
18
  children,
21
19
  anchorRef,
22
20
  crossOffset,
21
+ defaultOpen,
22
+ onOpenChange,
23
23
  open: openProp,
24
+ portalContainer,
24
25
  offset: offsetProp,
25
26
  arrowBoundaryOffset,
26
27
  ...other
@@ -38,6 +39,7 @@ const Tooltip = forwardRef((props, ref) => {
38
39
  });
39
40
  const domRef = useDOMRef(ref);
40
41
  const controlRef = useRef(null);
42
+ const controlRefCallback = useMultiRef([controlRef]);
41
43
  const { triggerProps, tooltipProps } = useTooltipTrigger(
42
44
  {
43
45
  delay,
@@ -67,20 +69,20 @@ const Tooltip = forwardRef((props, ref) => {
67
69
  const { tooltipProps: localTooltipProps } = useTooltip(overlayProps, state);
68
70
  return /* @__PURE__ */ jsxs(Fragment, { children: [
69
71
  /* @__PURE__ */ jsx(FocusableProvider, { ...triggerProps, ref: controlRef, children: control?.({
70
- ref: controlRef,
72
+ ref: controlRefCallback,
71
73
  ...triggerProps
72
74
  }) }),
73
75
  /* @__PURE__ */ jsx(
74
76
  Transition,
75
77
  {
76
78
  onEnter: on,
77
- timeout: 300,
79
+ timeout: 120,
78
80
  onExited: off,
79
81
  in: openState,
80
82
  nodeRef: domRef,
81
83
  unmountOnExit: true,
82
84
  appear: true,
83
- children: (transition) => /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsxs(
85
+ children: (transition) => /* @__PURE__ */ jsx(Overlay, { portalContainer, children: /* @__PURE__ */ jsxs(
84
86
  "div",
85
87
  {
86
88
  ...mergeProps(localTooltipProps, tooltipProps),
@@ -108,8 +110,7 @@ const Tooltip = forwardRef((props, ref) => {
108
110
  ]
109
111
  }
110
112
  ) })
111
- },
112
- placement
113
+ }
113
114
  )
114
115
  ] });
115
116
  });
@@ -1,7 +1,7 @@
1
- import type { ReactNode, ComponentRef, Ref, ReactElement, HTMLAttributes, RefObject } from 'react';
1
+ import type { ReactNode, RefObject, ComponentRef, ReactElement, DOMAttributes } from 'react';
2
2
  import type { DataAttributeProps } from '@koobiq/react-core';
3
- export type TooltipPropControl = (props: HTMLAttributes<HTMLButtonElement> & {
4
- ref?: Ref<HTMLButtonElement>;
3
+ export type TooltipPropControl = (props: DOMAttributes<HTMLElement> & {
4
+ ref: ((node: HTMLElement | null) => void) | null;
5
5
  }) => ReactElement;
6
6
  export declare const tooltipPropPlacement: readonly ["bottom", "bottom start", "bottom end", "top", "top start", "top end", "start", "start top", "start bottom", "end", "end top", "end bottom"];
7
7
  export declare const tooltipPropVariant: readonly ["contrast", "contrast-fade", "error", "warning", "theme"];
@@ -34,7 +34,7 @@ export type TooltipProps = {
34
34
  * */
35
35
  placement?: TooltipPropPlacement;
36
36
  /** The ref for the element which the popover positions itself with respect to. */
37
- anchorRef?: RefObject<HTMLElement>;
37
+ anchorRef?: RefObject<HTMLElement | null>;
38
38
  /**
39
39
  * The minimum distance the arrow's edge should be from the edge of the overlay element.
40
40
  * @default 0
@@ -77,5 +77,10 @@ export type TooltipProps = {
77
77
  id?: string;
78
78
  /** Additional CSS-classes. */
79
79
  className?: string;
80
+ /**
81
+ * The container element in which the component portal will be placed.
82
+ * @default document.body
83
+ */
84
+ portalContainer?: Element;
80
85
  } & DataAttributeProps;
81
86
  export type TooltipRef = ComponentRef<'div'>;
@@ -27,11 +27,11 @@ const Typography = polymorphicForwardRef(
27
27
  "data-ellipsis": ellipsis,
28
28
  className: clsx(
29
29
  s.base,
30
+ textVariant[variant],
30
31
  display && s[display],
31
32
  ellipsis && s.ellipsis,
32
33
  align && s[`align-${align}`],
33
- textVariant[variant],
34
- foregroundColor[color],
34
+ color === "inherit" ? s["color-inherit"] : foregroundColor[color],
35
35
  className
36
36
  ),
37
37
  ...other,
@@ -12,7 +12,8 @@ const s = {
12
12
  "align-center": "kbq-typography-align-center-2d47fd",
13
13
  "align-initial": "kbq-typography-align-initial-faf6dd",
14
14
  "align-inherit": "kbq-typography-align-inherit-00f946",
15
- ellipsis
15
+ ellipsis,
16
+ "color-inherit": "kbq-typography-color-inherit-35de13"
16
17
  };
17
18
  export {
18
19
  base,
@@ -5,7 +5,7 @@ export declare const typographyPropDisplay: readonly ["block", "inline", "inline
5
5
  export type TypographyDisplayVariant = (typeof typographyPropDisplay)[number];
6
6
  export declare const typographyPropAlign: readonly ["start", "center", "end", "initial", "inherit"];
7
7
  export type TypographyPropAlign = (typeof typographyPropAlign)[number];
8
- export declare const typographyPropColor: readonly ["white", "white-secondary", "theme", "theme-secondary", "contrast", "on-contrast", "contrast-secondary", "contrast-tertiary", "error", "error-secondary", "error-tertiary", "error-less", "success", "success-less", "success-secondary", "warning", "warning-secondary", "visited"];
8
+ export declare const typographyPropColor: readonly ["white", "white-secondary", "theme", "theme-secondary", "contrast", "on-contrast", "contrast-secondary", "contrast-tertiary", "error", "error-secondary", "error-tertiary", "error-less", "success", "success-less", "success-secondary", "warning", "warning-secondary", "visited", "inherit"];
9
9
  export type TypographyPropColor = (typeof typographyPropColor)[number];
10
10
  export type TypographyBaseProps = {
11
11
  /**
@@ -74,7 +74,8 @@ const typographyPropColor = [
74
74
  "success-secondary",
75
75
  "warning",
76
76
  "warning-secondary",
77
- "visited"
77
+ "visited",
78
+ "inherit"
78
79
  ];
79
80
  export {
80
81
  typographyPropAlign,
@@ -1,4 +1,5 @@
1
1
  export * from './Provider';
2
+ export * from './FlexBox';
2
3
  export * from './Container';
3
4
  export * from './Alert';
4
5
  export * from './Button';
@@ -21,4 +22,7 @@ export * from './Modal';
21
22
  export * from './SidePanel';
22
23
  export * from './Popover';
23
24
  export * from './Tooltip';
25
+ export * from './List';
26
+ export * from './AnimatedIcon';
27
+ export * from './Select';
24
28
  export * from './layout';
@@ -13,13 +13,24 @@ export type FlexPropDirection = (typeof flexPropDirection)[number];
13
13
  export declare const flexPropOrder: readonly [-1, 0, 1];
14
14
  export type FlexPropOrder = (typeof flexPropOrder)[number];
15
15
  export type FlexProps = {
16
- alignItems?: FlexPropAlignItems;
17
- justifyContent?: FlexPropJustifyContent;
16
+ /** Defines the `gap` property. */
17
+ gap?: FlexPropGap;
18
+ /** Defines the `column-gap` property. */
19
+ colGap?: FlexPropGap;
20
+ /** Defines the `row-gap` property. */
21
+ rowGap?: FlexPropGap;
22
+ /** Defines the `display` property with `flex` or `inline-flex` value. */
18
23
  flex?: FlexPropFlex;
24
+ /** Defines the `flex-wrap` property. */
19
25
  wrap?: FlexPropWrap;
20
- direction?: FlexPropDirection;
21
- gap?: FlexPropGap;
26
+ /** Defines the `order` property. */
22
27
  order?: FlexPropOrder;
28
+ /** Defines the `flex-direction` property. */
29
+ direction?: FlexPropDirection;
30
+ /** Defines the `align-items` property. */
31
+ alignItems?: FlexPropAlignItems;
32
+ /** Defines the `justify-content` property. */
33
+ justifyContent?: FlexPropJustifyContent;
23
34
  };
24
35
  export type FlexParams = (props: FlexProps, className?: string) => string;
25
36
  export declare const flex: FlexParams;
@@ -47,15 +47,20 @@ const flex = (props, className) => {
47
47
  wrap,
48
48
  direction,
49
49
  gap,
50
+ rowGap: rowGapProp,
51
+ colGap: colGapProp,
50
52
  order: orderProp
51
53
  } = props;
52
54
  const order = String(orderProp);
55
+ const colGap = colGapProp ?? gap;
56
+ const rowGap = rowGapProp ?? gap;
53
57
  return clsx(
54
58
  s.base,
55
- gap && s[`gap_${gap}`],
56
59
  flex2 && s[`flex_${flex2}`],
57
60
  wrap && s[`wrap_${wrap}`],
58
61
  order && s[`order_${order}`],
62
+ rowGap && s[`gap_row_${rowGap}`],
63
+ colGap && s[`gap_column_${colGap}`],
59
64
  direction && s[`direction_${direction}`],
60
65
  alignItems && s[`alignItems_${alignItems}`],
61
66
  justifyContent && s[`justifyContent_${justifyContent}`],