@wonderflow/react-components 11.0.6 → 12.0.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/core/basic.css +1 -1
- package/core/typography.css +1 -1
- package/core.css +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +1 -1
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +3 -1
- package/dist/components/avatar/avatar.stories.js +1 -1
- package/dist/components/avatar/avatar.test.js +6 -2
- package/dist/components/button/button.module.css +1 -1
- package/dist/components/card/card.stories.d.ts.map +1 -1
- package/dist/components/card/card.stories.js +3 -8
- package/dist/components/chip/chip.js +1 -1
- package/dist/components/chip/chip.module.css +1 -1
- package/dist/components/circular-progress/circular-progress.module.css +1 -1
- package/dist/components/container/container.stories.js +1 -1
- package/dist/components/disclosure/disclosure.js +6 -6
- package/dist/components/disclosure/disclosure.module.css +1 -1
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/drawer.js +2 -2
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -2
- package/dist/components/info-state/info-state.js +2 -2
- package/dist/components/input-group/input-group.js +1 -1
- package/dist/components/linear-progress/linear-progress.d.ts.map +1 -1
- package/dist/components/linear-progress/linear-progress.js +1 -1
- package/dist/components/list/list-item.js +6 -6
- package/dist/components/list/list.module.css +1 -1
- package/dist/components/menu/menu-item/menu-item.d.ts.map +1 -1
- package/dist/components/menu/menu-item/menu-item.js +2 -2
- package/dist/components/menu/menu-item/menu-item.module.css +1 -1
- package/dist/components/menu/menu-item/menu-item.stories.js +1 -1
- package/dist/components/menu/menu.stories.js +2 -2
- package/dist/components/modal/modal.d.ts +1 -2
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.js +3 -3
- package/dist/components/modal/modal.stories.d.ts.map +1 -1
- package/dist/components/modal/modal.stories.js +6 -6
- package/dist/components/pagination/pagination.module.css +1 -1
- package/dist/components/popover/popover.stories.d.ts +4 -0
- package/dist/components/popover/popover.stories.d.ts.map +1 -1
- package/dist/components/popover/popover.stories.js +16 -0
- package/dist/components/select/select.d.ts +8 -0
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +2 -2
- package/dist/components/select/select.module.css +1 -1
- package/dist/components/select/select.stories.d.ts +5 -2
- package/dist/components/select/select.stories.d.ts.map +1 -1
- package/dist/components/select/select.stories.js +7 -4
- package/dist/components/select/select.test.js +1 -1
- package/dist/components/selection-controls/checkbox.d.ts.map +1 -1
- package/dist/components/selection-controls/checkbox.js +9 -1
- package/dist/components/selection-controls/checkbox.stories.d.ts +7 -0
- package/dist/components/selection-controls/checkbox.stories.d.ts.map +1 -1
- package/dist/components/selection-controls/checkbox.stories.js +8 -0
- package/dist/components/selection-controls/radio.d.ts.map +1 -1
- package/dist/components/selection-controls/radio.js +10 -2
- package/dist/components/selection-controls/radio.stories.d.ts +6 -0
- package/dist/components/selection-controls/radio.stories.d.ts.map +1 -1
- package/dist/components/selection-controls/radio.stories.js +8 -0
- package/dist/components/selection-controls/selection-controls.module.css +1 -1
- package/dist/components/selection-controls/toggle.d.ts.map +1 -1
- package/dist/components/selection-controls/toggle.js +10 -2
- package/dist/components/selection-controls/toggle.stories.d.ts +7 -0
- package/dist/components/selection-controls/toggle.stories.d.ts.map +1 -1
- package/dist/components/selection-controls/toggle.stories.js +8 -0
- package/dist/components/skeleton/skeleton.module.css +1 -1
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/snackbar/snackbar.d.ts.map +1 -1
- package/dist/components/snackbar/snackbar.js +9 -2
- package/dist/components/snackbar/snackbar.module.css +1 -1
- package/dist/components/star-meter/star-meter.js +5 -5
- package/dist/components/symbol/symbol.js +1 -1
- package/dist/components/tab/tab.module.css +1 -1
- package/dist/components/tab/tab.stories.d.ts.map +1 -1
- package/dist/components/tab/tab.stories.js +6 -0
- package/dist/components/table/table-cell/table-cell.module.css +1 -1
- package/dist/components/table/table-header/table-header.d.ts +2 -2
- package/dist/components/table/table-header/table-header.d.ts.map +1 -1
- package/dist/components/table/table-header/table-header.js +2 -2
- package/dist/components/table/table-pagination/table-pagination.js +2 -2
- package/dist/components/table/table-row/table-row.js +1 -1
- package/dist/components/table/table.js +1 -1
- package/dist/components/table/table.stories.js +2 -2
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.d.ts.map +1 -1
- package/dist/components/text/text.d.ts +42 -22
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/text/text.js +86 -5
- package/dist/components/text/text.module.css +1 -1
- package/dist/components/text/text.stories.d.ts +6 -1
- package/dist/components/text/text.stories.d.ts.map +1 -1
- package/dist/components/text/text.stories.js +63 -18
- package/dist/components/text/text.test.js +85 -0
- package/dist/components/textfield/base-field/base-field.module.css +1 -1
- package/dist/components/textfield/textfield.js +2 -2
- package/dist/components/textfield/textfield.module.css +1 -1
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.module.css +1 -1
- package/dist/examples/shell.module.css +1 -1
- package/dist/examples/shell.stories.d.ts.map +1 -1
- package/dist/examples/shell.stories.js +7 -7
- package/dist/hooks/useBreakpoints.d.ts.map +1 -1
- package/dist/hooks/useBreakpoints.js +7 -5
- package/dist/providers/responsive.d.ts.map +1 -1
- package/dist/providers/responsive.js +7 -5
- package/dist/utils/conversions.d.ts +2 -0
- package/dist/utils/conversions.d.ts.map +1 -0
- package/dist/{components/title/index.js → utils/conversions.js} +10 -2
- package/dist/utils/convertions.test.d.ts +2 -0
- package/dist/utils/convertions.test.d.ts.map +1 -0
- package/dist/utils/convertions.test.js +13 -0
- package/dist/utils/themes.d.ts +3 -0
- package/dist/utils/themes.d.ts.map +1 -0
- package/dist/{components/prose/prose.js → utils/themes.js} +12 -6
- package/dist/utils/themes.test.d.ts +2 -0
- package/dist/utils/themes.test.d.ts.map +1 -0
- package/dist/utils/themes.test.js +26 -0
- package/package.json +3 -3
- package/dist/components/prose/index.d.ts +0 -3
- package/dist/components/prose/index.d.ts.map +0 -1
- package/dist/components/prose/index.js +0 -16
- package/dist/components/prose/prose.d.ts +0 -6
- package/dist/components/prose/prose.d.ts.map +0 -1
- package/dist/components/prose/prose.module.css +0 -1
- package/dist/components/prose/prose.stories.d.ts +0 -7
- package/dist/components/prose/prose.stories.d.ts.map +0 -1
- package/dist/components/prose/prose.stories.js +0 -12
- package/dist/components/prose/prose.test.d.ts +0 -2
- package/dist/components/prose/prose.test.d.ts.map +0 -1
- package/dist/components/prose/prose.test.js +0 -11
- package/dist/components/title/index.d.ts +0 -3
- package/dist/components/title/index.d.ts.map +0 -1
- package/dist/components/title/title.d.ts +0 -40
- package/dist/components/title/title.d.ts.map +0 -1
- package/dist/components/title/title.js +0 -41
- package/dist/components/title/title.module.css +0 -1
- package/dist/components/title/title.stories.d.ts +0 -8
- package/dist/components/title/title.stories.d.ts.map +0 -1
- package/dist/components/title/title.stories.js +0 -47
- package/dist/components/title/title.test.d.ts +0 -2
- package/dist/components/title/title.test.d.ts.map +0 -1
- package/dist/components/title/title.test.js +0 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
@@ -23,15 +23,15 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
23
23
|
const seedID = useUIDSeed();
|
|
24
24
|
const properties = useMemo(() => ({
|
|
25
25
|
small: {
|
|
26
|
-
labelSize:
|
|
26
|
+
labelSize: 'body-3',
|
|
27
27
|
iconSize: 12,
|
|
28
28
|
},
|
|
29
29
|
regular: {
|
|
30
|
-
labelSize:
|
|
30
|
+
labelSize: 'body-2',
|
|
31
31
|
iconSize: 16,
|
|
32
32
|
},
|
|
33
33
|
big: {
|
|
34
|
-
labelSize:
|
|
34
|
+
labelSize: 'body-1',
|
|
35
35
|
iconSize: 24,
|
|
36
36
|
},
|
|
37
37
|
}), []);
|
|
@@ -61,5 +61,5 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
61
61
|
return (_jsx(Symbol, { source: "star", weight: "solid", className: styles.Icon, dimension: properties[dimension].iconSize, fill: fillType }, starIndex));
|
|
62
62
|
});
|
|
63
63
|
}, [dimension, properties, roundValue]);
|
|
64
|
-
return (_jsxs(Stack, { inline: true, direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.StarMeter, className), role: "meter", fill: false, "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": seedID('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...otherProps, children: [_jsx("svg", { "aria-hidden": "true", className: styles.Gradient, width: "100", height: "50", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: _jsx("defs", { children: _jsxs("linearGradient", { id: "HalfStar", children: [_jsx("stop", { offset: "0", style: { stopColor: 'var(--star-color)' } }), _jsx("stop", { offset: "50%", style: { stopColor: 'var(--star-color)' } }), _jsx("stop", { offset: "50.1%", style: { stopColor: 'var(--star-dimmed-color)' } }), _jsx("stop", { offset: "100%", style: { stopColor: 'var(--star-dimmed-color)' } })] }) }) }), _jsx(Stack, { direction: "row", columnGap: dimension === 'small' ? 2 : 4, children: starType(starCount, value) }), _jsx(Text, {
|
|
64
|
+
return (_jsxs(Stack, { inline: true, direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.StarMeter, className), role: "meter", fill: false, "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": seedID('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...otherProps, children: [_jsx("svg", { "aria-hidden": "true", className: styles.Gradient, width: "100", height: "50", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: _jsx("defs", { children: _jsxs("linearGradient", { id: "HalfStar", children: [_jsx("stop", { offset: "0", style: { stopColor: 'var(--star-color)' } }), _jsx("stop", { offset: "50%", style: { stopColor: 'var(--star-color)' } }), _jsx("stop", { offset: "50.1%", style: { stopColor: 'var(--star-dimmed-color)' } }), _jsx("stop", { offset: "100%", style: { stopColor: 'var(--star-dimmed-color)' } })] }) }) }), _jsx(Stack, { direction: "row", columnGap: dimension === 'small' ? 2 : 4, vAlign: "center", children: starType(starCount, value) }), _jsx(Text, { preventResponsive: true, id: seedID('star-meter'), variant: properties[dimension].labelSize, children: _jsx("b", { children: (!hideLabel && label) ?? value.toString() }) })] }));
|
|
65
65
|
});
|
|
@@ -5,7 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { Children, cloneElement, forwardRef, useMemo, } from 'react';
|
|
6
6
|
import * as styles from './symbol.module.css';
|
|
7
7
|
export const Symbol = forwardRef(({ className, source, dimension = 16, weight = 'outline', fill, ...otherProps }, forwardedRef) => {
|
|
8
|
-
const computedStyle = useMemo(() => (dimension < 18 ? 'solid' : weight), [weight, dimension]);
|
|
8
|
+
const computedStyle = useMemo(() => (+dimension < 18 ? 'solid' : weight), [weight, dimension]);
|
|
9
9
|
return (typeof source === 'string')
|
|
10
10
|
? (_jsx("svg", { "aria-hidden": "true", width: dimension, height: dimension, fill: fill, className: clsx(styles.Icon, className), ref: forwardedRef, ...otherProps, children: _jsx("use", { href: `${sprite}#${computedStyle}/${source}` }) }))
|
|
11
11
|
: (_jsx(_Fragment, { children: Children.map(source, (child) => cloneElement(child, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.List{--separator-size:2px;box-shadow:inset 0 calc(var(--separator-size)*-1) 0 var(--dimmed-1);overflow:auto;white-space:nowrap}.Highlight{background:var(--cta-default);border-radius:2px 2px 0 0;bottom:0;height:4px;pointer-events:none;position:absolute;width:100%}.Panel{animation:fade-in .2s;animation-timing-function:cubic-bezier(0,0,.34,1))}}@layer overrides{.Trigger{appearance:none;-webkit-backdrop-filter:none;backdrop-filter:none;background:none;background-color:transparent;block-size:3rem;border:0;border-radius:0;color:var(--dimmed-6);flex-shrink:0;font-family:inherit;font-weight:400;outline-offset:calc(var(--separator-size)*-1);overflow:unset;padding:.5rem 1rem;position:relative;white-space:nowrap}.Trigger[data-tab-dimension=big]{font-size:
|
|
1
|
+
@layer components{.List{--separator-size:2px;box-shadow:inset 0 calc(var(--separator-size)*-1) 0 var(--dimmed-1);overflow:auto;white-space:nowrap}.Highlight{background:var(--cta-default);border-radius:2px 2px 0 0;bottom:0;height:4px;pointer-events:none;position:absolute;width:100%}.Panel{animation:fade-in .2s;animation-timing-function:cubic-bezier(0,0,.34,1))}}@layer overrides{.Trigger{appearance:none;-webkit-backdrop-filter:none;backdrop-filter:none;background:none;background-color:transparent;block-size:3rem;border:0;border-radius:0;color:var(--dimmed-6);flex-shrink:0;font-family:inherit;font-size:.875rem;font-weight:400;outline-offset:calc(var(--separator-size)*-1);overflow:unset;padding:.5rem 1rem;position:relative;white-space:nowrap}.Trigger[data-tab-dimension=big]{font-size:1rem;height:calc(3.5rem - var(--separator-size))}.Trigger:active{transform:none}.Trigger:not([aria-disabled=true]){-webkit-backdrop-filter:none;backdrop-filter:none;color:var(--dimmed-5)}.Trigger.Trigger:not([aria-disabled=true]):is(:hover,:focus,:active){-webkit-backdrop-filter:none;backdrop-filter:none;background:none;color:var(--global-foreground)}.Trigger.Trigger[aria-disabled=true]{-webkit-backdrop-filter:none;backdrop-filter:none;background:none;color:var(--global-disabled-foreground)}.Trigger[data-state=active]{-webkit-text-stroke:.4px var(--global-foreground);color:var(--global-foreground)}}@keyframes fade-in{0%{opacity:0;transform:translate(var(--fade-from-x,0),var(--fade-from-y,0))}to{opacity:unset;transform:none}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"tab.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,GAAG,CAapC,CAAC;AACF,eAAe,KAAK,CAAC;AAarB,eAAO,MAAM,OAAO;;;EAAoB,CAAC;AAEzC,eAAO,MAAM,UAAU;;;EAAoB,CAAC;AAK5C,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,OAAO,GAAG,CAqBtD,CAAC;AAEF,eAAO,MAAM,WAAW;;;EAAoB,CAAC;AAM7C,eAAO,MAAM,cAAc,mBAc1B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,OAAO,GAAG,CASlD,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAAc,CAAC,OAAO,GAAG,CAShD,CAAC"}
|
|
@@ -9,6 +9,12 @@ const story = {
|
|
|
9
9
|
defaultValue: '1',
|
|
10
10
|
dimension: 'regular',
|
|
11
11
|
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
dimension: {
|
|
14
|
+
options: ['regular', 'big'],
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
12
18
|
};
|
|
13
19
|
export default story;
|
|
14
20
|
const Template = args => (_jsxs(Tab, { ...args, children: [_jsx(Tab.Panel, { value: "1", label: "Tab 1", children: "Panel 1" }), _jsx(Tab.Panel, { value: "2", label: "Tab mid long 2", children: "Panel 2" }), _jsx(Tab.Panel, { value: "3", label: "Tab short 3", children: "Panel 3" }), _jsx(Tab.Panel, { value: "4", label: "Tab veryy long 4", children: "Panel 4" }), _jsx(Tab.Panel, { value: "5", label: "Tab 5", children: "Panel 5" }), _jsx(Tab.Panel, { value: "6", label: "Tab 6", children: "Panel 6" })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.TableCell{--indent-guide-width:24px;font-feature-settings:"tnum";word-wrap:break-word;font-variant-numeric:tabular-nums;line-height:1.
|
|
1
|
+
@layer components{.TableCell{--indent-guide-width:24px;font-feature-settings:"tnum";word-wrap:break-word;font-variant-numeric:tabular-nums;line-height:1.25rem;margin:0;max-width:var(--width);padding:0;position:relative;text-align:start}.TableCell:not(:only-child){text-align:var(--text-align,start)}.TableCell[data-table-cell-fixed=true]{width:var(--width,1%)}.TableCell[data-table-cell-collapsed=true]{width:1e-10%}.TableCell[data-table-cell-padding=true]{padding:.75rem .5rem}.HeadCellIcon{margin-inline-start:.5rem}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
-
import { Polymorphic,
|
|
2
|
+
import { Polymorphic, Text } from '../../..';
|
|
3
3
|
export declare type TableHeaderProps = HTMLAttributes<HTMLElement> & {
|
|
4
|
-
title?: string | Polymorphic.IntrinsicElement<typeof
|
|
4
|
+
title?: string | Polymorphic.IntrinsicElement<typeof Text>;
|
|
5
5
|
};
|
|
6
6
|
export declare const TableHeader: FCChildren<TableHeaderProps>;
|
|
7
7
|
//# sourceMappingURL=table-header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-header.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-header/table-header.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAS,
|
|
1
|
+
{"version":3,"file":"table-header.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-header/table-header.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAS,IAAI,EAAE,MAAM,cAAc,CAAC;AAIxD,oBAAY,gBAAgB,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IAC3D,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,gBAAgB,CAAC,OAAO,IAAI,CAAC,CAAC;CAC5D,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,UAAU,CAAC,gBAAgB,CAuBpD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Stack,
|
|
2
|
+
import { Stack, Text } from '../../..';
|
|
3
3
|
import * as styles from './table-header.module.css';
|
|
4
|
-
export const TableHeader = ({ children, title, id, ...otherProps }) => (_jsxs(Stack, { direction: "row", columnGap: 32, vAlign: "center", hAlign: "space-between", fill: false, className: styles.TableHeader, ...otherProps, children: [_jsx("div", { children: typeof title === 'string' ? _jsx(
|
|
4
|
+
export const TableHeader = ({ children, title, id, ...otherProps }) => (_jsxs(Stack, { direction: "row", columnGap: 32, vAlign: "center", hAlign: "space-between", fill: false, className: styles.TableHeader, ...otherProps, children: [_jsx("div", { children: typeof title === 'string' ? _jsx(Text, { id: id, variant: "heading-6", color: "dark", children: title }) : title }), _jsx(Stack, { direction: "row", vAlign: "center", columnGap: 8, inline: true, children: children })] }));
|
|
@@ -22,7 +22,7 @@ export const TablePagination = ({ children, pageSize, onPageSizeChange, clusters
|
|
|
22
22
|
const computedPageCount = useMemo(() => (isManual ? Math.ceil(totalItems / pageSize) : totalPages), [isManual, pageSize, totalItems, totalPages]);
|
|
23
23
|
const computedItemsInPageStart = useMemo(() => (currentPage && pageSize) && currentPage * pageSize, [currentPage, pageSize]);
|
|
24
24
|
const computedItemsInPageEnd = useMemo(() => currentPage * pageSize + pageSize, [currentPage, pageSize]);
|
|
25
|
-
return (_jsxs(Stack, { fill: false, direction: "row", columnGap: 16, vAlign: "center", hAlign: "end", vPadding: 16, ...otherProps, children: [_jsxs(Stack, { direction: "row", columnGap: 4, children: [_jsx(Text, { as: "label", htmlFor: uid('table-i-per-page'),
|
|
25
|
+
return (_jsxs(Stack, { fill: false, direction: "row", columnGap: 16, vAlign: "center", hAlign: "end", vPadding: 16, ...otherProps, children: [_jsxs(Stack, { direction: "row", columnGap: 4, children: [_jsx(Text, { as: "label", htmlFor: uid('table-i-per-page'), variant: "body-2", children: "Items per page:" }), _jsx(Select, { value: pageSize, dimension: "small", id: uid('table-i-per-page'), onChange: ({ currentTarget }) => {
|
|
26
26
|
onPageSizeChange?.(Number(currentTarget.value));
|
|
27
|
-
}, children: clusters.map(cluster => (_jsx("option", { value: cluster, children: cluster }, cluster))) })] }), _jsx(Text, { "aria-hidden": "true",
|
|
27
|
+
}, children: clusters.map(cluster => (_jsx("option", { value: cluster, children: cluster }, cluster))) })] }), _jsx(Text, { "aria-hidden": "true", variant: "body-2", children: _jsx("b", { children: `${computedItemsInPageStart + 1}-${computedItemsInPageEnd > totalItems ? totalItems : computedItemsInPageEnd} of ${totalItems}` }) }), _jsx(Pagination, { itemsCount: totalItems, itemsPerPage: pageSize, pageCount: computedPageCount, onPageClick: ({ selected }) => onPageClick?.(selected), renderOnZeroPageCount: () => null, forcePage: currentPage })] }));
|
|
28
28
|
};
|
|
@@ -20,7 +20,7 @@ import * as styles from './table-row.module.css';
|
|
|
20
20
|
export const TableRow = ({ children, className, expanded, rowData, expandedRows, ...otherProps }) => {
|
|
21
21
|
const shouldHighlightRow = useMemo(() => {
|
|
22
22
|
const [currentParentRowId] = rowData?.id.match(/.*(?=\.)/) ?? [];
|
|
23
|
-
const isHighlight = expandedRows?.includes(currentParentRowId) && expandedRows.every((rowId) => {
|
|
23
|
+
const isHighlight = expandedRows?.includes(currentParentRowId ?? '') && expandedRows.every((rowId) => {
|
|
24
24
|
const [parentRowMatch] = rowId.match(/.*(?=\.)/) ?? [];
|
|
25
25
|
return parentRowMatch !== currentParentRowId;
|
|
26
26
|
});
|
|
@@ -140,7 +140,7 @@ export const Table = ({ className, style, columns, data = [], selectableRows, se
|
|
|
140
140
|
stiffness: 700,
|
|
141
141
|
damping: 30,
|
|
142
142
|
},
|
|
143
|
-
}, exit: { y: '-16px', opacity: 0 }, children: [_jsx(Text, { as: "span",
|
|
143
|
+
}, exit: { y: '-16px', opacity: 0 }, children: [_jsx(Text, { as: "span", variant: "body-1", children: _jsx("b", { children: selectedLabel(Object.keys(selectedRowIdsState)) }) }), selectedActions?.(Object.keys(selectedRowIdsState))] })), (showHeader || selectableRows) && (_jsx(m.div, { animate: {
|
|
144
144
|
y: Object.keys(selectedRowIdsState).length ? 20 : 0,
|
|
145
145
|
opacity: Object.keys(selectedRowIdsState).length ? 0 : 1,
|
|
146
146
|
transition: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState, } from 'react';
|
|
3
|
-
import { Button, IconButton, Menu, Popover, Stack,
|
|
3
|
+
import { Button, IconButton, Menu, Popover, Stack, Text, } from '../..';
|
|
4
4
|
import { Table } from './table';
|
|
5
5
|
const firstData = {
|
|
6
6
|
firstName: 'Gianni',
|
|
@@ -938,7 +938,7 @@ const story = {
|
|
|
938
938
|
},
|
|
939
939
|
};
|
|
940
940
|
export default story;
|
|
941
|
-
const CustomExpandableComponent = ({ data }) => (_jsx(Stack, { vPadding: 16, hPadding: 16, rowGap: 32, children: Object.keys(data).map((item, i) => (_jsxs("div", { style: { background: 'var(--dimmed-1)', padding: 24, minHeight: 50 * (i + 1) }, children: [_jsx(
|
|
941
|
+
const CustomExpandableComponent = ({ data }) => (_jsx(Stack, { vPadding: 16, hPadding: 16, rowGap: 32, children: Object.keys(data).map((item, i) => (_jsxs("div", { style: { background: 'var(--dimmed-1)', padding: 24, minHeight: 50 * (i + 1) }, children: [_jsx(Text, { variant: "heading-6", children: typeof data[item] === 'string' ? data[item] : null }), "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Labore, nostrum minima, debitis qui magni voluptatum."] }, item))) }));
|
|
942
942
|
const CustomEmptyComponent = () => (_jsx("div", { title: "No data to show", children: "It seems there is no data to show inside this table. If data should be present,please check if columns are visible by using the table controls." }));
|
|
943
943
|
const Template = ({ dataWithIds, ...args }) => (_jsx(Table, { emptyComponent: _jsx(CustomEmptyComponent, {}), onRowExpandChange: rows => console.log(rows), ...args }));
|
|
944
944
|
export const Simple = Template.bind({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/text/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/text/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1,44 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
import { Polymorphic } from '../..';
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ChipProps, Polymorphic, SymbolProps } from '../..';
|
|
3
|
+
declare type VariantDisplay = 'display-1' | 'display-2' | 'display-3' | 'display-4';
|
|
4
|
+
declare type VariantHeading = 'heading-1' | 'heading-2' | 'heading-3' | 'heading-4' | 'heading-5' | 'heading-6';
|
|
5
|
+
declare type VariantTagline = 'tagline-1' | 'tagline-2' | 'tagline-3';
|
|
6
|
+
declare type VariantSubtitle = 'subtitle-1' | 'subtitle-2';
|
|
7
|
+
declare type VariantBody = 'body-1' | 'body-2' | 'body-3';
|
|
8
|
+
export declare type TextVariants = VariantDisplay | VariantHeading | VariantTagline | VariantSubtitle | VariantBody;
|
|
9
|
+
export declare type TextColors = 'positive' | 'informative' | 'danger' | 'warning' | 'neutral' | 'dark';
|
|
10
|
+
declare type Decorator = React.ReactElement<SymbolProps> | React.ReactElement<ChipProps>;
|
|
3
11
|
export declare type TextProps = {
|
|
4
12
|
/**
|
|
5
|
-
*
|
|
6
|
-
* the typography system values
|
|
13
|
+
* Apply typographic text style.
|
|
7
14
|
*/
|
|
8
|
-
|
|
15
|
+
variant?: TextVariants;
|
|
9
16
|
/**
|
|
10
|
-
* Set the
|
|
17
|
+
* Set the color of the text.
|
|
11
18
|
*/
|
|
12
|
-
|
|
19
|
+
color?: TextColors;
|
|
13
20
|
/**
|
|
14
|
-
* Set the
|
|
15
|
-
*
|
|
21
|
+
* Set the text alignment of the text. This is a logical property
|
|
22
|
+
* based on the direction of the text.
|
|
23
|
+
*/
|
|
24
|
+
textAlign?: 'start' | 'center' | 'end' | 'justify';
|
|
25
|
+
/**
|
|
26
|
+
* Allow text to overflow.
|
|
27
|
+
*/
|
|
28
|
+
preventBreakWord?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Disable the responsiveness of the text. If disabled,
|
|
31
|
+
* the text will be always the same size across all breakpoints.
|
|
16
32
|
*/
|
|
17
|
-
|
|
33
|
+
preventResponsive?: boolean;
|
|
18
34
|
/**
|
|
19
|
-
*
|
|
20
|
-
* consistent with the typography system.
|
|
35
|
+
* Truncate text overflow with ellipsis.
|
|
21
36
|
*/
|
|
22
|
-
|
|
37
|
+
truncate?: boolean;
|
|
23
38
|
/**
|
|
24
39
|
* Set the maximum width of the text after which it will wrap.
|
|
25
40
|
*/
|
|
26
41
|
maxWidth?: string;
|
|
27
42
|
/**
|
|
28
|
-
*
|
|
29
|
-
* based on the direction of the text.
|
|
43
|
+
* Place a Decorator before the string. This must be a Symbol or a Chip component.
|
|
30
44
|
*/
|
|
31
|
-
|
|
45
|
+
decoratorStart?: Decorator;
|
|
32
46
|
/**
|
|
33
|
-
*
|
|
34
|
-
|
|
47
|
+
* Place a Decorator after the string. This must be a Symbol or a Chip component.
|
|
48
|
+
*/
|
|
49
|
+
decoratorEnd?: Decorator;
|
|
50
|
+
/**
|
|
51
|
+
* Set the size of the decorator according to the variant.
|
|
35
52
|
*/
|
|
36
|
-
|
|
53
|
+
decoratorSize?: 'small' | 'medium' | 'big';
|
|
37
54
|
/**
|
|
38
|
-
*
|
|
39
|
-
* the
|
|
55
|
+
* Auto generate anchor link inside the heading and display variants. This should be
|
|
56
|
+
* used only when the title define a new content section and has
|
|
57
|
+
* a semantic tag.
|
|
58
|
+
*
|
|
59
|
+
* @default: `false`
|
|
40
60
|
*/
|
|
41
|
-
|
|
61
|
+
anchor?: boolean;
|
|
42
62
|
};
|
|
43
63
|
declare type PolymorphicText = Polymorphic.ForwardRefComponent<'p', TextProps>;
|
|
44
64
|
export declare const Text: PolymorphicText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.tsx"],"names":[],"mappings":";AAyBA,OAAO,EACL,SAAS,EAAE,WAAW,EAEtB,WAAW,EACZ,MAAM,cAAc,CAAC;AAItB,aAAK,cAAc,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAC5E,aAAK,cAAc,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AACxG,aAAK,cAAc,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAC9D,aAAK,eAAe,GAAG,YAAY,GAAG,YAAY,CAAC;AACnD,aAAK,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,oBAAY,YAAY,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,WAAW,CAAC;AAE5G,oBAAY,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhG,aAAK,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AAsDjF,oBAAY,SAAS,GAAG;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IACnD;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC3C;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAA;AAED,aAAK,eAAe,GAAG,WAAW,CAAC,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAEvE,eAAO,MAAM,IAAI,iBA8GI,CAAC"}
|
|
@@ -1,11 +1,92 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import { Children, cloneElement, forwardRef, isValidElement, useCallback, useMemo, } from 'react';
|
|
4
|
+
import slugify from 'slugify';
|
|
5
|
+
import { Symbol, } from '../..';
|
|
4
6
|
import * as styles from './text.module.css';
|
|
5
|
-
|
|
7
|
+
const decoratorSizeConfig = {
|
|
8
|
+
'body-1': {
|
|
9
|
+
chip: {
|
|
10
|
+
small: 'small',
|
|
11
|
+
medium: 'regular',
|
|
12
|
+
big: 'big',
|
|
13
|
+
},
|
|
14
|
+
icon: {
|
|
15
|
+
small: 16,
|
|
16
|
+
medium: 16,
|
|
17
|
+
big: 18,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
'body-2': {
|
|
21
|
+
chip: {
|
|
22
|
+
small: 'small',
|
|
23
|
+
medium: 'regular',
|
|
24
|
+
big: 'big',
|
|
25
|
+
},
|
|
26
|
+
icon: {
|
|
27
|
+
small: 12,
|
|
28
|
+
medium: 16,
|
|
29
|
+
big: 18,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
'body-3': {
|
|
33
|
+
chip: {
|
|
34
|
+
small: 'small',
|
|
35
|
+
medium: 'small',
|
|
36
|
+
big: 'small',
|
|
37
|
+
},
|
|
38
|
+
icon: {
|
|
39
|
+
small: 12,
|
|
40
|
+
medium: 12,
|
|
41
|
+
big: 12,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export const Text = forwardRef(({ children, className, variant = 'body-1', color, textAlign = 'start', as: Wrapper = 'p', preventResponsive = false, truncate = false, maxWidth, preventBreakWord = false, decoratorStart, decoratorEnd, decoratorSize = 'small', anchor = false, style, id, ...otherProps }, forwardedRef) => {
|
|
6
46
|
const dynamicStyle = {
|
|
7
|
-
'--max-w': maxWidth,
|
|
8
47
|
'--t-align': textAlign,
|
|
48
|
+
'--max-width': maxWidth,
|
|
9
49
|
};
|
|
10
|
-
|
|
50
|
+
const isBody = useMemo(() => variant.includes('body'), [variant]);
|
|
51
|
+
const isTitle = useMemo(() => variant.includes('display') || variant.includes('heading'), [variant]);
|
|
52
|
+
const isDisplay = useMemo(() => variant.includes('display'), [variant]);
|
|
53
|
+
const hasStart = useMemo(() => !!(isBody && decoratorStart), [decoratorStart, isBody]);
|
|
54
|
+
const hasEnd = useMemo(() => !!(isBody && decoratorEnd), [decoratorEnd, isBody]);
|
|
55
|
+
const isDecoratorAnIcon = (d) => Object.prototype.hasOwnProperty.call(d?.props, 'source');
|
|
56
|
+
const isDecoratorStartAnIcon = useMemo(() => (hasStart && isDecoratorAnIcon(decoratorStart)), [hasStart, decoratorStart]);
|
|
57
|
+
const isDecoratorEndAnIcon = useMemo(() => (hasEnd && isDecoratorAnIcon(decoratorEnd)), [hasEnd, decoratorEnd]);
|
|
58
|
+
const getDecoratorSize = (w) => {
|
|
59
|
+
if (w === 'start') {
|
|
60
|
+
return isDecoratorStartAnIcon
|
|
61
|
+
? decoratorSizeConfig[variant].icon[decoratorSize]
|
|
62
|
+
: decoratorSizeConfig[variant].chip[decoratorSize];
|
|
63
|
+
}
|
|
64
|
+
return isDecoratorEndAnIcon
|
|
65
|
+
? decoratorSizeConfig[variant].icon[decoratorSize]
|
|
66
|
+
: decoratorSizeConfig[variant].chip[decoratorSize];
|
|
67
|
+
};
|
|
68
|
+
const decoratorStartDimension = hasStart ? getDecoratorSize('start') : decoratorSize;
|
|
69
|
+
const decoratorEndDimension = hasEnd ? getDecoratorSize('end') : decoratorSize;
|
|
70
|
+
const getTextFromChildren = useCallback(() => {
|
|
71
|
+
let label = '';
|
|
72
|
+
Children.map(children, (child) => {
|
|
73
|
+
if (typeof child === 'string') {
|
|
74
|
+
label += child;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return label;
|
|
78
|
+
}, [children]);
|
|
79
|
+
const generatedID = slugify(String(id ?? getTextFromChildren()), { lower: true, replacement: '_' });
|
|
80
|
+
return (_jsxs(Wrapper, { ref: forwardedRef, "data-text-variant": variant, "data-text-color": color, "data-text-prevent-responsive": preventResponsive, "data-text-truncate": truncate, "data-text-decorator": hasStart || hasEnd, "data-text-prevent-break-word": preventBreakWord, className: clsx(styles.Text, className), style: { ...dynamicStyle, ...style }, id: id || (isTitle && generatedID) || '', ...otherProps, children: [hasStart
|
|
81
|
+
&& isValidElement(decoratorStart)
|
|
82
|
+
&& cloneElement(decoratorStart, {
|
|
83
|
+
...decoratorStart.props,
|
|
84
|
+
dimension: decoratorStartDimension,
|
|
85
|
+
}), children, (anchor && isTitle) && (_jsx("a", { href: `#${generatedID}`, className: styles.Anchor, rel: "noreferrer", children: _jsx(Symbol, { source: "link", weight: "duotone", dimension: isDisplay ? 24 : 16 }) })), hasEnd
|
|
86
|
+
&& isValidElement(decoratorEnd)
|
|
87
|
+
&& cloneElement(decoratorEnd, {
|
|
88
|
+
...decoratorEnd.props,
|
|
89
|
+
dimension: decoratorEndDimension,
|
|
90
|
+
})] }));
|
|
11
91
|
});
|
|
92
|
+
Text.displayName = 'Text';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Text{font-size:var(--fs-
|
|
1
|
+
@layer components{.Text{font-size:var(--fs-extra-small);font-weight:var(--fw-extra-small);letter-spacing:0;line-height:var(--lh-extra-small);max-width:var(--max-width);min-block-size:.01vh;text-align:var(--t-align);word-break:break-word}@media (min-width:48em){.Text{font-size:var(--fs-small);font-weight:var(--fw-small);line-height:var(--lh-small)}}@media (min-width:60em){.Text{font-size:var(--fs-medium);font-weight:var(--fw-medium);line-height:var(--lh-medium)}}@media (min-width:80em){.Text{font-size:var(--fs-large);font-weight:var(--fw-large);line-height:var(--lh-large)}}.Text[data-text-decorator=true]{align-items:center;display:inline-flex;flex-flow:row wrap;gap:.5rem}.Text[data-text-prevent-break-word=true]{word-break:unset}.Text[data-text-prevent-responsive=true]{font-size:var(--fs-large);font-weight:var(--fw-large);line-height:var(--lh-large)}.Text[data-text-variant=display-1]{--fs-large:6rem;--fw-large:800;--lh-large:6.75rem;--fs-medium:4rem;--fw-medium:800;--lh-medium:5rem;--fs-small:3.5rem;--fw-small:800;--lh-small:4rem;--fs-extra-small:2.5rem;--fw-extra-small:800;--lh-extra-small:3rem;color:var(--dimmed-9)}.Text[data-text-variant=display-2]{--fs-large:5rem;--fw-large:800;--lh-large:6rem;--fs-medium:4rem;--fw-medium:800;--lh-medium:5rem;--fs-small:3.5rem;--fw-small:800;--lh-small:4rem;--fs-extra-small:2.5rem;--fw-extra-small:800;--lh-extra-small:3rem;color:var(--dimmed-9)}.Text[data-text-variant=display-3]{--fs-large:4rem;--fw-large:800;--lh-large:5rem;--fs-medium:3.5rem;--fw-medium:800;--lh-medium:4rem;--fs-small:3rem;--fw-small:800;--lh-small:3.5rem;--fs-extra-small:2.5rem;--fw-extra-small:800;--lh-extra-small:3rem;color:var(--dimmed-9)}.Text[data-text-variant=display-4]{--fs-large:3.5rem;--fw-large:800;--lh-large:4rem;--fs-medium:3.5rem;--fw-medium:800;--lh-medium:4rem;--fs-small:3rem;--fw-small:800;--lh-small:3.5rem;--fs-extra-small:2.5rem;--fw-extra-small:800;--lh-extra-small:3rem;color:var(--dimmed-9)}.Text[data-text-variant=heading-1]{--fs-large:3rem;--fw-large:800;--lh-large:3.5rem;--fs-medium:3rem;--fw-medium:800;--lh-medium:3.5rem;--fs-small:3rem;--fw-small:800;--lh-small:3.5rem;--fs-extra-small:2.5rem;--fw-extra-small:800;--lh-extra-small:3rem;color:var(--dimmed-9)}.Text[data-text-variant=heading-2]{--fs-large:2.5rem;--fw-large:800;--lh-large:3rem;--fs-medium:2.5rem;--fw-medium:800;--lh-medium:3rem;--fs-small:2rem;--fw-small:700;--lh-small:2.5rem;--fs-extra-small:2rem;--fw-extra-small:700;--lh-extra-small:2.5rem;color:var(--dimmed-9)}.Text[data-text-variant=heading-3]{--fs-large:2rem;--fw-large:700;--lh-large:2.5rem;--fs-medium:2rem;--fw-medium:700;--lh-medium:2.5rem;--fs-small:2rem;--fw-small:700;--lh-small:2.5rem;--fs-extra-small:1.75rem;--fw-extra-small:700;--lh-extra-small:2.25rem;color:var(--dimmed-9)}.Text[data-text-variant=heading-4]{--fs-large:1.75rem;--fw-large:700;--lh-large:2.25rem;--fs-medium:1.75rem;--fw-medium:700;--lh-medium:2.25rem;--fs-small:1.75rem;--fw-small:700;--lh-small:2.25rem;--fs-extra-small:1.5rem;--fw-extra-small:600;--lh-extra-small:2rem;color:var(--dimmed-9)}.Text[data-text-variant=heading-5]{--fs-large:1.5rem;--fw-large:600;--lh-large:2rem;--fs-medium:1.5rem;--fw-medium:600;--lh-medium:2rem;--fs-small:1.25rem;--fw-small:600;--lh-small:1.75rem;--fs-extra-small:1.25rem;--fw-extra-small:600;--lh-extra-small:1.75rem;color:var(--dimmed-9)}.Text[data-text-variant=heading-6]{--fs-large:1.25rem;--fw-large:600;--lh-large:1.75rem;--fs-medium:1.25rem;--fw-medium:600;--lh-medium:1.75rem;--fs-small:1.25rem;--fw-small:600;--lh-small:1.75rem;--fs-extra-small:1.25rem;--fw-extra-small:600;--lh-extra-small:1.75rem;color:var(--dimmed-9)}.Text[data-text-variant=tagline-1]{--fs-large:1.75rem;--fw-large:300;--lh-large:2.25rem;--fs-medium:1.75rem;--fw-medium:300;--lh-medium:2.25rem;--fs-small:1.75rem;--fw-small:300;--lh-small:2.25rem;--fs-extra-small:1.5rem;--fw-extra-small:300;--lh-extra-small:2rem;color:var(--dimmed-7)}.Text[data-text-variant=tagline-2]{--fs-large:1.5rem;--fw-large:300;--lh-large:2rem;--fs-medium:1.5rem;--fw-medium:300;--lh-medium:2rem;--fs-small:1.25rem;--fw-small:300;--lh-small:1.75rem;--fs-extra-small:1.25rem;--fw-extra-small:300;--lh-extra-small:1.75rem;color:var(--dimmed-7)}.Text[data-text-variant=tagline-3]{--fs-large:1.25rem;--fw-large:300;--lh-large:1.75rem;--fs-medium:1.25rem;--fw-medium:300;--lh-medium:1.75rem;--fs-small:1.25rem;--fw-small:300;--lh-small:1.75rem;--fs-extra-small:1.25rem;--fw-extra-small:300;--lh-extra-small:1.75rem;color:var(--dimmed-7)}.Text[data-text-variant=subtitle-1]{--fs-large:1rem;--fw-large:600;--lh-large:1.5rem;--fs-medium:1rem;--fw-medium:600;--lh-medium:1.5rem;--fs-small:1rem;--fw-small:600;--lh-small:1.5rem;--fs-extra-small:1rem;--fw-extra-small:600;--lh-extra-small:1.5rem;color:var(--dimmed-7);letter-spacing:.01rem}.Text[data-text-variant=subtitle-2]{--fs-large:0.875rem;--fw-large:600;--lh-large:1.25rem;--fs-medium:0.875rem;--fw-medium:600;--lh-medium:1.25rem;--fs-small:0.875rem;--fw-small:600;--lh-small:1.25rem;--fs-extra-small:0.875rem;--fw-extra-small:600;--lh-extra-small:1.25rem;color:var(--dimmed-7);letter-spacing:.015rem}.Text[data-text-variant=body-1]{--fs-large:1rem;--fw-large:400;--lh-large:1.5rem;--fs-medium:1rem;--fw-medium:400;--lh-medium:1.5rem;--fs-small:1rem;--fw-small:400;--lh-small:1.5rem;--fs-extra-small:1rem;--fw-extra-small:400;--lh-extra-small:1.5rem;color:var(--dimmed-7);letter-spacing:.01rem}.Text[data-text-variant=body-2]{--fs-large:0.875rem;--fw-large:400;--lh-large:1.25rem;--fs-medium:0.875rem;--fw-medium:400;--lh-medium:1.25rem;--fs-small:0.875rem;--fw-small:400;--lh-small:1.25rem;--fs-extra-small:0.875rem;--fw-extra-small:400;--lh-extra-small:1.25rem;color:var(--dimmed-7);letter-spacing:token(--wds-letter-spacing-14)}.Text[data-text-variant=body-3]{--fs-large:0.75rem;--fw-large:400;--lh-large:1rem;--fs-medium:0.75rem;--fw-medium:400;--lh-medium:1rem;--fs-small:0.75rem;--fw-small:400;--lh-small:1rem;--fs-extra-small:0.75rem;--fw-extra-small:400;--lh-extra-small:1rem;color:var(--dimmed-7);letter-spacing:.02rem}.Text[data-text-color=positive]{color:var(--highlight-green-foreground)}.Text[data-text-color=informative]{color:var(--highlight-blue-foreground)}.Text[data-text-color=danger]{color:var(--highlight-red-foreground)}.Text[data-text-color=warning]{color:var(--highlight-yellow-foreground)}.Text[data-text-color=neutral]{color:var(--dimmed-7)}.Text[data-text-color=dark]{color:var(--dimmed-9)}.Text[data-text-truncate=true]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:inherit}}@layer overrides{.Anchor{align-items:center;background-image:none;color:inherit;display:inline-flex;justify-content:center;margin-left:1rem;visibility:hidden}.Text:focus-within .Anchor,.Text:hover .Anchor{visibility:visible}}
|
|
@@ -3,5 +3,10 @@ import { Text } from './text';
|
|
|
3
3
|
declare const story: ComponentMeta<typeof Text>;
|
|
4
4
|
export default story;
|
|
5
5
|
export declare const Default: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"p", import("./text").TextProps>>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Variants: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"p", import("./text").TextProps>>;
|
|
7
|
+
export declare const Colors: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"p", import("./text").TextProps>>;
|
|
8
|
+
export declare const TitleWithAnchor: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"p", import("./text").TextProps>>;
|
|
9
|
+
export declare const withConstraint: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"p", import("./text").TextProps>>;
|
|
10
|
+
export declare const withDecorators: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"p", import("./text").TextProps>>;
|
|
11
|
+
export declare const sizePairing: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"p", import("./text").TextProps>>;
|
|
7
12
|
//# sourceMappingURL=text.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.stories.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.stories.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMjE,OAAO,EAAE,IAAI,EAAgB,MAAM,QAAQ,CAAC;AAE5C,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CA8CrC,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,OAAO,wGAAoB,CAAC;AAoBzC,eAAO,MAAM,QAAQ,wGAA4B,CAAC;AAalD,eAAO,MAAM,MAAM,wGAA0B,CAAC;AAc9C,eAAO,MAAM,eAAe,wGAAyB,CAAC;AAUtD,eAAO,MAAM,cAAc,wGAA8B,CAAC;AAgD1D,eAAO,MAAM,cAAc,wGAA8B,CAAC;AAyB1D,eAAO,MAAM,WAAW,wGAA2B,CAAC"}
|
|
@@ -1,39 +1,84 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Container } from '../..';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card, Chip, Container, Stack, Symbol, } from '../..';
|
|
3
3
|
import { Text } from './text';
|
|
4
4
|
const story = {
|
|
5
5
|
title: 'Typography/Text',
|
|
6
6
|
component: Text,
|
|
7
7
|
args: {
|
|
8
|
-
|
|
8
|
+
variant: 'body-1',
|
|
9
|
+
color: undefined,
|
|
9
10
|
children: 'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Eius dolores, tempore quas labore officiis praesentium. Porro sed dolorem, numquam temporibus consequuntur quam doloremque ducimus error tempora illo aliquam nesciunt nostrum!',
|
|
10
11
|
textAlign: 'start',
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
preventBreakWord: false,
|
|
13
|
+
truncate: false,
|
|
14
|
+
maxWidth: '',
|
|
15
|
+
preventResponsive: false,
|
|
16
|
+
anchor: false,
|
|
13
17
|
},
|
|
14
18
|
argTypes: {
|
|
15
|
-
|
|
16
|
-
options: [
|
|
19
|
+
variant: {
|
|
20
|
+
options: [
|
|
21
|
+
'display-1',
|
|
22
|
+
'display-2',
|
|
23
|
+
'display-3',
|
|
24
|
+
'display-4',
|
|
25
|
+
'heading-1',
|
|
26
|
+
'heading-2',
|
|
27
|
+
'heading-3',
|
|
28
|
+
'heading-4',
|
|
29
|
+
'heading-5',
|
|
30
|
+
'heading-6',
|
|
31
|
+
'tagline-1',
|
|
32
|
+
'tagline-2',
|
|
33
|
+
'tagline-3',
|
|
34
|
+
'subtitle-1',
|
|
35
|
+
'subtitle-2',
|
|
36
|
+
'body-1',
|
|
37
|
+
'body-2',
|
|
38
|
+
'body-3'
|
|
39
|
+
],
|
|
17
40
|
control: { type: 'select' },
|
|
18
41
|
},
|
|
19
|
-
|
|
20
|
-
options: [
|
|
42
|
+
color: {
|
|
43
|
+
options: ['positive', 'informative', 'danger', 'warning', 'neutral', 'dark'],
|
|
21
44
|
control: { type: 'select' },
|
|
22
45
|
},
|
|
23
46
|
textAlign: {
|
|
24
|
-
options: ['start', 'center', 'end'],
|
|
25
|
-
control: { type: 'inline-radio' },
|
|
26
|
-
},
|
|
27
|
-
lineHeight: {
|
|
28
|
-
options: ['none', 'small', 'large'],
|
|
47
|
+
options: ['start', 'center', 'end', 'justify'],
|
|
29
48
|
control: { type: 'inline-radio' },
|
|
30
49
|
},
|
|
31
50
|
},
|
|
32
51
|
};
|
|
33
52
|
export default story;
|
|
34
|
-
const Template = args => _jsx(Container, { dimension: "
|
|
53
|
+
const Template = args => _jsx(Container, { dimension: "fixed", children: _jsx(Text, { ...args }) });
|
|
35
54
|
export const Default = Template.bind({});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
const TemplateVariants = () => {
|
|
56
|
+
const variants = ['display-1', 'display-2', 'display-3', 'display-4', 'heading-1', 'heading-2', 'heading-3',
|
|
57
|
+
'heading-4', 'heading-5', 'heading-6', 'tagline-1', 'tagline-2', 'tagline-3', 'subtitle-1', 'subtitle-2', 'body-1', 'body-2', 'body-3'];
|
|
58
|
+
return (_jsx(Container, { dimension: "fixed", children: _jsx(Stack, { rowGap: 16, children: variants.map(e => (_jsxs("div", { children: [_jsx(Text, { variant: "body-3", children: e }), _jsx(Text, { variant: e, children: "Wonderflow" })] }, e))) }) }));
|
|
59
|
+
};
|
|
60
|
+
export const Variants = TemplateVariants.bind({});
|
|
61
|
+
const TemplateColors = () => {
|
|
62
|
+
const colors = ['positive', 'informative', 'danger', 'warning', 'neutral', 'dark'];
|
|
63
|
+
return (_jsx(Container, { dimension: "fixed", children: colors.map(e => _jsx(Text, { variant: "heading-1", color: e, children: e }, e)) }));
|
|
64
|
+
};
|
|
65
|
+
export const Colors = TemplateColors.bind({});
|
|
66
|
+
const TemplateTitle = () => {
|
|
67
|
+
const variants = ['display-1', 'display-2', 'display-3', 'display-4', 'heading-1', 'heading-2', 'heading-3',
|
|
68
|
+
'heading-4', 'heading-5', 'heading-6'];
|
|
69
|
+
return (_jsxs(Container, { dimension: "fixed", children: [variants.map(e => _jsx(Text, { variant: e, id: e, anchor: true, children: e }, e)), variants.map(e => _jsx(Text, { variant: e, id: `${e}-danger`, anchor: true, color: "danger", children: e }, e))] }));
|
|
70
|
+
};
|
|
71
|
+
export const TitleWithAnchor = TemplateTitle.bind({});
|
|
72
|
+
const TemplateConstraint = args => (_jsx(Container, { dimension: "fixed", children: _jsx(Card, { dimmed: 0, bordered: true, style: { width: '300px', height: '200px' }, children: _jsx(Text, { ...args }) }) }));
|
|
73
|
+
export const withConstraint = TemplateConstraint.bind({});
|
|
74
|
+
withConstraint.args = {
|
|
75
|
+
children: 'Loremipsumdolor,sitametconsecteturadipisicingelit.Impeditautnonfugitanimiab?\nNemo,illumrepudiandaeaharumexvoluptateveritatisearumassumendasuscipit!',
|
|
76
|
+
};
|
|
77
|
+
const TemplateDecorators = () => {
|
|
78
|
+
const variants = ['body-1', 'body-2', 'body-3'];
|
|
79
|
+
const sizes = ['small', 'medium', 'big'];
|
|
80
|
+
return (_jsx(Container, { dimension: "fixed", children: _jsx(Stack, { rowGap: 40, children: variants.map(v => (_jsxs(Stack, { rowGap: 8, children: [_jsx(Text, { variant: v, color: "informative", decoratorSize: sizes[0], decoratorStart: _jsx(Symbol, { source: "circle-check", weight: "solid" }), decoratorEnd: _jsx(Chip, { color: "cyan", children: sizes[0] }), children: v }), _jsx(Text, { variant: v, decoratorSize: sizes[1], decoratorStart: _jsx(Symbol, { source: "circle-check", weight: "solid" }), decoratorEnd: _jsx(Chip, { color: "green", children: sizes[1] }), children: v }), _jsx(Text, { variant: v, decoratorSize: sizes[2], decoratorStart: _jsx(Symbol, { source: "circle-check", weight: "outline", color: "red" }), decoratorEnd: _jsx(Chip, { color: "red", children: sizes[2] }), children: v })] }, v))) }) }));
|
|
39
81
|
};
|
|
82
|
+
export const withDecorators = TemplateDecorators.bind({});
|
|
83
|
+
const TemplatePairing = () => (_jsxs(Stack, { rowGap: 16, children: [_jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-1", children: "96px display-1" }), _jsx(Text, { variant: "tagline-1", children: "28px tagline-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-2", children: "80px display-2" }), _jsx(Text, { variant: "tagline-1", children: "28px tagline-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-3", children: "68px display-3" }), _jsx(Text, { variant: "tagline-2", children: "24px tagline-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-4", children: "56px display-4" }), _jsx(Text, { variant: "tagline-2", children: "24px tagline-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] })] }));
|
|
84
|
+
export const sizePairing = TemplatePairing.bind({});
|