@orianatech/pire 0.12.0 → 0.13.0

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.js CHANGED
@@ -677,124 +677,6 @@ import {
677
677
  Text as Text4,
678
678
  FieldError as FieldError3
679
679
  } from "react-aria-components";
680
- import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
681
- var norm = (o) => typeof o === "string" ? { value: o, label: o, isDisabled: false } : o;
682
- function Select({
683
- label,
684
- value,
685
- defaultValue,
686
- onChange,
687
- options = [],
688
- placeholder = "Select\u2026",
689
- description,
690
- errorMessage,
691
- size = "md",
692
- fullWidth = true,
693
- className,
694
- style,
695
- ...rest
696
- }) {
697
- const items = options.map(norm);
698
- return /* @__PURE__ */ jsxs12(
699
- AriaSelect,
700
- {
701
- className: cx("pire-field", className),
702
- style,
703
- selectedKey: value,
704
- defaultSelectedKey: defaultValue,
705
- onSelectionChange: (k) => onChange?.(String(k)),
706
- placeholder,
707
- validationBehavior: "aria",
708
- ...rest,
709
- children: [
710
- label ? /* @__PURE__ */ jsxs12(Label3, { className: "pire-field-label", children: [
711
- label,
712
- rest.isRequired ? /* @__PURE__ */ jsx17("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
713
- ] }) : null,
714
- /* @__PURE__ */ jsxs12(
715
- AriaButton4,
716
- {
717
- className: "pire-control",
718
- "data-size": size,
719
- "data-full-width": String(fullWidth),
720
- "data-invalid": rest.isInvalid ? "true" : void 0,
721
- children: [
722
- /* @__PURE__ */ jsx17(SelectValue, { className: "pire-select-value" }),
723
- /* @__PURE__ */ jsx17(Icon, { name: "chevron-down", size: 16, className: "pire-leading-icon" })
724
- ]
725
- }
726
- ),
727
- description ? /* @__PURE__ */ jsx17(Text4, { slot: "description", className: "pire-field-hint", children: description }) : null,
728
- /* @__PURE__ */ jsx17(FieldError3, { className: "pire-field-error", children: errorMessage }),
729
- /* @__PURE__ */ jsx17(Popover, { className: "pire-popover", children: /* @__PURE__ */ jsx17(ListBox, { className: "pire-listbox", items, children: (item) => /* @__PURE__ */ jsx17(ListBoxItem, { className: "pire-option", id: item.value, textValue: item.label, isDisabled: item.isDisabled, children: item.label }) }) })
730
- ]
731
- }
732
- );
733
- }
734
-
735
- // src/components/forms/Checkbox.tsx
736
- import { Checkbox as AriaCheckbox } from "react-aria-components";
737
- import { Fragment, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
738
- function Checkbox({ label, hint, children, className, ...rest }) {
739
- return /* @__PURE__ */ jsx18(AriaCheckbox, { className: cx("pire-choice", className), ...rest, children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs13(Fragment, { children: [
740
- /* @__PURE__ */ jsx18("span", { className: "pire-choice-box", "aria-hidden": "true", children: isIndeterminate ? /* @__PURE__ */ jsx18(Icon, { name: "minus", size: 12 }) : isSelected ? /* @__PURE__ */ jsx18(Icon, { name: "check", size: 12 }) : null }),
741
- /* @__PURE__ */ jsxs13("span", { children: [
742
- label ?? children,
743
- hint ? /* @__PURE__ */ jsx18("span", { className: "pire-choice-hint", children: hint }) : null
744
- ] })
745
- ] }) });
746
- }
747
-
748
- // src/components/forms/Radio.tsx
749
- import {
750
- RadioGroup as AriaRadioGroup,
751
- Radio as AriaRadio,
752
- Label as Label4,
753
- Text as Text5,
754
- FieldError as FieldError4
755
- } from "react-aria-components";
756
- import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
757
- function RadioGroup({ label, description, errorMessage, children, className, ...rest }) {
758
- return /* @__PURE__ */ jsxs14(AriaRadioGroup, { className: cx("pire-field", className), validationBehavior: "aria", ...rest, children: [
759
- label ? /* @__PURE__ */ jsx19(Label4, { className: "pire-field-label", children: label }) : null,
760
- /* @__PURE__ */ jsx19("div", { className: "pire-radiogroup", children }),
761
- description ? /* @__PURE__ */ jsx19(Text5, { slot: "description", className: "pire-field-hint", children: description }) : null,
762
- /* @__PURE__ */ jsx19(FieldError4, { className: "pire-field-error", children: errorMessage })
763
- ] });
764
- }
765
- function Radio({ label, hint, children, className, ...rest }) {
766
- return /* @__PURE__ */ jsxs14(AriaRadio, { className: cx("pire-choice", className), ...rest, children: [
767
- /* @__PURE__ */ jsx19("span", { className: "pire-choice-box", "data-radio": "true", "aria-hidden": "true" }),
768
- /* @__PURE__ */ jsxs14("span", { children: [
769
- label ?? children,
770
- hint ? /* @__PURE__ */ jsx19("span", { className: "pire-choice-hint", children: hint }) : null
771
- ] })
772
- ] });
773
- }
774
-
775
- // src/components/forms/Switch.tsx
776
- import { Switch as AriaSwitch } from "react-aria-components";
777
- import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
778
- function Switch({ label, children, className, ...rest }) {
779
- return /* @__PURE__ */ jsxs15(AriaSwitch, { className: cx("pire-choice", className), ...rest, children: [
780
- /* @__PURE__ */ jsx20("span", { className: "pire-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ jsx20("span", { className: "pire-switch-thumb" }) }),
781
- /* @__PURE__ */ jsx20("span", { children: label ?? children })
782
- ] });
783
- }
784
-
785
- // src/components/forms/ComboBox.tsx
786
- import {
787
- ComboBox as AriaComboBox,
788
- Label as Label5,
789
- Input as AriaInput2,
790
- Button as AriaButton5,
791
- Group as Group3,
792
- Popover as Popover2,
793
- ListBox as ListBox2,
794
- ListBoxItem as ListBoxItem2,
795
- Text as Text6,
796
- FieldError as FieldError5
797
- } from "react-aria-components";
798
680
 
799
681
  // src/i18n/PireIntlProvider.tsx
800
682
  import * as React6 from "react";
@@ -812,6 +694,7 @@ var enMessages = {
812
694
  inlineMessageDismiss: "Dismiss message",
813
695
  toastDismiss: "Dismiss",
814
696
  toastRegionLabel: "Notifications",
697
+ selectEmpty: "No options available",
815
698
  comboBoxShowSuggestions: "Show suggestions",
816
699
  comboBoxLoading: "Searching\u2026",
817
700
  datePickerOpenCalendar: "Open calendar",
@@ -852,6 +735,7 @@ var esMessages = {
852
735
  inlineMessageDismiss: "Descartar mensaje",
853
736
  toastDismiss: "Descartar",
854
737
  toastRegionLabel: "Notificaciones",
738
+ selectEmpty: "Sin opciones disponibles",
855
739
  comboBoxShowSuggestions: "Mostrar sugerencias",
856
740
  comboBoxLoading: "Buscando\u2026",
857
741
  datePickerOpenCalendar: "Abrir calendario",
@@ -882,14 +766,14 @@ var esMessages = {
882
766
  };
883
767
 
884
768
  // src/i18n/PireIntlProvider.tsx
885
- import { jsx as jsx21 } from "react/jsx-runtime";
769
+ import { jsx as jsx17 } from "react/jsx-runtime";
886
770
  var MessagesContext = React6.createContext(enMessages);
887
771
  function PireIntlProvider({ messages, children }) {
888
772
  const value = React6.useMemo(
889
773
  () => messages ? { ...enMessages, ...messages } : enMessages,
890
774
  [messages]
891
775
  );
892
- return /* @__PURE__ */ jsx21(MessagesContext.Provider, { value, children });
776
+ return /* @__PURE__ */ jsx17(MessagesContext.Provider, { value, children });
893
777
  }
894
778
  function usePireMessages() {
895
779
  return React6.useContext(MessagesContext);
@@ -899,7 +783,136 @@ function useMessage(key, override) {
899
783
  return override ?? messages[key];
900
784
  }
901
785
 
786
+ // src/components/forms/Select.tsx
787
+ import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
788
+ var norm = (o) => typeof o === "string" ? { value: o, label: o, isDisabled: false } : o;
789
+ function Select({
790
+ label,
791
+ value,
792
+ defaultValue,
793
+ onChange,
794
+ options = [],
795
+ placeholder = "Select\u2026",
796
+ description,
797
+ errorMessage,
798
+ emptyLabel,
799
+ size = "md",
800
+ fullWidth = true,
801
+ className,
802
+ style,
803
+ ...rest
804
+ }) {
805
+ const msg = usePireMessages();
806
+ const items = options.map(norm);
807
+ return /* @__PURE__ */ jsxs12(
808
+ AriaSelect,
809
+ {
810
+ className: cx("pire-field", className),
811
+ style,
812
+ selectedKey: value,
813
+ defaultSelectedKey: defaultValue,
814
+ onSelectionChange: (k) => onChange?.(String(k)),
815
+ allowsEmptyCollection: true,
816
+ placeholder,
817
+ validationBehavior: "aria",
818
+ ...rest,
819
+ children: [
820
+ label ? /* @__PURE__ */ jsxs12(Label3, { className: "pire-field-label", children: [
821
+ label,
822
+ rest.isRequired ? /* @__PURE__ */ jsx18("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
823
+ ] }) : null,
824
+ /* @__PURE__ */ jsxs12(
825
+ AriaButton4,
826
+ {
827
+ className: "pire-control",
828
+ "data-size": size,
829
+ "data-full-width": String(fullWidth),
830
+ "data-invalid": rest.isInvalid ? "true" : void 0,
831
+ children: [
832
+ /* @__PURE__ */ jsx18(SelectValue, { className: "pire-select-value" }),
833
+ /* @__PURE__ */ jsx18(Icon, { name: "chevron-down", size: 16, className: "pire-leading-icon" })
834
+ ]
835
+ }
836
+ ),
837
+ description ? /* @__PURE__ */ jsx18(Text4, { slot: "description", className: "pire-field-hint", children: description }) : null,
838
+ /* @__PURE__ */ jsx18(FieldError3, { className: "pire-field-error", children: errorMessage }),
839
+ /* @__PURE__ */ jsx18(Popover, { className: "pire-popover", children: /* @__PURE__ */ jsx18(
840
+ ListBox,
841
+ {
842
+ className: "pire-listbox",
843
+ items,
844
+ renderEmptyState: () => /* @__PURE__ */ jsx18("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: emptyLabel ?? msg.selectEmpty }),
845
+ children: (item) => /* @__PURE__ */ jsx18(ListBoxItem, { className: "pire-option", id: item.value, textValue: item.label, isDisabled: item.isDisabled, children: item.label })
846
+ }
847
+ ) })
848
+ ]
849
+ }
850
+ );
851
+ }
852
+
853
+ // src/components/forms/Checkbox.tsx
854
+ import { Checkbox as AriaCheckbox } from "react-aria-components";
855
+ import { Fragment, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
856
+ function Checkbox({ label, hint, children, className, ...rest }) {
857
+ return /* @__PURE__ */ jsx19(AriaCheckbox, { className: cx("pire-choice", className), ...rest, children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs13(Fragment, { children: [
858
+ /* @__PURE__ */ jsx19("span", { className: "pire-choice-box", "aria-hidden": "true", children: isIndeterminate ? /* @__PURE__ */ jsx19(Icon, { name: "minus", size: 12 }) : isSelected ? /* @__PURE__ */ jsx19(Icon, { name: "check", size: 12 }) : null }),
859
+ /* @__PURE__ */ jsxs13("span", { children: [
860
+ label ?? children,
861
+ hint ? /* @__PURE__ */ jsx19("span", { className: "pire-choice-hint", children: hint }) : null
862
+ ] })
863
+ ] }) });
864
+ }
865
+
866
+ // src/components/forms/Radio.tsx
867
+ import {
868
+ RadioGroup as AriaRadioGroup,
869
+ Radio as AriaRadio,
870
+ Label as Label4,
871
+ Text as Text5,
872
+ FieldError as FieldError4
873
+ } from "react-aria-components";
874
+ import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
875
+ function RadioGroup({ label, description, errorMessage, children, className, ...rest }) {
876
+ return /* @__PURE__ */ jsxs14(AriaRadioGroup, { className: cx("pire-field", className), validationBehavior: "aria", ...rest, children: [
877
+ label ? /* @__PURE__ */ jsx20(Label4, { className: "pire-field-label", children: label }) : null,
878
+ /* @__PURE__ */ jsx20("div", { className: "pire-radiogroup", children }),
879
+ description ? /* @__PURE__ */ jsx20(Text5, { slot: "description", className: "pire-field-hint", children: description }) : null,
880
+ /* @__PURE__ */ jsx20(FieldError4, { className: "pire-field-error", children: errorMessage })
881
+ ] });
882
+ }
883
+ function Radio({ label, hint, children, className, ...rest }) {
884
+ return /* @__PURE__ */ jsxs14(AriaRadio, { className: cx("pire-choice", className), ...rest, children: [
885
+ /* @__PURE__ */ jsx20("span", { className: "pire-choice-box", "data-radio": "true", "aria-hidden": "true" }),
886
+ /* @__PURE__ */ jsxs14("span", { children: [
887
+ label ?? children,
888
+ hint ? /* @__PURE__ */ jsx20("span", { className: "pire-choice-hint", children: hint }) : null
889
+ ] })
890
+ ] });
891
+ }
892
+
893
+ // src/components/forms/Switch.tsx
894
+ import { Switch as AriaSwitch } from "react-aria-components";
895
+ import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
896
+ function Switch({ label, children, className, ...rest }) {
897
+ return /* @__PURE__ */ jsxs15(AriaSwitch, { className: cx("pire-choice", className), ...rest, children: [
898
+ /* @__PURE__ */ jsx21("span", { className: "pire-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ jsx21("span", { className: "pire-switch-thumb" }) }),
899
+ /* @__PURE__ */ jsx21("span", { children: label ?? children })
900
+ ] });
901
+ }
902
+
902
903
  // src/components/forms/ComboBox.tsx
904
+ import {
905
+ ComboBox as AriaComboBox,
906
+ Label as Label5,
907
+ Input as AriaInput2,
908
+ Button as AriaButton5,
909
+ Group as Group3,
910
+ Popover as Popover2,
911
+ ListBox as ListBox2,
912
+ ListBoxItem as ListBoxItem2,
913
+ Text as Text6,
914
+ FieldError as FieldError5
915
+ } from "react-aria-components";
903
916
  import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
904
917
  var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
905
918
  function ComboBox({
@@ -908,6 +921,7 @@ function ComboBox({
908
921
  defaultValue,
909
922
  onChange,
910
923
  onInputChange,
924
+ inputValue,
911
925
  options = [],
912
926
  description,
913
927
  errorMessage,
@@ -937,6 +951,7 @@ function ComboBox({
937
951
  if (isLoading) return;
938
952
  onChange?.(k == null ? null : String(k));
939
953
  },
954
+ inputValue,
940
955
  onInputChange,
941
956
  ...collection,
942
957
  allowsEmptyCollection: isFilteredExternally || isLoading,
@@ -1436,7 +1451,7 @@ function Dialog({
1436
1451
  ] }),
1437
1452
  showClose ? /* @__PURE__ */ jsx27(IconButton, { icon: "x", label: msg.dialogClose, size: "sm", onPress: close }) : null
1438
1453
  ] }) : null,
1439
- /* @__PURE__ */ jsx27("div", { className: "pire-dialog-body", children }),
1454
+ children ? /* @__PURE__ */ jsx27("div", { className: "pire-dialog-body", children }) : null,
1440
1455
  footer ? /* @__PURE__ */ jsx27("footer", { className: "pire-dialog-foot", children: footer }) : null
1441
1456
  ] }) })
1442
1457
  }
@@ -2957,13 +2972,18 @@ function colorForSegment(index) {
2957
2972
  // src/components/data/LinkList.tsx
2958
2973
  import { Button as AriaButton12 } from "react-aria-components";
2959
2974
  import { jsx as jsx51, jsxs as jsxs44 } from "react/jsx-runtime";
2960
- function LinkList({ items, onSelect, className, ...rest }) {
2961
- return /* @__PURE__ */ jsx51("div", { className: cx("pire-linklist", className), role: "list", ...rest, children: items.map((item) => /* @__PURE__ */ jsx51("div", { role: "listitem", className: "pire-linklist-row", children: /* @__PURE__ */ jsxs44(AriaButton12, { className: "pire-linklist-item", onPress: () => onSelect?.(item.id), children: [
2962
- item.icon ? /* @__PURE__ */ jsx51(Icon, { name: item.icon, size: 16, style: { color: "var(--text-secondary)" } }) : null,
2963
- item.key ? /* @__PURE__ */ jsx51("span", { className: "pire-linklist-key", children: item.key }) : null,
2964
- item.text ? /* @__PURE__ */ jsx51("span", { className: "pire-linklist-text", children: item.text }) : null,
2965
- item.trailing
2966
- ] }) }, item.id)) });
2975
+ function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
2976
+ return /* @__PURE__ */ jsx51("div", { className: cx("pire-linklist", className), role: "list", "data-emphasis": emphasis, ...rest, children: items.map((item) => {
2977
+ const keySlot = item.key ? /* @__PURE__ */ jsx51("span", { className: "pire-linklist-key", children: item.key }) : null;
2978
+ const textSlot = item.text ? /* @__PURE__ */ jsx51("span", { className: "pire-linklist-text", children: item.text }) : null;
2979
+ const [first, second] = emphasis === "text" ? [textSlot, keySlot] : [keySlot, textSlot];
2980
+ return /* @__PURE__ */ jsx51("div", { role: "listitem", className: "pire-linklist-row", children: /* @__PURE__ */ jsxs44(AriaButton12, { className: "pire-linklist-item", onPress: () => onSelect?.(item.id), children: [
2981
+ item.icon ? /* @__PURE__ */ jsx51(Icon, { name: item.icon, size: 16, style: { color: "var(--text-secondary)" } }) : null,
2982
+ first,
2983
+ second,
2984
+ item.trailing
2985
+ ] }) }, item.id);
2986
+ }) });
2967
2987
  }
2968
2988
 
2969
2989
  // src/components/layout/PageBand.tsx