opus-toolkit-components 1.6.0 → 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",
|
|
@@ -4621,33 +4697,79 @@ var datepicker_update = injectStylesIntoStyleTag_default()(datepicker/* default
|
|
|
4621
4697
|
|
|
4622
4698
|
|
|
4623
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
|
+
|
|
4624
4746
|
function DatePicker(_ref) {
|
|
4625
4747
|
let {
|
|
4626
|
-
initialDate =
|
|
4627
|
-
label =
|
|
4748
|
+
initialDate = "",
|
|
4749
|
+
label = "Select a Date:",
|
|
4628
4750
|
isValid = true,
|
|
4629
|
-
errorMessage =
|
|
4630
|
-
name =
|
|
4751
|
+
errorMessage = "Error message",
|
|
4752
|
+
name = "date",
|
|
4631
4753
|
onChange,
|
|
4632
4754
|
value,
|
|
4633
|
-
className =
|
|
4634
|
-
title =
|
|
4755
|
+
className = "",
|
|
4756
|
+
title = "",
|
|
4635
4757
|
required = false,
|
|
4636
4758
|
dataCy,
|
|
4637
4759
|
disabled = false
|
|
4638
4760
|
} = _ref;
|
|
4639
|
-
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)("");
|
|
4640
4762
|
const inputRef = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useRef)(null);
|
|
4641
4763
|
const normalizeToInputFormat = dateString => {
|
|
4642
|
-
if (!dateString) return
|
|
4643
|
-
const [datePart] = dateString.split(
|
|
4764
|
+
if (!dateString) return "";
|
|
4765
|
+
const [datePart] = dateString.split(" "); // Remove time if present
|
|
4644
4766
|
|
|
4645
4767
|
if (/^\d{4}-\d{2}-\d{2}$/.test(datePart)) {
|
|
4646
4768
|
return datePart; // Already ISO format
|
|
4647
4769
|
}
|
|
4648
|
-
const parts = datePart.split(
|
|
4649
|
-
if (parts.length !== 3) return
|
|
4650
|
-
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"));
|
|
4651
4773
|
if (parseInt(part1, 10) > 12) {
|
|
4652
4774
|
// Assume dd/MM/yyyy
|
|
4653
4775
|
const [day, month, year] = [part1, part2, part3];
|
|
@@ -4682,14 +4804,14 @@ function DatePicker(_ref) {
|
|
|
4682
4804
|
}
|
|
4683
4805
|
};
|
|
4684
4806
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
4685
|
-
className: "relative flex flex-col
|
|
4807
|
+
className: "relative mb-4 flex flex-col",
|
|
4686
4808
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)(Text, {
|
|
4687
4809
|
as: "label",
|
|
4688
4810
|
variant: "label",
|
|
4689
4811
|
htmlFor: name,
|
|
4690
4812
|
className: "mb-1",
|
|
4691
4813
|
children: [label, required && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
4692
|
-
className: "text-[--color-util-red]
|
|
4814
|
+
className: "ml-1 text-[--color-util-red]",
|
|
4693
4815
|
children: "*"
|
|
4694
4816
|
})]
|
|
4695
4817
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("input", {
|
|
@@ -4708,15 +4830,15 @@ function DatePicker(_ref) {
|
|
|
4708
4830
|
}),
|
|
4709
4831
|
"aria-invalid": !isValid,
|
|
4710
4832
|
"aria-describedby": !isValid ? "".concat(name, "-error") : undefined,
|
|
4711
|
-
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)
|
|
4712
4834
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("button", {
|
|
4713
4835
|
type: "button",
|
|
4714
4836
|
onClick: handleIconClick,
|
|
4715
|
-
className: "absolute top-1/2 mt-1
|
|
4837
|
+
className: "datepicker-icon-button absolute right-3 top-1/2 mt-1 transform",
|
|
4716
4838
|
"aria-label": "Open date picker",
|
|
4717
4839
|
disabled: disabled,
|
|
4718
4840
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(esm_CalendarIcon, {
|
|
4719
|
-
className: "
|
|
4841
|
+
className: "h-5 w-5 ".concat(disabled ? "text-[--color-text-disabled]" : "text-[--color-text-weak] hover:text-[--color-primary-btn-hover]", " transition")
|
|
4720
4842
|
})
|
|
4721
4843
|
}), !isValid && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(Text, {
|
|
4722
4844
|
as: "span",
|
|
@@ -4732,6 +4854,60 @@ function DatePicker(_ref) {
|
|
|
4732
4854
|
|
|
4733
4855
|
|
|
4734
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
|
+
|
|
4735
4911
|
const RadioButton = _ref => {
|
|
4736
4912
|
let {
|
|
4737
4913
|
label,
|
|
@@ -4826,6 +5002,49 @@ RadioButton.displayName = "RadioButton";
|
|
|
4826
5002
|
|
|
4827
5003
|
|
|
4828
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
|
+
|
|
4829
5048
|
function Checkbox(_ref) {
|
|
4830
5049
|
let {
|
|
4831
5050
|
label,
|
|
@@ -4833,7 +5052,7 @@ function Checkbox(_ref) {
|
|
|
4833
5052
|
onChange,
|
|
4834
5053
|
value = false,
|
|
4835
5054
|
isValid = true,
|
|
4836
|
-
errorMessage =
|
|
5055
|
+
errorMessage = "",
|
|
4837
5056
|
disabled = false,
|
|
4838
5057
|
title,
|
|
4839
5058
|
dataCy
|
|
@@ -4842,7 +5061,7 @@ function Checkbox(_ref) {
|
|
|
4842
5061
|
const errorId = "".concat(id, "-error");
|
|
4843
5062
|
const showError = !isValid && errorMessage;
|
|
4844
5063
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
4845
|
-
className: "flex flex-col
|
|
5064
|
+
className: "mb-4 flex flex-col",
|
|
4846
5065
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
4847
5066
|
className: "flex items-center",
|
|
4848
5067
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("input", {
|
|
@@ -4861,9 +5080,9 @@ function Checkbox(_ref) {
|
|
|
4861
5080
|
"aria-describedby": showError ? errorId : undefined,
|
|
4862
5081
|
"aria-disabled": disabled,
|
|
4863
5082
|
style: {
|
|
4864
|
-
accentColor:
|
|
5083
|
+
accentColor: "var(--color-primary-btn)"
|
|
4865
5084
|
},
|
|
4866
|
-
className: "
|
|
5085
|
+
className: "mr-2 rounded-sm ".concat(disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer")
|
|
4867
5086
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(Text, {
|
|
4868
5087
|
variant: "label",
|
|
4869
5088
|
as: "label",
|
|
@@ -4874,7 +5093,7 @@ function Checkbox(_ref) {
|
|
|
4874
5093
|
id: errorId,
|
|
4875
5094
|
variant: "small",
|
|
4876
5095
|
as: "span",
|
|
4877
|
-
className: "text-[--color-util-red]
|
|
5096
|
+
className: "mt-1 text-[--color-util-red]",
|
|
4878
5097
|
children: errorMessage
|
|
4879
5098
|
})]
|
|
4880
5099
|
});
|
|
@@ -4912,37 +5131,87 @@ var table_update = injectStylesIntoStyleTag_default()(table/* default */.A, tabl
|
|
|
4912
5131
|
|
|
4913
5132
|
|
|
4914
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
|
+
|
|
4915
5184
|
function Table(_ref) {
|
|
4916
5185
|
let {
|
|
4917
5186
|
data = [],
|
|
4918
5187
|
rows = [],
|
|
4919
|
-
className =
|
|
4920
|
-
rowClassName =
|
|
4921
|
-
cellClassName =
|
|
4922
|
-
headRowClassName =
|
|
4923
|
-
headCellClassName =
|
|
5188
|
+
className = "",
|
|
5189
|
+
rowClassName = "",
|
|
5190
|
+
cellClassName = "",
|
|
5191
|
+
headRowClassName = "",
|
|
5192
|
+
headCellClassName = "",
|
|
4924
5193
|
rowKeyExtractor = (row, index) => index
|
|
4925
5194
|
} = _ref;
|
|
4926
5195
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
4927
5196
|
className: "wrapper w-full ".concat(className),
|
|
4928
5197
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("table", {
|
|
4929
|
-
className: "
|
|
5198
|
+
className: "table min-w-full table-auto border-collapse text-left",
|
|
4930
5199
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("thead", {
|
|
4931
5200
|
className: "hidden sm:table-header-group",
|
|
4932
5201
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("tr", {
|
|
4933
5202
|
className: "bg-[--color-table-head-bg] ".concat(headRowClassName),
|
|
4934
5203
|
children: data.map(column => /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("th", {
|
|
4935
|
-
className: "
|
|
5204
|
+
className: "border-b border-[--color-stroke] px-4 py-2 text-sm font-normal text-[--color-table-head-txt] ".concat(headCellClassName),
|
|
4936
5205
|
children: column.header
|
|
4937
5206
|
}, column.key))
|
|
4938
5207
|
})
|
|
4939
5208
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("tbody", {
|
|
4940
5209
|
children: rows.map((row, index) => {
|
|
4941
|
-
const backgroundClass = index % 2 === 0 ?
|
|
5210
|
+
const backgroundClass = index % 2 === 0 ? "bg-[--color-table-row-bg-even]" : "bg-[--color-table-row-bg-odd]";
|
|
4942
5211
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("tr", {
|
|
4943
|
-
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),
|
|
4944
5213
|
children: data.map(column => /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("td", {
|
|
4945
|
-
className: "
|
|
5214
|
+
className: "block text-sm text-[--color-text-weak] sm:table-cell lg:px-4 lg:py-2 ".concat(cellClassName),
|
|
4946
5215
|
"data-label": column.header,
|
|
4947
5216
|
children: column.render ? column.render(row) : row[column.key]
|
|
4948
5217
|
}, column.key))
|
|
@@ -13500,21 +13769,83 @@ const esm_ChevronDownIcon_ForwardRef = /*#__PURE__*/ external_commonjs_react_com
|
|
|
13500
13769
|
|
|
13501
13770
|
|
|
13502
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
|
+
|
|
13503
13834
|
function Dropdown(_ref) {
|
|
13504
13835
|
let {
|
|
13505
13836
|
items = [],
|
|
13506
|
-
label =
|
|
13837
|
+
label = "Test Label",
|
|
13507
13838
|
isValid = true,
|
|
13508
13839
|
required = false,
|
|
13509
|
-
placeholder =
|
|
13840
|
+
placeholder = "Example Placeholder",
|
|
13510
13841
|
name,
|
|
13511
|
-
className =
|
|
13512
|
-
title =
|
|
13513
|
-
tabIndex =
|
|
13842
|
+
className = "",
|
|
13843
|
+
title = "",
|
|
13844
|
+
tabIndex = "",
|
|
13514
13845
|
onChange,
|
|
13515
13846
|
value,
|
|
13516
13847
|
Icon,
|
|
13517
|
-
errorMessage =
|
|
13848
|
+
errorMessage = "This field is required",
|
|
13518
13849
|
disabled = false,
|
|
13519
13850
|
dataCy
|
|
13520
13851
|
} = _ref;
|
|
@@ -13523,7 +13854,7 @@ function Dropdown(_ref) {
|
|
|
13523
13854
|
const newSelectedItem = items.find(item => item.value === value) || null;
|
|
13524
13855
|
setSelectedItem(newSelectedItem);
|
|
13525
13856
|
}, [value, items]);
|
|
13526
|
-
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" : "");
|
|
13527
13858
|
const handleSelect = item => {
|
|
13528
13859
|
if (disabled) return;
|
|
13529
13860
|
setSelectedItem(item);
|
|
@@ -13536,7 +13867,7 @@ function Dropdown(_ref) {
|
|
|
13536
13867
|
onChange === null || onChange === void 0 || onChange(event);
|
|
13537
13868
|
};
|
|
13538
13869
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
13539
|
-
className: "flex flex-col
|
|
13870
|
+
className: "mb-4 flex flex-col ".concat(className),
|
|
13540
13871
|
children: [/*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)(Text, {
|
|
13541
13872
|
as: "label",
|
|
13542
13873
|
variant: "label",
|
|
@@ -13575,10 +13906,10 @@ function Dropdown(_ref) {
|
|
|
13575
13906
|
})]
|
|
13576
13907
|
}), /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(solid_esm_ChevronDownIcon, {
|
|
13577
13908
|
"aria-hidden": "true",
|
|
13578
|
-
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")
|
|
13579
13910
|
})]
|
|
13580
13911
|
}), !disabled && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(yt, {
|
|
13581
|
-
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",
|
|
13582
13913
|
children: /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
13583
13914
|
className: "py-1",
|
|
13584
13915
|
children: items.map((item, index) => /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(gt, {
|
|
@@ -13589,7 +13920,7 @@ function Dropdown(_ref) {
|
|
|
13589
13920
|
return /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)("button", {
|
|
13590
13921
|
type: "button",
|
|
13591
13922
|
onClick: () => handleSelect(item),
|
|
13592
|
-
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]" : ""),
|
|
13593
13924
|
children: item.label
|
|
13594
13925
|
});
|
|
13595
13926
|
}
|
|
@@ -13602,7 +13933,7 @@ function Dropdown(_ref) {
|
|
|
13602
13933
|
as: "span",
|
|
13603
13934
|
variant: "small",
|
|
13604
13935
|
id: "".concat(name, "-error"),
|
|
13605
|
-
className: "text-[--color-util-red]
|
|
13936
|
+
className: "mt-1 text-[--color-util-red]",
|
|
13606
13937
|
children: errorMessage
|
|
13607
13938
|
})]
|
|
13608
13939
|
});
|
|
@@ -13650,6 +13981,30 @@ var c247_icon_only_2x_png_default = /*#__PURE__*/__webpack_require__.n(c247_icon
|
|
|
13650
13981
|
|
|
13651
13982
|
|
|
13652
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
|
+
|
|
13653
14008
|
const Navbar = _ref => {
|
|
13654
14009
|
let {
|
|
13655
14010
|
children,
|
|
@@ -13689,12 +14044,36 @@ var c247_loader_gif_default = /*#__PURE__*/__webpack_require__.n(c247_loader_gif
|
|
|
13689
14044
|
// In production, it's better to let the parent control rendering to keep Loader focused on UI.
|
|
13690
14045
|
// This change would improve testability, flexibility, and follow React best practices.
|
|
13691
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
|
+
|
|
13692
14071
|
function Loader(_ref) {
|
|
13693
14072
|
let {
|
|
13694
14073
|
isLoading,
|
|
13695
|
-
loaderText =
|
|
14074
|
+
loaderText = "loading...",
|
|
13696
14075
|
customLoader,
|
|
13697
|
-
className =
|
|
14076
|
+
className = ""
|
|
13698
14077
|
} = _ref;
|
|
13699
14078
|
return isLoading && /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
13700
14079
|
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
@@ -13744,6 +14123,46 @@ const XMarkIcon_ForwardRef = /*#__PURE__*/ external_commonjs_react_commonjs2_rea
|
|
|
13744
14123
|
|
|
13745
14124
|
|
|
13746
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
|
+
|
|
13747
14166
|
const Modal = _ref => {
|
|
13748
14167
|
let {
|
|
13749
14168
|
isOpen,
|
|
@@ -22511,15 +22930,62 @@ const C247Tasks = props => /*#__PURE__*/(0,jsx_runtime_namespaceObject.jsx)(task
|
|
|
22511
22930
|
|
|
22512
22931
|
|
|
22513
22932
|
|
|
22514
|
-
/**
|
|
22515
|
-
*
|
|
22516
|
-
*
|
|
22517
|
-
|
|
22518
|
-
|
|
22519
|
-
|
|
22520
|
-
*
|
|
22521
|
-
*
|
|
22522
|
-
|
|
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
|
|
22523
22989
|
*/
|
|
22524
22990
|
|
|
22525
22991
|
const Icon = _ref => {
|
|
@@ -22554,6 +23020,48 @@ function SidebarItem_objectWithoutPropertiesLoose(r, e) { if (null == r) return
|
|
|
22554
23020
|
|
|
22555
23021
|
|
|
22556
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
|
+
|
|
22557
23065
|
function SidebarItem(_ref) {
|
|
22558
23066
|
let {
|
|
22559
23067
|
menu,
|
|
@@ -22600,6 +23108,57 @@ function SidebarGroup_toPrimitive(t, r) { if ("object" != typeof t || !t) return
|
|
|
22600
23108
|
|
|
22601
23109
|
|
|
22602
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
|
+
|
|
22603
23162
|
function SidebarGroup(_ref) {
|
|
22604
23163
|
let {
|
|
22605
23164
|
menu,
|
|
@@ -22680,6 +23239,31 @@ function Link(_ref) {
|
|
|
22680
23239
|
|
|
22681
23240
|
|
|
22682
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
|
+
|
|
22683
23267
|
function ProfileCard(_ref) {
|
|
22684
23268
|
let {
|
|
22685
23269
|
user,
|
|
@@ -22767,6 +23351,68 @@ var sidebar_update = injectStylesIntoStyleTag_default()(sidebar/* default */.A,
|
|
|
22767
23351
|
|
|
22768
23352
|
|
|
22769
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
|
+
|
|
22770
23416
|
function Sidebar(_ref) {
|
|
22771
23417
|
let {
|
|
22772
23418
|
menus,
|