@pk-design/react-tailwind 1.4.3 → 1.5.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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { AccordionProps } from './Accordion.types';
3
+ export declare const Accordion: React.FC<AccordionProps>;
@@ -0,0 +1,85 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * Single accordion item.
4
+ */
5
+ export type AccordionItem = {
6
+ /** Header content for this item */
7
+ title: ReactNode;
8
+ /** Content rendered in the collapsible panel when this item is open */
9
+ content: ReactNode;
10
+ /** Optional icon rendered before the title */
11
+ icon?: ReactNode;
12
+ /** Unique key for this item; falls back to index when omitted */
13
+ id?: string | number;
14
+ /** Prevents this item from being opened/closed */
15
+ disabled?: boolean;
16
+ /** Extra classes applied to this specific item's header button */
17
+ titleClass?: string;
18
+ /** Extra classes applied to this specific item's panel content */
19
+ panelClass?: string;
20
+ };
21
+ /**
22
+ * Whether one or multiple items can be open at the same time.
23
+ *
24
+ * @default "single"
25
+ */
26
+ export type AccordionType = 'single' | 'multiple';
27
+ /**
28
+ * Visual style of the accordion.
29
+ *
30
+ * - **bordered** (default): items share a single bordered container, divided by hairlines
31
+ * - **separated**: each item renders as its own bordered card with spacing between items
32
+ * - **plain**: no borders, just a divided list
33
+ *
34
+ * @default "bordered"
35
+ */
36
+ export type AccordionVariant = 'bordered' | 'separated' | 'plain';
37
+ /**
38
+ * Accordion component props.
39
+ */
40
+ export interface AccordionProps {
41
+ /** Item data array. Order defines visual order. */
42
+ items: AccordionItem[];
43
+ /**
44
+ * Whether one or multiple items can be open at the same time.
45
+ *
46
+ * @default "single"
47
+ */
48
+ type?: AccordionType;
49
+ /**
50
+ * Visual style of the accordion.
51
+ *
52
+ * @default "bordered"
53
+ */
54
+ variant?: AccordionVariant;
55
+ /**
56
+ * When `type="single"`, whether clicking the currently open item's header
57
+ * closes it. Has no effect when `type="multiple"`.
58
+ *
59
+ * @default true
60
+ */
61
+ collapsible?: boolean;
62
+ /** Initially open item id(s) (uncontrolled) */
63
+ defaultOpenIds?: Array<string | number>;
64
+ /** Controlled open item id(s) — pair with onChange */
65
+ openIds?: Array<string | number>;
66
+ /** Called with the new open id(s) whenever an item is toggled */
67
+ onChange?: (openIds: Array<string | number>) => void;
68
+ /**
69
+ * Custom trailing indicator icon rendered in place of the default chevron.
70
+ *
71
+ * - Pass a `ReactNode` to swap the icon while keeping the default
72
+ * rotate-180°-on-open behavior.
73
+ * - Pass a function of the item's open state for full control (e.g.
74
+ * swapping between plus/minus icons instead of rotating).
75
+ *
76
+ * @default undefined (renders the built-in chevron)
77
+ */
78
+ expandIcon?: ReactNode | ((isOpen: boolean) => ReactNode);
79
+ /** Extra classes for the outer container */
80
+ className?: string;
81
+ /** Extra classes applied to every item's header button */
82
+ titleClass?: string;
83
+ /** Extra classes applied to every item's panel content */
84
+ panelClass?: string;
85
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Accordion';
2
+ export * from './Accordion.types';
@@ -24,4 +24,5 @@ export interface BodyTextProps extends HTMLAttributes<HTMLParagraphElement> {
24
24
  * JSX element to be render in place of `p`
25
25
  */
26
26
  as?: keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
27
+ invert?: boolean;
27
28
  }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { ButtonGroupProps } from './ButtonGroup.types';
3
+ export declare const ButtonGroup: React.FC<ButtonGroupProps>;
@@ -0,0 +1,70 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ButtonSize, ButtonTheme, ButtonVariant } from '../Button/Button.types';
3
+ /**
4
+ * Layout direction of a ButtonGroup.
5
+ *
6
+ * @default "horizontal"
7
+ */
8
+ export type ButtonGroupOrientation = 'horizontal' | 'vertical';
9
+ /**
10
+ * ButtonGroup component props.
11
+ */
12
+ export interface ButtonGroupProps {
13
+ /**
14
+ * `Button` elements to render as a single joined control.
15
+ *
16
+ * Each child may still set its own `theme`/`variant`/`size`/`className`
17
+ * to override the group's fallback styling (e.g. a colored icon).
18
+ */
19
+ children: ReactNode;
20
+ /**
21
+ * Layout direction of the group.
22
+ *
23
+ * - **horizontal** (default): buttons sit side by side, divided by a vertical hairline.
24
+ * - **vertical**: buttons stack top to bottom, divided by a horizontal hairline.
25
+ *
26
+ * @default "horizontal"
27
+ */
28
+ orientation?: ButtonGroupOrientation;
29
+ /**
30
+ * Fallback theme applied to child buttons that don't set their own `theme`.
31
+ *
32
+ * @default "secondary"
33
+ */
34
+ theme?: ButtonTheme;
35
+ /**
36
+ * Fallback variant applied to child buttons that don't set their own `variant`.
37
+ *
38
+ * @default "default"
39
+ */
40
+ variant?: ButtonVariant;
41
+ /**
42
+ * Fallback size applied to child buttons that don't set their own `size`.
43
+ *
44
+ * @default "md"
45
+ */
46
+ size?: ButtonSize;
47
+ /**
48
+ * Rounds the group's outer corners into a full pill shape instead of the
49
+ * size-matched corner radius.
50
+ *
51
+ * @default false
52
+ */
53
+ rounded?: boolean;
54
+ /**
55
+ * Stretches child buttons to share the group's width (horizontal) or
56
+ * height (vertical) equally.
57
+ *
58
+ * @default false
59
+ */
60
+ fullWidth?: boolean;
61
+ /**
62
+ * Accessible label describing the purpose of the group.
63
+ * Rendered as `aria-label` on the `role="group"` container.
64
+ */
65
+ label?: string;
66
+ /**
67
+ * Additional classNames merged onto the outer container.
68
+ */
69
+ className?: string;
70
+ }
@@ -0,0 +1,2 @@
1
+ export * from './ButtonGroup';
2
+ export * from './ButtonGroup.types';
@@ -1,4 +1,4 @@
1
1
  import type { SortIconKey, Sorting } from './DataTable.types';
2
2
  import type { ReactNode } from 'react';
3
3
  export declare const SortIconMap: Record<SortIconKey, ReactNode>;
4
- export declare const getSortIcon: (sort?: Sorting) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
4
+ export declare const getSortIcon: (sort?: Sorting) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
@@ -1,2 +1,2 @@
1
1
  import type { BaseOption, SelectBoxProps } from './SelectBox.types';
2
- export declare const SelectBox: import("react").ForwardRefExoticComponent<SelectBoxProps<string | BaseOption> & import("react").RefAttributes<HTMLInputElement | HTMLDivElement>>;
2
+ export declare const SelectBox: import("react").ForwardRefExoticComponent<SelectBoxProps<string | BaseOption> & import("react").RefAttributes<HTMLDivElement | HTMLInputElement>>;
@@ -48,6 +48,17 @@ export interface SelectBoxProps<T extends BaseOption | string = BaseOption> {
48
48
  placeholder?: string;
49
49
  /** CSS classes applied to the dropdown options container */
50
50
  dropdownContainerClass?: string;
51
+ /**
52
+ * Whether the open dropdown traps focus and makes the rest of the page
53
+ * inert (Headless UI's default Combobox behavior). Disabled by default so
54
+ * elements rendered inside the control itself — like the `allowClear`
55
+ * button — and the rest of the page stay interactive while the dropdown
56
+ * is open, matching common combobox libraries (e.g. react-select). Set to
57
+ * `true` to restore Headless UI's modal focus-trapping behavior.
58
+ *
59
+ * @default false
60
+ */
61
+ modalDropdown?: boolean;
51
62
  /** Enable multiple selection mode */
52
63
  multiple?: boolean;
53
64
  /** Maximum number of selections allowed in multi-select mode */
@@ -80,6 +91,13 @@ export interface SelectBoxProps<T extends BaseOption | string = BaseOption> {
80
91
  allowAdd?: boolean;
81
92
  /** Label prefix for the “Add new” action (e.g., "Create") */
82
93
  addNewText?: string;
94
+ /**
95
+ * Message shown in the dropdown when `options` is empty and the user
96
+ * hasn't typed a search query yet.
97
+ *
98
+ * @default "No options available"
99
+ */
100
+ noOptionsText?: string;
83
101
  /**
84
102
  * Callback when the user chooses the "create/add" option.
85
103
  *
@@ -1,10 +1,12 @@
1
1
  import './styles/tokens.css';
2
+ export * from './components/Accordion';
2
3
  export * from './components/Alert';
3
4
  export * from './components/Badge';
4
5
  export * from './components/Banner';
5
6
  export * from './components/BodyText';
6
7
  export * from './components/Breadcrumb';
7
8
  export * from './components/Button';
9
+ export * from './components/ButtonGroup';
8
10
  export * from './components/Card';
9
11
  export * from './components/Checkbox';
10
12
  export * from './components/CheckboxGroup';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pk-design/react-tailwind",
3
- "version": "1.4.3",
3
+ "version": "1.5.0",
4
4
  "main": "dist/react-tailwind.cjs.js",
5
5
  "module": "dist/react-tailwind.es.js",
6
6
  "types": "dist/types/index.d.ts",