@underverse-ui/underverse 1.0.206 → 1.0.207

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "1.0.206",
3
+ "version": "1.0.207",
4
4
  "sourceEntry": "src/index.ts",
5
- "totalExports": 252,
5
+ "totalExports": 256,
6
6
  "exports": [
7
7
  {
8
8
  "name": "*",
@@ -1121,6 +1121,13 @@
1121
1121
  "reexport": true,
1122
1122
  "local": false
1123
1123
  },
1124
+ {
1125
+ "name": "RadioButtonGroup",
1126
+ "kind": "value",
1127
+ "source": "./components/RadioGroup",
1128
+ "reexport": true,
1129
+ "local": false
1130
+ },
1124
1131
  {
1125
1132
  "name": "RadioGroup",
1126
1133
  "kind": "value",
@@ -1171,6 +1178,13 @@
1171
1178
  "local": false,
1172
1179
  "aliasOf": "default"
1173
1180
  },
1181
+ {
1182
+ "name": "SegmentedControl",
1183
+ "kind": "value",
1184
+ "source": "./components/RadioGroup",
1185
+ "reexport": true,
1186
+ "local": false
1187
+ },
1174
1188
  {
1175
1189
  "name": "SelectDropdown",
1176
1190
  "kind": "value",
@@ -1241,6 +1255,13 @@
1241
1255
  "reexport": true,
1242
1256
  "local": false
1243
1257
  },
1258
+ {
1259
+ "name": "SimpleRadioGroup",
1260
+ "kind": "value",
1261
+ "source": "./components/RadioGroup",
1262
+ "reexport": true,
1263
+ "local": false
1264
+ },
1244
1265
  {
1245
1266
  "name": "SimpleTabs",
1246
1267
  "kind": "value",
@@ -1491,6 +1512,13 @@
1491
1512
  "local": false,
1492
1513
  "aliasOf": "default"
1493
1514
  },
1515
+ {
1516
+ "name": "ToggleGroup",
1517
+ "kind": "value",
1518
+ "source": "./components/RadioGroup",
1519
+ "reexport": true,
1520
+ "local": false
1521
+ },
1494
1522
  {
1495
1523
  "name": "Tooltip",
1496
1524
  "kind": "value",
package/dist/index.cjs CHANGED
@@ -9390,17 +9390,20 @@ __export(src_exports, {
9390
9390
  Popover: () => Popover,
9391
9391
  Progress: () => Progress,
9392
9392
  PulseBadge: () => PulseBadge,
9393
+ RadioButtonGroup: () => RadioButtonGroup,
9393
9394
  RadioGroup: () => RadioGroup,
9394
9395
  RadioGroupItem: () => RadioGroupItem,
9395
9396
  SIZE_STYLES_BTN: () => SIZE_STYLES_BTN,
9396
9397
  ScrollArea: () => ScrollArea,
9397
9398
  SearchInput: () => SearchInput,
9398
9399
  Section: () => Section_default,
9400
+ SegmentedControl: () => SegmentedControl,
9399
9401
  SegmentedProgress: () => SegmentedProgress,
9400
9402
  SelectDropdown: () => SelectDropdown,
9401
9403
  Sheet: () => Sheet,
9402
9404
  SidebarSheet: () => SidebarSheet,
9403
9405
  SimplePagination: () => SimplePagination,
9406
+ SimpleRadioGroup: () => SimpleRadioGroup,
9404
9407
  SimpleTabs: () => SimpleTabs,
9405
9408
  Skeleton: () => Skeleton_default,
9406
9409
  SkeletonAvatar: () => SkeletonAvatar,
@@ -9437,6 +9440,7 @@ __export(src_exports, {
9437
9440
  Timeline: () => Timeline_default,
9438
9441
  TimelineItem: () => TimelineItem,
9439
9442
  ToastProvider: () => Toast_default,
9443
+ ToggleGroup: () => ToggleGroup,
9440
9444
  Tooltip: () => Tooltip,
9441
9445
  TranslationProvider: () => TranslationProvider,
9442
9446
  UEditor: () => UEditor_default,
@@ -25166,6 +25170,153 @@ var RadioGroupItem = React47.forwardRef(
25166
25170
  }
25167
25171
  );
25168
25172
  RadioGroupItem.displayName = "RadioGroupItem";
25173
+ var SimpleRadioGroup = ({
25174
+ items,
25175
+ value,
25176
+ defaultValue,
25177
+ onValueChange,
25178
+ name,
25179
+ disabled = false,
25180
+ orientation = "vertical",
25181
+ size = "md",
25182
+ variant = "default",
25183
+ borderMode,
25184
+ className,
25185
+ required = false,
25186
+ error = false,
25187
+ errorMessage
25188
+ }) => {
25189
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
25190
+ RadioGroup,
25191
+ {
25192
+ value,
25193
+ defaultValue,
25194
+ onValueChange,
25195
+ name,
25196
+ disabled,
25197
+ orientation,
25198
+ size,
25199
+ variant,
25200
+ borderMode,
25201
+ className,
25202
+ required,
25203
+ error,
25204
+ errorMessage,
25205
+ children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
25206
+ RadioGroupItem,
25207
+ {
25208
+ value: item.value,
25209
+ label: item.label,
25210
+ description: item.description,
25211
+ disabled: item.disabled,
25212
+ icon: item.icon
25213
+ },
25214
+ item.value
25215
+ ))
25216
+ }
25217
+ );
25218
+ };
25219
+ var RadioButtonGroup = ({
25220
+ items,
25221
+ value,
25222
+ defaultValue,
25223
+ onValueChange,
25224
+ name,
25225
+ disabled = false,
25226
+ size = "md",
25227
+ variant = "default",
25228
+ borderMode,
25229
+ className,
25230
+ fullWidth = false
25231
+ }) => {
25232
+ const globalConfig = useUnderverseUIConfig();
25233
+ const resolvedBorderMode = borderMode ?? globalConfig.input?.borderMode ?? globalConfig.borderMode ?? "full";
25234
+ const [internalValue, setInternalValue] = React47.useState(defaultValue || "");
25235
+ const isControlled = value !== void 0;
25236
+ const currentValue = isControlled ? value : internalValue;
25237
+ const handleValueChange = (newValue) => {
25238
+ if (!disabled) {
25239
+ if (!isControlled) {
25240
+ setInternalValue(newValue);
25241
+ }
25242
+ onValueChange?.(newValue);
25243
+ }
25244
+ };
25245
+ const sizeClasses2 = {
25246
+ sm: "px-3 py-1.5 text-xs",
25247
+ md: "px-4 py-2 text-sm",
25248
+ lg: "px-6 py-3 text-base"
25249
+ };
25250
+ const variantClasses3 = {
25251
+ default: {
25252
+ container: "bg-muted p-1",
25253
+ base: "bg-transparent hover:bg-background/50",
25254
+ selected: "bg-background text-foreground shadow-sm"
25255
+ },
25256
+ outline: {
25257
+ container: "border border-border/50 overflow-hidden",
25258
+ base: "bg-background border-r border-border/50 hover:bg-accent",
25259
+ selected: "bg-primary text-primary-foreground border-primary"
25260
+ },
25261
+ solid: {
25262
+ container: "border border-border/50 overflow-hidden",
25263
+ base: "bg-background hover:bg-accent",
25264
+ selected: "bg-primary text-primary-foreground"
25265
+ }
25266
+ };
25267
+ const uniqueId = React47.useId();
25268
+ const radioName = name || `radio-button-group-${uniqueId}`;
25269
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cn("inline-flex", variantClasses3[variant].container, getBorderRadiusClass(resolvedBorderMode), fullWidth && "w-full", className), role: "radiogroup", children: items.map((item, index) => {
25270
+ const isSelected = currentValue === item.value;
25271
+ const isDisabled = item.disabled || disabled;
25272
+ const Icon = item.icon;
25273
+ const isLast = index === items.length - 1;
25274
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
25275
+ "button",
25276
+ {
25277
+ type: "button",
25278
+ disabled: isDisabled,
25279
+ role: "radio",
25280
+ "aria-checked": isSelected,
25281
+ className: cn(
25282
+ "relative inline-flex items-center justify-center gap-2 font-medium transition-all duration-200",
25283
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
25284
+ "disabled:cursor-not-allowed disabled:opacity-50",
25285
+ sizeClasses2[size],
25286
+ isSelected ? variantClasses3[variant].selected : variantClasses3[variant].base,
25287
+ variant === "outline" && !isLast && "border-r border-border/50",
25288
+ variant === "default" && getBorderRadiusClass(resolvedBorderMode),
25289
+ fullWidth && "flex-1"
25290
+ ),
25291
+ onClick: () => handleValueChange(item.value),
25292
+ children: [
25293
+ Icon && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Icon, { className: "w-4 h-4" }),
25294
+ item.label,
25295
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
25296
+ "input",
25297
+ {
25298
+ type: "radio",
25299
+ name: radioName,
25300
+ value: item.value,
25301
+ checked: isSelected,
25302
+ onChange: () => {
25303
+ },
25304
+ className: "sr-only",
25305
+ tabIndex: -1
25306
+ }
25307
+ )
25308
+ ]
25309
+ },
25310
+ item.value
25311
+ );
25312
+ }) });
25313
+ };
25314
+ var SegmentedControl = (props) => {
25315
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RadioButtonGroup, { ...props, variant: "default" });
25316
+ };
25317
+ var ToggleGroup = (props) => {
25318
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RadioButtonGroup, { ...props, variant: "outline" });
25319
+ };
25169
25320
 
25170
25321
  // src/components/Slider.tsx
25171
25322
  var React48 = __toESM(require("react"), 1);
@@ -47697,17 +47848,20 @@ function getUnderverseMessages(locale = "en") {
47697
47848
  Popover,
47698
47849
  Progress,
47699
47850
  PulseBadge,
47851
+ RadioButtonGroup,
47700
47852
  RadioGroup,
47701
47853
  RadioGroupItem,
47702
47854
  SIZE_STYLES_BTN,
47703
47855
  ScrollArea,
47704
47856
  SearchInput,
47705
47857
  Section,
47858
+ SegmentedControl,
47706
47859
  SegmentedProgress,
47707
47860
  SelectDropdown,
47708
47861
  Sheet,
47709
47862
  SidebarSheet,
47710
47863
  SimplePagination,
47864
+ SimpleRadioGroup,
47711
47865
  SimpleTabs,
47712
47866
  Skeleton,
47713
47867
  SkeletonAvatar,
@@ -47744,6 +47898,7 @@ function getUnderverseMessages(locale = "en") {
47744
47898
  Timeline,
47745
47899
  TimelineItem,
47746
47900
  ToastProvider,
47901
+ ToggleGroup,
47747
47902
  Tooltip,
47748
47903
  TranslationProvider,
47749
47904
  UEditor,