@bccampus/ui-components 0.9.10 → 0.9.12
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/_chunks/index4.js +3 -3
- package/dist/_chunks/utils.js +204 -39
- package/dist/components/ui/horizontal-list.js +16 -16
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/popover.js +77 -65
- package/dist/lib/object.js +9 -3
- package/package.json +6 -11
- package/src/components/ui/horizontal-list.tsx +30 -21
- package/src/lib/object.ts +39 -35
package/dist/_chunks/index4.js
CHANGED
|
@@ -604,10 +604,10 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
604
604
|
export {
|
|
605
605
|
DismissableLayer as D,
|
|
606
606
|
Primitive as P,
|
|
607
|
-
|
|
608
|
-
|
|
607
|
+
Presence as a,
|
|
608
|
+
composeEventHandlers as b,
|
|
609
609
|
createContextScope as c,
|
|
610
|
-
|
|
610
|
+
useId as d,
|
|
611
611
|
useCallbackRef as e,
|
|
612
612
|
useLayoutEffect2 as f,
|
|
613
613
|
dispatchDiscreteCustomEvent as g,
|
package/dist/_chunks/utils.js
CHANGED
|
@@ -435,7 +435,7 @@ const fromTheme = (key) => {
|
|
|
435
435
|
};
|
|
436
436
|
const arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
|
|
437
437
|
const arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
|
|
438
|
-
const fractionRegex = /^\d
|
|
438
|
+
const fractionRegex = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/;
|
|
439
439
|
const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
|
|
440
440
|
const lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
|
|
441
441
|
const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
|
|
@@ -461,6 +461,8 @@ const isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNev
|
|
|
461
461
|
const isArbitraryValue = (value) => arbitraryValueRegex.test(value);
|
|
462
462
|
const isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
|
|
463
463
|
const isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
|
|
464
|
+
const isArbitraryWeight = (value) => getIsArbitraryValue(value, isLabelWeight, isAny);
|
|
465
|
+
const isArbitraryFamilyName = (value) => getIsArbitraryValue(value, isLabelFamilyName, isNever);
|
|
464
466
|
const isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
|
|
465
467
|
const isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
|
|
466
468
|
const isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
|
|
@@ -471,6 +473,7 @@ const isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isL
|
|
|
471
473
|
const isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
|
|
472
474
|
const isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
|
|
473
475
|
const isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
|
|
476
|
+
const isArbitraryVariableWeight = (value) => getIsArbitraryVariable(value, isLabelWeight, true);
|
|
474
477
|
const getIsArbitraryValue = (value, testLabel, testValue) => {
|
|
475
478
|
const result = arbitraryValueRegex.exec(value);
|
|
476
479
|
if (result) {
|
|
@@ -497,6 +500,7 @@ const isLabelSize = (label) => label === "length" || label === "size" || label =
|
|
|
497
500
|
const isLabelLength = (label) => label === "length";
|
|
498
501
|
const isLabelNumber = (label) => label === "number";
|
|
499
502
|
const isLabelFamilyName = (label) => label === "family-name";
|
|
503
|
+
const isLabelWeight = (label) => label === "number" || label === "weight";
|
|
500
504
|
const isLabelShadow = (label) => label === "shadow";
|
|
501
505
|
const getDefaultConfig = () => {
|
|
502
506
|
const themeColor = fromTheme("color");
|
|
@@ -553,6 +557,8 @@ const getDefaultConfig = () => {
|
|
|
553
557
|
const scaleAlignSecondaryAxis = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"];
|
|
554
558
|
const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
|
|
555
559
|
const scaleSizing = () => [isFraction, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
|
|
560
|
+
const scaleSizingInline = () => [isFraction, "screen", "full", "dvw", "lvw", "svw", "min", "max", "fit", ...scaleUnambiguousSpacing()];
|
|
561
|
+
const scaleSizingBlock = () => [isFraction, "screen", "full", "lh", "dvh", "lvh", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
|
|
556
562
|
const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
|
|
557
563
|
const scaleBgPosition = () => [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition, {
|
|
558
564
|
position: [isArbitraryVariable, isArbitraryValue]
|
|
@@ -762,40 +768,66 @@ const getDefaultConfig = () => {
|
|
|
762
768
|
*/
|
|
763
769
|
position: ["static", "fixed", "absolute", "relative", "sticky"],
|
|
764
770
|
/**
|
|
765
|
-
*
|
|
771
|
+
* Inset
|
|
766
772
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
767
773
|
*/
|
|
768
774
|
inset: [{
|
|
769
775
|
inset: scaleInset()
|
|
770
776
|
}],
|
|
771
777
|
/**
|
|
772
|
-
*
|
|
778
|
+
* Inset Inline
|
|
773
779
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
774
780
|
*/
|
|
775
781
|
"inset-x": [{
|
|
776
782
|
"inset-x": scaleInset()
|
|
777
783
|
}],
|
|
778
784
|
/**
|
|
779
|
-
*
|
|
785
|
+
* Inset Block
|
|
780
786
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
781
787
|
*/
|
|
782
788
|
"inset-y": [{
|
|
783
789
|
"inset-y": scaleInset()
|
|
784
790
|
}],
|
|
785
791
|
/**
|
|
786
|
-
* Start
|
|
792
|
+
* Inset Inline Start
|
|
787
793
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
794
|
+
* @todo class group will be renamed to `inset-s` in next major release
|
|
788
795
|
*/
|
|
789
796
|
start: [{
|
|
797
|
+
"inset-s": scaleInset(),
|
|
798
|
+
/**
|
|
799
|
+
* @deprecated since Tailwind CSS v4.2.0 in favor of `inset-s-*` utilities.
|
|
800
|
+
* @see https://github.com/tailwindlabs/tailwindcss/pull/19613
|
|
801
|
+
*/
|
|
790
802
|
start: scaleInset()
|
|
791
803
|
}],
|
|
792
804
|
/**
|
|
793
|
-
* End
|
|
805
|
+
* Inset Inline End
|
|
794
806
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
807
|
+
* @todo class group will be renamed to `inset-e` in next major release
|
|
795
808
|
*/
|
|
796
809
|
end: [{
|
|
810
|
+
"inset-e": scaleInset(),
|
|
811
|
+
/**
|
|
812
|
+
* @deprecated since Tailwind CSS v4.2.0 in favor of `inset-e-*` utilities.
|
|
813
|
+
* @see https://github.com/tailwindlabs/tailwindcss/pull/19613
|
|
814
|
+
*/
|
|
797
815
|
end: scaleInset()
|
|
798
816
|
}],
|
|
817
|
+
/**
|
|
818
|
+
* Inset Block Start
|
|
819
|
+
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
820
|
+
*/
|
|
821
|
+
"inset-bs": [{
|
|
822
|
+
"inset-bs": scaleInset()
|
|
823
|
+
}],
|
|
824
|
+
/**
|
|
825
|
+
* Inset Block End
|
|
826
|
+
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
827
|
+
*/
|
|
828
|
+
"inset-be": [{
|
|
829
|
+
"inset-be": scaleInset()
|
|
830
|
+
}],
|
|
799
831
|
/**
|
|
800
832
|
* Top
|
|
801
833
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
@@ -1062,33 +1094,47 @@ const getDefaultConfig = () => {
|
|
|
1062
1094
|
p: scaleUnambiguousSpacing()
|
|
1063
1095
|
}],
|
|
1064
1096
|
/**
|
|
1065
|
-
* Padding
|
|
1097
|
+
* Padding Inline
|
|
1066
1098
|
* @see https://tailwindcss.com/docs/padding
|
|
1067
1099
|
*/
|
|
1068
1100
|
px: [{
|
|
1069
1101
|
px: scaleUnambiguousSpacing()
|
|
1070
1102
|
}],
|
|
1071
1103
|
/**
|
|
1072
|
-
* Padding
|
|
1104
|
+
* Padding Block
|
|
1073
1105
|
* @see https://tailwindcss.com/docs/padding
|
|
1074
1106
|
*/
|
|
1075
1107
|
py: [{
|
|
1076
1108
|
py: scaleUnambiguousSpacing()
|
|
1077
1109
|
}],
|
|
1078
1110
|
/**
|
|
1079
|
-
* Padding Start
|
|
1111
|
+
* Padding Inline Start
|
|
1080
1112
|
* @see https://tailwindcss.com/docs/padding
|
|
1081
1113
|
*/
|
|
1082
1114
|
ps: [{
|
|
1083
1115
|
ps: scaleUnambiguousSpacing()
|
|
1084
1116
|
}],
|
|
1085
1117
|
/**
|
|
1086
|
-
* Padding End
|
|
1118
|
+
* Padding Inline End
|
|
1087
1119
|
* @see https://tailwindcss.com/docs/padding
|
|
1088
1120
|
*/
|
|
1089
1121
|
pe: [{
|
|
1090
1122
|
pe: scaleUnambiguousSpacing()
|
|
1091
1123
|
}],
|
|
1124
|
+
/**
|
|
1125
|
+
* Padding Block Start
|
|
1126
|
+
* @see https://tailwindcss.com/docs/padding
|
|
1127
|
+
*/
|
|
1128
|
+
pbs: [{
|
|
1129
|
+
pbs: scaleUnambiguousSpacing()
|
|
1130
|
+
}],
|
|
1131
|
+
/**
|
|
1132
|
+
* Padding Block End
|
|
1133
|
+
* @see https://tailwindcss.com/docs/padding
|
|
1134
|
+
*/
|
|
1135
|
+
pbe: [{
|
|
1136
|
+
pbe: scaleUnambiguousSpacing()
|
|
1137
|
+
}],
|
|
1092
1138
|
/**
|
|
1093
1139
|
* Padding Top
|
|
1094
1140
|
* @see https://tailwindcss.com/docs/padding
|
|
@@ -1125,33 +1171,47 @@ const getDefaultConfig = () => {
|
|
|
1125
1171
|
m: scaleMargin()
|
|
1126
1172
|
}],
|
|
1127
1173
|
/**
|
|
1128
|
-
* Margin
|
|
1174
|
+
* Margin Inline
|
|
1129
1175
|
* @see https://tailwindcss.com/docs/margin
|
|
1130
1176
|
*/
|
|
1131
1177
|
mx: [{
|
|
1132
1178
|
mx: scaleMargin()
|
|
1133
1179
|
}],
|
|
1134
1180
|
/**
|
|
1135
|
-
* Margin
|
|
1181
|
+
* Margin Block
|
|
1136
1182
|
* @see https://tailwindcss.com/docs/margin
|
|
1137
1183
|
*/
|
|
1138
1184
|
my: [{
|
|
1139
1185
|
my: scaleMargin()
|
|
1140
1186
|
}],
|
|
1141
1187
|
/**
|
|
1142
|
-
* Margin Start
|
|
1188
|
+
* Margin Inline Start
|
|
1143
1189
|
* @see https://tailwindcss.com/docs/margin
|
|
1144
1190
|
*/
|
|
1145
1191
|
ms: [{
|
|
1146
1192
|
ms: scaleMargin()
|
|
1147
1193
|
}],
|
|
1148
1194
|
/**
|
|
1149
|
-
* Margin End
|
|
1195
|
+
* Margin Inline End
|
|
1150
1196
|
* @see https://tailwindcss.com/docs/margin
|
|
1151
1197
|
*/
|
|
1152
1198
|
me: [{
|
|
1153
1199
|
me: scaleMargin()
|
|
1154
1200
|
}],
|
|
1201
|
+
/**
|
|
1202
|
+
* Margin Block Start
|
|
1203
|
+
* @see https://tailwindcss.com/docs/margin
|
|
1204
|
+
*/
|
|
1205
|
+
mbs: [{
|
|
1206
|
+
mbs: scaleMargin()
|
|
1207
|
+
}],
|
|
1208
|
+
/**
|
|
1209
|
+
* Margin Block End
|
|
1210
|
+
* @see https://tailwindcss.com/docs/margin
|
|
1211
|
+
*/
|
|
1212
|
+
mbe: [{
|
|
1213
|
+
mbe: scaleMargin()
|
|
1214
|
+
}],
|
|
1155
1215
|
/**
|
|
1156
1216
|
* Margin Top
|
|
1157
1217
|
* @see https://tailwindcss.com/docs/margin
|
|
@@ -1214,6 +1274,48 @@ const getDefaultConfig = () => {
|
|
|
1214
1274
|
size: [{
|
|
1215
1275
|
size: scaleSizing()
|
|
1216
1276
|
}],
|
|
1277
|
+
/**
|
|
1278
|
+
* Inline Size
|
|
1279
|
+
* @see https://tailwindcss.com/docs/width
|
|
1280
|
+
*/
|
|
1281
|
+
"inline-size": [{
|
|
1282
|
+
inline: ["auto", ...scaleSizingInline()]
|
|
1283
|
+
}],
|
|
1284
|
+
/**
|
|
1285
|
+
* Min-Inline Size
|
|
1286
|
+
* @see https://tailwindcss.com/docs/min-width
|
|
1287
|
+
*/
|
|
1288
|
+
"min-inline-size": [{
|
|
1289
|
+
"min-inline": ["auto", ...scaleSizingInline()]
|
|
1290
|
+
}],
|
|
1291
|
+
/**
|
|
1292
|
+
* Max-Inline Size
|
|
1293
|
+
* @see https://tailwindcss.com/docs/max-width
|
|
1294
|
+
*/
|
|
1295
|
+
"max-inline-size": [{
|
|
1296
|
+
"max-inline": ["none", ...scaleSizingInline()]
|
|
1297
|
+
}],
|
|
1298
|
+
/**
|
|
1299
|
+
* Block Size
|
|
1300
|
+
* @see https://tailwindcss.com/docs/height
|
|
1301
|
+
*/
|
|
1302
|
+
"block-size": [{
|
|
1303
|
+
block: ["auto", ...scaleSizingBlock()]
|
|
1304
|
+
}],
|
|
1305
|
+
/**
|
|
1306
|
+
* Min-Block Size
|
|
1307
|
+
* @see https://tailwindcss.com/docs/min-height
|
|
1308
|
+
*/
|
|
1309
|
+
"min-block-size": [{
|
|
1310
|
+
"min-block": ["auto", ...scaleSizingBlock()]
|
|
1311
|
+
}],
|
|
1312
|
+
/**
|
|
1313
|
+
* Max-Block Size
|
|
1314
|
+
* @see https://tailwindcss.com/docs/max-height
|
|
1315
|
+
*/
|
|
1316
|
+
"max-block-size": [{
|
|
1317
|
+
"max-block": ["none", ...scaleSizingBlock()]
|
|
1318
|
+
}],
|
|
1217
1319
|
/**
|
|
1218
1320
|
* Width
|
|
1219
1321
|
* @see https://tailwindcss.com/docs/width
|
|
@@ -1298,7 +1400,7 @@ const getDefaultConfig = () => {
|
|
|
1298
1400
|
* @see https://tailwindcss.com/docs/font-weight
|
|
1299
1401
|
*/
|
|
1300
1402
|
"font-weight": [{
|
|
1301
|
-
font: [themeFontWeight,
|
|
1403
|
+
font: [themeFontWeight, isArbitraryVariableWeight, isArbitraryWeight]
|
|
1302
1404
|
}],
|
|
1303
1405
|
/**
|
|
1304
1406
|
* Font Stretch
|
|
@@ -1312,7 +1414,14 @@ const getDefaultConfig = () => {
|
|
|
1312
1414
|
* @see https://tailwindcss.com/docs/font-family
|
|
1313
1415
|
*/
|
|
1314
1416
|
"font-family": [{
|
|
1315
|
-
font: [isArbitraryVariableFamilyName,
|
|
1417
|
+
font: [isArbitraryVariableFamilyName, isArbitraryFamilyName, themeFont]
|
|
1418
|
+
}],
|
|
1419
|
+
/**
|
|
1420
|
+
* Font Feature Settings
|
|
1421
|
+
* @see https://tailwindcss.com/docs/font-feature-settings
|
|
1422
|
+
*/
|
|
1423
|
+
"font-features": [{
|
|
1424
|
+
"font-features": [isArbitraryValue]
|
|
1316
1425
|
}],
|
|
1317
1426
|
/**
|
|
1318
1427
|
* Font Variant Numeric
|
|
@@ -1734,33 +1843,47 @@ const getDefaultConfig = () => {
|
|
|
1734
1843
|
border: scaleBorderWidth()
|
|
1735
1844
|
}],
|
|
1736
1845
|
/**
|
|
1737
|
-
* Border Width
|
|
1846
|
+
* Border Width Inline
|
|
1738
1847
|
* @see https://tailwindcss.com/docs/border-width
|
|
1739
1848
|
*/
|
|
1740
1849
|
"border-w-x": [{
|
|
1741
1850
|
"border-x": scaleBorderWidth()
|
|
1742
1851
|
}],
|
|
1743
1852
|
/**
|
|
1744
|
-
* Border Width
|
|
1853
|
+
* Border Width Block
|
|
1745
1854
|
* @see https://tailwindcss.com/docs/border-width
|
|
1746
1855
|
*/
|
|
1747
1856
|
"border-w-y": [{
|
|
1748
1857
|
"border-y": scaleBorderWidth()
|
|
1749
1858
|
}],
|
|
1750
1859
|
/**
|
|
1751
|
-
* Border Width Start
|
|
1860
|
+
* Border Width Inline Start
|
|
1752
1861
|
* @see https://tailwindcss.com/docs/border-width
|
|
1753
1862
|
*/
|
|
1754
1863
|
"border-w-s": [{
|
|
1755
1864
|
"border-s": scaleBorderWidth()
|
|
1756
1865
|
}],
|
|
1757
1866
|
/**
|
|
1758
|
-
* Border Width End
|
|
1867
|
+
* Border Width Inline End
|
|
1759
1868
|
* @see https://tailwindcss.com/docs/border-width
|
|
1760
1869
|
*/
|
|
1761
1870
|
"border-w-e": [{
|
|
1762
1871
|
"border-e": scaleBorderWidth()
|
|
1763
1872
|
}],
|
|
1873
|
+
/**
|
|
1874
|
+
* Border Width Block Start
|
|
1875
|
+
* @see https://tailwindcss.com/docs/border-width
|
|
1876
|
+
*/
|
|
1877
|
+
"border-w-bs": [{
|
|
1878
|
+
"border-bs": scaleBorderWidth()
|
|
1879
|
+
}],
|
|
1880
|
+
/**
|
|
1881
|
+
* Border Width Block End
|
|
1882
|
+
* @see https://tailwindcss.com/docs/border-width
|
|
1883
|
+
*/
|
|
1884
|
+
"border-w-be": [{
|
|
1885
|
+
"border-be": scaleBorderWidth()
|
|
1886
|
+
}],
|
|
1764
1887
|
/**
|
|
1765
1888
|
* Border Width Top
|
|
1766
1889
|
* @see https://tailwindcss.com/docs/border-width
|
|
@@ -1835,33 +1958,47 @@ const getDefaultConfig = () => {
|
|
|
1835
1958
|
border: scaleColor()
|
|
1836
1959
|
}],
|
|
1837
1960
|
/**
|
|
1838
|
-
* Border Color
|
|
1961
|
+
* Border Color Inline
|
|
1839
1962
|
* @see https://tailwindcss.com/docs/border-color
|
|
1840
1963
|
*/
|
|
1841
1964
|
"border-color-x": [{
|
|
1842
1965
|
"border-x": scaleColor()
|
|
1843
1966
|
}],
|
|
1844
1967
|
/**
|
|
1845
|
-
* Border Color
|
|
1968
|
+
* Border Color Block
|
|
1846
1969
|
* @see https://tailwindcss.com/docs/border-color
|
|
1847
1970
|
*/
|
|
1848
1971
|
"border-color-y": [{
|
|
1849
1972
|
"border-y": scaleColor()
|
|
1850
1973
|
}],
|
|
1851
1974
|
/**
|
|
1852
|
-
* Border Color
|
|
1975
|
+
* Border Color Inline Start
|
|
1853
1976
|
* @see https://tailwindcss.com/docs/border-color
|
|
1854
1977
|
*/
|
|
1855
1978
|
"border-color-s": [{
|
|
1856
1979
|
"border-s": scaleColor()
|
|
1857
1980
|
}],
|
|
1858
1981
|
/**
|
|
1859
|
-
* Border Color
|
|
1982
|
+
* Border Color Inline End
|
|
1860
1983
|
* @see https://tailwindcss.com/docs/border-color
|
|
1861
1984
|
*/
|
|
1862
1985
|
"border-color-e": [{
|
|
1863
1986
|
"border-e": scaleColor()
|
|
1864
1987
|
}],
|
|
1988
|
+
/**
|
|
1989
|
+
* Border Color Block Start
|
|
1990
|
+
* @see https://tailwindcss.com/docs/border-color
|
|
1991
|
+
*/
|
|
1992
|
+
"border-color-bs": [{
|
|
1993
|
+
"border-bs": scaleColor()
|
|
1994
|
+
}],
|
|
1995
|
+
/**
|
|
1996
|
+
* Border Color Block End
|
|
1997
|
+
* @see https://tailwindcss.com/docs/border-color
|
|
1998
|
+
*/
|
|
1999
|
+
"border-color-be": [{
|
|
2000
|
+
"border-be": scaleColor()
|
|
2001
|
+
}],
|
|
1865
2002
|
/**
|
|
1866
2003
|
* Border Color Top
|
|
1867
2004
|
* @see https://tailwindcss.com/docs/border-color
|
|
@@ -2740,33 +2877,47 @@ const getDefaultConfig = () => {
|
|
|
2740
2877
|
"scroll-m": scaleUnambiguousSpacing()
|
|
2741
2878
|
}],
|
|
2742
2879
|
/**
|
|
2743
|
-
* Scroll Margin
|
|
2880
|
+
* Scroll Margin Inline
|
|
2744
2881
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2745
2882
|
*/
|
|
2746
2883
|
"scroll-mx": [{
|
|
2747
2884
|
"scroll-mx": scaleUnambiguousSpacing()
|
|
2748
2885
|
}],
|
|
2749
2886
|
/**
|
|
2750
|
-
* Scroll Margin
|
|
2887
|
+
* Scroll Margin Block
|
|
2751
2888
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2752
2889
|
*/
|
|
2753
2890
|
"scroll-my": [{
|
|
2754
2891
|
"scroll-my": scaleUnambiguousSpacing()
|
|
2755
2892
|
}],
|
|
2756
2893
|
/**
|
|
2757
|
-
* Scroll Margin Start
|
|
2894
|
+
* Scroll Margin Inline Start
|
|
2758
2895
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2759
2896
|
*/
|
|
2760
2897
|
"scroll-ms": [{
|
|
2761
2898
|
"scroll-ms": scaleUnambiguousSpacing()
|
|
2762
2899
|
}],
|
|
2763
2900
|
/**
|
|
2764
|
-
* Scroll Margin End
|
|
2901
|
+
* Scroll Margin Inline End
|
|
2765
2902
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2766
2903
|
*/
|
|
2767
2904
|
"scroll-me": [{
|
|
2768
2905
|
"scroll-me": scaleUnambiguousSpacing()
|
|
2769
2906
|
}],
|
|
2907
|
+
/**
|
|
2908
|
+
* Scroll Margin Block Start
|
|
2909
|
+
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2910
|
+
*/
|
|
2911
|
+
"scroll-mbs": [{
|
|
2912
|
+
"scroll-mbs": scaleUnambiguousSpacing()
|
|
2913
|
+
}],
|
|
2914
|
+
/**
|
|
2915
|
+
* Scroll Margin Block End
|
|
2916
|
+
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2917
|
+
*/
|
|
2918
|
+
"scroll-mbe": [{
|
|
2919
|
+
"scroll-mbe": scaleUnambiguousSpacing()
|
|
2920
|
+
}],
|
|
2770
2921
|
/**
|
|
2771
2922
|
* Scroll Margin Top
|
|
2772
2923
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
@@ -2803,33 +2954,47 @@ const getDefaultConfig = () => {
|
|
|
2803
2954
|
"scroll-p": scaleUnambiguousSpacing()
|
|
2804
2955
|
}],
|
|
2805
2956
|
/**
|
|
2806
|
-
* Scroll Padding
|
|
2957
|
+
* Scroll Padding Inline
|
|
2807
2958
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2808
2959
|
*/
|
|
2809
2960
|
"scroll-px": [{
|
|
2810
2961
|
"scroll-px": scaleUnambiguousSpacing()
|
|
2811
2962
|
}],
|
|
2812
2963
|
/**
|
|
2813
|
-
* Scroll Padding
|
|
2964
|
+
* Scroll Padding Block
|
|
2814
2965
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2815
2966
|
*/
|
|
2816
2967
|
"scroll-py": [{
|
|
2817
2968
|
"scroll-py": scaleUnambiguousSpacing()
|
|
2818
2969
|
}],
|
|
2819
2970
|
/**
|
|
2820
|
-
* Scroll Padding Start
|
|
2971
|
+
* Scroll Padding Inline Start
|
|
2821
2972
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2822
2973
|
*/
|
|
2823
2974
|
"scroll-ps": [{
|
|
2824
2975
|
"scroll-ps": scaleUnambiguousSpacing()
|
|
2825
2976
|
}],
|
|
2826
2977
|
/**
|
|
2827
|
-
* Scroll Padding End
|
|
2978
|
+
* Scroll Padding Inline End
|
|
2828
2979
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2829
2980
|
*/
|
|
2830
2981
|
"scroll-pe": [{
|
|
2831
2982
|
"scroll-pe": scaleUnambiguousSpacing()
|
|
2832
2983
|
}],
|
|
2984
|
+
/**
|
|
2985
|
+
* Scroll Padding Block Start
|
|
2986
|
+
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2987
|
+
*/
|
|
2988
|
+
"scroll-pbs": [{
|
|
2989
|
+
"scroll-pbs": scaleUnambiguousSpacing()
|
|
2990
|
+
}],
|
|
2991
|
+
/**
|
|
2992
|
+
* Scroll Padding Block End
|
|
2993
|
+
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2994
|
+
*/
|
|
2995
|
+
"scroll-pbe": [{
|
|
2996
|
+
"scroll-pbe": scaleUnambiguousSpacing()
|
|
2997
|
+
}],
|
|
2833
2998
|
/**
|
|
2834
2999
|
* Scroll Padding Top
|
|
2835
3000
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
@@ -2964,15 +3129,15 @@ const getDefaultConfig = () => {
|
|
|
2964
3129
|
conflictingClassGroups: {
|
|
2965
3130
|
overflow: ["overflow-x", "overflow-y"],
|
|
2966
3131
|
overscroll: ["overscroll-x", "overscroll-y"],
|
|
2967
|
-
inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
|
|
3132
|
+
inset: ["inset-x", "inset-y", "inset-bs", "inset-be", "start", "end", "top", "right", "bottom", "left"],
|
|
2968
3133
|
"inset-x": ["right", "left"],
|
|
2969
3134
|
"inset-y": ["top", "bottom"],
|
|
2970
3135
|
flex: ["basis", "grow", "shrink"],
|
|
2971
3136
|
gap: ["gap-x", "gap-y"],
|
|
2972
|
-
p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
|
|
3137
|
+
p: ["px", "py", "ps", "pe", "pbs", "pbe", "pt", "pr", "pb", "pl"],
|
|
2973
3138
|
px: ["pr", "pl"],
|
|
2974
3139
|
py: ["pt", "pb"],
|
|
2975
|
-
m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
|
|
3140
|
+
m: ["mx", "my", "ms", "me", "mbs", "mbe", "mt", "mr", "mb", "ml"],
|
|
2976
3141
|
mx: ["mr", "ml"],
|
|
2977
3142
|
my: ["mt", "mb"],
|
|
2978
3143
|
size: ["w", "h"],
|
|
@@ -2992,18 +3157,18 @@ const getDefaultConfig = () => {
|
|
|
2992
3157
|
"rounded-b": ["rounded-br", "rounded-bl"],
|
|
2993
3158
|
"rounded-l": ["rounded-tl", "rounded-bl"],
|
|
2994
3159
|
"border-spacing": ["border-spacing-x", "border-spacing-y"],
|
|
2995
|
-
"border-w": ["border-w-x", "border-w-y", "border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
|
|
3160
|
+
"border-w": ["border-w-x", "border-w-y", "border-w-s", "border-w-e", "border-w-bs", "border-w-be", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
|
|
2996
3161
|
"border-w-x": ["border-w-r", "border-w-l"],
|
|
2997
3162
|
"border-w-y": ["border-w-t", "border-w-b"],
|
|
2998
|
-
"border-color": ["border-color-x", "border-color-y", "border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
|
|
3163
|
+
"border-color": ["border-color-x", "border-color-y", "border-color-s", "border-color-e", "border-color-bs", "border-color-be", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
|
|
2999
3164
|
"border-color-x": ["border-color-r", "border-color-l"],
|
|
3000
3165
|
"border-color-y": ["border-color-t", "border-color-b"],
|
|
3001
3166
|
translate: ["translate-x", "translate-y", "translate-none"],
|
|
3002
3167
|
"translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
|
|
3003
|
-
"scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
|
|
3168
|
+
"scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mbs", "scroll-mbe", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
|
|
3004
3169
|
"scroll-mx": ["scroll-mr", "scroll-ml"],
|
|
3005
3170
|
"scroll-my": ["scroll-mt", "scroll-mb"],
|
|
3006
|
-
"scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
|
|
3171
|
+
"scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pbs", "scroll-pbe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
|
|
3007
3172
|
"scroll-px": ["scroll-pr", "scroll-pl"],
|
|
3008
3173
|
"scroll-py": ["scroll-pt", "scroll-pb"],
|
|
3009
3174
|
touch: ["touch-x", "touch-y", "touch-pz"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c as cn } from "../../_chunks/utils.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
-
import { useRef, useCallback } from "react";
|
|
4
|
+
import { useRef, useState, useCallback, useEffect } from "react";
|
|
5
5
|
import { c as cva } from "../../_chunks/index2.js";
|
|
6
6
|
import { c as createLucideIcon } from "../../_chunks/createLucideIcon.js";
|
|
7
7
|
const __iconNode$1 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
|
|
@@ -9,11 +9,11 @@ const ChevronLeft = createLucideIcon("chevron-left", __iconNode$1);
|
|
|
9
9
|
const __iconNode = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
10
10
|
const ChevronRight = createLucideIcon("chevron-right", __iconNode);
|
|
11
11
|
const horizontalListVariants = cva(
|
|
12
|
-
"scrollbar-hidden overscroll-x-contain
|
|
12
|
+
"py-1 scrollbar-hidden overscroll-x-contain overflow-x-auto snap-start snap-mandatory scroll-smooth *:shrink-0 *:grow-0 *:snap-center *:select-none",
|
|
13
13
|
{
|
|
14
14
|
variants: {
|
|
15
15
|
variant: {
|
|
16
|
-
contain: "w-full
|
|
16
|
+
contain: "w-full",
|
|
17
17
|
overflow: "w-screen px-(--spacing-section) -ms-(--spacing-section) scroll-px-(--spacing-section)"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
@@ -30,34 +30,34 @@ function HorizontalList({
|
|
|
30
30
|
scrollBy = 360,
|
|
31
31
|
...props
|
|
32
32
|
}) {
|
|
33
|
+
const rootRef = useRef(null);
|
|
33
34
|
const containerRef = useRef(null);
|
|
35
|
+
const wrapperRef = useRef(null);
|
|
36
|
+
const [isOverflowed, setIsOverflowed] = useState(true);
|
|
34
37
|
const scrollLeft = useCallback(() => {
|
|
35
38
|
containerRef.current?.scrollBy({ left: -scrollBy });
|
|
36
39
|
}, [scrollBy]);
|
|
37
40
|
const scrollRight = useCallback(() => {
|
|
38
41
|
containerRef.current?.scrollBy({ left: scrollBy });
|
|
39
42
|
}, [scrollBy]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (rootRef.current && wrapperRef.current) {
|
|
45
|
+
const rootRect = rootRef.current.getBoundingClientRect();
|
|
46
|
+
const wrapperRect = wrapperRef.current.getBoundingClientRect();
|
|
47
|
+
setIsOverflowed(wrapperRect.width - rootRect.width > 8);
|
|
48
|
+
}
|
|
49
|
+
}, []);
|
|
40
50
|
return /* @__PURE__ */ jsxs(
|
|
41
51
|
"div",
|
|
42
52
|
{
|
|
53
|
+
ref: rootRef,
|
|
43
54
|
className: cn("flex gap-4", {
|
|
44
55
|
"flex-col": toolbarLocation === "bottom",
|
|
45
56
|
"flex-col-reverse": toolbarLocation === "top"
|
|
46
57
|
}),
|
|
47
58
|
children: [
|
|
48
|
-
/* @__PURE__ */ jsx(
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
ref: containerRef,
|
|
52
|
-
className: cn(
|
|
53
|
-
horizontalListVariants({ variant }),
|
|
54
|
-
className
|
|
55
|
-
),
|
|
56
|
-
...props,
|
|
57
|
-
children
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-center sm:justify-start", children: [
|
|
59
|
+
/* @__PURE__ */ jsx("div", { ref: containerRef, className: cn(horizontalListVariants({ variant }), className), ...props, children: /* @__PURE__ */ jsx("div", { className: "w-fit flex flex-row flex-nowrap gap-(--gap-card) ", ref: wrapperRef, children }) }),
|
|
60
|
+
isOverflowed && /* @__PURE__ */ jsxs("div", { className: "flex justify-center sm:justify-start", children: [
|
|
61
61
|
/* @__PURE__ */ jsx(Button, { size: "icon", variant: "ghost", className: "rounded-full", onClick: scrollLeft, children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-9" }) }),
|
|
62
62
|
/* @__PURE__ */ jsx(Button, { size: "icon", variant: "ghost", className: "rounded-full", onClick: scrollRight, children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-9" }) })
|
|
63
63
|
] })
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import React__default from "react";
|
|
4
4
|
import ReactDOM__default from "react-dom";
|
|
5
|
-
import { c as createContextScope, P as Primitive, u as useControllableState, a as
|
|
5
|
+
import { c as createContextScope, P as Primitive, u as useControllableState, a as Presence, b as composeEventHandlers, d as useId, e as useCallbackRef, D as DismissableLayer, f as useLayoutEffect2, g as dispatchDiscreteCustomEvent } from "../../_chunks/index4.js";
|
|
6
6
|
import { c as composeRefs, u as useComposedRefs } from "../../_chunks/index3.js";
|
|
7
7
|
import { c as cn } from "../../_chunks/utils.js";
|
|
8
8
|
import { buttonVariants } from "./button.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useLayoutEffect, useState } from "react";
|
|
4
|
-
import { e as useCallbackRef$1, P as Primitive, f as useLayoutEffect2, c as createContextScope, u as useControllableState,
|
|
4
|
+
import { e as useCallbackRef$1, P as Primitive, f as useLayoutEffect2, c as createContextScope, u as useControllableState, d as useId, a as Presence, b as composeEventHandlers, D as DismissableLayer } from "../../_chunks/index4.js";
|
|
5
5
|
import { u as useComposedRefs, c as composeRefs } from "../../_chunks/index3.js";
|
|
6
6
|
import * as ReactDOM from "react-dom";
|
|
7
7
|
import ReactDOM__default from "react-dom";
|
|
@@ -415,6 +415,62 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
415
415
|
}
|
|
416
416
|
return coords;
|
|
417
417
|
}
|
|
418
|
+
async function detectOverflow(state, options) {
|
|
419
|
+
var _await$platform$isEle;
|
|
420
|
+
if (options === void 0) {
|
|
421
|
+
options = {};
|
|
422
|
+
}
|
|
423
|
+
const {
|
|
424
|
+
x,
|
|
425
|
+
y,
|
|
426
|
+
platform: platform2,
|
|
427
|
+
rects,
|
|
428
|
+
elements,
|
|
429
|
+
strategy
|
|
430
|
+
} = state;
|
|
431
|
+
const {
|
|
432
|
+
boundary = "clippingAncestors",
|
|
433
|
+
rootBoundary = "viewport",
|
|
434
|
+
elementContext = "floating",
|
|
435
|
+
altBoundary = false,
|
|
436
|
+
padding = 0
|
|
437
|
+
} = evaluate(options, state);
|
|
438
|
+
const paddingObject = getPaddingObject(padding);
|
|
439
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
440
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
441
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
442
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
443
|
+
boundary,
|
|
444
|
+
rootBoundary,
|
|
445
|
+
strategy
|
|
446
|
+
}));
|
|
447
|
+
const rect = elementContext === "floating" ? {
|
|
448
|
+
x,
|
|
449
|
+
y,
|
|
450
|
+
width: rects.floating.width,
|
|
451
|
+
height: rects.floating.height
|
|
452
|
+
} : rects.reference;
|
|
453
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
454
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
455
|
+
x: 1,
|
|
456
|
+
y: 1
|
|
457
|
+
} : {
|
|
458
|
+
x: 1,
|
|
459
|
+
y: 1
|
|
460
|
+
};
|
|
461
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
462
|
+
elements,
|
|
463
|
+
rect,
|
|
464
|
+
offsetParent,
|
|
465
|
+
strategy
|
|
466
|
+
}) : rect);
|
|
467
|
+
return {
|
|
468
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
469
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
470
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
471
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
472
|
+
};
|
|
473
|
+
}
|
|
418
474
|
const computePosition$1 = async (reference, floating, config) => {
|
|
419
475
|
const {
|
|
420
476
|
placement = "bottom",
|
|
@@ -437,6 +493,7 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
437
493
|
let middlewareData = {};
|
|
438
494
|
let resetCount = 0;
|
|
439
495
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
496
|
+
var _platform$detectOverf;
|
|
440
497
|
const {
|
|
441
498
|
name,
|
|
442
499
|
fn
|
|
@@ -454,7 +511,10 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
454
511
|
strategy,
|
|
455
512
|
middlewareData,
|
|
456
513
|
rects,
|
|
457
|
-
platform:
|
|
514
|
+
platform: {
|
|
515
|
+
...platform2,
|
|
516
|
+
detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
517
|
+
},
|
|
458
518
|
elements: {
|
|
459
519
|
reference,
|
|
460
520
|
floating
|
|
@@ -498,62 +558,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
498
558
|
middlewareData
|
|
499
559
|
};
|
|
500
560
|
};
|
|
501
|
-
async function detectOverflow(state, options) {
|
|
502
|
-
var _await$platform$isEle;
|
|
503
|
-
if (options === void 0) {
|
|
504
|
-
options = {};
|
|
505
|
-
}
|
|
506
|
-
const {
|
|
507
|
-
x,
|
|
508
|
-
y,
|
|
509
|
-
platform: platform2,
|
|
510
|
-
rects,
|
|
511
|
-
elements,
|
|
512
|
-
strategy
|
|
513
|
-
} = state;
|
|
514
|
-
const {
|
|
515
|
-
boundary = "clippingAncestors",
|
|
516
|
-
rootBoundary = "viewport",
|
|
517
|
-
elementContext = "floating",
|
|
518
|
-
altBoundary = false,
|
|
519
|
-
padding = 0
|
|
520
|
-
} = evaluate(options, state);
|
|
521
|
-
const paddingObject = getPaddingObject(padding);
|
|
522
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
523
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
524
|
-
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
525
|
-
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
526
|
-
boundary,
|
|
527
|
-
rootBoundary,
|
|
528
|
-
strategy
|
|
529
|
-
}));
|
|
530
|
-
const rect = elementContext === "floating" ? {
|
|
531
|
-
x,
|
|
532
|
-
y,
|
|
533
|
-
width: rects.floating.width,
|
|
534
|
-
height: rects.floating.height
|
|
535
|
-
} : rects.reference;
|
|
536
|
-
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
537
|
-
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
538
|
-
x: 1,
|
|
539
|
-
y: 1
|
|
540
|
-
} : {
|
|
541
|
-
x: 1,
|
|
542
|
-
y: 1
|
|
543
|
-
};
|
|
544
|
-
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
545
|
-
elements,
|
|
546
|
-
rect,
|
|
547
|
-
offsetParent,
|
|
548
|
-
strategy
|
|
549
|
-
}) : rect);
|
|
550
|
-
return {
|
|
551
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
552
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
553
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
554
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
561
|
const arrow$3 = (options) => ({
|
|
558
562
|
name: "arrow",
|
|
559
563
|
options,
|
|
@@ -655,7 +659,7 @@ const flip$2 = function(options) {
|
|
|
655
659
|
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
656
660
|
}
|
|
657
661
|
const placements = [initialPlacement, ...fallbackPlacements];
|
|
658
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
662
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
659
663
|
const overflows = [];
|
|
660
664
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
661
665
|
if (checkMainAxis) {
|
|
@@ -745,7 +749,8 @@ const hide$2 = function(options) {
|
|
|
745
749
|
options,
|
|
746
750
|
async fn(state) {
|
|
747
751
|
const {
|
|
748
|
-
rects
|
|
752
|
+
rects,
|
|
753
|
+
platform: platform2
|
|
749
754
|
} = state;
|
|
750
755
|
const {
|
|
751
756
|
strategy = "referenceHidden",
|
|
@@ -753,7 +758,7 @@ const hide$2 = function(options) {
|
|
|
753
758
|
} = evaluate(options, state);
|
|
754
759
|
switch (strategy) {
|
|
755
760
|
case "referenceHidden": {
|
|
756
|
-
const overflow = await detectOverflow(state, {
|
|
761
|
+
const overflow = await platform2.detectOverflow(state, {
|
|
757
762
|
...detectOverflowOptions,
|
|
758
763
|
elementContext: "reference"
|
|
759
764
|
});
|
|
@@ -766,7 +771,7 @@ const hide$2 = function(options) {
|
|
|
766
771
|
};
|
|
767
772
|
}
|
|
768
773
|
case "escaped": {
|
|
769
|
-
const overflow = await detectOverflow(state, {
|
|
774
|
+
const overflow = await platform2.detectOverflow(state, {
|
|
770
775
|
...detectOverflowOptions,
|
|
771
776
|
altBoundary: true
|
|
772
777
|
});
|
|
@@ -864,7 +869,8 @@ const shift$2 = function(options) {
|
|
|
864
869
|
const {
|
|
865
870
|
x,
|
|
866
871
|
y,
|
|
867
|
-
placement
|
|
872
|
+
placement,
|
|
873
|
+
platform: platform2
|
|
868
874
|
} = state;
|
|
869
875
|
const {
|
|
870
876
|
mainAxis: checkMainAxis = true,
|
|
@@ -887,7 +893,7 @@ const shift$2 = function(options) {
|
|
|
887
893
|
x,
|
|
888
894
|
y
|
|
889
895
|
};
|
|
890
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
896
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
891
897
|
const crossAxis = getSideAxis(getSide(placement));
|
|
892
898
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
893
899
|
let mainAxisCoord = coords[mainAxis];
|
|
@@ -1010,7 +1016,7 @@ const size$2 = function(options) {
|
|
|
1010
1016
|
},
|
|
1011
1017
|
...detectOverflowOptions
|
|
1012
1018
|
} = evaluate(options, state);
|
|
1013
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1019
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
1014
1020
|
const side = getSide(placement);
|
|
1015
1021
|
const alignment = getAlignment(placement);
|
|
1016
1022
|
const isYAxis = getSideAxis(placement) === "y";
|
|
@@ -3181,6 +3187,12 @@ function RemoveScrollSideCar(props) {
|
|
|
3181
3187
|
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
3182
3188
|
return false;
|
|
3183
3189
|
}
|
|
3190
|
+
var selection = window.getSelection();
|
|
3191
|
+
var anchorNode = selection && selection.anchorNode;
|
|
3192
|
+
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
3193
|
+
if (isTouchingSelection) {
|
|
3194
|
+
return false;
|
|
3195
|
+
}
|
|
3184
3196
|
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3185
3197
|
if (!canBeScrolledInMainDirection) {
|
|
3186
3198
|
return true;
|
package/dist/lib/object.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
const get = (object, prop) => prop.split(".").reduce(
|
|
1
|
+
const get = (object, prop) => prop.split(".").reduce(
|
|
2
|
+
(reducedObject, key) => reducedObject && key in reducedObject ? reducedObject[key] : void 0,
|
|
3
|
+
object
|
|
4
|
+
);
|
|
2
5
|
const set = (object, prop, value) => {
|
|
3
6
|
const propChunks = prop.split(".");
|
|
4
7
|
const lastChunk = propChunks.pop();
|
|
5
8
|
if (!lastChunk) return object;
|
|
6
9
|
const ref = propChunks.reduce((reducedObject, key) => {
|
|
7
|
-
reducedObject[key] = {};
|
|
10
|
+
if (reducedObject[key] === void 0) reducedObject[key] = {};
|
|
8
11
|
return reducedObject[key];
|
|
9
12
|
}, object);
|
|
10
13
|
ref[lastChunk] = value;
|
|
@@ -22,7 +25,10 @@ const omit = (object, props) => {
|
|
|
22
25
|
const propChunks = prop.split(".");
|
|
23
26
|
const lastChunk = propChunks.pop();
|
|
24
27
|
if (lastChunk) {
|
|
25
|
-
const ref = propChunks.reduce(
|
|
28
|
+
const ref = propChunks.reduce(
|
|
29
|
+
(reducedObject, key) => reducedObject && key in reducedObject ? reducedObject[key] : void 0,
|
|
30
|
+
result
|
|
31
|
+
);
|
|
26
32
|
if (ref && lastChunk in ref) delete ref[lastChunk];
|
|
27
33
|
}
|
|
28
34
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bccampus/ui-components",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.12",
|
|
4
4
|
"description": "BCcampus React components",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
9
|
"types": "./dist/components/index.d.ts",
|
|
@@ -22,14 +23,16 @@
|
|
|
22
23
|
"./theme.css": "./src/styles/theme.css",
|
|
23
24
|
"./typography.css": "./src/styles/typography.css"
|
|
24
25
|
},
|
|
26
|
+
"packageManager": "yarn@4.12.0",
|
|
25
27
|
"scripts": {
|
|
26
|
-
"dev": "
|
|
28
|
+
"dev": "ladle serve",
|
|
27
29
|
"check": "tsc -b && eslint ./src",
|
|
28
30
|
"build": "tsc -b && vite build",
|
|
31
|
+
"build:ladle": "ladle build",
|
|
29
32
|
"lint": "eslint .",
|
|
30
33
|
"prepublish": "yarn build",
|
|
31
34
|
"publish": "yarn npm publish --access public --tolerate-republish",
|
|
32
|
-
"preview": "
|
|
35
|
+
"preview": "ladle preview"
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"@bccampus/media-kit": "^0.1.1",
|
|
@@ -49,14 +52,6 @@
|
|
|
49
52
|
"tailwindcss": "^4.1.18",
|
|
50
53
|
"tw-animate-css": "^1.4.0"
|
|
51
54
|
},
|
|
52
|
-
"peerDependencies": {
|
|
53
|
-
"@nanostores/react": "^1.0.0",
|
|
54
|
-
"nanostores": "^1.1.0",
|
|
55
|
-
"react": "^19.2.1",
|
|
56
|
-
"react-dom": "^19.2.1",
|
|
57
|
-
"tailwindcss": "^4.1.18",
|
|
58
|
-
"tw-animate-css": "^1.4.0"
|
|
59
|
-
},
|
|
60
55
|
"devDependencies": {
|
|
61
56
|
"@eslint/js": "^9.39.2",
|
|
62
57
|
"@ladle/react": "^5.1.1",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { cn } from "@/lib/utils";
|
|
2
2
|
import { Button } from "./button";
|
|
3
3
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
-
import { useCallback, useRef } from "react";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
5
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
6
|
|
|
7
7
|
export type HorizontalListVariantsProps = VariantProps<typeof horizontalListVariants>;
|
|
8
8
|
export const horizontalListVariants = cva(
|
|
9
|
-
"scrollbar-hidden overscroll-x-contain
|
|
9
|
+
"py-1 scrollbar-hidden overscroll-x-contain overflow-x-auto snap-start snap-mandatory scroll-smooth *:shrink-0 *:grow-0 *:snap-center *:select-none",
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
13
|
-
contain: "w-full
|
|
13
|
+
contain: "w-full",
|
|
14
14
|
overflow: "w-screen px-(--spacing-section) -ms-(--spacing-section) scroll-px-(--spacing-section)",
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -33,7 +33,10 @@ export function HorizontalList({
|
|
|
33
33
|
scrollBy = 360,
|
|
34
34
|
...props
|
|
35
35
|
}: HorizontalListProps) {
|
|
36
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
36
37
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
38
|
+
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
39
|
+
const [isOverflowed, setIsOverflowed] = useState<boolean>(true);
|
|
37
40
|
|
|
38
41
|
const scrollLeft = useCallback(() => {
|
|
39
42
|
containerRef.current?.scrollBy({ left: -scrollBy });
|
|
@@ -43,32 +46,38 @@ export function HorizontalList({
|
|
|
43
46
|
containerRef.current?.scrollBy({ left: scrollBy });
|
|
44
47
|
}, [scrollBy]);
|
|
45
48
|
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (rootRef.current && wrapperRef.current) {
|
|
51
|
+
const rootRect = rootRef.current.getBoundingClientRect();
|
|
52
|
+
const wrapperRect = wrapperRef.current.getBoundingClientRect();
|
|
53
|
+
|
|
54
|
+
setIsOverflowed(wrapperRect.width - rootRect.width > 8);
|
|
55
|
+
}
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
46
58
|
return (
|
|
47
59
|
<div
|
|
60
|
+
ref={rootRef}
|
|
48
61
|
className={cn("flex gap-4", {
|
|
49
62
|
"flex-col": toolbarLocation === "bottom",
|
|
50
63
|
"flex-col-reverse": toolbarLocation === "top",
|
|
51
64
|
})}
|
|
52
65
|
>
|
|
53
|
-
<div
|
|
54
|
-
ref={
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
className,
|
|
59
|
-
)}
|
|
60
|
-
{...props}
|
|
61
|
-
>
|
|
62
|
-
{children}
|
|
63
|
-
</div>
|
|
64
|
-
<div className="flex justify-center sm:justify-start">
|
|
65
|
-
<Button size="icon" variant="ghost" className="rounded-full" onClick={scrollLeft}>
|
|
66
|
-
<ChevronLeft className="size-9" />
|
|
67
|
-
</Button>
|
|
68
|
-
<Button size="icon" variant="ghost" className="rounded-full" onClick={scrollRight}>
|
|
69
|
-
<ChevronRight className="size-9" />
|
|
70
|
-
</Button>
|
|
66
|
+
<div ref={containerRef} className={cn(horizontalListVariants({ variant }), className)} {...props}>
|
|
67
|
+
<div className="w-fit flex flex-row flex-nowrap gap-(--gap-card) " ref={wrapperRef}>
|
|
68
|
+
{children}
|
|
69
|
+
</div>
|
|
71
70
|
</div>
|
|
71
|
+
{isOverflowed && (
|
|
72
|
+
<div className="flex justify-center sm:justify-start">
|
|
73
|
+
<Button size="icon" variant="ghost" className="rounded-full" onClick={scrollLeft}>
|
|
74
|
+
<ChevronLeft className="size-9" />
|
|
75
|
+
</Button>
|
|
76
|
+
<Button size="icon" variant="ghost" className="rounded-full" onClick={scrollRight}>
|
|
77
|
+
<ChevronRight className="size-9" />
|
|
78
|
+
</Button>
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
72
81
|
</div>
|
|
73
82
|
);
|
|
74
83
|
}
|
package/src/lib/object.ts
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
|
|
3
|
-
export const get = <T extends object>(object: T, prop: string) =>
|
|
4
|
-
|
|
5
|
-
.
|
|
3
|
+
export const get = <T extends object>(object: T, prop: string) =>
|
|
4
|
+
prop
|
|
5
|
+
.split(".")
|
|
6
|
+
.reduce<any>(
|
|
7
|
+
(reducedObject, key) => (reducedObject && key in reducedObject ? reducedObject[key] : undefined),
|
|
8
|
+
object,
|
|
9
|
+
);
|
|
6
10
|
|
|
7
11
|
export const set = <T extends object, V>(object: T, prop: string, value: V) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const propChunks = prop.split(".");
|
|
13
|
+
const lastChunk = propChunks.pop();
|
|
14
|
+
if (!lastChunk) return object;
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
const ref = propChunks.reduce<any>((reducedObject, key) => {
|
|
17
|
+
if (reducedObject[key] === undefined) reducedObject[key] = {};
|
|
18
|
+
return reducedObject[key];
|
|
19
|
+
}, object);
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
ref[lastChunk] = value;
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
}
|
|
23
|
+
return object;
|
|
24
|
+
};
|
|
21
25
|
|
|
22
26
|
export const pick = <T extends object>(object: T, props: string[]) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
set(result, key, get(object, key));
|
|
27
|
-
|
|
28
|
-
return result;
|
|
29
|
-
}, {}) as Partial<T>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const omit = <T extends object>(object: T, props: string[]) => {
|
|
33
|
-
const result: Partial<T> = { ...object };
|
|
34
|
-
|
|
35
|
-
props.forEach(prop => {
|
|
36
|
-
const propChunks = prop.split('.');
|
|
37
|
-
const lastChunk = propChunks.pop();
|
|
38
|
-
if (lastChunk) {
|
|
39
|
-
const ref = propChunks.reduce<any>((reducedObject, key) => (reducedObject && key in reducedObject) ? reducedObject[key] : undefined, result);
|
|
40
|
-
if (ref && lastChunk in ref) delete ref[lastChunk];
|
|
41
|
-
}
|
|
42
|
-
})
|
|
27
|
+
return props.reduce<Record<string, unknown>>((result, key) => {
|
|
28
|
+
set(result, key, get(object, key));
|
|
43
29
|
|
|
44
30
|
return result;
|
|
45
|
-
}
|
|
31
|
+
}, {}) as Partial<T>;
|
|
32
|
+
};
|
|
46
33
|
|
|
47
|
-
export const
|
|
34
|
+
export const omit = <T extends object>(object: T, props: string[]) => {
|
|
35
|
+
const result: Partial<T> = { ...object };
|
|
48
36
|
|
|
37
|
+
props.forEach((prop) => {
|
|
38
|
+
const propChunks = prop.split(".");
|
|
39
|
+
const lastChunk = propChunks.pop();
|
|
40
|
+
if (lastChunk) {
|
|
41
|
+
const ref = propChunks.reduce<any>(
|
|
42
|
+
(reducedObject, key) => (reducedObject && key in reducedObject ? reducedObject[key] : undefined),
|
|
43
|
+
result,
|
|
44
|
+
);
|
|
45
|
+
if (ref && lastChunk in ref) delete ref[lastChunk];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const isObject = (object: unknown) => typeof object === "object" && !Array.isArray(object) && object !== null;
|