@salemcobalt/ui 0.2.0-rc.0 → 0.2.0-rc.2
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/README.md +56 -13
- package/dist/index.d.ts +988 -16
- package/dist/index.js +738 -0
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1181 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -196,12 +196,18 @@ function ArchiveIcon(props) {
|
|
|
196
196
|
/* @__PURE__ */ jsx5("path", { d: "M3.25 5.75v6.5a1 1 0 0 0 1 1h7.5a1 1 0 0 0 1-1v-6.5M6.5 8.75h3" })
|
|
197
197
|
] });
|
|
198
198
|
}
|
|
199
|
+
function ArrowDownIcon(props) {
|
|
200
|
+
return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M8 3v10M4 9l4 4 4-4" }) });
|
|
201
|
+
}
|
|
199
202
|
function ArrowLeftIcon(props) {
|
|
200
203
|
return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M13 8H3M7 4 3 8l4 4" }) });
|
|
201
204
|
}
|
|
202
205
|
function ArrowRightIcon(props) {
|
|
203
206
|
return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M3 8h10M9 4l4 4-4 4" }) });
|
|
204
207
|
}
|
|
208
|
+
function ArrowUpIcon(props) {
|
|
209
|
+
return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M8 13V3M4 7l4-4 4 4" }) });
|
|
210
|
+
}
|
|
205
211
|
function BellIcon(props) {
|
|
206
212
|
return /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
|
|
207
213
|
/* @__PURE__ */ jsx5("path", { d: "M4 6.5a4 4 0 0 1 8 0v3l1.25 2H2.75L4 9.5z" }),
|
|
@@ -489,8 +495,10 @@ var Dialog = { Root, Trigger, Content, Title, Description, Body, Actions, Close
|
|
|
489
495
|
// src/icons/icon-names.gen.ts
|
|
490
496
|
var iconNames = [
|
|
491
497
|
"archive",
|
|
498
|
+
"arrow-down",
|
|
492
499
|
"arrow-left",
|
|
493
500
|
"arrow-right",
|
|
501
|
+
"arrow-up",
|
|
494
502
|
"bell",
|
|
495
503
|
"briefcase",
|
|
496
504
|
"calendar",
|
|
@@ -737,19 +745,737 @@ var Menu = {
|
|
|
737
745
|
Separator
|
|
738
746
|
};
|
|
739
747
|
|
|
748
|
+
// src/components/Input/Input.tsx
|
|
749
|
+
import { Field as Field2 } from "@base-ui/react/field";
|
|
750
|
+
|
|
751
|
+
// src/components/Field/FieldShell.tsx
|
|
752
|
+
import { Field } from "@base-ui/react/field";
|
|
753
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
754
|
+
function FieldShell({
|
|
755
|
+
label,
|
|
756
|
+
hideLabel = false,
|
|
757
|
+
description,
|
|
758
|
+
error,
|
|
759
|
+
invalid = false,
|
|
760
|
+
required = false,
|
|
761
|
+
disabled = false,
|
|
762
|
+
name,
|
|
763
|
+
size = "md",
|
|
764
|
+
className,
|
|
765
|
+
children
|
|
766
|
+
}) {
|
|
767
|
+
return /* @__PURE__ */ jsxs9(
|
|
768
|
+
Field.Root,
|
|
769
|
+
{
|
|
770
|
+
className: cx("sc-field", className),
|
|
771
|
+
name,
|
|
772
|
+
disabled,
|
|
773
|
+
invalid: invalid || error != null,
|
|
774
|
+
"data-size": size,
|
|
775
|
+
children: [
|
|
776
|
+
/* @__PURE__ */ jsxs9(Field.Label, { className: cx("sc-field__label", hideLabel && "sc-visually-hidden"), children: [
|
|
777
|
+
label,
|
|
778
|
+
required ? /* @__PURE__ */ jsx10("span", { className: "sc-field__required", "aria-hidden": "true", children: "*" }) : null
|
|
779
|
+
] }),
|
|
780
|
+
children,
|
|
781
|
+
description != null ? /* @__PURE__ */ jsx10(Field.Description, { className: "sc-field__description", children: description }) : null,
|
|
782
|
+
error != null ? /* @__PURE__ */ jsx10(Field.Error, { className: "sc-field__error", match: true, children: error }) : null
|
|
783
|
+
]
|
|
784
|
+
}
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// src/components/Input/Input.tsx
|
|
789
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
790
|
+
function Input({
|
|
791
|
+
label,
|
|
792
|
+
hideLabel,
|
|
793
|
+
description,
|
|
794
|
+
error,
|
|
795
|
+
invalid,
|
|
796
|
+
required,
|
|
797
|
+
disabled,
|
|
798
|
+
name,
|
|
799
|
+
size,
|
|
800
|
+
className,
|
|
801
|
+
iconStart,
|
|
802
|
+
iconEnd,
|
|
803
|
+
onValueChange,
|
|
804
|
+
...rest
|
|
805
|
+
}) {
|
|
806
|
+
return /* @__PURE__ */ jsx11(
|
|
807
|
+
FieldShell,
|
|
808
|
+
{
|
|
809
|
+
label,
|
|
810
|
+
hideLabel,
|
|
811
|
+
description,
|
|
812
|
+
error,
|
|
813
|
+
invalid,
|
|
814
|
+
required,
|
|
815
|
+
disabled,
|
|
816
|
+
name,
|
|
817
|
+
size,
|
|
818
|
+
className,
|
|
819
|
+
children: /* @__PURE__ */ jsxs10(
|
|
820
|
+
"span",
|
|
821
|
+
{
|
|
822
|
+
className: "sc-input-wrap",
|
|
823
|
+
"data-icon-start": iconStart ? "" : void 0,
|
|
824
|
+
"data-icon-end": iconEnd ? "" : void 0,
|
|
825
|
+
children: [
|
|
826
|
+
iconStart ? /* @__PURE__ */ jsx11("span", { className: "sc-input__icon", "data-side": "start", "aria-hidden": "true", children: iconStart }) : null,
|
|
827
|
+
/* @__PURE__ */ jsx11(
|
|
828
|
+
Field2.Control,
|
|
829
|
+
{
|
|
830
|
+
className: "sc-input",
|
|
831
|
+
required,
|
|
832
|
+
onValueChange: onValueChange ? (value) => onValueChange(value) : void 0,
|
|
833
|
+
...rest
|
|
834
|
+
}
|
|
835
|
+
),
|
|
836
|
+
iconEnd ? /* @__PURE__ */ jsx11("span", { className: "sc-input__icon", "data-side": "end", "aria-hidden": "true", children: iconEnd }) : null
|
|
837
|
+
]
|
|
838
|
+
}
|
|
839
|
+
)
|
|
840
|
+
}
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// src/components/Textarea/Textarea.tsx
|
|
845
|
+
import { Field as Field3 } from "@base-ui/react/field";
|
|
846
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
847
|
+
function Textarea({
|
|
848
|
+
label,
|
|
849
|
+
hideLabel,
|
|
850
|
+
description,
|
|
851
|
+
error,
|
|
852
|
+
invalid,
|
|
853
|
+
required,
|
|
854
|
+
disabled,
|
|
855
|
+
name,
|
|
856
|
+
className,
|
|
857
|
+
rows = 3,
|
|
858
|
+
resize = "vertical",
|
|
859
|
+
onValueChange,
|
|
860
|
+
...rest
|
|
861
|
+
}) {
|
|
862
|
+
return /* @__PURE__ */ jsx12(
|
|
863
|
+
FieldShell,
|
|
864
|
+
{
|
|
865
|
+
label,
|
|
866
|
+
hideLabel,
|
|
867
|
+
description,
|
|
868
|
+
error,
|
|
869
|
+
invalid,
|
|
870
|
+
required,
|
|
871
|
+
disabled,
|
|
872
|
+
name,
|
|
873
|
+
className,
|
|
874
|
+
children: /* @__PURE__ */ jsx12(
|
|
875
|
+
Field3.Control,
|
|
876
|
+
{
|
|
877
|
+
render: /* @__PURE__ */ jsx12("textarea", { rows, ...rest }),
|
|
878
|
+
className: "sc-input sc-textarea",
|
|
879
|
+
"data-resize": resize,
|
|
880
|
+
required,
|
|
881
|
+
onValueChange: onValueChange ? (value) => onValueChange(value) : void 0
|
|
882
|
+
}
|
|
883
|
+
)
|
|
884
|
+
}
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// src/components/Select/Select.tsx
|
|
889
|
+
import { Select as BaseSelect } from "@base-ui/react/select";
|
|
890
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
891
|
+
function isGroup(entry) {
|
|
892
|
+
return "options" in entry;
|
|
893
|
+
}
|
|
894
|
+
function Option({ option }) {
|
|
895
|
+
return /* @__PURE__ */ jsxs11(BaseSelect.Item, { value: option.value, disabled: option.disabled, className: "sc-select__item", children: [
|
|
896
|
+
/* @__PURE__ */ jsx13(BaseSelect.ItemIndicator, { className: "sc-select__indicator", children: /* @__PURE__ */ jsx13(CheckIcon, { size: "sm" }) }),
|
|
897
|
+
/* @__PURE__ */ jsx13(BaseSelect.ItemText, { className: "sc-select__item-text", children: option.label })
|
|
898
|
+
] });
|
|
899
|
+
}
|
|
900
|
+
function Select({
|
|
901
|
+
label,
|
|
902
|
+
hideLabel,
|
|
903
|
+
description,
|
|
904
|
+
error,
|
|
905
|
+
invalid,
|
|
906
|
+
required,
|
|
907
|
+
disabled,
|
|
908
|
+
name,
|
|
909
|
+
size = "md",
|
|
910
|
+
className,
|
|
911
|
+
options,
|
|
912
|
+
value,
|
|
913
|
+
defaultValue,
|
|
914
|
+
onValueChange,
|
|
915
|
+
placeholder = "Choose\u2026",
|
|
916
|
+
readOnly,
|
|
917
|
+
fullWidth = false,
|
|
918
|
+
id
|
|
919
|
+
}) {
|
|
920
|
+
const items = options.flatMap((entry) => isGroup(entry) ? entry.options : [entry]);
|
|
921
|
+
return /* @__PURE__ */ jsx13(
|
|
922
|
+
FieldShell,
|
|
923
|
+
{
|
|
924
|
+
label,
|
|
925
|
+
hideLabel,
|
|
926
|
+
description,
|
|
927
|
+
error,
|
|
928
|
+
invalid,
|
|
929
|
+
required,
|
|
930
|
+
disabled,
|
|
931
|
+
name,
|
|
932
|
+
size,
|
|
933
|
+
className,
|
|
934
|
+
children: /* @__PURE__ */ jsxs11(
|
|
935
|
+
BaseSelect.Root,
|
|
936
|
+
{
|
|
937
|
+
items,
|
|
938
|
+
value,
|
|
939
|
+
defaultValue,
|
|
940
|
+
onValueChange: onValueChange ? (next) => onValueChange(next) : void 0,
|
|
941
|
+
disabled,
|
|
942
|
+
required,
|
|
943
|
+
readOnly,
|
|
944
|
+
children: [
|
|
945
|
+
/* @__PURE__ */ jsxs11(
|
|
946
|
+
BaseSelect.Trigger,
|
|
947
|
+
{
|
|
948
|
+
id,
|
|
949
|
+
className: "sc-select",
|
|
950
|
+
"data-size": size,
|
|
951
|
+
"data-full-width": fullWidth || void 0,
|
|
952
|
+
children: [
|
|
953
|
+
/* @__PURE__ */ jsx13(BaseSelect.Value, { className: "sc-select__value", placeholder }),
|
|
954
|
+
/* @__PURE__ */ jsx13(BaseSelect.Icon, { className: "sc-select__icon", children: /* @__PURE__ */ jsx13(ChevronDownIcon, {}) })
|
|
955
|
+
]
|
|
956
|
+
}
|
|
957
|
+
),
|
|
958
|
+
/* @__PURE__ */ jsx13(BaseSelect.Portal, { children: /* @__PURE__ */ jsx13(
|
|
959
|
+
BaseSelect.Positioner,
|
|
960
|
+
{
|
|
961
|
+
className: "sc-select__positioner",
|
|
962
|
+
sideOffset: 4,
|
|
963
|
+
alignItemWithTrigger: false,
|
|
964
|
+
children: /* @__PURE__ */ jsx13(BaseSelect.Popup, { className: "sc-select__popup", children: /* @__PURE__ */ jsx13(BaseSelect.List, { children: options.map(
|
|
965
|
+
(entry, i) => isGroup(entry) ? /* @__PURE__ */ jsxs11(BaseSelect.Group, { className: "sc-select__group", children: [
|
|
966
|
+
/* @__PURE__ */ jsx13(BaseSelect.GroupLabel, { className: "sc-select__group-label", children: entry.label }),
|
|
967
|
+
entry.options.map((option) => /* @__PURE__ */ jsx13(Option, { option }, option.value))
|
|
968
|
+
] }, i) : /* @__PURE__ */ jsx13(Option, { option: entry }, entry.value)
|
|
969
|
+
) }) })
|
|
970
|
+
}
|
|
971
|
+
) })
|
|
972
|
+
]
|
|
973
|
+
}
|
|
974
|
+
)
|
|
975
|
+
}
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
980
|
+
import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox";
|
|
981
|
+
import { useId } from "react";
|
|
982
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
983
|
+
function Checkbox({
|
|
984
|
+
label,
|
|
985
|
+
description,
|
|
986
|
+
onCheckedChange,
|
|
987
|
+
className,
|
|
988
|
+
disabled,
|
|
989
|
+
...rest
|
|
990
|
+
}) {
|
|
991
|
+
const descriptionId = useId();
|
|
992
|
+
return /* @__PURE__ */ jsxs12("div", { className: cx("sc-choice", className), "data-disabled": disabled || void 0, children: [
|
|
993
|
+
/* @__PURE__ */ jsxs12("label", { className: "sc-choice__control", children: [
|
|
994
|
+
/* @__PURE__ */ jsx14(
|
|
995
|
+
BaseCheckbox.Root,
|
|
996
|
+
{
|
|
997
|
+
className: "sc-checkbox",
|
|
998
|
+
disabled,
|
|
999
|
+
"aria-describedby": description != null ? descriptionId : void 0,
|
|
1000
|
+
onCheckedChange: onCheckedChange ? (checked) => onCheckedChange(checked) : void 0,
|
|
1001
|
+
...rest,
|
|
1002
|
+
children: /* @__PURE__ */ jsxs12(BaseCheckbox.Indicator, { className: "sc-checkbox__indicator", children: [
|
|
1003
|
+
/* @__PURE__ */ jsx14(CheckIcon, { size: "sm", className: "sc-checkbox__check" }),
|
|
1004
|
+
/* @__PURE__ */ jsx14(MinusIcon, { size: "sm", className: "sc-checkbox__dash" })
|
|
1005
|
+
] })
|
|
1006
|
+
}
|
|
1007
|
+
),
|
|
1008
|
+
/* @__PURE__ */ jsx14("span", { className: "sc-choice__label", children: label })
|
|
1009
|
+
] }),
|
|
1010
|
+
description != null ? /* @__PURE__ */ jsx14("span", { className: "sc-choice__description", id: descriptionId, children: description }) : null
|
|
1011
|
+
] });
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// src/components/Switch/Switch.tsx
|
|
1015
|
+
import { Switch as BaseSwitch } from "@base-ui/react/switch";
|
|
1016
|
+
import { useId as useId2 } from "react";
|
|
1017
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1018
|
+
function Switch({
|
|
1019
|
+
label,
|
|
1020
|
+
description,
|
|
1021
|
+
onCheckedChange,
|
|
1022
|
+
labelPosition = "end",
|
|
1023
|
+
className,
|
|
1024
|
+
disabled,
|
|
1025
|
+
...rest
|
|
1026
|
+
}) {
|
|
1027
|
+
const descriptionId = useId2();
|
|
1028
|
+
return /* @__PURE__ */ jsxs13(
|
|
1029
|
+
"div",
|
|
1030
|
+
{
|
|
1031
|
+
className: cx("sc-choice", className),
|
|
1032
|
+
"data-disabled": disabled || void 0,
|
|
1033
|
+
"data-label-position": labelPosition,
|
|
1034
|
+
children: [
|
|
1035
|
+
/* @__PURE__ */ jsxs13("label", { className: "sc-choice__control", children: [
|
|
1036
|
+
/* @__PURE__ */ jsx15(
|
|
1037
|
+
BaseSwitch.Root,
|
|
1038
|
+
{
|
|
1039
|
+
className: "sc-switch",
|
|
1040
|
+
disabled,
|
|
1041
|
+
"aria-describedby": description != null ? descriptionId : void 0,
|
|
1042
|
+
onCheckedChange: onCheckedChange ? (checked) => onCheckedChange(checked) : void 0,
|
|
1043
|
+
...rest,
|
|
1044
|
+
children: /* @__PURE__ */ jsx15(BaseSwitch.Thumb, { className: "sc-switch__thumb" })
|
|
1045
|
+
}
|
|
1046
|
+
),
|
|
1047
|
+
/* @__PURE__ */ jsx15("span", { className: "sc-choice__label", children: label })
|
|
1048
|
+
] }),
|
|
1049
|
+
description != null ? /* @__PURE__ */ jsx15("span", { className: "sc-choice__description", id: descriptionId, children: description }) : null
|
|
1050
|
+
]
|
|
1051
|
+
}
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// src/components/Tabs/Tabs.tsx
|
|
1056
|
+
import { Tabs as BaseTabs } from "@base-ui/react/tabs";
|
|
1057
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1058
|
+
function Root3({ className, onValueChange, ...rest }) {
|
|
1059
|
+
return /* @__PURE__ */ jsx16(
|
|
1060
|
+
BaseTabs.Root,
|
|
1061
|
+
{
|
|
1062
|
+
className: cx("sc-tabs", className),
|
|
1063
|
+
onValueChange: onValueChange ? (value) => onValueChange(String(value)) : void 0,
|
|
1064
|
+
...rest
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
function List({ fill = false, className, children, ...rest }) {
|
|
1069
|
+
return /* @__PURE__ */ jsxs14(BaseTabs.List, { className: cx("sc-tabs__list", className), "data-fill": fill || void 0, ...rest, children: [
|
|
1070
|
+
children,
|
|
1071
|
+
/* @__PURE__ */ jsx16(BaseTabs.Indicator, { className: "sc-tabs__indicator" })
|
|
1072
|
+
] });
|
|
1073
|
+
}
|
|
1074
|
+
function Tab({ icon, count, className, children, ...rest }) {
|
|
1075
|
+
return /* @__PURE__ */ jsxs14(BaseTabs.Tab, { className: cx("sc-tabs__tab", className), ...rest, children: [
|
|
1076
|
+
icon ? /* @__PURE__ */ jsx16("span", { className: "sc-tabs__icon", "aria-hidden": "true", children: icon }) : null,
|
|
1077
|
+
/* @__PURE__ */ jsx16("span", { className: "sc-tabs__label", children }),
|
|
1078
|
+
count != null ? /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
1079
|
+
" ",
|
|
1080
|
+
/* @__PURE__ */ jsx16("span", { className: "sc-tabs__count", children: count })
|
|
1081
|
+
] }) : null
|
|
1082
|
+
] });
|
|
1083
|
+
}
|
|
1084
|
+
function Panel({ className, ...rest }) {
|
|
1085
|
+
return /* @__PURE__ */ jsx16(BaseTabs.Panel, { className: cx("sc-tabs__panel", className), ...rest });
|
|
1086
|
+
}
|
|
1087
|
+
var Tabs = { Root: Root3, List, Tab, Panel };
|
|
1088
|
+
|
|
1089
|
+
// src/components/Toolbar/Toolbar.tsx
|
|
1090
|
+
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
1091
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1092
|
+
function Root4({ wrap = true, gap = "xs", className, ...rest }) {
|
|
1093
|
+
return /* @__PURE__ */ jsx17(
|
|
1094
|
+
BaseToolbar.Root,
|
|
1095
|
+
{
|
|
1096
|
+
className: cx("sc-toolbar", className),
|
|
1097
|
+
"data-wrap": wrap || void 0,
|
|
1098
|
+
"data-gap": gap,
|
|
1099
|
+
...rest
|
|
1100
|
+
}
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
function Group2({ gap = "2xs", className, ...rest }) {
|
|
1104
|
+
return /* @__PURE__ */ jsx17(BaseToolbar.Group, { className: cx("sc-toolbar__group", className), "data-gap": gap, ...rest });
|
|
1105
|
+
}
|
|
1106
|
+
function Separator2({ className, ...rest }) {
|
|
1107
|
+
return /* @__PURE__ */ jsx17(BaseToolbar.Separator, { className: cx("sc-toolbar__separator", className), ...rest });
|
|
1108
|
+
}
|
|
1109
|
+
var Button2 = BaseToolbar.Button;
|
|
1110
|
+
function Spacer({ className }) {
|
|
1111
|
+
return /* @__PURE__ */ jsx17("div", { className: cx("sc-toolbar__spacer", className), "aria-hidden": "true" });
|
|
1112
|
+
}
|
|
1113
|
+
var Toolbar = { Root: Root4, Group: Group2, Separator: Separator2, Button: Button2, Spacer };
|
|
1114
|
+
|
|
1115
|
+
// src/components/Banner/Banner.tsx
|
|
1116
|
+
import { useState } from "react";
|
|
1117
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1118
|
+
var toneIcons = {
|
|
1119
|
+
info: /* @__PURE__ */ jsx18(InfoIcon, {}),
|
|
1120
|
+
success: /* @__PURE__ */ jsx18(CircleCheckIcon, {}),
|
|
1121
|
+
warning: /* @__PURE__ */ jsx18(WarningIcon, {}),
|
|
1122
|
+
danger: /* @__PURE__ */ jsx18(CircleXIcon, {}),
|
|
1123
|
+
neutral: null
|
|
1124
|
+
};
|
|
1125
|
+
function Banner({
|
|
1126
|
+
tone = "info",
|
|
1127
|
+
icon,
|
|
1128
|
+
action,
|
|
1129
|
+
dismissible = false,
|
|
1130
|
+
onDismiss,
|
|
1131
|
+
open,
|
|
1132
|
+
dismissLabel = "Dismiss",
|
|
1133
|
+
role,
|
|
1134
|
+
className,
|
|
1135
|
+
children,
|
|
1136
|
+
...rest
|
|
1137
|
+
}) {
|
|
1138
|
+
const [dismissed, setDismissed] = useState(false);
|
|
1139
|
+
const visible = open ?? !dismissed;
|
|
1140
|
+
if (!visible) return null;
|
|
1141
|
+
const glyph = icon === false ? null : icon ?? toneIcons[tone];
|
|
1142
|
+
return /* @__PURE__ */ jsxs15(
|
|
1143
|
+
"div",
|
|
1144
|
+
{
|
|
1145
|
+
role: role ?? (tone === "warning" || tone === "danger" ? "alert" : "status"),
|
|
1146
|
+
className: cx("sc-banner", className),
|
|
1147
|
+
"data-tone": tone,
|
|
1148
|
+
...rest,
|
|
1149
|
+
children: [
|
|
1150
|
+
glyph ? /* @__PURE__ */ jsx18("span", { className: "sc-banner__icon", "aria-hidden": "true", children: glyph }) : null,
|
|
1151
|
+
/* @__PURE__ */ jsx18("div", { className: "sc-banner__body", children }),
|
|
1152
|
+
action ? /* @__PURE__ */ jsx18("div", { className: "sc-banner__action", children: action }) : null,
|
|
1153
|
+
dismissible ? /* @__PURE__ */ jsx18(
|
|
1154
|
+
IconButton,
|
|
1155
|
+
{
|
|
1156
|
+
label: dismissLabel,
|
|
1157
|
+
size: "sm",
|
|
1158
|
+
className: "sc-banner__dismiss",
|
|
1159
|
+
onClick: () => {
|
|
1160
|
+
setDismissed(true);
|
|
1161
|
+
onDismiss?.();
|
|
1162
|
+
},
|
|
1163
|
+
children: /* @__PURE__ */ jsx18(XIcon, {})
|
|
1164
|
+
}
|
|
1165
|
+
) : null
|
|
1166
|
+
]
|
|
1167
|
+
}
|
|
1168
|
+
);
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// src/components/Spinner/Spinner.tsx
|
|
1172
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1173
|
+
function Spinner({
|
|
1174
|
+
size = "md",
|
|
1175
|
+
label = "Loading",
|
|
1176
|
+
decorative = false,
|
|
1177
|
+
className,
|
|
1178
|
+
...rest
|
|
1179
|
+
}) {
|
|
1180
|
+
return /* @__PURE__ */ jsx19(
|
|
1181
|
+
"span",
|
|
1182
|
+
{
|
|
1183
|
+
className: cx("sc-spinner", className),
|
|
1184
|
+
"data-size": size,
|
|
1185
|
+
role: decorative ? void 0 : "status",
|
|
1186
|
+
"aria-label": decorative ? void 0 : label,
|
|
1187
|
+
"aria-hidden": decorative || void 0,
|
|
1188
|
+
...rest,
|
|
1189
|
+
children: /* @__PURE__ */ jsxs16(
|
|
1190
|
+
"svg",
|
|
1191
|
+
{
|
|
1192
|
+
viewBox: "0 0 16 16",
|
|
1193
|
+
fill: "none",
|
|
1194
|
+
stroke: "currentColor",
|
|
1195
|
+
strokeWidth: "1.75",
|
|
1196
|
+
"aria-hidden": "true",
|
|
1197
|
+
focusable: "false",
|
|
1198
|
+
children: [
|
|
1199
|
+
/* @__PURE__ */ jsx19("circle", { className: "sc-spinner__track", cx: "8", cy: "8", r: "6.25" }),
|
|
1200
|
+
/* @__PURE__ */ jsx19("circle", { className: "sc-spinner__arc", cx: "8", cy: "8", r: "6.25", strokeLinecap: "round" })
|
|
1201
|
+
]
|
|
1202
|
+
}
|
|
1203
|
+
)
|
|
1204
|
+
}
|
|
1205
|
+
);
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
// src/components/Progress/Progress.tsx
|
|
1209
|
+
import { Progress as BaseProgress } from "@base-ui/react/progress";
|
|
1210
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1211
|
+
function Progress({
|
|
1212
|
+
value,
|
|
1213
|
+
max = 100,
|
|
1214
|
+
min = 0,
|
|
1215
|
+
label,
|
|
1216
|
+
valueText,
|
|
1217
|
+
showValue = false,
|
|
1218
|
+
tone = "accent",
|
|
1219
|
+
size = "md",
|
|
1220
|
+
variant = "bar",
|
|
1221
|
+
className,
|
|
1222
|
+
...rest
|
|
1223
|
+
}) {
|
|
1224
|
+
const current = value ?? null;
|
|
1225
|
+
const hasValueText = valueText != null || showValue && current !== null;
|
|
1226
|
+
return /* @__PURE__ */ jsxs17(
|
|
1227
|
+
BaseProgress.Root,
|
|
1228
|
+
{
|
|
1229
|
+
value: current,
|
|
1230
|
+
max,
|
|
1231
|
+
min,
|
|
1232
|
+
getAriaValueText: (formatted) => typeof valueText === "string" ? valueText : formatted ?? "",
|
|
1233
|
+
className: cx("sc-progress", className),
|
|
1234
|
+
"data-variant": variant,
|
|
1235
|
+
"data-tone": tone,
|
|
1236
|
+
"data-size": size,
|
|
1237
|
+
...rest,
|
|
1238
|
+
children: [
|
|
1239
|
+
variant === "inline" ? /* @__PURE__ */ jsx20(Spinner, { size: "sm", decorative: true, className: "sc-progress__spinner" }) : null,
|
|
1240
|
+
label != null ? /* @__PURE__ */ jsx20(BaseProgress.Label, { className: "sc-progress__label", children: label }) : null,
|
|
1241
|
+
hasValueText ? /* @__PURE__ */ jsx20(BaseProgress.Value, { className: "sc-progress__value", children: (formatted) => valueText != null ? valueText : formatted }) : null,
|
|
1242
|
+
variant === "bar" ? /* @__PURE__ */ jsx20(BaseProgress.Track, { className: "sc-progress__track", children: /* @__PURE__ */ jsx20(BaseProgress.Indicator, { className: "sc-progress__indicator" }) }) : null
|
|
1243
|
+
]
|
|
1244
|
+
}
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
// src/components/Heading/Heading.tsx
|
|
1249
|
+
import { createElement as createElement3 } from "react";
|
|
1250
|
+
var sizeByLevel = {
|
|
1251
|
+
1: "3xl",
|
|
1252
|
+
2: "2xl",
|
|
1253
|
+
3: "xl",
|
|
1254
|
+
4: "lg",
|
|
1255
|
+
5: "md",
|
|
1256
|
+
6: "sm"
|
|
1257
|
+
};
|
|
1258
|
+
function Heading({
|
|
1259
|
+
level = 2,
|
|
1260
|
+
size,
|
|
1261
|
+
as,
|
|
1262
|
+
tone = "default",
|
|
1263
|
+
truncate = false,
|
|
1264
|
+
className,
|
|
1265
|
+
...rest
|
|
1266
|
+
}) {
|
|
1267
|
+
return createElement3(as ?? `h${level}`, {
|
|
1268
|
+
className: cx("sc-heading", className),
|
|
1269
|
+
"data-size": size ?? sizeByLevel[level],
|
|
1270
|
+
"data-tone": tone,
|
|
1271
|
+
"data-truncate": truncate || void 0,
|
|
1272
|
+
...rest
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// src/components/Text/Text.tsx
|
|
1277
|
+
import { createElement as createElement4 } from "react";
|
|
1278
|
+
function Text({
|
|
1279
|
+
as = "p",
|
|
1280
|
+
size = "sm",
|
|
1281
|
+
tone = "default",
|
|
1282
|
+
weight = "regular",
|
|
1283
|
+
align,
|
|
1284
|
+
truncate = false,
|
|
1285
|
+
numeric = false,
|
|
1286
|
+
className,
|
|
1287
|
+
style,
|
|
1288
|
+
...rest
|
|
1289
|
+
}) {
|
|
1290
|
+
const clamp = typeof truncate === "number" ? truncate : void 0;
|
|
1291
|
+
return createElement4(as, {
|
|
1292
|
+
className: cx("sc-text", className),
|
|
1293
|
+
"data-size": size,
|
|
1294
|
+
"data-tone": tone,
|
|
1295
|
+
"data-weight": weight,
|
|
1296
|
+
"data-align": align,
|
|
1297
|
+
"data-truncate": truncate === true ? "" : clamp !== void 0 ? "clamp" : void 0,
|
|
1298
|
+
"data-numeric": numeric || void 0,
|
|
1299
|
+
style: clamp !== void 0 ? { ...style, "--sc-text-lines": clamp } : style,
|
|
1300
|
+
...rest
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
// src/components/Table/Table.tsx
|
|
1305
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1306
|
+
function Root5({
|
|
1307
|
+
stickyHeader = false,
|
|
1308
|
+
maxHeight,
|
|
1309
|
+
density,
|
|
1310
|
+
divided = true,
|
|
1311
|
+
layout = "auto",
|
|
1312
|
+
wrapperClassName,
|
|
1313
|
+
wrapperStyle,
|
|
1314
|
+
className,
|
|
1315
|
+
style,
|
|
1316
|
+
children,
|
|
1317
|
+
...rest
|
|
1318
|
+
}) {
|
|
1319
|
+
return /* @__PURE__ */ jsx21(
|
|
1320
|
+
"div",
|
|
1321
|
+
{
|
|
1322
|
+
className: cx("sc-table-wrap", wrapperClassName),
|
|
1323
|
+
"data-sticky-header": stickyHeader || void 0,
|
|
1324
|
+
"data-scroll": maxHeight ? "" : void 0,
|
|
1325
|
+
style: maxHeight ? { ...wrapperStyle, maxBlockSize: maxHeight } : wrapperStyle,
|
|
1326
|
+
children: /* @__PURE__ */ jsx21(
|
|
1327
|
+
"table",
|
|
1328
|
+
{
|
|
1329
|
+
className: cx("sc-table", className),
|
|
1330
|
+
"data-density": density,
|
|
1331
|
+
"data-divided": divided || void 0,
|
|
1332
|
+
"data-layout": layout,
|
|
1333
|
+
style,
|
|
1334
|
+
...rest,
|
|
1335
|
+
children
|
|
1336
|
+
}
|
|
1337
|
+
)
|
|
1338
|
+
}
|
|
1339
|
+
);
|
|
1340
|
+
}
|
|
1341
|
+
function Caption({ className, ...rest }) {
|
|
1342
|
+
return /* @__PURE__ */ jsx21("caption", { className: cx("sc-table__caption", className), ...rest });
|
|
1343
|
+
}
|
|
1344
|
+
function Head({ className, ...rest }) {
|
|
1345
|
+
return /* @__PURE__ */ jsx21("thead", { className: cx("sc-table__head", className), ...rest });
|
|
1346
|
+
}
|
|
1347
|
+
function Body2({ className, ...rest }) {
|
|
1348
|
+
return /* @__PURE__ */ jsx21("tbody", { className: cx("sc-table__body", className), ...rest });
|
|
1349
|
+
}
|
|
1350
|
+
function Foot({ className, ...rest }) {
|
|
1351
|
+
return /* @__PURE__ */ jsx21("tfoot", { className: cx("sc-table__foot", className), ...rest });
|
|
1352
|
+
}
|
|
1353
|
+
function Row({ selected = false, interactive = false, className, ...rest }) {
|
|
1354
|
+
return /* @__PURE__ */ jsx21(
|
|
1355
|
+
"tr",
|
|
1356
|
+
{
|
|
1357
|
+
className: cx("sc-table__row", className),
|
|
1358
|
+
"data-selected": selected || void 0,
|
|
1359
|
+
"data-interactive": interactive || void 0,
|
|
1360
|
+
"aria-selected": selected || void 0,
|
|
1361
|
+
...rest
|
|
1362
|
+
}
|
|
1363
|
+
);
|
|
1364
|
+
}
|
|
1365
|
+
function Header({
|
|
1366
|
+
align,
|
|
1367
|
+
numeric = false,
|
|
1368
|
+
nowrap = false,
|
|
1369
|
+
truncate = false,
|
|
1370
|
+
width,
|
|
1371
|
+
scope = "col",
|
|
1372
|
+
className,
|
|
1373
|
+
style,
|
|
1374
|
+
...rest
|
|
1375
|
+
}) {
|
|
1376
|
+
return /* @__PURE__ */ jsx21(
|
|
1377
|
+
"th",
|
|
1378
|
+
{
|
|
1379
|
+
scope,
|
|
1380
|
+
className: cx("sc-table__header", className),
|
|
1381
|
+
"data-align": align ?? (numeric ? "end" : void 0),
|
|
1382
|
+
"data-numeric": numeric || void 0,
|
|
1383
|
+
"data-nowrap": nowrap || void 0,
|
|
1384
|
+
"data-truncate": truncate || void 0,
|
|
1385
|
+
style: width ? { ...style, inlineSize: width } : style,
|
|
1386
|
+
...rest
|
|
1387
|
+
}
|
|
1388
|
+
);
|
|
1389
|
+
}
|
|
1390
|
+
function Cell({
|
|
1391
|
+
align,
|
|
1392
|
+
numeric = false,
|
|
1393
|
+
nowrap = false,
|
|
1394
|
+
truncate = false,
|
|
1395
|
+
width,
|
|
1396
|
+
className,
|
|
1397
|
+
style,
|
|
1398
|
+
...rest
|
|
1399
|
+
}) {
|
|
1400
|
+
return /* @__PURE__ */ jsx21(
|
|
1401
|
+
"td",
|
|
1402
|
+
{
|
|
1403
|
+
className: cx("sc-table__cell", className),
|
|
1404
|
+
"data-align": align ?? (numeric ? "end" : void 0),
|
|
1405
|
+
"data-numeric": numeric || void 0,
|
|
1406
|
+
"data-nowrap": nowrap || void 0,
|
|
1407
|
+
"data-truncate": truncate || void 0,
|
|
1408
|
+
style: width ? { ...style, inlineSize: width } : style,
|
|
1409
|
+
...rest
|
|
1410
|
+
}
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
var Table = { Root: Root5, Caption, Head, Body: Body2, Foot, Row, Header, Cell };
|
|
1414
|
+
|
|
1415
|
+
// src/components/Stat/Stat.tsx
|
|
1416
|
+
import { createElement as createElement5 } from "react";
|
|
1417
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1418
|
+
var trendIcons = {
|
|
1419
|
+
up: /* @__PURE__ */ jsx22(ArrowUpIcon, { size: "xs" }),
|
|
1420
|
+
down: /* @__PURE__ */ jsx22(ArrowDownIcon, { size: "xs" }),
|
|
1421
|
+
flat: /* @__PURE__ */ jsx22(ArrowRightIcon, { size: "xs" })
|
|
1422
|
+
};
|
|
1423
|
+
function Stat({
|
|
1424
|
+
label,
|
|
1425
|
+
value,
|
|
1426
|
+
delta,
|
|
1427
|
+
deltaTone = "neutral",
|
|
1428
|
+
trend,
|
|
1429
|
+
hint,
|
|
1430
|
+
icon,
|
|
1431
|
+
variant = "outlined",
|
|
1432
|
+
size = "md",
|
|
1433
|
+
as = "div",
|
|
1434
|
+
className,
|
|
1435
|
+
...rest
|
|
1436
|
+
}) {
|
|
1437
|
+
return createElement5(
|
|
1438
|
+
as,
|
|
1439
|
+
{
|
|
1440
|
+
className: cx("sc-stat", className),
|
|
1441
|
+
"data-variant": variant,
|
|
1442
|
+
"data-size": size,
|
|
1443
|
+
...rest
|
|
1444
|
+
},
|
|
1445
|
+
/* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
1446
|
+
/* @__PURE__ */ jsx22("div", { className: "sc-stat__label", children: label }),
|
|
1447
|
+
icon ? /* @__PURE__ */ jsx22("span", { className: "sc-stat__icon", "aria-hidden": "true", children: icon }) : null,
|
|
1448
|
+
/* @__PURE__ */ jsx22("div", { className: "sc-stat__value", children: value }),
|
|
1449
|
+
delta != null ? /* @__PURE__ */ jsxs18("div", { className: "sc-stat__delta", "data-tone": deltaTone, children: [
|
|
1450
|
+
trend ? /* @__PURE__ */ jsx22("span", { className: "sc-stat__trend", "aria-hidden": "true", children: trendIcons[trend] }) : null,
|
|
1451
|
+
trend ? /* @__PURE__ */ jsxs18("span", { className: "sc-visually-hidden", children: [
|
|
1452
|
+
trend === "flat" ? "unchanged" : trend,
|
|
1453
|
+
" "
|
|
1454
|
+
] }) : null,
|
|
1455
|
+
delta
|
|
1456
|
+
] }) : null,
|
|
1457
|
+
hint != null ? /* @__PURE__ */ jsx22("div", { className: "sc-stat__hint", children: hint }) : null
|
|
1458
|
+
] })
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1461
|
+
|
|
740
1462
|
// src/index.ts
|
|
741
1463
|
var version = "0.1.1";
|
|
742
1464
|
export {
|
|
743
1465
|
ArchiveIcon,
|
|
1466
|
+
ArrowDownIcon,
|
|
744
1467
|
ArrowLeftIcon,
|
|
745
1468
|
ArrowRightIcon,
|
|
1469
|
+
ArrowUpIcon,
|
|
746
1470
|
Badge,
|
|
1471
|
+
Banner,
|
|
747
1472
|
BellIcon,
|
|
748
1473
|
BriefcaseIcon,
|
|
749
1474
|
Button,
|
|
750
1475
|
CalendarIcon,
|
|
751
1476
|
Card,
|
|
752
1477
|
CheckIcon,
|
|
1478
|
+
Checkbox,
|
|
753
1479
|
ChevronDownIcon,
|
|
754
1480
|
ChevronLeftIcon,
|
|
755
1481
|
ChevronRightIcon,
|
|
@@ -766,11 +1492,13 @@ export {
|
|
|
766
1492
|
EyeIcon,
|
|
767
1493
|
FilterIcon,
|
|
768
1494
|
FlagIcon,
|
|
1495
|
+
Heading,
|
|
769
1496
|
Icon,
|
|
770
1497
|
IconButton,
|
|
771
1498
|
InboxIcon,
|
|
772
1499
|
InfoIcon,
|
|
773
1500
|
Inline,
|
|
1501
|
+
Input,
|
|
774
1502
|
Kbd,
|
|
775
1503
|
LinkIcon,
|
|
776
1504
|
MailIcon,
|
|
@@ -784,14 +1512,24 @@ export {
|
|
|
784
1512
|
PauseIcon,
|
|
785
1513
|
PlayIcon,
|
|
786
1514
|
PlusIcon,
|
|
1515
|
+
Progress,
|
|
787
1516
|
RefreshIcon,
|
|
788
1517
|
SearchIcon,
|
|
1518
|
+
Select,
|
|
789
1519
|
SettingsIcon,
|
|
1520
|
+
Spinner,
|
|
790
1521
|
Stack,
|
|
791
1522
|
StarIcon,
|
|
1523
|
+
Stat,
|
|
792
1524
|
SunIcon,
|
|
1525
|
+
Switch,
|
|
1526
|
+
Table,
|
|
1527
|
+
Tabs,
|
|
1528
|
+
Text,
|
|
1529
|
+
Textarea,
|
|
793
1530
|
ThumbsDownIcon,
|
|
794
1531
|
ThumbsUpIcon,
|
|
1532
|
+
Toolbar,
|
|
795
1533
|
Tooltip,
|
|
796
1534
|
TrashIcon,
|
|
797
1535
|
UndoIcon,
|