ywana-core8 0.1.76 → 0.1.78

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.
@@ -1348,7 +1348,7 @@ var PropTypes = propTypes;
1348
1348
  */
1349
1349
  var SiteContext = React.createContext({});
1350
1350
 
1351
- var _excluded$e = ["format", "children", "className", "size", "weight", "color", "align", "transform", "decoration", "truncate", "maxLength", "locale", "currency", "minimumFractionDigits", "maximumFractionDigits", "dateStyle", "timeStyle", "fallback", "loading", "skeleton", "copyable", "selectable", "as", "style", "onClick"];
1351
+ var _excluded$h = ["format", "children", "className", "size", "weight", "color", "align", "transform", "decoration", "truncate", "maxLength", "locale", "currency", "minimumFractionDigits", "maximumFractionDigits", "dateStyle", "timeStyle", "fallback", "loading", "skeleton", "copyable", "selectable", "as", "style", "onClick"];
1352
1352
  function _catch$c(body, recover) {
1353
1353
  try {
1354
1354
  var result = body();
@@ -1419,7 +1419,7 @@ var Text = function Text(props) {
1419
1419
  as = _props$as === void 0 ? 'span' : _props$as,
1420
1420
  style = props.style,
1421
1421
  onClick = props.onClick,
1422
- restProps = _objectWithoutPropertiesLoose(props, _excluded$e);
1422
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$h);
1423
1423
  var site = useContext(SiteContext);
1424
1424
 
1425
1425
  // Memoize formatted value for performance
@@ -1787,8 +1787,8 @@ Icon.defaultProps = {
1787
1787
  className: ''
1788
1788
  };
1789
1789
 
1790
- var _excluded$d = ["className", "sections", "disabled", "allowMultiple", "animated", "onCheck", "onToggle", "onSectionChange", "ariaLabel"],
1791
- _excluded2$8 = ["checked", "icon", "title", "subtitle", "open", "disabled", "animated", "sectionIndex", "onToggle", "onCheck", "toolbar", "info", "children", "ariaLabel"];
1790
+ var _excluded$g = ["className", "sections", "disabled", "allowMultiple", "animated", "onCheck", "onToggle", "onSectionChange", "ariaLabel"],
1791
+ _excluded2$9 = ["checked", "icon", "title", "subtitle", "open", "disabled", "animated", "sectionIndex", "onToggle", "onCheck", "toolbar", "info", "children", "ariaLabel"];
1792
1792
 
1793
1793
  /**
1794
1794
  * Enhanced Accordion component with improved accessibility and robustness
@@ -1807,7 +1807,7 @@ var Accordion = function Accordion(props) {
1807
1807
  onToggle = props.onToggle,
1808
1808
  onSectionChange = props.onSectionChange,
1809
1809
  ariaLabel = props.ariaLabel,
1810
- restProps = _objectWithoutPropertiesLoose(props, _excluded$d);
1810
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
1811
1811
  var _useState = useState([]),
1812
1812
  openSections = _useState[0],
1813
1813
  setOpenSections = _useState[1];
@@ -1924,7 +1924,7 @@ var AccordionSection = function AccordionSection(props) {
1924
1924
  info = props.info,
1925
1925
  children = props.children,
1926
1926
  ariaLabel = props.ariaLabel,
1927
- restProps = _objectWithoutPropertiesLoose(props, _excluded2$8);
1927
+ restProps = _objectWithoutPropertiesLoose(props, _excluded2$9);
1928
1928
  var togglerIcon = open ? "expand_less" : "expand_more";
1929
1929
  var checkedIcon = checked === undefined || checked === null ? null : checked === false ? "check_box_outline_blank" : "check_box";
1930
1930
 
@@ -2053,8 +2053,8 @@ Accordion.defaultProps = {
2053
2053
  animated: true
2054
2054
  };
2055
2055
 
2056
- var _excluded$c = ["id", "label", "icon", "action", "disabled", "loading", "outlined", "raised", "size", "type", "className", "ariaLabel", "tooltip", "form", "onClick", "onFocus", "onBlur", "onKeyDown"],
2057
- _excluded2$7 = ["states", "state", "className", "disabled", "onStateChange"];
2056
+ var _excluded$f = ["id", "label", "icon", "action", "disabled", "loading", "outlined", "raised", "size", "type", "className", "ariaLabel", "tooltip", "form", "onClick", "onFocus", "onBlur", "onKeyDown"],
2057
+ _excluded2$8 = ["states", "state", "className", "disabled", "onStateChange"];
2058
2058
  function _catch$b(body, recover) {
2059
2059
  try {
2060
2060
  var result = body();
@@ -2109,7 +2109,7 @@ var Button = function Button(props) {
2109
2109
  onFocus = props.onFocus,
2110
2110
  onBlur = props.onBlur,
2111
2111
  onKeyDown = props.onKeyDown,
2112
- restProps = _objectWithoutPropertiesLoose(props, _excluded$c);
2112
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$f);
2113
2113
 
2114
2114
  // Validate required props
2115
2115
  if (!label && !icon && !ariaLabel) {
@@ -2222,7 +2222,7 @@ var ActionButton = function ActionButton(props) {
2222
2222
  _props$disabled2 = props.disabled,
2223
2223
  disabled = _props$disabled2 === void 0 ? false : _props$disabled2,
2224
2224
  onStateChange = props.onStateChange,
2225
- restProps = _objectWithoutPropertiesLoose(props, _excluded2$7);
2225
+ restProps = _objectWithoutPropertiesLoose(props, _excluded2$8);
2226
2226
  var _useState = useState(state),
2227
2227
  currentState = _useState[0],
2228
2228
  setCurrentState = _useState[1];
@@ -2473,8 +2473,8 @@ CheckBox.defaultProps = {
2473
2473
  className: ''
2474
2474
  };
2475
2475
 
2476
- var _excluded$b = ["id", "icon", "label", "tooltip", "action", "outlined", "selected", "disabled", "deletable", "size", "variant", "className", "ariaLabel", "onSelect", "onDelete", "onClick", "onKeyDown"],
2477
- _excluded2$6 = ["children", "items", "selected", "disabled", "deletable", "multiSelect", "size", "variant", "className", "onSelect", "onDelete", "onChange"];
2476
+ var _excluded$e = ["id", "icon", "label", "tooltip", "action", "outlined", "selected", "disabled", "deletable", "size", "variant", "className", "ariaLabel", "onSelect", "onDelete", "onClick", "onKeyDown"],
2477
+ _excluded2$7 = ["children", "items", "selected", "disabled", "deletable", "multiSelect", "size", "variant", "className", "onSelect", "onDelete", "onChange"];
2478
2478
 
2479
2479
  /**
2480
2480
  * Chip component with enhanced features and accessibility
@@ -2503,7 +2503,7 @@ var Chip = function Chip(props) {
2503
2503
  onDelete = props.onDelete,
2504
2504
  onClick = props.onClick,
2505
2505
  onKeyDown = props.onKeyDown,
2506
- restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
2506
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$e);
2507
2507
 
2508
2508
  // Validate required props
2509
2509
  if (!label && !icon && !ariaLabel) {
@@ -2605,7 +2605,7 @@ var Chips = function Chips(props) {
2605
2605
  onSelect = props.onSelect,
2606
2606
  onDelete = props.onDelete,
2607
2607
  onChange = props.onChange,
2608
- restProps = _objectWithoutPropertiesLoose(props, _excluded2$6);
2608
+ restProps = _objectWithoutPropertiesLoose(props, _excluded2$7);
2609
2609
  var _useState = useState(selected),
2610
2610
  selectedItems = _useState[0],
2611
2611
  setSelectedItems = _useState[1];
@@ -2770,7 +2770,7 @@ Chips.defaultProps = {
2770
2770
  className: ''
2771
2771
  };
2772
2772
 
2773
- var _excluded$a = ["id", "title", "columns", "children", "outlined", "disabled", "loading", "autoComplete", "noValidate", "className", "onChange", "onSubmit", "onReset", "onValidationChange"];
2773
+ var _excluded$d = ["id", "title", "columns", "children", "outlined", "disabled", "loading", "autoComplete", "noValidate", "className", "onChange", "onSubmit", "onReset", "onValidationChange"];
2774
2774
  function _catch$a(body, recover) {
2775
2775
  try {
2776
2776
  var result = body();
@@ -2821,7 +2821,7 @@ var Form = function Form(props) {
2821
2821
  onSubmit = props.onSubmit,
2822
2822
  onReset = props.onReset,
2823
2823
  onValidationChange = props.onValidationChange,
2824
- restProps = _objectWithoutPropertiesLoose(props, _excluded$a);
2824
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$d);
2825
2825
  var _useState = useState([]),
2826
2826
  fields = _useState[0],
2827
2827
  setFields = _useState[1];
@@ -3112,8 +3112,186 @@ var Header = function Header(props) {
3112
3112
  }, props.children));
3113
3113
  };
3114
3114
 
3115
- var _excluded$9 = ["value", "max", "size", "thickness", "variant", "color", "showValue", "showLabel", "label", "icon", "animated", "disabled", "className", "style", "children", "onComplete", "formatValue", "ariaLabel"],
3116
- _excluded2$5 = ["value", "max", "variant", "color", "size", "showValue", "showLabel", "label", "buffer", "animated", "striped", "disabled", "rounded", "className", "style", "onComplete", "formatValue", "ariaLabel", "estimatedTime", "speed"];
3115
+ var _excluded$c = ["title", "icon", "iconSrc", "img", "caption", "prominent", "dense", "primary", "secondary", "clickable", "disabled", "loading", "className", "children", "action", "ariaLabel", "role", "onClick", "onIconClick"];
3116
+
3117
+ /**
3118
+ * Enhanced Header component with improved accessibility and robustness
3119
+ * Maintains 100% visual compatibility with original Header
3120
+ */
3121
+ var Header2 = function Header2(props) {
3122
+ var title = props.title,
3123
+ icon = props.icon,
3124
+ iconSrc = props.iconSrc,
3125
+ img = props.img,
3126
+ _props$caption = props.caption,
3127
+ caption = _props$caption === void 0 ? false : _props$caption,
3128
+ _props$prominent = props.prominent,
3129
+ prominent = _props$prominent === void 0 ? false : _props$prominent,
3130
+ _props$dense = props.dense,
3131
+ dense = _props$dense === void 0 ? false : _props$dense,
3132
+ _props$primary = props.primary,
3133
+ primary = _props$primary === void 0 ? false : _props$primary,
3134
+ _props$secondary = props.secondary,
3135
+ secondary = _props$secondary === void 0 ? false : _props$secondary,
3136
+ _props$clickable = props.clickable,
3137
+ clickable = _props$clickable === void 0 ? false : _props$clickable,
3138
+ _props$disabled = props.disabled,
3139
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
3140
+ _props$loading = props.loading,
3141
+ loading = _props$loading === void 0 ? false : _props$loading,
3142
+ className = props.className,
3143
+ children = props.children,
3144
+ action = props.action,
3145
+ ariaLabel = props.ariaLabel,
3146
+ _props$role = props.role,
3147
+ role = _props$role === void 0 ? 'banner' : _props$role,
3148
+ onClick = props.onClick,
3149
+ onIconClick = props.onIconClick,
3150
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$c);
3151
+
3152
+ // Validate props
3153
+ if (!title && !icon && !iconSrc && !ariaLabel) {
3154
+ console.warn('Header2 component: title, icon, iconSrc, or ariaLabel should be provided for accessibility');
3155
+ }
3156
+
3157
+ // Handle icon click
3158
+ var handleIconClick = useCallback(function (event) {
3159
+ if (disabled || loading) return;
3160
+ if (onIconClick) {
3161
+ onIconClick(event);
3162
+ } else if (action) {
3163
+ action(event);
3164
+ }
3165
+ }, [disabled, loading, onIconClick, action]);
3166
+
3167
+ // Handle header click
3168
+ var handleClick = useCallback(function (event) {
3169
+ if (disabled || loading) return;
3170
+ if (onClick) {
3171
+ onClick(event);
3172
+ }
3173
+ }, [disabled, loading, onClick]);
3174
+
3175
+ // Generate CSS classes (maintaining exact same logic as original)
3176
+ var captionClass = caption ? 'caption' : '';
3177
+ var prominentClass = prominent ? 'prominent' : '';
3178
+ var denseClass = dense ? 'dense' : '';
3179
+ var themeClass = primary ? 'primary' : '';
3180
+ themeClass = secondary ? 'secondary' : themeClass;
3181
+ var safeClassName = className || '';
3182
+ var cssClasses = ['header2', captionClass, prominentClass, denseClass, themeClass, disabled && 'disabled', loading && 'loading', safeClassName].filter(Boolean).join(' ');
3183
+
3184
+ // Generate icon element (maintaining exact same logic as original)
3185
+ var iconElement = null;
3186
+ if (icon) {
3187
+ iconElement = /*#__PURE__*/React.createElement(Icon, {
3188
+ icon: icon,
3189
+ clickable: clickable && !disabled && !loading,
3190
+ action: handleIconClick,
3191
+ disabled: disabled,
3192
+ ariaLabel: icon + " icon"
3193
+ });
3194
+ } else if (iconSrc) {
3195
+ iconElement = /*#__PURE__*/React.createElement("img", {
3196
+ className: "header2-icon",
3197
+ src: iconSrc,
3198
+ alt: ariaLabel || title || 'Header icon',
3199
+ onClick: clickable && !disabled && !loading ? handleIconClick : undefined,
3200
+ style: {
3201
+ cursor: clickable && !disabled && !loading ? 'pointer' : 'default',
3202
+ opacity: disabled ? 0.6 : 1
3203
+ }
3204
+ });
3205
+ }
3206
+
3207
+ // Generate background style (maintaining exact same logic as original)
3208
+ var backgroundStyle = img ? {
3209
+ backgroundImage: "url(" + img + ")"
3210
+ } : {};
3211
+
3212
+ // Generate title element (maintaining exact same logic as original)
3213
+ var titleElement = title ? /*#__PURE__*/React.createElement("label", {
3214
+ className: "header2-title"
3215
+ }, /*#__PURE__*/React.createElement(Text, null, title)) : null;
3216
+
3217
+ // Accessibility attributes
3218
+ var ariaAttributes = {
3219
+ 'aria-label': ariaLabel || (typeof title === 'string' ? title : 'Header'),
3220
+ 'aria-disabled': disabled,
3221
+ 'aria-busy': loading,
3222
+ role: role
3223
+ };
3224
+ return /*#__PURE__*/React.createElement("header", _extends({
3225
+ className: cssClasses,
3226
+ style: backgroundStyle,
3227
+ onClick: onClick ? handleClick : undefined
3228
+ }, ariaAttributes, restProps), iconElement, titleElement, /*#__PURE__*/React.createElement("span", {
3229
+ className: "header2-actions",
3230
+ role: "toolbar",
3231
+ "aria-label": "Header actions"
3232
+ }, loading && /*#__PURE__*/React.createElement(Icon, {
3233
+ icon: "hourglass_empty",
3234
+ className: "header2-loading",
3235
+ ariaLabel: "Loading"
3236
+ }), children));
3237
+ };
3238
+
3239
+ // PropTypes for Header2
3240
+ Header2.propTypes = {
3241
+ /** Header title text */
3242
+ title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
3243
+ /** Material icon name */
3244
+ icon: PropTypes.string,
3245
+ /** Icon image source URL */
3246
+ iconSrc: PropTypes.string,
3247
+ /** Background image URL */
3248
+ img: PropTypes.string,
3249
+ /** Whether header has caption style (4rem height) */
3250
+ caption: PropTypes.bool,
3251
+ /** Whether header has prominent style (12.8rem height) */
3252
+ prominent: PropTypes.bool,
3253
+ /** Whether header has dense style (2.4rem height) */
3254
+ dense: PropTypes.bool,
3255
+ /** Whether header has primary theme */
3256
+ primary: PropTypes.bool,
3257
+ /** Whether header has secondary theme */
3258
+ secondary: PropTypes.bool,
3259
+ /** Whether icon is clickable */
3260
+ clickable: PropTypes.bool,
3261
+ /** Whether header is disabled */
3262
+ disabled: PropTypes.bool,
3263
+ /** Whether header is in loading state */
3264
+ loading: PropTypes.bool,
3265
+ /** Additional CSS classes */
3266
+ className: PropTypes.string,
3267
+ /** Action elements (buttons, etc.) */
3268
+ children: PropTypes.node,
3269
+ /** Icon click handler (legacy support) */
3270
+ action: PropTypes.func,
3271
+ /** ARIA label for accessibility */
3272
+ ariaLabel: PropTypes.string,
3273
+ /** ARIA role */
3274
+ role: PropTypes.string,
3275
+ /** Header click handler */
3276
+ onClick: PropTypes.func,
3277
+ /** Icon click handler */
3278
+ onIconClick: PropTypes.func
3279
+ };
3280
+ Header2.defaultProps = {
3281
+ caption: false,
3282
+ prominent: false,
3283
+ dense: false,
3284
+ primary: false,
3285
+ secondary: false,
3286
+ clickable: false,
3287
+ disabled: false,
3288
+ loading: false,
3289
+ role: 'banner',
3290
+ className: ''
3291
+ };
3292
+
3293
+ var _excluded$b = ["value", "max", "size", "thickness", "variant", "color", "showValue", "showLabel", "label", "icon", "animated", "disabled", "className", "style", "children", "onComplete", "formatValue", "ariaLabel"],
3294
+ _excluded2$6 = ["value", "max", "variant", "color", "size", "showValue", "showLabel", "label", "buffer", "animated", "striped", "disabled", "rounded", "className", "style", "onComplete", "formatValue", "ariaLabel", "estimatedTime", "speed"];
3117
3295
 
3118
3296
  /**
3119
3297
  * Enhanced Circular Progress component with professional features
@@ -3147,7 +3325,7 @@ var CircularProgress = function CircularProgress(props) {
3147
3325
  onComplete = props.onComplete,
3148
3326
  formatValue = props.formatValue,
3149
3327
  ariaLabel = props.ariaLabel,
3150
- restProps = _objectWithoutPropertiesLoose(props, _excluded$9);
3328
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
3151
3329
  var _useState = useState(0),
3152
3330
  animatedValue = _useState[0],
3153
3331
  setAnimatedValue = _useState[1];
@@ -3309,7 +3487,7 @@ var LinearProgress = function LinearProgress(props) {
3309
3487
  ariaLabel = props.ariaLabel,
3310
3488
  estimatedTime = props.estimatedTime,
3311
3489
  speed = props.speed,
3312
- restProps = _objectWithoutPropertiesLoose(props, _excluded2$5);
3490
+ restProps = _objectWithoutPropertiesLoose(props, _excluded2$6);
3313
3491
  var _useState3 = useState(0),
3314
3492
  animatedValue = _useState3[0],
3315
3493
  setAnimatedValue = _useState3[1];
@@ -4002,9 +4180,9 @@ var PasswordField = function PasswordField(props) {
4002
4180
  }));
4003
4181
  };
4004
4182
 
4005
- var _excluded$8 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "loading", "empty", "emptyMessage", "emptyIcon", "searchable", "searchPlaceholder", "searchBy", "sortable", "sortBy", "sortDirection", "onSort", "multiSelect", "onMultiSelect", "dense", "disabled", "animated", "virtualized", "itemHeight", "maxHeight", "className", "style", "ariaLabel", "role"],
4006
- _excluded2$4 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "searchTerm", "onSearch", "searchable", "searchPlaceholder", "multiSelect", "dense", "disabled", "animated", "cssClasses", "ariaAttributes", "style"],
4007
- _excluded3$1 = ["id", "icon", "iconTooltip", "line1", "line2", "meta", "avatar", "badge", "actions", "disabled"];
4183
+ var _excluded$a = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "loading", "empty", "emptyMessage", "emptyIcon", "searchable", "searchPlaceholder", "searchBy", "sortable", "sortBy", "sortDirection", "onSort", "multiSelect", "onMultiSelect", "dense", "disabled", "animated", "virtualized", "itemHeight", "maxHeight", "className", "style", "ariaLabel", "role"],
4184
+ _excluded2$5 = ["items", "children", "selected", "onSelect", "groupBy", "groupRenderer", "searchTerm", "onSearch", "searchable", "searchPlaceholder", "multiSelect", "dense", "disabled", "animated", "cssClasses", "ariaAttributes", "style"],
4185
+ _excluded3$2 = ["id", "icon", "iconTooltip", "line1", "line2", "meta", "avatar", "badge", "actions", "disabled"];
4008
4186
 
4009
4187
  /**
4010
4188
  * Enhanced List component with improved functionality while maintaining 100% compatibility
@@ -4051,7 +4229,7 @@ var List = function List(props) {
4051
4229
  ariaLabel = props.ariaLabel,
4052
4230
  _props$role = props.role,
4053
4231
  role = _props$role === void 0 ? 'list' : _props$role,
4054
- restProps = _objectWithoutPropertiesLoose(props, _excluded$8);
4232
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$a);
4055
4233
  var _useState = useState(''),
4056
4234
  searchTerm = _useState[0],
4057
4235
  setSearchTerm = _useState[1];
@@ -4260,7 +4438,7 @@ var GroupedList = function GroupedList(props) {
4260
4438
  cssClasses = props.cssClasses,
4261
4439
  ariaAttributes = props.ariaAttributes,
4262
4440
  style = props.style,
4263
- restProps = _objectWithoutPropertiesLoose(props, _excluded2$4);
4441
+ restProps = _objectWithoutPropertiesLoose(props, _excluded2$5);
4264
4442
  var _useState3 = useState(new Set()),
4265
4443
  collapsedGroups = _useState3[0],
4266
4444
  setCollapsedGroups = _useState3[1];
@@ -4380,7 +4558,7 @@ var ListItem = function ListItem(_ref) {
4380
4558
  actions = item.actions,
4381
4559
  _item$disabled = item.disabled,
4382
4560
  itemDisabled = _item$disabled === void 0 ? false : _item$disabled,
4383
- itemProps = _objectWithoutPropertiesLoose(item, _excluded3$1);
4561
+ itemProps = _objectWithoutPropertiesLoose(item, _excluded3$2);
4384
4562
  var isItemDisabled = disabled || itemDisabled;
4385
4563
  var isSelected = Array.isArray(selected) ? selected.includes(id) : selected === id;
4386
4564
 
@@ -4644,7 +4822,7 @@ var MenuSeparator = function MenuSeparator(props) {
4644
4822
  });
4645
4823
  };
4646
4824
 
4647
- var _excluded$7 = ["id", "className", "label", "name", "initial", "value", "editable", "onChange", "options", "type", "disabled", "required", "placeholder", "multiline", "rows", "maxLength", "minLength", "pattern", "validateValue", "size", "variant", "layout", "nameWidth", "copyable", "error", "helperText", "onFocus", "onBlur", "onValidationError", "clearable", "readOnly", "loading", "skeleton", "style"];
4825
+ var _excluded$9 = ["id", "className", "label", "name", "initial", "value", "editable", "onChange", "options", "type", "disabled", "required", "placeholder", "multiline", "rows", "maxLength", "minLength", "pattern", "validateValue", "size", "variant", "layout", "nameWidth", "copyable", "error", "helperText", "onFocus", "onBlur", "onValidationError", "clearable", "readOnly", "loading", "skeleton", "style"];
4648
4826
  function _catch$9(body, recover) {
4649
4827
  try {
4650
4828
  var result = body();
@@ -4710,7 +4888,7 @@ var Property = function Property(props) {
4710
4888
  _props$skeleton = props.skeleton,
4711
4889
  skeleton = _props$skeleton === void 0 ? false : _props$skeleton,
4712
4890
  style = props.style,
4713
- restProps = _objectWithoutPropertiesLoose(props, _excluded$7);
4891
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$9);
4714
4892
  var _useState = useState(false),
4715
4893
  isFocused = _useState[0],
4716
4894
  setIsFocused = _useState[1];
@@ -5342,8 +5520,8 @@ Section.defaultProps = {
5342
5520
  className: ''
5343
5521
  };
5344
5522
 
5345
- var _excluded$6 = ["children", "selected", "onChange", "fillLeft", "fillRight", "orientation", "variant", "scrollable", "centered", "disabled", "animated", "persistent", "persistKey", "beforeChange", "className", "style", "ariaLabel"],
5346
- _excluded2$3 = ["id", "icon", "label", "selected", "actions", "onSelect", "disabled", "closeable", "onClose", "badge", "tooltip", "orientation", "variant", "animated", "tabIndex", "totalTabs", "className", "style"];
5523
+ var _excluded$8 = ["children", "selected", "onChange", "fillLeft", "fillRight", "orientation", "variant", "scrollable", "centered", "disabled", "animated", "persistent", "persistKey", "beforeChange", "className", "style", "ariaLabel"],
5524
+ _excluded2$4 = ["id", "icon", "label", "selected", "actions", "onSelect", "disabled", "closeable", "onClose", "badge", "tooltip", "orientation", "variant", "animated", "tabIndex", "totalTabs", "className", "style"];
5347
5525
  function _catch$8(body, recover) {
5348
5526
  try {
5349
5527
  var result = body();
@@ -5386,7 +5564,7 @@ var Tabs = function Tabs(props) {
5386
5564
  className = props.className,
5387
5565
  style = props.style,
5388
5566
  ariaLabel = props.ariaLabel,
5389
- restProps = _objectWithoutPropertiesLoose(props, _excluded$6);
5567
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$8);
5390
5568
  var tabsRef = useRef(null);
5391
5569
 
5392
5570
  // Validate props
@@ -5548,7 +5726,7 @@ var Tab = function Tab(props) {
5548
5726
  tabIndex = props.tabIndex,
5549
5727
  className = props.className,
5550
5728
  style = props.style,
5551
- restProps = _objectWithoutPropertiesLoose(props, _excluded2$3);
5729
+ restProps = _objectWithoutPropertiesLoose(props, _excluded2$4);
5552
5730
  var tabRef = useRef(null);
5553
5731
 
5554
5732
  // Handle selection (maintaining original behavior)
@@ -6217,7 +6395,7 @@ var Uploader = function Uploader(_ref) {
6217
6395
  }));
6218
6396
  };
6219
6397
 
6220
- var isFunction$1 = function isFunction(value) {
6398
+ var isFunction$2 = function isFunction(value) {
6221
6399
  return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
6222
6400
  };
6223
6401
 
@@ -6489,7 +6667,7 @@ var DataTableRow = function DataTableRow(props) {
6489
6667
  className: "table-row-info"
6490
6668
  }, /*#__PURE__*/React.createElement("td", {
6491
6669
  colSpan: columns.length + 1
6492
- }, isFunction$1(row.info) ? row.info() : row.info)) : null);
6670
+ }, isFunction$2(row.info) ? row.info() : row.info)) : null);
6493
6671
  };
6494
6672
 
6495
6673
  /**
@@ -6981,140 +7159,2592 @@ var SortIcon = function SortIcon(props) {
6981
7159
  });
6982
7160
  };
6983
7161
 
6984
- var _excluded$5 = ["id", "label", "tokens", "readOnly", "options", "predictive", "onChange", "disabled", "required", "placeholder", "maxTokens", "minTokens", "allowDuplicates", "validateToken", "tokenSeparators", "size", "variant", "error", "helperText", "onFocus", "onBlur", "onTokenAdd", "onTokenRemove", "onValidationError", "clearable", "onClear", "searchable", "sortable", "className", "style"],
6985
- _excluded2$2 = ["text", "onDelete", "disabled", "error", "size", "variant", "icon", "className", "style"];
7162
+ var _excluded$7 = ["id", "type", "className", "label", "labelPosition", "placeholder", "value", "outlined", "readOnly", "disabled", "required", "canClear", "showPasswordToggle", "autoComplete", "error", "helperText", "maxLength", "minLength", "pattern", "step", "min", "max", "rows", "validation", "debounceMs", "ariaLabel", "ariaDescribedBy", "onChange", "onEnter", "onClick", "onFocus", "onBlur", "onValidation"],
7163
+ _excluded2$3 = ["id", "options", "value", "placeholder", "label", "outlined", "disabled", "readOnly", "required", "searchable", "clearable", "multiple", "groupBy", "filterFunction", "renderOption", "renderValue", "position", "maxHeight", "error", "helperText", "className", "ariaLabel", "onChange", "onOpen", "onClose", "onSearch"],
7164
+ _excluded3$1 = ["id", "label", "value", "outlined", "disabled", "readOnly", "required", "minDate", "maxDate", "error", "helperText", "className", "ariaLabel", "onChange", "onValidation"];
6986
7165
 
6987
7166
  /**
6988
- * Enhanced Token Field component with improved functionality while maintaining 100% compatibility
7167
+ * Enhanced TextField component with improved validation and accessibility
6989
7168
  */
6990
- var TokenField = function TokenField(props) {
7169
+ var TextField2 = function TextField2(props) {
6991
7170
  var id = props.id,
7171
+ _props$type = props.type,
7172
+ type = _props$type === void 0 ? 'text' : _props$type,
7173
+ className = props.className,
6992
7174
  label = props.label,
6993
- _props$tokens = props.tokens,
6994
- tokens = _props$tokens === void 0 ? [] : _props$tokens,
6995
- readOnly = props.readOnly,
6996
- options = props.options,
6997
- _props$predictive = props.predictive,
6998
- predictive = _props$predictive === void 0 ? true : _props$predictive,
6999
- onChange = props.onChange,
7175
+ _props$labelPosition = props.labelPosition,
7176
+ labelPosition = _props$labelPosition === void 0 ? 'top' : _props$labelPosition,
7177
+ placeholder = props.placeholder,
7178
+ value = props.value,
7179
+ _props$outlined = props.outlined,
7180
+ outlined = _props$outlined === void 0 ? false : _props$outlined,
7181
+ _props$readOnly = props.readOnly,
7182
+ readOnly = _props$readOnly === void 0 ? false : _props$readOnly,
7000
7183
  _props$disabled = props.disabled,
7001
7184
  disabled = _props$disabled === void 0 ? false : _props$disabled,
7002
7185
  _props$required = props.required,
7003
7186
  required = _props$required === void 0 ? false : _props$required,
7004
- _props$placeholder = props.placeholder,
7005
- placeholder = _props$placeholder === void 0 ? "Add token..." : _props$placeholder,
7006
- maxTokens = props.maxTokens,
7007
- _props$minTokens = props.minTokens,
7008
- minTokens = _props$minTokens === void 0 ? 0 : _props$minTokens,
7009
- _props$allowDuplicate = props.allowDuplicates,
7010
- allowDuplicates = _props$allowDuplicate === void 0 ? true : _props$allowDuplicate,
7011
- validateToken = props.validateToken,
7012
- _props$tokenSeparator = props.tokenSeparators,
7013
- tokenSeparators = _props$tokenSeparator === void 0 ? [',', ';', '\n'] : _props$tokenSeparator,
7014
- _props$size = props.size,
7015
- size = _props$size === void 0 ? 'medium' : _props$size,
7016
- _props$variant = props.variant,
7017
- variant = _props$variant === void 0 ? 'default' : _props$variant,
7187
+ _props$canClear = props.canClear,
7188
+ canClear = _props$canClear === void 0 ? true : _props$canClear,
7189
+ _props$showPasswordTo = props.showPasswordToggle,
7190
+ showPasswordToggle = _props$showPasswordTo === void 0 ? true : _props$showPasswordTo,
7191
+ _props$autoComplete = props.autoComplete,
7192
+ autoComplete = _props$autoComplete === void 0 ? 'off' : _props$autoComplete,
7018
7193
  error = props.error,
7019
7194
  helperText = props.helperText,
7195
+ maxLength = props.maxLength,
7196
+ minLength = props.minLength,
7197
+ pattern = props.pattern,
7198
+ step = props.step,
7199
+ min = props.min,
7200
+ max = props.max,
7201
+ _props$rows = props.rows,
7202
+ rows = _props$rows === void 0 ? 3 : _props$rows,
7203
+ validation = props.validation,
7204
+ _props$debounceMs = props.debounceMs,
7205
+ debounceMs = _props$debounceMs === void 0 ? 0 : _props$debounceMs,
7206
+ ariaLabel = props.ariaLabel,
7207
+ ariaDescribedBy = props.ariaDescribedBy,
7208
+ onChange = props.onChange,
7209
+ onEnter = props.onEnter,
7210
+ onClick = props.onClick,
7020
7211
  onFocus = props.onFocus,
7021
7212
  onBlur = props.onBlur,
7022
- onTokenAdd = props.onTokenAdd,
7023
- onTokenRemove = props.onTokenRemove,
7024
- onValidationError = props.onValidationError,
7025
- _props$clearable = props.clearable,
7026
- clearable = _props$clearable === void 0 ? false : _props$clearable,
7027
- onClear = props.onClear,
7028
- _props$searchable = props.searchable,
7029
- searchable = _props$searchable === void 0 ? false : _props$searchable,
7030
- _props$sortable = props.sortable,
7031
- sortable = _props$sortable === void 0 ? false : _props$sortable,
7032
- className = props.className,
7033
- style = props.style,
7034
- restProps = _objectWithoutPropertiesLoose(props, _excluded$5);
7035
- var _useState = useState(''),
7036
- value = _useState[0],
7037
- setValue = _useState[1];
7213
+ onValidation = props.onValidation,
7214
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$7);
7215
+ var site = useContext(SiteContext);
7216
+ var _useState = useState(false),
7217
+ isPasswordVisible = _useState[0],
7218
+ setIsPasswordVisible = _useState[1];
7038
7219
  var _useState2 = useState(false),
7039
7220
  isFocused = _useState2[0],
7040
7221
  setIsFocused = _useState2[1];
7041
- var _useState3 = useState({}),
7042
- validationErrors = _useState3[0],
7043
- setValidationErrors = _useState3[1];
7222
+ var _useState3 = useState(''),
7223
+ internalError = _useState3[0],
7224
+ setInternalError = _useState3[1];
7225
+ var _useState4 = useState(true),
7226
+ isValid = _useState4[0],
7227
+ setIsValid = _useState4[1];
7044
7228
  var inputRef = useRef(null);
7045
- var containerRef = useRef(null);
7229
+ var debounceRef = useRef(null);
7046
7230
 
7047
- // Validate props
7048
- useEffect(function () {
7049
- if (!Array.isArray(tokens)) {
7050
- console.warn('TokenField: tokens prop must be an array');
7051
- }
7052
- if (maxTokens && tokens.length > maxTokens) {
7053
- console.warn("TokenField: tokens count (" + tokens.length + ") exceeds maxTokens (" + maxTokens + ")");
7054
- }
7055
- if (minTokens && tokens.length < minTokens) {
7056
- console.warn("TokenField: tokens count (" + tokens.length + ") is below minTokens (" + minTokens + ")");
7057
- }
7058
- }, [tokens, maxTokens, minTokens]);
7059
-
7060
- // Enhanced remove function (maintaining original behavior)
7061
- var remove = useCallback(function (index) {
7062
- if (disabled || readOnly) return;
7063
- var next = tokens.slice();
7064
- var removedToken = next.splice(index, 1)[0];
7231
+ // Validate required props
7232
+ if (!id) {
7233
+ console.warn('TextField2 component: id prop is required');
7234
+ }
7065
7235
 
7066
- // Check minimum tokens
7067
- if (minTokens && next.length < minTokens) {
7068
- console.warn("TokenField: Cannot remove token. Minimum " + minTokens + " tokens required.");
7069
- return;
7236
+ // Validate value and set error states
7237
+ useEffect(function () {
7238
+ if (validation && value !== undefined) {
7239
+ var validationResult = validation(value);
7240
+ var valid = typeof validationResult === 'boolean' ? validationResult : validationResult.valid;
7241
+ var errorMessage = typeof validationResult === 'object' ? validationResult.message : '';
7242
+ setIsValid(valid);
7243
+ setInternalError(valid ? '' : errorMessage || (required && !value ? 'This field is required' : 'Invalid value'));
7244
+ if (onValidation) {
7245
+ onValidation(id, valid, errorMessage);
7246
+ }
7247
+ } else if (required && !value) {
7248
+ setIsValid(false);
7249
+ setInternalError('This field is required');
7250
+ } else {
7251
+ setIsValid(true);
7252
+ setInternalError('');
7070
7253
  }
7071
- if (onChange) onChange(id, next);
7072
- if (onTokenRemove) onTokenRemove(removedToken, index);
7073
- }, [disabled, readOnly, tokens, minTokens, id, onChange, onTokenRemove]);
7254
+ }, [value, required, id]); // Removed validation and onValidation from dependencies to prevent infinite loops
7074
7255
 
7075
- // Enhanced change function (maintaining original behavior)
7076
- var change = useCallback(function (event) {
7256
+ // Handle input changes with debouncing
7257
+ var handleChange = useCallback(function (event) {
7077
7258
  if (disabled || readOnly) return;
7259
+ event.stopPropagation();
7078
7260
  var newValue = event.target.value;
7079
- setValue(newValue);
7080
- }, [disabled, readOnly]);
7081
7261
 
7082
- // Validate token
7083
- var validateTokenValue = useCallback(function (tokenValue) {
7084
- if (!tokenValue || typeof tokenValue === 'string' && tokenValue.trim() === '') {
7085
- return {
7086
- isValid: false,
7087
- error: 'Token cannot be empty'
7088
- };
7262
+ // Clear previous debounce
7263
+ if (debounceRef.current) {
7264
+ clearTimeout(debounceRef.current);
7089
7265
  }
7090
-
7091
- // Check duplicates
7092
- if (!allowDuplicates && tokens.includes(tokenValue)) {
7093
- return {
7094
- isValid: false,
7095
- error: 'Duplicate token not allowed'
7096
- };
7266
+ if (debounceMs > 0) {
7267
+ debounceRef.current = setTimeout(function () {
7268
+ if (onChange) onChange(id, newValue, event);
7269
+ }, debounceMs);
7270
+ } else {
7271
+ if (onChange) onChange(id, newValue, event);
7097
7272
  }
7273
+ }, [disabled, readOnly, id, onChange, debounceMs]);
7098
7274
 
7099
- // Check max tokens
7100
- if (maxTokens && tokens.length >= maxTokens) {
7101
- return {
7102
- isValid: false,
7103
- error: "Maximum " + maxTokens + " tokens allowed"
7104
- };
7275
+ // Handle key press events
7276
+ var handleKeyPress = useCallback(function (event) {
7277
+ if (disabled) return;
7278
+ var key = event.charCode || event.keyCode || 0;
7279
+ if (key === 13 && onEnter) {
7280
+ event.preventDefault();
7281
+ onEnter(event);
7105
7282
  }
7283
+ }, [disabled, onEnter]);
7106
7284
 
7107
- // Custom validation
7108
- if (validateToken) {
7109
- var customValidation = validateToken(tokenValue, tokens);
7110
- if (customValidation && !customValidation.isValid) {
7111
- return customValidation;
7112
- }
7285
+ // Handle focus events
7286
+ var handleFocus = useCallback(function (event) {
7287
+ if (disabled) return;
7288
+ setIsFocused(true);
7289
+ if (onFocus) onFocus(event);
7290
+
7291
+ // Site context focus management
7292
+ if (site && site.changeFocus) {
7293
+ site.changeFocus({
7294
+ lose: function lose() {
7295
+ return setIsFocused(false);
7296
+ }
7297
+ });
7113
7298
  }
7114
- return {
7115
- isValid: true
7116
- };
7117
- }, [allowDuplicates, tokens, maxTokens, validateToken]);
7299
+ }, [disabled, onFocus, site]);
7300
+
7301
+ // Handle blur events
7302
+ var handleBlur = useCallback(function (event) {
7303
+ if (disabled) return;
7304
+ setIsFocused(false);
7305
+ if (onBlur) onBlur(event);
7306
+ }, [disabled, onBlur]);
7307
+
7308
+ // Handle clear action
7309
+ var handleClear = useCallback(function () {
7310
+ if (disabled || readOnly) return;
7311
+ if (onChange) onChange(id, '', {
7312
+ target: {
7313
+ value: ''
7314
+ }
7315
+ });
7316
+ if (inputRef.current) {
7317
+ inputRef.current.focus();
7318
+ }
7319
+ }, [disabled, readOnly, id, onChange]);
7320
+
7321
+ // Handle password visibility toggle
7322
+ var handlePasswordToggle = useCallback(function () {
7323
+ if (disabled) return;
7324
+ setIsPasswordVisible(!isPasswordVisible);
7325
+ }, [disabled, isPasswordVisible]);
7326
+
7327
+ // Generate CSS classes
7328
+ var borderStyle = outlined ? 'textfield2-outlined' : 'textfield2';
7329
+ var labelStyle = label ? '' : 'no-label';
7330
+ var labelPositionStyle = labelPosition === 'left' ? 'label-left' : 'label-top';
7331
+ var safeClassName = className || '';
7332
+ var cssClasses = ['textfield2', borderStyle, labelStyle, labelPositionStyle, "textfield2-" + type, isFocused && 'focused', disabled && 'disabled', readOnly && 'readonly', error || internalError ? 'error' : '', !isValid && 'invalid', placeholder && 'has-placeholder', safeClassName, id].filter(Boolean).join(' ');
7333
+
7334
+ // Accessibility attributes
7335
+ var ariaAttributes = {
7336
+ 'aria-label': ariaLabel || label,
7337
+ 'aria-describedby': ariaDescribedBy || (error || internalError || helperText ? id + "-helper" : undefined),
7338
+ 'aria-invalid': !isValid || !!(error || internalError),
7339
+ 'aria-required': required,
7340
+ 'aria-disabled': disabled,
7341
+ 'aria-readonly': readOnly
7342
+ };
7343
+
7344
+ // Input attributes
7345
+ var inputAttributes = _extends({
7346
+ id: id,
7347
+ type: type === 'password' && isPasswordVisible ? 'text' : type,
7348
+ placeholder: site != null && site.translate ? site.translate(placeholder) : placeholder,
7349
+ value: value || '',
7350
+ required: required,
7351
+ disabled: disabled,
7352
+ readOnly: readOnly,
7353
+ maxLength: maxLength,
7354
+ minLength: minLength,
7355
+ pattern: pattern,
7356
+ step: step,
7357
+ min: min,
7358
+ max: max,
7359
+ autoComplete: autoComplete
7360
+ }, ariaAttributes, restProps);
7361
+
7362
+ // Label text
7363
+ var labelTxt = label ? /*#__PURE__*/React.createElement(Text, null, label) : null;
7364
+ var placeholderTxt = site != null && site.translate ? site.translate(placeholder) : placeholder;
7365
+
7366
+ // Error/helper text
7367
+ var displayError = error || internalError;
7368
+ var displayHelperText = helperText && !displayError;
7369
+ return /*#__PURE__*/React.createElement("div", {
7370
+ className: cssClasses,
7371
+ onClick: onClick
7372
+ }, type === 'textarea' ? /*#__PURE__*/React.createElement("textarea", _extends({
7373
+ ref: inputRef,
7374
+ rows: rows,
7375
+ placeholder: placeholderTxt,
7376
+ onChange: handleChange,
7377
+ onKeyDown: handleKeyPress,
7378
+ onFocus: handleFocus,
7379
+ onBlur: handleBlur
7380
+ }, inputAttributes)) : /*#__PURE__*/React.createElement("input", _extends({
7381
+ ref: inputRef,
7382
+ onChange: handleChange,
7383
+ onKeyDown: handleKeyPress,
7384
+ onFocus: handleFocus,
7385
+ onBlur: handleBlur
7386
+ }, inputAttributes)), !readOnly && !disabled && canClear && value && value.length > 0 && /*#__PURE__*/React.createElement(Icon, {
7387
+ icon: "close",
7388
+ clickable: true,
7389
+ size: "small",
7390
+ action: handleClear,
7391
+ className: "textfield2-clear",
7392
+ ariaLabel: "Clear field"
7393
+ }), type === 'password' && showPasswordToggle && !disabled && /*#__PURE__*/React.createElement(Icon, {
7394
+ icon: isPasswordVisible ? 'visibility' : 'visibility_off',
7395
+ clickable: true,
7396
+ size: "small",
7397
+ action: handlePasswordToggle,
7398
+ className: "textfield2-password-toggle",
7399
+ ariaLabel: isPasswordVisible ? 'Hide password' : 'Show password'
7400
+ }), /*#__PURE__*/React.createElement("span", {
7401
+ className: "textfield2-bar"
7402
+ }), label && /*#__PURE__*/React.createElement("label", {
7403
+ htmlFor: id
7404
+ }, labelTxt), (displayError || displayHelperText) && /*#__PURE__*/React.createElement("div", {
7405
+ id: id + "-helper",
7406
+ className: "textfield2-helper " + (displayError ? 'error' : 'helper'),
7407
+ role: displayError ? 'alert' : 'status',
7408
+ "aria-live": displayError ? 'assertive' : 'polite'
7409
+ }, displayError && /*#__PURE__*/React.createElement(Icon, {
7410
+ icon: "error",
7411
+ size: "small"
7412
+ }), /*#__PURE__*/React.createElement(Text, null, displayError || helperText)));
7413
+ };
7414
+
7415
+ /**
7416
+ * Enhanced TextArea component
7417
+ */
7418
+ var TextArea2 = function TextArea2(props) {
7419
+ return /*#__PURE__*/React.createElement(TextField2, _extends({}, props, {
7420
+ type: "textarea"
7421
+ }));
7422
+ };
7423
+
7424
+ /**
7425
+ * Enhanced PasswordField component
7426
+ */
7427
+ var PasswordField2 = function PasswordField2(props) {
7428
+ return /*#__PURE__*/React.createElement(TextField2, _extends({}, props, {
7429
+ type: "password"
7430
+ }));
7431
+ };
7432
+
7433
+ // PropTypes for TextField2
7434
+ TextField2.propTypes = {
7435
+ /** Unique identifier for the field */
7436
+ id: PropTypes.string.isRequired,
7437
+ /** Input type */
7438
+ type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime-local', 'month', 'week', 'textarea']),
7439
+ /** Additional CSS classes */
7440
+ className: PropTypes.string,
7441
+ /** Field label */
7442
+ label: PropTypes.string,
7443
+ /** Label position */
7444
+ labelPosition: PropTypes.oneOf(['top', 'left']),
7445
+ /** Placeholder text */
7446
+ placeholder: PropTypes.string,
7447
+ /** Field value */
7448
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
7449
+ /** Whether field has outlined style */
7450
+ outlined: PropTypes.bool,
7451
+ /** Whether field is read-only */
7452
+ readOnly: PropTypes.bool,
7453
+ /** Whether field is disabled */
7454
+ disabled: PropTypes.bool,
7455
+ /** Whether field is required */
7456
+ required: PropTypes.bool,
7457
+ /** Whether to show clear button */
7458
+ canClear: PropTypes.bool,
7459
+ /** Whether to show password toggle for password fields */
7460
+ showPasswordToggle: PropTypes.bool,
7461
+ /** HTML autocomplete attribute */
7462
+ autoComplete: PropTypes.string,
7463
+ /** Error message to display */
7464
+ error: PropTypes.string,
7465
+ /** Helper text to display */
7466
+ helperText: PropTypes.string,
7467
+ /** Maximum length */
7468
+ maxLength: PropTypes.number,
7469
+ /** Minimum length */
7470
+ minLength: PropTypes.number,
7471
+ /** Input pattern */
7472
+ pattern: PropTypes.string,
7473
+ /** Step for number inputs */
7474
+ step: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
7475
+ /** Minimum value for number inputs */
7476
+ min: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
7477
+ /** Maximum value for number inputs */
7478
+ max: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
7479
+ /** Number of rows for textarea */
7480
+ rows: PropTypes.number,
7481
+ /** Validation function */
7482
+ validation: PropTypes.func,
7483
+ /** Debounce delay in milliseconds */
7484
+ debounceMs: PropTypes.number,
7485
+ /** ARIA label */
7486
+ ariaLabel: PropTypes.string,
7487
+ /** ARIA described by */
7488
+ ariaDescribedBy: PropTypes.string,
7489
+ /** Change handler */
7490
+ onChange: PropTypes.func,
7491
+ /** Enter key handler */
7492
+ onEnter: PropTypes.func,
7493
+ /** Click handler */
7494
+ onClick: PropTypes.func,
7495
+ /** Focus handler */
7496
+ onFocus: PropTypes.func,
7497
+ /** Blur handler */
7498
+ onBlur: PropTypes.func,
7499
+ /** Validation handler */
7500
+ onValidation: PropTypes.func
7501
+ };
7502
+ TextField2.defaultProps = {
7503
+ type: 'text',
7504
+ labelPosition: 'top',
7505
+ outlined: false,
7506
+ readOnly: false,
7507
+ disabled: false,
7508
+ required: false,
7509
+ canClear: true,
7510
+ showPasswordToggle: true,
7511
+ autoComplete: 'off',
7512
+ rows: 3,
7513
+ debounceMs: 0,
7514
+ className: ''
7515
+ };
7516
+
7517
+ // PropTypes for TextArea2
7518
+ TextArea2.propTypes = _extends({}, TextField2.propTypes);
7519
+ TextArea2.defaultProps = _extends({}, TextField2.defaultProps, {
7520
+ type: 'textarea'
7521
+ });
7522
+
7523
+ // PropTypes for PasswordField2
7524
+ PasswordField2.propTypes = _extends({}, TextField2.propTypes);
7525
+ PasswordField2.defaultProps = _extends({}, TextField2.defaultProps, {
7526
+ type: 'password'
7527
+ });
7528
+
7529
+ /**
7530
+ * Enhanced DropDown component with improved accessibility and functionality
7531
+ */
7532
+ var DropDown2 = function DropDown2(props) {
7533
+ var id = props.id,
7534
+ _props$options = props.options,
7535
+ options = _props$options === void 0 ? [] : _props$options,
7536
+ value = props.value,
7537
+ placeholder = props.placeholder,
7538
+ label = props.label,
7539
+ _props$outlined2 = props.outlined,
7540
+ outlined = _props$outlined2 === void 0 ? false : _props$outlined2,
7541
+ _props$disabled2 = props.disabled,
7542
+ disabled = _props$disabled2 === void 0 ? false : _props$disabled2,
7543
+ _props$readOnly2 = props.readOnly,
7544
+ readOnly = _props$readOnly2 === void 0 ? false : _props$readOnly2,
7545
+ _props$required2 = props.required,
7546
+ required = _props$required2 === void 0 ? false : _props$required2,
7547
+ _props$searchable = props.searchable,
7548
+ searchable = _props$searchable === void 0 ? false : _props$searchable,
7549
+ _props$clearable = props.clearable,
7550
+ clearable = _props$clearable === void 0 ? false : _props$clearable,
7551
+ _props$multiple = props.multiple,
7552
+ multiple = _props$multiple === void 0 ? false : _props$multiple,
7553
+ groupBy = props.groupBy,
7554
+ filterFunction = props.filterFunction,
7555
+ renderOption = props.renderOption,
7556
+ renderValue = props.renderValue,
7557
+ _props$position = props.position,
7558
+ position = _props$position === void 0 ? 'bottom' : _props$position,
7559
+ _props$maxHeight = props.maxHeight,
7560
+ maxHeight = _props$maxHeight === void 0 ? '200px' : _props$maxHeight,
7561
+ error = props.error,
7562
+ helperText = props.helperText,
7563
+ className = props.className,
7564
+ ariaLabel = props.ariaLabel,
7565
+ onChange = props.onChange,
7566
+ onOpen = props.onOpen,
7567
+ onClose = props.onClose,
7568
+ onSearch = props.onSearch,
7569
+ restProps = _objectWithoutPropertiesLoose(props, _excluded2$3);
7570
+ useContext(SiteContext);
7571
+ var _useState5 = useState(false),
7572
+ isOpen = _useState5[0],
7573
+ setIsOpen = _useState5[1];
7574
+ var _useState6 = useState(''),
7575
+ searchTerm = _useState6[0],
7576
+ setSearchTerm = _useState6[1];
7577
+ var _useState7 = useState(-1),
7578
+ focusedIndex = _useState7[0],
7579
+ setFocusedIndex = _useState7[1];
7580
+ var _useState8 = useState(''),
7581
+ internalError = _useState8[0],
7582
+ setInternalError = _useState8[1];
7583
+ var dropdownRef = useRef(null);
7584
+ var inputRef = useRef(null);
7585
+ var listRef = useRef(null);
7586
+
7587
+ // Validate required props
7588
+ if (!id) {
7589
+ console.warn('DropDown2 component: id prop is required');
7590
+ }
7591
+ if (!Array.isArray(options)) {
7592
+ console.warn('DropDown2 component: options must be an array');
7593
+ }
7594
+
7595
+ // Validate required field
7596
+ useEffect(function () {
7597
+ if (required && (!value || Array.isArray(value) && value.length === 0)) {
7598
+ setInternalError('This field is required');
7599
+ } else {
7600
+ setInternalError('');
7601
+ }
7602
+ }, [value, required]);
7603
+
7604
+ // Get display value
7605
+ var getDisplayValue = useCallback(function () {
7606
+ if (!value) return '';
7607
+ if (multiple && Array.isArray(value)) {
7608
+ if (value.length === 0) return '';
7609
+ if (value.length === 1) {
7610
+ var _option = options.find(function (opt) {
7611
+ return opt.value === value[0];
7612
+ });
7613
+ return _option ? _option.label : value[0];
7614
+ }
7615
+ return value.length + " items selected";
7616
+ }
7617
+ var option = options.find(function (opt) {
7618
+ return opt.value === value;
7619
+ });
7620
+ if (renderValue && option) {
7621
+ return renderValue(option);
7622
+ }
7623
+ return option ? option.label : value;
7624
+ }, [value, options, multiple, renderValue]);
7625
+
7626
+ // Filter options based on search term
7627
+ var filteredOptions = useMemo(function () {
7628
+ if (!searchTerm || !searchable) return options;
7629
+ if (filterFunction) {
7630
+ return options.filter(function (option) {
7631
+ return filterFunction(option, searchTerm);
7632
+ });
7633
+ }
7634
+ return options.filter(function (option) {
7635
+ return option.label.toLowerCase().includes(searchTerm.toLowerCase());
7636
+ });
7637
+ }, [options, searchTerm, searchable, filterFunction]);
7638
+
7639
+ // Group options if groupBy is provided
7640
+ var groupedOptions = useMemo(function () {
7641
+ if (!groupBy) return [{
7642
+ options: filteredOptions
7643
+ }];
7644
+ var groups = filteredOptions.reduce(function (acc, option) {
7645
+ var groupKey = typeof groupBy === 'function' ? groupBy(option) : option[groupBy];
7646
+ if (!acc[groupKey]) {
7647
+ acc[groupKey] = [];
7648
+ }
7649
+ acc[groupKey].push(option);
7650
+ return acc;
7651
+ }, {});
7652
+ return Object.entries(groups).map(function (_ref) {
7653
+ var label = _ref[0],
7654
+ options = _ref[1];
7655
+ return {
7656
+ label: label,
7657
+ options: options
7658
+ };
7659
+ });
7660
+ }, [filteredOptions, groupBy]);
7661
+
7662
+ // Handle option selection
7663
+ var handleSelect = useCallback(function (selectedValue, option) {
7664
+ if (disabled || readOnly) return;
7665
+ var newValue;
7666
+ if (multiple) {
7667
+ var currentValues = Array.isArray(value) ? value : [];
7668
+ if (currentValues.includes(selectedValue)) {
7669
+ newValue = currentValues.filter(function (v) {
7670
+ return v !== selectedValue;
7671
+ });
7672
+ } else {
7673
+ newValue = [].concat(currentValues, [selectedValue]);
7674
+ }
7675
+ } else {
7676
+ newValue = selectedValue;
7677
+ setIsOpen(false);
7678
+ }
7679
+ if (onChange) {
7680
+ onChange(id, newValue, option);
7681
+ }
7682
+ if (!multiple) {
7683
+ setSearchTerm('');
7684
+ setFocusedIndex(-1);
7685
+ }
7686
+ }, [disabled, readOnly, multiple, value, id, onChange]);
7687
+
7688
+ // Handle dropdown open/close
7689
+ var handleToggle = useCallback(function () {
7690
+ if (disabled || readOnly) return;
7691
+ var newOpen = !isOpen;
7692
+ setIsOpen(newOpen);
7693
+ if (newOpen) {
7694
+ setFocusedIndex(-1);
7695
+ if (onOpen) onOpen();
7696
+ } else {
7697
+ setSearchTerm('');
7698
+ setFocusedIndex(-1);
7699
+ if (onClose) onClose();
7700
+ }
7701
+ }, [disabled, readOnly, isOpen, onOpen, onClose]);
7702
+
7703
+ // Handle search input
7704
+ var handleSearch = useCallback(function (event) {
7705
+ if (!searchable) return;
7706
+ var term = event.target.value;
7707
+ setSearchTerm(term);
7708
+ setFocusedIndex(-1);
7709
+ if (!isOpen) {
7710
+ setIsOpen(true);
7711
+ }
7712
+ if (onSearch) {
7713
+ onSearch(term);
7714
+ }
7715
+ }, [searchable, isOpen, onSearch]);
7716
+
7717
+ // Handle clear
7718
+ var handleClear = useCallback(function (event) {
7719
+ event.stopPropagation();
7720
+ if (disabled || readOnly) return;
7721
+ var newValue = multiple ? [] : '';
7722
+ if (onChange) {
7723
+ onChange(id, newValue);
7724
+ }
7725
+ setSearchTerm('');
7726
+ }, [disabled, readOnly, multiple, id, onChange]);
7727
+
7728
+ // Keyboard navigation
7729
+ var handleKeyDown = useCallback(function (event) {
7730
+ if (disabled) return;
7731
+ var flatOptions = groupedOptions.flatMap(function (group) {
7732
+ return group.options;
7733
+ });
7734
+ switch (event.key) {
7735
+ case 'ArrowDown':
7736
+ event.preventDefault();
7737
+ if (!isOpen) {
7738
+ setIsOpen(true);
7739
+ } else {
7740
+ setFocusedIndex(function (prev) {
7741
+ return prev < flatOptions.length - 1 ? prev + 1 : 0;
7742
+ });
7743
+ }
7744
+ break;
7745
+ case 'ArrowUp':
7746
+ event.preventDefault();
7747
+ if (isOpen) {
7748
+ setFocusedIndex(function (prev) {
7749
+ return prev > 0 ? prev - 1 : flatOptions.length - 1;
7750
+ });
7751
+ }
7752
+ break;
7753
+ case 'Enter':
7754
+ event.preventDefault();
7755
+ if (isOpen && focusedIndex >= 0) {
7756
+ var option = flatOptions[focusedIndex];
7757
+ if (option) {
7758
+ handleSelect(option.value, option);
7759
+ }
7760
+ } else {
7761
+ handleToggle();
7762
+ }
7763
+ break;
7764
+ case 'Escape':
7765
+ if (isOpen) {
7766
+ event.preventDefault();
7767
+ setIsOpen(false);
7768
+ setSearchTerm('');
7769
+ setFocusedIndex(-1);
7770
+ }
7771
+ break;
7772
+ case 'Tab':
7773
+ if (isOpen) {
7774
+ setIsOpen(false);
7775
+ setSearchTerm('');
7776
+ setFocusedIndex(-1);
7777
+ }
7778
+ break;
7779
+ }
7780
+ }, [disabled, isOpen, focusedIndex, groupedOptions, handleSelect, handleToggle]);
7781
+
7782
+ // Click outside to close
7783
+ useEffect(function () {
7784
+ var handleClickOutside = function handleClickOutside(event) {
7785
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
7786
+ setIsOpen(false);
7787
+ setSearchTerm('');
7788
+ setFocusedIndex(-1);
7789
+ }
7790
+ };
7791
+ if (isOpen) {
7792
+ document.addEventListener('mousedown', handleClickOutside);
7793
+ return function () {
7794
+ return document.removeEventListener('mousedown', handleClickOutside);
7795
+ };
7796
+ }
7797
+ }, [isOpen]);
7798
+
7799
+ // Generate CSS classes
7800
+ var safeClassName = className || '';
7801
+ var cssClasses = ['dropdown2', outlined && 'outlined', disabled && 'disabled', readOnly && 'readonly', isOpen && 'open', error || internalError ? 'error' : '', multiple && 'multiple', safeClassName].filter(Boolean).join(' ');
7802
+
7803
+ // Accessibility attributes
7804
+ var ariaAttributes = {
7805
+ 'aria-label': ariaLabel || label,
7806
+ 'aria-expanded': isOpen,
7807
+ 'aria-haspopup': 'listbox',
7808
+ 'aria-disabled': disabled,
7809
+ 'aria-readonly': readOnly,
7810
+ 'aria-required': required,
7811
+ 'aria-invalid': !!(error || internalError),
7812
+ 'aria-describedby': error || internalError || helperText ? id + "-helper" : undefined
7813
+ };
7814
+ var displayValue = getDisplayValue();
7815
+ var displayError = error || internalError;
7816
+ var displayHelperText = helperText && !displayError;
7817
+ var showClear = clearable && displayValue && !disabled && !readOnly;
7818
+ return /*#__PURE__*/React.createElement("div", _extends({
7819
+ ref: dropdownRef,
7820
+ className: cssClasses
7821
+ }, restProps), /*#__PURE__*/React.createElement("div", _extends({
7822
+ className: "dropdown2-control",
7823
+ onClick: handleToggle,
7824
+ onKeyDown: handleKeyDown,
7825
+ tabIndex: disabled ? -1 : 0
7826
+ }, ariaAttributes), searchable && isOpen ? /*#__PURE__*/React.createElement("input", {
7827
+ ref: inputRef,
7828
+ type: "text",
7829
+ value: searchTerm,
7830
+ placeholder: placeholder || 'Search...',
7831
+ onChange: handleSearch,
7832
+ onKeyDown: handleKeyDown,
7833
+ className: "dropdown2-search",
7834
+ disabled: disabled,
7835
+ autoFocus: true
7836
+ }) : /*#__PURE__*/React.createElement("span", {
7837
+ className: "dropdown2-value " + (!displayValue ? 'placeholder' : '')
7838
+ }, displayValue || placeholder || 'Select...'), /*#__PURE__*/React.createElement("div", {
7839
+ className: "dropdown2-indicators"
7840
+ }, showClear && /*#__PURE__*/React.createElement(Icon, {
7841
+ icon: "close",
7842
+ size: "small",
7843
+ clickable: true,
7844
+ action: handleClear,
7845
+ className: "dropdown2-clear",
7846
+ ariaLabel: "Clear selection"
7847
+ }), /*#__PURE__*/React.createElement(Icon, {
7848
+ icon: isOpen ? 'expand_less' : 'expand_more',
7849
+ size: "small",
7850
+ className: "dropdown2-arrow"
7851
+ }))), label && /*#__PURE__*/React.createElement("label", {
7852
+ htmlFor: id,
7853
+ className: "dropdown2-label " + (isOpen || displayValue ? 'active' : '')
7854
+ }, /*#__PURE__*/React.createElement(Text, null, label)), isOpen && /*#__PURE__*/React.createElement("div", {
7855
+ className: "dropdown2-menu " + position,
7856
+ style: {
7857
+ maxHeight: maxHeight
7858
+ },
7859
+ role: "listbox",
7860
+ "aria-multiselectable": multiple
7861
+ }, /*#__PURE__*/React.createElement("ul", {
7862
+ ref: listRef
7863
+ }, groupedOptions.map(function (group, groupIndex) {
7864
+ return /*#__PURE__*/React.createElement(React.Fragment, {
7865
+ key: groupIndex
7866
+ }, group.label && /*#__PURE__*/React.createElement("li", {
7867
+ className: "dropdown2-group-label",
7868
+ role: "group"
7869
+ }, /*#__PURE__*/React.createElement(Text, null, group.label)), group.options.map(function (option, optionIndex) {
7870
+ var flatIndex = groupedOptions.slice(0, groupIndex).reduce(function (acc, g) {
7871
+ return acc + g.options.length;
7872
+ }, 0) + optionIndex;
7873
+ var isSelected = multiple ? Array.isArray(value) && value.includes(option.value) : value === option.value;
7874
+ var isFocused = flatIndex === focusedIndex;
7875
+ return /*#__PURE__*/React.createElement("li", {
7876
+ key: option.value,
7877
+ className: "dropdown2-option " + (isSelected ? 'selected' : '') + " " + (isFocused ? 'focused' : ''),
7878
+ onClick: function onClick() {
7879
+ return handleSelect(option.value, option);
7880
+ },
7881
+ role: "option",
7882
+ "aria-selected": isSelected
7883
+ }, multiple && /*#__PURE__*/React.createElement(Icon, {
7884
+ icon: isSelected ? 'check_box' : 'check_box_outline_blank',
7885
+ size: "small",
7886
+ className: "dropdown2-checkbox"
7887
+ }), option.icon && /*#__PURE__*/React.createElement(Icon, {
7888
+ icon: option.icon,
7889
+ size: "small",
7890
+ className: "dropdown2-option-icon"
7891
+ }), /*#__PURE__*/React.createElement("span", {
7892
+ className: "dropdown2-option-text"
7893
+ }, renderOption ? renderOption(option) : /*#__PURE__*/React.createElement(Text, null, option.label)), isSelected && !multiple && /*#__PURE__*/React.createElement(Icon, {
7894
+ icon: "check",
7895
+ size: "small",
7896
+ className: "dropdown2-check"
7897
+ }));
7898
+ }));
7899
+ }), filteredOptions.length === 0 && /*#__PURE__*/React.createElement("li", {
7900
+ className: "dropdown2-no-options"
7901
+ }, /*#__PURE__*/React.createElement(Text, null, "No options found")))), (displayError || displayHelperText) && /*#__PURE__*/React.createElement("div", {
7902
+ id: id + "-helper",
7903
+ className: "dropdown2-helper " + (displayError ? 'error' : 'helper'),
7904
+ role: displayError ? 'alert' : 'status',
7905
+ "aria-live": displayError ? 'assertive' : 'polite'
7906
+ }, displayError && /*#__PURE__*/React.createElement(Icon, {
7907
+ icon: "error",
7908
+ size: "small"
7909
+ }), /*#__PURE__*/React.createElement(Text, null, displayError || helperText)));
7910
+ };
7911
+
7912
+ // PropTypes for DropDown2
7913
+ DropDown2.propTypes = {
7914
+ /** Unique identifier for the dropdown */
7915
+ id: PropTypes.string.isRequired,
7916
+ /** Array of option objects */
7917
+ options: PropTypes.arrayOf(PropTypes.shape({
7918
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
7919
+ label: PropTypes.string.isRequired,
7920
+ icon: PropTypes.string,
7921
+ disabled: PropTypes.bool
7922
+ })).isRequired,
7923
+ /** Selected value(s) */
7924
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
7925
+ /** Placeholder text */
7926
+ placeholder: PropTypes.string,
7927
+ /** Field label */
7928
+ label: PropTypes.string,
7929
+ /** Whether dropdown has outlined style */
7930
+ outlined: PropTypes.bool,
7931
+ /** Whether dropdown is disabled */
7932
+ disabled: PropTypes.bool,
7933
+ /** Whether dropdown is read-only */
7934
+ readOnly: PropTypes.bool,
7935
+ /** Whether dropdown is required */
7936
+ required: PropTypes.bool,
7937
+ /** Whether dropdown is searchable */
7938
+ searchable: PropTypes.bool,
7939
+ /** Whether dropdown is clearable */
7940
+ clearable: PropTypes.bool,
7941
+ /** Whether multiple selection is allowed */
7942
+ multiple: PropTypes.bool,
7943
+ /** Function or property name to group options by */
7944
+ groupBy: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
7945
+ /** Custom filter function */
7946
+ filterFunction: PropTypes.func,
7947
+ /** Custom option renderer */
7948
+ renderOption: PropTypes.func,
7949
+ /** Custom value renderer */
7950
+ renderValue: PropTypes.func,
7951
+ /** Dropdown position */
7952
+ position: PropTypes.oneOf(['top', 'bottom']),
7953
+ /** Maximum height of dropdown menu */
7954
+ maxHeight: PropTypes.string,
7955
+ /** Error message */
7956
+ error: PropTypes.string,
7957
+ /** Helper text */
7958
+ helperText: PropTypes.string,
7959
+ /** Additional CSS classes */
7960
+ className: PropTypes.string,
7961
+ /** ARIA label */
7962
+ ariaLabel: PropTypes.string,
7963
+ /** Change handler */
7964
+ onChange: PropTypes.func,
7965
+ /** Open handler */
7966
+ onOpen: PropTypes.func,
7967
+ /** Close handler */
7968
+ onClose: PropTypes.func,
7969
+ /** Search handler */
7970
+ onSearch: PropTypes.func
7971
+ };
7972
+ DropDown2.defaultProps = {
7973
+ options: [],
7974
+ outlined: false,
7975
+ disabled: false,
7976
+ readOnly: false,
7977
+ required: false,
7978
+ searchable: false,
7979
+ clearable: false,
7980
+ multiple: false,
7981
+ position: 'bottom',
7982
+ maxHeight: '200px',
7983
+ className: ''
7984
+ };
7985
+
7986
+ /**
7987
+ * Enhanced DateRange component with improved validation and accessibility
7988
+ */
7989
+ var DateRange2 = function DateRange2(props) {
7990
+ var id = props.id,
7991
+ label = props.label,
7992
+ value = props.value,
7993
+ _props$outlined3 = props.outlined,
7994
+ outlined = _props$outlined3 === void 0 ? false : _props$outlined3,
7995
+ _props$disabled3 = props.disabled,
7996
+ disabled = _props$disabled3 === void 0 ? false : _props$disabled3,
7997
+ _props$readOnly3 = props.readOnly,
7998
+ readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3,
7999
+ _props$required3 = props.required,
8000
+ required = _props$required3 === void 0 ? false : _props$required3,
8001
+ minDate = props.minDate,
8002
+ maxDate = props.maxDate,
8003
+ error = props.error,
8004
+ helperText = props.helperText,
8005
+ className = props.className,
8006
+ ariaLabel = props.ariaLabel,
8007
+ onChange = props.onChange,
8008
+ onValidation = props.onValidation,
8009
+ restProps = _objectWithoutPropertiesLoose(props, _excluded3$1);
8010
+ var _useState9 = useState({
8011
+ from: '',
8012
+ to: ''
8013
+ }),
8014
+ form = _useState9[0],
8015
+ setForm = _useState9[1];
8016
+ var _useState0 = useState(''),
8017
+ internalError = _useState0[0],
8018
+ setInternalError = _useState0[1];
8019
+ var _useState1 = useState(true),
8020
+ isValid = _useState1[0],
8021
+ setIsValid = _useState1[1];
8022
+
8023
+ // Validate required props
8024
+ if (!id) {
8025
+ console.warn('DateRange2 component: id prop is required');
8026
+ }
8027
+
8028
+ // Initialize form from value
8029
+ useEffect(function () {
8030
+ if (value && typeof value === 'object') {
8031
+ setForm(function (prevForm) {
8032
+ // Only update if values are actually different
8033
+ if (prevForm.from !== (value.from || '') || prevForm.to !== (value.to || '')) {
8034
+ return {
8035
+ from: value.from || '',
8036
+ to: value.to || ''
8037
+ };
8038
+ }
8039
+ return prevForm;
8040
+ });
8041
+ }
8042
+ }, [value]);
8043
+
8044
+ // Validate date range
8045
+ useEffect(function () {
8046
+ var valid = true;
8047
+ var errorMessage = '';
8048
+ if (required && (!form.from || !form.to)) {
8049
+ valid = false;
8050
+ errorMessage = 'Both dates are required';
8051
+ } else if (form.from && form.to) {
8052
+ var fromDate = new Date(form.from);
8053
+ var toDate = new Date(form.to);
8054
+ if (fromDate > toDate) {
8055
+ valid = false;
8056
+ errorMessage = 'From date must be before To date';
8057
+ } else if (minDate && fromDate < new Date(minDate)) {
8058
+ valid = false;
8059
+ errorMessage = "From date must be after " + minDate;
8060
+ } else if (maxDate && toDate > new Date(maxDate)) {
8061
+ valid = false;
8062
+ errorMessage = "To date must be before " + maxDate;
8063
+ }
8064
+ }
8065
+ setIsValid(valid);
8066
+ setInternalError(valid ? '' : errorMessage);
8067
+ if (onValidation) {
8068
+ onValidation(id, valid, errorMessage);
8069
+ }
8070
+ }, [form, required, minDate, maxDate, id]); // Removed onValidation to prevent infinite loops
8071
+
8072
+ // Handle form changes
8073
+ useEffect(function () {
8074
+ if (form.from && form.to && onChange) {
8075
+ // Only call onChange if the form values are different from the current value
8076
+ var hasChanged = !value || value.from !== form.from || value.to !== form.to;
8077
+ if (hasChanged) {
8078
+ onChange(id, form);
8079
+ }
8080
+ }
8081
+ }, [form, id, value]); // Added value to check for changes
8082
+
8083
+ // Handle field changes
8084
+ var handleChange = useCallback(function (fieldId, fieldValue) {
8085
+ if (disabled || readOnly) return;
8086
+ setForm(function (prevForm) {
8087
+ var _extends2;
8088
+ return _extends({}, prevForm, (_extends2 = {}, _extends2[fieldId] = fieldValue, _extends2));
8089
+ });
8090
+ }, [disabled, readOnly]);
8091
+
8092
+ // Generate CSS classes
8093
+ var safeClassName = className || '';
8094
+ var cssClasses = ['date-range2', outlined && 'outlined', disabled && 'disabled', readOnly && 'readonly', error || internalError ? 'error' : '', !isValid && 'invalid', safeClassName].filter(Boolean).join(' ');
8095
+
8096
+ // Accessibility attributes
8097
+ var ariaAttributes = {
8098
+ 'aria-label': ariaLabel || label,
8099
+ 'aria-invalid': !isValid || !!(error || internalError),
8100
+ 'aria-required': required,
8101
+ 'aria-disabled': disabled,
8102
+ 'aria-readonly': readOnly,
8103
+ 'aria-describedby': error || internalError || helperText ? id + "-helper" : undefined
8104
+ };
8105
+ var displayError = error || internalError;
8106
+ var displayHelperText = helperText && !displayError;
8107
+ return /*#__PURE__*/React.createElement("div", _extends({
8108
+ className: cssClasses
8109
+ }, ariaAttributes, restProps), label && /*#__PURE__*/React.createElement("label", {
8110
+ className: "date-range2-label"
8111
+ }, /*#__PURE__*/React.createElement(Text, null, label)), /*#__PURE__*/React.createElement("div", {
8112
+ className: "date-range2-fields"
8113
+ }, /*#__PURE__*/React.createElement(TextField2, {
8114
+ id: id + "-from",
8115
+ type: "date",
8116
+ label: "From",
8117
+ value: form.from,
8118
+ outlined: outlined,
8119
+ disabled: disabled,
8120
+ readOnly: readOnly,
8121
+ required: required,
8122
+ min: minDate,
8123
+ max: form.to || maxDate,
8124
+ onChange: handleChange,
8125
+ className: "date-range2-from"
8126
+ }), /*#__PURE__*/React.createElement("span", {
8127
+ className: "date-range2-separator"
8128
+ }, /*#__PURE__*/React.createElement(Text, null, "to")), /*#__PURE__*/React.createElement(TextField2, {
8129
+ id: id + "-to",
8130
+ type: "date",
8131
+ label: "To",
8132
+ value: form.to,
8133
+ outlined: outlined,
8134
+ disabled: disabled,
8135
+ readOnly: readOnly,
8136
+ required: required,
8137
+ min: form.from || minDate,
8138
+ max: maxDate,
8139
+ onChange: handleChange,
8140
+ className: "date-range2-to"
8141
+ })), (displayError || displayHelperText) && /*#__PURE__*/React.createElement("div", {
8142
+ id: id + "-helper",
8143
+ className: "date-range2-helper " + (displayError ? 'error' : 'helper'),
8144
+ role: displayError ? 'alert' : 'status',
8145
+ "aria-live": displayError ? 'assertive' : 'polite'
8146
+ }, displayError && /*#__PURE__*/React.createElement(Icon, {
8147
+ icon: "error",
8148
+ size: "small"
8149
+ }), /*#__PURE__*/React.createElement(Text, null, displayError || helperText)));
8150
+ };
8151
+
8152
+ // PropTypes for DateRange2
8153
+ DateRange2.propTypes = {
8154
+ /** Unique identifier for the date range */
8155
+ id: PropTypes.string.isRequired,
8156
+ /** Field label */
8157
+ label: PropTypes.string,
8158
+ /** Date range value object with from and to properties */
8159
+ value: PropTypes.shape({
8160
+ from: PropTypes.string,
8161
+ to: PropTypes.string
8162
+ }),
8163
+ /** Whether fields have outlined style */
8164
+ outlined: PropTypes.bool,
8165
+ /** Whether fields are disabled */
8166
+ disabled: PropTypes.bool,
8167
+ /** Whether fields are read-only */
8168
+ readOnly: PropTypes.bool,
8169
+ /** Whether date range is required */
8170
+ required: PropTypes.bool,
8171
+ /** Minimum allowed date */
8172
+ minDate: PropTypes.string,
8173
+ /** Maximum allowed date */
8174
+ maxDate: PropTypes.string,
8175
+ /** Error message */
8176
+ error: PropTypes.string,
8177
+ /** Helper text */
8178
+ helperText: PropTypes.string,
8179
+ /** Additional CSS classes */
8180
+ className: PropTypes.string,
8181
+ /** ARIA label */
8182
+ ariaLabel: PropTypes.string,
8183
+ /** Change handler */
8184
+ onChange: PropTypes.func,
8185
+ /** Validation handler */
8186
+ onValidation: PropTypes.func
8187
+ };
8188
+ DateRange2.defaultProps = {
8189
+ outlined: false,
8190
+ disabled: false,
8191
+ readOnly: false,
8192
+ required: false,
8193
+ className: ''
8194
+ };
8195
+
8196
+ var _excluded$6 = ["columns", "rows", "onRowSelection", "onSort", "onCheckAll", "editable", "outlined", "expanded", "className", "emptyMessage", "emptyIcon", "multisort", "filterable", "onClearFilters", "loading", "skeleton", "striped", "hover", "compact", "bordered", "responsive", "stickyHeader", "virtualScrolling", "pageSize", "selectionMode", "sortMode", "resizable", "reorderable", "exportable", "searchable", "searchPlaceholder", "onSearch", "onExport", "onColumnResize", "onColumnReorder", "customEmptyState", "rowHeight", "density", "theme", "accessibility", "onRowClick", "onRowDoubleClick", "onRowContextMenu", "onCellClick", "onCellDoubleClick", "onCellEdit", "rowClassName", "cellClassName", "headerClassName", "footerContent", "showRowNumbers", "showSelectAll", "persistState", "stateKey", "onStateChange"];
8197
+ var isFunction$1 = function isFunction(value) {
8198
+ return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
8199
+ };
8200
+
8201
+ /**
8202
+ * Enhanced DataTable v2 - 100% Compatible with original DataTable
8203
+ *
8204
+ * This is a completely rewritten version of DataTable that maintains 100% API compatibility
8205
+ * while adding significant performance improvements, accessibility, and new features.
8206
+ */
8207
+ var DataTable2 = function DataTable2(props) {
8208
+ var _props$columns = props.columns,
8209
+ columns = _props$columns === void 0 ? [] : _props$columns,
8210
+ _props$rows = props.rows,
8211
+ rows = _props$rows === void 0 ? [] : _props$rows,
8212
+ onRowSelection = props.onRowSelection,
8213
+ onSort = props.onSort,
8214
+ onCheckAll = props.onCheckAll,
8215
+ editable = props.editable,
8216
+ outlined = props.outlined,
8217
+ _props$expanded = props.expanded,
8218
+ expanded = _props$expanded === void 0 ? false : _props$expanded,
8219
+ className = props.className,
8220
+ _props$emptyMessage = props.emptyMessage,
8221
+ emptyMessage = _props$emptyMessage === void 0 ? "No Results Found" : _props$emptyMessage,
8222
+ _props$emptyIcon = props.emptyIcon,
8223
+ emptyIcon = _props$emptyIcon === void 0 ? "search_off" : _props$emptyIcon,
8224
+ _props$multisort = props.multisort,
8225
+ multisort = _props$multisort === void 0 ? false : _props$multisort,
8226
+ _props$filterable = props.filterable,
8227
+ filterable = _props$filterable === void 0 ? false : _props$filterable,
8228
+ onClearFilters = props.onClearFilters,
8229
+ _props$loading = props.loading,
8230
+ loading = _props$loading === void 0 ? false : _props$loading,
8231
+ _props$skeleton = props.skeleton,
8232
+ skeleton = _props$skeleton === void 0 ? false : _props$skeleton,
8233
+ _props$striped = props.striped,
8234
+ striped = _props$striped === void 0 ? false : _props$striped,
8235
+ _props$hover = props.hover,
8236
+ hover = _props$hover === void 0 ? true : _props$hover,
8237
+ _props$compact = props.compact,
8238
+ compact = _props$compact === void 0 ? false : _props$compact,
8239
+ _props$bordered = props.bordered,
8240
+ bordered = _props$bordered === void 0 ? false : _props$bordered,
8241
+ _props$responsive = props.responsive,
8242
+ responsive = _props$responsive === void 0 ? true : _props$responsive,
8243
+ _props$stickyHeader = props.stickyHeader,
8244
+ stickyHeader = _props$stickyHeader === void 0 ? true : _props$stickyHeader,
8245
+ _props$virtualScrolli = props.virtualScrolling,
8246
+ virtualScrolling = _props$virtualScrolli === void 0 ? false : _props$virtualScrolli,
8247
+ _props$pageSize = props.pageSize,
8248
+ pageSize = _props$pageSize === void 0 ? 50 : _props$pageSize,
8249
+ _props$selectionMode = props.selectionMode,
8250
+ selectionMode = _props$selectionMode === void 0 ? 'single' : _props$selectionMode,
8251
+ _props$sortMode = props.sortMode,
8252
+ sortMode = _props$sortMode === void 0 ? 'single' : _props$sortMode,
8253
+ _props$resizable = props.resizable,
8254
+ resizable = _props$resizable === void 0 ? false : _props$resizable,
8255
+ _props$exportable = props.exportable,
8256
+ exportable = _props$exportable === void 0 ? false : _props$exportable,
8257
+ _props$searchable = props.searchable,
8258
+ searchable = _props$searchable === void 0 ? false : _props$searchable,
8259
+ _props$searchPlacehol = props.searchPlaceholder,
8260
+ searchPlaceholder = _props$searchPlacehol === void 0 ? "Search..." : _props$searchPlacehol,
8261
+ onSearch = props.onSearch,
8262
+ onExport = props.onExport,
8263
+ onColumnResize = props.onColumnResize,
8264
+ customEmptyState = props.customEmptyState,
8265
+ _props$rowHeight = props.rowHeight,
8266
+ rowHeight = _props$rowHeight === void 0 ? 'medium' : _props$rowHeight,
8267
+ _props$density = props.density,
8268
+ density = _props$density === void 0 ? 'normal' : _props$density,
8269
+ _props$theme = props.theme,
8270
+ theme = _props$theme === void 0 ? 'default' : _props$theme,
8271
+ _props$accessibility = props.accessibility,
8272
+ accessibility = _props$accessibility === void 0 ? true : _props$accessibility,
8273
+ onRowClick = props.onRowClick,
8274
+ onRowDoubleClick = props.onRowDoubleClick,
8275
+ onRowContextMenu = props.onRowContextMenu,
8276
+ onCellClick = props.onCellClick,
8277
+ onCellDoubleClick = props.onCellDoubleClick,
8278
+ onCellEdit = props.onCellEdit,
8279
+ rowClassName = props.rowClassName,
8280
+ cellClassName = props.cellClassName,
8281
+ headerClassName = props.headerClassName,
8282
+ footerContent = props.footerContent,
8283
+ _props$showRowNumbers = props.showRowNumbers,
8284
+ showRowNumbers = _props$showRowNumbers === void 0 ? false : _props$showRowNumbers,
8285
+ _props$showSelectAll = props.showSelectAll,
8286
+ showSelectAll = _props$showSelectAll === void 0 ? true : _props$showSelectAll,
8287
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$6);
8288
+
8289
+ // State management
8290
+ var _useState = useState({}),
8291
+ sortDir = _useState[0],
8292
+ setSortDir = _useState[1];
8293
+ var _useState2 = useState(false),
8294
+ allChecked = _useState2[0],
8295
+ setAllChecked = _useState2[1];
8296
+ var _useState3 = useState(''),
8297
+ searchTerm = _useState3[0],
8298
+ setSearchTerm = _useState3[1];
8299
+ var _useState4 = useState(new Set()),
8300
+ selectedRows = _useState4[0],
8301
+ setSelectedRows = _useState4[1];
8302
+ var _useState5 = useState(loading),
8303
+ isLoading = _useState5[0],
8304
+ setIsLoading = _useState5[1];
8305
+ var _useState6 = useState(0),
8306
+ currentPage = _useState6[0],
8307
+ setCurrentPage = _useState6[1];
8308
+
8309
+ // Refs
8310
+ var tableRef = useRef(null);
8311
+
8312
+ // Validate props
8313
+ useEffect(function () {
8314
+ if (!Array.isArray(columns)) {
8315
+ console.warn('DataTable2: columns prop must be an array');
8316
+ }
8317
+ if (!Array.isArray(rows)) {
8318
+ console.warn('DataTable2: rows prop must be an array');
8319
+ }
8320
+ if (virtualScrolling && !pageSize) {
8321
+ console.warn('DataTable2: pageSize is required when virtualScrolling is enabled');
8322
+ }
8323
+ }, [columns, rows, virtualScrolling, pageSize]);
8324
+
8325
+ // Sync loading state
8326
+ useEffect(function () {
8327
+ setIsLoading(loading);
8328
+ }, [loading]);
8329
+
8330
+ // Enhanced sort function (maintaining original behavior)
8331
+ var changeSort = useCallback(function (id) {
8332
+ if (sortMode === 'none') return;
8333
+ if (sortMode === 'multiple' || multisort) {
8334
+ var _Object$assign;
8335
+ var nextDir = sortDir[id] ? sortDir[id] * -1 : 1;
8336
+ var next = Object.assign({}, sortDir, (_Object$assign = {}, _Object$assign[id] = nextDir, _Object$assign));
8337
+ setSortDir(next);
8338
+ } else {
8339
+ var _setSortDir;
8340
+ var _nextDir = sortDir[id] ? sortDir[id] * -1 : 1;
8341
+ setSortDir((_setSortDir = {}, _setSortDir[id] = _nextDir, _setSortDir));
8342
+ }
8343
+ }, [sortDir, sortMode, multisort]);
8344
+
8345
+ // Enhanced multiSort function (maintaining original logic)
8346
+ var multiSort = useCallback(function (array, sortObject) {
8347
+ if (sortObject === void 0) {
8348
+ sortObject = {};
8349
+ }
8350
+ var sortKeys = Object.keys(sortObject);
8351
+ if (!sortKeys.length) {
8352
+ return array;
8353
+ }
8354
+ var keySort = function keySort(a, b, direction) {
8355
+ direction = direction !== null ? direction : 1;
8356
+
8357
+ // check if a and b are numbers and compare as numbers
8358
+ if (!isNaN(a) && !isNaN(b)) {
8359
+ a = Number(a);
8360
+ b = Number(b);
8361
+ }
8362
+
8363
+ // If b > a, multiply by -1 to get the reverse direction.
8364
+ return a > b ? direction : -1 * direction;
8365
+ };
8366
+ return array.sort(function (a, b) {
8367
+ var sorted = 0;
8368
+ var index = 0;
8369
+
8370
+ // Loop until sorted (-1 or 1) or until the sort keys have been processed.
8371
+ while (sorted === 0 && index < sortKeys.length) {
8372
+ var key = sortKeys[index];
8373
+ if (key) {
8374
+ var direction = sortObject[key];
8375
+ sorted = keySort(a[key], b[key], direction);
8376
+ index++;
8377
+ }
8378
+ }
8379
+ return sorted;
8380
+ });
8381
+ }, []);
8382
+
8383
+ // Enhanced row selection (maintaining original behavior)
8384
+ var select = useCallback(function (row, event) {
8385
+ if (event.target.id !== "checked") {
8386
+ // Enhanced selection logic
8387
+ if (selectionMode === 'multiple') {
8388
+ var newSelected = new Set(selectedRows);
8389
+ if (newSelected.has(row.id)) {
8390
+ newSelected["delete"](row.id);
8391
+ } else {
8392
+ newSelected.add(row.id);
8393
+ }
8394
+ setSelectedRows(newSelected);
8395
+ } else if (selectionMode === 'single') {
8396
+ setSelectedRows(new Set([row.id]));
8397
+ }
8398
+
8399
+ // Call original callback
8400
+ if (onRowSelection) onRowSelection(row, event);
8401
+ if (onRowClick) onRowClick(row, event);
8402
+ }
8403
+ }, [selectedRows, selectionMode, onRowSelection, onRowClick]);
8404
+
8405
+ // Enhanced move row function (maintaining original behavior)
8406
+ var moveRow = useCallback(function (dragged, dropped) {
8407
+ if (onSort) onSort(dragged, dropped);
8408
+ }, [onSort]);
8409
+
8410
+ // Enhanced check all function (maintaining original behavior)
8411
+ var checkAll = useCallback(function (_, value) {
8412
+ var ids = rows.map(function (row) {
8413
+ return row.id;
8414
+ });
8415
+ setAllChecked(value);
8416
+ if (selectionMode === 'multiple') {
8417
+ if (value) {
8418
+ setSelectedRows(new Set(ids));
8419
+ } else {
8420
+ setSelectedRows(new Set());
8421
+ }
8422
+ }
8423
+ if (onCheckAll) onCheckAll(ids, value);
8424
+ }, [rows, selectionMode, onCheckAll]);
8425
+
8426
+ // Search functionality
8427
+ var filteredRows = useMemo(function () {
8428
+ if (!searchTerm || !searchable) return rows;
8429
+ return rows.filter(function (row) {
8430
+ return columns.some(function (column) {
8431
+ var value = row[column.id];
8432
+ if (value == null) return false;
8433
+ return String(value).toLowerCase().includes(searchTerm.toLowerCase());
8434
+ });
8435
+ });
8436
+ }, [rows, searchTerm, searchable, columns]);
8437
+
8438
+ // Pagination for virtual scrolling
8439
+ var paginatedRows = useMemo(function () {
8440
+ if (!virtualScrolling) return filteredRows;
8441
+ var start = currentPage * pageSize;
8442
+ var end = start + pageSize;
8443
+ return filteredRows.slice(start, end);
8444
+ }, [filteredRows, virtualScrolling, currentPage, pageSize]);
8445
+
8446
+ // Final processed rows
8447
+ var processedRows = useMemo(function () {
8448
+ var rowsToProcess = virtualScrolling ? paginatedRows : filteredRows;
8449
+ return multiSort(rowsToProcess, sortDir);
8450
+ }, [virtualScrolling, paginatedRows, filteredRows, multiSort, sortDir]);
8451
+
8452
+ // Handle search
8453
+ var handleSearch = useCallback(function (term) {
8454
+ setSearchTerm(term);
8455
+ setCurrentPage(0); // Reset to first page
8456
+ if (onSearch) onSearch(term);
8457
+ }, [onSearch]);
8458
+
8459
+ // Handle export
8460
+ var handleExport = useCallback(function () {
8461
+ if (onExport) {
8462
+ onExport(processedRows, columns);
8463
+ } else {
8464
+ // Default CSV export
8465
+ var csvContent = [columns.map(function (col) {
8466
+ return col.label || col.id;
8467
+ }).join(',')].concat(processedRows.map(function (row) {
8468
+ return columns.map(function (col) {
8469
+ var value = row[col.id];
8470
+ return typeof value === 'string' ? "\"" + value + "\"" : value;
8471
+ }).join(',');
8472
+ })).join('\n');
8473
+ var blob = new Blob([csvContent], {
8474
+ type: 'text/csv'
8475
+ });
8476
+ var url = URL.createObjectURL(blob);
8477
+ var a = document.createElement('a');
8478
+ a.href = url;
8479
+ a.download = 'table-export.csv';
8480
+ a.click();
8481
+ URL.revokeObjectURL(url);
8482
+ }
8483
+ }, [processedRows, columns, onExport]);
8484
+
8485
+ // Generate CSS classes
8486
+ var cssClasses = ['datatable8',
8487
+ // Maintain original class for compatibility
8488
+ 'datatable2',
8489
+ // New class for v2 features
8490
+ outlined && 'outlined', striped && 'datatable2--striped', compact && 'datatable2--compact', bordered && 'datatable2--bordered', !hover && 'datatable2--no-hover', "datatable2--" + rowHeight, "datatable2--" + density, "datatable2--" + theme, responsive && 'datatable2--responsive', isLoading && 'datatable2--loading', skeleton && 'datatable2--skeleton', className].filter(Boolean).join(' ');
8491
+
8492
+ // Accessibility attributes
8493
+ var ariaAttributes = accessibility ? {
8494
+ role: 'table',
8495
+ 'aria-label': 'Data table',
8496
+ 'aria-rowcount': processedRows.length,
8497
+ 'aria-colcount': columns.length,
8498
+ 'aria-multiselectable': selectionMode === 'multiple',
8499
+ 'aria-busy': isLoading
8500
+ } : {};
8501
+
8502
+ // Render loading/skeleton state
8503
+ if (isLoading && skeleton) {
8504
+ return /*#__PURE__*/React.createElement("div", _extends({
8505
+ className: cssClasses
8506
+ }, ariaAttributes, restProps), /*#__PURE__*/React.createElement(SkeletonTable, {
8507
+ columns: columns,
8508
+ rows: 5
8509
+ }));
8510
+ }
8511
+ return /*#__PURE__*/React.createElement("div", _extends({
8512
+ className: cssClasses,
8513
+ ref: tableRef
8514
+ }, ariaAttributes, restProps), searchable && /*#__PURE__*/React.createElement("div", {
8515
+ className: "datatable2__search"
8516
+ }, /*#__PURE__*/React.createElement(TextField2, {
8517
+ placeholder: searchPlaceholder,
8518
+ value: searchTerm,
8519
+ onChange: function onChange(_, value) {
8520
+ return handleSearch(value);
8521
+ },
8522
+ icon: "search"
8523
+ })), exportable && /*#__PURE__*/React.createElement("div", {
8524
+ className: "datatable2__toolbar"
8525
+ }, /*#__PURE__*/React.createElement("button", {
8526
+ className: "datatable2__export-btn",
8527
+ onClick: handleExport,
8528
+ disabled: isLoading
8529
+ }, /*#__PURE__*/React.createElement(Icon, {
8530
+ icon: "download",
8531
+ size: "small"
8532
+ }), "Export")), /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement(DataTable2Header, {
8533
+ columns: columns,
8534
+ sortDir: sortDir,
8535
+ onSort: changeSort,
8536
+ allChecked: allChecked,
8537
+ onCheckAll: checkAll,
8538
+ showSelectAll: showSelectAll,
8539
+ showRowNumbers: showRowNumbers,
8540
+ resizable: resizable,
8541
+ onColumnResize: onColumnResize,
8542
+ accessibility: accessibility,
8543
+ headerClassName: headerClassName,
8544
+ stickyHeader: stickyHeader
8545
+ }), /*#__PURE__*/React.createElement(DataTable2Body, {
8546
+ columns: columns,
8547
+ rows: processedRows,
8548
+ onSelect: select,
8549
+ onDrop: moveRow,
8550
+ editable: editable,
8551
+ expanded: expanded,
8552
+ filterable: filterable,
8553
+ onClearFilters: onClearFilters,
8554
+ selectedRows: selectedRows,
8555
+ showRowNumbers: showRowNumbers,
8556
+ onRowDoubleClick: onRowDoubleClick,
8557
+ onRowContextMenu: onRowContextMenu,
8558
+ onCellClick: onCellClick,
8559
+ onCellDoubleClick: onCellDoubleClick,
8560
+ onCellEdit: onCellEdit,
8561
+ rowClassName: rowClassName,
8562
+ cellClassName: cellClassName,
8563
+ accessibility: accessibility,
8564
+ emptyMessage: emptyMessage,
8565
+ emptyIcon: emptyIcon,
8566
+ customEmptyState: customEmptyState,
8567
+ isLoading: isLoading
8568
+ })), footerContent && /*#__PURE__*/React.createElement("div", {
8569
+ className: "datatable2__footer"
8570
+ }, footerContent), virtualScrolling && filteredRows.length > pageSize && /*#__PURE__*/React.createElement("div", {
8571
+ className: "datatable2__pagination"
8572
+ }, /*#__PURE__*/React.createElement("button", {
8573
+ onClick: function onClick() {
8574
+ return setCurrentPage(Math.max(0, currentPage - 1));
8575
+ },
8576
+ disabled: currentPage === 0
8577
+ }, "Previous"), /*#__PURE__*/React.createElement("span", null, "Page ", currentPage + 1, " of ", Math.ceil(filteredRows.length / pageSize)), /*#__PURE__*/React.createElement("button", {
8578
+ onClick: function onClick() {
8579
+ return setCurrentPage(Math.min(Math.ceil(filteredRows.length / pageSize) - 1, currentPage + 1));
8580
+ },
8581
+ disabled: currentPage >= Math.ceil(filteredRows.length / pageSize) - 1
8582
+ }, "Next")));
8583
+ };
8584
+
8585
+ /**
8586
+ * Enhanced DataTable Header - maintains original structure
8587
+ */
8588
+ var DataTable2Header = function DataTable2Header(_ref) {
8589
+ var columns = _ref.columns,
8590
+ sortDir = _ref.sortDir,
8591
+ onSort = _ref.onSort,
8592
+ allChecked = _ref.allChecked,
8593
+ onCheckAll = _ref.onCheckAll,
8594
+ showSelectAll = _ref.showSelectAll,
8595
+ showRowNumbers = _ref.showRowNumbers,
8596
+ resizable = _ref.resizable,
8597
+ onColumnResize = _ref.onColumnResize,
8598
+ accessibility = _ref.accessibility,
8599
+ headerClassName = _ref.headerClassName,
8600
+ stickyHeader = _ref.stickyHeader;
8601
+ var headerClasses = ['datatable2__header', stickyHeader && 'datatable2__header--sticky', headerClassName].filter(Boolean).join(' ');
8602
+ return /*#__PURE__*/React.createElement("thead", {
8603
+ className: headerClasses
8604
+ }, /*#__PURE__*/React.createElement("tr", null, showRowNumbers && /*#__PURE__*/React.createElement("th", {
8605
+ className: "datatable2__row-number-header"
8606
+ }, /*#__PURE__*/React.createElement("div", null, "#")), columns.map(function (_ref2) {
8607
+ var id = _ref2.id,
8608
+ label = _ref2.label,
8609
+ type = _ref2.type,
8610
+ item = _ref2.item,
8611
+ sortable = _ref2.sortable,
8612
+ _ref2$resizable = _ref2.resizable,
8613
+ colResizable = _ref2$resizable === void 0 ? false : _ref2$resizable;
8614
+ var isResizable = resizable || colResizable;
8615
+ var resizableStyle = isResizable ? "resizable-column" : "";
8616
+ var sort = sortDir[id] ? sortDir[id] : null;
8617
+ var _ref3 = type === TYPES$1.ENTITY ? [1, Object.values(item).filter(function (v) {
8618
+ return v.column === true;
8619
+ }).length] : [2, 1],
8620
+ rowspan = _ref3[0],
8621
+ colspan = _ref3[1];
8622
+ var thProps = accessibility ? {
8623
+ role: 'columnheader',
8624
+ 'aria-sort': sort > 0 ? 'ascending' : sort < 0 ? 'descending' : 'none',
8625
+ tabIndex: sortable ? 0 : -1
8626
+ } : {};
8627
+ return /*#__PURE__*/React.createElement("th", _extends({
8628
+ key: id,
8629
+ className: resizableStyle,
8630
+ rowSpan: rowspan,
8631
+ colSpan: colspan,
8632
+ style: {
8633
+ minWidth: '80px'
8634
+ }
8635
+ }, thProps), /*#__PURE__*/React.createElement("div", {
8636
+ style: {
8637
+ display: 'flex',
8638
+ alignItems: 'center',
8639
+ justifyContent: 'space-between'
8640
+ }
8641
+ }, /*#__PURE__*/React.createElement("div", {
8642
+ style: {
8643
+ display: 'flex',
8644
+ alignItems: 'center',
8645
+ gap: '0.5rem'
8646
+ }
8647
+ }, id === "checked" && onCheckAll && showSelectAll ? /*#__PURE__*/React.createElement(CheckBox, {
8648
+ onChange: onCheckAll,
8649
+ value: allChecked
8650
+ }) : /*#__PURE__*/React.createElement(Text, {
8651
+ key: "th_" + id
8652
+ }, label), sortable ? /*#__PURE__*/React.createElement(SortIcon2, {
8653
+ sortDir: sortDir[id],
8654
+ onChange: function onChange() {
8655
+ return onSort(id);
8656
+ }
8657
+ }) : null)), isResizable && /*#__PURE__*/React.createElement("div", {
8658
+ className: "column-resizer",
8659
+ onMouseDown: function onMouseDown(e) {
8660
+ return handleColumnResize(e, id, onColumnResize);
8661
+ },
8662
+ title: "Drag to resize column"
8663
+ }));
8664
+ }), /*#__PURE__*/React.createElement("th", {
8665
+ rowSpan: 2,
8666
+ colSpan: 1
8667
+ })), /*#__PURE__*/React.createElement("tr", null, showRowNumbers && /*#__PURE__*/React.createElement("th", null), columns.filter(function (_ref4) {
8668
+ var type = _ref4.type;
8669
+ return type === TYPES$1.ENTITY;
8670
+ }).map(function (column) {
8671
+ var item = column.item;
8672
+ var fields = item ? Object.values(item) : [];
8673
+ return fields.filter(function (field) {
8674
+ return field.column === true;
8675
+ }).map(function (field) {
8676
+ return /*#__PURE__*/React.createElement("th", {
8677
+ key: field.id
8678
+ }, field.label);
8679
+ });
8680
+ })));
8681
+ };
8682
+
8683
+ /**
8684
+ * Enhanced DataTable Body - maintains original structure
8685
+ */
8686
+ var DataTable2Body = function DataTable2Body(_ref5) {
8687
+ var columns = _ref5.columns,
8688
+ rows = _ref5.rows,
8689
+ onSelect = _ref5.onSelect,
8690
+ onDrop = _ref5.onDrop,
8691
+ editable = _ref5.editable,
8692
+ expanded = _ref5.expanded,
8693
+ filterable = _ref5.filterable,
8694
+ onClearFilters = _ref5.onClearFilters,
8695
+ selectedRows = _ref5.selectedRows,
8696
+ showRowNumbers = _ref5.showRowNumbers,
8697
+ onRowDoubleClick = _ref5.onRowDoubleClick,
8698
+ onRowContextMenu = _ref5.onRowContextMenu,
8699
+ onCellClick = _ref5.onCellClick,
8700
+ onCellDoubleClick = _ref5.onCellDoubleClick,
8701
+ onCellEdit = _ref5.onCellEdit,
8702
+ rowClassName = _ref5.rowClassName,
8703
+ cellClassName = _ref5.cellClassName,
8704
+ accessibility = _ref5.accessibility,
8705
+ emptyMessage = _ref5.emptyMessage,
8706
+ emptyIcon = _ref5.emptyIcon,
8707
+ customEmptyState = _ref5.customEmptyState;
8708
+ return /*#__PURE__*/React.createElement("tbody", null, filterable ? /*#__PURE__*/React.createElement(DataTableFiltersRow2, {
8709
+ columns: columns,
8710
+ onClear: onClearFilters,
8711
+ showRowNumbers: showRowNumbers
8712
+ }) : null, rows.length > 0 ? rows.map(function (row, index) {
8713
+ return /*#__PURE__*/React.createElement(DataTableRow2, {
8714
+ key: row.id,
8715
+ index: index,
8716
+ row: row,
8717
+ columns: columns,
8718
+ onSelect: onSelect,
8719
+ onDrop: onDrop,
8720
+ editable: editable,
8721
+ expanded: expanded,
8722
+ selected: selectedRows.has(row.id),
8723
+ showRowNumbers: showRowNumbers,
8724
+ onRowDoubleClick: onRowDoubleClick,
8725
+ onRowContextMenu: onRowContextMenu,
8726
+ onCellClick: onCellClick,
8727
+ onCellDoubleClick: onCellDoubleClick,
8728
+ onCellEdit: onCellEdit,
8729
+ rowClassName: rowClassName,
8730
+ cellClassName: cellClassName,
8731
+ accessibility: accessibility
8732
+ });
8733
+ }) : /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
8734
+ colSpan: columns.length + (showRowNumbers ? 1 : 0) + 1
8735
+ }, customEmptyState || /*#__PURE__*/React.createElement(EmptyMessage, {
8736
+ icon: emptyIcon ? emptyIcon : "search_off",
8737
+ text: emptyMessage,
8738
+ className: "empty-message"
8739
+ }))));
8740
+ };
8741
+
8742
+ /**
8743
+ * Enhanced DataTableFiltersRow - maintains original structure
8744
+ */
8745
+ var DataTableFiltersRow2 = function DataTableFiltersRow2(_ref6) {
8746
+ var columns = _ref6.columns,
8747
+ onClear = _ref6.onClear,
8748
+ showRowNumbers = _ref6.showRowNumbers;
8749
+ var _useState7 = useState({}),
8750
+ form = _useState7[0],
8751
+ setForm = _useState7[1];
8752
+ function changeFilter(id, value, onFilter) {
8753
+ var _extends2;
8754
+ setForm(_extends({}, form, (_extends2 = {}, _extends2[id] = value, _extends2)));
8755
+ if (onFilter) onFilter(id, value);
8756
+ }
8757
+ function clear() {
8758
+ setForm({});
8759
+ if (onClear) onClear();
8760
+ }
8761
+ var dirty = Object.keys(form).length > 0;
8762
+ return /*#__PURE__*/React.createElement("tr", {
8763
+ className: "filters-row"
8764
+ }, showRowNumbers && /*#__PURE__*/React.createElement("td", {
8765
+ className: "filter-cell"
8766
+ }), columns.map(function (_ref7) {
8767
+ var id = _ref7.id,
8768
+ filterable = _ref7.filterable,
8769
+ onFilter = _ref7.onFilter,
8770
+ _ref7$predictive = _ref7.predictive,
8771
+ predictive = _ref7$predictive === void 0 ? false : _ref7$predictive,
8772
+ options = _ref7.options;
8773
+ var value = form[id] ? form[id] : '';
8774
+ var field = options ? /*#__PURE__*/React.createElement(DropDown2, {
8775
+ id: id,
8776
+ value: value,
8777
+ options: options,
8778
+ predictive: predictive,
8779
+ onChange: function onChange(id, value) {
8780
+ return changeFilter(id, value, onFilter);
8781
+ },
8782
+ outlined: true
8783
+ }) : /*#__PURE__*/React.createElement(TextField2, {
8784
+ id: id,
8785
+ value: value,
8786
+ onChange: function onChange(id, value) {
8787
+ return changeFilter(id, value, onFilter);
8788
+ },
8789
+ outlined: true
8790
+ });
8791
+ return /*#__PURE__*/React.createElement("td", {
8792
+ key: id,
8793
+ className: "filter-cell"
8794
+ }, filterable ? field : null);
8795
+ }), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Icon, {
8796
+ icon: "close",
8797
+ size: "small",
8798
+ clickable: true,
8799
+ action: clear,
8800
+ disabled: !dirty
8801
+ })));
8802
+ };
8803
+
8804
+ /**
8805
+ * Enhanced DataTable Row - maintains original structure
8806
+ */
8807
+ var DataTableRow2 = function DataTableRow2(props) {
8808
+ var index = props.index,
8809
+ row = props.row,
8810
+ _props$columns2 = props.columns,
8811
+ columns = _props$columns2 === void 0 ? [] : _props$columns2,
8812
+ onSelect = props.onSelect,
8813
+ editable = props.editable,
8814
+ _props$expanded2 = props.expanded,
8815
+ expanded = _props$expanded2 === void 0 ? false : _props$expanded2,
8816
+ _props$selected = props.selected,
8817
+ selected = _props$selected === void 0 ? false : _props$selected,
8818
+ showRowNumbers = props.showRowNumbers,
8819
+ onRowDoubleClick = props.onRowDoubleClick,
8820
+ onRowContextMenu = props.onRowContextMenu,
8821
+ onCellClick = props.onCellClick,
8822
+ onCellDoubleClick = props.onCellDoubleClick,
8823
+ onCellEdit = props.onCellEdit,
8824
+ rowClassName = props.rowClassName,
8825
+ cellClassName = props.cellClassName,
8826
+ accessibility = props.accessibility;
8827
+ var rowClass = row.className;
8828
+ var _useState8 = useState(expanded),
8829
+ isInfoOpen = _useState8[0],
8830
+ toggleInfo = _useState8[1];
8831
+ var infoIcon = isInfoOpen ? 'expand_less' : 'expand_more';
8832
+ var style = isInfoOpen ? "expanded" : "";
8833
+ if (selected) style += " selected";
8834
+ var finalRowClassName = [style, rowClass, typeof rowClassName === 'function' ? rowClassName(row, index) : rowClassName].filter(Boolean).join(' ');
8835
+ var rowProps = accessibility ? {
8836
+ role: 'row',
8837
+ 'aria-selected': selected,
8838
+ 'aria-rowindex': index + 1,
8839
+ tabIndex: 0
8840
+ } : {};
8841
+ var handleRowClick = useCallback(function (ev) {
8842
+ onSelect(row, ev);
8843
+ }, [onSelect, row]);
8844
+ var handleRowDoubleClick = useCallback(function (ev) {
8845
+ if (onRowDoubleClick) onRowDoubleClick(row, ev);
8846
+ }, [onRowDoubleClick, row]);
8847
+ var handleRowContextMenu = useCallback(function (ev) {
8848
+ if (onRowContextMenu) onRowContextMenu(row, ev);
8849
+ }, [onRowContextMenu, row]);
8850
+ return /*#__PURE__*/React.createElement(Fragment$2, null, /*#__PURE__*/React.createElement("tr", _extends({
8851
+ className: finalRowClassName,
8852
+ onClick: handleRowClick,
8853
+ onDoubleClick: handleRowDoubleClick,
8854
+ onContextMenu: handleRowContextMenu
8855
+ }, rowProps), showRowNumbers && /*#__PURE__*/React.createElement("td", {
8856
+ className: "datatable2__row-number"
8857
+ }, index + 1), columns.map(function (column, cindex) {
8858
+ return /*#__PURE__*/React.createElement(DataTableCell2, {
8859
+ key: column.id + "_" + cindex,
8860
+ index: index,
8861
+ row: row,
8862
+ column: column,
8863
+ cell: row[column.id],
8864
+ editable: editable || column.editable,
8865
+ onCellClick: onCellClick,
8866
+ onCellDoubleClick: onCellDoubleClick,
8867
+ onCellEdit: onCellEdit,
8868
+ cellClassName: cellClassName,
8869
+ accessibility: accessibility
8870
+ });
8871
+ }), row.info ? /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Icon, {
8872
+ icon: infoIcon,
8873
+ clickable: true,
8874
+ action: function action() {
8875
+ return toggleInfo(!isInfoOpen);
8876
+ }
8877
+ })) : /*#__PURE__*/React.createElement("td", null)), row.info && isInfoOpen ? /*#__PURE__*/React.createElement("tr", {
8878
+ className: "table-row-info"
8879
+ }, /*#__PURE__*/React.createElement("td", {
8880
+ colSpan: columns.length + (showRowNumbers ? 1 : 0) + 1
8881
+ }, isFunction$1(row.info) ? row.info() : row.info)) : null);
8882
+ };
8883
+
8884
+ /**
8885
+ * Enhanced Sort Icon - maintains original behavior
8886
+ */
8887
+ var SortIcon2 = function SortIcon2(props) {
8888
+ var sortDir = props.sortDir,
8889
+ onChange = props.onChange;
8890
+ var icon = sortDir ? sortDir > 0 ? "arrow_upward" : "arrow_downward" : "swap_vert";
8891
+ return /*#__PURE__*/React.createElement(Icon, {
8892
+ icon: icon,
8893
+ size: "small",
8894
+ clickable: true,
8895
+ action: onChange
8896
+ });
8897
+ };
8898
+
8899
+ /**
8900
+ * Enhanced column resize handler
8901
+ */
8902
+ var handleColumnResize = function handleColumnResize(e, columnId, onColumnResize) {
8903
+ e.preventDefault();
8904
+ e.stopPropagation();
8905
+ var startX = e.clientX;
8906
+ var th = e.target.parentElement;
8907
+ var startWidth = th.offsetWidth;
8908
+ var handleMouseMove = function handleMouseMove(e) {
8909
+ var newWidth = Math.max(80, startWidth + (e.clientX - startX));
8910
+
8911
+ // Apply width directly to the element for immediate feedback
8912
+ th.style.width = newWidth + "px";
8913
+
8914
+ // Call external callback if provided
8915
+ if (onColumnResize) {
8916
+ onColumnResize(columnId, newWidth);
8917
+ }
8918
+ };
8919
+ var _handleMouseUp = function handleMouseUp() {
8920
+ document.removeEventListener('mousemove', handleMouseMove);
8921
+ document.removeEventListener('mouseup', _handleMouseUp);
8922
+ document.body.style.cursor = 'default';
8923
+ document.body.style.userSelect = 'auto';
8924
+ };
8925
+
8926
+ // Prevent text selection during resize
8927
+ document.body.style.cursor = 'col-resize';
8928
+ document.body.style.userSelect = 'none';
8929
+ document.addEventListener('mousemove', handleMouseMove);
8930
+ document.addEventListener('mouseup', _handleMouseUp);
8931
+ };
8932
+
8933
+ /**
8934
+ * Enhanced DataTable Cell - maintains original structure and logic
8935
+ */
8936
+ var DataTableCell2 = function DataTableCell2(_ref8) {
8937
+ var index = _ref8.index,
8938
+ row = _ref8.row,
8939
+ column = _ref8.column,
8940
+ cell = _ref8.cell,
8941
+ editable = _ref8.editable,
8942
+ onCellClick = _ref8.onCellClick,
8943
+ onCellDoubleClick = _ref8.onCellDoubleClick,
8944
+ cellClassName = _ref8.cellClassName,
8945
+ accessibility = _ref8.accessibility;
8946
+ var handleCellClick = useCallback(function (e) {
8947
+ if (onCellClick) onCellClick(row, column, cell, e);
8948
+ }, [onCellClick, row, column, cell]);
8949
+ var handleCellDoubleClick = useCallback(function (e) {
8950
+ if (onCellDoubleClick) onCellDoubleClick(row, column, cell, e);
8951
+ }, [onCellDoubleClick, row, column, cell]);
8952
+ var render = function render(type) {
8953
+ var id = column.id,
8954
+ _column$disabled = column.disabled,
8955
+ disabled = _column$disabled === void 0 ? false : _column$disabled,
8956
+ min = column.min,
8957
+ max = column.max,
8958
+ _onChange = column.onChange,
8959
+ format = column.format,
8960
+ options = column.options,
8961
+ action = column.action,
8962
+ maxDecimals = column.maxDecimals;
8963
+ if (id === "checked") {
8964
+ return row.checkDisabled ? null : /*#__PURE__*/React.createElement(CheckBox, {
8965
+ id: id,
8966
+ value: cell,
8967
+ onChange: function onChange(id, value) {
8968
+ return _onChange(row.id, id, value);
8969
+ }
8970
+ });
8971
+ } else if (editable && _onChange) {
8972
+ switch (type) {
8973
+ case "ICON":
8974
+ return /*#__PURE__*/React.createElement(Icon, {
8975
+ icon: cell
8976
+ });
8977
+ case "BOOLEAN":
8978
+ return /*#__PURE__*/React.createElement(CheckBox, {
8979
+ id: id,
8980
+ value: cell,
8981
+ onChange: function onChange(id, value) {
8982
+ return _onChange(row.id, id, value);
8983
+ },
8984
+ disabled: disabled
8985
+ });
8986
+ case "Boolean":
8987
+ return /*#__PURE__*/React.createElement(CheckBox, {
8988
+ id: id,
8989
+ value: cell,
8990
+ onChange: function onChange(id, value) {
8991
+ return _onChange(row.id, id, value);
8992
+ },
8993
+ disabled: disabled
8994
+ });
8995
+ case "SELECTION":
8996
+ return /*#__PURE__*/React.createElement(DropDown2, {
8997
+ id: id,
8998
+ value: cell,
8999
+ placeholder: "--Select--",
9000
+ options: options,
9001
+ onChange: function onChange(id, value) {
9002
+ return _onChange(row.id, id, value);
9003
+ }
9004
+ });
9005
+ case "CHECK":
9006
+ return /*#__PURE__*/React.createElement(CheckBox, {
9007
+ id: id,
9008
+ value: cell,
9009
+ onChange: function onChange(id, value) {
9010
+ return _onChange(row.id, id, value);
9011
+ },
9012
+ disabled: row.disabled
9013
+ });
9014
+ case "CHECKABLE":
9015
+ return cell && cell.value ? /*#__PURE__*/React.createElement(CheckBox, {
9016
+ id: id,
9017
+ value: cell.checked || false,
9018
+ label: cell.value,
9019
+ onChange: function onChange(id, checked) {
9020
+ return _onChange(row.id, id, cell.value, checked, cell);
9021
+ }
9022
+ }) : '';
9023
+ case "TEXTFIELD":
9024
+ return /*#__PURE__*/React.createElement(TextField2, {
9025
+ id: id,
9026
+ value: cell,
9027
+ onChange: function onChange(id, value) {
9028
+ return _onChange(row.id, id, value);
9029
+ }
9030
+ });
9031
+ case "String":
9032
+ return /*#__PURE__*/React.createElement(StringCellEditor2, {
9033
+ id: id,
9034
+ value: cell,
9035
+ options: options,
9036
+ onChange: function onChange(id, value) {
9037
+ return _onChange(row.id, id, value);
9038
+ }
9039
+ });
9040
+ case "Number":
9041
+ return /*#__PURE__*/React.createElement(TextField2, {
9042
+ id: id,
9043
+ type: "number",
9044
+ value: cell,
9045
+ min: min,
9046
+ max: max,
9047
+ maxDecimals: column.maxDecimals,
9048
+ onChange: function onChange(id, value) {
9049
+ return _onChange(row.id, id, value);
9050
+ }
9051
+ });
9052
+ case "Image":
9053
+ return /*#__PURE__*/React.createElement(ImageCellViewer2, {
9054
+ id: row.id,
9055
+ value: cell,
9056
+ uploadURL: column.uploadURL,
9057
+ onChange: column.onChange
9058
+ });
9059
+ default:
9060
+ return cell;
9061
+ }
9062
+ } else {
9063
+ switch (type) {
9064
+ case "INDEX":
9065
+ return /*#__PURE__*/React.createElement("span", null, index);
9066
+ case "ICON":
9067
+ return /*#__PURE__*/React.createElement(Icon, {
9068
+ icon: cell
9069
+ });
9070
+ case "Boolean":
9071
+ return /*#__PURE__*/React.createElement(BooleanCellViewer2, {
9072
+ id: id,
9073
+ value: cell
9074
+ });
9075
+ case "String":
9076
+ return /*#__PURE__*/React.createElement(StringCellViewer2, {
9077
+ id: id,
9078
+ value: cell,
9079
+ format: format,
9080
+ options: options,
9081
+ action: action
9082
+ });
9083
+ case "Number":
9084
+ return /*#__PURE__*/React.createElement(NumberCellViewer2, {
9085
+ id: id,
9086
+ value: cell,
9087
+ format: format,
9088
+ maxDecimals: maxDecimals
9089
+ });
9090
+ case "Image":
9091
+ return /*#__PURE__*/React.createElement("img", {
9092
+ src: cell,
9093
+ alt: ""
9094
+ });
9095
+ case "DATETIME":
9096
+ var locale = window.navigator.userLanguage || window.navigator.language;
9097
+ var date = new Date(cell);
9098
+ date.setMinutes(date.getMinutes() + date.getTimezoneOffset() + 1);
9099
+ return /*#__PURE__*/React.createElement("span", null, date.toLocaleString(locale, {
9100
+ year: 'numeric',
9101
+ month: 'numeric',
9102
+ day: 'numeric',
9103
+ hour: 'numeric',
9104
+ minute: 'numeric',
9105
+ second: 'numeric'
9106
+ }));
9107
+ default:
9108
+ return cell;
9109
+ }
9110
+ }
9111
+ };
9112
+ var finalCellClassName = [column.id, typeof cellClassName === 'function' ? cellClassName(row, column, cell) : cellClassName].filter(Boolean).join(' ');
9113
+ var cellProps = accessibility ? {
9114
+ role: 'cell',
9115
+ 'aria-describedby': column.label ? column.id + "-header" : undefined,
9116
+ tabIndex: editable ? 0 : -1
9117
+ } : {};
9118
+ return column.type === TYPES$1.ENTITY ? /*#__PURE__*/React.createElement(EntityCellViewer2, {
9119
+ id: column.id,
9120
+ item: column.item,
9121
+ value: cell
9122
+ }) : /*#__PURE__*/React.createElement("td", _extends({
9123
+ key: column.id,
9124
+ className: finalCellClassName,
9125
+ onClick: handleCellClick,
9126
+ onDoubleClick: handleCellDoubleClick
9127
+ }, cellProps), render(column.type));
9128
+ };
9129
+
9130
+ // Import and re-export original cell viewers with enhanced versions
9131
+ // These maintain 100% compatibility while adding new features
9132
+
9133
+ /**
9134
+ * Enhanced Image Cell Viewer
9135
+ */
9136
+ var ImageCellViewer2 = function ImageCellViewer2(_ref9) {
9137
+ var id = _ref9.id,
9138
+ value = _ref9.value,
9139
+ uploadURL = _ref9.uploadURL,
9140
+ onChange = _ref9.onChange;
9141
+ function success(file, message) {
9142
+ if (onChange) onChange(id, file, message);
9143
+ }
9144
+ function error(file, message) {
9145
+ if (onChange) onChange(id, file, message);
9146
+ console.error(message);
9147
+ }
9148
+ return uploadURL ? /*#__PURE__*/React.createElement("div", {
9149
+ className: "image-cell"
9150
+ }, value ? /*#__PURE__*/React.createElement("img", {
9151
+ src: value,
9152
+ alt: ""
9153
+ }) : /*#__PURE__*/React.createElement(Icon, {
9154
+ icon: "person"
9155
+ }), /*#__PURE__*/React.createElement(Uploader, {
9156
+ view: "icon",
9157
+ icon: "cloud_upload",
9158
+ target: uploadURL,
9159
+ onSuccess: success,
9160
+ onError: error
9161
+ })) : /*#__PURE__*/React.createElement("div", {
9162
+ className: "image-cell"
9163
+ }, value ? /*#__PURE__*/React.createElement("img", {
9164
+ src: value,
9165
+ alt: ""
9166
+ }) : /*#__PURE__*/React.createElement(Icon, {
9167
+ icon: "person"
9168
+ }));
9169
+ };
9170
+
9171
+ /**
9172
+ * Enhanced Entity Cell Viewer
9173
+ */
9174
+ var EntityCellViewer2 = function EntityCellViewer2(_ref0) {
9175
+ var item = _ref0.item,
9176
+ value = _ref0.value;
9177
+ var fields = Object.values(item).filter(function (field) {
9178
+ return field.column === true;
9179
+ });
9180
+ var locale = window.navigator.userLanguage || window.navigator.language;
9181
+ return fields.map(function (field) {
9182
+ var text = value[field.id];
9183
+ if (field.format) {
9184
+ switch (field.format) {
9185
+ case FORMATS$1.COLOR:
9186
+ text = /*#__PURE__*/React.createElement("input", {
9187
+ type: "color",
9188
+ value: text,
9189
+ disabled: true
9190
+ });
9191
+ break;
9192
+ case FORMATS$1.URL:
9193
+ text = /*#__PURE__*/React.createElement("a", {
9194
+ href: text,
9195
+ target: "download",
9196
+ download: true
9197
+ }, text);
9198
+ break;
9199
+ case FORMATS$1.IMG:
9200
+ text = /*#__PURE__*/React.createElement("img", {
9201
+ src: text,
9202
+ alt: ""
9203
+ });
9204
+ break;
9205
+ case FORMATS$1.DATE:
9206
+ var fecha = new Date(text);
9207
+ fecha.setMinutes(fecha.getMinutes() + fecha.getTimezoneOffset() + 1);
9208
+ text = fecha.toLocaleString(locale, {
9209
+ day: 'numeric',
9210
+ month: 'numeric',
9211
+ year: 'numeric'
9212
+ });
9213
+ break;
9214
+ case FORMATS$1.TIME:
9215
+ text = new Date(text).toLocaleString(locale, {
9216
+ hour: 'numeric',
9217
+ minute: 'numeric',
9218
+ second: 'numeric'
9219
+ });
9220
+ break;
9221
+ case FORMATS$1.DATETIME:
9222
+ text = new Date(text).toLocaleString(locale, {
9223
+ year: 'numeric',
9224
+ month: 'numeric',
9225
+ day: 'numeric',
9226
+ hour: 'numeric',
9227
+ minute: 'numeric',
9228
+ second: 'numeric'
9229
+ });
9230
+ break;
9231
+ }
9232
+ }
9233
+ return /*#__PURE__*/React.createElement("td", {
9234
+ key: field.id,
9235
+ className: "entity-cell " + field.id
9236
+ }, text);
9237
+ });
9238
+ };
9239
+
9240
+ /**
9241
+ * Enhanced Boolean Cell Viewer
9242
+ */
9243
+ var BooleanCellViewer2 = function BooleanCellViewer2(_ref1) {
9244
+ var _ref1$value = _ref1.value,
9245
+ value = _ref1$value === void 0 ? false : _ref1$value;
9246
+ var icon = value === true ? "check_box" : "check_box_outline_blank";
9247
+ return /*#__PURE__*/React.createElement(Icon, {
9248
+ icon: icon
9249
+ });
9250
+ };
9251
+
9252
+ /**
9253
+ * Enhanced Number Cell Viewer
9254
+ */
9255
+ var NumberCellViewer2 = function NumberCellViewer2(_ref10) {
9256
+ var value = _ref10.value,
9257
+ format = _ref10.format,
9258
+ maxDecimals = _ref10.maxDecimals;
9259
+ function formatNumber(number, maxDecimals) {
9260
+ if (maxDecimals === void 0) {
9261
+ maxDecimals = 0;
9262
+ }
9263
+ if (number === null) return "null";
9264
+ var result = number.toLocaleString('es-ES', {
9265
+ minimumFractionDigits: 2,
9266
+ maximumFractionDigits: 2
9267
+ });
9268
+ var parts = result.toString().split(",");
9269
+ var numberPart = parts[0];
9270
+ var decimalPart = parts[1];
9271
+ var thousands = /\B(?=(\d{3})+(?!\d))/g;
9272
+ var decimal = decimalPart ? decimalPart.substring(0, maxDecimals) : null;
9273
+ return numberPart.replace(thousands, ".") + (decimal ? "," + decimal : "");
9274
+ }
9275
+ if (format) {
9276
+ switch (format) {
9277
+ case FORMATS$1.CURRENCY:
9278
+ return /*#__PURE__*/React.createElement("span", null, value.toLocaleString('es-ES', {
9279
+ style: 'currency',
9280
+ currency: 'EUR'
9281
+ }));
9282
+ case FORMATS$1.PERCENT:
9283
+ return /*#__PURE__*/React.createElement("span", null, value.toLocaleString('es-ES', {
9284
+ style: 'percent',
9285
+ minimumFractionDigits: 2
9286
+ }));
9287
+ case "ES_es":
9288
+ var number = Number(value);
9289
+ if (isNaN(number)) return value;
9290
+ return /*#__PURE__*/React.createElement("span", null, formatNumber(number, maxDecimals));
9291
+ default:
9292
+ return /*#__PURE__*/React.createElement("span", null, value);
9293
+ }
9294
+ } else {
9295
+ var decimals = maxDecimals ? maxDecimals : 2;
9296
+ if (typeof value === "string") {
9297
+ value = parseFloat(value);
9298
+ }
9299
+ return value && !isNaN(value) ? /*#__PURE__*/React.createElement("span", null, value.toFixed(decimals)) : "";
9300
+ }
9301
+ };
9302
+
9303
+ /**
9304
+ * Enhanced String Cell Viewer
9305
+ */
9306
+ var StringCellViewer2 = function StringCellViewer2(_ref11) {
9307
+ var id = _ref11.id,
9308
+ value = _ref11.value,
9309
+ format = _ref11.format,
9310
+ options = _ref11.options,
9311
+ action = _ref11.action;
9312
+ function buildOptions() {
9313
+ var opts = typeof options === 'function' ? options() : options;
9314
+ return opts;
9315
+ }
9316
+ function onClick() {
9317
+ if (action) action(id, value, format, options);
9318
+ }
9319
+ var option = options ? buildOptions().find(function (o) {
9320
+ return o.value === value;
9321
+ }) : null;
9322
+ var text = option ? option.label : value;
9323
+ var className = option ? option.className : '';
9324
+ var locale = window.navigator.userLanguage || window.navigator.language;
9325
+ switch (format) {
9326
+ case FORMATS$1.TOKENS:
9327
+ text = value && Array.isArray(value) ? value.join(", ") : value;
9328
+ break;
9329
+ case FORMATS$1.COLOR:
9330
+ text = /*#__PURE__*/React.createElement("input", {
9331
+ type: "color",
9332
+ value: text,
9333
+ disabled: true
9334
+ });
9335
+ break;
9336
+ case FORMATS$1.URL:
9337
+ text = /*#__PURE__*/React.createElement("a", {
9338
+ href: text,
9339
+ target: "download",
9340
+ download: true
9341
+ }, text);
9342
+ break;
9343
+ case FORMATS$1.IMG:
9344
+ text = /*#__PURE__*/React.createElement("img", {
9345
+ src: text,
9346
+ onClick: onClick,
9347
+ alt: ""
9348
+ });
9349
+ break;
9350
+ case FORMATS$1.DATE:
9351
+ var fecha = new Date(text);
9352
+ fecha.setMinutes(fecha.getMinutes() + fecha.getTimezoneOffset() + 1);
9353
+ text = fecha.toLocaleString(locale, {
9354
+ day: 'numeric',
9355
+ month: 'numeric',
9356
+ year: 'numeric'
9357
+ });
9358
+ break;
9359
+ case FORMATS$1.TIME:
9360
+ text = new Date(text).toLocaleString(locale, {
9361
+ hour: 'numeric',
9362
+ minute: 'numeric',
9363
+ second: 'numeric'
9364
+ });
9365
+ break;
9366
+ case FORMATS$1.DATETIME:
9367
+ text = new Date(text).toLocaleString(locale, {
9368
+ year: 'numeric',
9369
+ month: 'numeric',
9370
+ day: 'numeric',
9371
+ hour: 'numeric',
9372
+ minute: 'numeric',
9373
+ second: 'numeric'
9374
+ });
9375
+ break;
9376
+ }
9377
+ return /*#__PURE__*/React.createElement("div", {
9378
+ className: "field-editor string-viewer " + className,
9379
+ title: text
9380
+ }, text);
9381
+ };
9382
+
9383
+ /**
9384
+ * Enhanced String Cell Editor
9385
+ */
9386
+ var StringCellEditor2 = function StringCellEditor2(_ref12) {
9387
+ var id = _ref12.id,
9388
+ _ref12$value = _ref12.value,
9389
+ value = _ref12$value === void 0 ? '' : _ref12$value,
9390
+ options = _ref12.options,
9391
+ onChange = _ref12.onChange;
9392
+ function change(id, value) {
9393
+ if (onChange) onChange(id, value);
9394
+ }
9395
+ return /*#__PURE__*/React.createElement("div", {
9396
+ className: "field-editor string-editor"
9397
+ }, options ? /*#__PURE__*/React.createElement(DropDown2, {
9398
+ outlined: true,
9399
+ id: id,
9400
+ value: value,
9401
+ onChange: change,
9402
+ options: options
9403
+ }) : /*#__PURE__*/React.createElement(TextField2, {
9404
+ outlined: true,
9405
+ id: id,
9406
+ value: value,
9407
+ onChange: change
9408
+ }));
9409
+ };
9410
+
9411
+ /**
9412
+ * Skeleton loading table
9413
+ */
9414
+ var SkeletonTable = function SkeletonTable(_ref13) {
9415
+ var columns = _ref13.columns,
9416
+ rows = _ref13.rows;
9417
+ return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, columns.map(function (col) {
9418
+ return /*#__PURE__*/React.createElement("th", {
9419
+ key: col.id
9420
+ }, /*#__PURE__*/React.createElement("div", {
9421
+ className: "skeleton-text skeleton-text--header"
9422
+ }));
9423
+ }))), /*#__PURE__*/React.createElement("tbody", null, Array.from({
9424
+ length: rows
9425
+ }, function (_, i) {
9426
+ return /*#__PURE__*/React.createElement("tr", {
9427
+ key: i
9428
+ }, columns.map(function (col) {
9429
+ return /*#__PURE__*/React.createElement("td", {
9430
+ key: col.id
9431
+ }, /*#__PURE__*/React.createElement("div", {
9432
+ className: "skeleton-text"
9433
+ }));
9434
+ }));
9435
+ })));
9436
+ };
9437
+
9438
+ // PropTypes for DataTable2
9439
+ DataTable2.propTypes = {
9440
+ // Original props (100% compatible)
9441
+ /** Array of column definitions */
9442
+ columns: PropTypes.arrayOf(PropTypes.shape({
9443
+ id: PropTypes.string.isRequired,
9444
+ label: PropTypes.string,
9445
+ type: PropTypes.string,
9446
+ sortable: PropTypes.bool,
9447
+ filterable: PropTypes.bool,
9448
+ resizable: PropTypes.bool,
9449
+ editable: PropTypes.bool,
9450
+ format: PropTypes.string,
9451
+ options: PropTypes.array,
9452
+ onChange: PropTypes.func,
9453
+ onFilter: PropTypes.func,
9454
+ action: PropTypes.func,
9455
+ disabled: PropTypes.bool,
9456
+ min: PropTypes.number,
9457
+ max: PropTypes.number,
9458
+ maxDecimals: PropTypes.number,
9459
+ predictive: PropTypes.bool,
9460
+ item: PropTypes.object,
9461
+ uploadURL: PropTypes.string
9462
+ })),
9463
+ /** Array of row data */
9464
+ rows: PropTypes.arrayOf(PropTypes.shape({
9465
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
9466
+ selected: PropTypes.bool,
9467
+ className: PropTypes.string,
9468
+ checkDisabled: PropTypes.bool,
9469
+ disabled: PropTypes.bool,
9470
+ info: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
9471
+ })),
9472
+ /** Row selection callback */
9473
+ onRowSelection: PropTypes.func,
9474
+ /** Sort callback */
9475
+ onSort: PropTypes.func,
9476
+ /** Check all callback */
9477
+ onCheckAll: PropTypes.func,
9478
+ /** Enable editing */
9479
+ editable: PropTypes.bool,
9480
+ /** Outlined style */
9481
+ outlined: PropTypes.bool,
9482
+ /** Expand rows by default */
9483
+ expanded: PropTypes.bool,
9484
+ /** Additional CSS classes */
9485
+ className: PropTypes.string,
9486
+ /** Empty state message */
9487
+ emptyMessage: PropTypes.string,
9488
+ /** Empty state icon */
9489
+ emptyIcon: PropTypes.string,
9490
+ /** Enable multi-sort */
9491
+ multisort: PropTypes.bool,
9492
+ /** Enable filtering */
9493
+ filterable: PropTypes.bool,
9494
+ /** Clear filters callback */
9495
+ onClearFilters: PropTypes.func,
9496
+ // New enhanced props (all optional for compatibility)
9497
+ /** Loading state */
9498
+ loading: PropTypes.bool,
9499
+ /** Skeleton placeholder */
9500
+ skeleton: PropTypes.bool,
9501
+ /** Striped rows */
9502
+ striped: PropTypes.bool,
9503
+ /** Hover effects */
9504
+ hover: PropTypes.bool,
9505
+ /** Compact layout */
9506
+ compact: PropTypes.bool,
9507
+ /** Bordered table */
9508
+ bordered: PropTypes.bool,
9509
+ /** Responsive design */
9510
+ responsive: PropTypes.bool,
9511
+ /** Sticky header */
9512
+ stickyHeader: PropTypes.bool,
9513
+ /** Virtual scrolling */
9514
+ virtualScrolling: PropTypes.bool,
9515
+ /** Page size for virtual scrolling */
9516
+ pageSize: PropTypes.number,
9517
+ /** Selection mode */
9518
+ selectionMode: PropTypes.oneOf(['single', 'multiple', 'none']),
9519
+ /** Sort mode */
9520
+ sortMode: PropTypes.oneOf(['single', 'multiple', 'none']),
9521
+ /** Resizable columns */
9522
+ resizable: PropTypes.bool,
9523
+ /** Reorderable columns */
9524
+ reorderable: PropTypes.bool,
9525
+ /** Export functionality */
9526
+ exportable: PropTypes.bool,
9527
+ /** Search functionality */
9528
+ searchable: PropTypes.bool,
9529
+ /** Search placeholder */
9530
+ searchPlaceholder: PropTypes.string,
9531
+ /** Search callback */
9532
+ onSearch: PropTypes.func,
9533
+ /** Export callback */
9534
+ onExport: PropTypes.func,
9535
+ /** Column resize callback */
9536
+ onColumnResize: PropTypes.func,
9537
+ /** Column reorder callback */
9538
+ onColumnReorder: PropTypes.func,
9539
+ /** Custom empty state */
9540
+ customEmptyState: PropTypes.node,
9541
+ /** Row height */
9542
+ rowHeight: PropTypes.oneOf(['small', 'medium', 'large']),
9543
+ /** Table density */
9544
+ density: PropTypes.oneOf(['compact', 'normal', 'comfortable']),
9545
+ /** Theme */
9546
+ theme: PropTypes.oneOf(['default', 'dark', 'minimal']),
9547
+ /** Accessibility features */
9548
+ accessibility: PropTypes.bool,
9549
+ /** Row click callback */
9550
+ onRowClick: PropTypes.func,
9551
+ /** Row double click callback */
9552
+ onRowDoubleClick: PropTypes.func,
9553
+ /** Row context menu callback */
9554
+ onRowContextMenu: PropTypes.func,
9555
+ /** Cell click callback */
9556
+ onCellClick: PropTypes.func,
9557
+ /** Cell double click callback */
9558
+ onCellDoubleClick: PropTypes.func,
9559
+ /** Cell edit callback */
9560
+ onCellEdit: PropTypes.func,
9561
+ /** Row class name function */
9562
+ rowClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
9563
+ /** Cell class name function */
9564
+ cellClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
9565
+ /** Header class name */
9566
+ headerClassName: PropTypes.string,
9567
+ /** Footer content */
9568
+ footerContent: PropTypes.node,
9569
+ /** Show row numbers */
9570
+ showRowNumbers: PropTypes.bool,
9571
+ /** Show select all checkbox */
9572
+ showSelectAll: PropTypes.bool,
9573
+ /** Persist table state */
9574
+ persistState: PropTypes.bool,
9575
+ /** State key for persistence */
9576
+ stateKey: PropTypes.string,
9577
+ /** State change callback */
9578
+ onStateChange: PropTypes.func
9579
+ };
9580
+ DataTable2.defaultProps = {
9581
+ columns: [],
9582
+ rows: [],
9583
+ expanded: false,
9584
+ emptyMessage: "No Results Found",
9585
+ emptyIcon: "search_off",
9586
+ multisort: false,
9587
+ filterable: false,
9588
+ loading: false,
9589
+ skeleton: false,
9590
+ striped: false,
9591
+ hover: true,
9592
+ compact: false,
9593
+ bordered: false,
9594
+ responsive: true,
9595
+ stickyHeader: true,
9596
+ virtualScrolling: false,
9597
+ pageSize: 50,
9598
+ selectionMode: 'single',
9599
+ sortMode: 'single',
9600
+ resizable: false,
9601
+ reorderable: false,
9602
+ exportable: false,
9603
+ searchable: false,
9604
+ searchPlaceholder: "Search...",
9605
+ rowHeight: 'medium',
9606
+ density: 'normal',
9607
+ theme: 'default',
9608
+ accessibility: true,
9609
+ showRowNumbers: false,
9610
+ showSelectAll: true,
9611
+ persistState: false
9612
+ };
9613
+
9614
+ var _excluded$5 = ["id", "label", "tokens", "readOnly", "options", "predictive", "onChange", "disabled", "required", "placeholder", "maxTokens", "minTokens", "allowDuplicates", "validateToken", "tokenSeparators", "size", "variant", "error", "helperText", "onFocus", "onBlur", "onTokenAdd", "onTokenRemove", "onValidationError", "clearable", "onClear", "searchable", "sortable", "className", "style"],
9615
+ _excluded2$2 = ["text", "onDelete", "disabled", "error", "size", "variant", "icon", "className", "style"];
9616
+
9617
+ /**
9618
+ * Enhanced Token Field component with improved functionality while maintaining 100% compatibility
9619
+ */
9620
+ var TokenField = function TokenField(props) {
9621
+ var id = props.id,
9622
+ label = props.label,
9623
+ _props$tokens = props.tokens,
9624
+ tokens = _props$tokens === void 0 ? [] : _props$tokens,
9625
+ readOnly = props.readOnly,
9626
+ options = props.options,
9627
+ _props$predictive = props.predictive,
9628
+ predictive = _props$predictive === void 0 ? true : _props$predictive,
9629
+ onChange = props.onChange,
9630
+ _props$disabled = props.disabled,
9631
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
9632
+ _props$required = props.required,
9633
+ required = _props$required === void 0 ? false : _props$required,
9634
+ _props$placeholder = props.placeholder,
9635
+ placeholder = _props$placeholder === void 0 ? "Add token..." : _props$placeholder,
9636
+ maxTokens = props.maxTokens,
9637
+ _props$minTokens = props.minTokens,
9638
+ minTokens = _props$minTokens === void 0 ? 0 : _props$minTokens,
9639
+ _props$allowDuplicate = props.allowDuplicates,
9640
+ allowDuplicates = _props$allowDuplicate === void 0 ? true : _props$allowDuplicate,
9641
+ validateToken = props.validateToken,
9642
+ _props$tokenSeparator = props.tokenSeparators,
9643
+ tokenSeparators = _props$tokenSeparator === void 0 ? [',', ';', '\n'] : _props$tokenSeparator,
9644
+ _props$size = props.size,
9645
+ size = _props$size === void 0 ? 'medium' : _props$size,
9646
+ _props$variant = props.variant,
9647
+ variant = _props$variant === void 0 ? 'default' : _props$variant,
9648
+ error = props.error,
9649
+ helperText = props.helperText,
9650
+ onFocus = props.onFocus,
9651
+ onBlur = props.onBlur,
9652
+ onTokenAdd = props.onTokenAdd,
9653
+ onTokenRemove = props.onTokenRemove,
9654
+ onValidationError = props.onValidationError,
9655
+ _props$clearable = props.clearable,
9656
+ clearable = _props$clearable === void 0 ? false : _props$clearable,
9657
+ onClear = props.onClear,
9658
+ _props$searchable = props.searchable,
9659
+ searchable = _props$searchable === void 0 ? false : _props$searchable,
9660
+ _props$sortable = props.sortable,
9661
+ sortable = _props$sortable === void 0 ? false : _props$sortable,
9662
+ className = props.className,
9663
+ style = props.style,
9664
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$5);
9665
+ var _useState = useState(''),
9666
+ value = _useState[0],
9667
+ setValue = _useState[1];
9668
+ var _useState2 = useState(false),
9669
+ isFocused = _useState2[0],
9670
+ setIsFocused = _useState2[1];
9671
+ var _useState3 = useState({}),
9672
+ validationErrors = _useState3[0],
9673
+ setValidationErrors = _useState3[1];
9674
+ var inputRef = useRef(null);
9675
+ var containerRef = useRef(null);
9676
+
9677
+ // Validate props
9678
+ useEffect(function () {
9679
+ if (!Array.isArray(tokens)) {
9680
+ console.warn('TokenField: tokens prop must be an array');
9681
+ }
9682
+ if (maxTokens && tokens.length > maxTokens) {
9683
+ console.warn("TokenField: tokens count (" + tokens.length + ") exceeds maxTokens (" + maxTokens + ")");
9684
+ }
9685
+ if (minTokens && tokens.length < minTokens) {
9686
+ console.warn("TokenField: tokens count (" + tokens.length + ") is below minTokens (" + minTokens + ")");
9687
+ }
9688
+ }, [tokens, maxTokens, minTokens]);
9689
+
9690
+ // Enhanced remove function (maintaining original behavior)
9691
+ var remove = useCallback(function (index) {
9692
+ if (disabled || readOnly) return;
9693
+ var next = tokens.slice();
9694
+ var removedToken = next.splice(index, 1)[0];
9695
+
9696
+ // Check minimum tokens
9697
+ if (minTokens && next.length < minTokens) {
9698
+ console.warn("TokenField: Cannot remove token. Minimum " + minTokens + " tokens required.");
9699
+ return;
9700
+ }
9701
+ if (onChange) onChange(id, next);
9702
+ if (onTokenRemove) onTokenRemove(removedToken, index);
9703
+ }, [disabled, readOnly, tokens, minTokens, id, onChange, onTokenRemove]);
9704
+
9705
+ // Enhanced change function (maintaining original behavior)
9706
+ var change = useCallback(function (event) {
9707
+ if (disabled || readOnly) return;
9708
+ var newValue = event.target.value;
9709
+ setValue(newValue);
9710
+ }, [disabled, readOnly]);
9711
+
9712
+ // Validate token
9713
+ var validateTokenValue = useCallback(function (tokenValue) {
9714
+ if (!tokenValue || typeof tokenValue === 'string' && tokenValue.trim() === '') {
9715
+ return {
9716
+ isValid: false,
9717
+ error: 'Token cannot be empty'
9718
+ };
9719
+ }
9720
+
9721
+ // Check duplicates
9722
+ if (!allowDuplicates && tokens.includes(tokenValue)) {
9723
+ return {
9724
+ isValid: false,
9725
+ error: 'Duplicate token not allowed'
9726
+ };
9727
+ }
9728
+
9729
+ // Check max tokens
9730
+ if (maxTokens && tokens.length >= maxTokens) {
9731
+ return {
9732
+ isValid: false,
9733
+ error: "Maximum " + maxTokens + " tokens allowed"
9734
+ };
9735
+ }
9736
+
9737
+ // Custom validation
9738
+ if (validateToken) {
9739
+ var customValidation = validateToken(tokenValue, tokens);
9740
+ if (customValidation && !customValidation.isValid) {
9741
+ return customValidation;
9742
+ }
9743
+ }
9744
+ return {
9745
+ isValid: true
9746
+ };
9747
+ }, [allowDuplicates, tokens, maxTokens, validateToken]);
7118
9748
 
7119
9749
  // Add token helper
7120
9750
  var addToken = useCallback(function (tokenValue) {
@@ -7630,7 +10260,7 @@ var Tree = function Tree(props) {
7630
10260
  className: "tree__loading"
7631
10261
  }, /*#__PURE__*/React.createElement(Icon, {
7632
10262
  icon: "hourglass_empty",
7633
- size: "medium"
10263
+ size: "normal"
7634
10264
  }), /*#__PURE__*/React.createElement(Text, null, "Loading...")));
7635
10265
  }
7636
10266
 
@@ -7680,7 +10310,7 @@ var Tree = function Tree(props) {
7680
10310
  icon: "unfold_more",
7681
10311
  size: "small"
7682
10312
  }), /*#__PURE__*/React.createElement(Text, {
7683
- size: "small"
10313
+ size: "sm"
7684
10314
  }, "Expand All")), collapseAll && /*#__PURE__*/React.createElement("button", {
7685
10315
  className: "tree__control-button",
7686
10316
  onClick: handleCollapseAll,
@@ -7689,7 +10319,7 @@ var Tree = function Tree(props) {
7689
10319
  icon: "unfold_less",
7690
10320
  size: "small"
7691
10321
  }), /*#__PURE__*/React.createElement(Text, {
7692
- size: "small"
10322
+ size: "sm"
7693
10323
  }, "Collapse All"))), /*#__PURE__*/React.createElement("div", {
7694
10324
  className: "tree__content"
7695
10325
  }, nodes, children));
@@ -7859,7 +10489,9 @@ var TreeNode = function TreeNode(props) {
7859
10489
  })), /*#__PURE__*/React.createElement("div", {
7860
10490
  className: "label " + clickable,
7861
10491
  onClick: handleSelect
7862
- }, labelTxt, badge && /*#__PURE__*/React.createElement("span", {
10492
+ }, /*#__PURE__*/React.createElement("span", {
10493
+ className: "tree-node__label-text"
10494
+ }, labelTxt), badge && /*#__PURE__*/React.createElement("span", {
7863
10495
  className: "tree-node__badge"
7864
10496
  }, typeof badge === 'number' && badge > 99 ? '99+' : badge)), actions && /*#__PURE__*/React.createElement("div", {
7865
10497
  className: "actions"
@@ -19166,5 +21798,5 @@ var isFunction = function isFunction(value) {
19166
21798
  return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
19167
21799
  };
19168
21800
 
19169
- export { Accordion, ActionButton, Avatar, Button, Calendar, ChangeUserPasswordAction, ChangeUserPasswordDialog, CheckBox, Chip, Chips, CircularProgress, CollectionAPI$1 as CollectionAPI, CollectionAPI as CollectionAPI2, CollectionContext$1 as CollectionContext, CollectionContext as CollectionContext2, CollectionEditor$2 as CollectionEditor, CollectionFilters$1 as CollectionFilters, CollectionPage$1 as CollectionPage, CollectionPage as CollectionPage2, CollectionTree, ColorField, Content, ContentEditor, ContentForm, ContentViewer, CreateContentDialog, DataTable, DateRange, Dialog, DropDown, DynamicForm, EditContentDialog, EmptyMessage, FORMATS$1 as FORMATS, FieldEditor, FileExplorer, FileExplorerView, FileGridItem, FilesGridView, FilesSearchBox, FilesTableView, _FoldersTreeView as FoldersTreeView, ForgetUserPasswordAction, Form, HTTPClient, Header, Icon, ImageViewer, Kanban, KanbanCard, KanbanColumn, KanbanHeader, KanbanSwimlane, LOGIN_API, LOGIN_CONTEXT, LOGIN_DICTIONARY, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, MonthCalendar, MultiSelector, Page, PageContext, PageLink, PageProvider, PasswordEditor, PasswordField, Planner, Planner2, Property, RadioButton, RadioGroup, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, Switch2, TASK_STATES, TEXTFORMATS, TYPES$1 as TYPES, Tab, TabbedContentEditor, TabbedTablePage, TabbedView, TableEditor$2 as TableEditor, TablePage, TablePage2, Tabs, TaskContext, TaskContextProvider, TaskMonitor, TaskProgress, Text, TextArea, TextField, Thumbnail, ToggleButton, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UnlockUserAction, UploadArea, UploadDialog, UploadFile$1 as UploadFile, UploadForm, UploadIcon, Uploader, View, Viewer, WaitScreen, Wizard, WizardContext, isEmpty, isFunction, useHashPage, validatePassword };
21801
+ export { Accordion, ActionButton, Avatar, Button, Calendar, ChangeUserPasswordAction, ChangeUserPasswordDialog, CheckBox, Chip, Chips, CircularProgress, CollectionAPI$1 as CollectionAPI, CollectionAPI as CollectionAPI2, CollectionContext$1 as CollectionContext, CollectionContext as CollectionContext2, CollectionEditor$2 as CollectionEditor, CollectionFilters$1 as CollectionFilters, CollectionPage$1 as CollectionPage, CollectionPage as CollectionPage2, CollectionTree, ColorField, Content, ContentEditor, ContentForm, ContentViewer, CreateContentDialog, DataTable, DataTable2, DateRange, DateRange2, Dialog, DropDown, DropDown2, DynamicForm, EditContentDialog, EmptyMessage, FORMATS$1 as FORMATS, FieldEditor, FileExplorer, FileExplorerView, FileGridItem, FilesGridView, FilesSearchBox, FilesTableView, _FoldersTreeView as FoldersTreeView, ForgetUserPasswordAction, Form, HTTPClient, Header, Header2, Icon, ImageViewer, Kanban, KanbanCard, KanbanColumn, KanbanHeader, KanbanSwimlane, LOGIN_API, LOGIN_CONTEXT, LOGIN_DICTIONARY, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, MonthCalendar, MultiSelector, Page, PageContext, PageLink, PageProvider, PasswordEditor, PasswordField, PasswordField2, Planner, Planner2, Property, RadioButton, RadioGroup, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, Switch2, TASK_STATES, TEXTFORMATS, TYPES$1 as TYPES, Tab, TabbedContentEditor, TabbedTablePage, TabbedView, TableEditor$2 as TableEditor, TablePage, TablePage2, Tabs, TaskContext, TaskContextProvider, TaskMonitor, TaskProgress, Text, TextArea, TextArea2, TextField, TextField2, Thumbnail, ToggleButton, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UnlockUserAction, UploadArea, UploadDialog, UploadFile$1 as UploadFile, UploadForm, UploadIcon, Uploader, View, Viewer, WaitScreen, Wizard, WizardContext, isEmpty, isFunction, useHashPage, validatePassword };
19170
21802
  //# sourceMappingURL=index.modern.js.map