reshaped 3.9.0-canary.9 → 3.9.0
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/bundle.css +1 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.js +2 -2
- package/dist/components/Actionable/Actionable.module.css +1 -1
- package/dist/components/Badge/Badge.js +2 -2
- package/dist/components/Badge/Badge.module.css +1 -1
- package/dist/components/Badge/Badge.types.d.ts +1 -1
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Calendar/Calendar.module.css +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.types.d.ts +5 -5
- package/dist/components/Flyout/Flyout.constants.d.ts +1 -0
- package/dist/components/Flyout/Flyout.constants.js +1 -0
- package/dist/components/Flyout/Flyout.module.css +1 -1
- package/dist/components/Flyout/Flyout.types.d.ts +3 -1
- package/dist/components/Flyout/FlyoutContent.js +2 -1
- package/dist/components/Flyout/FlyoutControlled.js +28 -11
- package/dist/components/Flyout/useFlyout.d.ts +1 -1
- package/dist/components/Flyout/useFlyout.js +3 -3
- package/dist/components/Flyout/utilities/calculatePosition.js +18 -11
- package/dist/components/Flyout/utilities/constants.d.ts +1 -0
- package/dist/components/Flyout/utilities/constants.js +1 -0
- package/dist/components/Flyout/utilities/flyout.js +33 -5
- package/dist/components/Flyout/utilities/isFullyVisible.d.ts +4 -3
- package/dist/components/Flyout/utilities/isFullyVisible.js +5 -4
- package/dist/components/Grid/Grid.types.d.ts +4 -4
- package/dist/components/HiddenInput/HiddenInput.js +2 -3
- package/dist/components/Image/Image.js +1 -1
- package/dist/components/Modal/Modal.js +0 -3
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Reshaped/Reshaped.css +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +6 -6
- package/dist/components/Slider/SliderControlled.js +5 -4
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +3 -1
- package/dist/components/Tabs/TabsContext.d.ts +1 -0
- package/dist/components/Tabs/TabsControlled.js +2 -1
- package/dist/components/Tabs/TabsItem.js +2 -2
- package/dist/components/Tabs/TabsList.js +9 -5
- package/dist/components/Tabs/TabsPanel.js +1 -1
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/Text/Text.types.d.ts +3 -3
- package/dist/components/Tooltip/Tooltip.js +2 -2
- package/dist/components/Tooltip/Tooltip.module.css +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/components/View/View.types.d.ts +4 -4
- package/dist/hooks/_private/useDrag.js +0 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/types/global.d.ts +1 -1
- package/dist/utilities/dom/index.d.ts +0 -1
- package/dist/utilities/dom/index.js +0 -1
- package/dist/utilities/scroll/disable.js +4 -2
- package/package.json +4 -98
- package/README.md +0 -24
- package/dist/utilities/dom/userSelect.d.ts +0 -2
- package/dist/utilities/dom/userSelect.js +0 -6
|
@@ -2,7 +2,7 @@ import type { Property } from "csstype";
|
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import type * as TStyles from "../../styles/types";
|
|
4
4
|
import type * as G from "../../types/global";
|
|
5
|
-
export type Props<TagName extends keyof React.JSX.IntrinsicElements =
|
|
5
|
+
export type Props<TagName extends keyof React.JSX.IntrinsicElements | void = void> = {
|
|
6
6
|
/** Gap between grid items */
|
|
7
7
|
gap?: G.Responsive<number>;
|
|
8
8
|
/** Horizontal gap between grid items */
|
|
@@ -34,13 +34,13 @@ export type Props<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
|
|
|
34
34
|
/** Node for inserting children */
|
|
35
35
|
children?: React.ReactNode;
|
|
36
36
|
/** Custom root element html tag */
|
|
37
|
-
as?: TagName;
|
|
37
|
+
as?: TagName extends keyof React.JSX.IntrinsicElements ? TagName : keyof React.JSX.IntrinsicElements;
|
|
38
38
|
/** Additional classname for the root element */
|
|
39
39
|
className?: G.ClassName;
|
|
40
40
|
/** Additional attributes for the root element */
|
|
41
41
|
attributes?: G.Attributes<TagName>;
|
|
42
42
|
};
|
|
43
|
-
export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements =
|
|
43
|
+
export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements | void = void> = {
|
|
44
44
|
/** Grid area for template syntax */
|
|
45
45
|
area?: string;
|
|
46
46
|
/** Starting column position */
|
|
@@ -58,7 +58,7 @@ export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements = "div">
|
|
|
58
58
|
/** Node for inserting children */
|
|
59
59
|
children?: React.ReactNode;
|
|
60
60
|
/** Custom item element html tag */
|
|
61
|
-
as?: TagName;
|
|
61
|
+
as?: TagName extends keyof React.JSX.IntrinsicElements ? TagName : keyof React.JSX.IntrinsicElements;
|
|
62
62
|
/** Additional classname for the item element */
|
|
63
63
|
className?: G.ClassName;
|
|
64
64
|
/** Additional attributes for the item element */
|
|
@@ -12,8 +12,7 @@ const HiddenInput = (props) => {
|
|
|
12
12
|
const formControl = useFormControl();
|
|
13
13
|
const name = checkboxGroup?.name ?? radioGroup?.name ?? props.name;
|
|
14
14
|
const disabled = formControl?.disabled ?? props.disabled ?? checkboxGroup?.disabled ?? radioGroup?.disabled;
|
|
15
|
-
const checked = (value && checkboxGroup?.value?.includes(value)) ||
|
|
16
|
-
radioGroup?.value === value ||
|
|
15
|
+
const checked = (value && (checkboxGroup?.value?.includes(value) ?? radioGroup?.value === value)) ||
|
|
17
16
|
props.checked;
|
|
18
17
|
const defaultChecked = checkboxGroup ? undefined : props.defaultChecked;
|
|
19
18
|
const handleChange = (event) => {
|
|
@@ -28,7 +27,7 @@ const HiddenInput = (props) => {
|
|
|
28
27
|
if (radioGroup?.onChange)
|
|
29
28
|
radioGroup.onChange(changeArgs);
|
|
30
29
|
};
|
|
31
|
-
return (_jsx("input", { ...attributes, className: rootClassNames, type: type, name: name, value: value, checked: checked, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus || attributes?.onFocus, onBlur: onBlur || attributes?.onBlur }));
|
|
30
|
+
return (_jsx("input", { ...attributes, className: rootClassNames, type: type, name: name, value: value, checked: checked, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus || attributes?.onFocus, onBlur: onBlur || attributes?.onBlur, "data-rs-hidden-input": true }));
|
|
32
31
|
};
|
|
33
32
|
HiddenInput.displayName = "HiddenInput";
|
|
34
33
|
export default HiddenInput;
|
|
@@ -7,7 +7,6 @@ import useElementId from "../../hooks/useElementId.js";
|
|
|
7
7
|
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
8
8
|
import useResponsiveClientValue from "../../hooks/useResponsiveClientValue.js";
|
|
9
9
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
10
|
-
import { enableUserSelect, disableUserSelect } from "../../utilities/dom/index.js";
|
|
11
10
|
import { classNames, responsiveVariables, responsiveClassNames } from "../../utilities/props.js";
|
|
12
11
|
import { enableScroll, disableScroll } from "../../utilities/scroll/index.js";
|
|
13
12
|
import s from "./Modal.module.css";
|
|
@@ -90,7 +89,6 @@ const Modal = (props) => {
|
|
|
90
89
|
// Prevent the drag handling when browser is trying to navigate to a previous page
|
|
91
90
|
if (clientPosition === "start" && e.targetTouches[0].clientX < DRAG_EDGE_BOUNDARY)
|
|
92
91
|
return;
|
|
93
|
-
disableUserSelect();
|
|
94
92
|
disableScroll();
|
|
95
93
|
setDragging(true);
|
|
96
94
|
};
|
|
@@ -108,7 +106,6 @@ const Modal = (props) => {
|
|
|
108
106
|
if (!dragging)
|
|
109
107
|
return;
|
|
110
108
|
const handleDragEnd = () => {
|
|
111
|
-
enableUserSelect();
|
|
112
109
|
enableScroll();
|
|
113
110
|
setDragging(false);
|
|
114
111
|
// Close only when dragging in the closing direction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.content{--rs-border-w:1px;border:var(--rs-border-w) solid var(--rs-color-border-neutral-faded);max-width:360px}.content--variant-elevated{background:var(--rs-color-background-elevation-overlay);
|
|
1
|
+
.content{--rs-border-w:1px;border:var(--rs-border-w) solid var(--rs-color-border-neutral-faded);border-radius:var(--rs-radius-medium);max-width:360px}.content--variant-elevated{background:var(--rs-color-background-elevation-overlay);box-shadow:var(--rs-shadow-overlay);color:var(--rs-color-foreground-neutral);min-width:220px}.content--variant-elevated.content--elevation-raised{box-shadow:var(--rs-shadow-raised)}.content--variant-headless{border:none}.content--radius-small{border-radius:var(--rs-radius-small)}.content.content--has-width{max-width:none;min-width:0}@media (--rs-viewport-s ){.content{max-width:none}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer rs.reset{[data-rs-theme]{--rs-radius-circular:9999px;--rs-shadow-focus:0 0 0 2px var(--rs-color-background-elevation-base),0 0 0 4px var(--rs-color-border-primary);--rs-shadow-focus-inset:inset 0 0 0 2px var(--rs-color-border-primary),inset 0 0 0 4px var(--rs-color-background-elevation-base)}[data-rs-theme] blockquote,[data-rs-theme] body,[data-rs-theme] dd,[data-rs-theme] dl,[data-rs-theme] figcaption,[data-rs-theme] figure,[data-rs-theme] h1,[data-rs-theme] h2,[data-rs-theme] h3,[data-rs-theme] h4,[data-rs-theme] h5,[data-rs-theme] h6,[data-rs-theme] li,[data-rs-theme] ol,[data-rs-theme] p,[data-rs-theme] ul{margin:0;padding:0}[data-rs-theme] ol[class],[data-rs-theme] ul[class]{list-style:none}[data-rs-theme] textarea{resize:vertical}[data-rs-theme] table{border-collapse:collapse;border-spacing:0}[data-rs-theme] fieldset{border:0;margin:0;padding:0}[data-rs-theme] img{display:block;max-width:100%}[data-rs-theme] button,[data-rs-theme] input,[data-rs-theme] select,[data-rs-theme] textarea{font:inherit}[data-rs-theme] option{background:var(--rs-color-background-elevation-base)}[data-rs-theme] label{cursor:pointer}[data-rs-theme] input::placeholder,[data-rs-theme] textarea::placeholder{color:var(--rs-color-foreground-disabled)}html[data-rs-theme]{-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;font-size:100%;text-rendering:optimizelegibility;touch-action:manipulation}[data-rs-theme] *{box-sizing:border-box}[data-rs-theme] body,html[data-rs-theme]{background:var(--rs-color-background-page);color:var(--rs-color-foreground-neutral);min-height:
|
|
1
|
+
@layer rs.reset{[data-rs-theme]{--rs-radius-circular:9999px;--rs-shadow-focus:0 0 0 2px var(--rs-color-background-elevation-base),0 0 0 4px var(--rs-color-border-primary);--rs-shadow-focus-inset:inset 0 0 0 2px var(--rs-color-border-primary),inset 0 0 0 4px var(--rs-color-background-elevation-base)}[data-rs-theme] blockquote,[data-rs-theme] body,[data-rs-theme] dd,[data-rs-theme] dl,[data-rs-theme] figcaption,[data-rs-theme] figure,[data-rs-theme] h1,[data-rs-theme] h2,[data-rs-theme] h3,[data-rs-theme] h4,[data-rs-theme] h5,[data-rs-theme] h6,[data-rs-theme] li,[data-rs-theme] ol,[data-rs-theme] p,[data-rs-theme] ul{margin:0;padding:0}[data-rs-theme] ol[class],[data-rs-theme] ul[class]{list-style:none}[data-rs-theme] textarea{resize:vertical}[data-rs-theme] table{border-collapse:collapse;border-spacing:0}[data-rs-theme] fieldset{border:0;margin:0;padding:0}[data-rs-theme] img{display:block;max-width:100%}[data-rs-theme] button,[data-rs-theme] input,[data-rs-theme] select,[data-rs-theme] textarea{font:inherit}[data-rs-theme] option{background:var(--rs-color-background-elevation-base)}[data-rs-theme] label{cursor:pointer}[data-rs-theme] input::placeholder,[data-rs-theme] textarea::placeholder{color:var(--rs-color-foreground-disabled)}html[data-rs-theme]{-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;font-size:100%;text-rendering:optimizelegibility;touch-action:manipulation}[data-rs-theme] *{box-sizing:border-box}[data-rs-theme] body,html[data-rs-theme]{background:var(--rs-color-background-page);color:var(--rs-color-foreground-neutral);min-height:100dvh;scroll-behavior:smooth}[data-rs-theme] body,[data-rs-theme]:not(html){font-family:var(--rs-font-family-body);font-size:var(--rs-font-size-body-3);font-weight:var(--rs-font-weight-regular);letter-spacing:var(--rs-letter-spacing-body-3);line-height:var(--rs-line-height-body-3)}}[data-rs-color-mode=light]{color-scheme:light}[data-rs-color-mode=dark]{color-scheme:dark}@media (prefers-reduced-motion:reduce){*{animation-duration:0s!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:0s!important}}[data-rs-no-transition] *,[data-rs-no-transition] :after,[data-rs-no-transition] :before{transition:none!important}
|
|
@@ -4,8 +4,8 @@ import React, { forwardRef } from "react";
|
|
|
4
4
|
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
5
5
|
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
6
6
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
7
|
-
import { disableUserSelect, enableUserSelect } from "../../utilities/dom/index.js";
|
|
8
7
|
import { classNames } from "../../utilities/props.js";
|
|
8
|
+
import { disableScroll, enableScroll } from "../../utilities/scroll/index.js";
|
|
9
9
|
import s from "./ScrollArea.module.css";
|
|
10
10
|
const ScrollAreaBar = (props) => {
|
|
11
11
|
const { ratio, position, vertical, onThumbMove } = props;
|
|
@@ -41,14 +41,14 @@ const ScrollAreaBar = (props) => {
|
|
|
41
41
|
const total = vertical ? elBar.scrollHeight : elBar.scrollWidth;
|
|
42
42
|
onThumbMoveRef.current?.({ value: diff / total, type: "relative" });
|
|
43
43
|
}, [vertical, dragging, onThumbMoveRef]);
|
|
44
|
-
const handleDragEnd = React.useCallback(() => {
|
|
45
|
-
setDragging(false);
|
|
46
|
-
enableUserSelect();
|
|
47
|
-
}, []);
|
|
48
44
|
const handleDragStart = () => {
|
|
49
45
|
setDragging(true);
|
|
50
|
-
|
|
46
|
+
disableScroll();
|
|
51
47
|
};
|
|
48
|
+
const handleDragEnd = React.useCallback(() => {
|
|
49
|
+
setDragging(false);
|
|
50
|
+
enableScroll();
|
|
51
|
+
}, []);
|
|
52
52
|
React.useEffect(() => {
|
|
53
53
|
if (!dragging)
|
|
54
54
|
return;
|
|
@@ -5,7 +5,7 @@ import { useFormControl } from "../FormControl/index.js";
|
|
|
5
5
|
import useElementId from "../../hooks/useElementId.js";
|
|
6
6
|
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
7
7
|
import useRTL from "../../hooks/useRTL.js";
|
|
8
|
-
import {
|
|
8
|
+
import { triggerChangeEvent } from "../../utilities/dom/index.js";
|
|
9
9
|
import { classNames } from "../../utilities/props.js";
|
|
10
10
|
import { disableScroll, enableScroll } from "../../utilities/scroll/index.js";
|
|
11
11
|
import s from "./Slider.module.css";
|
|
@@ -144,30 +144,31 @@ const SliderControlled = (props) => {
|
|
|
144
144
|
handleMinChange(nextValue);
|
|
145
145
|
if (closestId === maxId)
|
|
146
146
|
handleMaxChange(nextValue);
|
|
147
|
-
disableUserSelect();
|
|
148
|
-
disableScroll();
|
|
149
147
|
setDraggingId(closestId);
|
|
150
148
|
};
|
|
151
149
|
const handleMinDragStart = (e) => {
|
|
152
150
|
if (disabled)
|
|
153
151
|
return;
|
|
154
152
|
e.stopPropagation();
|
|
153
|
+
disableScroll();
|
|
155
154
|
setDraggingId(minId);
|
|
156
155
|
};
|
|
157
156
|
const handleMaxDragStart = (e) => {
|
|
158
157
|
if (disabled)
|
|
159
158
|
return;
|
|
160
159
|
e.stopPropagation();
|
|
160
|
+
disableScroll();
|
|
161
161
|
setDraggingId(maxId);
|
|
162
162
|
};
|
|
163
163
|
const handleDragStop = React.useCallback(() => {
|
|
164
164
|
if (draggingId === minId && minValue !== undefined) {
|
|
165
165
|
handleMinChange(minValue, { commit: true });
|
|
166
|
+
minInputRef.current?.focus();
|
|
166
167
|
}
|
|
167
168
|
if (draggingId === maxId) {
|
|
168
169
|
handleMaxChange(maxValue, { commit: true });
|
|
170
|
+
maxInputRef.current?.focus();
|
|
169
171
|
}
|
|
170
|
-
enableUserSelect();
|
|
171
172
|
enableScroll();
|
|
172
173
|
setDraggingId(null);
|
|
173
174
|
}, [minValue, maxValue, handleMinChange, handleMaxChange, draggingId, minId, maxId]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@property --rs-tabs-mid-l{syntax:"<length>";initial-value:-24px;inherits:false}@property --rs-tabs-stop-l{syntax:"<length>";initial-value:0;inherits:false}@property --rs-tabs-stop-r{syntax:"<length-percentage>";initial-value:100%;inherits:false}@property --rs-tabs-mid-r{syntax:"<length-percentage>";initial-value:calc(100% + 24px);inherits:false}.root{
|
|
1
|
+
@property --rs-tabs-mid-l{syntax:"<length>";initial-value:-24px;inherits:false}@property --rs-tabs-stop-l{syntax:"<length>";initial-value:0;inherits:false}@property --rs-tabs-stop-r{syntax:"<length-percentage>";initial-value:100%;inherits:false}@property --rs-tabs-mid-r{syntax:"<length-percentage>";initial-value:calc(100% + 24px);inherits:false}.root{--rs-tabs-gap:var(--rs-unit-x6);box-sizing:initial;isolation:isolate;max-width:100%;position:relative}.inner:after{background-color:var(--rs-color-border-neutral-faded);content:"";position:absolute;z-index:2}.list{gap:var(--rs-tabs-gap)}.list,.listItem{position:relative}.listItem{flex-shrink:0}.button{--rs-tabs-focus-ring-inset:calc(var(--rs-unit-x2) * -1);position:relative;width:100%;z-index:1;-webkit-tap-highlight-color:transparent;border-radius:var(--rs-radius-medium)}[data-rs-keyboard] .button:focus:after{border-radius:var(--rs-radius-medium);box-shadow:var(--rs-shadow-focus-inset);content:"";inset:0;inset-inline:var(--rs-tabs-focus-ring-inset);pointer-events:none;position:absolute}.buttonContent{align-items:center;border-radius:var(--rs-radius-medium);box-sizing:border-box;display:flex;width:100%}.icon{color:inherit;transition:color var(--rs-duration-fast) var(--rs-easing-standard)}.icon:not(:last-child){margin-inline-end:var(--rs-unit-x2)}[data-rs-keyboard] .radio:focus+.buttonContent{box-shadow:var(--rs-shadow-focus-inset)}.item{color:var(--rs-color-foreground-neutral)}.item:after{content:"";opacity:0;pointer-events:none}.item--active.item:after{opacity:1}.item.item--disabled{color:var(--rs-color-foreground-disabled)}.root:not(:has(.selector)) .item:after{transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity}.item:after,.selector{background:var(--rs-color-border-primary);border-radius:var(--rs-radius-medium);position:absolute;z-index:var(--rs-z-index-relative)}.selector{--rs-tab-selection-x:0;--rs-tab-selection-y:0;--rs-tab-selection-scale-x:0;--rs-tab-selection-scale-y:0;transform:translate(calc(var(--rs-tab-selection-x) * 1px),calc(var(--rs-tab-selection-y) * 1px)) translateZ(0);transform-origin:0 0}.selector.selector--hidden{visibility:hidden}.selector.selector--animated{transition:var(--rs-duration-medium) var(--rs-easing-decelerate);transition-property:transform,height,width;will-change:transform,height,width}.control{align-items:center;display:none;inset-block:0;opacity:0;pointer-events:none;position:absolute;transition:var(--rs-duration-medium) var(--rs-easing-decelerate);transition-property:opacity,transform;z-index:var(--rs-z-index-relative)}.control.control--active{opacity:1;pointer-events:all}[dir=rtl] .control{transform:scaleX(-1)}.control.control--next{inset-inline-end:0}.control.control--prev{inset-inline-start:0}.panel{outline:none}[data-rs-keyboard] .panel:focus{box-shadow:var(--rs-shadow-focus)}.panel.panel--hidden{display:none}.--scrollable .inner{overflow:auto;overflow:-moz-scrollbars-none;scrollbar-width:none;-ms-overflow-style:none;mask-image:linear-gradient(to right,transparent 0,transparent var(--rs-tabs-mid-l),#000 var(--rs-tabs-stop-l),#000 var(--rs-tabs-stop-r),transparent var(--rs-tabs-mid-r),transparent 100%);transition:var(--rs-duration-medium) var(--rs-easing-decelerate);transition-property:--rs-tabs-stop-l,--rs-tabs-stop-r,--rs-tabs-mid-l,--rs-tabs-mid-r}.--scrollable .inner::-webkit-scrollbar{display:none}.--direction-row .inner{white-space:nowrap}.--direction-row .inner:after{bottom:0;height:1px;inset-inline:0}.--direction-row .list{align-items:center;display:inline-flex;flex-wrap:nowrap;vertical-align:top}.--direction-row .item:after{inset-inline:0;bottom:0;height:2px}.--direction-row .selector{bottom:0;height:2px;left:0;width:calc(var(--rs-tab-selection-scale-x) * 1px)}.--direction-row .button{box-sizing:initial;margin-block:var(--rs-unit-x1)}.--direction-row .buttonContent{justify-content:center;padding:var(--rs-tabs-item-p-v) 0}.--direction-column{--rs-tabs-gap:var(--rs-unit-x1)}.--direction-column .inner:after{height:100%;inset-block:0;inset-inline-end:0;width:1px}.--direction-column .list{display:flex;flex-direction:column}.--direction-column .item{padding-inline-end:var(--rs-unit-x1)}.--direction-column .item:after{inset-block:0;inset-inline-end:0;width:2px}.--direction-column .selector{height:calc(var(--rs-tab-selection-scale-y) * 1px);inset-inline-end:0;top:0;width:2px}.--direction-column .button{--rs-tabs-focus-ring-inset:0;margin-inline-start:calc(var(--rs-unit-x2) * -1);padding:var(--rs-unit-x2);width:calc(100% + var(--rs-unit-x1))}.--direction-column .buttonContent{justify-content:flex-start}.--variant-borderless .inner:after,.--variant-pills .inner:after,.--variant-pills-elevated .inner:after{content:none}.--variant-pills,.--variant-pills-elevated{--rs-tabs-gap:var(--rs-unit-x1)}.--variant-pills .button,.--variant-pills-elevated .button{--rs-tabs-focus-ring-inset:0;margin:0;padding:0}.--variant-pills .buttonContent,.--variant-pills-elevated .buttonContent{margin:0;padding:var(--rs-tabs-item-p-v) var(--rs-tabs-item-p-h)}.--variant-pills .selector,.--variant-pills-elevated .selector{background-color:var(--rs-color-background-neutral);height:calc(var(--rs-tab-selection-scale-y) * 1px);width:calc(var(--rs-tab-selection-scale-x) * 1px);z-index:0}.--variant-pills .item:after,.--variant-pills-elevated .item:after{background-color:var(--rs-color-background-neutral);z-index:0}.--variant-pills-elevated.--direction-column .item:after,.--variant-pills.--direction-column .item:after{width:100%}.--variant-pills-elevated.--direction-column .selector,.--variant-pills.--direction-column .selector{left:0}.--variant-pills-elevated.--direction-row .item:after,.--variant-pills.--direction-row .item:after{height:100%}.--variant-pills-elevated.--direction-row .selector,.--variant-pills.--direction-row .selector{top:0}.--variant-pills .item--active:after,.--variant-pills .selector{opacity:.6}.--variant-pills-elevated .list{background:var(--rs-color-background-neutral-faded);border:2px solid transparent;border-radius:var(--rs-radius-medium)}.--variant-pills-elevated .buttonContent{padding:calc(var(--rs-tabs-item-p-v) - var(--rs-unit-x1) / 2) var(--rs-tabs-item-p-h)}.--variant-pills-elevated .item:after,.--variant-pills-elevated .selector{background:var(--rs-color-background-elevation-raised);border-radius:calc(var(--rs-radius-medium) - 1px);box-shadow:var(--rs-shadow-raised);box-sizing:border-box}.--size-medium{--rs-tabs-item-p-v:var(--rs-unit-x2);--rs-tabs-item-p-h:var(--rs-unit-x3)}.--size-large{--rs-tabs-item-p-v:var(--rs-unit-x3);--rs-tabs-item-p-h:var(--rs-unit-x4)}.--item-width-equal{max-width:none}.--item-width-equal .inner{flex-wrap:wrap}.--item-width-equal .list{display:flex}.--item-width-equal .listItem{flex-basis:0;flex-grow:1;margin:0;min-width:0}.--item-width-equal .buttonText{overflow:hidden;text-overflow:ellipsis}.--item-width-equal .button{--rs-tabs-focus-ring-inset:0}.--fade-end .inner,[dir=rtl] .--fade-start .inner{--rs-tabs-mid-r:100%;--rs-tabs-stop-r:calc(100% - var(--rs-unit-x1) * 10)}.--fade-start .inner,[dir=rtl] .--fade-end .inner{--rs-tabs-mid-l:0px;--rs-tabs-stop-l:calc(var(--rs-unit-x1) * 10)}@media (pointer:fine){.control{display:flex}.--fade-end .inner,[dir=rtl] .--fade-start .inner{--rs-tabs-mid-r:calc(100% - var(--rs-unit-x1) * 4);--rs-tabs-stop-r:calc(100% - var(--rs-unit-x1) * 10)}.--fade-start .inner,[dir=rtl] .--fade-end .inner{--rs-tabs-mid-l:calc(var(--rs-unit-x1) * 4);--rs-tabs-stop-l:calc(var(--rs-unit-x1) * 10)}}
|
|
@@ -53,6 +53,8 @@ export type BaseProps = {
|
|
|
53
53
|
size?: "medium" | "large";
|
|
54
54
|
/** Name of the tab buttons group when used as a form control */
|
|
55
55
|
name?: string;
|
|
56
|
+
/** Disable the animation of the tab button selection */
|
|
57
|
+
disableSelectionAnimation?: boolean;
|
|
56
58
|
/** Callback when the active tab value changes */
|
|
57
59
|
onChange?: (args: {
|
|
58
60
|
value: string;
|
|
@@ -75,7 +77,7 @@ export type UncontrolledProps = BaseProps & {
|
|
|
75
77
|
defaultValue?: string;
|
|
76
78
|
};
|
|
77
79
|
export type Props = ControlledProps | UncontrolledProps;
|
|
78
|
-
export type Context = Pick<BaseProps, "itemWidth" | "onChange" | "variant" | "name" | "direction"> & {
|
|
80
|
+
export type Context = Pick<BaseProps, "itemWidth" | "onChange" | "variant" | "name" | "direction" | "disableSelectionAnimation"> & {
|
|
79
81
|
size: NonNullable<BaseProps["size"]>;
|
|
80
82
|
value?: string;
|
|
81
83
|
setDefaultValue: (value: string) => void;
|
|
@@ -12,6 +12,7 @@ export declare const useTabs: (value?: string) => {
|
|
|
12
12
|
name?: string;
|
|
13
13
|
}) => void) | undefined;
|
|
14
14
|
itemWidth?: "equal" | undefined;
|
|
15
|
+
disableSelectionAnimation?: boolean | undefined;
|
|
15
16
|
size: NonNullable<T.BaseProps["size"]>;
|
|
16
17
|
value?: string;
|
|
17
18
|
setDefaultValue: (value: string) => void;
|
|
@@ -4,7 +4,7 @@ import React from "react";
|
|
|
4
4
|
import useElementId from "../../hooks/useElementId.js";
|
|
5
5
|
import { TabsProvider } from "./TabsContext.js";
|
|
6
6
|
const TabsControlled = (props) => {
|
|
7
|
-
const { children, value, onChange, onSilentChange, itemWidth, variant, name, direction = "row", size = "medium", } = props;
|
|
7
|
+
const { children, value, onChange, onSilentChange, itemWidth, variant, name, disableSelectionAnimation, direction = "row", size = "medium", } = props;
|
|
8
8
|
const id = useElementId();
|
|
9
9
|
const elActiveRef = React.useRef(null);
|
|
10
10
|
// eslint-disable-next-line react-hooks/refs
|
|
@@ -38,6 +38,7 @@ const TabsControlled = (props) => {
|
|
|
38
38
|
elScrollableRef,
|
|
39
39
|
selection,
|
|
40
40
|
setSelection,
|
|
41
|
+
disableSelectionAnimation,
|
|
41
42
|
}, children: children }));
|
|
42
43
|
};
|
|
43
44
|
TabsControlled.displayName = "TabsControlled";
|
|
@@ -16,7 +16,7 @@ const TabsItem = React.forwardRef((props, ref) => {
|
|
|
16
16
|
const itemRef = React.useRef(null);
|
|
17
17
|
const active = tabsValue === value;
|
|
18
18
|
const visuallySelected = active && selection.status === "idle";
|
|
19
|
-
const itemClassNames = classNames(s.item, visuallySelected && s["--
|
|
19
|
+
const itemClassNames = classNames(s.item, visuallySelected && s["item--active"], disabled && s["item--disabled"]);
|
|
20
20
|
const isFormControl = !!name;
|
|
21
21
|
const tabAttributes = {
|
|
22
22
|
role: "tab",
|
|
@@ -60,7 +60,7 @@ const TabsItem = React.forwardRef((props, ref) => {
|
|
|
60
60
|
return;
|
|
61
61
|
updateRefs();
|
|
62
62
|
}, [active, updateRefs]);
|
|
63
|
-
return (_jsx("div", { ...attributes, className: itemClassNames, ref: itemRef, role: "presentation", children: _jsxs(Actionable, { ref: ref, href: href,
|
|
63
|
+
return (_jsx("div", { ...attributes, className: itemClassNames, ref: itemRef, role: "presentation", children: _jsxs(Actionable, { ref: ref, href: href, disableFocusRing: true, disabled: disabled, onClick: !name ? handleChange : undefined, className: s.button, as: name ? "label" : undefined, attributes: {
|
|
64
64
|
...(!isFormControl && tabAttributes),
|
|
65
65
|
"aria-controls": panelId,
|
|
66
66
|
id: buttonId,
|
|
@@ -22,11 +22,11 @@ const findParentItem = (el, rootEl) => {
|
|
|
22
22
|
};
|
|
23
23
|
const TabsList = (props) => {
|
|
24
24
|
const { children, className, attributes } = props;
|
|
25
|
-
const { value, setDefaultValue, itemWidth, variant, name, direction, size, selection, setSelection, elActiveRef, elPrevActiveRef, elScrollableRef, } = useTabs();
|
|
25
|
+
const { value, setDefaultValue, itemWidth, variant, name, direction, size, selection, setSelection, elActiveRef, elPrevActiveRef, elScrollableRef, disableSelectionAnimation, } = useTabs();
|
|
26
26
|
const [rtl] = useRTL();
|
|
27
27
|
const fadeSide = useFadeSide(elScrollableRef, { disabled: itemWidth === "equal" });
|
|
28
28
|
const rootClassNames = classNames(s.root, size && s[`--size-${size}`], direction && s[`--direction-${direction}`], itemWidth && s[`--item-width-${itemWidth}`], variant && s[`--variant-${variant}`], fadeSide && s["--scrollable"], (fadeSide === "start" || fadeSide === "both") && s["--fade-start"], (fadeSide === "end" || fadeSide === "both") && s["--fade-end"], className);
|
|
29
|
-
const selectorClassNames = classNames(s.selector, selection.status === "idle" && s["--
|
|
29
|
+
const selectorClassNames = classNames(s.selector, selection.status === "idle" && s["selector--hidden"], selection.status === "animated" && s["selector--animated"]);
|
|
30
30
|
const handleNextClick = () => {
|
|
31
31
|
elScrollableRef.current.scrollBy({
|
|
32
32
|
// Using ceil here since during the second navigation half of the value may be
|
|
@@ -79,8 +79,12 @@ const TabsList = (props) => {
|
|
|
79
79
|
const selectionStyle = getElementSelectionStyle(elPrevActiveRef.current);
|
|
80
80
|
if (!selectionStyle)
|
|
81
81
|
return;
|
|
82
|
+
if (disableSelectionAnimation) {
|
|
83
|
+
setSelection({ ...selectionStyle, status: "idle" });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
82
86
|
setSelection({ ...selectionStyle, status: "prepared" });
|
|
83
|
-
}, [value, getElementSelectionStyle]);
|
|
87
|
+
}, [value, getElementSelectionStyle, disableSelectionAnimation]);
|
|
84
88
|
useIsomorphicLayoutEffect(() => {
|
|
85
89
|
if (selection.status !== "prepared" || !elActiveRef.current)
|
|
86
90
|
return;
|
|
@@ -94,12 +98,12 @@ const TabsList = (props) => {
|
|
|
94
98
|
return null;
|
|
95
99
|
const props = child.props;
|
|
96
100
|
return (_jsx("div", { className: s.listItem, "data-rs-tabs-item": true, children: child }, props.value || child.key || index));
|
|
97
|
-
}), _jsx("div", { onTransitionEnd: handleTransitionEnd, className: selectorClassNames, style: {
|
|
101
|
+
}), !disableSelectionAnimation && (_jsx("div", { onTransitionEnd: handleTransitionEnd, className: selectorClassNames, style: {
|
|
98
102
|
"--rs-tab-selection-x": selection.left,
|
|
99
103
|
"--rs-tab-selection-y": selection.top,
|
|
100
104
|
"--rs-tab-selection-scale-x": selection.scaleX,
|
|
101
105
|
"--rs-tab-selection-scale-y": selection.scaleY,
|
|
102
|
-
} })] }) }), _jsx(Actionable, { onClick: handlePrevClick, touchHitbox: true, attributes: { "aria-hidden": true, tabIndex: -1 }, className: [
|
|
106
|
+
} }))] }) }), _jsx(Actionable, { onClick: handlePrevClick, touchHitbox: true, attributes: { "aria-hidden": true, tabIndex: -1 }, className: [
|
|
103
107
|
s.control,
|
|
104
108
|
s["control--prev"],
|
|
105
109
|
(fadeSide === "start" || fadeSide === "both") && s["control--active"],
|
|
@@ -11,7 +11,7 @@ const TabsPanel = (props) => {
|
|
|
11
11
|
const [needsTabIndex, setNeedsTabIndex] = React.useState(true);
|
|
12
12
|
const rootRef = React.useRef(null);
|
|
13
13
|
const active = panelValue === value;
|
|
14
|
-
const panelClassNames = classNames(s.panel, !active && s["--
|
|
14
|
+
const panelClassNames = classNames(s.panel, !active && s["panel--hidden"], className);
|
|
15
15
|
React.useEffect(() => {
|
|
16
16
|
const el = rootRef.current;
|
|
17
17
|
if (!el)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as T from "./Text.types";
|
|
2
2
|
declare const Text: {
|
|
3
|
-
<As extends keyof React.JSX.IntrinsicElements>(props: T.Props<As>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
<As extends keyof React.JSX.IntrinsicElements = "div">(props: T.Props<As>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Text;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
2
|
import type * as G from "../../types/global";
|
|
3
3
|
export type Variant = "title-1" | "title-2" | "title-3" | "title-4" | "title-5" | "title-6" | "featured-1" | "featured-2" | "featured-3" | "body-1" | "body-2" | "body-3" | "caption-1" | "caption-2";
|
|
4
|
-
export type Props<TagName extends keyof React.JSX.IntrinsicElements =
|
|
4
|
+
export type Props<TagName extends keyof React.JSX.IntrinsicElements | void = void> = {
|
|
5
5
|
/** Text render variant */
|
|
6
6
|
variant?: G.Responsive<Variant>;
|
|
7
7
|
/** Text font weight */
|
|
@@ -20,12 +20,12 @@ export type Props<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
|
|
|
20
20
|
maxLines?: number;
|
|
21
21
|
/** Render as a numeric value to preserve the width of each character */
|
|
22
22
|
numeric?: true;
|
|
23
|
-
/** Render as a different html tag */
|
|
24
|
-
as?: TagName;
|
|
25
23
|
/** Node for inserting children */
|
|
26
24
|
children?: React.ReactNode;
|
|
27
25
|
/** Additional classname for the root element */
|
|
28
26
|
className?: G.ClassName;
|
|
29
27
|
/** Additional attributes for the root element */
|
|
30
28
|
attributes?: G.Attributes<TagName>;
|
|
29
|
+
/** Render as a different html tag */
|
|
30
|
+
as?: TagName extends keyof React.JSX.IntrinsicElements ? TagName : keyof React.JSX.IntrinsicElements;
|
|
31
31
|
};
|
|
@@ -5,12 +5,12 @@ import Text from "../Text/index.js";
|
|
|
5
5
|
import Theme from "../Theme/index.js";
|
|
6
6
|
import s from "./Tooltip.module.css";
|
|
7
7
|
const Tooltip = (props) => {
|
|
8
|
-
const { text, children, position = "bottom", color = "inverted", ...flyoutProps } = props;
|
|
8
|
+
const { text, children, position = "bottom", color = "inverted", contentMaxWidth = "360px", ...flyoutProps } = props;
|
|
9
9
|
if (!text)
|
|
10
10
|
return children({ ref: null });
|
|
11
11
|
return (_jsxs(Flyout, { ...flyoutProps, position: position, triggerType: "hover",
|
|
12
12
|
// Disable group timeouts by default since it's not controlled by the default user events
|
|
13
|
-
groupTimeouts: flyoutProps.active === undefined ? true : false, children: [_jsx(Flyout.Trigger, { children: children }), _jsx(Flyout.Content, { children: _jsx(Theme, { colorMode: color, children: _jsx(Text, { variant: "caption-1", className: s.root, children: text }) }) })] }));
|
|
13
|
+
groupTimeouts: flyoutProps.active === undefined ? true : false, contentMaxWidth: contentMaxWidth, children: [_jsx(Flyout.Trigger, { children: children }), _jsx(Flyout.Content, { children: _jsx(Theme, { colorMode: color, children: _jsx(Text, { variant: "caption-1", className: s.root, children: text }) }) })] }));
|
|
14
14
|
};
|
|
15
15
|
Tooltip.displayName = "Tooltip";
|
|
16
16
|
export default Tooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.root{background:var(--rs-color-background-elevation-overlay);border-radius:var(--rs-radius-small);box-shadow:var(--rs-shadow-overlay);color:var(--rs-color-foreground-neutral);
|
|
1
|
+
.root{background:var(--rs-color-background-elevation-overlay);border-radius:var(--rs-radius-small);box-shadow:var(--rs-shadow-overlay);color:var(--rs-color-foreground-neutral);padding:var(--rs-unit-x1) var(--rs-unit-x2)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { FlyoutProps, FlyoutTriggerAttributes } from "../Flyout";
|
|
3
|
-
export type Props = Pick<FlyoutProps, "id" | "position" | "onOpen" | "onClose" | "active" | "disabled" | "disableContentHover" | "containerRef" | "positionRef" | "contentGap" | "contentShift" | "originCoordinates" | "contentAttributes" | "contentClassName"> & {
|
|
3
|
+
export type Props = Pick<FlyoutProps, "id" | "position" | "onOpen" | "onClose" | "active" | "disabled" | "disableContentHover" | "containerRef" | "positionRef" | "contentGap" | "contentShift" | "contentMaxWidth" | "originCoordinates" | "contentAttributes" | "contentClassName" | "instanceRef"> & {
|
|
4
4
|
/** Node for inserting children */
|
|
5
5
|
children: (attributes: FlyoutTriggerAttributes) => React.ReactNode;
|
|
6
6
|
/** Text content for the tooltip */
|
|
@@ -3,11 +3,11 @@ import type * as TStyles from "../../styles/types";
|
|
|
3
3
|
import type * as G from "../../types/global";
|
|
4
4
|
type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | "auto";
|
|
5
5
|
export type Direction = "row" | "column" | "row-reverse" | "column-reverse";
|
|
6
|
-
export type Props<TagName extends keyof React.JSX.IntrinsicElements =
|
|
6
|
+
export type Props<TagName extends keyof React.JSX.IntrinsicElements | void = void> = {
|
|
7
7
|
/** Node for inserting the content */
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
/** Render as a different element */
|
|
10
|
-
as?: TagName;
|
|
10
|
+
as?: TagName extends keyof React.JSX.IntrinsicElements ? TagName : keyof React.JSX.IntrinsicElements;
|
|
11
11
|
/** Render a divider between each child */
|
|
12
12
|
divided?: boolean;
|
|
13
13
|
/** Flex direction for the content */
|
|
@@ -97,7 +97,7 @@ export type Props<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
|
|
|
97
97
|
/** Additional attributes for the root element */
|
|
98
98
|
attributes?: G.Attributes<TagName>;
|
|
99
99
|
} & Pick<ItemProps, "grow" | "shrink">;
|
|
100
|
-
export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements =
|
|
100
|
+
export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements | void = void> = {
|
|
101
101
|
/** Flex order of the item inside the parent */
|
|
102
102
|
order?: G.Responsive<number>;
|
|
103
103
|
/** Number of columns the item should span in the parent, View uses 12 columns */
|
|
@@ -109,7 +109,7 @@ export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements = "div">
|
|
|
109
109
|
/** Individual gap before the item, overrides the parent View gap */
|
|
110
110
|
gapBefore?: G.Responsive<number> | "auto";
|
|
111
111
|
/** Render as a different element */
|
|
112
|
-
as?: TagName;
|
|
112
|
+
as?: TagName extends keyof React.JSX.IntrinsicElements ? TagName : keyof React.JSX.IntrinsicElements;
|
|
113
113
|
/** Additional attributes for the root element */
|
|
114
114
|
attributes?: G.Attributes<TagName>;
|
|
115
115
|
/** Additional classname for the root element */
|
|
@@ -4,7 +4,6 @@ import * as keys from "../../constants/keys.js";
|
|
|
4
4
|
import useHandlerRef from "../useHandlerRef.js";
|
|
5
5
|
import useHotkeys from "../useHotkeys.js";
|
|
6
6
|
import useToggle from "../useToggle.js";
|
|
7
|
-
import { disableUserSelect, enableUserSelect } from "../../utilities/dom/index.js";
|
|
8
7
|
import { disableScroll, enableScroll } from "../../utilities/scroll/index.js";
|
|
9
8
|
const useDrag = (cb, options) => {
|
|
10
9
|
const { disabled, containerRef: passedContainerRef, orientation = "all" } = options || {};
|
|
@@ -76,7 +75,6 @@ const useDrag = (cb, options) => {
|
|
|
76
75
|
const handleDragEnd = () => {
|
|
77
76
|
triggerCompensationRef.current = { x: 0, y: 0 };
|
|
78
77
|
toggle.deactivate();
|
|
79
|
-
enableUserSelect();
|
|
80
78
|
enableScroll();
|
|
81
79
|
};
|
|
82
80
|
document.addEventListener("touchmove", handleDrag, { passive: true });
|
|
@@ -103,7 +101,6 @@ const useDrag = (cb, options) => {
|
|
|
103
101
|
y: resolvedEvent.clientY - triggerRect.y,
|
|
104
102
|
};
|
|
105
103
|
toggle.activate();
|
|
106
|
-
disableUserSelect();
|
|
107
104
|
disableScroll();
|
|
108
105
|
};
|
|
109
106
|
triggerEl.addEventListener("touchstart", handleStart, { passive: true });
|
package/dist/index.d.ts
CHANGED
|
@@ -110,6 +110,8 @@ export { default as Grid } from "./components/Grid";
|
|
|
110
110
|
export type { GridProps, GridItemProps } from "./components/Grid";
|
|
111
111
|
export { default as Hidden } from "./components/Hidden";
|
|
112
112
|
export type { HiddenProps } from "./components/Hidden";
|
|
113
|
+
export { default as HiddenInput } from "./components/HiddenInput";
|
|
114
|
+
export type { HiddenInputProps } from "./components/HiddenInput";
|
|
113
115
|
export { default as HiddenVisually } from "./components/HiddenVisually";
|
|
114
116
|
export type { HiddenVisuallyProps } from "./components/HiddenVisually";
|
|
115
117
|
export { default as Icon } from "./components/Icon";
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ export { default as Flyout } from "./components/Flyout/index.js";
|
|
|
57
57
|
export { default as FormControl } from "./components/FormControl/index.js";
|
|
58
58
|
export { default as Grid } from "./components/Grid/index.js";
|
|
59
59
|
export { default as Hidden } from "./components/Hidden/index.js";
|
|
60
|
+
export { default as HiddenInput } from "./components/HiddenInput/index.js";
|
|
60
61
|
export { default as HiddenVisually } from "./components/HiddenVisually/index.js";
|
|
61
62
|
export { default as Icon } from "./components/Icon/index.js";
|
|
62
63
|
export { default as Image } from "./components/Image/index.js";
|
package/dist/types/global.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type ClassName = ClassNameValue | ClassNameValue[] | ClassName[];
|
|
|
7
7
|
export type CSSVariable = `--${string}`;
|
|
8
8
|
export type StyleAttribute = React.CSSProperties | (React.CSSProperties & Record<CSSVariable, string | number | undefined>);
|
|
9
9
|
type DataAttributes = object | Record<`data-${string}`, string | boolean>;
|
|
10
|
-
export type Attributes<TagName extends keyof React.JSX.IntrinsicElements =
|
|
10
|
+
export type Attributes<TagName extends keyof React.JSX.IntrinsicElements | void = void> = (TagName extends keyof React.JSX.IntrinsicElements ? React.JSX.IntrinsicElements[TagName] : React.HTMLAttributes<HTMLElement>) & DataAttributes & {
|
|
11
11
|
style?: StyleAttribute;
|
|
12
12
|
};
|
|
13
13
|
export type Viewport = "s" | "m" | "l" | "xl";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getRectFromCoordinates } from "./flyout";
|
|
2
2
|
export { getShadowRoot } from "./shadowDom";
|
|
3
|
-
export { enableUserSelect, disableUserSelect } from "./userSelect";
|
|
4
3
|
export { findParent, findClosestScrollableContainer, findClosestPositionContainer } from "./find";
|
|
5
4
|
export { triggerChangeEvent } from "./event";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getRectFromCoordinates } from "./flyout.js";
|
|
2
2
|
export { getShadowRoot } from "./shadowDom.js";
|
|
3
|
-
export { enableUserSelect, disableUserSelect } from "./userSelect.js";
|
|
4
3
|
export { findParent, findClosestScrollableContainer, findClosestPositionContainer } from "./find.js";
|
|
5
4
|
export { triggerChangeEvent } from "./event.js";
|
|
@@ -4,10 +4,12 @@ export const preventDefault = (e) => e.preventDefault();
|
|
|
4
4
|
* without locking the page with overflow
|
|
5
5
|
*/
|
|
6
6
|
export const disableScroll = () => {
|
|
7
|
-
window.addEventListener("wheel", preventDefault);
|
|
8
|
-
window.addEventListener("touchmove", preventDefault);
|
|
7
|
+
window.addEventListener("wheel", preventDefault, { passive: false });
|
|
8
|
+
window.addEventListener("touchmove", preventDefault, { passive: false });
|
|
9
|
+
document.body.style.userSelect = "none";
|
|
9
10
|
};
|
|
10
11
|
export const enableScroll = () => {
|
|
11
12
|
window.removeEventListener("wheel", preventDefault);
|
|
12
13
|
window.removeEventListener("touchmove", preventDefault);
|
|
14
|
+
document.body.style.userSelect = "";
|
|
13
15
|
};
|