@wonderflow/react-components 2.18.13 → 2.20.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/button/button.d.ts +1 -1
- package/chip/chip.d.ts +2 -2
- package/core/basic.css +1 -1
- package/dropdown/dropdown-item.d.ts +1 -1
- package/dropdown/dropdown-item.module.css +1 -1
- package/index.d.ts +17 -16
- package/index.js +17 -16
- package/modal/index.d.ts +3 -0
- package/modal/index.js +2 -0
- package/modal/modal-content.d.ts +7 -0
- package/modal/modal-content.js +29 -0
- package/modal/modal-content.module.css +40 -0
- package/modal/modal-context.d.ts +9 -0
- package/modal/modal-context.js +13 -0
- package/modal/modal.d.ts +16 -0
- package/modal/modal.js +45 -0
- package/modal/modal.module.css +48 -0
- package/package.json +2 -1
- package/select/select.d.ts +2 -2
- package/selection-controls/checkbox.d.ts +2 -2
- package/selection-controls/radio.d.ts +2 -2
- package/selection-controls/toggle.d.ts +2 -2
- package/snackbar/snackbar.module.css +1 -2
- package/tab/tab.d.ts +8 -6
- package/tab/tab.js +9 -5
- package/tab/tab.module.css +4 -0
- package/themes/dark.css +1 -1
- package/themes/light.css +2 -2
- package/themes/light.json +1 -1
- package/themes.css +4 -4
package/button/button.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare type ButtonProps = PropsWithClass & {
|
|
|
9
9
|
iconPosition?: 'left' | 'right';
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
type?: 'submit' | 'reset' | 'button';
|
|
12
|
-
onClick
|
|
12
|
+
onClick?(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>): void;
|
|
13
13
|
};
|
|
14
14
|
declare type PolymorphicButton = Polymorphic.ForwardRefComponent<'button', ButtonProps>;
|
|
15
15
|
export declare const Button: PolymorphicButton;
|
package/chip/chip.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ export declare type ChipProps = PropsWithClass & {
|
|
|
3
3
|
dimension?: 'small' | 'regular' | 'big';
|
|
4
4
|
color?: 'gray' | 'cyan' | 'green' | 'purple' | 'yellow' | 'red' | 'blue';
|
|
5
5
|
interactive?: boolean;
|
|
6
|
-
onDismissClick
|
|
6
|
+
onDismissClick?(): void;
|
|
7
7
|
};
|
|
8
8
|
export declare const Chip: React.ForwardRefExoticComponent<PropsWithClass & {
|
|
9
9
|
dimension?: "big" | "small" | "regular" | undefined;
|
|
10
10
|
color?: "gray" | "cyan" | "green" | "purple" | "yellow" | "red" | "blue" | undefined;
|
|
11
11
|
interactive?: boolean | undefined;
|
|
12
|
-
onDismissClick
|
|
12
|
+
onDismissClick?(): void;
|
|
13
13
|
} & React.RefAttributes<HTMLSpanElement>>;
|
package/core/basic.css
CHANGED
|
@@ -4,6 +4,7 @@ html {
|
|
|
4
4
|
-webkit-font-smoothing: antialiased;
|
|
5
5
|
box-sizing: border-box;
|
|
6
6
|
line-height: 1.5;
|
|
7
|
+
background-color: var(--global-background);
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
*,
|
|
@@ -21,7 +22,6 @@ html {
|
|
|
21
22
|
|
|
22
23
|
body {
|
|
23
24
|
color: var(--global-foreground);
|
|
24
|
-
background-color: var(--global-background);
|
|
25
25
|
font-family: env(--font-family-sans);
|
|
26
26
|
font-feature-settings: 'calt' off;
|
|
27
27
|
scroll-padding: env(--space-80);
|
package/index.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
export { UIDReset as IdProvider } from 'react-uid';
|
|
2
|
+
export { Button } from './button';
|
|
3
|
+
export { Card } from './card';
|
|
4
|
+
export { Checkbox, Radio, Toggle } from './selection-controls';
|
|
5
|
+
export { Chip } from './chip';
|
|
6
|
+
export { ClampText } from './clamp-text';
|
|
2
7
|
export { Container } from './container';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { Title } from './title';
|
|
7
|
-
export { Stack } from './stack';
|
|
8
|
+
export { Disclosure } from './disclosure';
|
|
9
|
+
export { Dropdown } from './dropdown';
|
|
10
|
+
export { Elevator } from './elevator';
|
|
8
11
|
export { Icon } from './icon';
|
|
9
|
-
export { Button } from './button';
|
|
10
12
|
export { IconButton } from './icon-button';
|
|
13
|
+
export { List } from './list';
|
|
14
|
+
export { Modal, useModalContext } from './modal';
|
|
15
|
+
export { Prose } from './prose';
|
|
11
16
|
export { Select } from './select';
|
|
12
|
-
export {
|
|
17
|
+
export { Separator } from './separator';
|
|
13
18
|
export { Snackbar } from './snackbar';
|
|
14
|
-
export {
|
|
15
|
-
export { Checkbox, Radio, Toggle } from './selection-controls';
|
|
16
|
-
export { ThemeSwitch } from './theme-switch';
|
|
17
|
-
export { Elevator } from './elevator';
|
|
18
|
-
export { Card } from './card';
|
|
19
|
+
export { Stack } from './stack';
|
|
19
20
|
export { StarMeter } from './star-meter';
|
|
20
21
|
export { Tab } from './tab';
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
22
|
+
export { Text } from './text';
|
|
23
|
+
export { Textfield } from './textfield';
|
|
24
|
+
export { ThemeSwitch } from './theme-switch';
|
|
25
|
+
export { Title } from './title';
|
|
24
26
|
export { Tooltip } from './tooltip';
|
|
25
|
-
export { Chip } from './chip';
|
package/index.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
export { UIDReset as IdProvider } from 'react-uid';
|
|
2
|
+
export { Button } from './button';
|
|
3
|
+
export { Card } from './card';
|
|
4
|
+
export { Checkbox, Radio, Toggle } from './selection-controls';
|
|
5
|
+
export { Chip } from './chip';
|
|
6
|
+
export { ClampText } from './clamp-text';
|
|
2
7
|
export { Container } from './container';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { Title } from './title';
|
|
7
|
-
export { Stack } from './stack';
|
|
8
|
+
export { Disclosure } from './disclosure';
|
|
9
|
+
export { Dropdown } from './dropdown';
|
|
10
|
+
export { Elevator } from './elevator';
|
|
8
11
|
export { Icon } from './icon';
|
|
9
|
-
export { Button } from './button';
|
|
10
12
|
export { IconButton } from './icon-button';
|
|
13
|
+
export { List } from './list';
|
|
14
|
+
export { Modal, useModalContext } from './modal';
|
|
15
|
+
export { Prose } from './prose';
|
|
11
16
|
export { Select } from './select';
|
|
12
|
-
export {
|
|
17
|
+
export { Separator } from './separator';
|
|
13
18
|
export { Snackbar } from './snackbar';
|
|
14
|
-
export {
|
|
15
|
-
export { Checkbox, Radio, Toggle } from './selection-controls';
|
|
16
|
-
export { ThemeSwitch } from './theme-switch';
|
|
17
|
-
export { Elevator } from './elevator';
|
|
18
|
-
export { Card } from './card';
|
|
19
|
+
export { Stack } from './stack';
|
|
19
20
|
export { StarMeter } from './star-meter';
|
|
20
21
|
export { Tab } from './tab';
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
22
|
+
export { Text } from './text';
|
|
23
|
+
export { Textfield } from './textfield';
|
|
24
|
+
export { ThemeSwitch } from './theme-switch';
|
|
25
|
+
export { Title } from './title';
|
|
24
26
|
export { Tooltip } from './tooltip';
|
|
25
|
-
export { Chip } from './chip';
|
package/modal/index.d.ts
ADDED
package/modal/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export declare type ModalContentProps = PropsWithClass & {
|
|
3
|
+
title: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export declare const ModalContent: React.ForwardRefExoticComponent<PropsWithClass & {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import clsx from 'clsx';
|
|
13
|
+
import React, { forwardRef } from 'react';
|
|
14
|
+
import { Content, Header, CloseButton } from './modal-content.module.css';
|
|
15
|
+
import { Title } from '../title';
|
|
16
|
+
import { Elevator } from '../elevator';
|
|
17
|
+
import { IconButton } from '../icon-button';
|
|
18
|
+
import { useModalContext } from './modal-context';
|
|
19
|
+
export const ModalContent = forwardRef((_a, forwardedRef) => {
|
|
20
|
+
var { children, className, title } = _a, props = __rest(_a, ["children", "className", "title"]);
|
|
21
|
+
const { onClose, titleId } = useModalContext();
|
|
22
|
+
return (React.createElement(Elevator, { resting: 4 },
|
|
23
|
+
React.createElement("div", Object.assign({ className: clsx(Content, className), ref: forwardedRef }, props),
|
|
24
|
+
React.createElement("header", { className: Header },
|
|
25
|
+
onClose && React.createElement(IconButton, { onClick: onClose, className: CloseButton, icon: "xmark", kind: "flat" }),
|
|
26
|
+
React.createElement(Title, { level: "5", id: titleId }, title)),
|
|
27
|
+
children)));
|
|
28
|
+
});
|
|
29
|
+
ModalContent.displayName = 'Modal.Content';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@import '../core/media.css';
|
|
2
|
+
|
|
3
|
+
.Content {
|
|
4
|
+
background-color: var(--global-background);
|
|
5
|
+
color: var(--global-foreground);
|
|
6
|
+
overscroll-behavior: contain;
|
|
7
|
+
inline-size: 100%;
|
|
8
|
+
overflow: auto;
|
|
9
|
+
-webkit-overflow-scrolling: touch;
|
|
10
|
+
max-block-size: 95vh;
|
|
11
|
+
border-radius: env(--radius-16) env(--radius-16) 0 0;
|
|
12
|
+
justify-self: center;
|
|
13
|
+
align-self: end;
|
|
14
|
+
|
|
15
|
+
@media (--from-extra-small) {
|
|
16
|
+
max-inline-size: 600px;
|
|
17
|
+
max-block-size: 80vh;
|
|
18
|
+
border-radius: env(--radius-8);
|
|
19
|
+
justify-self: center;
|
|
20
|
+
align-self: center;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.Header {
|
|
25
|
+
position: sticky;
|
|
26
|
+
top: 0;
|
|
27
|
+
background-color: inherit;
|
|
28
|
+
border-bottom: 1px solid var(--dimmed-1);
|
|
29
|
+
padding:
|
|
30
|
+
env(--space-16)
|
|
31
|
+
env(--space-80)
|
|
32
|
+
env(--space-16)
|
|
33
|
+
env(--space-24);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.CloseButton {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: env(--space-8);
|
|
39
|
+
right: env(--space-8);
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ModalProps } from '../modal';
|
|
3
|
+
declare type ModalContextProps = Pick<ModalProps, 'onClose' | 'visible'> & {
|
|
4
|
+
titleId: string;
|
|
5
|
+
setTitleId?(): void;
|
|
6
|
+
};
|
|
7
|
+
export declare const ModalContext: import("react").Context<ModalContextProps>;
|
|
8
|
+
export declare const useModalContext: () => ModalContextProps;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const ModalContext = createContext({
|
|
3
|
+
titleId: '',
|
|
4
|
+
onClose: () => { }
|
|
5
|
+
});
|
|
6
|
+
ModalContext.displayName = 'ModalContext';
|
|
7
|
+
export const useModalContext = () => {
|
|
8
|
+
const context = useContext(ModalContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error('Modal component must be used inside ModalContext to access context data.');
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
};
|
package/modal/modal.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type ModalProps = PropsWithClass & {
|
|
3
|
+
visible?: boolean | React.Dispatch<React.SetStateAction<boolean>>;
|
|
4
|
+
overlayColor?: 'light' | 'dark' | 'auto';
|
|
5
|
+
closeOnClickOutside?: boolean;
|
|
6
|
+
onClose(): void;
|
|
7
|
+
};
|
|
8
|
+
export declare const Modal: {
|
|
9
|
+
({ visible, ...props }: ModalProps): JSX.Element;
|
|
10
|
+
Presence: React.FunctionComponent<import("framer-motion").AnimatePresenceProps>;
|
|
11
|
+
Root: React.FC<ModalProps>;
|
|
12
|
+
Content: React.ForwardRefExoticComponent<PropsWithClass & {
|
|
13
|
+
title: React.ReactNode;
|
|
14
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
package/modal/modal.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from 'react';
|
|
13
|
+
import { useUIDSeed } from 'react-uid';
|
|
14
|
+
import { LazyMotion, AnimatePresence as Presence, domAnimation, m } from 'framer-motion';
|
|
15
|
+
import clsx from 'clsx';
|
|
16
|
+
import { FocusOn } from 'react-focus-on';
|
|
17
|
+
import { ModalContent } from './modal-content';
|
|
18
|
+
import { Modal as ModalClass, Backdrop, Container } from './modal.module.css';
|
|
19
|
+
import { ModalContext } from './modal-context';
|
|
20
|
+
const ModalElement = forwardRef((_a, forwardedRef) => {
|
|
21
|
+
var { children, className, overlayColor = 'dark', closeOnClickOutside = true, onClose, visible } = _a, props = __rest(_a, ["children", "className", "overlayColor", "closeOnClickOutside", "onClose", "visible"]);
|
|
22
|
+
const seedID = useUIDSeed();
|
|
23
|
+
return (React.createElement(ModalContext.Provider, { value: {
|
|
24
|
+
onClose,
|
|
25
|
+
visible,
|
|
26
|
+
titleId: seedID('modal-title')
|
|
27
|
+
} },
|
|
28
|
+
React.createElement(ModalContext.Consumer, null, (ctx) => (React.createElement(LazyMotion, { features: domAnimation },
|
|
29
|
+
React.createElement("div", Object.assign({ role: "dialog", "aria-modal": "true", "aria-labelledby": ctx.titleId, className: clsx(ModalClass, className), ref: forwardedRef }, props),
|
|
30
|
+
React.createElement(m.span, { key: seedID('modal-backdrop'), className: Backdrop, "data-overlay-color": overlayColor, initial: { opacity: 0 }, animate: { opacity: 0.95 }, exit: { opacity: 0 }, transition: { duration: 0.2 } }),
|
|
31
|
+
React.createElement(FocusOn, { onClickOutside: () => closeOnClickOutside && ctx.onClose(), onEscapeKey: ctx.onClose },
|
|
32
|
+
React.createElement(m.div, { key: seedID('modal-container'), className: Container, "data-theme": "light", initial: { scale: 0.98, opacity: 0 }, animate: { scale: 1, opacity: 1 }, exit: { scale: 0.98, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 } }, children))))))));
|
|
33
|
+
});
|
|
34
|
+
export const Modal = (_a) => {
|
|
35
|
+
var { visible } = _a, props = __rest(_a, ["visible"]);
|
|
36
|
+
if (typeof visible === 'boolean') {
|
|
37
|
+
return (React.createElement(Presence, { exitBeforeEnter: true }, visible ? React.createElement(ModalElement, Object.assign({}, props)) : null));
|
|
38
|
+
}
|
|
39
|
+
return (React.createElement(ModalElement, Object.assign({}, props)));
|
|
40
|
+
};
|
|
41
|
+
Modal.Presence = Presence;
|
|
42
|
+
Modal.Root = ModalElement;
|
|
43
|
+
Modal.Content = ModalContent;
|
|
44
|
+
Modal.displayName = 'Modal';
|
|
45
|
+
ModalElement.displayName = 'Modal.Element';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import '../core/media.css';
|
|
2
|
+
|
|
3
|
+
.Modal {
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
z-index: 20;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.Backdrop {
|
|
13
|
+
display: block;
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
z-index: 1;
|
|
20
|
+
background-color: var(--dimmed-1);
|
|
21
|
+
|
|
22
|
+
&[data-overlay-color='light'] {
|
|
23
|
+
background-color: hsl(env(--color-primary-0));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&[data-overlay-color='dark'] {
|
|
27
|
+
background-color: hsl(env(--color-primary-90));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.Container {
|
|
32
|
+
position: absolute;
|
|
33
|
+
display: grid;
|
|
34
|
+
inset: 0;
|
|
35
|
+
z-index: 1;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
|
|
40
|
+
@media (--from-extra-small) {
|
|
41
|
+
overflow: auto;
|
|
42
|
+
padding: 24px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
& > * {
|
|
46
|
+
pointer-events: auto;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
3
|
"description": "UI components from Wonderflow's Wanda design system",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.20.0",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "index.js",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"postcss": "8.3.8",
|
|
67
67
|
"react": ">=17.0.2",
|
|
68
68
|
"react-dom": ">=17.0.2",
|
|
69
|
+
"react-focus-on": "3.5.2",
|
|
69
70
|
"react-popper-tooltip": "4.3.0",
|
|
70
71
|
"react-roving-tabindex": "3.1.1",
|
|
71
72
|
"react-uid": "2.3.1",
|
package/select/select.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare type SelectProps = SelectHTMLAttributes<HTMLSelectElement> & {
|
|
|
7
7
|
kind?: 'single' | 'multiple';
|
|
8
8
|
dimension?: 'regular' | 'small' | 'big';
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
onChange
|
|
10
|
+
onChange?(event: ChangeEvent<HTMLSelectElement>): void;
|
|
11
11
|
};
|
|
12
12
|
export declare const Select: React.ForwardRefExoticComponent<React.SelectHTMLAttributes<HTMLSelectElement> & {
|
|
13
13
|
children: ReactNode;
|
|
@@ -16,5 +16,5 @@ export declare const Select: React.ForwardRefExoticComponent<React.SelectHTMLAtt
|
|
|
16
16
|
kind?: "multiple" | "single" | undefined;
|
|
17
17
|
dimension?: "big" | "small" | "regular" | undefined;
|
|
18
18
|
disabled?: boolean | undefined;
|
|
19
|
-
onChange
|
|
19
|
+
onChange?(event: ChangeEvent<HTMLSelectElement>): void;
|
|
20
20
|
} & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -2,10 +2,10 @@ import React, { ChangeEvent, InputHTMLAttributes } from 'react';
|
|
|
2
2
|
export declare type CheckboxProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
dimension?: 'regular' | 'small';
|
|
5
|
-
onChange
|
|
5
|
+
onChange?(event: ChangeEvent<HTMLInputElement>): void;
|
|
6
6
|
};
|
|
7
7
|
export declare const Checkbox: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
dimension?: "small" | "regular" | undefined;
|
|
10
|
-
onChange
|
|
10
|
+
onChange?(event: ChangeEvent<HTMLInputElement>): void;
|
|
11
11
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -2,10 +2,10 @@ import React, { ChangeEvent, InputHTMLAttributes } from 'react';
|
|
|
2
2
|
export declare type RadioProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
dimension?: 'regular' | 'small';
|
|
5
|
-
onChange
|
|
5
|
+
onChange?(event: ChangeEvent<HTMLInputElement>): void;
|
|
6
6
|
};
|
|
7
7
|
export declare const Radio: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
dimension?: "small" | "regular" | undefined;
|
|
10
|
-
onChange
|
|
10
|
+
onChange?(event: ChangeEvent<HTMLInputElement>): void;
|
|
11
11
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -2,10 +2,10 @@ import React, { ChangeEvent, InputHTMLAttributes } from 'react';
|
|
|
2
2
|
export declare type ToggleProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
dimension?: 'regular' | 'small';
|
|
5
|
-
onChange
|
|
5
|
+
onChange?(event: ChangeEvent<HTMLInputElement>): void;
|
|
6
6
|
};
|
|
7
7
|
export declare const Toggle: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
dimension?: "small" | "regular" | undefined;
|
|
10
|
-
onChange
|
|
10
|
+
onChange?(event: ChangeEvent<HTMLInputElement>): void;
|
|
11
11
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
.Snackbar {
|
|
2
2
|
padding: env(--space-16) env(--space-24);
|
|
3
|
-
background
|
|
3
|
+
background: linear-gradient(to right, var(--snackbar-fg) 4px, var(--snackbar-bg) 4px);
|
|
4
4
|
color: var(--snackbar-fg);
|
|
5
5
|
border-radius: env(--radius-4);
|
|
6
6
|
overflow: hidden;
|
|
7
|
-
box-shadow: inset 4px 0 0 var(--snackbar-fg);
|
|
8
7
|
|
|
9
8
|
& p {
|
|
10
9
|
font-size: env(--font-size-16);
|
package/tab/tab.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import
|
|
1
|
+
import React, { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { IconNames } from 'src/icons/types';
|
|
3
3
|
export declare type TabProps = PropsWithClass & {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
state?: [number, React.Dispatch<React.SetStateAction<number>>];
|
|
6
|
-
onChange
|
|
6
|
+
onChange?(index: number): void;
|
|
7
7
|
};
|
|
8
8
|
export declare type TabPanelProps = PropsWithClass & {
|
|
9
9
|
label: ReactNode;
|
|
10
|
+
icon?: IconNames;
|
|
11
|
+
};
|
|
12
|
+
export declare type TabItemProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
13
|
+
icon?: IconNames;
|
|
10
14
|
};
|
|
11
|
-
declare type PolymorphicTabItem = Polymorphic.ForwardRefComponent<'button', {}>;
|
|
12
15
|
export declare const Tab: {
|
|
13
16
|
Root: React.FC<TabProps>;
|
|
14
17
|
List: React.FC<PropsWithClass>;
|
|
15
|
-
Item:
|
|
18
|
+
Item: React.FC<TabItemProps>;
|
|
16
19
|
Panel: React.FC<TabPanelProps>;
|
|
17
20
|
};
|
|
18
|
-
export {};
|
package/tab/tab.js
CHANGED
|
@@ -14,6 +14,8 @@ import { Tabs as TabsWrapper, useTabState, usePanelState } from '@bumaga/tabs';
|
|
|
14
14
|
import { useRovingTabIndex, useFocusEffect, RovingTabIndexProvider } from 'react-roving-tabindex';
|
|
15
15
|
import clsx from 'clsx';
|
|
16
16
|
import { useUIDSeed } from 'react-uid';
|
|
17
|
+
import { Icon } from '../icon';
|
|
18
|
+
import { Stack } from '../stack';
|
|
17
19
|
import { Tab as TabClass, TabList as TabListClass, TabItem as TabItemClass, TabPanel as TabPanelClass } from './tab.module.css';
|
|
18
20
|
const TabRoot = forwardRef((_a, forwardedRef) => {
|
|
19
21
|
var { children, className, state, onChange } = _a, props = __rest(_a, ["children", "className", "state", "onChange"]);
|
|
@@ -28,7 +30,7 @@ const TabRoot = forwardRef((_a, forwardedRef) => {
|
|
|
28
30
|
}, [currentTab, onChange]);
|
|
29
31
|
return (React.createElement("div", Object.assign({ ref: forwardedRef, className: clsx(TabClass, className) }, props),
|
|
30
32
|
React.createElement(TabsWrapper, { state: tabState },
|
|
31
|
-
React.createElement(TabList, null, Children.map(children, (child, index) => (React.createElement(Tab.Item, { id: seedID(`tab-item-${index}`), "aria-controls": seedID(`tab-panel-${index}`) }, child.props.label)))),
|
|
33
|
+
React.createElement(TabList, null, Children.map(children, (child, index) => (React.createElement(Tab.Item, { id: seedID(`tab-item-${index}`), "aria-controls": seedID(`tab-panel-${index}`), icon: child.props.icon }, child.props.label)))),
|
|
32
34
|
Children.map(children, (child, index) => cloneElement(child, {
|
|
33
35
|
id: seedID(`tab-panel-${index}`),
|
|
34
36
|
'aria-labelledby': seedID(`tab-item-${index}`)
|
|
@@ -46,8 +48,8 @@ const TabPanel = forwardRef((_a, forwardedRef) => {
|
|
|
46
48
|
? (React.createElement("div", Object.assign({ ref: forwardedRef, tabIndex: 0, className: clsx(TabPanelClass, className) }, props), children))
|
|
47
49
|
: null;
|
|
48
50
|
});
|
|
49
|
-
const TabItem =
|
|
50
|
-
var { children, className,
|
|
51
|
+
const TabItem = (_a) => {
|
|
52
|
+
var { children, className, icon } = _a, props = __rest(_a, ["children", "className", "icon"]);
|
|
51
53
|
const { onClick, isActive } = useTabState();
|
|
52
54
|
const internalRef = useRef(null);
|
|
53
55
|
const [, focused, handleKeyDown, handleClick] = useRovingTabIndex(internalRef, false);
|
|
@@ -56,8 +58,10 @@ const TabItem = forwardRef((_a, forwardedRef) => {
|
|
|
56
58
|
onClick();
|
|
57
59
|
handleClick();
|
|
58
60
|
}, [handleClick, onClick]);
|
|
59
|
-
return (React.createElement(
|
|
60
|
-
})
|
|
61
|
+
return (React.createElement(Stack, Object.assign({ as: "button", direction: "row", verticalAlign: "center", horizontalAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(TabItemClass, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1 }, props),
|
|
62
|
+
icon && React.createElement(Icon, { name: icon, dimension: 16 }),
|
|
63
|
+
children));
|
|
64
|
+
};
|
|
61
65
|
export const Tab = {
|
|
62
66
|
Root: TabRoot,
|
|
63
67
|
List: TabList,
|
package/tab/tab.module.css
CHANGED
package/themes/dark.css
CHANGED
package/themes/light.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on
|
|
3
|
+
* Generated on Thu, 30 Sep 2021 11:25:09 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--highlight-gray-background: hsl(220 19% 91%);
|
|
28
28
|
--highlight-gray-foreground: hsl(221 10% 39%);
|
|
29
29
|
--highlight-yellow-background: hsl(60 100% 89%);
|
|
30
|
-
--highlight-yellow-foreground: hsl(
|
|
30
|
+
--highlight-yellow-foreground: hsl(25 100% 34%);
|
|
31
31
|
--highlight-green-background: hsl(149 100% 91%);
|
|
32
32
|
--highlight-green-foreground: hsl(156 100% 23%);
|
|
33
33
|
--highlight-blue-background: hsl(180 100% 95%);
|
package/themes/light.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"highlight-gray-background": "hsl(220 19% 91%)",
|
|
23
23
|
"highlight-gray-foreground": "hsl(221 10% 39%)",
|
|
24
24
|
"highlight-yellow-background": "hsl(60 100% 89%)",
|
|
25
|
-
"highlight-yellow-foreground": "hsl(
|
|
25
|
+
"highlight-yellow-foreground": "hsl(25 100% 34%)",
|
|
26
26
|
"highlight-green-background": "hsl(149 100% 91%)",
|
|
27
27
|
"highlight-green-foreground": "hsl(156 100% 23%)",
|
|
28
28
|
"highlight-blue-background": "hsl(180 100% 95%)",
|
package/themes.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
color: var(--global-foreground);
|
|
5
5
|
/**
|
|
6
6
|
* Do not edit directly
|
|
7
|
-
* Generated on
|
|
7
|
+
* Generated on Thu, 30 Sep 2021 11:25:09 GMT
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
--highlight-gray-background: hsl(220 19% 91%);
|
|
32
32
|
--highlight-gray-foreground: hsl(221 10% 39%);
|
|
33
33
|
--highlight-yellow-background: hsl(60 100% 89%);
|
|
34
|
-
--highlight-yellow-foreground: hsl(
|
|
34
|
+
--highlight-yellow-foreground: hsl(25 100% 34%);
|
|
35
35
|
--highlight-green-background: hsl(149 100% 91%);
|
|
36
36
|
--highlight-green-foreground: hsl(156 100% 23%);
|
|
37
37
|
--highlight-blue-background: hsl(180 100% 95%);
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
color: var(--global-foreground);
|
|
52
52
|
/**
|
|
53
53
|
* Do not edit directly
|
|
54
|
-
* Generated on
|
|
54
|
+
* Generated on Thu, 30 Sep 2021 11:25:09 GMT
|
|
55
55
|
*/
|
|
56
56
|
|
|
57
57
|
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
color: var(--global-foreground);
|
|
100
100
|
/**
|
|
101
101
|
* Do not edit directly
|
|
102
|
-
* Generated on
|
|
102
|
+
* Generated on Thu, 30 Sep 2021 11:25:09 GMT
|
|
103
103
|
*/
|
|
104
104
|
|
|
105
105
|
|