@nubitio/ui 1.2.2 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -692,7 +692,7 @@ function FileDropzone({ accept, value = null, image = false, disabled = false, r
692
692
  }
693
693
  //#endregion
694
694
  //#region packages/ui/AppDropdown.tsx
695
- function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onChange, disabled = false, placeholder = "Seleccionar…", variant = "form", className, showFieldLabel = variant === "form", menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange }) {
695
+ function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onChange, disabled = false, placeholder = "Seleccionar…", variant = "form", className, showFieldLabel = variant === "form", menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange, triggerIcon }) {
696
696
  const generatedId = (0, react.useId)();
697
697
  const id = idProp ?? generatedId;
698
698
  const container = useOverlayContainer();
@@ -700,6 +700,7 @@ function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onCha
700
700
  const selected = options.find((option) => option.value === value);
701
701
  const labelled = !!label && (showFieldLabel || variant === "toolbar");
702
702
  const message = error ?? helpText;
703
+ const triggerIconClass = triggerIcon?.startsWith("ph ") ? triggerIcon : triggerIcon?.startsWith("ph-") ? `ph ${triggerIcon}` : `ph ph-${triggerIcon}`;
703
704
  const iconClass = icon?.startsWith("ph ") ? icon : icon?.startsWith("ph-") ? `ph ${icon}` : `ph ph-${icon}`;
704
705
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Root, {
705
706
  value,
@@ -751,17 +752,25 @@ function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onCha
751
752
  }
752
753
  },
753
754
  "aria-label": ariaLabel,
755
+ title: triggerIcon ? ariaLabel ?? selected?.label : void 0,
754
756
  "aria-labelledby": ariaLabel ? void 0 : labelled ? `${id}-label ${id}-value` : `${id}-value`,
755
757
  "aria-describedby": message ? `${id}-message` : void 0,
756
758
  "aria-invalid": !!error || void 0,
757
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
758
- className: "nb-dropdown__value",
759
- id: `${id}-value`,
760
- children: selected?.selectedLabel ?? selected?.label ?? placeholder
761
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {
762
- className: "ph ph-caret-down nb-dropdown__caret",
763
- "aria-hidden": "true"
764
- })]
759
+ children: [
760
+ triggerIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {
761
+ className: `${triggerIconClass} nb-dropdown__trigger-icon`,
762
+ "aria-hidden": "true"
763
+ }),
764
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
765
+ className: `nb-dropdown__value${triggerIcon ? " nb-sr-only" : ""}`,
766
+ id: `${id}-value`,
767
+ children: selected?.selectedLabel ?? selected?.label ?? placeholder
768
+ }),
769
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {
770
+ className: "ph ph-caret-down nb-dropdown__caret",
771
+ "aria-hidden": "true"
772
+ })
773
+ ]
765
774
  }),
766
775
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Portal, {
767
776
  container: container ?? void 0,
package/dist/index.d.cts CHANGED
@@ -200,8 +200,13 @@ interface AppDropdownProps {
200
200
  menuHeader?: ReactNode;
201
201
  menuFooter?: ReactNode;
202
202
  onOpenChange?: (open: boolean) => void;
203
+ /**
204
+ * Renders the trigger as this icon alone. The selected label stays available to assistive
205
+ * technology and as the tooltip, so the current choice is never icon-only.
206
+ */
207
+ triggerIcon?: string;
203
208
  }
204
- declare function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onChange, disabled, placeholder, variant, className, showFieldLabel, menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange }: AppDropdownProps): import("react").JSX.Element;
209
+ declare function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onChange, disabled, placeholder, variant, className, showFieldLabel, menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange, triggerIcon }: AppDropdownProps): import("react").JSX.Element;
205
210
  //#endregion
206
211
  //#region packages/ui/SearchableAppDropdown.d.ts
207
212
  interface SearchableAppDropdownProps extends Omit<AppDropdownProps, 'options'> {
package/dist/index.d.mts CHANGED
@@ -200,8 +200,13 @@ interface AppDropdownProps {
200
200
  menuHeader?: ReactNode;
201
201
  menuFooter?: ReactNode;
202
202
  onOpenChange?: (open: boolean) => void;
203
+ /**
204
+ * Renders the trigger as this icon alone. The selected label stays available to assistive
205
+ * technology and as the tooltip, so the current choice is never icon-only.
206
+ */
207
+ triggerIcon?: string;
203
208
  }
204
- declare function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onChange, disabled, placeholder, variant, className, showFieldLabel, menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange }: AppDropdownProps): import("react").JSX.Element;
209
+ declare function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onChange, disabled, placeholder, variant, className, showFieldLabel, menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange, triggerIcon }: AppDropdownProps): import("react").JSX.Element;
205
210
  //#endregion
206
211
  //#region packages/ui/SearchableAppDropdown.d.ts
207
212
  interface SearchableAppDropdownProps extends Omit<AppDropdownProps, 'options'> {
package/dist/index.mjs CHANGED
@@ -668,7 +668,7 @@ function FileDropzone({ accept, value = null, image = false, disabled = false, r
668
668
  }
669
669
  //#endregion
670
670
  //#region packages/ui/AppDropdown.tsx
671
- function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onChange, disabled = false, placeholder = "Seleccionar…", variant = "form", className, showFieldLabel = variant === "form", menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange }) {
671
+ function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onChange, disabled = false, placeholder = "Seleccionar…", variant = "form", className, showFieldLabel = variant === "form", menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange, triggerIcon }) {
672
672
  const generatedId = useId();
673
673
  const id = idProp ?? generatedId;
674
674
  const container = useOverlayContainer();
@@ -676,6 +676,7 @@ function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onCha
676
676
  const selected = options.find((option) => option.value === value);
677
677
  const labelled = !!label && (showFieldLabel || variant === "toolbar");
678
678
  const message = error ?? helpText;
679
+ const triggerIconClass = triggerIcon?.startsWith("ph ") ? triggerIcon : triggerIcon?.startsWith("ph-") ? `ph ${triggerIcon}` : `ph ph-${triggerIcon}`;
679
680
  const iconClass = icon?.startsWith("ph ") ? icon : icon?.startsWith("ph-") ? `ph ${icon}` : `ph ph-${icon}`;
680
681
  return /* @__PURE__ */ jsx(Select.Root, {
681
682
  value,
@@ -727,17 +728,25 @@ function AppDropdown({ id: idProp, ariaLabel, label, icon, value, options, onCha
727
728
  }
728
729
  },
729
730
  "aria-label": ariaLabel,
731
+ title: triggerIcon ? ariaLabel ?? selected?.label : void 0,
730
732
  "aria-labelledby": ariaLabel ? void 0 : labelled ? `${id}-label ${id}-value` : `${id}-value`,
731
733
  "aria-describedby": message ? `${id}-message` : void 0,
732
734
  "aria-invalid": !!error || void 0,
733
- children: [/* @__PURE__ */ jsx("span", {
734
- className: "nb-dropdown__value",
735
- id: `${id}-value`,
736
- children: selected?.selectedLabel ?? selected?.label ?? placeholder
737
- }), /* @__PURE__ */ jsx("i", {
738
- className: "ph ph-caret-down nb-dropdown__caret",
739
- "aria-hidden": "true"
740
- })]
735
+ children: [
736
+ triggerIcon && /* @__PURE__ */ jsx("i", {
737
+ className: `${triggerIconClass} nb-dropdown__trigger-icon`,
738
+ "aria-hidden": "true"
739
+ }),
740
+ /* @__PURE__ */ jsx("span", {
741
+ className: `nb-dropdown__value${triggerIcon ? " nb-sr-only" : ""}`,
742
+ id: `${id}-value`,
743
+ children: selected?.selectedLabel ?? selected?.label ?? placeholder
744
+ }),
745
+ /* @__PURE__ */ jsx("i", {
746
+ className: "ph ph-caret-down nb-dropdown__caret",
747
+ "aria-hidden": "true"
748
+ })
749
+ ]
741
750
  }),
742
751
  /* @__PURE__ */ jsx(Select.Portal, {
743
752
  container: container ?? void 0,
package/dist/style.css CHANGED
@@ -494,7 +494,7 @@ samp {
494
494
  .nb-button--sm {
495
495
  font-size: var(--font-size-xs);
496
496
  letter-spacing: 0;
497
- min-height: 22px;
497
+ min-height: 24px;
498
498
  padding: 0 var(--space-2);
499
499
  }
500
500
 
@@ -634,6 +634,8 @@ samp {
634
634
  align-items: center;
635
635
  background: var(--surface-1);
636
636
  border-bottom: 1px solid var(--border-subtle);
637
+ border-top-left-radius: calc(var(--radius-lg) - 1px);
638
+ border-top-right-radius: calc(var(--radius-lg) - 1px);
637
639
  display: flex;
638
640
  flex: 0 0 auto;
639
641
  gap: var(--space-2);
@@ -1419,6 +1421,16 @@ html[data-density=compact] .nb-dialog__footer {
1419
1421
  display: inline-flex;
1420
1422
  flex-shrink: 0;
1421
1423
  }
1424
+
1425
+ .nb-dropdown__value.nb-sr-only {
1426
+ border: 0;
1427
+ clip-path: inset(50%);
1428
+ height: 1px;
1429
+ overflow: hidden;
1430
+ position: absolute;
1431
+ white-space: nowrap;
1432
+ width: 1px;
1433
+ }
1422
1434
  .nb-combobox {
1423
1435
  --nb-combobox-action-size: calc(var(--control-height-form) - 8px);
1424
1436
  --nb-combobox-action-count: 1;
@@ -1963,6 +1975,7 @@ html[data-density=compact] .nb-badge--sm {
1963
1975
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
1964
1976
  }
1965
1977
  .nb-chip--sm {
1978
+ min-height: 24px;
1966
1979
  padding: 0.2rem 0.6rem;
1967
1980
  font-size: var(--font-size-xs);
1968
1981
  gap: 0.25rem;
@@ -3094,6 +3107,8 @@ html[data-density=compact] .nb-date-range-picker__panel {
3094
3107
  font-size: 1rem;
3095
3108
  height: var(--control-icon-size, 20px);
3096
3109
  justify-content: center;
3110
+ min-height: 24px;
3111
+ min-width: 24px;
3097
3112
  padding: 0 2px;
3098
3113
  transition: color var(--transition-fast);
3099
3114
  user-select: none;
@@ -3288,6 +3303,8 @@ html[data-density=compact] .nb-date-range-picker__panel {
3288
3303
  font-size: 1rem;
3289
3304
  height: var(--control-icon-size, 20px);
3290
3305
  justify-content: center;
3306
+ min-height: 24px;
3307
+ min-width: 24px;
3291
3308
  padding: 0 2px;
3292
3309
  transition: color var(--transition-fast);
3293
3310
  user-select: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nubitio/ui",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "description": "Visual primitives and theme system for the Nubit admin stack (dialogs, cards, toolbar, light/dark theme).",
6
6
  "license": "MIT",