@dimaan/ui 0.0.8 → 0.0.10

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
@@ -1,13 +1,59 @@
1
1
  'use strict';
2
2
 
3
+ var reactDirection = require('@radix-ui/react-direction');
3
4
  var react = require('react');
4
5
  var clsx = require('clsx');
5
6
  var tailwindMerge = require('tailwind-merge');
6
7
  var jsxRuntime = require('react/jsx-runtime');
7
8
  var lucideReact = require('lucide-react');
8
9
  var reactHookForm = require('react-hook-form');
10
+ var RadixRadioGroup = require('@radix-ui/react-radio-group');
11
+ var RadixSelect = require('@radix-ui/react-select');
12
+ var RadixSwitch = require('@radix-ui/react-switch');
9
13
 
10
- // src/components/dashboard-layout/context.ts
14
+ function _interopNamespace(e) {
15
+ if (e && e.__esModule) return e;
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n.default = e;
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ var RadixRadioGroup__namespace = /*#__PURE__*/_interopNamespace(RadixRadioGroup);
33
+ var RadixSelect__namespace = /*#__PURE__*/_interopNamespace(RadixSelect);
34
+ var RadixSwitch__namespace = /*#__PURE__*/_interopNamespace(RadixSwitch);
35
+
36
+ // src/components/app-shell/AppShell.tsx
37
+ function readDocumentDirection() {
38
+ if (typeof document === "undefined") return "ltr";
39
+ const dir = document.documentElement.getAttribute("dir");
40
+ return dir === "rtl" ? "rtl" : "ltr";
41
+ }
42
+ function useDirection() {
43
+ const [dir, setDir] = react.useState(() => readDocumentDirection());
44
+ react.useEffect(() => {
45
+ setDir(readDocumentDirection());
46
+ const observer = new MutationObserver(() => {
47
+ setDir(readDocumentDirection());
48
+ });
49
+ observer.observe(document.documentElement, {
50
+ attributes: true,
51
+ attributeFilter: ["dir"]
52
+ });
53
+ return () => observer.disconnect();
54
+ }, []);
55
+ return dir;
56
+ }
11
57
  var DashboardLayoutContext = react.createContext(null);
12
58
  function useDashboardLayout() {
13
59
  const ctx = react.useContext(DashboardLayoutContext);
@@ -601,7 +647,8 @@ function AppShell({
601
647
  onCollapsedChange,
602
648
  children
603
649
  }) {
604
- return /* @__PURE__ */ jsxRuntime.jsxs(
650
+ const dir = useDirection();
651
+ return /* @__PURE__ */ jsxRuntime.jsx(reactDirection.DirectionProvider, { dir, children: /* @__PURE__ */ jsxRuntime.jsxs(
605
652
  DashboardLayout,
606
653
  {
607
654
  defaultCollapsed,
@@ -646,7 +693,7 @@ function AppShell({
646
693
  ] })
647
694
  ]
648
695
  }
649
- );
696
+ ) });
650
697
  }
651
698
  var sizeClass = {
652
699
  sm: "h-7 w-7 text-xs",
@@ -782,6 +829,7 @@ function FieldShell({
782
829
  required = false,
783
830
  disabled = false,
784
831
  fullWidth = true,
832
+ orientation = "vertical",
785
833
  className,
786
834
  children
787
835
  }) {
@@ -804,39 +852,47 @@ function FieldShell({
804
852
  disabled: childProps.disabled ?? disabled,
805
853
  required: childProps.required ?? required
806
854
  });
855
+ const labelEl = label !== void 0 && label !== null ? /* @__PURE__ */ jsxRuntime.jsxs(
856
+ "label",
857
+ {
858
+ htmlFor: id,
859
+ className: cn(
860
+ "text-sm font-medium select-none text-foreground",
861
+ disabled && "opacity-50",
862
+ invalid && "text-destructive"
863
+ ),
864
+ children: [
865
+ label,
866
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "ms-0.5 text-destructive", children: "*" })
867
+ ]
868
+ }
869
+ ) : null;
870
+ const messageEl = showError ? /* @__PURE__ */ jsxRuntime.jsx(
871
+ "p",
872
+ {
873
+ id: errorId,
874
+ role: "alert",
875
+ "aria-live": "polite",
876
+ className: "text-xs font-medium text-destructive",
877
+ children: error
878
+ }
879
+ ) : showDescription ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: descriptionId, className: "text-xs text-muted-foreground", children: description }) : null;
807
880
  return /* @__PURE__ */ jsxRuntime.jsxs(
808
881
  "div",
809
882
  {
810
883
  "data-invalid": invalid || void 0,
811
884
  "data-disabled": disabled || void 0,
885
+ "data-orientation": orientation,
812
886
  className: cn("flex flex-col gap-1.5", fullWidth && "w-full", className),
813
887
  children: [
814
- label !== void 0 && label !== null && /* @__PURE__ */ jsxRuntime.jsxs(
815
- "label",
816
- {
817
- htmlFor: id,
818
- className: cn(
819
- "text-sm font-medium select-none text-foreground",
820
- disabled && "opacity-50",
821
- invalid && "text-destructive"
822
- ),
823
- children: [
824
- label,
825
- required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "ms-0.5 text-destructive", children: "*" })
826
- ]
827
- }
828
- ),
829
- enhancedChild,
830
- showError ? /* @__PURE__ */ jsxRuntime.jsx(
831
- "p",
832
- {
833
- id: errorId,
834
- role: "alert",
835
- "aria-live": "polite",
836
- className: "text-xs font-medium text-destructive",
837
- children: error
838
- }
839
- ) : showDescription ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: descriptionId, className: "text-xs text-muted-foreground", children: description }) : null
888
+ orientation === "horizontal" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
889
+ labelEl,
890
+ enhancedChild
891
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
892
+ labelEl,
893
+ enhancedChild
894
+ ] }),
895
+ messageEl
840
896
  ]
841
897
  }
842
898
  );
@@ -880,86 +936,67 @@ var inputBaseClass = "group/input relative inline-flex w-full items-center text-
880
936
  var Input = react.forwardRef(function Input2({
881
937
  variant = "default",
882
938
  inputSize = "md",
883
- label,
884
- helperText,
885
- error,
886
939
  leadingIcon,
887
940
  trailingIcon,
888
- fullWidth = true,
889
941
  type = "text",
890
942
  id,
891
943
  className,
892
944
  wrapperClassName,
893
- containerClassName,
894
- "aria-invalid": ariaInvalidProp,
895
- "aria-describedby": ariaDescribedByProp,
945
+ "aria-invalid": ariaInvalid,
946
+ "aria-describedby": ariaDescribedBy,
896
947
  disabled,
897
948
  ...props
898
949
  }, ref) {
899
950
  const generatedId = react.useId();
900
951
  const inputId = id ?? generatedId;
901
- const helperId = `${inputId}-helper`;
902
- const errorId = `${inputId}-error`;
903
- const hasError = error !== void 0 && error !== null && error !== false;
904
- const ariaInvalid = ariaInvalidProp ?? (hasError ? true : void 0);
905
- const describedByIds = [
906
- ariaDescribedByProp,
907
- hasError ? errorId : null,
908
- !hasError && helperText ? helperId : null
909
- ].filter(Boolean).join(" ");
910
- const ariaDescribedBy = describedByIds.length > 0 ? describedByIds : void 0;
911
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1.5", fullWidth && "w-full", containerClassName), children: [
912
- label !== void 0 && label !== null && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: inputId, className: "text-sm font-medium text-foreground select-none", children: label }),
913
- /* @__PURE__ */ jsxRuntime.jsxs(
914
- "div",
915
- {
916
- "data-slot": "input-wrapper",
917
- className: cn(
918
- inputBaseClass,
919
- inputVariantClass[variant],
920
- inputSizeClass[inputSize],
921
- wrapperClassName
952
+ return /* @__PURE__ */ jsxRuntime.jsxs(
953
+ "div",
954
+ {
955
+ "data-slot": "input-wrapper",
956
+ className: cn(
957
+ inputBaseClass,
958
+ inputVariantClass[variant],
959
+ inputSizeClass[inputSize],
960
+ wrapperClassName
961
+ ),
962
+ "aria-invalid": ariaInvalid,
963
+ "data-disabled": disabled ? "true" : void 0,
964
+ children: [
965
+ leadingIcon ? /* @__PURE__ */ jsxRuntime.jsx(
966
+ "span",
967
+ {
968
+ "aria-hidden": "true",
969
+ className: "inline-flex h-4 w-4 items-center justify-center text-muted-foreground",
970
+ children: leadingIcon
971
+ }
972
+ ) : null,
973
+ /* @__PURE__ */ jsxRuntime.jsx(
974
+ "input",
975
+ {
976
+ ref,
977
+ id: inputId,
978
+ type,
979
+ disabled,
980
+ "aria-invalid": ariaInvalid,
981
+ "aria-describedby": ariaDescribedBy,
982
+ className: cn(
983
+ "h-full w-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
984
+ className
985
+ ),
986
+ ...props
987
+ }
922
988
  ),
923
- "aria-invalid": ariaInvalid,
924
- "data-disabled": disabled ? "true" : void 0,
925
- children: [
926
- leadingIcon ? /* @__PURE__ */ jsxRuntime.jsx(
927
- "span",
928
- {
929
- "aria-hidden": "true",
930
- className: "inline-flex h-4 w-4 items-center justify-center text-muted-foreground",
931
- children: leadingIcon
932
- }
933
- ) : null,
934
- /* @__PURE__ */ jsxRuntime.jsx(
935
- "input",
936
- {
937
- ref,
938
- id: inputId,
939
- type,
940
- disabled,
941
- "aria-invalid": ariaInvalid,
942
- "aria-describedby": ariaDescribedBy,
943
- className: cn(
944
- "h-full w-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
945
- className
946
- ),
947
- ...props
948
- }
949
- ),
950
- trailingIcon ? /* @__PURE__ */ jsxRuntime.jsx(
951
- "span",
952
- {
953
- "aria-hidden": "true",
954
- className: "inline-flex h-4 w-4 items-center justify-center text-muted-foreground",
955
- children: trailingIcon
956
- }
957
- ) : null
958
- ]
959
- }
960
- ),
961
- hasError ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: errorId, className: "text-xs text-destructive", children: error }) : helperText ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: helperId, className: "text-xs text-muted-foreground", children: helperText }) : null
962
- ] });
989
+ trailingIcon ? /* @__PURE__ */ jsxRuntime.jsx(
990
+ "span",
991
+ {
992
+ "aria-hidden": "true",
993
+ className: "inline-flex h-4 w-4 items-center justify-center text-muted-foreground",
994
+ children: trailingIcon
995
+ }
996
+ ) : null
997
+ ]
998
+ }
999
+ );
963
1000
  });
964
1001
  function LanguageSwitcher({
965
1002
  languages,
@@ -998,26 +1035,332 @@ function LanguageSwitcher({
998
1035
  }
999
1036
  );
1000
1037
  }
1001
- function readDocumentDirection() {
1002
- if (typeof document === "undefined") return "ltr";
1003
- const dir = document.documentElement.getAttribute("dir");
1004
- return dir === "rtl" ? "rtl" : "ltr";
1038
+
1039
+ // src/components/radio-group/radioGroupVariants.ts
1040
+ var radioItemSizeClass = {
1041
+ sm: "size-4",
1042
+ md: "size-5",
1043
+ lg: "size-6"
1044
+ };
1045
+ var radioIndicatorSizeClass = {
1046
+ sm: "size-1.5",
1047
+ md: "size-2",
1048
+ lg: "size-2.5"
1049
+ };
1050
+ var radioLabelSizeClass = {
1051
+ sm: "text-xs",
1052
+ md: "text-sm",
1053
+ lg: "text-base"
1054
+ };
1055
+ var radioItemBaseClass = "aspect-square shrink-0 rounded-full border border-input bg-background text-primary outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background hover:border-ring disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-visible:ring-destructive/40 data-[state=checked]:border-primary";
1056
+ var radioIndicatorBaseClass = "flex h-full w-full items-center justify-center";
1057
+ var radioIndicatorDotClass = "rounded-full bg-primary";
1058
+ var radioOptionRowClass = "flex cursor-pointer items-start gap-2 has-[button:disabled]:cursor-not-allowed";
1059
+ var radioGroupBaseClass = "flex gap-3";
1060
+ var radioGroupOrientationClass = {
1061
+ vertical: "flex-col",
1062
+ horizontal: "flex-row flex-wrap"
1063
+ };
1064
+ var RadioGroup = react.forwardRef(function RadioGroup2({
1065
+ radioSize = "md",
1066
+ orientation = "vertical",
1067
+ value,
1068
+ defaultValue,
1069
+ onValueChange,
1070
+ onChange,
1071
+ onBlur,
1072
+ name,
1073
+ disabled,
1074
+ required,
1075
+ id,
1076
+ options,
1077
+ className,
1078
+ "aria-label": ariaLabel,
1079
+ "aria-labelledby": ariaLabelledBy,
1080
+ "aria-describedby": ariaDescribedBy,
1081
+ "aria-invalid": ariaInvalid,
1082
+ children
1083
+ }, ref) {
1084
+ const generatedId = react.useId();
1085
+ const groupId = id ?? generatedId;
1086
+ const handleValueChange = react.useCallback(
1087
+ (next) => {
1088
+ onValueChange?.(next);
1089
+ if (onChange) {
1090
+ const synthetic = {
1091
+ target: { value: next, name },
1092
+ currentTarget: { value: next, name },
1093
+ type: "change"
1094
+ };
1095
+ onChange(synthetic);
1096
+ }
1097
+ },
1098
+ [onValueChange, onChange, name]
1099
+ );
1100
+ return /* @__PURE__ */ jsxRuntime.jsx(
1101
+ RadixRadioGroup__namespace.Root,
1102
+ {
1103
+ ref,
1104
+ id: groupId,
1105
+ value,
1106
+ defaultValue,
1107
+ onValueChange: handleValueChange,
1108
+ onBlur,
1109
+ disabled,
1110
+ required,
1111
+ name,
1112
+ orientation,
1113
+ "aria-label": ariaLabel,
1114
+ "aria-labelledby": ariaLabelledBy,
1115
+ "aria-describedby": ariaDescribedBy,
1116
+ "aria-invalid": ariaInvalid,
1117
+ "data-slot": "radio-group",
1118
+ className: cn(radioGroupBaseClass, radioGroupOrientationClass[orientation], className),
1119
+ children: children ?? options?.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(
1120
+ RadioGroupOptionRow,
1121
+ {
1122
+ option: opt,
1123
+ radioSize,
1124
+ groupId
1125
+ },
1126
+ opt.value
1127
+ ))
1128
+ }
1129
+ );
1130
+ });
1131
+ function RadioGroupOptionRow({ option, radioSize, groupId }) {
1132
+ const itemId = `${groupId}-${option.value}`;
1133
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: itemId, className: radioOptionRowClass, children: [
1134
+ /* @__PURE__ */ jsxRuntime.jsx(
1135
+ RadixRadioGroup__namespace.Item,
1136
+ {
1137
+ id: itemId,
1138
+ value: option.value,
1139
+ disabled: option.disabled,
1140
+ "data-slot": "radio-item",
1141
+ className: cn(radioItemBaseClass, radioItemSizeClass[radioSize], "mt-0.5"),
1142
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Indicator, { className: radioIndicatorBaseClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(radioIndicatorDotClass, radioIndicatorSizeClass[radioSize]) }) })
1143
+ }
1144
+ ),
1145
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1 leading-tight", children: [
1146
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("block font-medium text-foreground", radioLabelSizeClass[radioSize]), children: option.label }),
1147
+ option.description ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
1148
+ ] })
1149
+ ] });
1005
1150
  }
1006
- function useDirection() {
1007
- const [dir, setDir] = react.useState(() => readDocumentDirection());
1008
- react.useEffect(() => {
1009
- setDir(readDocumentDirection());
1010
- const observer = new MutationObserver(() => {
1011
- setDir(readDocumentDirection());
1012
- });
1013
- observer.observe(document.documentElement, {
1014
- attributes: true,
1015
- attributeFilter: ["dir"]
1016
- });
1017
- return () => observer.disconnect();
1018
- }, []);
1019
- return dir;
1151
+ var RadioGroupItem = react.forwardRef(function RadioGroupItem2({ className, radioSize = "md", ...props }, ref) {
1152
+ return /* @__PURE__ */ jsxRuntime.jsx(
1153
+ RadixRadioGroup__namespace.Item,
1154
+ {
1155
+ ref,
1156
+ "data-slot": "radio-item",
1157
+ className: cn(radioItemBaseClass, radioItemSizeClass[radioSize], className),
1158
+ ...props,
1159
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Indicator, { className: radioIndicatorBaseClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(radioIndicatorDotClass, radioIndicatorSizeClass[radioSize]) }) })
1160
+ }
1161
+ );
1162
+ });
1163
+
1164
+ // src/components/select/selectVariants.ts
1165
+ var selectVariantClass = {
1166
+ default: "border border-input bg-background hover:border-ring",
1167
+ filled: "border border-transparent bg-muted hover:bg-muted/80",
1168
+ ghost: "border border-transparent bg-transparent hover:bg-accent"
1169
+ };
1170
+ var selectSizeClass = {
1171
+ sm: "h-8 rounded-md ps-2.5 pe-8 text-sm",
1172
+ md: "h-9 rounded-md ps-3 pe-9 text-sm",
1173
+ lg: "h-11 rounded-md ps-4 pe-10 text-base"
1174
+ };
1175
+ var selectBaseClass = "group/select relative inline-flex w-full items-center text-foreground outline-none transition-[background-color,border-color,box-shadow] focus:ring-2 focus:ring-ring/40 focus:ring-offset-1 focus:ring-offset-background aria-[invalid=true]:border-destructive aria-[invalid=true]:focus:ring-destructive/40 disabled:pointer-events-none disabled:opacity-50 cursor-pointer data-[placeholder]:text-muted-foreground";
1176
+ var selectContentClass = "z-50 max-h-(--radix-select-content-available-height) min-w-(--radix-select-trigger-width) overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
1177
+ var selectViewportClass = "p-1";
1178
+ var selectItemClass = "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
1179
+ var selectItemIndicatorClass = "absolute start-2 inline-flex h-3.5 w-3.5 items-center justify-center [&_svg]:h-3.5 [&_svg]:w-3.5";
1180
+ var selectGroupLabelClass = "px-2 py-1.5 text-xs font-semibold text-muted-foreground";
1181
+ var selectSeparatorClass = "-mx-1 my-1 h-px bg-border";
1182
+ function isGroupedOptions(options) {
1183
+ const first = options[0];
1184
+ return first !== void 0 && "options" in first;
1020
1185
  }
1186
+ var Select = react.forwardRef(function Select2({
1187
+ variant = "default",
1188
+ selectSize = "md",
1189
+ options,
1190
+ placeholder,
1191
+ value,
1192
+ defaultValue,
1193
+ onValueChange,
1194
+ onChange,
1195
+ onBlur,
1196
+ name,
1197
+ disabled,
1198
+ required,
1199
+ id,
1200
+ className,
1201
+ "aria-invalid": ariaInvalid,
1202
+ "aria-describedby": ariaDescribedBy,
1203
+ "aria-label": ariaLabel,
1204
+ children
1205
+ }, ref) {
1206
+ const generatedId = react.useId();
1207
+ const triggerId = id ?? generatedId;
1208
+ const handleValueChange = react.useCallback(
1209
+ (next) => {
1210
+ onValueChange?.(next);
1211
+ if (onChange) {
1212
+ const synthetic = {
1213
+ target: { value: next, name },
1214
+ currentTarget: { value: next, name },
1215
+ type: "change"
1216
+ };
1217
+ onChange(synthetic);
1218
+ }
1219
+ },
1220
+ [onValueChange, onChange, name]
1221
+ );
1222
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1223
+ RadixSelect__namespace.Root,
1224
+ {
1225
+ value,
1226
+ defaultValue,
1227
+ onValueChange: handleValueChange,
1228
+ disabled,
1229
+ required,
1230
+ name,
1231
+ children: [
1232
+ /* @__PURE__ */ jsxRuntime.jsxs(
1233
+ RadixSelect__namespace.Trigger,
1234
+ {
1235
+ ref,
1236
+ id: triggerId,
1237
+ "aria-label": ariaLabel,
1238
+ "aria-invalid": ariaInvalid,
1239
+ "aria-describedby": ariaDescribedBy,
1240
+ onBlur,
1241
+ "data-slot": "select-trigger",
1242
+ className: cn(
1243
+ selectBaseClass,
1244
+ selectVariantClass[variant],
1245
+ selectSizeClass[selectSize],
1246
+ className
1247
+ ),
1248
+ children: [
1249
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Value, { placeholder }),
1250
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground" }) })
1251
+ ]
1252
+ }
1253
+ ),
1254
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
1255
+ RadixSelect__namespace.Content,
1256
+ {
1257
+ position: "popper",
1258
+ sideOffset: 4,
1259
+ "data-slot": "select-content",
1260
+ className: selectContentClass,
1261
+ children: [
1262
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ScrollUpButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "size-4" }) }),
1263
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Viewport, { className: selectViewportClass, children: children ?? (options ? renderOptions(options) : null) }),
1264
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ScrollDownButton, { className: "flex h-6 cursor-default items-center justify-center bg-popover text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-4" }) })
1265
+ ]
1266
+ }
1267
+ ) })
1268
+ ]
1269
+ }
1270
+ );
1271
+ });
1272
+ function renderOptions(options) {
1273
+ if (isGroupedOptions(options)) {
1274
+ const lastIndex = options.length - 1;
1275
+ return options.map((group, idx) => /* @__PURE__ */ jsxRuntime.jsxs(RadixSelect__namespace.Group, { children: [
1276
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Label, { className: selectGroupLabelClass, children: group.label }),
1277
+ group.options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value)),
1278
+ idx < lastIndex && /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.Separator, { className: selectSeparatorClass })
1279
+ ] }, group.label));
1280
+ }
1281
+ return options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value));
1282
+ }
1283
+ var SelectItem = react.forwardRef(function SelectItem2({ className, children, ...props }, ref) {
1284
+ return /* @__PURE__ */ jsxRuntime.jsxs(RadixSelect__namespace.Item, { ref, className: cn(selectItemClass, className), ...props, children: [
1285
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ItemIndicator, { className: selectItemIndicatorClass, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}) }),
1286
+ /* @__PURE__ */ jsxRuntime.jsx(RadixSelect__namespace.ItemText, { children })
1287
+ ] });
1288
+ });
1289
+
1290
+ // src/components/switch/switchVariants.ts
1291
+ var switchTrackClass = {
1292
+ sm: "h-4 w-7",
1293
+ md: "h-5 w-9",
1294
+ lg: "h-6 w-11"
1295
+ };
1296
+ var switchThumbClass = {
1297
+ sm: "size-3 data-[state=checked]:translate-x-3 data-[state=checked]:rtl:-translate-x-3",
1298
+ md: "size-4 data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4",
1299
+ lg: "size-5 data-[state=checked]:translate-x-5 data-[state=checked]:rtl:-translate-x-5"
1300
+ };
1301
+ var switchTrackBaseClass = "relative inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent bg-input transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary aria-[invalid=true]:ring-2 aria-[invalid=true]:ring-destructive/40";
1302
+ var switchThumbBaseClass = "pointer-events-none block rounded-full bg-background shadow-sm ring-0 transition-transform";
1303
+ var Switch = react.forwardRef(function Switch2({
1304
+ switchSize = "md",
1305
+ checked,
1306
+ defaultChecked,
1307
+ onCheckedChange,
1308
+ value,
1309
+ onChange,
1310
+ onBlur,
1311
+ name,
1312
+ disabled,
1313
+ required,
1314
+ id,
1315
+ className,
1316
+ "aria-label": ariaLabel,
1317
+ "aria-describedby": ariaDescribedBy,
1318
+ "aria-invalid": ariaInvalid
1319
+ }, ref) {
1320
+ const generatedId = react.useId();
1321
+ const switchId = id ?? generatedId;
1322
+ const resolvedChecked = checked ?? (value === void 0 ? void 0 : Boolean(value));
1323
+ const handleCheckedChange = react.useCallback(
1324
+ (next) => {
1325
+ onCheckedChange?.(next);
1326
+ if (onChange) {
1327
+ const synthetic = {
1328
+ target: { checked: next, value: next, name },
1329
+ currentTarget: { checked: next, value: next, name },
1330
+ type: "change"
1331
+ };
1332
+ onChange(synthetic);
1333
+ }
1334
+ },
1335
+ [onCheckedChange, onChange, name]
1336
+ );
1337
+ return /* @__PURE__ */ jsxRuntime.jsx(
1338
+ RadixSwitch__namespace.Root,
1339
+ {
1340
+ ref,
1341
+ id: switchId,
1342
+ checked: resolvedChecked,
1343
+ defaultChecked,
1344
+ onCheckedChange: handleCheckedChange,
1345
+ onBlur,
1346
+ disabled,
1347
+ required,
1348
+ name,
1349
+ "aria-label": ariaLabel,
1350
+ "aria-invalid": ariaInvalid,
1351
+ "aria-describedby": ariaDescribedBy,
1352
+ "data-slot": "switch-track",
1353
+ className: cn(switchTrackBaseClass, switchTrackClass[switchSize], className),
1354
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1355
+ RadixSwitch__namespace.Thumb,
1356
+ {
1357
+ "data-slot": "switch-thumb",
1358
+ className: cn(switchThumbBaseClass, switchThumbClass[switchSize])
1359
+ }
1360
+ )
1361
+ }
1362
+ );
1363
+ });
1021
1364
  function Pagination({
1022
1365
  pageIndex,
1023
1366
  pageSize,
@@ -1528,67 +1871,48 @@ var Textarea = react.forwardRef(function Textarea2({
1528
1871
  variant = "default",
1529
1872
  textareaSize = "md",
1530
1873
  resize = "vertical",
1531
- label,
1532
- helperText,
1533
- error,
1534
- fullWidth = true,
1535
1874
  rows = 4,
1536
1875
  id,
1537
1876
  className,
1538
1877
  wrapperClassName,
1539
- containerClassName,
1540
- "aria-invalid": ariaInvalidProp,
1541
- "aria-describedby": ariaDescribedByProp,
1878
+ "aria-invalid": ariaInvalid,
1879
+ "aria-describedby": ariaDescribedBy,
1542
1880
  disabled,
1543
1881
  ...props
1544
1882
  }, ref) {
1545
1883
  const generatedId = react.useId();
1546
1884
  const textareaId = id ?? generatedId;
1547
- const helperId = `${textareaId}-helper`;
1548
- const errorId = `${textareaId}-error`;
1549
- const hasError = error !== void 0 && error !== null && error !== false;
1550
- const ariaInvalid = ariaInvalidProp ?? (hasError ? true : void 0);
1551
- const describedByIds = [
1552
- ariaDescribedByProp,
1553
- hasError ? errorId : null,
1554
- !hasError && helperText ? helperId : null
1555
- ].filter(Boolean).join(" ");
1556
- const ariaDescribedBy = describedByIds.length > 0 ? describedByIds : void 0;
1557
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1.5", fullWidth && "w-full", containerClassName), children: [
1558
- label !== void 0 && label !== null && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: textareaId, className: "text-sm font-medium text-foreground select-none", children: label }),
1559
- /* @__PURE__ */ jsxRuntime.jsx(
1560
- "div",
1561
- {
1562
- "data-slot": "textarea-wrapper",
1563
- className: cn(
1564
- textareaBaseClass,
1565
- textareaVariantClass[variant],
1566
- textareaSizeClass[textareaSize],
1567
- wrapperClassName
1568
- ),
1569
- "aria-invalid": ariaInvalid,
1570
- "data-disabled": disabled ? "true" : void 0,
1571
- children: /* @__PURE__ */ jsxRuntime.jsx(
1572
- "textarea",
1573
- {
1574
- ref,
1575
- id: textareaId,
1576
- rows,
1577
- disabled,
1578
- "aria-invalid": ariaInvalid,
1579
- "aria-describedby": ariaDescribedBy,
1580
- className: cn(
1581
- "w-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
1582
- textareaResizeClass[resize],
1583
- className
1584
- ),
1585
- ...props
1586
- }
1587
- )
1588
- }
1589
- ),
1590
- hasError ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: errorId, className: "text-xs text-destructive", children: error }) : helperText ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: helperId, className: "text-xs text-muted-foreground", children: helperText }) : null
1591
- ] });
1885
+ return /* @__PURE__ */ jsxRuntime.jsx(
1886
+ "div",
1887
+ {
1888
+ "data-slot": "textarea-wrapper",
1889
+ className: cn(
1890
+ textareaBaseClass,
1891
+ textareaVariantClass[variant],
1892
+ textareaSizeClass[textareaSize],
1893
+ wrapperClassName
1894
+ ),
1895
+ "aria-invalid": ariaInvalid,
1896
+ "data-disabled": disabled ? "true" : void 0,
1897
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1898
+ "textarea",
1899
+ {
1900
+ ref,
1901
+ id: textareaId,
1902
+ rows,
1903
+ disabled,
1904
+ "aria-invalid": ariaInvalid,
1905
+ "aria-describedby": ariaDescribedBy,
1906
+ className: cn(
1907
+ "w-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
1908
+ textareaResizeClass[resize],
1909
+ className
1910
+ ),
1911
+ ...props
1912
+ }
1913
+ )
1914
+ }
1915
+ );
1592
1916
  });
1593
1917
 
1594
1918
  exports.AppShell = AppShell;
@@ -1607,6 +1931,9 @@ exports.HeaderSearch = HeaderSearch;
1607
1931
  exports.HeaderTitle = HeaderTitle;
1608
1932
  exports.Input = Input;
1609
1933
  exports.LanguageSwitcher = LanguageSwitcher;
1934
+ exports.RadioGroup = RadioGroup;
1935
+ exports.RadioGroupItem = RadioGroupItem;
1936
+ exports.Select = Select;
1610
1937
  exports.Sidebar = Sidebar;
1611
1938
  exports.SidebarFooter = SidebarFooter;
1612
1939
  exports.SidebarGroup = SidebarGroup;
@@ -1614,6 +1941,7 @@ exports.SidebarHeader = SidebarHeader;
1614
1941
  exports.SidebarNav = SidebarNav;
1615
1942
  exports.SidebarNavGroup = SidebarNavGroup;
1616
1943
  exports.SidebarNavItem = SidebarNavItem;
1944
+ exports.Switch = Switch;
1617
1945
  exports.Table = Table;
1618
1946
  exports.Textarea = Textarea;
1619
1947
  exports.buttonBaseClass = buttonBaseClass;
@@ -1623,6 +1951,22 @@ exports.cn = cn;
1623
1951
  exports.inputBaseClass = inputBaseClass;
1624
1952
  exports.inputSizeClass = inputSizeClass;
1625
1953
  exports.inputVariantClass = inputVariantClass;
1954
+ exports.radioGroupBaseClass = radioGroupBaseClass;
1955
+ exports.radioGroupOrientationClass = radioGroupOrientationClass;
1956
+ exports.radioIndicatorBaseClass = radioIndicatorBaseClass;
1957
+ exports.radioIndicatorDotClass = radioIndicatorDotClass;
1958
+ exports.radioIndicatorSizeClass = radioIndicatorSizeClass;
1959
+ exports.radioItemBaseClass = radioItemBaseClass;
1960
+ exports.radioItemSizeClass = radioItemSizeClass;
1961
+ exports.radioLabelSizeClass = radioLabelSizeClass;
1962
+ exports.radioOptionRowClass = radioOptionRowClass;
1963
+ exports.selectBaseClass = selectBaseClass;
1964
+ exports.selectSizeClass = selectSizeClass;
1965
+ exports.selectVariantClass = selectVariantClass;
1966
+ exports.switchThumbBaseClass = switchThumbBaseClass;
1967
+ exports.switchThumbClass = switchThumbClass;
1968
+ exports.switchTrackBaseClass = switchTrackBaseClass;
1969
+ exports.switchTrackClass = switchTrackClass;
1626
1970
  exports.tableAlignClass = alignClass;
1627
1971
  exports.tableBaseClass = tableBaseClass;
1628
1972
  exports.tableSelectedRowClass = selectedRowClass;