@nimbus-ds/scroll-pane 1.0.0 → 1.0.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -2
- package/dist/CHANGELOG.md +14 -2
- package/dist/index.d.ts +48 -19
- package/dist/index.js +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
The ScrollPane component handles responsive scrolls in lists that are overflowing inside a container.
|
|
4
4
|
|
|
5
|
+
## 2025-11-12 `1.0.2`
|
|
6
|
+
|
|
7
|
+
#### 🐛 Bug fixes
|
|
8
|
+
|
|
9
|
+
- `ScrollPane`: Fixed focus ring styles to match design system. ([#383](https://github.com/TiendaNube/nimbus-design-system/pull/383) by [@joacotornello](https://github.com/joacotornello))
|
|
10
|
+
|
|
11
|
+
## 2025-09-10 `1.0.1`
|
|
12
|
+
|
|
13
|
+
#### 💡 Others
|
|
14
|
+
|
|
15
|
+
- Removed Scroll Pane margins to align with design specifications. ([#347](https://github.com/TiendaNube/nimbus-design-system/pull/347) by [@mrolando-tn](https://github.com/mrolando-tn))
|
|
16
|
+
|
|
5
17
|
## 2025-07-28 `1.0.0`
|
|
6
18
|
|
|
7
19
|
#### 🎉 New features
|
|
@@ -14,5 +26,5 @@ The ScrollPane component handles responsive scrolls in lists that are overflowin
|
|
|
14
26
|
- Option to show/hide scrollbar
|
|
15
27
|
- ScrollPane.Item sub-component for wrapping content
|
|
16
28
|
- Full accessibility support with ARIA labels
|
|
17
|
-
- Responsive design for mobile and desktop
|
|
18
|
-
|
|
29
|
+
- Responsive design for mobile and desktop
|
|
30
|
+
([#319](https://github.com/TiendaNube/nimbus-design-system/pull/319) by [@joacotornello](https://github.com/joacotornello))
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
The ScrollPane component handles responsive scrolls in lists that are overflowing inside a container.
|
|
4
4
|
|
|
5
|
+
## 2025-11-12 `1.0.2`
|
|
6
|
+
|
|
7
|
+
#### 🐛 Bug fixes
|
|
8
|
+
|
|
9
|
+
- `ScrollPane`: Fixed focus ring styles to match design system. ([#383](https://github.com/TiendaNube/nimbus-design-system/pull/383) by [@joacotornello](https://github.com/joacotornello))
|
|
10
|
+
|
|
11
|
+
## 2025-09-10 `1.0.1`
|
|
12
|
+
|
|
13
|
+
#### 💡 Others
|
|
14
|
+
|
|
15
|
+
- Removed Scroll Pane margins to align with design specifications. ([#347](https://github.com/TiendaNube/nimbus-design-system/pull/347) by [@mrolando-tn](https://github.com/mrolando-tn))
|
|
16
|
+
|
|
5
17
|
## 2025-07-28 `1.0.0`
|
|
6
18
|
|
|
7
19
|
#### 🎉 New features
|
|
@@ -14,5 +26,5 @@ The ScrollPane component handles responsive scrolls in lists that are overflowin
|
|
|
14
26
|
- Option to show/hide scrollbar
|
|
15
27
|
- ScrollPane.Item sub-component for wrapping content
|
|
16
28
|
- Full accessibility support with ARIA labels
|
|
17
|
-
- Responsive design for mobile and desktop
|
|
18
|
-
|
|
29
|
+
- Responsive design for mobile and desktop
|
|
30
|
+
([#319](https://github.com/TiendaNube/nimbus-design-system/pull/319) by [@joacotornello](https://github.com/joacotornello))
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface Conditions<T> {
|
|
|
34
34
|
md?: T;
|
|
35
35
|
lg?: T;
|
|
36
36
|
xl?: T;
|
|
37
|
+
xxl?: T;
|
|
37
38
|
}
|
|
38
39
|
export type BorderStyle = "solid" | "none" | "hidden" | "dashed" | "dotted";
|
|
39
40
|
export type BoxSizing = "border-box" | "content-box";
|
|
@@ -110,7 +111,9 @@ declare const propertiesBox: {
|
|
|
110
111
|
"primary-interactive": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
111
112
|
"primary-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
112
113
|
"primary-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
113
|
-
"primary-textLow": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
114
|
+
"primary-textLow": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
115
|
+
* The width property specifies the width of a box's content area.
|
|
116
|
+
*/
|
|
114
117
|
"success-interactive": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
115
118
|
"success-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
116
119
|
"success-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -129,6 +132,14 @@ declare const propertiesBox: {
|
|
|
129
132
|
"neutral-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
130
133
|
"neutral-surfaceDisabled": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
131
134
|
"neutral-textLow": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
135
|
+
"neutral-textHigh": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
136
|
+
"ai-generative-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
137
|
+
"ai-generative-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
138
|
+
transparent: string;
|
|
139
|
+
};
|
|
140
|
+
background: {
|
|
141
|
+
"ai-generative-interactive-border": string;
|
|
142
|
+
"ai-generative-interactive": string;
|
|
132
143
|
transparent: string;
|
|
133
144
|
};
|
|
134
145
|
color: {
|
|
@@ -136,7 +147,9 @@ declare const propertiesBox: {
|
|
|
136
147
|
"primary-interactive": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
137
148
|
"primary-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
138
149
|
"primary-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
139
|
-
"primary-textLow": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
150
|
+
"primary-textLow": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
151
|
+
* The width property specifies the width of a box's content area.
|
|
152
|
+
*/
|
|
140
153
|
"success-interactive": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
141
154
|
"success-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
142
155
|
"success-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -155,6 +168,9 @@ declare const propertiesBox: {
|
|
|
155
168
|
"neutral-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
156
169
|
"neutral-surfaceDisabled": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
157
170
|
"neutral-textLow": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
171
|
+
"neutral-textHigh": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
172
|
+
"ai-generative-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
173
|
+
"ai-generative-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
158
174
|
transparent: string;
|
|
159
175
|
};
|
|
160
176
|
borderColor: {
|
|
@@ -171,16 +187,17 @@ declare const propertiesBox: {
|
|
|
171
187
|
"danger-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
172
188
|
"danger-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
173
189
|
"neutral-interactive": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
190
|
+
/**
|
|
191
|
+
* The gridArea shorthand property specifies a grid item's size and location within a grid by contributing a line,
|
|
192
|
+
* a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area.
|
|
193
|
+
*/
|
|
174
194
|
"neutral-surface": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
175
195
|
"neutral-surfaceDisabled": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
176
196
|
"neutral-surfaceHighlight": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
177
197
|
transparent: string;
|
|
178
198
|
};
|
|
179
199
|
borderRadius: {
|
|
180
|
-
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
181
|
-
* The alignItems property sets the align-self value on all direct children as a group. In Flexbox, it controls the alignment of items on the Cross Axis.
|
|
182
|
-
* In Grid Layout, it controls the alignment of items on the Block Axis within their grid area.
|
|
183
|
-
*/
|
|
200
|
+
"0-5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
184
201
|
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
185
202
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
186
203
|
"3": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -188,10 +205,6 @@ declare const propertiesBox: {
|
|
|
188
205
|
"5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
189
206
|
"6": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
190
207
|
full: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
191
|
-
/**
|
|
192
|
-
* The alignSelf property overrides a grid or flex item's align-items value. In Grid, it aligns the item inside the grid area.
|
|
193
|
-
* In Flexbox, it aligns the item on the cross axis.
|
|
194
|
-
*/
|
|
195
208
|
base: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
196
209
|
half: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
197
210
|
none: string;
|
|
@@ -199,7 +212,9 @@ declare const propertiesBox: {
|
|
|
199
212
|
borderWidth: {
|
|
200
213
|
"1": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
201
214
|
"2": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
202
|
-
"3": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
215
|
+
"3": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
216
|
+
* The gap property sets the gaps between rows and columns. It is a shorthand for rowGap and columnGap.
|
|
217
|
+
*/
|
|
203
218
|
"4": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
204
219
|
"5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
205
220
|
none: string;
|
|
@@ -268,6 +283,7 @@ declare const propertiesBox: {
|
|
|
268
283
|
"4": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
269
284
|
"5": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
270
285
|
focusRing: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
286
|
+
aiFocus: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
271
287
|
};
|
|
272
288
|
transitionDuration: {
|
|
273
289
|
base: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
@@ -320,7 +336,9 @@ declare const propertiesBox: {
|
|
|
320
336
|
h2: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
321
337
|
h3: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
322
338
|
h4: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
323
|
-
h5: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
339
|
+
h5: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
340
|
+
* This defines the ability for a flex item to grow if necessary.
|
|
341
|
+
*/
|
|
324
342
|
h6: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
325
343
|
};
|
|
326
344
|
lineHeight: {
|
|
@@ -345,16 +363,15 @@ declare const propertiesBox: {
|
|
|
345
363
|
"16": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
346
364
|
"18": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
347
365
|
"20": `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
348
|
-
h1: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
366
|
+
h1: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`; /**
|
|
367
|
+
* The flexWrap property sets whether flex items are forced onto one line or can wrap onto multiple lines.
|
|
368
|
+
*/
|
|
349
369
|
h2: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
350
370
|
h3: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
351
371
|
h4: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
352
372
|
h5: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
353
373
|
h6: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
354
|
-
};
|
|
355
|
-
* The boxSizing property sets how the total width and height of an box is calculated.
|
|
356
|
-
* @default border-box
|
|
357
|
-
*/
|
|
374
|
+
};
|
|
358
375
|
};
|
|
359
376
|
export type BoxBorderColorProperties = keyof typeof propertiesBox.borderColor;
|
|
360
377
|
export type BoxBorderRadiusProperties = keyof typeof propertiesBox.borderRadius;
|
|
@@ -371,8 +388,10 @@ export type BoxTransitionDurationProperties = keyof typeof propertiesBox.transit
|
|
|
371
388
|
export type BoxFontSizeProperties = keyof typeof propertiesBox.fontSize;
|
|
372
389
|
export type BoxFontWeightProperties = keyof typeof propertiesBox.fontWeight;
|
|
373
390
|
export type BoxLineHeightProperties = keyof typeof propertiesBox.lineHeight;
|
|
391
|
+
export type BoxBackgroundProperties = keyof typeof propertiesBox.background;
|
|
374
392
|
export interface BoxConditions<T> extends Conditions<T> {
|
|
375
393
|
focus?: T;
|
|
394
|
+
focusVisible?: T;
|
|
376
395
|
focusWithin?: T;
|
|
377
396
|
active?: T;
|
|
378
397
|
hover?: T;
|
|
@@ -631,6 +650,10 @@ export interface BoxSprinkle {
|
|
|
631
650
|
* The zIndex property specifies the stack order of the box.
|
|
632
651
|
*/
|
|
633
652
|
zIndex?: BoxZIndexProperties | BoxConditions<BoxZIndexProperties>;
|
|
653
|
+
/**
|
|
654
|
+
* The background property sets the background of the box.
|
|
655
|
+
*/
|
|
656
|
+
background?: BoxBackgroundProperties | BoxConditions<BoxBackgroundProperties>;
|
|
634
657
|
/**
|
|
635
658
|
* The backgroundImage property sets one or more background images on an element.
|
|
636
659
|
*/
|
|
@@ -778,7 +801,7 @@ export interface ScrollPaneItemProperties {
|
|
|
778
801
|
*/
|
|
779
802
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
780
803
|
}
|
|
781
|
-
export type ScrollPaneItemProps = ScrollPaneItemProperties & Omit<
|
|
804
|
+
export type ScrollPaneItemProps = ScrollPaneItemProperties & Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
|
|
782
805
|
export type ScrollPaneArrowProperties = {
|
|
783
806
|
children: ReactNode;
|
|
784
807
|
};
|
|
@@ -831,8 +854,14 @@ export interface ScrollPaneProperties {
|
|
|
831
854
|
* Custom arrow component to render at the end of the scroll area
|
|
832
855
|
*/
|
|
833
856
|
scrollPaneArrowEnd?: React.ReactNode;
|
|
857
|
+
/**
|
|
858
|
+
* Props to be passed to the content container
|
|
859
|
+
*/
|
|
860
|
+
contentContainerProps?: object;
|
|
834
861
|
}
|
|
835
|
-
export type ScrollPaneProps = ScrollPaneProperties & Omit<BoxProps, "children"
|
|
862
|
+
export type ScrollPaneProps = ScrollPaneProperties & Omit<BoxProps, "children"> & {
|
|
863
|
+
contentContainerProps?: BoxProps;
|
|
864
|
+
};
|
|
836
865
|
/**
|
|
837
866
|
* ScrollPane component handles responsive scrolls in lists that are overflowing inside a container.
|
|
838
867
|
* It provides gradient overlays, optional navigation arrows, and scroll-to-item functionality.
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react"),require("@nimbus-ds/box"),require("@nimbus-ds/styles")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/box","@nimbus-ds/styles"],r):"object"==typeof exports?exports["@nimbus-ds/scroll-pane"]=r(require("react"),require("@nimbus-ds/box"),require("@nimbus-ds/styles")):e["@nimbus-ds/scroll-pane"]=r(e.react,e["@nimbus-ds/box"],e["@nimbus-ds/styles"])}(global,((e,r,t)=>(()=>{"use strict";var o={865:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getPosition=void 0;r.getPosition=(e,r)=>{const t=((e,r)=>{const t="horizontal"===r;return"start"===e?t?"left":"top":t?"right":"bottom"})(e,r);return`${r}-${t}`}},627:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPane=void 0;const o=t(769).__importStar(t(155)),n=t(558),a=t(367),l=t(337),c=t(865),i=({children:e,showGradients:r=!0,showArrows:t=!1,showScrollbar:i=!0,direction:s="horizontal",scrollToItemOnClick:u=!0,scrollPaneArrowStart:f,scrollPaneArrowEnd:d,...p})=>{const y=(0,o.useRef)(null),b=(0,o.useRef)(null),[m,_]=(0,o.useState)(!1),[w,h]=(0,o.useState)(!1),[v,P]=(0,o.useState)(!1),S=(0,o.useCallback)((()=>{if(!y.current)return;const e=y.current,{scrollLeft:r,scrollTop:t,scrollWidth:o,scrollHeight:n,clientWidth:a,clientHeight:l}=e;"horizontal"===s?(_(r>0),h(r<o-a-1)):(_(t>0),h(t<n-l-1))}),[s]),g=(0,o.useCallback)((()=>{v||P(!0),S(),b.current&&clearTimeout(b.current),b.current=setTimeout((()=>{P(!1)}),150)}),[S,v]),O=(0,o.useCallback)((e=>{if(!y.current)return;const r=y.current,t="horizontal"===s?.8*r.clientWidth:.8*r.clientHeight;if("horizontal"===s){const o="start"===e?r.scrollLeft-t:r.scrollLeft+t;r.scrollTo({left:Math.max(0,Math.min(o,r.scrollWidth-r.clientWidth)),behavior:"smooth"})}else{const o="start"===e?r.scrollTop-t:r.scrollTop+t;r.scrollTo({top:Math.max(0,Math.min(o,r.scrollHeight-r.clientHeight)),behavior:"smooth"})}}),[s]);(0,o.useEffect)((()=>{const e=y.current;if(!e)return;S(),e.addEventListener("scroll",g);const r=new ResizeObserver(S);return r.observe(e),()=>{e.removeEventListener("scroll",g),r.disconnect(),b.current&&clearTimeout(b.current)}}),[S,g]);const j=(0,o.useMemo)((()=>({direction:s,scrollToItemOnClick:u,containerRef:y,scrollToDirection:O})),[s,u,O]);return o.default.createElement(l.ScrollPaneContext.Provider,{value:j},o.default.createElement(n.Box,{as:"div",position:"relative"},o.default.createElement("div",{ref:y,className:[a.scrollPane.classnames.scrollArea,a.scrollPane.classnames.direction[s],!i&&a.scrollPane.classnames.scrollAreaHidden].filter(Boolean).join(" ")},o.default.createElement(n.Box,{display:"flex",margin:"1",...p},e),r&&o.default.createElement(o.default.Fragment,null,m&&o.default.createElement("div",{className:[a.scrollPane.classnames.gradient,a.scrollPane.classnames.gradientVariants[(0,c.getPosition)("start",s)]].join(" ")}),w&&o.default.createElement("div",{className:[a.scrollPane.classnames.gradient,a.scrollPane.classnames.gradientVariants[(0,c.getPosition)("end",s)]].join(" ")})),t&&o.default.createElement(o.default.Fragment,null,m&&f,w&&d))))};r.ScrollPane=i,i.displayName="ScrollPane",i.Item=l.ScrollPaneItem,i.ArrowHorizontalStart=l.ScrollPaneArrowHorizontalStart,i.ArrowHorizontalEnd=l.ScrollPaneArrowHorizontalEnd,i.ArrowVerticalStart=l.ScrollPaneArrowVerticalStart,i.ArrowVerticalEnd=l.ScrollPaneArrowVerticalEnd,i.Item.displayName="ScrollPane.Item",i.ArrowHorizontalStart.displayName="ScrollPane.ArrowHorizontalStart",i.ArrowHorizontalEnd.displayName="ScrollPane.ArrowHorizontalEnd",i.ArrowVerticalStart.displayName="ScrollPane.ArrowVerticalStart",i.ArrowVerticalEnd.displayName="ScrollPane.ArrowVerticalEnd"},138:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPaneArrowVerticalEnd=r.ScrollPaneArrowVerticalStart=r.ScrollPaneArrowHorizontalEnd=r.ScrollPaneArrowHorizontalStart=void 0;const o=t(769).__importDefault(t(155)),n=t(367),a=t(640),l=({children:e,variant:r,direction:t})=>{const l=(0,a.useScrollPaneContext)(),c=()=>l.scrollToDirection(t);return o.default.createElement("div",{className:[n.scrollPane.classnames.arrow,n.scrollPane.classnames.arrowVariants[r]].join(" "),onClick:c,onKeyDown:e=>{"Enter"!==e.key&&"Space"!==e.code||(e.preventDefault(),c())},role:"button",tabIndex:0,"aria-label":"Scroll "+("start"===t?"backward":"forward")},e)};r.ScrollPaneArrowHorizontalStart=({children:e})=>o.default.createElement(l,{variant:"horizontal-left",direction:"start"},e);r.ScrollPaneArrowHorizontalEnd=({children:e})=>o.default.createElement(l,{variant:"horizontal-right",direction:"end"},e);r.ScrollPaneArrowVerticalStart=({children:e})=>o.default.createElement(l,{variant:"vertical-top",direction:"start"},e);r.ScrollPaneArrowVerticalEnd=({children:e})=>o.default.createElement(l,{variant:"vertical-bottom",direction:"end"},e)},658:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPaneArrowVerticalEnd=r.ScrollPaneArrowVerticalStart=r.ScrollPaneArrowHorizontalEnd=r.ScrollPaneArrowHorizontalStart=void 0;var o=t(138);Object.defineProperty(r,"ScrollPaneArrowHorizontalStart",{enumerable:!0,get:function(){return o.ScrollPaneArrowHorizontalStart}}),Object.defineProperty(r,"ScrollPaneArrowHorizontalEnd",{enumerable:!0,get:function(){return o.ScrollPaneArrowHorizontalEnd}}),Object.defineProperty(r,"ScrollPaneArrowVerticalStart",{enumerable:!0,get:function(){return o.ScrollPaneArrowVerticalStart}}),Object.defineProperty(r,"ScrollPaneArrowVerticalEnd",{enumerable:!0,get:function(){return o.ScrollPaneArrowVerticalEnd}})},516:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.scrollItemIntoView=void 0;r.scrollItemIntoView=(e,r,t)=>{const o=e.getBoundingClientRect(),n=r.getBoundingClientRect();if(!((e,r,t)=>"horizontal"===t?r.left>=e.left&&r.right<=e.right:r.top>=e.top&&r.bottom<=e.bottom)(o,n,t))if("horizontal"===t){const r=o.width/2,t=n.width/2,a=n.left-o.left-r+t,l=e.scrollLeft+a;e.scrollTo({left:Math.max(0,l),behavior:"smooth"})}else{const r=o.height/2,t=n.height/2,a=n.top-o.top-r+t,l=e.scrollTop+a;e.scrollTo({top:Math.max(0,l),behavior:"smooth"})}}},900:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPaneItem=void 0;const o=t(769).__importDefault(t(155)),n=t(558),a=t(640),l=t(516);r.ScrollPaneItem=({children:e,onClick:r,...t})=>{const c=(0,a.useScrollPaneContext)();return o.default.createElement(n.Box,{...t,onClick:e=>{if(r&&r(e),c.scrollToItemOnClick&&e.currentTarget){const r=c.containerRef?.current,t=e.currentTarget;r&&t&&c.direction&&(0,l.scrollItemIntoView)(r,t,c.direction)}}},e)}},742:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});const o=t(769);o.__exportStar(t(900),r),o.__exportStar(t(119),r)},119:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0})},337:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPaneArrowVerticalEnd=r.ScrollPaneArrowVerticalStart=r.ScrollPaneArrowHorizontalEnd=r.ScrollPaneArrowHorizontalStart=r.ScrollPaneContext=r.ScrollPaneItem=void 0;var o=t(742);Object.defineProperty(r,"ScrollPaneItem",{enumerable:!0,get:function(){return o.ScrollPaneItem}});var n=t(640);Object.defineProperty(r,"ScrollPaneContext",{enumerable:!0,get:function(){return n.ScrollPaneContext}});var a=t(658);Object.defineProperty(r,"ScrollPaneArrowHorizontalStart",{enumerable:!0,get:function(){return a.ScrollPaneArrowHorizontalStart}}),Object.defineProperty(r,"ScrollPaneArrowHorizontalEnd",{enumerable:!0,get:function(){return a.ScrollPaneArrowHorizontalEnd}}),Object.defineProperty(r,"ScrollPaneArrowVerticalStart",{enumerable:!0,get:function(){return a.ScrollPaneArrowVerticalStart}}),Object.defineProperty(r,"ScrollPaneArrowVerticalEnd",{enumerable:!0,get:function(){return a.ScrollPaneArrowVerticalEnd}})},250:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.useScrollPaneContext=r.ScrollPaneContext=void 0;const o=t(155);r.ScrollPaneContext=(0,o.createContext)(null);r.useScrollPaneContext=()=>{const e=(0,o.useContext)(r.ScrollPaneContext);if(!e)throw new Error("useScrollPaneContext must be used within a ScrollPane");return e}},640:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.useScrollPaneContext=r.ScrollPaneContext=void 0;var o=t(250);Object.defineProperty(r,"ScrollPaneContext",{enumerable:!0,get:function(){return o.ScrollPaneContext}}),Object.defineProperty(r,"useScrollPaneContext",{enumerable:!0,get:function(){return o.useScrollPaneContext}})},558:e=>{e.exports=r},367:e=>{e.exports=t},155:r=>{r.exports=e},769:(e,r,t)=>{t.r(r),t.d(r,{__addDisposableResource:()=>H,__assign:()=>a,__asyncDelegator:()=>j,__asyncGenerator:()=>O,__asyncValues:()=>E,__await:()=>g,__awaiter:()=>y,__classPrivateFieldGet:()=>C,__classPrivateFieldIn:()=>I,__classPrivateFieldSet:()=>V,__createBinding:()=>m,__decorate:()=>c,__disposeResources:()=>k,__esDecorate:()=>s,__exportStar:()=>_,__extends:()=>n,__generator:()=>b,__importDefault:()=>z,__importStar:()=>T,__makeTemplateObject:()=>x,__metadata:()=>p,__param:()=>i,__propKey:()=>f,__read:()=>h,__rest:()=>l,__runInitializers:()=>u,__setFunctionName:()=>d,__spread:()=>v,__spreadArray:()=>S,__spreadArrays:()=>P,__values:()=>w,default:()=>D});var o=function(e,r){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},o(e,r)};function n(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}o(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var a=function(){return a=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},a.apply(this,arguments)};function l(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)r.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(t[o[n]]=e[o[n]])}return t}function c(e,r,t,o){var n,a=arguments.length,l=a<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,r,t,o);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(l=(a<3?n(l):a>3?n(r,t,l):n(r,t))||l);return a>3&&l&&Object.defineProperty(r,t,l),l}function i(e,r){return function(t,o){r(t,o,e)}}function s(e,r,t,o,n,a){function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,i=o.kind,s="getter"===i?"get":"setter"===i?"set":"value",u=!r&&e?o.static?e:e.prototype:null,f=r||(u?Object.getOwnPropertyDescriptor(u,o.name):{}),d=!1,p=t.length-1;p>=0;p--){var y={};for(var b in o)y[b]="access"===b?{}:o[b];for(var b in o.access)y.access[b]=o.access[b];y.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(l(e||null))};var m=(0,t[p])("accessor"===i?{get:f.get,set:f.set}:f[s],y);if("accessor"===i){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(c=l(m.get))&&(f.get=c),(c=l(m.set))&&(f.set=c),(c=l(m.init))&&n.unshift(c)}else(c=l(m))&&("field"===i?n.unshift(c):f[s]=c)}u&&Object.defineProperty(u,o.name,f),d=!0}function u(e,r,t){for(var o=arguments.length>2,n=0;n<r.length;n++)t=o?r[n].call(e,t):r[n].call(e);return o?t:void 0}function f(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,r,t){return"symbol"==typeof r&&(r=r.description?"[".concat(r.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:t?"".concat(t," ",r):r})}function p(e,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,r)}function y(e,r,t,o){return new(t||(t=Promise))((function(n,a){function l(e){try{i(o.next(e))}catch(e){a(e)}}function c(e){try{i(o.throw(e))}catch(e){a(e)}}function i(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(l,c)}i((o=o.apply(e,r||[])).next())}))}function b(e,r){var t,o,n,a,l={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(l=0)),l;)try{if(t=1,o&&(n=2&c[0]?o.return:c[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,c[1])).done)return n;switch(o=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,o=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(n=l.trys,(n=n.length>0&&n[n.length-1])||6!==c[0]&&2!==c[0])){l=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){l.label=c[1];break}if(6===c[0]&&l.label<n[1]){l.label=n[1],n=c;break}if(n&&l.label<n[2]){l.label=n[2],l.ops.push(c);break}n[2]&&l.ops.pop(),l.trys.pop();continue}c=r.call(e,l)}catch(e){c=[6,e],o=0}finally{t=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var m=Object.create?function(e,r,t,o){void 0===o&&(o=t);var n=Object.getOwnPropertyDescriptor(r,t);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,o,n)}:function(e,r,t,o){void 0===o&&(o=t),e[o]=r[t]};function _(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||m(r,e,t)}function w(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],o=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var o,n,a=t.call(e),l=[];try{for(;(void 0===r||r-- >0)&&!(o=a.next()).done;)l.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(n)throw n.error}}return l}function v(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(h(arguments[r]));return e}function P(){for(var e=0,r=0,t=arguments.length;r<t;r++)e+=arguments[r].length;var o=Array(e),n=0;for(r=0;r<t;r++)for(var a=arguments[r],l=0,c=a.length;l<c;l++,n++)o[n]=a[l];return o}function S(e,r,t){if(t||2===arguments.length)for(var o,n=0,a=r.length;n<a;n++)!o&&n in r||(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return e.concat(o||Array.prototype.slice.call(r))}function g(e){return this instanceof g?(this.v=e,this):new g(e)}function O(e,r,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,n=t.apply(e,r||[]),a=[];return o={},l("next"),l("throw"),l("return"),o[Symbol.asyncIterator]=function(){return this},o;function l(e){n[e]&&(o[e]=function(r){return new Promise((function(t,o){a.push([e,r,t,o])>1||c(e,r)}))})}function c(e,r){try{(t=n[e](r)).value instanceof g?Promise.resolve(t.value.v).then(i,s):u(a[0][2],t)}catch(e){u(a[0][3],e)}var t}function i(e){c("next",e)}function s(e){c("throw",e)}function u(e,r){e(r),a.shift(),a.length&&c(a[0][0],a[0][1])}}function j(e){var r,t;return r={},o("next"),o("throw",(function(e){throw e})),o("return"),r[Symbol.iterator]=function(){return this},r;function o(o,n){r[o]=e[o]?function(r){return(t=!t)?{value:g(e[o](r)),done:!1}:n?n(r):r}:n}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,t=e[Symbol.asyncIterator];return t?t.call(e):(e=w(e),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(t){r[t]=e[t]&&function(r){return new Promise((function(o,n){(function(e,r,t,o){Promise.resolve(o).then((function(r){e({value:r,done:t})}),r)})(o,n,(r=e[t](r)).done,r.value)}))}}}function x(e,r){return Object.defineProperty?Object.defineProperty(e,"raw",{value:r}):e.raw=r,e}var A=Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r};function T(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&m(r,e,t);return A(r,e),r}function z(e){return e&&e.__esModule?e:{default:e}}function C(e,r,t,o){if("a"===t&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof r?e!==r||!o:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?o:"a"===t?o.call(e):o?o.value:r.get(e)}function V(e,r,t,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof r?e!==r||!n:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,t):n?n.value=t:r.set(e,t),t}function I(e,r){if(null===r||"object"!=typeof r&&"function"!=typeof r)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?r===e:e.has(r)}function H(e,r,t){if(null!=r){if("object"!=typeof r&&"function"!=typeof r)throw new TypeError("Object expected.");var o;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=r[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=r[Symbol.dispose]}if("function"!=typeof o)throw new TypeError("Object not disposable.");e.stack.push({value:r,dispose:o,async:t})}else t&&e.stack.push({async:!0});return r}var M="function"==typeof SuppressedError?SuppressedError:function(e,r,t){var o=new Error(t);return o.name="SuppressedError",o.error=e,o.suppressed=r,o};function k(e){function r(r){e.error=e.hasError?new M(r,e.error,"An error was suppressed during disposal."):r,e.hasError=!0}return function t(){for(;e.stack.length;){var o=e.stack.pop();try{var n=o.dispose&&o.dispose.call(o.value);if(o.async)return Promise.resolve(n).then(t,(function(e){return r(e),t()}))}catch(e){r(e)}}if(e.hasError)throw e.error}()}const D={__extends:n,__assign:a,__rest:l,__decorate:c,__param:i,__metadata:p,__awaiter:y,__generator:b,__createBinding:m,__exportStar:_,__values:w,__read:h,__spread:v,__spreadArrays:P,__spreadArray:S,__await:g,__asyncGenerator:O,__asyncDelegator:j,__asyncValues:E,__makeTemplateObject:x,__importStar:T,__importDefault:z,__classPrivateFieldGet:C,__classPrivateFieldSet:V,__classPrivateFieldIn:I,__addDisposableResource:H,__disposeResources:k}}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var t=n[e]={exports:{}};return o[e](t,t.exports,a),t.exports}a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{var e=l;Object.defineProperty(e,"__esModule",{value:!0}),e.ScrollPane=void 0;var r=a(627);Object.defineProperty(e,"ScrollPane",{enumerable:!0,get:function(){return r.ScrollPane}})})(),l})()));
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react"),require("@nimbus-ds/box"),require("@nimbus-ds/styles")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/box","@nimbus-ds/styles"],r):"object"==typeof exports?exports["@nimbus-ds/scroll-pane"]=r(require("react"),require("@nimbus-ds/box"),require("@nimbus-ds/styles")):e["@nimbus-ds/scroll-pane"]=r(e.react,e["@nimbus-ds/box"],e["@nimbus-ds/styles"])}(global,((e,r,t)=>(()=>{"use strict";var o={865:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getPosition=void 0;r.getPosition=(e,r)=>{const t=((e,r)=>{const t="horizontal"===r;return"start"===e?t?"left":"top":t?"right":"bottom"})(e,r);return`${r}-${t}`}},627:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPane=void 0;const o=t(769).__importStar(t(155)),n=t(558),a=t(367),l=t(337),c=t(865),i=({children:e,showGradients:r=!0,showArrows:t=!1,showScrollbar:i=!0,direction:s="horizontal",scrollToItemOnClick:u=!0,scrollPaneArrowStart:f,scrollPaneArrowEnd:d,contentContainerProps:p,...y})=>{const b=(0,o.useRef)(null),m=(0,o.useRef)(null),[_,v]=(0,o.useState)(!1),[w,P]=(0,o.useState)(!1),[h,S]=(0,o.useState)(!1),g=(0,o.useCallback)((()=>{if(!b.current)return;const e=b.current,{scrollLeft:r,scrollTop:t,scrollWidth:o,scrollHeight:n,clientWidth:a,clientHeight:l}=e;"horizontal"===s?(v(r>0),P(r<o-a-1)):(v(t>0),P(t<n-l-1))}),[s]),O=(0,o.useCallback)((()=>{h||S(!0),g(),m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{S(!1)}),150)}),[g,h]),j=(0,o.useCallback)((e=>{if(!b.current)return;const r=b.current,t="horizontal"===s?.8*r.clientWidth:.8*r.clientHeight;if("horizontal"===s){const o="start"===e?r.scrollLeft-t:r.scrollLeft+t;r.scrollTo({left:Math.max(0,Math.min(o,r.scrollWidth-r.clientWidth)),behavior:"smooth"})}else{const o="start"===e?r.scrollTop-t:r.scrollTop+t;r.scrollTo({top:Math.max(0,Math.min(o,r.scrollHeight-r.clientHeight)),behavior:"smooth"})}}),[s]);(0,o.useEffect)((()=>{const e=b.current;if(!e)return;g(),e.addEventListener("scroll",O);const r=new ResizeObserver(g);return r.observe(e),()=>{e.removeEventListener("scroll",O),r.disconnect(),m.current&&clearTimeout(m.current)}}),[g,O]);const E=(0,o.useMemo)((()=>({direction:s,scrollToItemOnClick:u,containerRef:b,scrollToDirection:j})),[s,u,j]);return o.default.createElement(l.ScrollPaneContext.Provider,{value:E},o.default.createElement(n.Box,{as:"div",position:"relative",...y},o.default.createElement("div",{ref:b,className:[a.scrollPane.classnames.scrollArea,a.scrollPane.classnames.direction[s],!i&&a.scrollPane.classnames.scrollAreaHidden].filter(Boolean).join(" ")},o.default.createElement(n.Box,{display:"flex",...p},e),r&&o.default.createElement(o.default.Fragment,null,_&&o.default.createElement("div",{className:[a.scrollPane.classnames.gradient,a.scrollPane.classnames.gradientVariants[(0,c.getPosition)("start",s)]].join(" ")}),w&&o.default.createElement("div",{className:[a.scrollPane.classnames.gradient,a.scrollPane.classnames.gradientVariants[(0,c.getPosition)("end",s)]].join(" ")})),t&&o.default.createElement(o.default.Fragment,null,_&&f,w&&d))))};r.ScrollPane=i,i.displayName="ScrollPane",i.Item=l.ScrollPaneItem,i.ArrowHorizontalStart=l.ScrollPaneArrowHorizontalStart,i.ArrowHorizontalEnd=l.ScrollPaneArrowHorizontalEnd,i.ArrowVerticalStart=l.ScrollPaneArrowVerticalStart,i.ArrowVerticalEnd=l.ScrollPaneArrowVerticalEnd,i.Item.displayName="ScrollPane.Item",i.ArrowHorizontalStart.displayName="ScrollPane.ArrowHorizontalStart",i.ArrowHorizontalEnd.displayName="ScrollPane.ArrowHorizontalEnd",i.ArrowVerticalStart.displayName="ScrollPane.ArrowVerticalStart",i.ArrowVerticalEnd.displayName="ScrollPane.ArrowVerticalEnd"},138:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPaneArrowVerticalEnd=r.ScrollPaneArrowVerticalStart=r.ScrollPaneArrowHorizontalEnd=r.ScrollPaneArrowHorizontalStart=void 0;const o=t(769).__importDefault(t(155)),n=t(367),a=t(640),l=({children:e,variant:r,direction:t})=>{const l=(0,a.useScrollPaneContext)(),c=()=>l.scrollToDirection(t);return o.default.createElement("div",{className:[n.scrollPane.classnames.arrow,n.scrollPane.classnames.arrowVariants[r]].join(" "),onClick:c,onKeyDown:e=>{"Enter"!==e.key&&"Space"!==e.code||(e.preventDefault(),c())},role:"button",tabIndex:0,"aria-label":"Scroll "+("start"===t?"backward":"forward")},e)};r.ScrollPaneArrowHorizontalStart=({children:e})=>o.default.createElement(l,{variant:"horizontal-left",direction:"start"},e);r.ScrollPaneArrowHorizontalEnd=({children:e})=>o.default.createElement(l,{variant:"horizontal-right",direction:"end"},e);r.ScrollPaneArrowVerticalStart=({children:e})=>o.default.createElement(l,{variant:"vertical-top",direction:"start"},e);r.ScrollPaneArrowVerticalEnd=({children:e})=>o.default.createElement(l,{variant:"vertical-bottom",direction:"end"},e)},658:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPaneArrowVerticalEnd=r.ScrollPaneArrowVerticalStart=r.ScrollPaneArrowHorizontalEnd=r.ScrollPaneArrowHorizontalStart=void 0;var o=t(138);Object.defineProperty(r,"ScrollPaneArrowHorizontalStart",{enumerable:!0,get:function(){return o.ScrollPaneArrowHorizontalStart}}),Object.defineProperty(r,"ScrollPaneArrowHorizontalEnd",{enumerable:!0,get:function(){return o.ScrollPaneArrowHorizontalEnd}}),Object.defineProperty(r,"ScrollPaneArrowVerticalStart",{enumerable:!0,get:function(){return o.ScrollPaneArrowVerticalStart}}),Object.defineProperty(r,"ScrollPaneArrowVerticalEnd",{enumerable:!0,get:function(){return o.ScrollPaneArrowVerticalEnd}})},516:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.scrollItemIntoView=void 0;r.scrollItemIntoView=(e,r,t)=>{const o=e.getBoundingClientRect(),n=r.getBoundingClientRect();if(!((e,r,t)=>"horizontal"===t?r.left>=e.left&&r.right<=e.right:r.top>=e.top&&r.bottom<=e.bottom)(o,n,t))if("horizontal"===t){const r=o.width/2,t=n.width/2,a=n.left-o.left-r+t,l=e.scrollLeft+a;e.scrollTo({left:Math.max(0,l),behavior:"smooth"})}else{const r=o.height/2,t=n.height/2,a=n.top-o.top-r+t,l=e.scrollTop+a;e.scrollTo({top:Math.max(0,l),behavior:"smooth"})}}},900:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPaneItem=void 0;const o=t(769).__importDefault(t(155)),n=t(640),a=t(516),l=t(367);r.ScrollPaneItem=({children:e,onClick:r,...t})=>{const c=(0,n.useScrollPaneContext)();return o.default.createElement("div",{className:l.scrollPane.classnames.item,onClick:e=>{if(r&&r(e),c.scrollToItemOnClick&&e.currentTarget){const r=c.containerRef?.current,t=e.currentTarget;r&&t&&c.direction&&(0,a.scrollItemIntoView)(r,t,c.direction)}}},e)}},742:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});const o=t(769);o.__exportStar(t(900),r),o.__exportStar(t(119),r)},119:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0})},337:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScrollPaneArrowVerticalEnd=r.ScrollPaneArrowVerticalStart=r.ScrollPaneArrowHorizontalEnd=r.ScrollPaneArrowHorizontalStart=r.ScrollPaneContext=r.ScrollPaneItem=void 0;var o=t(742);Object.defineProperty(r,"ScrollPaneItem",{enumerable:!0,get:function(){return o.ScrollPaneItem}});var n=t(640);Object.defineProperty(r,"ScrollPaneContext",{enumerable:!0,get:function(){return n.ScrollPaneContext}});var a=t(658);Object.defineProperty(r,"ScrollPaneArrowHorizontalStart",{enumerable:!0,get:function(){return a.ScrollPaneArrowHorizontalStart}}),Object.defineProperty(r,"ScrollPaneArrowHorizontalEnd",{enumerable:!0,get:function(){return a.ScrollPaneArrowHorizontalEnd}}),Object.defineProperty(r,"ScrollPaneArrowVerticalStart",{enumerable:!0,get:function(){return a.ScrollPaneArrowVerticalStart}}),Object.defineProperty(r,"ScrollPaneArrowVerticalEnd",{enumerable:!0,get:function(){return a.ScrollPaneArrowVerticalEnd}})},250:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.useScrollPaneContext=r.ScrollPaneContext=void 0;const o=t(155);r.ScrollPaneContext=(0,o.createContext)(null);r.useScrollPaneContext=()=>{const e=(0,o.useContext)(r.ScrollPaneContext);if(!e)throw new Error("useScrollPaneContext must be used within a ScrollPane");return e}},640:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.useScrollPaneContext=r.ScrollPaneContext=void 0;var o=t(250);Object.defineProperty(r,"ScrollPaneContext",{enumerable:!0,get:function(){return o.ScrollPaneContext}}),Object.defineProperty(r,"useScrollPaneContext",{enumerable:!0,get:function(){return o.useScrollPaneContext}})},558:e=>{e.exports=r},367:e=>{e.exports=t},155:r=>{r.exports=e},769:(e,r,t)=>{t.r(r),t.d(r,{__addDisposableResource:()=>H,__assign:()=>a,__asyncDelegator:()=>j,__asyncGenerator:()=>O,__asyncValues:()=>E,__await:()=>g,__awaiter:()=>y,__classPrivateFieldGet:()=>C,__classPrivateFieldIn:()=>I,__classPrivateFieldSet:()=>V,__createBinding:()=>m,__decorate:()=>c,__disposeResources:()=>k,__esDecorate:()=>s,__exportStar:()=>_,__extends:()=>n,__generator:()=>b,__importDefault:()=>z,__importStar:()=>T,__makeTemplateObject:()=>x,__metadata:()=>p,__param:()=>i,__propKey:()=>f,__read:()=>w,__rest:()=>l,__runInitializers:()=>u,__setFunctionName:()=>d,__spread:()=>P,__spreadArray:()=>S,__spreadArrays:()=>h,__values:()=>v,default:()=>D});var o=function(e,r){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},o(e,r)};function n(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}o(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var a=function(){return a=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},a.apply(this,arguments)};function l(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)r.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(t[o[n]]=e[o[n]])}return t}function c(e,r,t,o){var n,a=arguments.length,l=a<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,r,t,o);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(l=(a<3?n(l):a>3?n(r,t,l):n(r,t))||l);return a>3&&l&&Object.defineProperty(r,t,l),l}function i(e,r){return function(t,o){r(t,o,e)}}function s(e,r,t,o,n,a){function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,i=o.kind,s="getter"===i?"get":"setter"===i?"set":"value",u=!r&&e?o.static?e:e.prototype:null,f=r||(u?Object.getOwnPropertyDescriptor(u,o.name):{}),d=!1,p=t.length-1;p>=0;p--){var y={};for(var b in o)y[b]="access"===b?{}:o[b];for(var b in o.access)y.access[b]=o.access[b];y.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(l(e||null))};var m=(0,t[p])("accessor"===i?{get:f.get,set:f.set}:f[s],y);if("accessor"===i){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(c=l(m.get))&&(f.get=c),(c=l(m.set))&&(f.set=c),(c=l(m.init))&&n.unshift(c)}else(c=l(m))&&("field"===i?n.unshift(c):f[s]=c)}u&&Object.defineProperty(u,o.name,f),d=!0}function u(e,r,t){for(var o=arguments.length>2,n=0;n<r.length;n++)t=o?r[n].call(e,t):r[n].call(e);return o?t:void 0}function f(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,r,t){return"symbol"==typeof r&&(r=r.description?"[".concat(r.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:t?"".concat(t," ",r):r})}function p(e,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,r)}function y(e,r,t,o){return new(t||(t=Promise))((function(n,a){function l(e){try{i(o.next(e))}catch(e){a(e)}}function c(e){try{i(o.throw(e))}catch(e){a(e)}}function i(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(l,c)}i((o=o.apply(e,r||[])).next())}))}function b(e,r){var t,o,n,a,l={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(l=0)),l;)try{if(t=1,o&&(n=2&c[0]?o.return:c[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,c[1])).done)return n;switch(o=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,o=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(n=l.trys,(n=n.length>0&&n[n.length-1])||6!==c[0]&&2!==c[0])){l=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){l.label=c[1];break}if(6===c[0]&&l.label<n[1]){l.label=n[1],n=c;break}if(n&&l.label<n[2]){l.label=n[2],l.ops.push(c);break}n[2]&&l.ops.pop(),l.trys.pop();continue}c=r.call(e,l)}catch(e){c=[6,e],o=0}finally{t=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var m=Object.create?function(e,r,t,o){void 0===o&&(o=t);var n=Object.getOwnPropertyDescriptor(r,t);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,o,n)}:function(e,r,t,o){void 0===o&&(o=t),e[o]=r[t]};function _(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||m(r,e,t)}function v(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],o=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var o,n,a=t.call(e),l=[];try{for(;(void 0===r||r-- >0)&&!(o=a.next()).done;)l.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(n)throw n.error}}return l}function P(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(w(arguments[r]));return e}function h(){for(var e=0,r=0,t=arguments.length;r<t;r++)e+=arguments[r].length;var o=Array(e),n=0;for(r=0;r<t;r++)for(var a=arguments[r],l=0,c=a.length;l<c;l++,n++)o[n]=a[l];return o}function S(e,r,t){if(t||2===arguments.length)for(var o,n=0,a=r.length;n<a;n++)!o&&n in r||(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return e.concat(o||Array.prototype.slice.call(r))}function g(e){return this instanceof g?(this.v=e,this):new g(e)}function O(e,r,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,n=t.apply(e,r||[]),a=[];return o={},l("next"),l("throw"),l("return"),o[Symbol.asyncIterator]=function(){return this},o;function l(e){n[e]&&(o[e]=function(r){return new Promise((function(t,o){a.push([e,r,t,o])>1||c(e,r)}))})}function c(e,r){try{(t=n[e](r)).value instanceof g?Promise.resolve(t.value.v).then(i,s):u(a[0][2],t)}catch(e){u(a[0][3],e)}var t}function i(e){c("next",e)}function s(e){c("throw",e)}function u(e,r){e(r),a.shift(),a.length&&c(a[0][0],a[0][1])}}function j(e){var r,t;return r={},o("next"),o("throw",(function(e){throw e})),o("return"),r[Symbol.iterator]=function(){return this},r;function o(o,n){r[o]=e[o]?function(r){return(t=!t)?{value:g(e[o](r)),done:!1}:n?n(r):r}:n}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,t=e[Symbol.asyncIterator];return t?t.call(e):(e=v(e),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(t){r[t]=e[t]&&function(r){return new Promise((function(o,n){(function(e,r,t,o){Promise.resolve(o).then((function(r){e({value:r,done:t})}),r)})(o,n,(r=e[t](r)).done,r.value)}))}}}function x(e,r){return Object.defineProperty?Object.defineProperty(e,"raw",{value:r}):e.raw=r,e}var A=Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r};function T(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&m(r,e,t);return A(r,e),r}function z(e){return e&&e.__esModule?e:{default:e}}function C(e,r,t,o){if("a"===t&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof r?e!==r||!o:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?o:"a"===t?o.call(e):o?o.value:r.get(e)}function V(e,r,t,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof r?e!==r||!n:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,t):n?n.value=t:r.set(e,t),t}function I(e,r){if(null===r||"object"!=typeof r&&"function"!=typeof r)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?r===e:e.has(r)}function H(e,r,t){if(null!=r){if("object"!=typeof r&&"function"!=typeof r)throw new TypeError("Object expected.");var o;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=r[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=r[Symbol.dispose]}if("function"!=typeof o)throw new TypeError("Object not disposable.");e.stack.push({value:r,dispose:o,async:t})}else t&&e.stack.push({async:!0});return r}var M="function"==typeof SuppressedError?SuppressedError:function(e,r,t){var o=new Error(t);return o.name="SuppressedError",o.error=e,o.suppressed=r,o};function k(e){function r(r){e.error=e.hasError?new M(r,e.error,"An error was suppressed during disposal."):r,e.hasError=!0}return function t(){for(;e.stack.length;){var o=e.stack.pop();try{var n=o.dispose&&o.dispose.call(o.value);if(o.async)return Promise.resolve(n).then(t,(function(e){return r(e),t()}))}catch(e){r(e)}}if(e.hasError)throw e.error}()}const D={__extends:n,__assign:a,__rest:l,__decorate:c,__param:i,__metadata:p,__awaiter:y,__generator:b,__createBinding:m,__exportStar:_,__values:v,__read:w,__spread:P,__spreadArrays:h,__spreadArray:S,__await:g,__asyncGenerator:O,__asyncDelegator:j,__asyncValues:E,__makeTemplateObject:x,__importStar:T,__importDefault:z,__classPrivateFieldGet:C,__classPrivateFieldSet:V,__classPrivateFieldIn:I,__addDisposableResource:H,__disposeResources:k}}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var t=n[e]={exports:{}};return o[e](t,t.exports,a),t.exports}a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{var e=l;Object.defineProperty(e,"__esModule",{value:!0}),e.ScrollPane=void 0;var r=a(627);Object.defineProperty(e,"ScrollPane",{enumerable:!0,get:function(){return r.ScrollPane}})})(),l})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbus-ds/scroll-pane",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-rc.1",
|
|
4
4
|
"description": "ScrollPane component handles responsive scrolls in lists that are overflowing inside a container.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"url": "https://github.com/TiendaNube/nimbus-design-system/issues"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@nimbus-ds/styles": "^9.
|
|
44
|
+
"@nimbus-ds/styles": "^9.41.0",
|
|
45
45
|
"react": "^16.8 || ^17.0 || ^18.0",
|
|
46
46
|
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@nimbus-ds/box": "^4.2
|
|
49
|
+
"@nimbus-ds/box": "^4.3.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@nimbus-ds/button": "^2.
|
|
52
|
+
"@nimbus-ds/button": "^2.9.0",
|
|
53
53
|
"@nimbus-ds/card": "^3.1.2",
|
|
54
|
-
"@nimbus-ds/icon": "^3.
|
|
55
|
-
"@nimbus-ds/icons": "^1.
|
|
56
|
-
"@nimbus-ds/text": "^6.
|
|
57
|
-
"@nimbus-ds/webpack": "^1.
|
|
54
|
+
"@nimbus-ds/icon": "^3.3.0",
|
|
55
|
+
"@nimbus-ds/icons": "^1.14.0",
|
|
56
|
+
"@nimbus-ds/text": "^6.6.0",
|
|
57
|
+
"@nimbus-ds/webpack": "^1.7.0"
|
|
58
58
|
}
|
|
59
59
|
}
|