@kenlo/kdls-design-system 2.9.2 → 2.10.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.
@@ -21,7 +21,7 @@ export interface BadgeProps {
21
21
  iconRightLoading?: boolean;
22
22
  /** Disables iconRight — blocks the click and applies the disabled icon color */
23
23
  iconRightDisabled?: boolean;
24
- /** Size: sm (12px) | md (14px) | lg (16px) */
24
+ /** Size: sm (12px label, 24px box) | md (16px label, 28px box) | lg (16px label, 32px box) */
25
25
  size?: BadgeSize;
26
26
  /** Width: 'hug' = content | 'fill' = 100% */
27
27
  width?: 'hug' | 'fill';
@@ -1,15 +1,18 @@
1
1
  import React from 'react';
2
2
  import './IconButton.css';
3
3
  import { IconElement } from '../Icon/Icon';
4
- export type IconButtonSize = 'sm' | 'md' | 'lg';
5
- export interface IconButtonProps {
4
+ export type IconButtonSize = 'xs' | 'sm' | 'md' | 'lg';
5
+ export type IconButtonVariant = 'neutral' | 'primary' | 'inverse';
6
+ export interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'disabled' | 'aria-label' | 'className' | 'type'> {
6
7
  /** Icon to display — e.g. <DeleteRegular /> */
7
8
  icon: IconElement;
8
9
  /** Callback fired when clicking the button. Not called when disabled or isLoading are active */
9
10
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
10
- /** 'primary' = theme color (default) · 'neutral' = gray. Use 'neutral' for chevrons and secondary actions */
11
- variant?: 'neutral' | 'primary';
12
- /** Click-area size — 'sm' 32px (default) · 'md' 40px · 'lg' 48px. The icon itself is always 24px */
11
+ /** 'primary' = theme color (default) · 'neutral' = gray, for chevrons and secondary actions ·
12
+ * 'inverse' = white icon with light overlays, for a button over a photo or a dark surface */
13
+ variant?: IconButtonVariant;
14
+ /** Layout size — 'xs' 24px (the icon alone sits in the line; hover, press and the hit area still
15
+ * reach 32px around it) · 'sm' 32px (default) · 'md' 40px · 'lg' 48px. The icon itself is always 24px */
13
16
  size?: IconButtonSize;
14
17
  /** Shows a spinner in place of the icon and blocks clicks while an async action is in progress */
15
18
  isLoading?: boolean;
@@ -17,6 +20,9 @@ export interface IconButtonProps {
17
20
  disabled?: boolean;
18
21
  /** Accessible label — required: there's no way to derive an automatic label from an arbitrary icon */
19
22
  'aria-label': string;
23
+ /** Whether what this button opens is open — for a menu, drawer or accordion trigger. The other
24
+ * button attributes (aria-*, onKeyDown, title…) also reach the root element */
25
+ 'aria-expanded'?: boolean;
20
26
  /** Additional CSS classes */
21
27
  className?: string;
22
28
  }
@@ -1,2 +1,2 @@
1
1
  export { IconButton } from './IconButton';
2
- export type { IconButtonProps, IconButtonSize } from './IconButton';
2
+ export type { IconButtonProps, IconButtonSize, IconButtonVariant } from './IconButton';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { TooltipPosition } from '../Tooltip';
3
- import { IconButtonSize } from '../IconButton/IconButton';
3
+ import { IconButtonSize, IconButtonVariant } from '../IconButton/IconButton';
4
4
  import { IconElement } from '../Icon/Icon';
5
5
  import './Menu.css';
6
6
  import '../../foundations/Scrollbar/Scrollbar.css';
@@ -66,7 +66,7 @@ interface MenuVariantBranch extends MenuCommonProps {
66
66
  /** variant="iconButton" — the icon to display */
67
67
  buttonIcon?: IconElement;
68
68
  /** variant="iconButton" — color variant (default 'primary') */
69
- iconVariant?: 'neutral' | 'primary';
69
+ iconVariant?: IconButtonVariant;
70
70
  /** variant="iconButton" — button size (default 'sm') */
71
71
  iconSize?: IconButtonSize;
72
72
  /** variant="iconButton" — accessible label */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Modal dialog focus, for Drawer and Modal: on open, focus moves inside (the first control of
3
+ * the body, else the first control of the panel, else the panel itself); Tab and Shift+Tab wrap
4
+ * inside the panel, and come back to it from a floating list the dialog opened; on close, focus
5
+ * returns to the element that had it when the dialog opened, when it is still on the page.
6
+ */
7
+ export declare function useDialogFocus(open: boolean, panelRef: React.RefObject<HTMLElement | null>, bodySelector: string): void;
@@ -2,9 +2,11 @@ import React from 'react';
2
2
  import { IconElement } from '../Icon/Icon';
3
3
  import './Pill.css';
4
4
  interface PillBase {
5
- /** Active/selected state — maps to aria-pressed. Marked as required in the props table — mandatory in every public use together with onClick. Optional in the type to allow internal usage (Select, DatePicker) */
5
+ /** Active/selected state of a filter or toggle pill — maps to aria-pressed. Leave it out for an
6
+ * action pill (one that opens something or navigates): with no `active` the button carries no
7
+ * pressed state at all, so a screen reader announces a plain button */
6
8
  active?: boolean;
7
- /** Callback fired when clicking the Pill. Marked as required in the props table — mandatory in every public use together with active. Optional in the type to allow internal usage (Select, DatePicker) */
9
+ /** Callback fired when clicking the Pill. Marked as required in the props table — mandatory in every public use. Optional in the type to allow internal usage (Select, DatePicker) */
8
10
  onClick?: () => void;
9
11
  /** Icon to the right of the label */
10
12
  iconRight?: IconElement;