shadcn-ui-react 0.7.12 → 0.7.14

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
@@ -7813,22 +7813,27 @@ var SelectContent = React46.forwardRef(
7813
7813
  cancelAnimationFrame(frame);
7814
7814
  };
7815
7815
  }, [context.activeValue, context.items, context.open]);
7816
- if (!context.open) {
7817
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { hidden: true, "aria-hidden": "true", style: { display: "none" }, children });
7818
- }
7819
- if (!mounted || !contentStyle) return null;
7816
+ if (!mounted) return null;
7817
+ const isVisible = context.open && Boolean(contentStyle);
7820
7818
  return (0, import_react_dom.createPortal)(
7821
7819
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
7822
7820
  "div",
7823
7821
  __spreadProps(__spreadValues({}, props), {
7824
7822
  ref: composeRefs(ref, context.contentRef),
7825
7823
  role: "listbox",
7824
+ "aria-hidden": !isVisible,
7826
7825
  "data-side": side,
7826
+ "data-select-content": true,
7827
7827
  className: cn(
7828
- "min-w-32 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
7828
+ "pointer-events-auto min-w-32 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
7829
7829
  className
7830
7830
  ),
7831
- style: __spreadValues(__spreadValues({}, contentStyle), style),
7831
+ style: __spreadProps(__spreadValues(__spreadValues({}, contentStyle != null ? contentStyle : {
7832
+ position: "fixed",
7833
+ zIndex: 9999
7834
+ }), style), {
7835
+ display: isVisible ? void 0 : "none"
7836
+ }),
7832
7837
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
7833
7838
  "div",
7834
7839
  {
@@ -7839,7 +7844,7 @@ var SelectContent = React46.forwardRef(
7839
7844
  "scrollbar-gutter-stable"
7840
7845
  ),
7841
7846
  style: {
7842
- maxHeight: contentStyle.maxHeight,
7847
+ maxHeight: contentStyle == null ? void 0 : contentStyle.maxHeight,
7843
7848
  overflowX: "hidden",
7844
7849
  overflowY: "auto",
7845
7850
  overscrollBehavior: "contain",
@@ -8255,8 +8260,9 @@ function SearchableSelectBase({
8255
8260
  "div",
8256
8261
  {
8257
8262
  ref: contentRef,
8263
+ "data-searchable-select-content": true,
8258
8264
  className: cn(
8259
- "overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl",
8265
+ "pointer-events-auto overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl",
8260
8266
  contentClassName
8261
8267
  ),
8262
8268
  style: __spreadProps(__spreadValues({}, contentStyle), {
@@ -8516,7 +8522,6 @@ var FormSelect = ({
8516
8522
  const form = (0, import_react_hook_form5.useFormContext)();
8517
8523
  const controllerControl = control != null ? control : form == null ? void 0 : form.control;
8518
8524
  const sizeClasses = getFormSizeClasses(size, customSize);
8519
- const triggerSizeClass = getFormControlSizeClass(variant, sizeClasses);
8520
8525
  const normalizedOptions = React48.useMemo(() => {
8521
8526
  if (options) return options;
8522
8527
  return (items != null ? items : []).map((item) => {
@@ -8606,7 +8611,7 @@ var FormSelect = ({
8606
8611
  field.onBlur();
8607
8612
  }
8608
8613
  }
8609
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8614
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
8610
8615
  Select2,
8611
8616
  {
8612
8617
  value: (_b = field.value) != null ? _b : "",
@@ -8615,19 +8620,36 @@ var FormSelect = ({
8615
8620
  if (!nextOpen) field.onBlur();
8616
8621
  },
8617
8622
  disabled,
8618
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8619
- SelectTrigger,
8620
- {
8621
- className: classNameDefault ? cn(
8622
- formControlBase,
8623
- formInputVariants[variant],
8624
- triggerSizeClass,
8625
- hasError && formControlErrorClass,
8626
- className
8627
- ) : className,
8628
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectValue, { placeholder })
8629
- }
8630
- ) })
8623
+ size,
8624
+ customSize,
8625
+ variant,
8626
+ invalid: hasError,
8627
+ children: [
8628
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectTrigger, { className, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectValue, { placeholder }) }) }),
8629
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8630
+ SelectContent,
8631
+ {
8632
+ position: "popper",
8633
+ sideOffset: 6,
8634
+ className: cn(
8635
+ "z-50 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl outline-none",
8636
+ contentClassName
8637
+ ),
8638
+ onWheelCapture: (event) => event.stopPropagation(),
8639
+ onTouchMoveCapture: (event) => event.stopPropagation(),
8640
+ children: normalizedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8641
+ SelectItem,
8642
+ {
8643
+ value: option.value,
8644
+ disabled: option.disabled,
8645
+ className: cn(sizeClasses.selectItem, itemClassName),
8646
+ children: option.label
8647
+ },
8648
+ option.value
8649
+ ))
8650
+ }
8651
+ )
8652
+ ]
8631
8653
  }
8632
8654
  ),
8633
8655
  fieldError ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -9836,7 +9858,7 @@ var TableHead = React63.forwardRef((_a, ref) => {
9836
9858
  __spreadValues({
9837
9859
  ref,
9838
9860
  className: cn(
9839
- "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
9861
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground has-[[role=checkbox]]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
9840
9862
  className
9841
9863
  )
9842
9864
  }, props)
@@ -9850,7 +9872,7 @@ var TableCell = React63.forwardRef((_a, ref) => {
9850
9872
  __spreadValues({
9851
9873
  ref,
9852
9874
  className: cn(
9853
- "p-2 align-middle [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
9875
+ "p-2 align-middle has-[[role=checkbox]]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
9854
9876
  className
9855
9877
  )
9856
9878
  }, props)
package/dist/index.js CHANGED
@@ -7537,22 +7537,27 @@ var SelectContent = React46.forwardRef(
7537
7537
  cancelAnimationFrame(frame);
7538
7538
  };
7539
7539
  }, [context.activeValue, context.items, context.open]);
7540
- if (!context.open) {
7541
- return /* @__PURE__ */ jsx24("div", { hidden: true, "aria-hidden": "true", style: { display: "none" }, children });
7542
- }
7543
- if (!mounted || !contentStyle) return null;
7540
+ if (!mounted) return null;
7541
+ const isVisible = context.open && Boolean(contentStyle);
7544
7542
  return createPortal(
7545
7543
  /* @__PURE__ */ jsx24(
7546
7544
  "div",
7547
7545
  __spreadProps(__spreadValues({}, props), {
7548
7546
  ref: composeRefs(ref, context.contentRef),
7549
7547
  role: "listbox",
7548
+ "aria-hidden": !isVisible,
7550
7549
  "data-side": side,
7550
+ "data-select-content": true,
7551
7551
  className: cn(
7552
- "min-w-32 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
7552
+ "pointer-events-auto min-w-32 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
7553
7553
  className
7554
7554
  ),
7555
- style: __spreadValues(__spreadValues({}, contentStyle), style),
7555
+ style: __spreadProps(__spreadValues(__spreadValues({}, contentStyle != null ? contentStyle : {
7556
+ position: "fixed",
7557
+ zIndex: 9999
7558
+ }), style), {
7559
+ display: isVisible ? void 0 : "none"
7560
+ }),
7556
7561
  children: /* @__PURE__ */ jsx24(
7557
7562
  "div",
7558
7563
  {
@@ -7563,7 +7568,7 @@ var SelectContent = React46.forwardRef(
7563
7568
  "scrollbar-gutter-stable"
7564
7569
  ),
7565
7570
  style: {
7566
- maxHeight: contentStyle.maxHeight,
7571
+ maxHeight: contentStyle == null ? void 0 : contentStyle.maxHeight,
7567
7572
  overflowX: "hidden",
7568
7573
  overflowY: "auto",
7569
7574
  overscrollBehavior: "contain",
@@ -7979,8 +7984,9 @@ function SearchableSelectBase({
7979
7984
  "div",
7980
7985
  {
7981
7986
  ref: contentRef,
7987
+ "data-searchable-select-content": true,
7982
7988
  className: cn(
7983
- "overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl",
7989
+ "pointer-events-auto overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl",
7984
7990
  contentClassName
7985
7991
  ),
7986
7992
  style: __spreadProps(__spreadValues({}, contentStyle), {
@@ -8240,7 +8246,6 @@ var FormSelect = ({
8240
8246
  const form = useFormContext4();
8241
8247
  const controllerControl = control != null ? control : form == null ? void 0 : form.control;
8242
8248
  const sizeClasses = getFormSizeClasses(size, customSize);
8243
- const triggerSizeClass = getFormControlSizeClass(variant, sizeClasses);
8244
8249
  const normalizedOptions = React48.useMemo(() => {
8245
8250
  if (options) return options;
8246
8251
  return (items != null ? items : []).map((item) => {
@@ -8330,7 +8335,7 @@ var FormSelect = ({
8330
8335
  field.onBlur();
8331
8336
  }
8332
8337
  }
8333
- ) }) : /* @__PURE__ */ jsx26(
8338
+ ) }) : /* @__PURE__ */ jsxs16(
8334
8339
  Select2,
8335
8340
  {
8336
8341
  value: (_b = field.value) != null ? _b : "",
@@ -8339,19 +8344,36 @@ var FormSelect = ({
8339
8344
  if (!nextOpen) field.onBlur();
8340
8345
  },
8341
8346
  disabled,
8342
- children: /* @__PURE__ */ jsx26(FormControl, { children: /* @__PURE__ */ jsx26(
8343
- SelectTrigger,
8344
- {
8345
- className: classNameDefault ? cn(
8346
- formControlBase,
8347
- formInputVariants[variant],
8348
- triggerSizeClass,
8349
- hasError && formControlErrorClass,
8350
- className
8351
- ) : className,
8352
- children: /* @__PURE__ */ jsx26(SelectValue, { placeholder })
8353
- }
8354
- ) })
8347
+ size,
8348
+ customSize,
8349
+ variant,
8350
+ invalid: hasError,
8351
+ children: [
8352
+ /* @__PURE__ */ jsx26(FormControl, { children: /* @__PURE__ */ jsx26(SelectTrigger, { className, children: /* @__PURE__ */ jsx26(SelectValue, { placeholder }) }) }),
8353
+ /* @__PURE__ */ jsx26(
8354
+ SelectContent,
8355
+ {
8356
+ position: "popper",
8357
+ sideOffset: 6,
8358
+ className: cn(
8359
+ "z-50 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-xl outline-none",
8360
+ contentClassName
8361
+ ),
8362
+ onWheelCapture: (event) => event.stopPropagation(),
8363
+ onTouchMoveCapture: (event) => event.stopPropagation(),
8364
+ children: normalizedOptions.map((option) => /* @__PURE__ */ jsx26(
8365
+ SelectItem,
8366
+ {
8367
+ value: option.value,
8368
+ disabled: option.disabled,
8369
+ className: cn(sizeClasses.selectItem, itemClassName),
8370
+ children: option.label
8371
+ },
8372
+ option.value
8373
+ ))
8374
+ }
8375
+ )
8376
+ ]
8355
8377
  }
8356
8378
  ),
8357
8379
  fieldError ? /* @__PURE__ */ jsx26(
@@ -9596,7 +9618,7 @@ var TableHead = React63.forwardRef((_a, ref) => {
9596
9618
  __spreadValues({
9597
9619
  ref,
9598
9620
  className: cn(
9599
- "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
9621
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground has-[[role=checkbox]]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
9600
9622
  className
9601
9623
  )
9602
9624
  }, props)
@@ -9610,7 +9632,7 @@ var TableCell = React63.forwardRef((_a, ref) => {
9610
9632
  __spreadValues({
9611
9633
  ref,
9612
9634
  className: cn(
9613
- "p-2 align-middle [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
9635
+ "p-2 align-middle has-[[role=checkbox]]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
9614
9636
  className
9615
9637
  )
9616
9638
  }, props)
package/dist/style.css CHANGED
@@ -61,10 +61,13 @@
61
61
  --color-black: #000;
62
62
  --color-white: #fff;
63
63
  --spacing: 0.25rem;
64
+ --container-xs: 20rem;
64
65
  --container-sm: 24rem;
65
66
  --container-md: 28rem;
66
67
  --container-lg: 32rem;
67
68
  --container-xl: 36rem;
69
+ --container-2xl: 42rem;
70
+ --container-3xl: 48rem;
68
71
  --text-xs: 0.75rem;
69
72
  --text-xs--line-height: calc(1 / 0.75);
70
73
  --text-sm: 0.875rem;
@@ -631,6 +634,9 @@
631
634
  .max-h-\[300px\] {
632
635
  max-height: 300px;
633
636
  }
637
+ .max-h-\[calc\(100vh-2rem\)\] {
638
+ max-height: calc(100vh - 2rem);
639
+ }
634
640
  .max-h-full {
635
641
  max-height: 100%;
636
642
  }
@@ -718,6 +724,9 @@
718
724
  .w-\[100px\] {
719
725
  width: 100px;
720
726
  }
727
+ .w-\[calc\(100vw-1rem\)\] {
728
+ width: calc(100vw - 1rem);
729
+ }
721
730
  .w-full {
722
731
  width: 100%;
723
732
  }
@@ -1479,6 +1488,9 @@
1479
1488
  .py-4 {
1480
1489
  padding-block: calc(var(--spacing) * 4);
1481
1490
  }
1491
+ .py-5 {
1492
+ padding-block: calc(var(--spacing) * 5);
1493
+ }
1482
1494
  .py-6 {
1483
1495
  padding-block: calc(var(--spacing) * 6);
1484
1496
  }
@@ -1491,6 +1503,9 @@
1491
1503
  .pt-4 {
1492
1504
  padding-top: calc(var(--spacing) * 4);
1493
1505
  }
1506
+ .pt-5 {
1507
+ padding-top: calc(var(--spacing) * 5);
1508
+ }
1494
1509
  .pt-6 {
1495
1510
  padding-top: calc(var(--spacing) * 6);
1496
1511
  }
@@ -1548,6 +1563,9 @@
1548
1563
  .text-left {
1549
1564
  text-align: left;
1550
1565
  }
1566
+ .text-start {
1567
+ text-align: start;
1568
+ }
1551
1569
  .align-middle {
1552
1570
  vertical-align: middle;
1553
1571
  }
@@ -2979,6 +2997,11 @@
2979
2997
  opacity: 50%;
2980
2998
  }
2981
2999
  }
3000
+ .has-\[\[role\=checkbox\]\]\:pr-0 {
3001
+ &:has(*:is([role=checkbox])) {
3002
+ padding-right: calc(var(--spacing) * 0);
3003
+ }
3004
+ }
2982
3005
  .aria-selected\:bg-accent {
2983
3006
  &[aria-selected=true] {
2984
3007
  background-color: var(--accent);
@@ -3713,11 +3736,52 @@
3713
3736
  display: none;
3714
3737
  }
3715
3738
  }
3739
+ .sm\:w-fit {
3740
+ @media (width >= 40rem) {
3741
+ width: -moz-fit-content;
3742
+ width: fit-content;
3743
+ }
3744
+ }
3745
+ .sm\:max-w-2xl {
3746
+ @media (width >= 40rem) {
3747
+ max-width: var(--container-2xl);
3748
+ }
3749
+ }
3750
+ .sm\:max-w-3xl {
3751
+ @media (width >= 40rem) {
3752
+ max-width: var(--container-3xl);
3753
+ }
3754
+ }
3755
+ .sm\:max-w-\[calc\(100vw-2rem\)\] {
3756
+ @media (width >= 40rem) {
3757
+ max-width: calc(100vw - 2rem);
3758
+ }
3759
+ }
3760
+ .sm\:max-w-lg {
3761
+ @media (width >= 40rem) {
3762
+ max-width: var(--container-lg);
3763
+ }
3764
+ }
3765
+ .sm\:max-w-md {
3766
+ @media (width >= 40rem) {
3767
+ max-width: var(--container-md);
3768
+ }
3769
+ }
3716
3770
  .sm\:max-w-sm {
3717
3771
  @media (width >= 40rem) {
3718
3772
  max-width: var(--container-sm);
3719
3773
  }
3720
3774
  }
3775
+ .sm\:max-w-xl {
3776
+ @media (width >= 40rem) {
3777
+ max-width: var(--container-xl);
3778
+ }
3779
+ }
3780
+ .sm\:max-w-xs {
3781
+ @media (width >= 40rem) {
3782
+ max-width: var(--container-xs);
3783
+ }
3784
+ }
3721
3785
  .sm\:grid-cols-\[1fr_auto\] {
3722
3786
  @media (width >= 40rem) {
3723
3787
  grid-template-columns: 1fr auto;
@@ -4212,11 +4276,6 @@
4212
4276
  line-height: var(--tw-leading, var(--text-xs--line-height));
4213
4277
  }
4214
4278
  }
4215
- .\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0 {
4216
- &:has([role=checkbox]) {
4217
- padding-right: calc(var(--spacing) * 0);
4218
- }
4219
- }
4220
4279
  .\*\:\[\[role\=checkbox\]\]\:translate-y-0\.5 {
4221
4280
  :is(& > *) {
4222
4281
  &:is([role=checkbox]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadcn-ui-react",
3
- "version": "0.7.12",
3
+ "version": "0.7.14",
4
4
  "private": false,
5
5
  "author": "Bleker <bleker@gliyen.com>",
6
6
  "description": "A collection of components for building beautiful and accessible user interfaces with React and Tailwind CSS.",