opus-toolkit-components 1.9.7 → 1.9.8

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.
@@ -1,19 +1,19 @@
1
- // Accordion Typescript Definitions - update when new props added
2
- export interface AccordionProps {
3
- title: string | React.ReactNode;
4
- handleToggle?: (index: number) => void;
5
- activeIndex?: number;
6
- index: number;
7
- isPreview?: boolean;
8
- isLocked?: boolean;
9
- onExitPreview?: () => void;
10
- content: React.ReactNode;
11
- preview?: React.ReactNode;
12
- isPill?: boolean;
13
- pillText?: string;
14
- pillStatus?: "success" | "warning" | "error" | "info" | string;
15
- pillIcon?: React.ReactNode;
16
- disabled?: boolean;
17
- }
18
-
19
- export const Accordion: React.ComponentType<AccordionProps>;
1
+ // Accordion Typescript Definitions - update when new props added
2
+ export interface AccordionProps {
3
+ title?: string | React.ReactNode;
4
+ handleToggle?: (index: number) => void;
5
+ activeIndex?: number;
6
+ index: number;
7
+ isPreview?: boolean;
8
+ isLocked?: boolean;
9
+ onExitPreview?: () => void;
10
+ content: React.ReactNode;
11
+ preview?: React.ReactNode;
12
+ isPill?: boolean;
13
+ pillText?: string;
14
+ pillStatus?: "success" | "warning" | "error" | "info" | string;
15
+ pillIcon?: React.ReactNode;
16
+ disabled?: boolean;
17
+ }
18
+
19
+ export const Accordion: React.ComponentType<AccordionProps>;
package/lib/main.js CHANGED
@@ -21,54 +21,54 @@ __webpack_require__.r(__webpack_exports__);
21
21
 
22
22
 
23
23
 
24
- /**
25
- * @typedef {Object} AccordionProps
26
- *
27
- * @property {string | React.ReactNode} title
28
- * Title rendered inside the header.
29
- *
30
- * @property {Function} [handleToggle]
31
- * Optional external toggle handler called with (index).
32
- *
33
- * @property {number} [activeIndex]
34
- * Controlled active index. If provided, the accordion becomes controlled.
35
- *
36
- * @property {number} index
37
- * This accordion's position in a list.
38
- *
39
- * @property {boolean} [isPreview]
40
- * If true, accordion goes into preview mode.
41
- *
42
- * @property {boolean} [isLocked]
43
- * If true, accordion cannot toggle.
44
- *
45
- * @property {Function} [onExitPreview]
46
- * Callback fired when exiting preview mode.
47
- *
48
- * @property {React.ReactNode} content
49
- * Accordion expanded content.
50
- *
51
- * @property {React.ReactNode} [preview]
52
- * Rendered when in preview mode and not active.
53
- *
54
- * @property {boolean} [isPill]
55
- * Whether to show a status pill.
56
- *
57
- * @property {string} [pillText]
58
- * Label inside the pill.
59
- *
60
- * @property {'success'|'warning'|'error'|'info'|string} [pillStatus]
61
- * Visual status for the pill.
62
- *
63
- * @property {React.ReactNode} [pillIcon]
64
- * Optional icon inside the pill.
65
- *
66
- * @property {boolean} [disabled]
67
- * Disables interaction with the accordion.
24
+ /**
25
+ * @typedef {Object} AccordionProps
26
+ *
27
+ * @property {string | React.ReactNode} [title]
28
+ * Title rendered inside the header.
29
+ *
30
+ * @property {Function} [handleToggle]
31
+ * Optional external toggle handler called with (index).
32
+ *
33
+ * @property {number} [activeIndex]
34
+ * Controlled active index. If provided, the accordion becomes controlled.
35
+ *
36
+ * @property {number} index
37
+ * This accordion's position in a list.
38
+ *
39
+ * @property {boolean} [isPreview]
40
+ * If true, accordion goes into preview mode.
41
+ *
42
+ * @property {boolean} [isLocked]
43
+ * If true, accordion cannot toggle.
44
+ *
45
+ * @property {Function} [onExitPreview]
46
+ * Callback fired when exiting preview mode.
47
+ *
48
+ * @property {React.ReactNode} content
49
+ * Accordion expanded content.
50
+ *
51
+ * @property {React.ReactNode} [preview]
52
+ * Rendered when in preview mode and not active.
53
+ *
54
+ * @property {boolean} [isPill]
55
+ * Whether to show a status pill.
56
+ *
57
+ * @property {string} [pillText]
58
+ * Label inside the pill.
59
+ *
60
+ * @property {'success'|'warning'|'error'|'info'|string} [pillStatus]
61
+ * Visual status for the pill.
62
+ *
63
+ * @property {React.ReactNode} [pillIcon]
64
+ * Optional icon inside the pill.
65
+ *
66
+ * @property {boolean} [disabled]
67
+ * Disables interaction with the accordion.
68
68
  */
69
69
 
70
- /**
71
- * @param {AccordionProps} props
70
+ /**
71
+ * @param {AccordionProps} props
72
72
  */
73
73
 
74
74
  const Accordion = _ref => {
@@ -89,6 +89,7 @@ const Accordion = _ref => {
89
89
  disabled = false
90
90
  } = _ref;
91
91
  const [internalActiveIndex, setInternalActiveIndex] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);
92
+ const hasTitle = title !== undefined && title !== null && title !== "";
92
93
 
93
94
  // Determine which activeIndex to use: internal or external
94
95
  const isActive = activeIndex !== undefined ? activeIndex === index : internalActiveIndex === index;
@@ -116,7 +117,7 @@ const Accordion = _ref => {
116
117
  children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
117
118
  onClick: !isPreview && !isLocked ? toggle : null,
118
119
  className: `accordion-header flex items-center justify-between rounded-t-lg bg-[--color-accordion-header] ${isActive || isPreview ? "" : "rounded-b-lg"} hover: ${!isLocked ? "cursor-pointer" : null} `,
119
- children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
120
+ children: [hasTitle && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
120
121
  className: "flex items-center justify-between gap-2",
121
122
  children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_Text_Text__WEBPACK_IMPORTED_MODULE_3__["default"], {
122
123
  as: "h2",