@rio-cloud/rio-uikit 2.5.0 → 2.5.1

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.
@@ -104,6 +104,12 @@ type BaseButtonProps = {
104
104
  * @default false
105
105
  */
106
106
  block?: boolean;
107
+ /**
108
+ * Enables a subtle scale animation when the button is hovered.
109
+ *
110
+ * @default false
111
+ */
112
+ hoverScale?: boolean;
107
113
  /**
108
114
  * Sets the button style.
109
115
  * @default 'default'
@@ -1,11 +1,11 @@
1
1
  import { jsxs as E, jsx as k } from "react/jsx-runtime";
2
- import { forwardRef as Y, useState as L, useRef as $ } from "react";
3
- import { noop as w } from "es-toolkit/function";
4
- import B from "../../utils/classNames.js";
5
- import { createButtonRipple as S } from "../../utils/buttonEffect.js";
6
- import F from "../../hooks/useMergeRefs.js";
7
- import { getAutoTrackingAttributes as G } from "../../utils/analytics/autoTracking.js";
8
- const z = {
2
+ import { forwardRef as $, useState as S, useRef as w } from "react";
3
+ import { noop as B } from "es-toolkit/function";
4
+ import F from "../../utils/classNames.js";
5
+ import { createButtonRipple as L } from "../../utils/buttonEffect.js";
6
+ import G from "../../hooks/useMergeRefs.js";
7
+ import { getAutoTrackingAttributes as z } from "../../utils/analytics/autoTracking.js";
8
+ const W = {
9
9
  DEFAULT: "default",
10
10
  UNSTYLED: "unstyled",
11
11
  PRIMARY: "primary",
@@ -16,72 +16,74 @@ const z = {
16
16
  SUCCESS: "success",
17
17
  MUTED: "muted",
18
18
  MUTED_FILLED: "muted-filled"
19
- }, i = {
19
+ }, s = {
20
20
  VARIANT_LINK: "link",
21
21
  VARIANT_LINK_INLINE: "link-inline",
22
22
  VARIANT_OUTLINE: "outline",
23
23
  VARIANT_ACTION: "action"
24
- }, W = {
24
+ }, X = {
25
25
  XS: "xs",
26
26
  SM: "sm",
27
27
  MD: "md",
28
28
  LG: "lg"
29
- }, u = Y((_, C) => {
29
+ }, u = $((_, h) => {
30
30
  const {
31
31
  as: a = "button",
32
- active: n = !1,
33
- disabled: e = !1,
32
+ active: e = !1,
33
+ disabled: n = !1,
34
34
  asToggle: f = !1,
35
- onClick: l = w,
36
- bsStyle: y = "default",
35
+ onClick: l = B,
36
+ bsStyle: C = "default",
37
37
  bsSize: b,
38
- variant: s,
39
- iconOnly: O = !1,
38
+ variant: i,
39
+ iconOnly: v = !1,
40
40
  iconName: o,
41
- iconRight: h = !1,
42
- multiline: D = !1,
43
- block: M = !1,
41
+ iconRight: y = !1,
42
+ multiline: O = !1,
43
+ block: D = !1,
44
+ hoverScale: M = !1,
44
45
  className: V = "",
45
46
  noRippleEffect: N = !1,
46
- autoTrackingKey: v,
47
- type: U = "button",
47
+ autoTrackingKey: U,
48
+ type: x = "button",
48
49
  tabIndex: A = 0,
49
50
  children: m,
50
51
  ...r
51
- } = _, I = G({
52
- autoTrackingKey: v,
52
+ } = _, I = z({
53
+ autoTrackingKey: U,
53
54
  props: r,
54
55
  source: "button"
55
- }), [g, d] = L(n), T = $(null), p = F(T, C), [x, P] = L(n);
56
- n !== x && (d(n), P(n));
57
- const j = (t) => {
58
- if (N || S(t.nativeEvent, t.currentTarget), f) {
56
+ }), [g, d] = S(e), T = w(null), p = G(T, h), [P, j] = S(e);
57
+ e !== P && (d(e), j(e));
58
+ const K = (t) => {
59
+ if (N || L(t.nativeEvent, t.currentTarget), f) {
59
60
  const c = !g;
60
61
  d(c), c && T.current?.blur(), l(c);
61
62
  } else
62
63
  l(t);
63
- }, K = (t) => {
64
- if (e) {
64
+ }, Y = (t) => {
65
+ if (n) {
65
66
  t.preventDefault();
66
67
  return;
67
68
  }
68
- N || S(t.nativeEvent, t.currentTarget), l(t);
69
- }, R = B(
69
+ N || L(t.nativeEvent, t.currentTarget), l(t);
70
+ }, R = F(
70
71
  "btn",
71
- `btn-${y}`,
72
- s === i.VARIANT_LINK && "btn-link",
73
- s === i.VARIANT_LINK_INLINE && "btn-link btn-link-inline",
74
- s === i.VARIANT_OUTLINE && "btn-outline",
75
- s === i.VARIANT_ACTION && "btn-action",
72
+ `btn-${C}`,
73
+ i === s.VARIANT_LINK && "btn-link",
74
+ i === s.VARIANT_LINK_INLINE && "btn-link btn-link-inline",
75
+ i === s.VARIANT_OUTLINE && "btn-outline",
76
+ i === s.VARIANT_ACTION && "btn-action",
76
77
  b && `btn-${b}`,
77
78
  f && "btn-toggle",
78
79
  g && "active",
79
- O && "btn-icon-only",
80
- h && "btn-icon-right",
81
- D && "btn-multiline",
82
- M && "btn-block",
80
+ v && "btn-icon-only",
81
+ y && "btn-icon-right",
82
+ O && "btn-multiline",
83
+ D && "btn-block",
84
+ M && "hover-scale",
83
85
  a === "a" && "gap-0",
84
- a === "a" && e && "disabled",
86
+ a === "a" && n && "disabled",
85
87
  "btn-component",
86
88
  V
87
89
  );
@@ -92,9 +94,9 @@ const z = {
92
94
  ...r,
93
95
  ...I,
94
96
  className: R,
95
- onClick: K,
96
- "aria-disabled": e || void 0,
97
- tabIndex: e ? -1 : A,
97
+ onClick: Y,
98
+ "aria-disabled": n || void 0,
99
+ tabIndex: n ? -1 : A,
98
100
  children: [
99
101
  o && /* @__PURE__ */ k("span", { className: `rioglyph ${o}` }),
100
102
  m
@@ -104,12 +106,12 @@ const z = {
104
106
  "button",
105
107
  {
106
108
  ref: p,
107
- type: U,
109
+ type: x,
108
110
  ...r,
109
111
  ...I,
110
112
  className: R,
111
- onClick: j,
112
- disabled: e,
113
+ onClick: K,
114
+ disabled: n,
113
115
  tabIndex: A,
114
116
  children: [
115
117
  o && /* @__PURE__ */ k("span", { className: `rioglyph ${o}` }),
@@ -118,13 +120,13 @@ const z = {
118
120
  }
119
121
  );
120
122
  });
121
- Object.assign(u, z);
122
- Object.assign(u, i);
123
123
  Object.assign(u, W);
124
+ Object.assign(u, s);
125
+ Object.assign(u, X);
124
126
  export {
125
- W as SIZES_MAP,
126
- z as STYLES_MAP,
127
- i as VARIANTS_MAP,
127
+ X as SIZES_MAP,
128
+ W as STYLES_MAP,
129
+ s as VARIANTS_MAP,
128
130
  u as default
129
131
  };
130
132
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import React, {\n forwardRef,\n type ForwardRefExoticComponent,\n type HTMLProps,\n type PropsWithChildren,\n type RefAttributes,\n useRef,\n useState,\n} from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport { createButtonRipple } from '../../utils/buttonEffect';\nimport useMergeRefs from '../../hooks/useMergeRefs';\nimport type { ObjectValues } from '../../utils/ObjectValues';\nimport { getAutoTrackingAttributes } from '../../utils/analytics/autoTracking';\n\nexport const STYLES_MAP = {\n DEFAULT: 'default',\n UNSTYLED: 'unstyled',\n PRIMARY: 'primary',\n SECONDARY: 'secondary',\n INFO: 'info',\n WARNING: 'warning',\n DANGER: 'danger',\n SUCCESS: 'success',\n MUTED: 'muted',\n MUTED_FILLED: 'muted-filled',\n} as const;\n\n// export for convenient usage on client side\nexport type BUTTON_STYLE = ObjectValues<typeof STYLES_MAP>;\n\nexport const VARIANTS_MAP = {\n VARIANT_LINK: 'link',\n VARIANT_LINK_INLINE: 'link-inline',\n VARIANT_OUTLINE: 'outline',\n VARIANT_ACTION: 'action',\n} as const;\n\nexport type BUTTON_VARIANT = ObjectValues<typeof VARIANTS_MAP>;\n\nexport const SIZES_MAP = {\n XS: 'xs',\n SM: 'sm',\n MD: 'md',\n LG: 'lg',\n} as const;\n\nexport type BUTTON_SIZE = ObjectValues<typeof SIZES_MAP>;\n\n/*\n * ATTENTION: We're typing the onClick handler based on the value of `asToggle`.\n *\n * It does not fully work here inside of this file, though. Therefore, we have to apply some explicit casts below.\n * In code _using_ the Button component, however, the parameter type of the onClick handler must either be a boolean or\n * a React.MouseEvent, respectively.\n */\n\ntype RegularButton = {\n /**\n * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.\n *\n * @default false\n */\n asToggle?: false;\n\n /**\n * Callback function triggered when clicking the button.\n *\n * @param event The MouseEvent that triggered the click.\n */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n};\n\ntype ToggleButton = {\n /**\n * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.\n *\n * @default false\n */\n asToggle: true;\n\n /**\n * Callback function triggered when clicking the button.\n *\n * @param value The new value of the toggle button.\n */\n onClick?: (value: boolean) => void;\n};\n\ntype BaseButtonProps = {\n /**\n * Whether the button should be disabled.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Set the button toggled. Should be used in combination with \"asToggle\" prop.\n *\n * @default false\n */\n active?: boolean;\n\n /**\n * Use when the content of the button is an icon only to adapt the button spacing accordingly.\n *\n * @default false\n */\n iconOnly?: boolean;\n\n /**\n * Adds right side spacing for an icon. This should be used when having navigation buttons\n * that use an icon on the right side.\n *\n * @default false\n */\n iconRight?: boolean;\n\n /**\n * Optional RIOglyph icon class name that comes in handy for icon-only buttons without adding\n * a separate icon span.\n *\n * Use only exact existing `rioglyph-*` classes from the generated UIKIT icon contract,\n * for example `rioglyph-download`. Do not compose or guess semantic icon names; an unknown\n * icon class renders as a filled rectangle.\n */\n iconName?: string;\n\n /**\n * Defines whether the button text break into multiple lines when the button space exceeds.\n *\n * Multiline buttons should be used as exception only.\n *\n * @default false\n */\n multiline?: boolean;\n\n /**\n * Defines whether the button takes up the full width of the parent element.\n *\n * @default false\n */\n block?: boolean;\n\n /**\n * Sets the button style.\n * @default 'default'\n */\n bsStyle?: BUTTON_STYLE;\n\n /**\n * Sets the button size.\n */\n bsSize?: BUTTON_SIZE;\n\n /**\n * Sets the button variant.\n */\n variant?: BUTTON_VARIANT;\n\n /**\n * Whether the \"ripple\" effect should be suppressed on this button.\n */\n noRippleEffect?: boolean;\n\n /**\n * Optional key used to generate automatic GA tracking attributes when no explicit\n * tracking attributes are provided.\n *\n * Resulting label format: `button::<autoTrackingKey>`.\n */\n autoTrackingKey?: string;\n\n /**\n * Number of the index used for keyboard support.\n *\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Additional classes to be set on the button element.\n */\n className?: string;\n};\n\ntype NativeButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'> &\n BaseButtonProps & {\n /**\n * Defines this component as a native button element.\n *\n * @default 'button'\n */\n as?: 'button';\n\n /**\n * Defines the native button type.\n *\n * The Button component renders a native `<button>` with `type=\"button\"` by default.\n * Only set `type=\"submit\"` when the button should submit a form. Do not add\n * `type=\"button\"` defensively unless local code style requires explicit defaults.\n *\n * @default 'button'\n */\n type?: 'button' | 'submit';\n } & (RegularButton | ToggleButton);\n\ntype LinkButtonProps = Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'> &\n BaseButtonProps & {\n /**\n * Defines this component as a link element.\n */\n as: 'a';\n\n /**\n * Native button type is not supported when using `as=\"a\"`.\n */\n type?: never;\n\n /**\n * Defines the destination URL for the link button.\n */\n href: string;\n\n /**\n * Toggle behavior is not supported when using `as=\"a\"`.\n *\n * @default false\n */\n asToggle?: false;\n\n /**\n * Callback function triggered when clicking the link.\n *\n * @param event The MouseEvent that triggered the click.\n */\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;\n };\n\nexport type ButtonProps = NativeButtonProps | LinkButtonProps;\n\ntype Props = PropsWithChildren<ButtonProps>;\n\n// Define statics to be used as \"Button.PRIMARY\"\ntype ButtonType = ForwardRefExoticComponent<Props & RefAttributes<HTMLButtonElement>> & {\n DEFAULT: 'default';\n UNSTYLED: 'unstyled';\n PRIMARY: 'primary';\n SECONDARY: 'secondary';\n INFO: 'info';\n WARNING: 'warning';\n DANGER: 'danger';\n SUCCESS: 'success';\n MUTED: 'muted';\n MUTED_FILLED: 'muted-filled';\n\n VARIANT_LINK: 'link';\n VARIANT_LINK_INLINE: 'link-inline';\n VARIANT_OUTLINE: 'outline';\n VARIANT_ACTION: 'action';\n\n XS: 'xs';\n SM: 'sm';\n MD: 'md';\n LG: 'lg';\n};\n\nconst Button = forwardRef<HTMLButtonElement, Props>((props, ref) => {\n const {\n as = 'button',\n active = false,\n disabled = false,\n asToggle = false,\n onClick = noop,\n bsStyle = 'default',\n bsSize,\n variant,\n iconOnly = false,\n iconName,\n iconRight = false,\n multiline = false,\n block = false,\n className = '',\n noRippleEffect = false,\n autoTrackingKey,\n type = 'button',\n tabIndex = 0,\n children,\n ...remainingProps\n } = props;\n\n const autoTrackingAttributes = getAutoTrackingAttributes({\n autoTrackingKey,\n props: remainingProps as Record<string, unknown>,\n source: 'button',\n });\n\n const [isToggled, setIsToggled] = useState(active);\n\n const btnRef = useRef<HTMLButtonElement>(null);\n\n const buttonRef = useMergeRefs(btnRef, ref);\n\n // Update internal toggle state when used as controlled component and outside toggle state changes\n // Note, using the usePrevious hook resulted in an endless loop, hence the useState here\n const [previousActive, setPreviousActive] = useState(active);\n if (active !== previousActive) {\n setIsToggled(active);\n setPreviousActive(active);\n }\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!noRippleEffect) {\n createButtonRipple(event.nativeEvent, event.currentTarget);\n }\n\n if (asToggle) {\n // Intercept click handler only for toggle button to update internal state and blur after click\n const newIsToggled = !isToggled;\n setIsToggled(newIsToggled);\n\n if (newIsToggled) {\n btnRef.current?.blur();\n }\n\n (onClick as (x: boolean) => void)(newIsToggled);\n } else {\n (onClick as (x: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void)(event);\n }\n };\n\n const handleLinkClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n if (!noRippleEffect) {\n createButtonRipple(event.nativeEvent, event.currentTarget);\n }\n\n (onClick as (x: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void)(event);\n };\n\n const buttonClassNames = classNames(\n 'btn',\n `btn-${bsStyle}`,\n variant === VARIANTS_MAP.VARIANT_LINK && 'btn-link',\n variant === VARIANTS_MAP.VARIANT_LINK_INLINE && 'btn-link btn-link-inline',\n variant === VARIANTS_MAP.VARIANT_OUTLINE && 'btn-outline',\n variant === VARIANTS_MAP.VARIANT_ACTION && 'btn-action',\n bsSize && `btn-${bsSize}`,\n asToggle && 'btn-toggle',\n isToggled && 'active',\n iconOnly && 'btn-icon-only',\n iconRight && 'btn-icon-right',\n multiline && 'btn-multiline',\n block && 'btn-block',\n as === 'a' && 'gap-0',\n as === 'a' && disabled && 'disabled',\n 'btn-component',\n className\n );\n\n if (as === 'a') {\n return (\n <a\n ref={buttonRef as React.Ref<HTMLAnchorElement>}\n {...(remainingProps as Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'>)}\n {...autoTrackingAttributes}\n className={buttonClassNames}\n onClick={handleLinkClick}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : tabIndex}\n >\n {iconName && <span className={`rioglyph ${iconName}`} />}\n {children}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n type={type}\n {...(remainingProps as Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'>)}\n {...autoTrackingAttributes}\n className={buttonClassNames}\n onClick={handleButtonClick}\n disabled={disabled}\n tabIndex={tabIndex}\n >\n {iconName && <span className={`rioglyph ${iconName}`} />}\n {children}\n </button>\n );\n}) as ButtonType;\n\nObject.assign(Button, STYLES_MAP);\nObject.assign(Button, VARIANTS_MAP);\nObject.assign(Button, SIZES_MAP);\n\nexport default Button;\n"],"names":["STYLES_MAP","VARIANTS_MAP","SIZES_MAP","Button","forwardRef","props","ref","as","active","disabled","asToggle","onClick","noop","bsStyle","bsSize","variant","iconOnly","iconName","iconRight","multiline","block","className","noRippleEffect","autoTrackingKey","type","tabIndex","children","remainingProps","autoTrackingAttributes","getAutoTrackingAttributes","isToggled","setIsToggled","useState","btnRef","useRef","buttonRef","useMergeRefs","previousActive","setPreviousActive","handleButtonClick","event","createButtonRipple","newIsToggled","handleLinkClick","buttonClassNames","classNames","jsxs","jsx"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DS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAMT,gBAAAoB;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKX;AAAA,MACL,MAAAX;AAAA,MACC,GAAIG;AAAA,MACJ,GAAGC;AAAA,MACJ,WAAWgB;AAAA,MACX,SAASL;AAAA,MACT,UAAA9B;AAAA,MACA,UAAAgB;AAAA,MAEC,UAAA;AAAA,QAAAR,KAAY,gBAAA8B,EAAC,QAAA,EAAK,WAAW,YAAY9B,CAAQ,IAAI;AAAA,QACrDS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb,CAAC;AAED,OAAO,OAAOvB,GAAQH,CAAU;AAChC,OAAO,OAAOG,GAAQF,CAAY;AAClC,OAAO,OAAOE,GAAQD,CAAS;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import React, {\n forwardRef,\n type ForwardRefExoticComponent,\n type HTMLProps,\n type PropsWithChildren,\n type RefAttributes,\n useRef,\n useState,\n} from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport { createButtonRipple } from '../../utils/buttonEffect';\nimport useMergeRefs from '../../hooks/useMergeRefs';\nimport type { ObjectValues } from '../../utils/ObjectValues';\nimport { getAutoTrackingAttributes } from '../../utils/analytics/autoTracking';\n\nexport const STYLES_MAP = {\n DEFAULT: 'default',\n UNSTYLED: 'unstyled',\n PRIMARY: 'primary',\n SECONDARY: 'secondary',\n INFO: 'info',\n WARNING: 'warning',\n DANGER: 'danger',\n SUCCESS: 'success',\n MUTED: 'muted',\n MUTED_FILLED: 'muted-filled',\n} as const;\n\n// export for convenient usage on client side\nexport type BUTTON_STYLE = ObjectValues<typeof STYLES_MAP>;\n\nexport const VARIANTS_MAP = {\n VARIANT_LINK: 'link',\n VARIANT_LINK_INLINE: 'link-inline',\n VARIANT_OUTLINE: 'outline',\n VARIANT_ACTION: 'action',\n} as const;\n\nexport type BUTTON_VARIANT = ObjectValues<typeof VARIANTS_MAP>;\n\nexport const SIZES_MAP = {\n XS: 'xs',\n SM: 'sm',\n MD: 'md',\n LG: 'lg',\n} as const;\n\nexport type BUTTON_SIZE = ObjectValues<typeof SIZES_MAP>;\n\n/*\n * ATTENTION: We're typing the onClick handler based on the value of `asToggle`.\n *\n * It does not fully work here inside of this file, though. Therefore, we have to apply some explicit casts below.\n * In code _using_ the Button component, however, the parameter type of the onClick handler must either be a boolean or\n * a React.MouseEvent, respectively.\n */\n\ntype RegularButton = {\n /**\n * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.\n *\n * @default false\n */\n asToggle?: false;\n\n /**\n * Callback function triggered when clicking the button.\n *\n * @param event The MouseEvent that triggered the click.\n */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n};\n\ntype ToggleButton = {\n /**\n * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.\n *\n * @default false\n */\n asToggle: true;\n\n /**\n * Callback function triggered when clicking the button.\n *\n * @param value The new value of the toggle button.\n */\n onClick?: (value: boolean) => void;\n};\n\ntype BaseButtonProps = {\n /**\n * Whether the button should be disabled.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Set the button toggled. Should be used in combination with \"asToggle\" prop.\n *\n * @default false\n */\n active?: boolean;\n\n /**\n * Use when the content of the button is an icon only to adapt the button spacing accordingly.\n *\n * @default false\n */\n iconOnly?: boolean;\n\n /**\n * Adds right side spacing for an icon. This should be used when having navigation buttons\n * that use an icon on the right side.\n *\n * @default false\n */\n iconRight?: boolean;\n\n /**\n * Optional RIOglyph icon class name that comes in handy for icon-only buttons without adding\n * a separate icon span.\n *\n * Use only exact existing `rioglyph-*` classes from the generated UIKIT icon contract,\n * for example `rioglyph-download`. Do not compose or guess semantic icon names; an unknown\n * icon class renders as a filled rectangle.\n */\n iconName?: string;\n\n /**\n * Defines whether the button text break into multiple lines when the button space exceeds.\n *\n * Multiline buttons should be used as exception only.\n *\n * @default false\n */\n multiline?: boolean;\n\n /**\n * Defines whether the button takes up the full width of the parent element.\n *\n * @default false\n */\n block?: boolean;\n\n /**\n * Enables a subtle scale animation when the button is hovered.\n *\n * @default false\n */\n hoverScale?: boolean;\n\n /**\n * Sets the button style.\n * @default 'default'\n */\n bsStyle?: BUTTON_STYLE;\n\n /**\n * Sets the button size.\n */\n bsSize?: BUTTON_SIZE;\n\n /**\n * Sets the button variant.\n */\n variant?: BUTTON_VARIANT;\n\n /**\n * Whether the \"ripple\" effect should be suppressed on this button.\n */\n noRippleEffect?: boolean;\n\n /**\n * Optional key used to generate automatic GA tracking attributes when no explicit\n * tracking attributes are provided.\n *\n * Resulting label format: `button::<autoTrackingKey>`.\n */\n autoTrackingKey?: string;\n\n /**\n * Number of the index used for keyboard support.\n *\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Additional classes to be set on the button element.\n */\n className?: string;\n};\n\ntype NativeButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'> &\n BaseButtonProps & {\n /**\n * Defines this component as a native button element.\n *\n * @default 'button'\n */\n as?: 'button';\n\n /**\n * Defines the native button type.\n *\n * The Button component renders a native `<button>` with `type=\"button\"` by default.\n * Only set `type=\"submit\"` when the button should submit a form. Do not add\n * `type=\"button\"` defensively unless local code style requires explicit defaults.\n *\n * @default 'button'\n */\n type?: 'button' | 'submit';\n } & (RegularButton | ToggleButton);\n\ntype LinkButtonProps = Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'> &\n BaseButtonProps & {\n /**\n * Defines this component as a link element.\n */\n as: 'a';\n\n /**\n * Native button type is not supported when using `as=\"a\"`.\n */\n type?: never;\n\n /**\n * Defines the destination URL for the link button.\n */\n href: string;\n\n /**\n * Toggle behavior is not supported when using `as=\"a\"`.\n *\n * @default false\n */\n asToggle?: false;\n\n /**\n * Callback function triggered when clicking the link.\n *\n * @param event The MouseEvent that triggered the click.\n */\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;\n };\n\nexport type ButtonProps = NativeButtonProps | LinkButtonProps;\n\ntype Props = PropsWithChildren<ButtonProps>;\n\n// Define statics to be used as \"Button.PRIMARY\"\ntype ButtonType = ForwardRefExoticComponent<Props & RefAttributes<HTMLButtonElement>> & {\n DEFAULT: 'default';\n UNSTYLED: 'unstyled';\n PRIMARY: 'primary';\n SECONDARY: 'secondary';\n INFO: 'info';\n WARNING: 'warning';\n DANGER: 'danger';\n SUCCESS: 'success';\n MUTED: 'muted';\n MUTED_FILLED: 'muted-filled';\n\n VARIANT_LINK: 'link';\n VARIANT_LINK_INLINE: 'link-inline';\n VARIANT_OUTLINE: 'outline';\n VARIANT_ACTION: 'action';\n\n XS: 'xs';\n SM: 'sm';\n MD: 'md';\n LG: 'lg';\n};\n\nconst Button = forwardRef<HTMLButtonElement, Props>((props, ref) => {\n const {\n as = 'button',\n active = false,\n disabled = false,\n asToggle = false,\n onClick = noop,\n bsStyle = 'default',\n bsSize,\n variant,\n iconOnly = false,\n iconName,\n iconRight = false,\n multiline = false,\n block = false,\n hoverScale = false,\n className = '',\n noRippleEffect = false,\n autoTrackingKey,\n type = 'button',\n tabIndex = 0,\n children,\n ...remainingProps\n } = props;\n\n const autoTrackingAttributes = getAutoTrackingAttributes({\n autoTrackingKey,\n props: remainingProps as Record<string, unknown>,\n source: 'button',\n });\n\n const [isToggled, setIsToggled] = useState(active);\n\n const btnRef = useRef<HTMLButtonElement>(null);\n\n const buttonRef = useMergeRefs(btnRef, ref);\n\n // Update internal toggle state when used as controlled component and outside toggle state changes\n // Note, using the usePrevious hook resulted in an endless loop, hence the useState here\n const [previousActive, setPreviousActive] = useState(active);\n if (active !== previousActive) {\n setIsToggled(active);\n setPreviousActive(active);\n }\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!noRippleEffect) {\n createButtonRipple(event.nativeEvent, event.currentTarget);\n }\n\n if (asToggle) {\n // Intercept click handler only for toggle button to update internal state and blur after click\n const newIsToggled = !isToggled;\n setIsToggled(newIsToggled);\n\n if (newIsToggled) {\n btnRef.current?.blur();\n }\n\n (onClick as (x: boolean) => void)(newIsToggled);\n } else {\n (onClick as (x: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void)(event);\n }\n };\n\n const handleLinkClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n if (!noRippleEffect) {\n createButtonRipple(event.nativeEvent, event.currentTarget);\n }\n\n (onClick as (x: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void)(event);\n };\n\n const buttonClassNames = classNames(\n 'btn',\n `btn-${bsStyle}`,\n variant === VARIANTS_MAP.VARIANT_LINK && 'btn-link',\n variant === VARIANTS_MAP.VARIANT_LINK_INLINE && 'btn-link btn-link-inline',\n variant === VARIANTS_MAP.VARIANT_OUTLINE && 'btn-outline',\n variant === VARIANTS_MAP.VARIANT_ACTION && 'btn-action',\n bsSize && `btn-${bsSize}`,\n asToggle && 'btn-toggle',\n isToggled && 'active',\n iconOnly && 'btn-icon-only',\n iconRight && 'btn-icon-right',\n multiline && 'btn-multiline',\n block && 'btn-block',\n hoverScale && 'hover-scale',\n as === 'a' && 'gap-0',\n as === 'a' && disabled && 'disabled',\n 'btn-component',\n className\n );\n\n if (as === 'a') {\n return (\n <a\n ref={buttonRef as React.Ref<HTMLAnchorElement>}\n {...(remainingProps as Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'>)}\n {...autoTrackingAttributes}\n className={buttonClassNames}\n onClick={handleLinkClick}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : tabIndex}\n >\n {iconName && <span className={`rioglyph ${iconName}`} />}\n {children}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n type={type}\n {...(remainingProps as Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'>)}\n {...autoTrackingAttributes}\n className={buttonClassNames}\n onClick={handleButtonClick}\n disabled={disabled}\n tabIndex={tabIndex}\n >\n {iconName && <span className={`rioglyph ${iconName}`} />}\n {children}\n </button>\n );\n}) as ButtonType;\n\nObject.assign(Button, STYLES_MAP);\nObject.assign(Button, VARIANTS_MAP);\nObject.assign(Button, SIZES_MAP);\n\nexport default Button;\n"],"names":["STYLES_MAP","VARIANTS_MAP","SIZES_MAP","Button","forwardRef","props","ref","as","active","disabled","asToggle","onClick","noop","bsStyle","bsSize","variant","iconOnly","iconName","iconRight","multiline","block","hoverScale","className","noRippleEffect","autoTrackingKey","type","tabIndex","children","remainingProps","autoTrackingAttributes","getAutoTrackingAttributes","isToggled","setIsToggled","useState","btnRef","useRef","buttonRef","useMergeRefs","previousActive","setPreviousActive","handleButtonClick","event","createButtonRipple","newIsToggled","handleLinkClick","buttonClassNames","classNames","jsxs","jsx"],"mappings":";;;;;;;AAiBO,MAAMA,IAAa;AAAA,EACtB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,cAAc;AAClB,GAKaC,IAAe;AAAA,EACxB,cAAc;AAAA,EACd,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,gBAAgB;AACpB,GAIaC,IAAY;AAAA,EACrB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACR,GAsOMC,IAASC,EAAqC,CAACC,GAAOC,MAAQ;AAChE,QAAM;AAAA,IACF,IAAAC,IAAK;AAAA,IACL,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,UAAAC,IAAW;AAAA,IACX,SAAAC,IAAUC;AAAA,IACV,SAAAC,IAAU;AAAA,IACV,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IAC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Ca,KAAU,OAAOA,CAAM;AAAA,IACvBJ,KAAY;AAAA,IACZqB,KAAa;AAAA,IACbf,KAAY;AAAA,IACZE,KAAa;AAAA,IACbC,KAAa;AAAA,IACbC,KAAS;AAAA,IACTC,KAAc;AAAA,IACdd,MAAO,OAAO;AAAA,IACdA,MAAO,OAAOE,KAAY;AAAA,IAC1B;AAAA,IACAa;AAAA,EAAA;AAGJ,SAAIf,MAAO,MAEH,gBAAAwC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKX;AAAA,MACJ,GAAIR;AAAA,MACJ,GAAGC;AAAA,MACJ,WAAWgB;AAAA,MACX,SAASD;AAAA,MACT,iBAAenC,KAAY;AAAA,MAC3B,UAAUA,IAAW,KAAKiB;AAAA,MAEzB,UAAA;AAAA,QAAAT,KAAY,gBAAA+B,EAAC,QAAA,EAAK,WAAW,YAAY/B,CAAQ,IAAI;AAAA,QACrDU;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAMT,gBAAAoB;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKX;AAAA,MACL,MAAAX;AAAA,MACC,GAAIG;AAAA,MACJ,GAAGC;AAAA,MACJ,WAAWgB;AAAA,MACX,SAASL;AAAA,MACT,UAAA/B;AAAA,MACA,UAAAiB;AAAA,MAEC,UAAA;AAAA,QAAAT,KAAY,gBAAA+B,EAAC,QAAA,EAAK,WAAW,YAAY/B,CAAQ,IAAI;AAAA,QACrDU;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb,CAAC;AAED,OAAO,OAAOxB,GAAQH,CAAU;AAChC,OAAO,OAAOG,GAAQF,CAAY;AAClC,OAAO,OAAOE,GAAQD,CAAS;"}
@@ -2,11 +2,11 @@ import { jsx as n } from "react/jsx-runtime";
2
2
  import { useState as i, useEffect as m } from "react";
3
3
  import p from "../../../dropdown/ButtonDropdown.js";
4
4
  import { TABLE_HORIZONTAL_SCROLL_EVENT as r } from "../../layout/useHorizontalSectionSync.js";
5
- const h = ({ items: a, dropdownClassName: o, ...s }) => {
5
+ const w = ({ items: a, dropdownClassName: t, ...s }) => {
6
6
  const [l, e] = i(!1);
7
7
  return m(() => {
8
- const t = () => e(!1);
9
- return window.addEventListener(r, t), () => window.removeEventListener(r, t);
8
+ const o = () => e(!1);
9
+ return window.addEventListener(r, o), () => window.removeEventListener(r, o);
10
10
  }, []), /* @__PURE__ */ n(
11
11
  p,
12
12
  {
@@ -14,17 +14,18 @@ const h = ({ items: a, dropdownClassName: o, ...s }) => {
14
14
  title: /* @__PURE__ */ n("span", { className: "rioglyph rioglyph-checkboxes" }),
15
15
  variant: "outline",
16
16
  bsSize: "sm",
17
- toggleClassName: "table-batch-dropdown-button no-hover-scale",
18
- dropdownClassName: o ? `text-normal ${o}` : "text-normal",
17
+ toggleClassName: "table-batch-dropdown-button",
18
+ dropdownClassName: t ? `text-normal ${t}` : "text-normal",
19
19
  iconOnly: !0,
20
20
  items: a,
21
21
  open: l,
22
22
  onOpen: () => e(!0),
23
- onClose: () => e(!1)
23
+ onClose: () => e(!1),
24
+ usePortal: !0
24
25
  }
25
26
  );
26
27
  };
27
28
  export {
28
- h as default
29
+ w as default
29
30
  };
30
31
  //# sourceMappingURL=TableBatchDropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableBatchDropdown.js","sources":["../../../../../src/components/table/render/header/TableBatchDropdown.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport ButtonDropdown, { type ButtonDropdownProps } from '../../../dropdown/ButtonDropdown';\nimport { TABLE_HORIZONTAL_SCROLL_EVENT } from '../../layout/useHorizontalSectionSync';\n\nexport type TableBatchDropdownProps = {\n /**\n * Dropdown items rendered for batch actions in the selection header.\n */\n items: NonNullable<ButtonDropdownProps['items']>;\n\n /**\n * Optional class names for the dropdown menu.\n */\n dropdownClassName?: ButtonDropdownProps['dropdownClassName'];\n};\n\nconst TableBatchDropdown = ({ items, dropdownClassName, ...remainingProps }: TableBatchDropdownProps) => {\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n const handleHorizontalScroll = () => setOpen(false);\n\n window.addEventListener(TABLE_HORIZONTAL_SCROLL_EVENT, handleHorizontalScroll);\n\n return () => window.removeEventListener(TABLE_HORIZONTAL_SCROLL_EVENT, handleHorizontalScroll);\n }, []);\n\n return (\n <ButtonDropdown\n {...remainingProps}\n title={<span className='rioglyph rioglyph-checkboxes' />}\n variant='outline'\n bsSize='sm'\n toggleClassName='table-batch-dropdown-button no-hover-scale'\n dropdownClassName={dropdownClassName ? `text-normal ${dropdownClassName}` : 'text-normal'}\n iconOnly\n items={items}\n open={open}\n onOpen={() => setOpen(true)}\n onClose={() => setOpen(false)}\n />\n );\n};\n\nexport default TableBatchDropdown;\n"],"names":["TableBatchDropdown","items","dropdownClassName","remainingProps","open","setOpen","useState","useEffect","handleHorizontalScroll","TABLE_HORIZONTAL_SCROLL_EVENT","jsx","ButtonDropdown"],"mappings":";;;;AAiBA,MAAMA,IAAqB,CAAC,EAAE,OAAAC,GAAO,mBAAAC,GAAmB,GAAGC,QAA8C;AACrG,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAK;AAEtC,SAAAC,EAAU,MAAM;AACZ,UAAMC,IAAyB,MAAMH,EAAQ,EAAK;AAElD,kBAAO,iBAAiBI,GAA+BD,CAAsB,GAEtE,MAAM,OAAO,oBAAoBC,GAA+BD,CAAsB;AAAA,EACjG,GAAG,CAAA,CAAE,GAGD,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGR;AAAA,MACJ,OAAO,gBAAAO,EAAC,QAAA,EAAK,WAAU,+BAAA,CAA+B;AAAA,MACtD,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,iBAAgB;AAAA,MAChB,mBAAmBR,IAAoB,eAAeA,CAAiB,KAAK;AAAA,MAC5E,UAAQ;AAAA,MACR,OAAAD;AAAA,MACA,MAAAG;AAAA,MACA,QAAQ,MAAMC,EAAQ,EAAI;AAAA,MAC1B,SAAS,MAAMA,EAAQ,EAAK;AAAA,IAAA;AAAA,EAAA;AAGxC;"}
1
+ {"version":3,"file":"TableBatchDropdown.js","sources":["../../../../../src/components/table/render/header/TableBatchDropdown.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport ButtonDropdown, { type ButtonDropdownProps } from '../../../dropdown/ButtonDropdown';\nimport { TABLE_HORIZONTAL_SCROLL_EVENT } from '../../layout/useHorizontalSectionSync';\n\nexport type TableBatchDropdownProps = {\n /**\n * Dropdown items rendered for batch actions in the selection header.\n */\n items: NonNullable<ButtonDropdownProps['items']>;\n\n /**\n * Optional class names for the dropdown menu.\n */\n dropdownClassName?: ButtonDropdownProps['dropdownClassName'];\n};\n\nconst TableBatchDropdown = ({ items, dropdownClassName, ...remainingProps }: TableBatchDropdownProps) => {\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n const handleHorizontalScroll = () => setOpen(false);\n\n window.addEventListener(TABLE_HORIZONTAL_SCROLL_EVENT, handleHorizontalScroll);\n\n return () => window.removeEventListener(TABLE_HORIZONTAL_SCROLL_EVENT, handleHorizontalScroll);\n }, []);\n\n return (\n <ButtonDropdown\n {...remainingProps}\n title={<span className='rioglyph rioglyph-checkboxes' />}\n variant='outline'\n bsSize='sm'\n toggleClassName='table-batch-dropdown-button'\n dropdownClassName={dropdownClassName ? `text-normal ${dropdownClassName}` : 'text-normal'}\n iconOnly\n items={items}\n open={open}\n onOpen={() => setOpen(true)}\n onClose={() => setOpen(false)}\n usePortal\n />\n );\n};\n\nexport default TableBatchDropdown;\n"],"names":["TableBatchDropdown","items","dropdownClassName","remainingProps","open","setOpen","useState","useEffect","handleHorizontalScroll","TABLE_HORIZONTAL_SCROLL_EVENT","jsx","ButtonDropdown"],"mappings":";;;;AAiBA,MAAMA,IAAqB,CAAC,EAAE,OAAAC,GAAO,mBAAAC,GAAmB,GAAGC,QAA8C;AACrG,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAK;AAEtC,SAAAC,EAAU,MAAM;AACZ,UAAMC,IAAyB,MAAMH,EAAQ,EAAK;AAElD,kBAAO,iBAAiBI,GAA+BD,CAAsB,GAEtE,MAAM,OAAO,oBAAoBC,GAA+BD,CAAsB;AAAA,EACjG,GAAG,CAAA,CAAE,GAGD,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGR;AAAA,MACJ,OAAO,gBAAAO,EAAC,QAAA,EAAK,WAAU,+BAAA,CAA+B;AAAA,MACtD,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,iBAAgB;AAAA,MAChB,mBAAmBR,IAAoB,eAAeA,CAAiB,KAAK;AAAA,MAC5E,UAAQ;AAAA,MACR,OAAAD;AAAA,MACA,MAAAG;AAAA,MACA,QAAQ,MAAMC,EAAQ,EAAI;AAAA,MAC1B,SAAS,MAAMA,EAAQ,EAAK;AAAA,MAC5B,WAAS;AAAA,IAAA;AAAA,EAAA;AAGrB;"}
@@ -5,7 +5,7 @@ import S from "../../../dropdown/ButtonDropdown.js";
5
5
  import { TABLE_HORIZONTAL_SCROLL_EVENT as p } from "../../layout/useHorizontalSectionSync.js";
6
6
  const j = (d) => {
7
7
  const {
8
- activeCount: a = 0,
8
+ activeCount: i = 0,
9
9
  active: c = !1,
10
10
  children: m,
11
11
  className: f,
@@ -13,13 +13,13 @@ const j = (d) => {
13
13
  id: g,
14
14
  onClose: o,
15
15
  onOpen: h,
16
- open: i,
17
- popperConfig: v,
18
- pullRight: C = !0,
16
+ open: a,
17
+ popperConfig: C,
18
+ pullRight: v = !0,
19
19
  toggleClassName: N,
20
20
  usePortal: O = !0,
21
21
  ...b
22
- } = d, [x, n] = y(!1), e = i !== void 0, r = e ? i : x, l = a > 0;
22
+ } = d, [x, n] = y(!1), e = a !== void 0, r = e ? a : x, l = i > 0;
23
23
  return E(() => {
24
24
  const t = () => {
25
25
  r && (e || n(!1), o?.());
@@ -38,7 +38,7 @@ const j = (d) => {
38
38
  "aria-hidden": "true"
39
39
  }
40
40
  ),
41
- l && /* @__PURE__ */ s("span", { className: "text-medium", children: a })
41
+ l && /* @__PURE__ */ s("span", { className: "text-medium", children: i })
42
42
  ] }),
43
43
  bsStyle: "default",
44
44
  variant: "outline",
@@ -52,12 +52,12 @@ const j = (d) => {
52
52
  onClose: () => {
53
53
  e || n(!1), o?.();
54
54
  },
55
- pullRight: C,
55
+ pullRight: v,
56
56
  usePortal: O,
57
57
  className: f,
58
- popperConfig: v,
58
+ popperConfig: C,
59
59
  toggleClassName: L(
60
- "table-head-filter-button no-hover-scale border-color-light bg-decent hover-bg-lighter rounded-small",
60
+ "table-head-filter-button border-color-light bg-decent hover-bg-lighter rounded-small",
61
61
  l && "padding-left-2",
62
62
  N
63
63
  ),
@@ -1 +1 @@
1
- {"version":3,"file":"TableColumnFilter.js","sources":["../../../../../src/components/table/render/header/TableColumnFilter.tsx"],"sourcesContent":["import { useEffect, useState, type HTMLAttributes, type ReactNode } from 'react';\n\nimport classNames from '../../../../utils/classNames';\nimport ButtonDropdown, { type ButtonDropdownProps } from '../../../dropdown/ButtonDropdown';\nimport { TABLE_HORIZONTAL_SCROLL_EVENT } from '../../layout/useHorizontalSectionSync';\n\nexport type TableColumnFilterProps = Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children' | 'className' | 'onClick' | 'role'\n> & {\n /**\n * Custom dropdown content rendered below the filter trigger.\n */\n children?: ReactNode;\n\n /**\n * Optional classes for the outer dropdown component.\n */\n className?: ButtonDropdownProps['className'];\n\n /**\n * Optional classes for the dropdown menu.\n */\n dropdownClassName?: ButtonDropdownProps['dropdownClassName'];\n\n /**\n * Optional DOM id for the dropdown trigger.\n */\n id?: ButtonDropdownProps['id'];\n\n /**\n * Called when the dropdown closes.\n */\n onClose?: ButtonDropdownProps['onClose'];\n\n /**\n * Called when the dropdown opens.\n */\n onOpen?: ButtonDropdownProps['onOpen'];\n\n /**\n * Controlled open state for the dropdown.\n */\n open?: ButtonDropdownProps['open'];\n\n /**\n * Optional Popper configuration passed to the underlying dropdown.\n */\n popperConfig?: ButtonDropdownProps['popperConfig'];\n\n /**\n * Aligns the dropdown menu to the right side of the trigger.\n *\n * @default true\n */\n pullRight?: ButtonDropdownProps['pullRight'];\n\n /**\n * Optional classes for the dropdown toggle button.\n */\n toggleClassName?: ButtonDropdownProps['toggleClassName'];\n\n /**\n * Renders the dropdown through a portal.\n *\n * @default true\n */\n usePortal?: ButtonDropdownProps['usePortal'];\n\n /**\n * Renders the active filter icon variant.\n *\n * @default false\n */\n active?: boolean;\n\n /**\n * Optional number of currently active filters shown next to the filter icon.\n *\n * @default 0\n */\n activeCount?: number;\n};\n\nconst TableColumnFilter = (props: TableColumnFilterProps) => {\n const {\n activeCount = 0,\n active = false,\n children,\n className,\n dropdownClassName,\n id,\n onClose,\n onOpen,\n open,\n popperConfig,\n pullRight = true,\n toggleClassName,\n usePortal = true,\n ...remainingProps\n } = props;\n\n const [internalOpen, setInternalOpen] = useState(false);\n\n const isControlled = open !== undefined;\n const isOpen = isControlled ? open : internalOpen;\n const hasActiveFilters = activeCount > 0;\n\n useEffect(() => {\n const handleHorizontalScroll = () => {\n if (!isOpen) {\n return;\n }\n\n if (!isControlled) {\n setInternalOpen(false);\n }\n\n onClose?.();\n };\n\n window.addEventListener(TABLE_HORIZONTAL_SCROLL_EVENT, handleHorizontalScroll);\n\n return () => window.removeEventListener(TABLE_HORIZONTAL_SCROLL_EVENT, handleHorizontalScroll);\n }, [isControlled, isOpen, onClose]);\n\n return (\n <ButtonDropdown\n {...remainingProps}\n id={id}\n title={\n <span className='display-flex gap-0 align-items-center text-color-dark'>\n <span\n className={`text-size-16 rioglyph ${active ? 'rioglyph-filter-active' : 'rioglyph-filter'}`}\n aria-hidden='true'\n />\n {hasActiveFilters && <span className='text-medium'>{activeCount}</span>}\n </span>\n }\n bsStyle='default'\n variant='outline'\n bsSize='xs'\n noCaret\n iconOnly={!hasActiveFilters}\n open={isOpen}\n onOpen={event => {\n if (!isControlled) {\n setInternalOpen(true);\n }\n\n onOpen?.(event);\n }}\n onClose={() => {\n if (!isControlled) {\n setInternalOpen(false);\n }\n\n onClose?.();\n }}\n pullRight={pullRight}\n usePortal={usePortal}\n className={className}\n popperConfig={popperConfig}\n toggleClassName={classNames(\n 'table-head-filter-button no-hover-scale border-color-light bg-decent hover-bg-lighter rounded-small',\n hasActiveFilters && 'padding-left-2',\n toggleClassName\n )}\n dropdownClassName={dropdownClassName}\n customDropdown={children}\n />\n );\n};\n\nexport default TableColumnFilter;\n"],"names":["TableColumnFilter","props","activeCount","active","children","className","dropdownClassName","id","onClose","onOpen","open","popperConfig","pullRight","toggleClassName","usePortal","remainingProps","internalOpen","setInternalOpen","useState","isControlled","isOpen","hasActiveFilters","useEffect","handleHorizontalScroll","TABLE_HORIZONTAL_SCROLL_EVENT","jsx","ButtonDropdown","jsxs","event","classNames"],"mappings":";;;;;AAoFA,MAAMA,IAAoB,CAACC,MAAkC;AACzD,QAAM;AAAA,IACF,aAAAC,IAAc;AAAA,IACd,QAAAC,IAAS;AAAA,IACT,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,IAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,iBAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,GAAGC;AAAA,EAAA,IACHd,GAEE,CAACe,GAAcC,CAAe,IAAIC,EAAS,EAAK,GAEhDC,IAAeT,MAAS,QACxBU,IAASD,IAAeT,IAAOM,GAC/BK,IAAmBnB,IAAc;AAEvC,SAAAoB,EAAU,MAAM;AACZ,UAAMC,IAAyB,MAAM;AACjC,MAAKH,MAIAD,KACDF,EAAgB,EAAK,GAGzBT,IAAA;AAAA,IACJ;AAEA,kBAAO,iBAAiBgB,GAA+BD,CAAsB,GAEtE,MAAM,OAAO,oBAAoBC,GAA+BD,CAAsB;AAAA,EACjG,GAAG,CAACJ,GAAcC,GAAQZ,CAAO,CAAC,GAG9B,gBAAAiB;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGX;AAAA,MACJ,IAAAR;AAAA,MACA,OACI,gBAAAoB,EAAC,QAAA,EAAK,WAAU,yDACZ,UAAA;AAAA,QAAA,gBAAAF;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAW,yBAAyBtB,IAAS,2BAA2B,iBAAiB;AAAA,YACzF,eAAY;AAAA,UAAA;AAAA,QAAA;AAAA,QAEfkB,KAAoB,gBAAAI,EAAC,QAAA,EAAK,WAAU,eAAe,UAAAvB,EAAA,CAAY;AAAA,MAAA,GACpE;AAAA,MAEJ,SAAQ;AAAA,MACR,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,SAAO;AAAA,MACP,UAAU,CAACmB;AAAA,MACX,MAAMD;AAAA,MACN,QAAQ,CAAAQ,MAAS;AACb,QAAKT,KACDF,EAAgB,EAAI,GAGxBR,IAASmB,CAAK;AAAA,MAClB;AAAA,MACA,SAAS,MAAM;AACX,QAAKT,KACDF,EAAgB,EAAK,GAGzBT,IAAA;AAAA,MACJ;AAAA,MACA,WAAAI;AAAA,MACA,WAAAE;AAAA,MACA,WAAAT;AAAA,MACA,cAAAM;AAAA,MACA,iBAAiBkB;AAAA,QACb;AAAA,QACAR,KAAoB;AAAA,QACpBR;AAAA,MAAA;AAAA,MAEJ,mBAAAP;AAAA,MACA,gBAAgBF;AAAA,IAAA;AAAA,EAAA;AAG5B;"}
1
+ {"version":3,"file":"TableColumnFilter.js","sources":["../../../../../src/components/table/render/header/TableColumnFilter.tsx"],"sourcesContent":["import { useEffect, useState, type HTMLAttributes, type ReactNode } from 'react';\n\nimport classNames from '../../../../utils/classNames';\nimport ButtonDropdown, { type ButtonDropdownProps } from '../../../dropdown/ButtonDropdown';\nimport { TABLE_HORIZONTAL_SCROLL_EVENT } from '../../layout/useHorizontalSectionSync';\n\nexport type TableColumnFilterProps = Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children' | 'className' | 'onClick' | 'role'\n> & {\n /**\n * Custom dropdown content rendered below the filter trigger.\n */\n children?: ReactNode;\n\n /**\n * Optional classes for the outer dropdown component.\n */\n className?: ButtonDropdownProps['className'];\n\n /**\n * Optional classes for the dropdown menu.\n */\n dropdownClassName?: ButtonDropdownProps['dropdownClassName'];\n\n /**\n * Optional DOM id for the dropdown trigger.\n */\n id?: ButtonDropdownProps['id'];\n\n /**\n * Called when the dropdown closes.\n */\n onClose?: ButtonDropdownProps['onClose'];\n\n /**\n * Called when the dropdown opens.\n */\n onOpen?: ButtonDropdownProps['onOpen'];\n\n /**\n * Controlled open state for the dropdown.\n */\n open?: ButtonDropdownProps['open'];\n\n /**\n * Optional Popper configuration passed to the underlying dropdown.\n */\n popperConfig?: ButtonDropdownProps['popperConfig'];\n\n /**\n * Aligns the dropdown menu to the right side of the trigger.\n *\n * @default true\n */\n pullRight?: ButtonDropdownProps['pullRight'];\n\n /**\n * Optional classes for the dropdown toggle button.\n */\n toggleClassName?: ButtonDropdownProps['toggleClassName'];\n\n /**\n * Renders the dropdown through a portal.\n *\n * @default true\n */\n usePortal?: ButtonDropdownProps['usePortal'];\n\n /**\n * Renders the active filter icon variant.\n *\n * @default false\n */\n active?: boolean;\n\n /**\n * Optional number of currently active filters shown next to the filter icon.\n *\n * @default 0\n */\n activeCount?: number;\n};\n\nconst TableColumnFilter = (props: TableColumnFilterProps) => {\n const {\n activeCount = 0,\n active = false,\n children,\n className,\n dropdownClassName,\n id,\n onClose,\n onOpen,\n open,\n popperConfig,\n pullRight = true,\n toggleClassName,\n usePortal = true,\n ...remainingProps\n } = props;\n\n const [internalOpen, setInternalOpen] = useState(false);\n\n const isControlled = open !== undefined;\n const isOpen = isControlled ? open : internalOpen;\n const hasActiveFilters = activeCount > 0;\n\n useEffect(() => {\n const handleHorizontalScroll = () => {\n if (!isOpen) {\n return;\n }\n\n if (!isControlled) {\n setInternalOpen(false);\n }\n\n onClose?.();\n };\n\n window.addEventListener(TABLE_HORIZONTAL_SCROLL_EVENT, handleHorizontalScroll);\n\n return () => window.removeEventListener(TABLE_HORIZONTAL_SCROLL_EVENT, handleHorizontalScroll);\n }, [isControlled, isOpen, onClose]);\n\n return (\n <ButtonDropdown\n {...remainingProps}\n id={id}\n title={\n <span className='display-flex gap-0 align-items-center text-color-dark'>\n <span\n className={`text-size-16 rioglyph ${active ? 'rioglyph-filter-active' : 'rioglyph-filter'}`}\n aria-hidden='true'\n />\n {hasActiveFilters && <span className='text-medium'>{activeCount}</span>}\n </span>\n }\n bsStyle='default'\n variant='outline'\n bsSize='xs'\n noCaret\n iconOnly={!hasActiveFilters}\n open={isOpen}\n onOpen={event => {\n if (!isControlled) {\n setInternalOpen(true);\n }\n\n onOpen?.(event);\n }}\n onClose={() => {\n if (!isControlled) {\n setInternalOpen(false);\n }\n\n onClose?.();\n }}\n pullRight={pullRight}\n usePortal={usePortal}\n className={className}\n popperConfig={popperConfig}\n toggleClassName={classNames(\n 'table-head-filter-button border-color-light bg-decent hover-bg-lighter rounded-small',\n hasActiveFilters && 'padding-left-2',\n toggleClassName\n )}\n dropdownClassName={dropdownClassName}\n customDropdown={children}\n />\n );\n};\n\nexport default TableColumnFilter;\n"],"names":["TableColumnFilter","props","activeCount","active","children","className","dropdownClassName","id","onClose","onOpen","open","popperConfig","pullRight","toggleClassName","usePortal","remainingProps","internalOpen","setInternalOpen","useState","isControlled","isOpen","hasActiveFilters","useEffect","handleHorizontalScroll","TABLE_HORIZONTAL_SCROLL_EVENT","jsx","ButtonDropdown","jsxs","event","classNames"],"mappings":";;;;;AAoFA,MAAMA,IAAoB,CAACC,MAAkC;AACzD,QAAM;AAAA,IACF,aAAAC,IAAc;AAAA,IACd,QAAAC,IAAS;AAAA,IACT,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,IAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,iBAAAC;AA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,QACpBR;AAAA,MAAA;AAAA,MAEJ,mBAAAP;AAAA,MACA,gBAAgBF;AAAA,IAAA;AAAA,EAAA;AAG5B;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rio-cloud/rio-uikit",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "The RIO UIKIT component library",
5
5
  "repository": {
6
6
  "type": "git",
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export const version: "2.5.0";
1
+ export const version: "2.5.1";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = "2.5.0";
1
+ const o = "2.5.1";
2
2
  export {
3
3
  o as version
4
4
  };
package/version.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../src/version.js"],"sourcesContent":["export const version = '2.5.0';\n"],"names":["version"],"mappings":"AAAY,MAACA,IAAU;"}
1
+ {"version":3,"file":"version.js","sources":["../src/version.js"],"sourcesContent":["export const version = '2.5.1';\n"],"names":["version"],"mappings":"AAAY,MAACA,IAAU;"}