nexaas-ui-components 1.0.76 → 1.0.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.
package/dist/index.cjs CHANGED
@@ -192,7 +192,7 @@ var Button = ({
192
192
  React5.useEffect(() => {
193
193
  if (!hotkey || !props.onClick) return;
194
194
  const handleKeyDown = (event) => {
195
- var _a;
195
+ var _a, _b;
196
196
  if (props.disabled || props.loading) return;
197
197
  const keys = hotkey.toLowerCase().split("+").map((k) => k.trim());
198
198
  const primaryKey = keys.pop();
@@ -201,10 +201,17 @@ var Button = ({
201
201
  const requiredAlt = keys.includes("alt");
202
202
  const requiredShift = keys.includes("shift");
203
203
  const requiredMeta = keys.includes("meta") || keys.includes("cmd");
204
- const match = event.key.toLowerCase() === primaryKey && event.ctrlKey === requiredCtrl && event.altKey === requiredAlt && event.shiftKey === requiredShift && event.metaKey === requiredMeta;
204
+ const keyAliases = {
205
+ esc: "escape",
206
+ del: "delete",
207
+ space: " ",
208
+ spacebar: " "
209
+ };
210
+ const normalizedPrimary = (_a = keyAliases[primaryKey]) != null ? _a : primaryKey;
211
+ const match = event.key.toLowerCase() === normalizedPrimary && event.ctrlKey === requiredCtrl && event.altKey === requiredAlt && event.shiftKey === requiredShift && event.metaKey === requiredMeta;
205
212
  if (match) {
206
213
  event.preventDefault();
207
- (_a = props.onClick) == null ? void 0 : _a.call(props, event);
214
+ (_b = props.onClick) == null ? void 0 : _b.call(props, event);
208
215
  }
209
216
  };
210
217
  window.addEventListener("keydown", handleKeyDown);
@@ -494,7 +501,7 @@ var Input = ({
494
501
  const hasError = fieldValidationMessages.some((item) => item !== void 0);
495
502
  const [showPassword, setShowPassword] = React5__namespace.default.useState(false);
496
503
  const styles = {
497
- input: `text-p-md pl-2 peer text-paragraph bg-surface shadow-input border border-[0.5px] rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 disabled:text-disabled disabled:cursor-not-allowed focus-visible:ring-[1.5px] focus-visible:ring-blue-500 focus-visible:ring-offset-[2px] focus-visible:rounded-[2px] ${label ? "pt-[22px]" : "pt-[10px]"}
504
+ input: `text-p-md pl-2 peer text-paragraph bg-surface shadow-input border border-[0.5px] rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-[var(--input-bg-disabled)] disabled:border-[var(--input-border-disabled)] disabled:text-disabled disabled:cursor-not-allowed focus-visible:ring-[1.5px] focus-visible:ring-blue-500 focus-visible:ring-offset-[2px] focus-visible:rounded-[2px] ${label ? "pt-[22px]" : "pt-[10px]"}
498
505
  ${!hasError ? "border-neutral-300" : ""}`,
499
506
  icon: `absolute bg-neutral-100 h-[44px] top-[1px] left-[1.5px] w-[38px] rounded-l-lg text-[20px] ${hasError ? "text-dangerous-500" : "text-label peer-focus:text-blue-500"} peer-focus:border-blue-500`,
500
507
  rightIcon: "absolute h-[44px] top-[1px] right-[1.5px] w-[38px] text-[22px]",
@@ -1243,7 +1250,6 @@ var FilterCalendar = ({
1243
1250
  filterActive: "rounded-3xl border border-blue-500 text-blue-500 bg-blue-100 shadow-input hover:bg-blue-500 hover:text-accent-label active:text-accent-label active:bg-blue-600 active:border-blue-600"
1244
1251
  };
1245
1252
  const [currentValue, setCurrentValue] = React5.useState([]);
1246
- const [calendarLabel, setCalendarLabel] = React5.useState("");
1247
1253
  const isMobileSize = (window == null ? void 0 : window.innerWidth) < 768;
1248
1254
  const shorcuts = [
1249
1255
  {
@@ -1407,6 +1413,9 @@ var FilterCalendar = ({
1407
1413
  const [selectedShortcut, setSelectedShortcut] = React5.useState(
1408
1414
  defaultShortcut || shorcuts[0]
1409
1415
  );
1416
+ const [calendarLabel, setCalendarLabel] = React5.useState(
1417
+ defaultShortcut != null && shorcuts[defaultShortcut] ? shorcuts[defaultShortcut].label : ""
1418
+ );
1410
1419
  const calendar = /* @__PURE__ */ jsxRuntime.jsx("div", { id: "group-input-calendar", className: "relative", children: rangeCalendar ? /* @__PURE__ */ jsxRuntime.jsx(
1411
1420
  datetime2.DateRangePicker3,
1412
1421
  {
@@ -1472,7 +1481,7 @@ var FilterCalendar = ({
1472
1481
  control,
1473
1482
  render: ({ field }) => {
1474
1483
  var _a;
1475
- let hasValue = ((_a = field == null ? void 0 : field.value) == null ? void 0 : _a.length) > 0;
1484
+ let hasValue = ((_a = field == null ? void 0 : field.value) == null ? void 0 : _a.length) > 0 || !!calendarLabel && calendarLabel !== shorcuts[0].label;
1476
1485
  return /* @__PURE__ */ jsxRuntime.jsx(
1477
1486
  react.Popover,
1478
1487
  {
@@ -1499,9 +1508,9 @@ var FilterCalendar = ({
1499
1508
  "div",
1500
1509
  {
1501
1510
  className: clsx9__default.default({
1502
- ["text-label group-active:text-blue-500"]: !field.value && !open,
1503
- ["text-blue-500"]: open && !field.value,
1504
- ["text-blue-500 group-hover:text-accent-label group-active:text-accent-label"]: open && field.value
1511
+ ["text-label group-active:text-blue-500"]: !hasValue && !open,
1512
+ ["text-blue-500"]: open && !hasValue,
1513
+ ["text-blue-500 group-hover:text-accent-label group-active:text-accent-label"]: open && hasValue || !open && hasValue
1505
1514
  }),
1506
1515
  children: icon
1507
1516
  }
@@ -1511,9 +1520,9 @@ var FilterCalendar = ({
1511
1520
  {
1512
1521
  className: clsx9__default.default(
1513
1522
  {
1514
- [`${labelClassName != null ? labelClassName : "text-paragraph"} group-active:text-blue-500`]: !field.value && !open,
1515
- ["text-blue-500"]: open && !field.value,
1516
- ["text-blue-500 group-hover:text-accent-label group-active:text-accent-label"]: open && field.value
1523
+ [`${labelClassName != null ? labelClassName : "text-paragraph"} group-active:text-blue-500`]: !hasValue && !open,
1524
+ ["text-blue-500"]: open && !hasValue,
1525
+ ["text-blue-500 group-hover:text-accent-label group-active:text-accent-label"]: open && hasValue || !open && hasValue
1517
1526
  },
1518
1527
  "truncate cursor-pointer"
1519
1528
  ),
@@ -1527,9 +1536,9 @@ var FilterCalendar = ({
1527
1536
  {
1528
1537
  className: clsx9__default.default(
1529
1538
  {
1530
- ["text-label group-active:text-blue-500"]: !field.value && !open,
1531
- ["text-blue-500"]: open && !field.value,
1532
- ["text-blue-500 group-hover:text-accent-label group-active:text-accent-label"]: open && field.value
1539
+ ["text-label group-active:text-blue-500"]: !hasValue && !open,
1540
+ ["text-blue-500"]: open && !hasValue,
1541
+ ["text-blue-500 group-hover:text-accent-label group-active:text-accent-label"]: open && hasValue || !open && hasValue
1533
1542
  },
1534
1543
  "uil uil-angle-down text-[18px]"
1535
1544
  )
@@ -1694,6 +1703,7 @@ var FilterOptions = ({
1694
1703
  subFilters = [],
1695
1704
  emptyMessage,
1696
1705
  initialMessage,
1706
+ initialMessageClassName,
1697
1707
  applyOnClick = false,
1698
1708
  showFilter = false,
1699
1709
  renderOption,
@@ -1982,7 +1992,7 @@ var FilterOptions = ({
1982
1992
  "Carregando"
1983
1993
  ] }),
1984
1994
  (data == null ? void 0 : data.length) === 0 && (filter == null ? void 0 : filter.length) > 0 && !loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-label text-p-md", children: emptyMessage }) }),
1985
- initialMessage && (data == null ? void 0 : data.length) === 0 && (filter == null ? void 0 : filter.length) === 0 && !loading && (options == null ? void 0 : options.length) === 0 && !(currentValue == null ? void 0 : currentValue.id) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-label text-p-md", children: initialMessage }) }),
1995
+ initialMessage && (data == null ? void 0 : data.length) === 0 && (filter == null ? void 0 : filter.length) === 0 && !loading && (options == null ? void 0 : options.length) === 0 && !(currentValue == null ? void 0 : currentValue.id) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx9__default.default("py-4", initialMessageClassName), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-label text-p-md", children: initialMessage }) }),
1986
1996
  initialMessage && currentValue && (currentValue == null ? void 0 : currentValue.id) && (filter == null ? void 0 : filter.length) === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2", children: isMulti ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: currentValue == null ? void 0 : currentValue.map((option) => {
1987
1997
  let isSelected = isMulti ? currentValue && (currentValue == null ? void 0 : currentValue.length) > 0 && (currentValue == null ? void 0 : currentValue.some(
1988
1998
  (e) => e.id === option.id
@@ -3248,20 +3258,21 @@ var customStyles2 = {
3248
3258
  }),
3249
3259
  placeholder: (provided, state) => ({
3250
3260
  ...provided,
3251
- paddingLeft: state.selectProps.hasIcon ? "34px" : "0px"
3261
+ paddingLeft: state.selectProps.hasIcon ? "34px" : "0px",
3262
+ color: state.isDisabled ? "var(--input-placeholder-disabled)" : "var(--label)"
3252
3263
  }),
3253
3264
  control: (provided, state) => ({
3254
3265
  ...provided,
3255
3266
  cursor: "pointer",
3256
- border: state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--neutral-300)",
3267
+ border: state.isDisabled ? "0.5px solid var(--input-border-disabled)" : state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--neutral-300)",
3257
3268
  boxShadow: state.isFocused ? "0 0 0 2px var(--surface), 0 0 0 3.5px var(--blue-500)" : "none",
3258
3269
  outline: "none",
3259
3270
  borderRadius: state.isFocused ? "2px" : "0.5rem",
3260
3271
  placeholder: " ",
3261
3272
  height: "46px",
3262
- backgroundColor: state.isDisabled ? "var(--light-100)" : "var(--surface)",
3273
+ backgroundColor: state.isDisabled ? "var(--input-bg-disabled)" : "var(--surface)",
3263
3274
  ":hover": {
3264
- border: state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--neutral-300)"
3275
+ border: state.isDisabled ? "0.5px solid var(--input-border-disabled)" : state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--neutral-300)"
3265
3276
  }
3266
3277
  }),
3267
3278
  multiValue: (provided) => ({