analytica-frontend-lib 1.1.96 → 1.1.97
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.
- package/dist/Accordation/index.d.mts +4 -1
- package/dist/Accordation/index.d.ts +4 -1
- package/dist/Accordation/index.js +37 -8
- package/dist/Accordation/index.js.map +1 -1
- package/dist/Accordation/index.mjs +39 -9
- package/dist/Accordation/index.mjs.map +1 -1
- package/dist/CheckBox/index.d.mts +1 -1
- package/dist/CheckBox/index.d.ts +1 -1
- package/dist/Input/index.js +8 -2
- package/dist/Input/index.js.map +1 -1
- package/dist/Input/index.mjs +8 -2
- package/dist/Input/index.mjs.map +1 -1
- package/dist/Quiz/index.js +8 -2
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +8 -2
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Radio/index.d.mts +2 -2
- package/dist/Radio/index.d.ts +2 -2
- package/dist/Search/index.d.mts +1 -1
- package/dist/Search/index.d.ts +1 -1
- package/dist/Table/index.d.mts +17 -4
- package/dist/Table/index.d.ts +17 -4
- package/dist/Table/index.js +65 -38
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/index.mjs +65 -38
- package/dist/Table/index.mjs.map +1 -1
- package/dist/TextArea/index.js +8 -2
- package/dist/TextArea/index.js.map +1 -1
- package/dist/TextArea/index.mjs +8 -2
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/index.css +39 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +1173 -941
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +997 -764
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +39 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
forwardRef as forwardRef2,
|
|
4
4
|
useId,
|
|
5
|
-
useState as useState2
|
|
5
|
+
useState as useState2,
|
|
6
|
+
useEffect as useEffect2
|
|
6
7
|
} from "react";
|
|
7
8
|
|
|
8
9
|
// src/components/Card/Card.tsx
|
|
@@ -2152,17 +2153,33 @@ var CardAccordation = forwardRef2(
|
|
|
2152
2153
|
children,
|
|
2153
2154
|
className,
|
|
2154
2155
|
defaultExpanded = false,
|
|
2156
|
+
expanded: controlledExpanded,
|
|
2155
2157
|
onToggleExpanded,
|
|
2158
|
+
value,
|
|
2159
|
+
disabled = false,
|
|
2156
2160
|
...props
|
|
2157
2161
|
}, ref) => {
|
|
2158
|
-
const [
|
|
2159
|
-
const
|
|
2162
|
+
const [internalExpanded, setInternalExpanded] = useState2(defaultExpanded);
|
|
2163
|
+
const generatedId = useId();
|
|
2164
|
+
const contentId = value ? `accordion-content-${value}` : generatedId;
|
|
2165
|
+
const headerId = value ? `accordion-header-${value}` : `${generatedId}-header`;
|
|
2166
|
+
const isControlled = controlledExpanded !== void 0;
|
|
2167
|
+
const isExpanded = isControlled ? controlledExpanded : internalExpanded;
|
|
2168
|
+
useEffect2(() => {
|
|
2169
|
+
if (isControlled) {
|
|
2170
|
+
setInternalExpanded(controlledExpanded);
|
|
2171
|
+
}
|
|
2172
|
+
}, [isControlled, controlledExpanded]);
|
|
2160
2173
|
const handleToggle = () => {
|
|
2174
|
+
if (disabled) return;
|
|
2161
2175
|
const newExpanded = !isExpanded;
|
|
2162
|
-
|
|
2176
|
+
if (!isControlled) {
|
|
2177
|
+
setInternalExpanded(newExpanded);
|
|
2178
|
+
}
|
|
2163
2179
|
onToggleExpanded?.(newExpanded);
|
|
2164
2180
|
};
|
|
2165
2181
|
const handleKeyDown = (event) => {
|
|
2182
|
+
if (disabled) return;
|
|
2166
2183
|
if (event.key === "Enter" || event.key === " ") {
|
|
2167
2184
|
event.preventDefault();
|
|
2168
2185
|
handleToggle();
|
|
@@ -2181,11 +2198,19 @@ var CardAccordation = forwardRef2(
|
|
|
2181
2198
|
/* @__PURE__ */ jsxs8(
|
|
2182
2199
|
"button",
|
|
2183
2200
|
{
|
|
2201
|
+
id: headerId,
|
|
2202
|
+
type: "button",
|
|
2184
2203
|
onClick: handleToggle,
|
|
2185
2204
|
onKeyDown: handleKeyDown,
|
|
2186
|
-
|
|
2205
|
+
disabled,
|
|
2206
|
+
className: cn(
|
|
2207
|
+
"w-full cursor-pointer not-aria-expanded:rounded-xl aria-expanded:rounded-t-xl flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:border-2 focus:border-primary-950 focus:ring-inset px-2",
|
|
2208
|
+
disabled && "cursor-not-allowed text-text-400"
|
|
2209
|
+
),
|
|
2187
2210
|
"aria-expanded": isExpanded,
|
|
2188
|
-
"aria-controls":
|
|
2211
|
+
"aria-controls": contentId,
|
|
2212
|
+
"aria-disabled": disabled,
|
|
2213
|
+
"data-value": value,
|
|
2189
2214
|
children: [
|
|
2190
2215
|
trigger,
|
|
2191
2216
|
/* @__PURE__ */ jsx10(
|
|
@@ -2193,7 +2218,8 @@ var CardAccordation = forwardRef2(
|
|
|
2193
2218
|
{
|
|
2194
2219
|
size: 20,
|
|
2195
2220
|
className: cn(
|
|
2196
|
-
"
|
|
2221
|
+
"transition-transform duration-200 flex-shrink-0",
|
|
2222
|
+
disabled ? "text-gray-400" : "text-text-700",
|
|
2197
2223
|
isExpanded ? "rotate-90" : "rotate-0"
|
|
2198
2224
|
),
|
|
2199
2225
|
"data-testid": "accordion-caret"
|
|
@@ -2203,15 +2229,18 @@ var CardAccordation = forwardRef2(
|
|
|
2203
2229
|
}
|
|
2204
2230
|
),
|
|
2205
2231
|
/* @__PURE__ */ jsx10(
|
|
2206
|
-
"
|
|
2232
|
+
"section",
|
|
2207
2233
|
{
|
|
2208
2234
|
id: contentId,
|
|
2235
|
+
"aria-labelledby": headerId,
|
|
2236
|
+
"aria-hidden": !isExpanded,
|
|
2209
2237
|
className: cn(
|
|
2210
2238
|
"transition-all duration-300 ease-in-out overflow-hidden",
|
|
2211
2239
|
isExpanded ? "max-h-screen opacity-100" : "max-h-0 opacity-0"
|
|
2212
2240
|
),
|
|
2213
2241
|
"data-testid": "accordion-content",
|
|
2214
|
-
|
|
2242
|
+
"data-value": value,
|
|
2243
|
+
children: /* @__PURE__ */ jsx10("div", { className: "p-4 pt-0", children })
|
|
2215
2244
|
}
|
|
2216
2245
|
)
|
|
2217
2246
|
]
|
|
@@ -2219,6 +2248,7 @@ var CardAccordation = forwardRef2(
|
|
|
2219
2248
|
);
|
|
2220
2249
|
}
|
|
2221
2250
|
);
|
|
2251
|
+
CardAccordation.displayName = "CardAccordation";
|
|
2222
2252
|
export {
|
|
2223
2253
|
CardAccordation
|
|
2224
2254
|
};
|