opus-toolkit-components 1.5.9 → 1.6.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.
|
@@ -1122,26 +1122,58 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
1122
1122
|
|
|
1123
1123
|
|
|
1124
1124
|
const statusClasses = {
|
|
1125
|
-
primary:
|
|
1126
|
-
danger:
|
|
1127
|
-
warning:
|
|
1128
|
-
success:
|
|
1129
|
-
info:
|
|
1130
|
-
notice:
|
|
1125
|
+
primary: "bg-[--color-primary-btn] text-[--color-white]",
|
|
1126
|
+
danger: "bg-[--color-util-red] text-[--color-white]",
|
|
1127
|
+
warning: "bg-[--color-util-amber] text-[--color-white]",
|
|
1128
|
+
success: "bg-[--color-util-green] text-[--color-white]",
|
|
1129
|
+
info: "bg-[--color-util-blue] text-[--color-white]",
|
|
1130
|
+
notice: "bg-[--color-util-yellow] text-[--color-black]"
|
|
1131
1131
|
};
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* Allowed pill status values.
|
|
1135
|
+
* @typedef {'primary'|'danger'|'warning'|'success'|'info'|'notice'} PillStatus
|
|
1136
|
+
*/
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Icon component type — any valid SVG React component.
|
|
1140
|
+
* @typedef {(props: React.SVGProps<SVGSVGElement>) => JSX.Element} IconComponent
|
|
1141
|
+
*/
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* Props for the Pill component.
|
|
1145
|
+
*
|
|
1146
|
+
* @typedef {Object} PillProps
|
|
1147
|
+
* @property {string} [text='']
|
|
1148
|
+
* Text displayed inside the pill.
|
|
1149
|
+
*
|
|
1150
|
+
* @property {PillStatus} [status='info']
|
|
1151
|
+
* Determines visual colors of the pill.
|
|
1152
|
+
*
|
|
1153
|
+
* @property {string} [className]
|
|
1154
|
+
* Additional class names.
|
|
1155
|
+
*
|
|
1156
|
+
* @property {IconComponent} [icon]
|
|
1157
|
+
* Optional icon displayed before the text.
|
|
1158
|
+
*/
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* @param {PillProps & React.HTMLAttributes<HTMLSpanElement>} props
|
|
1162
|
+
*/
|
|
1163
|
+
|
|
1132
1164
|
const Pill = _ref => {
|
|
1133
1165
|
let {
|
|
1134
|
-
text =
|
|
1135
|
-
status =
|
|
1136
|
-
className =
|
|
1166
|
+
text = "",
|
|
1167
|
+
status = "info",
|
|
1168
|
+
className = "",
|
|
1137
1169
|
icon: Icon
|
|
1138
1170
|
} = _ref;
|
|
1139
|
-
const baseClasses =
|
|
1171
|
+
const baseClasses = "inline-flex items-center gap-1 text-xs font-medium px-3 py-1 rounded-full";
|
|
1140
1172
|
const statusClass = statusClasses[status] || statusClasses.info;
|
|
1141
1173
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("span", {
|
|
1142
1174
|
className: "".concat(baseClasses, " ").concat(statusClass, " ").concat(className),
|
|
1143
1175
|
children: [Icon && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(Icon, {
|
|
1144
|
-
className: "
|
|
1176
|
+
className: "h-4 w-4"
|
|
1145
1177
|
}), text]
|
|
1146
1178
|
});
|
|
1147
1179
|
};
|
|
@@ -1193,6 +1225,50 @@ const elementMap = {
|
|
|
1193
1225
|
caption: "span",
|
|
1194
1226
|
label: "label"
|
|
1195
1227
|
};
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* Allowed typographical variants for the Text component.
|
|
1231
|
+
* @typedef {'h1'|'h2'|'h3'|'h4'|'h5'|'h6'|'body'|'small'|'caption'|'label'} TextVariant
|
|
1232
|
+
*/
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Polymorphic HTML element types supported in `as`.
|
|
1236
|
+
* @typedef {keyof JSX.IntrinsicElements | React.ComponentType<any>} TextAs
|
|
1237
|
+
*/
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Props for the Text component.
|
|
1241
|
+
*
|
|
1242
|
+
* @typedef {Object} TextProps
|
|
1243
|
+
*
|
|
1244
|
+
* @property {TextVariant} [variant='body']
|
|
1245
|
+
* Controls the typography style.
|
|
1246
|
+
*
|
|
1247
|
+
* @property {TextAs} [as]
|
|
1248
|
+
* Optional override for the underlying HTML element.
|
|
1249
|
+
*
|
|
1250
|
+
* @property {string} [className]
|
|
1251
|
+
* Extra CSS classes.
|
|
1252
|
+
*
|
|
1253
|
+
* @property {string} [color='text-[--color-text-strong]']
|
|
1254
|
+
* Tailwind/text color classes.
|
|
1255
|
+
*
|
|
1256
|
+
* @property {React.ReactNode} [children]
|
|
1257
|
+
* Text content.
|
|
1258
|
+
*
|
|
1259
|
+
* @property {string} [name]
|
|
1260
|
+
* Name used to generate `data-cy`.
|
|
1261
|
+
*
|
|
1262
|
+
* @property {string} [dataCy]
|
|
1263
|
+
* Optional override for auto-generated data-cy attribute.
|
|
1264
|
+
*/
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Text component with typography variants and polymorphic rendering.
|
|
1268
|
+
*
|
|
1269
|
+
* @param {TextProps & React.HTMLAttributes<HTMLElement>} props
|
|
1270
|
+
*/
|
|
1271
|
+
|
|
1196
1272
|
function Text(_ref) {
|
|
1197
1273
|
let {
|
|
1198
1274
|
variant = "body",
|
|
@@ -1222,6 +1298,56 @@ function Text(_ref) {
|
|
|
1222
1298
|
|
|
1223
1299
|
|
|
1224
1300
|
|
|
1301
|
+
/**
|
|
1302
|
+
* @typedef {Object} AccordionProps
|
|
1303
|
+
*
|
|
1304
|
+
* @property {string | React.ReactNode} title
|
|
1305
|
+
* Title rendered inside the header.
|
|
1306
|
+
*
|
|
1307
|
+
* @property {Function} [handleToggle]
|
|
1308
|
+
* Optional external toggle handler called with (index).
|
|
1309
|
+
*
|
|
1310
|
+
* @property {number} [activeIndex]
|
|
1311
|
+
* Controlled active index. If provided, the accordion becomes controlled.
|
|
1312
|
+
*
|
|
1313
|
+
* @property {number} index
|
|
1314
|
+
* This accordion's position in a list.
|
|
1315
|
+
*
|
|
1316
|
+
* @property {boolean} [isPreview]
|
|
1317
|
+
* If true, accordion goes into preview mode.
|
|
1318
|
+
*
|
|
1319
|
+
* @property {boolean} [isLocked]
|
|
1320
|
+
* If true, accordion cannot toggle.
|
|
1321
|
+
*
|
|
1322
|
+
* @property {Function} [onExitPreview]
|
|
1323
|
+
* Callback fired when exiting preview mode.
|
|
1324
|
+
*
|
|
1325
|
+
* @property {React.ReactNode} content
|
|
1326
|
+
* Accordion expanded content.
|
|
1327
|
+
*
|
|
1328
|
+
* @property {React.ReactNode} [preview]
|
|
1329
|
+
* Rendered when in preview mode and not active.
|
|
1330
|
+
*
|
|
1331
|
+
* @property {boolean} [isPill]
|
|
1332
|
+
* Whether to show a status pill.
|
|
1333
|
+
*
|
|
1334
|
+
* @property {string} [pillText]
|
|
1335
|
+
* Label inside the pill.
|
|
1336
|
+
*
|
|
1337
|
+
* @property {'success'|'warning'|'error'|'info'|string} [pillStatus]
|
|
1338
|
+
* Visual status for the pill.
|
|
1339
|
+
*
|
|
1340
|
+
* @property {React.ReactNode} [pillIcon]
|
|
1341
|
+
* Optional icon inside the pill.
|
|
1342
|
+
*
|
|
1343
|
+
* @property {boolean} [disabled]
|
|
1344
|
+
* Disables interaction with the accordion.
|
|
1345
|
+
*/
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* @param {AccordionProps} props
|
|
1349
|
+
*/
|
|
1350
|
+
|
|
1225
1351
|
const Accordion = _ref => {
|
|
1226
1352
|
let {
|
|
1227
1353
|
title,
|
|
@@ -4140,7 +4266,82 @@ function AiTwotoneWarning (props) {
|
|
|
4140
4266
|
|
|
4141
4267
|
// Import a spinner icon
|
|
4142
4268
|
|
|
4143
|
-
|
|
4269
|
+
|
|
4270
|
+
/**
|
|
4271
|
+
* @typedef {'primary'|'secondary'|'tertiary'|'outline'|'destructive'} ButtonRank
|
|
4272
|
+
*/
|
|
4273
|
+
|
|
4274
|
+
/**
|
|
4275
|
+
* @typedef {'default'|'disabled'} ButtonState
|
|
4276
|
+
*/
|
|
4277
|
+
|
|
4278
|
+
/**
|
|
4279
|
+
* @typedef {'sm'|'md'|'lg'|'xl'|string} ButtonSize
|
|
4280
|
+
* (Supports custom tailwind text sizes too)
|
|
4281
|
+
*/
|
|
4282
|
+
|
|
4283
|
+
/**
|
|
4284
|
+
* Icon component type from react-icons or your own components
|
|
4285
|
+
* @typedef {(props: React.SVGProps<SVGSVGElement>) => JSX.Element} IconComponent
|
|
4286
|
+
*/
|
|
4287
|
+
|
|
4288
|
+
/**
|
|
4289
|
+
* @typedef {Object} ButtonProps
|
|
4290
|
+
*
|
|
4291
|
+
* @property {'button'|'submit'|'reset'} [type]
|
|
4292
|
+
* Native button type.
|
|
4293
|
+
*
|
|
4294
|
+
* @property {ButtonRank} [rank]
|
|
4295
|
+
* Visual rank: primary, secondary, etc.
|
|
4296
|
+
*
|
|
4297
|
+
* @property {ButtonState} [state]
|
|
4298
|
+
* Current state (default, disabled).
|
|
4299
|
+
*
|
|
4300
|
+
* @property {string} [text]
|
|
4301
|
+
* Text shown inside the button (ignored when isSaving is true).
|
|
4302
|
+
*
|
|
4303
|
+
* @property {ButtonSize} [size]
|
|
4304
|
+
* Tailwind text size (sm, md, lg, xl).
|
|
4305
|
+
*
|
|
4306
|
+
* @property {string} [name]
|
|
4307
|
+
* Standard HTML name attribute + for data-cy.
|
|
4308
|
+
*
|
|
4309
|
+
* @property {string} [dataCy]
|
|
4310
|
+
* Override for auto-generated test selector.
|
|
4311
|
+
*
|
|
4312
|
+
* @property {number} [tabIndex]
|
|
4313
|
+
*
|
|
4314
|
+
* @property {boolean} [isFullWidth]
|
|
4315
|
+
* Expand to full container width.
|
|
4316
|
+
*
|
|
4317
|
+
* @property {IconComponent} [icon]
|
|
4318
|
+
* Optional icon component (left or right).
|
|
4319
|
+
*
|
|
4320
|
+
* @property {'left'|'right'} [iconPosition]
|
|
4321
|
+
* Position of icon.
|
|
4322
|
+
*
|
|
4323
|
+
* @property {boolean} [isIconAnimated]
|
|
4324
|
+
* Enables subtle translate animation on hover.
|
|
4325
|
+
*
|
|
4326
|
+
* @property {boolean} [isSaving]
|
|
4327
|
+
* Shows a spinner and disables all interaction.
|
|
4328
|
+
*
|
|
4329
|
+
* @property {string} [savingText]
|
|
4330
|
+
* Text shown when isSaving = true.
|
|
4331
|
+
*
|
|
4332
|
+
* @property {string} [className]
|
|
4333
|
+
* Extra custom classes.
|
|
4334
|
+
*
|
|
4335
|
+
* @property {string} [title]
|
|
4336
|
+
* Adds accessible label / tooltip.
|
|
4337
|
+
*
|
|
4338
|
+
* @property {(event: React.MouseEvent<HTMLButtonElement>) => void} [onClick]
|
|
4339
|
+
* Click handler. Not called during saving or disabled state.
|
|
4340
|
+
*/
|
|
4341
|
+
|
|
4342
|
+
/**
|
|
4343
|
+
* @param {ButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>} props
|
|
4344
|
+
*/
|
|
4144
4345
|
|
|
4145
4346
|
function Button(_ref) {
|
|
4146
4347
|
let {
|
|
@@ -4216,24 +4417,49 @@ function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;e
|
|
|
4216
4417
|
|
|
4217
4418
|
|
|
4218
4419
|
|
|
4420
|
+
/**
|
|
4421
|
+
* The visual intent / theme of the Card.
|
|
4422
|
+
* @typedef {'default'|'info'|'warning'|'success'|'error'|'brand'|'brandSecondary'} CardIntent
|
|
4423
|
+
*/
|
|
4424
|
+
|
|
4425
|
+
/**
|
|
4426
|
+
* Props for the Card component.
|
|
4427
|
+
*
|
|
4428
|
+
* @typedef {Object} CardProps
|
|
4429
|
+
* @property {CardIntent} [intent]
|
|
4430
|
+
* Controls the background + text color theme of the card.
|
|
4431
|
+
*
|
|
4432
|
+
* @property {string} [className]
|
|
4433
|
+
* Additional custom class names.
|
|
4434
|
+
*
|
|
4435
|
+
* @property {React.ReactNode} [children]
|
|
4436
|
+
* Card content.
|
|
4437
|
+
*/
|
|
4438
|
+
|
|
4439
|
+
/**
|
|
4440
|
+
* Card component with typed JSDoc for TS autocomplete.
|
|
4441
|
+
*
|
|
4442
|
+
* @param {CardProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
4443
|
+
*/
|
|
4444
|
+
|
|
4219
4445
|
function Card(_ref) {
|
|
4220
4446
|
let {
|
|
4221
4447
|
intent,
|
|
4222
|
-
className =
|
|
4448
|
+
className = "",
|
|
4223
4449
|
children
|
|
4224
4450
|
} = _ref;
|
|
4225
4451
|
// Theme override
|
|
4226
4452
|
const intentClasses = {
|
|
4227
|
-
default:
|
|
4228
|
-
info:
|
|
4229
|
-
warning:
|
|
4230
|
-
success:
|
|
4231
|
-
error:
|
|
4232
|
-
brand:
|
|
4233
|
-
brandSecondary:
|
|
4453
|
+
default: "bg-[--color-primary-bg] text-[--color-text-weak]",
|
|
4454
|
+
info: "bg-[--color-util-blue-200] text-[--color-black] border-[--color-util-blue]",
|
|
4455
|
+
warning: "bg-[--color-util-yellow-200] text-[--color-black] border-[--color-util-yellow]",
|
|
4456
|
+
success: "bg-[--color-util-green-200] text-[--color-black] border-[--color-util-green]",
|
|
4457
|
+
error: "bg-[--color-util-red-200] text-[--color-text-black] border-[--color-util-red]",
|
|
4458
|
+
brand: "bg-[--color-brand-primary] text-[--color-white]",
|
|
4459
|
+
brandSecondary: "bg-[--color-brand-secondary] text-[--color-white]"
|
|
4234
4460
|
};
|
|
4235
|
-
const resolvedIntent = intent ||
|
|
4236
|
-
const cardClasses = dist_clsx(
|
|
4461
|
+
const resolvedIntent = intent || "default";
|
|
4462
|
+
const cardClasses = dist_clsx("p-5", "rounded-lg", "shadow-lg", "border-2 border-solid border-[--color-stroke]", intentClasses[resolvedIntent], className);
|
|
4237
4463
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
4238
4464
|
className: cardClasses,
|
|
4239
4465
|
children: children
|
|
@@ -4249,22 +4475,93 @@ function Input_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var
|
|
|
4249
4475
|
|
|
4250
4476
|
|
|
4251
4477
|
|
|
4478
|
+
/**
|
|
4479
|
+
* Icon component type — any React component that renders an SVG.
|
|
4480
|
+
* @typedef {(props: React.SVGProps<SVGSVGElement>) => JSX.Element} IconComponent
|
|
4481
|
+
*/
|
|
4482
|
+
|
|
4483
|
+
/**
|
|
4484
|
+
* Custom component type for supplementary UI below input.
|
|
4485
|
+
* Must be a React component.
|
|
4486
|
+
* @typedef {(props: any) => JSX.Element} CustomComponent
|
|
4487
|
+
*/
|
|
4488
|
+
|
|
4489
|
+
/**
|
|
4490
|
+
* Input component props.
|
|
4491
|
+
*
|
|
4492
|
+
* @typedef {Object} InputProps
|
|
4493
|
+
*
|
|
4494
|
+
* @property {string} label
|
|
4495
|
+
* Label displayed above the input.
|
|
4496
|
+
*
|
|
4497
|
+
* @property {string} [placeholder]
|
|
4498
|
+
*
|
|
4499
|
+
* @property {'text'|'email'|'password'|'number'|'search'|'tel'|'url'|'date'|'datetime-local'|'month'|'time'|'week'|string} [type]
|
|
4500
|
+
* HTML input type.
|
|
4501
|
+
*
|
|
4502
|
+
* @property {string|number} [tabIndex]
|
|
4503
|
+
*
|
|
4504
|
+
* @property {string} [title]
|
|
4505
|
+
*
|
|
4506
|
+
* @property {string} [name]
|
|
4507
|
+
*
|
|
4508
|
+
* @property {boolean} [isValid]
|
|
4509
|
+
* Whether the field is valid — shows error text if false.
|
|
4510
|
+
*
|
|
4511
|
+
* @property {string} [errorMessage]
|
|
4512
|
+
*
|
|
4513
|
+
* @property {(event: React.ChangeEvent<HTMLInputElement>) => void} [onChange]
|
|
4514
|
+
* Change handler using your preferred full event signature.
|
|
4515
|
+
*
|
|
4516
|
+
* @property {string} [className]
|
|
4517
|
+
*
|
|
4518
|
+
* @property {string|number} [value]
|
|
4519
|
+
*
|
|
4520
|
+
* @property {IconComponent} [Icon]
|
|
4521
|
+
*
|
|
4522
|
+
* @property {'left'|'right'} [iconPosition]
|
|
4523
|
+
* Icon placement inside the input.
|
|
4524
|
+
*
|
|
4525
|
+
* @property {boolean} [isAnimated]
|
|
4526
|
+
* Enables focus animation on the icon.
|
|
4527
|
+
*
|
|
4528
|
+
* @property {boolean} [required]
|
|
4529
|
+
*
|
|
4530
|
+
* @property {boolean} [disabled]
|
|
4531
|
+
*
|
|
4532
|
+
* @property {boolean} [shouldRenderCustomComponent]
|
|
4533
|
+
*
|
|
4534
|
+
* @property {CustomComponent} [customComponent]
|
|
4535
|
+
*
|
|
4536
|
+
* @property {Object<string, any>} [customComponentProps]
|
|
4537
|
+
*
|
|
4538
|
+
* @property {string} [dataCy]
|
|
4539
|
+
* Override for auto-generated test selector.
|
|
4540
|
+
*/
|
|
4541
|
+
|
|
4542
|
+
/**
|
|
4543
|
+
* ForwardRef Input component with complete JSDoc typings.
|
|
4544
|
+
*
|
|
4545
|
+
* @param {InputProps & React.InputHTMLAttributes<HTMLInputElement>} props
|
|
4546
|
+
* @param {React.Ref<HTMLInputElement>} ref
|
|
4547
|
+
*/
|
|
4548
|
+
|
|
4252
4549
|
const Input = /*#__PURE__*/(0,external_commonjs_react_commonjs2_react_amd_react_root_React_.forwardRef)((_ref, ref) => {
|
|
4253
4550
|
let {
|
|
4254
4551
|
label,
|
|
4255
4552
|
placeholder,
|
|
4256
|
-
type =
|
|
4257
|
-
tabIndex =
|
|
4258
|
-
title =
|
|
4553
|
+
type = "text",
|
|
4554
|
+
tabIndex = "",
|
|
4555
|
+
title = "",
|
|
4259
4556
|
name,
|
|
4260
4557
|
isValid = true,
|
|
4261
4558
|
errorMessage = "".concat(label, " is required"),
|
|
4262
4559
|
onChange,
|
|
4263
|
-
className =
|
|
4560
|
+
className = "",
|
|
4264
4561
|
value,
|
|
4265
4562
|
Icon,
|
|
4266
4563
|
// Icon component
|
|
4267
|
-
iconPosition =
|
|
4564
|
+
iconPosition = "left",
|
|
4268
4565
|
// Icon position: left or right
|
|
4269
4566
|
isAnimated = false,
|
|
4270
4567
|
// Add animation class when focused
|
|
@@ -4280,10 +4577,10 @@ const Input = /*#__PURE__*/(0,external_commonjs_react_commonjs2_react_amd_react_
|
|
|
4280
4577
|
// New disabled prop
|
|
4281
4578
|
dataCy
|
|
4282
4579
|
} = _ref;
|
|
4283
|
-
const inputClasses = "".concat(className, " flex items-center rounded-md bg-[--color-input-bg] border ").concat(isValid ?
|
|
4284
|
-
const iconClasses = "h-5 w-5 ".concat(isAnimated ?
|
|
4580
|
+
const inputClasses = "".concat(className, " flex items-center rounded-md bg-[--color-input-bg] border ").concat(isValid ? "border-[--color-stroke]" : "border-utilRed1000", " text-md font-normal text-[--color-text-strong] ").concat(disabled ? "opacity-50 cursor-not-allowed" : "");
|
|
4581
|
+
const iconClasses = "h-5 w-5 ".concat(isAnimated ? "transition-transform duration-200 group-focus-within:scale-125" : "", " text-[--color-text-weak]");
|
|
4285
4582
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
4286
|
-
className: "flex flex-col
|
|
4583
|
+
className: "mb-4 flex flex-col",
|
|
4287
4584
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)(Text, {
|
|
4288
4585
|
as: "label",
|
|
4289
4586
|
variant: "label",
|
|
@@ -4292,20 +4589,20 @@ const Input = /*#__PURE__*/(0,external_commonjs_react_commonjs2_react_amd_react_
|
|
|
4292
4589
|
children: [label, required && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(Text, {
|
|
4293
4590
|
as: "span",
|
|
4294
4591
|
variant: "small",
|
|
4295
|
-
className: "text-[--color-util-red]
|
|
4592
|
+
className: "ml-1 text-[--color-util-red]",
|
|
4296
4593
|
children: "*"
|
|
4297
4594
|
})]
|
|
4298
4595
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
4299
4596
|
className: "".concat(inputClasses, " relative"),
|
|
4300
|
-
children: [Icon && iconPosition ===
|
|
4301
|
-
className: "absolute left-3 flex items-center
|
|
4597
|
+
children: [Icon && iconPosition === "left" && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
4598
|
+
className: "pointer-events-none absolute left-3 flex items-center",
|
|
4302
4599
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(Icon, {
|
|
4303
4600
|
className: iconClasses
|
|
4304
4601
|
})
|
|
4305
4602
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("input", {
|
|
4306
4603
|
id: name,
|
|
4307
4604
|
ref: ref,
|
|
4308
|
-
className: "w-full ".concat(Icon ? iconPosition ===
|
|
4605
|
+
className: "w-full ".concat(Icon ? iconPosition === "left" ? "pl-10" : "pr-10" : "", " rounded-md border-none bg-[--color-input-bg] px-3 py-2 focus:outline-none focus:ring-0"),
|
|
4309
4606
|
type: type,
|
|
4310
4607
|
name: name,
|
|
4311
4608
|
placeholder: placeholder,
|
|
@@ -4321,8 +4618,8 @@ const Input = /*#__PURE__*/(0,external_commonjs_react_commonjs2_react_amd_react_
|
|
|
4321
4618
|
}),
|
|
4322
4619
|
"aria-invalid": !isValid,
|
|
4323
4620
|
"aria-describedby": !isValid ? "".concat(name, "-error") : undefined
|
|
4324
|
-
}), Icon && iconPosition ===
|
|
4325
|
-
className: "absolute right-3 flex items-center
|
|
4621
|
+
}), Icon && iconPosition === "right" && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
4622
|
+
className: "pointer-events-none absolute right-3 flex items-center",
|
|
4326
4623
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(Icon, {
|
|
4327
4624
|
className: iconClasses
|
|
4328
4625
|
})
|
|
@@ -4400,33 +4697,79 @@ var datepicker_update = injectStylesIntoStyleTag_default()(datepicker/* default
|
|
|
4400
4697
|
|
|
4401
4698
|
|
|
4402
4699
|
|
|
4700
|
+
/**
|
|
4701
|
+
* Custom change event type used by your date components.
|
|
4702
|
+
* @typedef {{ target: { name: string, value: string } }} DatePickerChangeEvent
|
|
4703
|
+
*/
|
|
4704
|
+
|
|
4705
|
+
/**
|
|
4706
|
+
* Props for DatePicker.
|
|
4707
|
+
*
|
|
4708
|
+
* @typedef {Object} DatePickerProps
|
|
4709
|
+
*
|
|
4710
|
+
* @property {string} [initialDate]
|
|
4711
|
+
* Initial date value (ISO or human-readable). Converted internally.
|
|
4712
|
+
*
|
|
4713
|
+
* @property {string} [label]
|
|
4714
|
+
* Label above the input.
|
|
4715
|
+
*
|
|
4716
|
+
* @property {boolean} [isValid]
|
|
4717
|
+
* Controls validation styles + error message display.
|
|
4718
|
+
*
|
|
4719
|
+
* @property {string} [errorMessage]
|
|
4720
|
+
* Message shown when isValid = false.
|
|
4721
|
+
*
|
|
4722
|
+
* @property {string} [name]
|
|
4723
|
+
* Input field name and event target name.
|
|
4724
|
+
*
|
|
4725
|
+
* @property {(event: DatePickerChangeEvent) => void} [onChange]
|
|
4726
|
+
* Custom event format with `event.target.name` & `event.target.value` in ISO.
|
|
4727
|
+
*
|
|
4728
|
+
* @property {string} [value]
|
|
4729
|
+
* External controlled value (ISO or slash-format). Normalized automatically.
|
|
4730
|
+
*
|
|
4731
|
+
* @property {string} [className]
|
|
4732
|
+
*
|
|
4733
|
+
* @property {string} [title]
|
|
4734
|
+
*
|
|
4735
|
+
* @property {boolean} [required]
|
|
4736
|
+
*
|
|
4737
|
+
* @property {string} [dataCy]
|
|
4738
|
+
*
|
|
4739
|
+
* @property {boolean} [disabled]
|
|
4740
|
+
*/
|
|
4741
|
+
|
|
4742
|
+
/**
|
|
4743
|
+
* @param {DatePickerProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
4744
|
+
*/
|
|
4745
|
+
|
|
4403
4746
|
function DatePicker(_ref) {
|
|
4404
4747
|
let {
|
|
4405
|
-
initialDate =
|
|
4406
|
-
label =
|
|
4748
|
+
initialDate = "",
|
|
4749
|
+
label = "Select a Date:",
|
|
4407
4750
|
isValid = true,
|
|
4408
|
-
errorMessage =
|
|
4409
|
-
name =
|
|
4751
|
+
errorMessage = "Error message",
|
|
4752
|
+
name = "date",
|
|
4410
4753
|
onChange,
|
|
4411
4754
|
value,
|
|
4412
|
-
className =
|
|
4413
|
-
title =
|
|
4755
|
+
className = "",
|
|
4756
|
+
title = "",
|
|
4414
4757
|
required = false,
|
|
4415
4758
|
dataCy,
|
|
4416
4759
|
disabled = false
|
|
4417
4760
|
} = _ref;
|
|
4418
|
-
const [selectedDate, setSelectedDate] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(
|
|
4761
|
+
const [selectedDate, setSelectedDate] = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)("");
|
|
4419
4762
|
const inputRef = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useRef)(null);
|
|
4420
4763
|
const normalizeToInputFormat = dateString => {
|
|
4421
|
-
if (!dateString) return
|
|
4422
|
-
const [datePart] = dateString.split(
|
|
4764
|
+
if (!dateString) return "";
|
|
4765
|
+
const [datePart] = dateString.split(" "); // Remove time if present
|
|
4423
4766
|
|
|
4424
4767
|
if (/^\d{4}-\d{2}-\d{2}$/.test(datePart)) {
|
|
4425
4768
|
return datePart; // Already ISO format
|
|
4426
4769
|
}
|
|
4427
|
-
const parts = datePart.split(
|
|
4428
|
-
if (parts.length !== 3) return
|
|
4429
|
-
const [part1, part2, part3] = parts.map(p => p.padStart(2,
|
|
4770
|
+
const parts = datePart.split("/");
|
|
4771
|
+
if (parts.length !== 3) return "";
|
|
4772
|
+
const [part1, part2, part3] = parts.map(p => p.padStart(2, "0"));
|
|
4430
4773
|
if (parseInt(part1, 10) > 12) {
|
|
4431
4774
|
// Assume dd/MM/yyyy
|
|
4432
4775
|
const [day, month, year] = [part1, part2, part3];
|
|
@@ -4461,14 +4804,14 @@ function DatePicker(_ref) {
|
|
|
4461
4804
|
}
|
|
4462
4805
|
};
|
|
4463
4806
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
4464
|
-
className: "relative flex flex-col
|
|
4807
|
+
className: "relative mb-4 flex flex-col",
|
|
4465
4808
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)(Text, {
|
|
4466
4809
|
as: "label",
|
|
4467
4810
|
variant: "label",
|
|
4468
4811
|
htmlFor: name,
|
|
4469
4812
|
className: "mb-1",
|
|
4470
4813
|
children: [label, required && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
4471
|
-
className: "text-[--color-util-red]
|
|
4814
|
+
className: "ml-1 text-[--color-util-red]",
|
|
4472
4815
|
children: "*"
|
|
4473
4816
|
})]
|
|
4474
4817
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("input", {
|
|
@@ -4487,15 +4830,15 @@ function DatePicker(_ref) {
|
|
|
4487
4830
|
}),
|
|
4488
4831
|
"aria-invalid": !isValid,
|
|
4489
4832
|
"aria-describedby": !isValid ? "".concat(name, "-error") : undefined,
|
|
4490
|
-
className: "w-full
|
|
4833
|
+
className: "w-full rounded-md border bg-[--color-input-bg] px-3 py-2 pr-10 ".concat(isValid ? "border-[--color-stroke]" : "border-[--color-util-red]", " text-md font-normal text-[--color-text-strong] ").concat(disabled ? "cursor-not-allowed opacity-50" : "", " ").concat(className)
|
|
4491
4834
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("button", {
|
|
4492
4835
|
type: "button",
|
|
4493
4836
|
onClick: handleIconClick,
|
|
4494
|
-
className: "absolute top-1/2 mt-1
|
|
4837
|
+
className: "datepicker-icon-button absolute right-3 top-1/2 mt-1 transform",
|
|
4495
4838
|
"aria-label": "Open date picker",
|
|
4496
4839
|
disabled: disabled,
|
|
4497
4840
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(esm_CalendarIcon, {
|
|
4498
|
-
className: "
|
|
4841
|
+
className: "h-5 w-5 ".concat(disabled ? "text-[--color-text-disabled]" : "text-[--color-text-weak] hover:text-[--color-primary-btn-hover]", " transition")
|
|
4499
4842
|
})
|
|
4500
4843
|
}), !isValid && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(Text, {
|
|
4501
4844
|
as: "span",
|
|
@@ -4511,6 +4854,60 @@ function DatePicker(_ref) {
|
|
|
4511
4854
|
|
|
4512
4855
|
|
|
4513
4856
|
|
|
4857
|
+
/**
|
|
4858
|
+
* A single radio option.
|
|
4859
|
+
* @typedef {Object} RadioOption
|
|
4860
|
+
* @property {string|number} value
|
|
4861
|
+
* @property {string} label
|
|
4862
|
+
*/
|
|
4863
|
+
|
|
4864
|
+
/**
|
|
4865
|
+
* Custom event format used by your form components.
|
|
4866
|
+
* @typedef {{ target: { name: string, value: string|number } }} RadioChangeEvent
|
|
4867
|
+
*/
|
|
4868
|
+
|
|
4869
|
+
/**
|
|
4870
|
+
* Props for the RadioButton component.
|
|
4871
|
+
*
|
|
4872
|
+
* @typedef {Object} RadioButtonProps
|
|
4873
|
+
*
|
|
4874
|
+
* @property {string} label
|
|
4875
|
+
* Form label above the radio group.
|
|
4876
|
+
*
|
|
4877
|
+
* @property {RadioOption[]} [options]
|
|
4878
|
+
* Array of selectable radio items.
|
|
4879
|
+
*
|
|
4880
|
+
* @property {string} name
|
|
4881
|
+
* Name of the radio group (required for grouping).
|
|
4882
|
+
*
|
|
4883
|
+
* @property {string|number} [value]
|
|
4884
|
+
* Currently selected value.
|
|
4885
|
+
*
|
|
4886
|
+
* @property {(event: RadioChangeEvent) => void} [onChange]
|
|
4887
|
+
* Custom event handler following your design system.
|
|
4888
|
+
*
|
|
4889
|
+
* @property {string} [className]
|
|
4890
|
+
*
|
|
4891
|
+
* @property {string|number} [tabIndex]
|
|
4892
|
+
*
|
|
4893
|
+
* @property {string} [title]
|
|
4894
|
+
*
|
|
4895
|
+
* @property {boolean} [isValid]
|
|
4896
|
+
* Controls error message + styles.
|
|
4897
|
+
*
|
|
4898
|
+
* @property {string} [errorMessage]
|
|
4899
|
+
*
|
|
4900
|
+
* @property {boolean} [required]
|
|
4901
|
+
*
|
|
4902
|
+
* @property {string} [dataCy]
|
|
4903
|
+
*
|
|
4904
|
+
* @property {boolean} [disabled]
|
|
4905
|
+
*/
|
|
4906
|
+
|
|
4907
|
+
/**
|
|
4908
|
+
* @param {RadioButtonProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
4909
|
+
*/
|
|
4910
|
+
|
|
4514
4911
|
const RadioButton = _ref => {
|
|
4515
4912
|
let {
|
|
4516
4913
|
label,
|
|
@@ -4605,6 +5002,49 @@ RadioButton.displayName = "RadioButton";
|
|
|
4605
5002
|
|
|
4606
5003
|
|
|
4607
5004
|
|
|
5005
|
+
/**
|
|
5006
|
+
* Custom change event format used across your form components.
|
|
5007
|
+
* Matches your Input / Dropdown / DatePicker pattern.
|
|
5008
|
+
*
|
|
5009
|
+
* @typedef {{ target: { name: string, value: boolean } }} CheckboxChangeEvent
|
|
5010
|
+
*/
|
|
5011
|
+
|
|
5012
|
+
/**
|
|
5013
|
+
* Props for Checkbox.
|
|
5014
|
+
*
|
|
5015
|
+
* @typedef {Object} CheckboxProps
|
|
5016
|
+
*
|
|
5017
|
+
* @property {string} label
|
|
5018
|
+
* Label displayed next to the checkbox.
|
|
5019
|
+
*
|
|
5020
|
+
* @property {string} name
|
|
5021
|
+
* Name used in the emitted onChange event.
|
|
5022
|
+
*
|
|
5023
|
+
* @property {(event: CheckboxChangeEvent) => void} [onChange]
|
|
5024
|
+
* Receives `{ target: { name, value } }`.
|
|
5025
|
+
*
|
|
5026
|
+
* @property {boolean} [value]
|
|
5027
|
+
* Whether the checkbox is checked.
|
|
5028
|
+
*
|
|
5029
|
+
* @property {boolean} [isValid]
|
|
5030
|
+
* Controls error styling.
|
|
5031
|
+
*
|
|
5032
|
+
* @property {string} [errorMessage]
|
|
5033
|
+
* Error text shown below the checkbox.
|
|
5034
|
+
*
|
|
5035
|
+
* @property {boolean} [disabled]
|
|
5036
|
+
* Prevents user interaction.
|
|
5037
|
+
*
|
|
5038
|
+
* @property {string} [title]
|
|
5039
|
+
*
|
|
5040
|
+
* @property {string} [dataCy]
|
|
5041
|
+
* Override test selector.
|
|
5042
|
+
*/
|
|
5043
|
+
|
|
5044
|
+
/**
|
|
5045
|
+
* @param {CheckboxProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
5046
|
+
*/
|
|
5047
|
+
|
|
4608
5048
|
function Checkbox(_ref) {
|
|
4609
5049
|
let {
|
|
4610
5050
|
label,
|
|
@@ -4612,7 +5052,7 @@ function Checkbox(_ref) {
|
|
|
4612
5052
|
onChange,
|
|
4613
5053
|
value = false,
|
|
4614
5054
|
isValid = true,
|
|
4615
|
-
errorMessage =
|
|
5055
|
+
errorMessage = "",
|
|
4616
5056
|
disabled = false,
|
|
4617
5057
|
title,
|
|
4618
5058
|
dataCy
|
|
@@ -4621,7 +5061,7 @@ function Checkbox(_ref) {
|
|
|
4621
5061
|
const errorId = "".concat(id, "-error");
|
|
4622
5062
|
const showError = !isValid && errorMessage;
|
|
4623
5063
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
4624
|
-
className: "flex flex-col
|
|
5064
|
+
className: "mb-4 flex flex-col",
|
|
4625
5065
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
4626
5066
|
className: "flex items-center",
|
|
4627
5067
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("input", {
|
|
@@ -4640,9 +5080,9 @@ function Checkbox(_ref) {
|
|
|
4640
5080
|
"aria-describedby": showError ? errorId : undefined,
|
|
4641
5081
|
"aria-disabled": disabled,
|
|
4642
5082
|
style: {
|
|
4643
|
-
accentColor:
|
|
5083
|
+
accentColor: "var(--color-primary-btn)"
|
|
4644
5084
|
},
|
|
4645
|
-
className: "
|
|
5085
|
+
className: "mr-2 rounded-sm ".concat(disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer")
|
|
4646
5086
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(Text, {
|
|
4647
5087
|
variant: "label",
|
|
4648
5088
|
as: "label",
|
|
@@ -4653,7 +5093,7 @@ function Checkbox(_ref) {
|
|
|
4653
5093
|
id: errorId,
|
|
4654
5094
|
variant: "small",
|
|
4655
5095
|
as: "span",
|
|
4656
|
-
className: "text-[--color-util-red]
|
|
5096
|
+
className: "mt-1 text-[--color-util-red]",
|
|
4657
5097
|
children: errorMessage
|
|
4658
5098
|
})]
|
|
4659
5099
|
});
|
|
@@ -4691,37 +5131,87 @@ var table_update = injectStylesIntoStyleTag_default()(table/* default */.A, tabl
|
|
|
4691
5131
|
|
|
4692
5132
|
|
|
4693
5133
|
|
|
5134
|
+
/**
|
|
5135
|
+
* A column definition for the table.
|
|
5136
|
+
*
|
|
5137
|
+
* @typedef {Object} TableColumn
|
|
5138
|
+
* @property {string} key
|
|
5139
|
+
* The key used to read the row value.
|
|
5140
|
+
*
|
|
5141
|
+
* @property {string} header
|
|
5142
|
+
* The column header text.
|
|
5143
|
+
*
|
|
5144
|
+
* @property {(row: any) => React.ReactNode} [render]
|
|
5145
|
+
* Optional custom renderer for this column.
|
|
5146
|
+
*/
|
|
5147
|
+
|
|
5148
|
+
/**
|
|
5149
|
+
* Props for the Table component.
|
|
5150
|
+
*
|
|
5151
|
+
* @typedef {Object} TableProps
|
|
5152
|
+
*
|
|
5153
|
+
* @property {TableColumn[]} [data=[]]
|
|
5154
|
+
* Array of column definitions.
|
|
5155
|
+
*
|
|
5156
|
+
* @property {any[]} [rows=[]]
|
|
5157
|
+
* Array of row objects. Row shape is flexible.
|
|
5158
|
+
*
|
|
5159
|
+
* @property {string} [className='']
|
|
5160
|
+
* Extra classes for the outer wrapper.
|
|
5161
|
+
*
|
|
5162
|
+
* @property {string} [rowClassName='']
|
|
5163
|
+
* Classes applied to each table row.
|
|
5164
|
+
*
|
|
5165
|
+
* @property {string} [cellClassName='']
|
|
5166
|
+
* Classes applied to each table cell.
|
|
5167
|
+
*
|
|
5168
|
+
* @property {string} [headRowClassName='']
|
|
5169
|
+
* Classes for the `<thead>` row.
|
|
5170
|
+
*
|
|
5171
|
+
* @property {string} [headCellClassName='']
|
|
5172
|
+
* Classes for header `<th>` cells.
|
|
5173
|
+
*
|
|
5174
|
+
* @property {(row: any, index: number) => string|number} [rowKeyExtractor]
|
|
5175
|
+
* Extractor for row key (defaults to index).
|
|
5176
|
+
*/
|
|
5177
|
+
|
|
5178
|
+
/**
|
|
5179
|
+
* Responsive Table with JSDoc types.
|
|
5180
|
+
*
|
|
5181
|
+
* @param {TableProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
5182
|
+
*/
|
|
5183
|
+
|
|
4694
5184
|
function Table(_ref) {
|
|
4695
5185
|
let {
|
|
4696
5186
|
data = [],
|
|
4697
5187
|
rows = [],
|
|
4698
|
-
className =
|
|
4699
|
-
rowClassName =
|
|
4700
|
-
cellClassName =
|
|
4701
|
-
headRowClassName =
|
|
4702
|
-
headCellClassName =
|
|
5188
|
+
className = "",
|
|
5189
|
+
rowClassName = "",
|
|
5190
|
+
cellClassName = "",
|
|
5191
|
+
headRowClassName = "",
|
|
5192
|
+
headCellClassName = "",
|
|
4703
5193
|
rowKeyExtractor = (row, index) => index
|
|
4704
5194
|
} = _ref;
|
|
4705
5195
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
4706
5196
|
className: "wrapper w-full ".concat(className),
|
|
4707
5197
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("table", {
|
|
4708
|
-
className: "
|
|
5198
|
+
className: "table min-w-full table-auto border-collapse text-left",
|
|
4709
5199
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("thead", {
|
|
4710
5200
|
className: "hidden sm:table-header-group",
|
|
4711
5201
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("tr", {
|
|
4712
5202
|
className: "bg-[--color-table-head-bg] ".concat(headRowClassName),
|
|
4713
5203
|
children: data.map(column => /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("th", {
|
|
4714
|
-
className: "
|
|
5204
|
+
className: "border-b border-[--color-stroke] px-4 py-2 text-sm font-normal text-[--color-table-head-txt] ".concat(headCellClassName),
|
|
4715
5205
|
children: column.header
|
|
4716
5206
|
}, column.key))
|
|
4717
5207
|
})
|
|
4718
5208
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("tbody", {
|
|
4719
5209
|
children: rows.map((row, index) => {
|
|
4720
|
-
const backgroundClass = index % 2 === 0 ?
|
|
5210
|
+
const backgroundClass = index % 2 === 0 ? "bg-[--color-table-row-bg-even]" : "bg-[--color-table-row-bg-odd]";
|
|
4721
5211
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("tr", {
|
|
4722
|
-
className: "
|
|
5212
|
+
className: "mb-4 block rounded-lg border border-[--color-stroke] p-4 shadow-sm hover:bg-[--color-table-row-bg-hover] sm:mb-0 sm:table-row sm:rounded-none sm:border-0 sm:p-0 sm:shadow-none ".concat(backgroundClass, " ").concat(rowClassName),
|
|
4723
5213
|
children: data.map(column => /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("td", {
|
|
4724
|
-
className: "
|
|
5214
|
+
className: "block text-sm text-[--color-text-weak] sm:table-cell lg:px-4 lg:py-2 ".concat(cellClassName),
|
|
4725
5215
|
"data-label": column.header,
|
|
4726
5216
|
children: column.render ? column.render(row) : row[column.key]
|
|
4727
5217
|
}, column.key))
|
|
@@ -13279,21 +13769,83 @@ const esm_ChevronDownIcon_ForwardRef = /*#__PURE__*/ external_commonjs_react_com
|
|
|
13279
13769
|
|
|
13280
13770
|
|
|
13281
13771
|
|
|
13772
|
+
/**
|
|
13773
|
+
* @typedef {Object} DropdownItem
|
|
13774
|
+
* @property {string} label
|
|
13775
|
+
* @property {string|number} value
|
|
13776
|
+
*/
|
|
13777
|
+
|
|
13778
|
+
/**
|
|
13779
|
+
* Icon component type — any React SVG component.
|
|
13780
|
+
* @typedef {(props: React.SVGProps<SVGSVGElement>) => JSX.Element} IconComponent
|
|
13781
|
+
*/
|
|
13782
|
+
|
|
13783
|
+
/**
|
|
13784
|
+
* Custom event type emitted by your onChange (matching your pattern).
|
|
13785
|
+
* @typedef {{ target: { name: string, value: string|number } }} DropdownChangeEvent
|
|
13786
|
+
*/
|
|
13787
|
+
|
|
13788
|
+
/**
|
|
13789
|
+
* @typedef {Object} DropdownProps
|
|
13790
|
+
*
|
|
13791
|
+
* @property {DropdownItem[]} [items]
|
|
13792
|
+
* Array of dropdown options.
|
|
13793
|
+
*
|
|
13794
|
+
* @property {string} [label]
|
|
13795
|
+
* Label above the dropdown.
|
|
13796
|
+
*
|
|
13797
|
+
* @property {boolean} [isValid]
|
|
13798
|
+
* Whether the field is valid.
|
|
13799
|
+
*
|
|
13800
|
+
* @property {boolean} [required]
|
|
13801
|
+
* Whether a * is appended.
|
|
13802
|
+
*
|
|
13803
|
+
* @property {string} [placeholder]
|
|
13804
|
+
*
|
|
13805
|
+
* @property {string} [name]
|
|
13806
|
+
*
|
|
13807
|
+
* @property {string} [className]
|
|
13808
|
+
*
|
|
13809
|
+
* @property {string} [title]
|
|
13810
|
+
*
|
|
13811
|
+
* @property {string|number} [tabIndex]
|
|
13812
|
+
*
|
|
13813
|
+
* @property {(event: DropdownChangeEvent) => void} [onChange]
|
|
13814
|
+
* Uses your preferred event signature: `event.target.name` / `event.target.value`.
|
|
13815
|
+
*
|
|
13816
|
+
* @property {string|number} [value]
|
|
13817
|
+
* Selected item value.
|
|
13818
|
+
*
|
|
13819
|
+
* @property {IconComponent} [Icon]
|
|
13820
|
+
* Optional decorative icon.
|
|
13821
|
+
*
|
|
13822
|
+
* @property {string} [errorMessage]
|
|
13823
|
+
*
|
|
13824
|
+
* @property {boolean} [disabled]
|
|
13825
|
+
*
|
|
13826
|
+
* @property {string} [dataCy]
|
|
13827
|
+
* Override for auto-generated data-cy attribute.
|
|
13828
|
+
*/
|
|
13829
|
+
|
|
13830
|
+
/**
|
|
13831
|
+
* @param {DropdownProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
13832
|
+
*/
|
|
13833
|
+
|
|
13282
13834
|
function Dropdown(_ref) {
|
|
13283
13835
|
let {
|
|
13284
13836
|
items = [],
|
|
13285
|
-
label =
|
|
13837
|
+
label = "Test Label",
|
|
13286
13838
|
isValid = true,
|
|
13287
13839
|
required = false,
|
|
13288
|
-
placeholder =
|
|
13840
|
+
placeholder = "Example Placeholder",
|
|
13289
13841
|
name,
|
|
13290
|
-
className =
|
|
13291
|
-
title =
|
|
13292
|
-
tabIndex =
|
|
13842
|
+
className = "",
|
|
13843
|
+
title = "",
|
|
13844
|
+
tabIndex = "",
|
|
13293
13845
|
onChange,
|
|
13294
13846
|
value,
|
|
13295
13847
|
Icon,
|
|
13296
|
-
errorMessage =
|
|
13848
|
+
errorMessage = "This field is required",
|
|
13297
13849
|
disabled = false,
|
|
13298
13850
|
dataCy
|
|
13299
13851
|
} = _ref;
|
|
@@ -13302,7 +13854,7 @@ function Dropdown(_ref) {
|
|
|
13302
13854
|
const newSelectedItem = items.find(item => item.value === value) || null;
|
|
13303
13855
|
setSelectedItem(newSelectedItem);
|
|
13304
13856
|
}, [value, items]);
|
|
13305
|
-
const inputClasses = "inline-flex w-full justify-between items-center rounded-md bg-[--color-input-bg] text-md font-normal border p-2 text-[--color-text-strong] ".concat(isValid ?
|
|
13857
|
+
const inputClasses = "inline-flex w-full justify-between items-center rounded-md bg-[--color-input-bg] text-md font-normal border p-2 text-[--color-text-strong] ".concat(isValid ? "border-[--color-stroke]" : "border-utilRed1000", " ").concat(disabled ? "opacity-50 cursor-not-allowed" : "");
|
|
13306
13858
|
const handleSelect = item => {
|
|
13307
13859
|
if (disabled) return;
|
|
13308
13860
|
setSelectedItem(item);
|
|
@@ -13315,7 +13867,7 @@ function Dropdown(_ref) {
|
|
|
13315
13867
|
onChange === null || onChange === void 0 || onChange(event);
|
|
13316
13868
|
};
|
|
13317
13869
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
13318
|
-
className: "flex flex-col
|
|
13870
|
+
className: "mb-4 flex flex-col ".concat(className),
|
|
13319
13871
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)(Text, {
|
|
13320
13872
|
as: "label",
|
|
13321
13873
|
variant: "label",
|
|
@@ -13354,10 +13906,10 @@ function Dropdown(_ref) {
|
|
|
13354
13906
|
})]
|
|
13355
13907
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(solid_esm_ChevronDownIcon, {
|
|
13356
13908
|
"aria-hidden": "true",
|
|
13357
|
-
className: "ml-3 mr-1 h-5 w-5 text-[--color-text-strong]
|
|
13909
|
+
className: "ml-3 mr-1 h-5 w-5 bg-transparent text-[--color-text-strong] transition-transform duration-200 ".concat(open ? "rotate-180" : "rotate-0")
|
|
13358
13910
|
})]
|
|
13359
13911
|
}), !disabled && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(yt, {
|
|
13360
|
-
className: "
|
|
13912
|
+
className: "ring-opacity-1 absolute left-0 z-10 mt-2 max-h-48 w-[100%] origin-top-right overflow-y-auto rounded-md bg-[--color-primary-bg] shadow-lg ring-1 ring-[--color-stroke] focus:outline-none",
|
|
13361
13913
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
13362
13914
|
className: "py-1",
|
|
13363
13915
|
children: items.map((item, index) => /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(gt, {
|
|
@@ -13368,7 +13920,7 @@ function Dropdown(_ref) {
|
|
|
13368
13920
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("button", {
|
|
13369
13921
|
type: "button",
|
|
13370
13922
|
onClick: () => handleSelect(item),
|
|
13371
|
-
className: "block w-full px-4 py-2 text-left text-sm text-[--color-text-strong] ".concat(active ?
|
|
13923
|
+
className: "block w-full px-4 py-2 text-left text-sm text-[--color-text-strong] ".concat(active ? "bg-[--color-input-bg]" : ""),
|
|
13372
13924
|
children: item.label
|
|
13373
13925
|
});
|
|
13374
13926
|
}
|
|
@@ -13381,7 +13933,7 @@ function Dropdown(_ref) {
|
|
|
13381
13933
|
as: "span",
|
|
13382
13934
|
variant: "small",
|
|
13383
13935
|
id: "".concat(name, "-error"),
|
|
13384
|
-
className: "text-[--color-util-red]
|
|
13936
|
+
className: "mt-1 text-[--color-util-red]",
|
|
13385
13937
|
children: errorMessage
|
|
13386
13938
|
})]
|
|
13387
13939
|
});
|
|
@@ -13429,6 +13981,30 @@ var c247_icon_only_2x_png_default = /*#__PURE__*/__webpack_require__.n(c247_icon
|
|
|
13429
13981
|
|
|
13430
13982
|
|
|
13431
13983
|
|
|
13984
|
+
/**
|
|
13985
|
+
* Props for the Navbar component.
|
|
13986
|
+
*
|
|
13987
|
+
* @typedef {Object} NavbarProps
|
|
13988
|
+
*
|
|
13989
|
+
* @property {React.ReactNode} [children]
|
|
13990
|
+
* Content displayed on the right side of the navbar.
|
|
13991
|
+
*
|
|
13992
|
+
* @property {string} [logo]
|
|
13993
|
+
* Custom logo URL. Defaults to toolkit logos.
|
|
13994
|
+
*
|
|
13995
|
+
* @property {string} [className]
|
|
13996
|
+
* Extra class names for the navbar wrapper.
|
|
13997
|
+
*
|
|
13998
|
+
* @property {string} [maxWidth="1200px"]
|
|
13999
|
+
* Max width of the inner content container.
|
|
14000
|
+
*/
|
|
14001
|
+
|
|
14002
|
+
/**
|
|
14003
|
+
* Responsive Navbar with optional custom logo and region for child content.
|
|
14004
|
+
*
|
|
14005
|
+
* @param {NavbarProps & React.HTMLAttributes<HTMLElement>} props
|
|
14006
|
+
*/
|
|
14007
|
+
|
|
13432
14008
|
const Navbar = _ref => {
|
|
13433
14009
|
let {
|
|
13434
14010
|
children,
|
|
@@ -13468,12 +14044,36 @@ var c247_loader_gif_default = /*#__PURE__*/__webpack_require__.n(c247_loader_gif
|
|
|
13468
14044
|
// In production, it's better to let the parent control rendering to keep Loader focused on UI.
|
|
13469
14045
|
// This change would improve testability, flexibility, and follow React best practices.
|
|
13470
14046
|
|
|
14047
|
+
/**
|
|
14048
|
+
* Props for the Loader component.
|
|
14049
|
+
*
|
|
14050
|
+
* @typedef {Object} LoaderProps
|
|
14051
|
+
*
|
|
14052
|
+
* @property {boolean} isLoading
|
|
14053
|
+
* Determines whether the loader is visible.
|
|
14054
|
+
*
|
|
14055
|
+
* @property {string} [loaderText='loading...']
|
|
14056
|
+
* Optional text displayed beneath the spinner.
|
|
14057
|
+
*
|
|
14058
|
+
* @property {React.ReactNode} [customLoader]
|
|
14059
|
+
* Custom loader element (replaces default GIF).
|
|
14060
|
+
*
|
|
14061
|
+
* @property {string} [className]
|
|
14062
|
+
* Extra class names applied to the outer container.
|
|
14063
|
+
*/
|
|
14064
|
+
|
|
14065
|
+
/**
|
|
14066
|
+
* Loader overlay that covers the entire screen.
|
|
14067
|
+
*
|
|
14068
|
+
* @param {LoaderProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
14069
|
+
*/
|
|
14070
|
+
|
|
13471
14071
|
function Loader(_ref) {
|
|
13472
14072
|
let {
|
|
13473
14073
|
isLoading,
|
|
13474
|
-
loaderText =
|
|
14074
|
+
loaderText = "loading...",
|
|
13475
14075
|
customLoader,
|
|
13476
|
-
className =
|
|
14076
|
+
className = ""
|
|
13477
14077
|
} = _ref;
|
|
13478
14078
|
return isLoading && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
13479
14079
|
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
@@ -13523,6 +14123,46 @@ const XMarkIcon_ForwardRef = /*#__PURE__*/ external_commonjs_react_commonjs2_rea
|
|
|
13523
14123
|
|
|
13524
14124
|
|
|
13525
14125
|
|
|
14126
|
+
/**
|
|
14127
|
+
* Props for the Modal component.
|
|
14128
|
+
*
|
|
14129
|
+
* @typedef {Object} ModalProps
|
|
14130
|
+
*
|
|
14131
|
+
* @property {boolean} isOpen
|
|
14132
|
+
* Whether the modal is visible.
|
|
14133
|
+
*
|
|
14134
|
+
* @property {() => void} [onClose]
|
|
14135
|
+
* Callback fired when the modal requests to close (Escape key or close button).
|
|
14136
|
+
*
|
|
14137
|
+
* @property {boolean} [isLoading]
|
|
14138
|
+
* Shows a loader overlay inside the modal content.
|
|
14139
|
+
*
|
|
14140
|
+
* @property {string} [loaderText]
|
|
14141
|
+
* Text passed to the loader when isLoading = true.
|
|
14142
|
+
*
|
|
14143
|
+
* @property {React.ReactNode} [header]
|
|
14144
|
+
* Content rendered in the modal header.
|
|
14145
|
+
*
|
|
14146
|
+
* @property {React.ReactNode} [body]
|
|
14147
|
+
* Content rendered in the modal body.
|
|
14148
|
+
*
|
|
14149
|
+
* @property {React.ReactNode} [footer]
|
|
14150
|
+
* Content rendered in the modal footer.
|
|
14151
|
+
*
|
|
14152
|
+
* @property {string} [className]
|
|
14153
|
+
* Additional classes for the modal container.
|
|
14154
|
+
*
|
|
14155
|
+
* @property {string} [footerClassName]
|
|
14156
|
+
*
|
|
14157
|
+
* @property {string} [headerClassName]
|
|
14158
|
+
*/
|
|
14159
|
+
|
|
14160
|
+
/**
|
|
14161
|
+
* Modal component written in JavaScript but fully typed using JSDoc.
|
|
14162
|
+
*
|
|
14163
|
+
* @param {ModalProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
14164
|
+
*/
|
|
14165
|
+
|
|
13526
14166
|
const Modal = _ref => {
|
|
13527
14167
|
let {
|
|
13528
14168
|
isOpen,
|
|
@@ -22290,15 +22930,62 @@ const C247Tasks = props => /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(task
|
|
|
22290
22930
|
|
|
22291
22931
|
|
|
22292
22932
|
|
|
22293
|
-
/**
|
|
22294
|
-
*
|
|
22295
|
-
*
|
|
22296
|
-
|
|
22297
|
-
|
|
22298
|
-
|
|
22299
|
-
*
|
|
22300
|
-
*
|
|
22301
|
-
|
|
22933
|
+
/**
|
|
22934
|
+
* All valid keys for heroicons.
|
|
22935
|
+
* @typedef {keyof typeof HeroIcons} HeroIconName
|
|
22936
|
+
*/
|
|
22937
|
+
|
|
22938
|
+
/**
|
|
22939
|
+
* All valid keys for your custom C247 icons.
|
|
22940
|
+
* @typedef {keyof typeof C247Icons} C247IconName
|
|
22941
|
+
*/
|
|
22942
|
+
|
|
22943
|
+
/**
|
|
22944
|
+
* Allowed icon name type (union of dynamic keys).
|
|
22945
|
+
* @typedef {HeroIconName | C247IconName} IconName
|
|
22946
|
+
*/
|
|
22947
|
+
|
|
22948
|
+
/**
|
|
22949
|
+
* Which icon library to use.
|
|
22950
|
+
* @typedef {'hero'|'c247'} IconLibrary
|
|
22951
|
+
*/
|
|
22952
|
+
|
|
22953
|
+
/**
|
|
22954
|
+
* Props for the generic Icon component.
|
|
22955
|
+
*
|
|
22956
|
+
* @typedef {Object} IconProps
|
|
22957
|
+
*
|
|
22958
|
+
* @property {IconName} name
|
|
22959
|
+
* The dynamic icon name to render.
|
|
22960
|
+
*
|
|
22961
|
+
* @property {IconLibrary} [library='hero']
|
|
22962
|
+
* Which icon set to render from.
|
|
22963
|
+
*
|
|
22964
|
+
* @property {number} [size=18]
|
|
22965
|
+
* Icon size in pixels.
|
|
22966
|
+
*
|
|
22967
|
+
* @property {string} [className]
|
|
22968
|
+
* Extra classes for styling.
|
|
22969
|
+
*
|
|
22970
|
+
* @property {string} [color]
|
|
22971
|
+
* Optional CSS color override.
|
|
22972
|
+
*/
|
|
22973
|
+
|
|
22974
|
+
/**
|
|
22975
|
+
* Generic Icon component supporting HeroIcons and C247 icons.
|
|
22976
|
+
*
|
|
22977
|
+
* @param {IconProps & React.SVGProps<SVGSVGElement>} props
|
|
22978
|
+
*/
|
|
22979
|
+
|
|
22980
|
+
/**
|
|
22981
|
+
* Generic Icon component supporting HeroIcons and C247 icons.
|
|
22982
|
+
*
|
|
22983
|
+
* Props:
|
|
22984
|
+
* - name: string - icon name
|
|
22985
|
+
* - library: 'hero' | 'c247' (default: 'hero')
|
|
22986
|
+
* - size: number (default: 24)
|
|
22987
|
+
* - className: string
|
|
22988
|
+
* - color: string
|
|
22302
22989
|
*/
|
|
22303
22990
|
|
|
22304
22991
|
const Icon = _ref => {
|
|
@@ -22333,6 +23020,48 @@ function SidebarItem_objectWithoutPropertiesLoose(r, e) { if (null == r) return
|
|
|
22333
23020
|
|
|
22334
23021
|
|
|
22335
23022
|
|
|
23023
|
+
/**
|
|
23024
|
+
* Icon props (importing from your Icon component typedef).
|
|
23025
|
+
* @typedef {import('../Icon/Icon').IconProps} IconProps
|
|
23026
|
+
*/
|
|
23027
|
+
|
|
23028
|
+
/**
|
|
23029
|
+
* A sidebar leaf item (no children).
|
|
23030
|
+
* @typedef {Object} SidebarItemMenu
|
|
23031
|
+
* @property {string|number} key
|
|
23032
|
+
* @property {string} name
|
|
23033
|
+
* @property {string} [path]
|
|
23034
|
+
* @property {string} [href]
|
|
23035
|
+
* @property {IconProps} [iconProps]
|
|
23036
|
+
*/
|
|
23037
|
+
|
|
23038
|
+
/**
|
|
23039
|
+
* Props for SidebarItem.
|
|
23040
|
+
*
|
|
23041
|
+
* @typedef {Object} SidebarItemProps
|
|
23042
|
+
*
|
|
23043
|
+
* @property {SidebarItemMenu} menu
|
|
23044
|
+
* The menu item to render.
|
|
23045
|
+
*
|
|
23046
|
+
* @property {boolean} open
|
|
23047
|
+
* Whether the sidebar is expanded.
|
|
23048
|
+
*
|
|
23049
|
+
* @property {boolean} [active=false]
|
|
23050
|
+
* Whether this item is currently active.
|
|
23051
|
+
*
|
|
23052
|
+
* @property {keyof JSX.IntrinsicElements | React.ComponentType<any>} [as='div']
|
|
23053
|
+
* Polymorphic wrapper: div, a, button, Link, etc.
|
|
23054
|
+
*
|
|
23055
|
+
* @property {() => void} [onClick]
|
|
23056
|
+
* Fired when the item is clicked.
|
|
23057
|
+
*/
|
|
23058
|
+
|
|
23059
|
+
/**
|
|
23060
|
+
* Fully typed SidebarItem component.
|
|
23061
|
+
*
|
|
23062
|
+
* @param {SidebarItemProps & React.HTMLAttributes<HTMLElement>} props
|
|
23063
|
+
*/
|
|
23064
|
+
|
|
22336
23065
|
function SidebarItem(_ref) {
|
|
22337
23066
|
let {
|
|
22338
23067
|
menu,
|
|
@@ -22379,6 +23108,57 @@ function SidebarGroup_toPrimitive(t, r) { if ("object" != typeof t || !t) return
|
|
|
22379
23108
|
|
|
22380
23109
|
|
|
22381
23110
|
|
|
23111
|
+
/**
|
|
23112
|
+
* Icon props used by your dynamic Icon component (optional).
|
|
23113
|
+
* @typedef {import('../Icon/Icon').IconProps} IconProps
|
|
23114
|
+
*/
|
|
23115
|
+
|
|
23116
|
+
/**
|
|
23117
|
+
* A single child menu item.
|
|
23118
|
+
* @typedef {Object} SidebarChild
|
|
23119
|
+
* @property {string|number} key
|
|
23120
|
+
* @property {string} name
|
|
23121
|
+
* @property {string} [path]
|
|
23122
|
+
* @property {string} [href]
|
|
23123
|
+
* @property {IconProps} [iconProps]
|
|
23124
|
+
*/
|
|
23125
|
+
|
|
23126
|
+
/**
|
|
23127
|
+
* Sidebar group object containing children.
|
|
23128
|
+
* @typedef {Object} SidebarGroupMenu
|
|
23129
|
+
* @property {string|number} key
|
|
23130
|
+
* @property {string} name
|
|
23131
|
+
* @property {SidebarChild[]} children
|
|
23132
|
+
* @property {IconProps} [iconProps]
|
|
23133
|
+
*/
|
|
23134
|
+
|
|
23135
|
+
/**
|
|
23136
|
+
* Props for SidebarGroup component.
|
|
23137
|
+
*
|
|
23138
|
+
* @typedef {Object} SidebarGroupProps
|
|
23139
|
+
*
|
|
23140
|
+
* @property {SidebarGroupMenu} menu
|
|
23141
|
+
* The group menu containing children.
|
|
23142
|
+
*
|
|
23143
|
+
* @property {boolean} open
|
|
23144
|
+
* Whether the sidebar is currently expanded.
|
|
23145
|
+
*
|
|
23146
|
+
* @property {string|number|null} activeItem
|
|
23147
|
+
* The currently selected menu item key.
|
|
23148
|
+
*
|
|
23149
|
+
* @property {(key: string|number) => void} onItemClick
|
|
23150
|
+
* Handler fired when a child item is selected.
|
|
23151
|
+
*
|
|
23152
|
+
* @property {(open: boolean) => void} toggleSidebar
|
|
23153
|
+
* Used to open the sidebar when clicking a group.
|
|
23154
|
+
*/
|
|
23155
|
+
|
|
23156
|
+
/**
|
|
23157
|
+
* Fully typed SidebarGroup component.
|
|
23158
|
+
*
|
|
23159
|
+
* @param {SidebarGroupProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
23160
|
+
*/
|
|
23161
|
+
|
|
22382
23162
|
function SidebarGroup(_ref) {
|
|
22383
23163
|
let {
|
|
22384
23164
|
menu,
|
|
@@ -22459,6 +23239,31 @@ function Link(_ref) {
|
|
|
22459
23239
|
|
|
22460
23240
|
|
|
22461
23241
|
|
|
23242
|
+
/**
|
|
23243
|
+
* Shape of the user object
|
|
23244
|
+
* @typedef {Object} ProfileCardUser
|
|
23245
|
+
* @property {string} name
|
|
23246
|
+
* @property {string} role
|
|
23247
|
+
*/
|
|
23248
|
+
|
|
23249
|
+
/**
|
|
23250
|
+
* Props for ProfileCard.
|
|
23251
|
+
*
|
|
23252
|
+
* @typedef {Object} ProfileCardProps
|
|
23253
|
+
*
|
|
23254
|
+
* @property {ProfileCardUser} user
|
|
23255
|
+
* The user object containing name + role.
|
|
23256
|
+
*
|
|
23257
|
+
* @property {string} [href]
|
|
23258
|
+
* If provided, the card becomes a link instead of a div.
|
|
23259
|
+
*/
|
|
23260
|
+
|
|
23261
|
+
/**
|
|
23262
|
+
* ProfileCard with polymorphic wrapper (Link or div).
|
|
23263
|
+
*
|
|
23264
|
+
* @param {ProfileCardProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
23265
|
+
*/
|
|
23266
|
+
|
|
22462
23267
|
function ProfileCard(_ref) {
|
|
22463
23268
|
let {
|
|
22464
23269
|
user,
|
|
@@ -22546,6 +23351,68 @@ var sidebar_update = injectStylesIntoStyleTag_default()(sidebar/* default */.A,
|
|
|
22546
23351
|
|
|
22547
23352
|
|
|
22548
23353
|
|
|
23354
|
+
/**
|
|
23355
|
+
* A single menu item (no children).
|
|
23356
|
+
* @typedef {Object} SidebarMenuItem
|
|
23357
|
+
* @property {string|number} key
|
|
23358
|
+
* @property {string} name
|
|
23359
|
+
* @property {string} [icon] // optional icon name depending on your app
|
|
23360
|
+
* @property {string} [href] // optional link target
|
|
23361
|
+
*/
|
|
23362
|
+
|
|
23363
|
+
/**
|
|
23364
|
+
* A grouped menu entry with children.
|
|
23365
|
+
* @typedef {Object} SidebarMenuGroup
|
|
23366
|
+
* @property {string|number} key
|
|
23367
|
+
* @property {string} name
|
|
23368
|
+
* @property {SidebarMenuItem[]} children
|
|
23369
|
+
*/
|
|
23370
|
+
|
|
23371
|
+
/**
|
|
23372
|
+
* A full menu entry (either group or leaf item).
|
|
23373
|
+
* @typedef {SidebarMenuItem | SidebarMenuGroup} SidebarMenu
|
|
23374
|
+
*/
|
|
23375
|
+
|
|
23376
|
+
/**
|
|
23377
|
+
* Minimal shape expected for SidebarProfile.
|
|
23378
|
+
* @typedef {Object} SidebarUser
|
|
23379
|
+
* @property {string|number} id
|
|
23380
|
+
* @property {string} name
|
|
23381
|
+
* @property {string} role
|
|
23382
|
+
* @property {string} [avatar] // optional depending on your design
|
|
23383
|
+
*/
|
|
23384
|
+
|
|
23385
|
+
/**
|
|
23386
|
+
* Props for Sidebar.
|
|
23387
|
+
*
|
|
23388
|
+
* @typedef {Object} SidebarProps
|
|
23389
|
+
*
|
|
23390
|
+
* @property {SidebarMenu[]} menus
|
|
23391
|
+
* All sidebar menu items (groups + items).
|
|
23392
|
+
*
|
|
23393
|
+
* @property {SidebarUser} user
|
|
23394
|
+
* The current logged-in user.
|
|
23395
|
+
*
|
|
23396
|
+
* @property {string|number|null} [activeItem]
|
|
23397
|
+
* Key of the currently selected item.
|
|
23398
|
+
*
|
|
23399
|
+
* @property {(key: string|number) => void} [onItemClick]
|
|
23400
|
+
* Fired when a menu item is clicked.
|
|
23401
|
+
*
|
|
23402
|
+
* @property {string} [logo]
|
|
23403
|
+
* Optional logo override.
|
|
23404
|
+
*
|
|
23405
|
+
* @property {string} [searchValue='']
|
|
23406
|
+
*
|
|
23407
|
+
* @property {(value: string) => void} [onSearchChange]
|
|
23408
|
+
*/
|
|
23409
|
+
|
|
23410
|
+
/**
|
|
23411
|
+
* Fully typed Sidebar component.
|
|
23412
|
+
*
|
|
23413
|
+
* @param {SidebarProps & React.HTMLAttributes<HTMLDivElement>} props
|
|
23414
|
+
*/
|
|
23415
|
+
|
|
22549
23416
|
function Sidebar(_ref) {
|
|
22550
23417
|
let {
|
|
22551
23418
|
menus,
|