@salemcobalt/ui 0.2.0-rc.0 → 0.2.0-rc.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/README.md +56 -13
- package/dist/index.d.ts +598 -12
- package/dist/index.js +568 -0
- package/dist/index.js.map +1 -1
- package/dist/styles.css +966 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -737,6 +737,562 @@ var Menu = {
|
|
|
737
737
|
Separator
|
|
738
738
|
};
|
|
739
739
|
|
|
740
|
+
// src/components/Input/Input.tsx
|
|
741
|
+
import { Field as Field2 } from "@base-ui/react/field";
|
|
742
|
+
|
|
743
|
+
// src/components/Field/FieldShell.tsx
|
|
744
|
+
import { Field } from "@base-ui/react/field";
|
|
745
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
746
|
+
function FieldShell({
|
|
747
|
+
label,
|
|
748
|
+
hideLabel = false,
|
|
749
|
+
description,
|
|
750
|
+
error,
|
|
751
|
+
invalid = false,
|
|
752
|
+
required = false,
|
|
753
|
+
disabled = false,
|
|
754
|
+
name,
|
|
755
|
+
size = "md",
|
|
756
|
+
className,
|
|
757
|
+
children
|
|
758
|
+
}) {
|
|
759
|
+
return /* @__PURE__ */ jsxs9(
|
|
760
|
+
Field.Root,
|
|
761
|
+
{
|
|
762
|
+
className: cx("sc-field", className),
|
|
763
|
+
name,
|
|
764
|
+
disabled,
|
|
765
|
+
invalid: invalid || error != null,
|
|
766
|
+
"data-size": size,
|
|
767
|
+
children: [
|
|
768
|
+
/* @__PURE__ */ jsxs9(Field.Label, { className: cx("sc-field__label", hideLabel && "sc-visually-hidden"), children: [
|
|
769
|
+
label,
|
|
770
|
+
required ? /* @__PURE__ */ jsx10("span", { className: "sc-field__required", "aria-hidden": "true", children: "*" }) : null
|
|
771
|
+
] }),
|
|
772
|
+
children,
|
|
773
|
+
description != null ? /* @__PURE__ */ jsx10(Field.Description, { className: "sc-field__description", children: description }) : null,
|
|
774
|
+
error != null ? /* @__PURE__ */ jsx10(Field.Error, { className: "sc-field__error", match: true, children: error }) : null
|
|
775
|
+
]
|
|
776
|
+
}
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// src/components/Input/Input.tsx
|
|
781
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
782
|
+
function Input({
|
|
783
|
+
label,
|
|
784
|
+
hideLabel,
|
|
785
|
+
description,
|
|
786
|
+
error,
|
|
787
|
+
invalid,
|
|
788
|
+
required,
|
|
789
|
+
disabled,
|
|
790
|
+
name,
|
|
791
|
+
size,
|
|
792
|
+
className,
|
|
793
|
+
iconStart,
|
|
794
|
+
iconEnd,
|
|
795
|
+
onValueChange,
|
|
796
|
+
...rest
|
|
797
|
+
}) {
|
|
798
|
+
return /* @__PURE__ */ jsx11(
|
|
799
|
+
FieldShell,
|
|
800
|
+
{
|
|
801
|
+
label,
|
|
802
|
+
hideLabel,
|
|
803
|
+
description,
|
|
804
|
+
error,
|
|
805
|
+
invalid,
|
|
806
|
+
required,
|
|
807
|
+
disabled,
|
|
808
|
+
name,
|
|
809
|
+
size,
|
|
810
|
+
className,
|
|
811
|
+
children: /* @__PURE__ */ jsxs10(
|
|
812
|
+
"span",
|
|
813
|
+
{
|
|
814
|
+
className: "sc-input-wrap",
|
|
815
|
+
"data-icon-start": iconStart ? "" : void 0,
|
|
816
|
+
"data-icon-end": iconEnd ? "" : void 0,
|
|
817
|
+
children: [
|
|
818
|
+
iconStart ? /* @__PURE__ */ jsx11("span", { className: "sc-input__icon", "data-side": "start", "aria-hidden": "true", children: iconStart }) : null,
|
|
819
|
+
/* @__PURE__ */ jsx11(
|
|
820
|
+
Field2.Control,
|
|
821
|
+
{
|
|
822
|
+
className: "sc-input",
|
|
823
|
+
required,
|
|
824
|
+
onValueChange: onValueChange ? (value) => onValueChange(value) : void 0,
|
|
825
|
+
...rest
|
|
826
|
+
}
|
|
827
|
+
),
|
|
828
|
+
iconEnd ? /* @__PURE__ */ jsx11("span", { className: "sc-input__icon", "data-side": "end", "aria-hidden": "true", children: iconEnd }) : null
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
)
|
|
832
|
+
}
|
|
833
|
+
);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// src/components/Textarea/Textarea.tsx
|
|
837
|
+
import { Field as Field3 } from "@base-ui/react/field";
|
|
838
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
839
|
+
function Textarea({
|
|
840
|
+
label,
|
|
841
|
+
hideLabel,
|
|
842
|
+
description,
|
|
843
|
+
error,
|
|
844
|
+
invalid,
|
|
845
|
+
required,
|
|
846
|
+
disabled,
|
|
847
|
+
name,
|
|
848
|
+
className,
|
|
849
|
+
rows = 3,
|
|
850
|
+
resize = "vertical",
|
|
851
|
+
onValueChange,
|
|
852
|
+
...rest
|
|
853
|
+
}) {
|
|
854
|
+
return /* @__PURE__ */ jsx12(
|
|
855
|
+
FieldShell,
|
|
856
|
+
{
|
|
857
|
+
label,
|
|
858
|
+
hideLabel,
|
|
859
|
+
description,
|
|
860
|
+
error,
|
|
861
|
+
invalid,
|
|
862
|
+
required,
|
|
863
|
+
disabled,
|
|
864
|
+
name,
|
|
865
|
+
className,
|
|
866
|
+
children: /* @__PURE__ */ jsx12(
|
|
867
|
+
Field3.Control,
|
|
868
|
+
{
|
|
869
|
+
render: /* @__PURE__ */ jsx12("textarea", { rows, ...rest }),
|
|
870
|
+
className: "sc-input sc-textarea",
|
|
871
|
+
"data-resize": resize,
|
|
872
|
+
required,
|
|
873
|
+
onValueChange: onValueChange ? (value) => onValueChange(value) : void 0
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
}
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// src/components/Select/Select.tsx
|
|
881
|
+
import { Select as BaseSelect } from "@base-ui/react/select";
|
|
882
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
883
|
+
function isGroup(entry) {
|
|
884
|
+
return "options" in entry;
|
|
885
|
+
}
|
|
886
|
+
function Option({ option }) {
|
|
887
|
+
return /* @__PURE__ */ jsxs11(BaseSelect.Item, { value: option.value, disabled: option.disabled, className: "sc-select__item", children: [
|
|
888
|
+
/* @__PURE__ */ jsx13(BaseSelect.ItemIndicator, { className: "sc-select__indicator", children: /* @__PURE__ */ jsx13(CheckIcon, { size: "sm" }) }),
|
|
889
|
+
/* @__PURE__ */ jsx13(BaseSelect.ItemText, { className: "sc-select__item-text", children: option.label })
|
|
890
|
+
] });
|
|
891
|
+
}
|
|
892
|
+
function Select({
|
|
893
|
+
label,
|
|
894
|
+
hideLabel,
|
|
895
|
+
description,
|
|
896
|
+
error,
|
|
897
|
+
invalid,
|
|
898
|
+
required,
|
|
899
|
+
disabled,
|
|
900
|
+
name,
|
|
901
|
+
size = "md",
|
|
902
|
+
className,
|
|
903
|
+
options,
|
|
904
|
+
value,
|
|
905
|
+
defaultValue,
|
|
906
|
+
onValueChange,
|
|
907
|
+
placeholder = "Choose\u2026",
|
|
908
|
+
readOnly,
|
|
909
|
+
fullWidth = false,
|
|
910
|
+
id
|
|
911
|
+
}) {
|
|
912
|
+
const items = options.flatMap((entry) => isGroup(entry) ? entry.options : [entry]);
|
|
913
|
+
return /* @__PURE__ */ jsx13(
|
|
914
|
+
FieldShell,
|
|
915
|
+
{
|
|
916
|
+
label,
|
|
917
|
+
hideLabel,
|
|
918
|
+
description,
|
|
919
|
+
error,
|
|
920
|
+
invalid,
|
|
921
|
+
required,
|
|
922
|
+
disabled,
|
|
923
|
+
name,
|
|
924
|
+
size,
|
|
925
|
+
className,
|
|
926
|
+
children: /* @__PURE__ */ jsxs11(
|
|
927
|
+
BaseSelect.Root,
|
|
928
|
+
{
|
|
929
|
+
items,
|
|
930
|
+
value,
|
|
931
|
+
defaultValue,
|
|
932
|
+
onValueChange: onValueChange ? (next) => onValueChange(next) : void 0,
|
|
933
|
+
disabled,
|
|
934
|
+
required,
|
|
935
|
+
readOnly,
|
|
936
|
+
children: [
|
|
937
|
+
/* @__PURE__ */ jsxs11(
|
|
938
|
+
BaseSelect.Trigger,
|
|
939
|
+
{
|
|
940
|
+
id,
|
|
941
|
+
className: "sc-select",
|
|
942
|
+
"data-size": size,
|
|
943
|
+
"data-full-width": fullWidth || void 0,
|
|
944
|
+
children: [
|
|
945
|
+
/* @__PURE__ */ jsx13(BaseSelect.Value, { className: "sc-select__value", placeholder }),
|
|
946
|
+
/* @__PURE__ */ jsx13(BaseSelect.Icon, { className: "sc-select__icon", children: /* @__PURE__ */ jsx13(ChevronDownIcon, {}) })
|
|
947
|
+
]
|
|
948
|
+
}
|
|
949
|
+
),
|
|
950
|
+
/* @__PURE__ */ jsx13(BaseSelect.Portal, { children: /* @__PURE__ */ jsx13(
|
|
951
|
+
BaseSelect.Positioner,
|
|
952
|
+
{
|
|
953
|
+
className: "sc-select__positioner",
|
|
954
|
+
sideOffset: 4,
|
|
955
|
+
alignItemWithTrigger: false,
|
|
956
|
+
children: /* @__PURE__ */ jsx13(BaseSelect.Popup, { className: "sc-select__popup", children: /* @__PURE__ */ jsx13(BaseSelect.List, { children: options.map(
|
|
957
|
+
(entry, i) => isGroup(entry) ? /* @__PURE__ */ jsxs11(BaseSelect.Group, { className: "sc-select__group", children: [
|
|
958
|
+
/* @__PURE__ */ jsx13(BaseSelect.GroupLabel, { className: "sc-select__group-label", children: entry.label }),
|
|
959
|
+
entry.options.map((option) => /* @__PURE__ */ jsx13(Option, { option }, option.value))
|
|
960
|
+
] }, i) : /* @__PURE__ */ jsx13(Option, { option: entry }, entry.value)
|
|
961
|
+
) }) })
|
|
962
|
+
}
|
|
963
|
+
) })
|
|
964
|
+
]
|
|
965
|
+
}
|
|
966
|
+
)
|
|
967
|
+
}
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
972
|
+
import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox";
|
|
973
|
+
import { useId } from "react";
|
|
974
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
975
|
+
function Checkbox({
|
|
976
|
+
label,
|
|
977
|
+
description,
|
|
978
|
+
onCheckedChange,
|
|
979
|
+
className,
|
|
980
|
+
disabled,
|
|
981
|
+
...rest
|
|
982
|
+
}) {
|
|
983
|
+
const descriptionId = useId();
|
|
984
|
+
return /* @__PURE__ */ jsxs12("div", { className: cx("sc-choice", className), "data-disabled": disabled || void 0, children: [
|
|
985
|
+
/* @__PURE__ */ jsxs12("label", { className: "sc-choice__control", children: [
|
|
986
|
+
/* @__PURE__ */ jsx14(
|
|
987
|
+
BaseCheckbox.Root,
|
|
988
|
+
{
|
|
989
|
+
className: "sc-checkbox",
|
|
990
|
+
disabled,
|
|
991
|
+
"aria-describedby": description != null ? descriptionId : void 0,
|
|
992
|
+
onCheckedChange: onCheckedChange ? (checked) => onCheckedChange(checked) : void 0,
|
|
993
|
+
...rest,
|
|
994
|
+
children: /* @__PURE__ */ jsxs12(BaseCheckbox.Indicator, { className: "sc-checkbox__indicator", children: [
|
|
995
|
+
/* @__PURE__ */ jsx14(CheckIcon, { size: "sm", className: "sc-checkbox__check" }),
|
|
996
|
+
/* @__PURE__ */ jsx14(MinusIcon, { size: "sm", className: "sc-checkbox__dash" })
|
|
997
|
+
] })
|
|
998
|
+
}
|
|
999
|
+
),
|
|
1000
|
+
/* @__PURE__ */ jsx14("span", { className: "sc-choice__label", children: label })
|
|
1001
|
+
] }),
|
|
1002
|
+
description != null ? /* @__PURE__ */ jsx14("span", { className: "sc-choice__description", id: descriptionId, children: description }) : null
|
|
1003
|
+
] });
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// src/components/Switch/Switch.tsx
|
|
1007
|
+
import { Switch as BaseSwitch } from "@base-ui/react/switch";
|
|
1008
|
+
import { useId as useId2 } from "react";
|
|
1009
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1010
|
+
function Switch({
|
|
1011
|
+
label,
|
|
1012
|
+
description,
|
|
1013
|
+
onCheckedChange,
|
|
1014
|
+
labelPosition = "end",
|
|
1015
|
+
className,
|
|
1016
|
+
disabled,
|
|
1017
|
+
...rest
|
|
1018
|
+
}) {
|
|
1019
|
+
const descriptionId = useId2();
|
|
1020
|
+
return /* @__PURE__ */ jsxs13(
|
|
1021
|
+
"div",
|
|
1022
|
+
{
|
|
1023
|
+
className: cx("sc-choice", className),
|
|
1024
|
+
"data-disabled": disabled || void 0,
|
|
1025
|
+
"data-label-position": labelPosition,
|
|
1026
|
+
children: [
|
|
1027
|
+
/* @__PURE__ */ jsxs13("label", { className: "sc-choice__control", children: [
|
|
1028
|
+
/* @__PURE__ */ jsx15(
|
|
1029
|
+
BaseSwitch.Root,
|
|
1030
|
+
{
|
|
1031
|
+
className: "sc-switch",
|
|
1032
|
+
disabled,
|
|
1033
|
+
"aria-describedby": description != null ? descriptionId : void 0,
|
|
1034
|
+
onCheckedChange: onCheckedChange ? (checked) => onCheckedChange(checked) : void 0,
|
|
1035
|
+
...rest,
|
|
1036
|
+
children: /* @__PURE__ */ jsx15(BaseSwitch.Thumb, { className: "sc-switch__thumb" })
|
|
1037
|
+
}
|
|
1038
|
+
),
|
|
1039
|
+
/* @__PURE__ */ jsx15("span", { className: "sc-choice__label", children: label })
|
|
1040
|
+
] }),
|
|
1041
|
+
description != null ? /* @__PURE__ */ jsx15("span", { className: "sc-choice__description", id: descriptionId, children: description }) : null
|
|
1042
|
+
]
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
// src/components/Tabs/Tabs.tsx
|
|
1048
|
+
import { Tabs as BaseTabs } from "@base-ui/react/tabs";
|
|
1049
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1050
|
+
function Root3({ className, onValueChange, ...rest }) {
|
|
1051
|
+
return /* @__PURE__ */ jsx16(
|
|
1052
|
+
BaseTabs.Root,
|
|
1053
|
+
{
|
|
1054
|
+
className: cx("sc-tabs", className),
|
|
1055
|
+
onValueChange: onValueChange ? (value) => onValueChange(String(value)) : void 0,
|
|
1056
|
+
...rest
|
|
1057
|
+
}
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
function List({ fill = false, className, children, ...rest }) {
|
|
1061
|
+
return /* @__PURE__ */ jsxs14(BaseTabs.List, { className: cx("sc-tabs__list", className), "data-fill": fill || void 0, ...rest, children: [
|
|
1062
|
+
children,
|
|
1063
|
+
/* @__PURE__ */ jsx16(BaseTabs.Indicator, { className: "sc-tabs__indicator" })
|
|
1064
|
+
] });
|
|
1065
|
+
}
|
|
1066
|
+
function Tab({ icon, count, className, children, ...rest }) {
|
|
1067
|
+
return /* @__PURE__ */ jsxs14(BaseTabs.Tab, { className: cx("sc-tabs__tab", className), ...rest, children: [
|
|
1068
|
+
icon ? /* @__PURE__ */ jsx16("span", { className: "sc-tabs__icon", "aria-hidden": "true", children: icon }) : null,
|
|
1069
|
+
/* @__PURE__ */ jsx16("span", { className: "sc-tabs__label", children }),
|
|
1070
|
+
count != null ? /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
1071
|
+
" ",
|
|
1072
|
+
/* @__PURE__ */ jsx16("span", { className: "sc-tabs__count", children: count })
|
|
1073
|
+
] }) : null
|
|
1074
|
+
] });
|
|
1075
|
+
}
|
|
1076
|
+
function Panel({ className, ...rest }) {
|
|
1077
|
+
return /* @__PURE__ */ jsx16(BaseTabs.Panel, { className: cx("sc-tabs__panel", className), ...rest });
|
|
1078
|
+
}
|
|
1079
|
+
var Tabs = { Root: Root3, List, Tab, Panel };
|
|
1080
|
+
|
|
1081
|
+
// src/components/Toolbar/Toolbar.tsx
|
|
1082
|
+
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
1083
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1084
|
+
function Root4({ wrap = true, gap = "xs", className, ...rest }) {
|
|
1085
|
+
return /* @__PURE__ */ jsx17(
|
|
1086
|
+
BaseToolbar.Root,
|
|
1087
|
+
{
|
|
1088
|
+
className: cx("sc-toolbar", className),
|
|
1089
|
+
"data-wrap": wrap || void 0,
|
|
1090
|
+
"data-gap": gap,
|
|
1091
|
+
...rest
|
|
1092
|
+
}
|
|
1093
|
+
);
|
|
1094
|
+
}
|
|
1095
|
+
function Group2({ gap = "2xs", className, ...rest }) {
|
|
1096
|
+
return /* @__PURE__ */ jsx17(BaseToolbar.Group, { className: cx("sc-toolbar__group", className), "data-gap": gap, ...rest });
|
|
1097
|
+
}
|
|
1098
|
+
function Separator2({ className, ...rest }) {
|
|
1099
|
+
return /* @__PURE__ */ jsx17(BaseToolbar.Separator, { className: cx("sc-toolbar__separator", className), ...rest });
|
|
1100
|
+
}
|
|
1101
|
+
var Button2 = BaseToolbar.Button;
|
|
1102
|
+
function Spacer({ className }) {
|
|
1103
|
+
return /* @__PURE__ */ jsx17("div", { className: cx("sc-toolbar__spacer", className), "aria-hidden": "true" });
|
|
1104
|
+
}
|
|
1105
|
+
var Toolbar = { Root: Root4, Group: Group2, Separator: Separator2, Button: Button2, Spacer };
|
|
1106
|
+
|
|
1107
|
+
// src/components/Banner/Banner.tsx
|
|
1108
|
+
import { useState } from "react";
|
|
1109
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1110
|
+
var toneIcons = {
|
|
1111
|
+
info: /* @__PURE__ */ jsx18(InfoIcon, {}),
|
|
1112
|
+
success: /* @__PURE__ */ jsx18(CircleCheckIcon, {}),
|
|
1113
|
+
warning: /* @__PURE__ */ jsx18(WarningIcon, {}),
|
|
1114
|
+
danger: /* @__PURE__ */ jsx18(CircleXIcon, {}),
|
|
1115
|
+
neutral: null
|
|
1116
|
+
};
|
|
1117
|
+
function Banner({
|
|
1118
|
+
tone = "info",
|
|
1119
|
+
icon,
|
|
1120
|
+
action,
|
|
1121
|
+
dismissible = false,
|
|
1122
|
+
onDismiss,
|
|
1123
|
+
open,
|
|
1124
|
+
dismissLabel = "Dismiss",
|
|
1125
|
+
role,
|
|
1126
|
+
className,
|
|
1127
|
+
children,
|
|
1128
|
+
...rest
|
|
1129
|
+
}) {
|
|
1130
|
+
const [dismissed, setDismissed] = useState(false);
|
|
1131
|
+
const visible = open ?? !dismissed;
|
|
1132
|
+
if (!visible) return null;
|
|
1133
|
+
const glyph = icon === false ? null : icon ?? toneIcons[tone];
|
|
1134
|
+
return /* @__PURE__ */ jsxs15(
|
|
1135
|
+
"div",
|
|
1136
|
+
{
|
|
1137
|
+
role: role ?? (tone === "warning" || tone === "danger" ? "alert" : "status"),
|
|
1138
|
+
className: cx("sc-banner", className),
|
|
1139
|
+
"data-tone": tone,
|
|
1140
|
+
...rest,
|
|
1141
|
+
children: [
|
|
1142
|
+
glyph ? /* @__PURE__ */ jsx18("span", { className: "sc-banner__icon", "aria-hidden": "true", children: glyph }) : null,
|
|
1143
|
+
/* @__PURE__ */ jsx18("div", { className: "sc-banner__body", children }),
|
|
1144
|
+
action ? /* @__PURE__ */ jsx18("div", { className: "sc-banner__action", children: action }) : null,
|
|
1145
|
+
dismissible ? /* @__PURE__ */ jsx18(
|
|
1146
|
+
IconButton,
|
|
1147
|
+
{
|
|
1148
|
+
label: dismissLabel,
|
|
1149
|
+
size: "sm",
|
|
1150
|
+
className: "sc-banner__dismiss",
|
|
1151
|
+
onClick: () => {
|
|
1152
|
+
setDismissed(true);
|
|
1153
|
+
onDismiss?.();
|
|
1154
|
+
},
|
|
1155
|
+
children: /* @__PURE__ */ jsx18(XIcon, {})
|
|
1156
|
+
}
|
|
1157
|
+
) : null
|
|
1158
|
+
]
|
|
1159
|
+
}
|
|
1160
|
+
);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// src/components/Spinner/Spinner.tsx
|
|
1164
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1165
|
+
function Spinner({
|
|
1166
|
+
size = "md",
|
|
1167
|
+
label = "Loading",
|
|
1168
|
+
decorative = false,
|
|
1169
|
+
className,
|
|
1170
|
+
...rest
|
|
1171
|
+
}) {
|
|
1172
|
+
return /* @__PURE__ */ jsx19(
|
|
1173
|
+
"span",
|
|
1174
|
+
{
|
|
1175
|
+
className: cx("sc-spinner", className),
|
|
1176
|
+
"data-size": size,
|
|
1177
|
+
role: decorative ? void 0 : "status",
|
|
1178
|
+
"aria-label": decorative ? void 0 : label,
|
|
1179
|
+
"aria-hidden": decorative || void 0,
|
|
1180
|
+
...rest,
|
|
1181
|
+
children: /* @__PURE__ */ jsxs16(
|
|
1182
|
+
"svg",
|
|
1183
|
+
{
|
|
1184
|
+
viewBox: "0 0 16 16",
|
|
1185
|
+
fill: "none",
|
|
1186
|
+
stroke: "currentColor",
|
|
1187
|
+
strokeWidth: "1.75",
|
|
1188
|
+
"aria-hidden": "true",
|
|
1189
|
+
focusable: "false",
|
|
1190
|
+
children: [
|
|
1191
|
+
/* @__PURE__ */ jsx19("circle", { className: "sc-spinner__track", cx: "8", cy: "8", r: "6.25" }),
|
|
1192
|
+
/* @__PURE__ */ jsx19("circle", { className: "sc-spinner__arc", cx: "8", cy: "8", r: "6.25", strokeLinecap: "round" })
|
|
1193
|
+
]
|
|
1194
|
+
}
|
|
1195
|
+
)
|
|
1196
|
+
}
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
// src/components/Progress/Progress.tsx
|
|
1201
|
+
import { Progress as BaseProgress } from "@base-ui/react/progress";
|
|
1202
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1203
|
+
function Progress({
|
|
1204
|
+
value,
|
|
1205
|
+
max = 100,
|
|
1206
|
+
min = 0,
|
|
1207
|
+
label,
|
|
1208
|
+
valueText,
|
|
1209
|
+
showValue = false,
|
|
1210
|
+
tone = "accent",
|
|
1211
|
+
size = "md",
|
|
1212
|
+
variant = "bar",
|
|
1213
|
+
className,
|
|
1214
|
+
...rest
|
|
1215
|
+
}) {
|
|
1216
|
+
const current = value ?? null;
|
|
1217
|
+
const hasValueText = valueText != null || showValue && current !== null;
|
|
1218
|
+
return /* @__PURE__ */ jsxs17(
|
|
1219
|
+
BaseProgress.Root,
|
|
1220
|
+
{
|
|
1221
|
+
value: current,
|
|
1222
|
+
max,
|
|
1223
|
+
min,
|
|
1224
|
+
getAriaValueText: (formatted) => typeof valueText === "string" ? valueText : formatted ?? "",
|
|
1225
|
+
className: cx("sc-progress", className),
|
|
1226
|
+
"data-variant": variant,
|
|
1227
|
+
"data-tone": tone,
|
|
1228
|
+
"data-size": size,
|
|
1229
|
+
...rest,
|
|
1230
|
+
children: [
|
|
1231
|
+
variant === "inline" ? /* @__PURE__ */ jsx20(Spinner, { size: "sm", decorative: true, className: "sc-progress__spinner" }) : null,
|
|
1232
|
+
label != null ? /* @__PURE__ */ jsx20(BaseProgress.Label, { className: "sc-progress__label", children: label }) : null,
|
|
1233
|
+
hasValueText ? /* @__PURE__ */ jsx20(BaseProgress.Value, { className: "sc-progress__value", children: (formatted) => valueText != null ? valueText : formatted }) : null,
|
|
1234
|
+
variant === "bar" ? /* @__PURE__ */ jsx20(BaseProgress.Track, { className: "sc-progress__track", children: /* @__PURE__ */ jsx20(BaseProgress.Indicator, { className: "sc-progress__indicator" }) }) : null
|
|
1235
|
+
]
|
|
1236
|
+
}
|
|
1237
|
+
);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
// src/components/Heading/Heading.tsx
|
|
1241
|
+
import { createElement as createElement3 } from "react";
|
|
1242
|
+
var sizeByLevel = {
|
|
1243
|
+
1: "3xl",
|
|
1244
|
+
2: "2xl",
|
|
1245
|
+
3: "xl",
|
|
1246
|
+
4: "lg",
|
|
1247
|
+
5: "md",
|
|
1248
|
+
6: "sm"
|
|
1249
|
+
};
|
|
1250
|
+
function Heading({
|
|
1251
|
+
level = 2,
|
|
1252
|
+
size,
|
|
1253
|
+
as,
|
|
1254
|
+
tone = "default",
|
|
1255
|
+
truncate = false,
|
|
1256
|
+
className,
|
|
1257
|
+
...rest
|
|
1258
|
+
}) {
|
|
1259
|
+
return createElement3(as ?? `h${level}`, {
|
|
1260
|
+
className: cx("sc-heading", className),
|
|
1261
|
+
"data-size": size ?? sizeByLevel[level],
|
|
1262
|
+
"data-tone": tone,
|
|
1263
|
+
"data-truncate": truncate || void 0,
|
|
1264
|
+
...rest
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/components/Text/Text.tsx
|
|
1269
|
+
import { createElement as createElement4 } from "react";
|
|
1270
|
+
function Text({
|
|
1271
|
+
as = "p",
|
|
1272
|
+
size = "sm",
|
|
1273
|
+
tone = "default",
|
|
1274
|
+
weight = "regular",
|
|
1275
|
+
align,
|
|
1276
|
+
truncate = false,
|
|
1277
|
+
numeric = false,
|
|
1278
|
+
className,
|
|
1279
|
+
style,
|
|
1280
|
+
...rest
|
|
1281
|
+
}) {
|
|
1282
|
+
const clamp = typeof truncate === "number" ? truncate : void 0;
|
|
1283
|
+
return createElement4(as, {
|
|
1284
|
+
className: cx("sc-text", className),
|
|
1285
|
+
"data-size": size,
|
|
1286
|
+
"data-tone": tone,
|
|
1287
|
+
"data-weight": weight,
|
|
1288
|
+
"data-align": align,
|
|
1289
|
+
"data-truncate": truncate === true ? "" : clamp !== void 0 ? "clamp" : void 0,
|
|
1290
|
+
"data-numeric": numeric || void 0,
|
|
1291
|
+
style: clamp !== void 0 ? { ...style, "--sc-text-lines": clamp } : style,
|
|
1292
|
+
...rest
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
|
|
740
1296
|
// src/index.ts
|
|
741
1297
|
var version = "0.1.1";
|
|
742
1298
|
export {
|
|
@@ -744,12 +1300,14 @@ export {
|
|
|
744
1300
|
ArrowLeftIcon,
|
|
745
1301
|
ArrowRightIcon,
|
|
746
1302
|
Badge,
|
|
1303
|
+
Banner,
|
|
747
1304
|
BellIcon,
|
|
748
1305
|
BriefcaseIcon,
|
|
749
1306
|
Button,
|
|
750
1307
|
CalendarIcon,
|
|
751
1308
|
Card,
|
|
752
1309
|
CheckIcon,
|
|
1310
|
+
Checkbox,
|
|
753
1311
|
ChevronDownIcon,
|
|
754
1312
|
ChevronLeftIcon,
|
|
755
1313
|
ChevronRightIcon,
|
|
@@ -766,11 +1324,13 @@ export {
|
|
|
766
1324
|
EyeIcon,
|
|
767
1325
|
FilterIcon,
|
|
768
1326
|
FlagIcon,
|
|
1327
|
+
Heading,
|
|
769
1328
|
Icon,
|
|
770
1329
|
IconButton,
|
|
771
1330
|
InboxIcon,
|
|
772
1331
|
InfoIcon,
|
|
773
1332
|
Inline,
|
|
1333
|
+
Input,
|
|
774
1334
|
Kbd,
|
|
775
1335
|
LinkIcon,
|
|
776
1336
|
MailIcon,
|
|
@@ -784,14 +1344,22 @@ export {
|
|
|
784
1344
|
PauseIcon,
|
|
785
1345
|
PlayIcon,
|
|
786
1346
|
PlusIcon,
|
|
1347
|
+
Progress,
|
|
787
1348
|
RefreshIcon,
|
|
788
1349
|
SearchIcon,
|
|
1350
|
+
Select,
|
|
789
1351
|
SettingsIcon,
|
|
1352
|
+
Spinner,
|
|
790
1353
|
Stack,
|
|
791
1354
|
StarIcon,
|
|
792
1355
|
SunIcon,
|
|
1356
|
+
Switch,
|
|
1357
|
+
Tabs,
|
|
1358
|
+
Text,
|
|
1359
|
+
Textarea,
|
|
793
1360
|
ThumbsDownIcon,
|
|
794
1361
|
ThumbsUpIcon,
|
|
1362
|
+
Toolbar,
|
|
795
1363
|
Tooltip,
|
|
796
1364
|
TrashIcon,
|
|
797
1365
|
UndoIcon,
|