@wonderflow/react-components 11.0.7 → 12.1.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/drawer/drawer.module.css +1 -1
- 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 +1 -1
- package/dist/components/selection-controls/radio.d.ts.map +1 -1
- package/dist/components/selection-controls/radio.js +1 -1
- 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 +1 -1
- 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 +10 -3
- 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.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 +2 -2
- 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/index.js +0 -16
- 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 +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;AAOjE,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;AAiH1D,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, Separator, 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: 32, children: [_jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "display-1", preventResponsive: true, children: "96px display-1" }), _jsx(Text, { variant: "tagline-1", preventResponsive: true, 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", preventResponsive: true, children: "80px display-2" }), _jsx(Text, { variant: "tagline-1", preventResponsive: true, 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", preventResponsive: true, children: "68px display-3" }), _jsx(Text, { variant: "tagline-2", preventResponsive: true, 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", preventResponsive: true, children: "56px display-4" }), _jsx(Text, { variant: "tagline-2", preventResponsive: true, children: "24px tagline-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "tagline-3", preventResponsive: true, children: "20px tagline-3" }), _jsx(Text, { variant: "heading-1", preventResponsive: true, children: "48px heading-1" }), _jsx(Text, { variant: "tagline-3", children: "20px tagline-3" })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "subtitle-1", children: "16px subtitle-1" }), _jsx(Text, { variant: "heading-1", preventResponsive: true, children: "48px heading-1" }), _jsx(Text, { variant: "body-1", children: "16px body-1" })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-1", preventResponsive: true, children: "48px heading-1" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-2", preventResponsive: true, children: "40px heading-2" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { children: [_jsx(Text, { variant: "subtitle-1", color: "danger", children: "Heading Title with Body text" }), _jsx(Separator, {})] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-3", preventResponsive: true, children: "32px heading-3" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-4", preventResponsive: true, children: "28px heading-4" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-5", preventResponsive: true, children: "24px heading-5" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-6", preventResponsive: true, children: "20px heading-6" }), _jsx(Text, { variant: "body-1", children: "16px as body-1 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "heading-6", preventResponsive: true, children: "20px heading-6" }), _jsx(Text, { variant: "body-2", children: "14px as body-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "subtitle-1", children: "16px subtitle-1" }), _jsx(Text, { variant: "body-2", children: "14px as body-2 Lorem ipsum sit amet, consectur adipiscing elit. Fusce aliquet cursus." })] }), _jsxs("div", { children: [_jsx(Text, { variant: "subtitle-1", color: "danger", children: "Title with eyebrow text" }), _jsx(Separator, {})] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "subtitle-1", children: "16px subtitle-1" }), _jsx(Text, { variant: "heading-4", preventResponsive: true, children: "28px heading-4" })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "subtitle-2", children: "14px subtitle-2" }), _jsx(Text, { variant: "heading-5", preventResponsive: true, children: "24px heading-5" })] }), _jsxs("div", { children: [_jsx(Text, { variant: "subtitle-1", color: "danger", children: "Paragraph with text" }), _jsx(Separator, {})] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { children: "16px as body-1" }), _jsx(Text, { variant: "body-3", children: "12px as body-3" })] }), _jsxs("div", { style: { maxWidth: '800px' }, children: [_jsx(Text, { variant: "body-2", children: "14px as body-2" }), _jsx(Text, { variant: "body-3", children: "12px as body-3" })] })] }));
|
|
84
|
+
export const sizePairing = TemplatePairing.bind({});
|
|
@@ -1,9 +1,94 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
|
+
import { Chip, Symbol, } from '../..';
|
|
3
4
|
import { Text } from './text';
|
|
4
5
|
describe('<Text>', () => {
|
|
5
6
|
test(' it should render properly', () => {
|
|
6
7
|
const { container } = render(_jsx(Text, { children: "Some text" }));
|
|
7
8
|
expect(container).not.toBeNull();
|
|
8
9
|
});
|
|
10
|
+
test(' it should render properly as <span>', () => {
|
|
11
|
+
const { container } = render(_jsx(Text, { as: "span", children: "Some text" }));
|
|
12
|
+
expect(container).not.toBeNull();
|
|
13
|
+
});
|
|
14
|
+
test(' it should render properly with all variants', () => {
|
|
15
|
+
const v = [
|
|
16
|
+
'display-1',
|
|
17
|
+
'display-2',
|
|
18
|
+
'display-3',
|
|
19
|
+
'display-4',
|
|
20
|
+
'heading-1',
|
|
21
|
+
'heading-2',
|
|
22
|
+
'heading-3',
|
|
23
|
+
'heading-4',
|
|
24
|
+
'heading-5',
|
|
25
|
+
'heading-6',
|
|
26
|
+
'subtitle-1',
|
|
27
|
+
'subtitle-2',
|
|
28
|
+
'tagline-1',
|
|
29
|
+
'tagline-2',
|
|
30
|
+
'tagline-3',
|
|
31
|
+
'body-1',
|
|
32
|
+
'body-2',
|
|
33
|
+
'body-3'
|
|
34
|
+
];
|
|
35
|
+
v.map((el) => {
|
|
36
|
+
const { container } = render(_jsx(Text, { variant: el, children: "Some text" }));
|
|
37
|
+
return expect(container).not.toBeNull();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
test(' it should render properly with colors', () => {
|
|
41
|
+
const c = ['positive', 'informative', 'danger', 'warning'];
|
|
42
|
+
c.map((col) => {
|
|
43
|
+
const { container } = render(_jsx(Text, { color: col, children: "Some text" }));
|
|
44
|
+
return expect(container).not.toBeNull();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
test(' it should render properly with different alignment', () => {
|
|
48
|
+
const a = ['start', 'center', 'end', 'justify'];
|
|
49
|
+
a.map((t) => {
|
|
50
|
+
const { container } = render(_jsx(Text, { textAlign: t, children: "Some text" }));
|
|
51
|
+
return expect(container).not.toBeNull();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
test(' it should render properly with props', () => {
|
|
55
|
+
const { container } = render(_jsx(Text, { preventBreakWord: true, preventResponsive: true, truncate: true, children: "Some text" }));
|
|
56
|
+
return expect(container).not.toBeNull();
|
|
57
|
+
});
|
|
58
|
+
test(' it should render properly with anchor', () => {
|
|
59
|
+
const { container } = render(_jsx(Text, { variant: "heading-1", anchor: true, id: "heading-1", children: "Some text" }));
|
|
60
|
+
return expect(container).not.toBeNull();
|
|
61
|
+
});
|
|
62
|
+
test(' it should render properly with anchor w/o id', () => {
|
|
63
|
+
const { container } = render(_jsx(Text, { variant: "display-1", anchor: true, children: "Some text" }));
|
|
64
|
+
return expect(container).not.toBeNull();
|
|
65
|
+
});
|
|
66
|
+
test(' it should render properly with decorator start icon', () => {
|
|
67
|
+
const s = ['small', 'medium', 'big'];
|
|
68
|
+
s.map(((t) => {
|
|
69
|
+
const { container } = render(_jsx(Text, { decoratorStart: (_jsx(Symbol, { source: "circle-check", weight: "solid" })), decoratorSize: t, children: "Some text" }));
|
|
70
|
+
return expect(container).not.toBeNull();
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
test(' it should render properly with decorator start chip', () => {
|
|
74
|
+
const s = ['small', 'medium', 'big'];
|
|
75
|
+
s.map(((t) => {
|
|
76
|
+
const { container } = render(_jsx(Text, { decoratorStart: (_jsx(Chip, { color: "red", children: "Chip" })), decoratorSize: t, children: "Some text" }));
|
|
77
|
+
return expect(container).not.toBeNull();
|
|
78
|
+
}));
|
|
79
|
+
});
|
|
80
|
+
test(' it should render properly with decorator end icon', () => {
|
|
81
|
+
const s = ['small', 'medium', 'big'];
|
|
82
|
+
s.map(((t) => {
|
|
83
|
+
const { container } = render(_jsx(Text, { decoratorEnd: (_jsx(Symbol, { source: "circle-check", weight: "solid" })), decoratorSize: t, children: "Some text" }));
|
|
84
|
+
return expect(container).not.toBeNull();
|
|
85
|
+
}));
|
|
86
|
+
});
|
|
87
|
+
test(' it should render properly with decorator end chip', () => {
|
|
88
|
+
const s = ['small', 'medium', 'big'];
|
|
89
|
+
s.map(((t) => {
|
|
90
|
+
const { container } = render(_jsx(Text, { decoratorEnd: (_jsx(Chip, { color: "red", children: "Chip" })), decoratorSize: t, children: "Some text" }));
|
|
91
|
+
return expect(container).not.toBeNull();
|
|
92
|
+
}));
|
|
93
|
+
});
|
|
9
94
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.BaseField{appearance:none;background-color:var(--global-background);block-size:var(--field-height);border:1px solid var(--dimmed-2);border-radius:.25rem;box-sizing:border-box;caret-color:var(--cta-default);color:inherit;display:flex;font-family:inherit;font-size:var(--font-size);inline-size:100%;line-height:
|
|
1
|
+
@layer components{.BaseField{appearance:none;background-color:var(--global-background);block-size:var(--field-height);border:1px solid var(--dimmed-2);border-radius:.25rem;box-sizing:border-box;caret-color:var(--cta-default);color:inherit;display:flex;font-family:inherit;font-size:var(--font-size);inline-size:100%;line-height:1rem;margin:0;overflow:hidden;padding:0 var(--field-padding);text-overflow:ellipsis}[data-textfield-has-icon=true] .BaseField::-webkit-calendar-picker-indicator{opacity:0;position:absolute;right:calc(var(--field-padding)/2)}.BaseField:-moz-ui-invalid{box-shadow:none}.BaseField::placeholder{color:var(--dimmed-5)}.BaseField:focus-visible{border-color:var(--dimmed-5)}.BaseField:disabled{background:linear-gradient(to bottom,var(--global-disabled-background),var(--global-disabled-background));border-color:transparent;color:var(--global-disabled-foreground);cursor:not-allowed}.BaseField:disabled::placeholder{color:var(--global-disabled-foreground)}.BaseField[readonly]{border-style:dashed;box-shadow:none;cursor:default}.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:active,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:hover{-webkit-text-fill-color:var(--global-vibrancy-foreground);border:1px solid var(--dimmed-2);box-shadow:0 0 0 100px var(--global-background) inset}:is(.BaseField:-webkit-autofill,.BaseField:-webkit-autofill:hover,.BaseField:-webkit-autofill:focus,.BaseField:-webkit-autofill:active)::selection{-webkit-text-fill-color:var(--dimmed-0)}.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range),.BaseField:is(:invalid,[data-basefield-invalid=true],:out-of-range):focus-visible{border-color:var(--highlight-red-foreground)}.BaseField[type=number]{appearance:textfield}.BaseField[type=number]::-webkit-inner-spin-button,.BaseField[type=number]::-webkit-outer-spin-button{display:none}.BaseField[type=search]{appearance:none}.BaseField[type=search]::-webkit-search-cancel-button,.BaseField[type=search]::-webkit-search-decoration{appearance:none}textarea.BaseField{block-size:auto;line-height:1.5rem;min-block-size:2rem;padding:calc(var(--field-padding)/2) calc(var(--field-padding) + 1rem) calc(var(--field-padding)/2) var(--field-padding);resize:vertical}textarea.BaseField::-webkit-datetime-edit-text{opacity:.3}textarea.BaseField::-webkit-calendar-picker-indicator{color:var(--global-foreground)}textarea.BaseField:-moz-ui-invalid{box-shadow:none}textarea.BaseField::-webkit-calendar-picker-indicator:hover{background-color:transparent}}
|
|
@@ -29,8 +29,8 @@ export const Textfield = forwardRef(({ children, className, disabled = false, ic
|
|
|
29
29
|
disabled,
|
|
30
30
|
onChange,
|
|
31
31
|
};
|
|
32
|
-
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Textfield, className), "data-testid": "Textfield", "data-textfield-has-icon": isPassword || Boolean(icon), "data-textfield-icon-position": iconPosition, "data-textfield-dimension": dimension, "data-textfield-invalid": invalid && !disabled, "data-textfield-fullwidth": fullWidth, "aria-disabled": disabled, hAlign: "stretch", vAlign: "start", tabIndex: disabled ? 0 : undefined, style: style, children: [label && _jsx(Text, { as: "label",
|
|
32
|
+
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Textfield, className), "data-testid": "Textfield", "data-textfield-has-icon": isPassword || Boolean(icon), "data-textfield-icon-position": iconPosition, "data-textfield-dimension": dimension, "data-textfield-invalid": invalid && !disabled, "data-textfield-fullwidth": fullWidth, "aria-disabled": disabled, hAlign: "stretch", vAlign: "start", tabIndex: disabled ? 0 : undefined, style: style, children: [label && _jsx(Text, { as: "label", "aria-disabled": disabled, className: styles.Label, variant: dimension === 'big' ? 'body-1' : 'body-2', htmlFor: fieldID, children: label }), _jsxs("div", { className: styles.FieldContainer, children: [textarea
|
|
33
33
|
? (_jsx(BaseField, { ref: forwardedRef, as: "textarea", id: fieldID, ...commonProps, ...otherProps }))
|
|
34
|
-
: (_jsx(BaseField, { className: styles.InputField, id: fieldID, ref: forwardedRef, type: isPasswordVisible ? 'text' : type, spellCheck: isPassword ? false : undefined, ...commonProps, ...otherProps })), isPassword && (_jsx(IconButton, { className: styles.IconButton, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", "data-testid": "RevealIcon", icon: isPasswordVisible ? 'eye-slash' : 'eye' })), !textarea && icon && !isPassword && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }))] }), message && _jsx(Text, { as: "label",
|
|
34
|
+
: (_jsx(BaseField, { className: styles.InputField, id: fieldID, ref: forwardedRef, type: isPasswordVisible ? 'text' : type, spellCheck: isPassword ? false : undefined, ...commonProps, ...otherProps })), isPassword && (_jsx(IconButton, { className: styles.IconButton, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", "data-testid": "RevealIcon", icon: isPasswordVisible ? 'eye-slash' : 'eye' })), !textarea && icon && !isPassword && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }))] }), message && _jsx(Text, { as: "label", color: (invalid && !disabled) ? 'danger' : undefined, "aria-disabled": disabled, className: styles.Label, variant: dimension === 'big' ? 'body-2' : 'body-3', children: message })] }));
|
|
35
35
|
});
|
|
36
36
|
Textfield.displayName = 'Textfield';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Textfield{appearance:none;padding:0;position:relative}.Textfield[data-textfield-dimension=small]{--field-height:1.500rem;--field-padding:0.33rem;--font-size:0.875rem}.Textfield[data-textfield-dimension=regular]{--field-height:2.500rem;--field-padding:1.000rem;--font-size:
|
|
1
|
+
@layer components{.Textfield{appearance:none;padding:0;position:relative}.Textfield[data-textfield-dimension=small]{--field-height:1.500rem;--field-padding:0.33rem;--font-size:0.875rem}.Textfield[data-textfield-dimension=regular]{--field-height:2.500rem;--field-padding:1.000rem;--font-size:1rem}.Textfield[data-textfield-dimension=big]{--field-height:3.000rem;--field-padding:1.000rem;--font-size:1rem}.Textfield[data-textfield-fullwidth=true]{inline-size:100%}.FieldContainer{position:relative}.InputField{--factor:4}[data-textfield-has-icon=true][data-textfield-icon-position=right] .InputField{padding:0 calc(var(--field-padding)*var(--factor)) 0 var(--field-padding)}[data-textfield-has-icon=true][data-textfield-icon-position=left] .InputField{padding:0 var(--field-padding) 0 calc(var(--field-padding)*var(--factor))}[data-textfield-dimension*=big] .InputField,[data-textfield-dimension*=regular] .InputField{--factor:3}.Icon{border-radius:.25rem;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%)}[data-textfield-icon-position=left] .Icon{left:var(--field-padding);right:auto}[data-textfield-icon-position=right] .Icon{left:auto;right:var(--field-padding)}.Textfield[data-textfield-invalid=true] .Icon{fill:var(--highlight-red-foreground)}.InputField:invalid+.Icon{fill:var(--highlight-red-foreground)}.Label[aria-disabled=true]{color:var(--global-disabled-foreground);cursor:not-allowed}}@layer overrides{.IconButton{--x:25%;outline-offset:-.25em;position:absolute;top:50%;transform:translateY(-50%) translateX(var(--x))}.IconButton[data-button-kind=flat]:is(:hover,:active,:focus,[data-button-disabled=true]){-webkit-backdrop-filter:none;backdrop-filter:none;background-color:transparent}[data-textfield-icon-position=left] .IconButton{--x:-19%;left:var(--field-padding);right:auto}[data-textfield-icon-position=right] .IconButton{left:auto;right:var(--field-padding)}.Textfield[data-textfield-invalid=true] .IconButton{color:var(--highlight-red-foreground)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Tooltip{display:contents}.Balloon{word-wrap:break-word;background-color:#31363f;border-radius:.25rem;
|
|
1
|
+
@layer components{.Tooltip{display:contents}.Balloon{word-wrap:break-word;background-color:#31363f;border-radius:.25rem;max-inline-size:var(--max-w);padding:.5rem 1rem;position:relative;z-index:5}.Balloon,.Balloon p{font-size:.875rem}.Balloon[data-popper-reference-hidden=true]{pointer-events:none;visibility:hidden}.Arrow:before{background-color:#31363f;block-size:12px;content:"";inline-size:12px;position:absolute;transform:rotate(45deg);visibility:visible}.Balloon[data-popper-reference-hidden=true] .Arrow{pointer-events:none;visibility:hidden}.Balloon[data-popper-placement^=top] .Arrow{bottom:6px}.Balloon[data-popper-placement^=top] .Arrow:before{transform:translateX(-50%) translateY(-2px) rotate(45deg)}.Balloon[data-popper-placement^=left] .Arrow{right:6px}.Balloon[data-popper-placement^=left] .Arrow:before{transform:translateX(-2px) translateY(-50%) rotate(45deg)}.Balloon[data-popper-placement^=bottom] .Arrow{top:-6px}.Balloon[data-popper-placement^=bottom] .Arrow:before{transform:translateX(-50%) translateY(2px) rotate(45deg)}.Balloon[data-popper-placement^=right] .Arrow{left:-6px}.Balloon[data-popper-placement^=right] .Arrow:before{transform:translateX(2px) translateY(-50%) rotate(45deg)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.MainContainer{background-color:#f9fafb}.LeftMenu{background-color:var(--global-background);border-right:1px solid var(--dimmed-1);max-width:63px;min-width:63px}.LeftMenu[data-is-open=true]{max-width:279px;min-width:279px}.LeftMenuInner{wordbreak:break-all;background-color:var(--dimmed-1);border-bottom:1px solid var(--dimmed-1);height:64px;max-height:64px;padding:.5rem}.LeftMenuInner[data-is-open=true]{background-color:var(--global-background);height:250px;max-height:250px}.MainMenu{maxheight:64px;border-bottom:1px solid var(--dimmed-1);height:64px;padding:0 2rem}.MainMenu,.RightMenu{background-color:var(--global-background)}.RightMenu{border-left:1px solid var(--dimmed-1);max-width:0;min-width:0;overflow:hidden}.RightMenu[data-is-open=true]{max-width:299px;min-width:299px}.RightMenuInner{wordbreak:break-all;background-color:var(--global-background);border-bottom:1px solid var(--dimmed-1);height:4rem;max-height:4rem;padding:.5rem}.Container{height:calc(100vh - 64px);overflow:auto}.Filter{
|
|
1
|
+
@layer components{.MainContainer{background-color:#f9fafb}.LeftMenu{background-color:var(--global-background);border-right:1px solid var(--dimmed-1);max-width:63px;min-width:63px}.LeftMenu[data-is-open=true]{max-width:279px;min-width:279px}.LeftMenuInner{wordbreak:break-all;background-color:var(--dimmed-1);border-bottom:1px solid var(--dimmed-1);height:64px;max-height:64px;padding:.5rem}.LeftMenuInner[data-is-open=true]{background-color:var(--global-background);height:250px;max-height:250px}.MainMenu{maxheight:64px;border-bottom:1px solid var(--dimmed-1);height:64px;padding:0 2rem}.MainMenu,.RightMenu{background-color:var(--global-background)}.RightMenu{border-left:1px solid var(--dimmed-1);max-width:0;min-width:0;overflow:hidden}.RightMenu[data-is-open=true]{max-width:299px;min-width:299px}.RightMenuInner{wordbreak:break-all;background-color:var(--global-background);border-bottom:1px solid var(--dimmed-1);height:4rem;max-height:4rem;padding:.5rem}.Container{height:calc(100vh - 64px);overflow:auto}.Filter{max-height:calc(100vh - 64px);overflow-y:scroll}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.stories.d.ts","sourceRoot":"","sources":["../../src/examples/shell.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQjE,OAAO,EAGL,SAAS,EAOV,MAAM,cAAc,CAAC;AAItB,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,SAAS,CAG1C,CAAC;AAEF,eAAe,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"shell.stories.d.ts","sourceRoot":"","sources":["../../src/examples/shell.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQjE,OAAO,EAGL,SAAS,EAOV,MAAM,cAAc,CAAC;AAItB,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,SAAS,CAG1C,CAAC;AAEF,eAAe,KAAK,CAAC;AAqJrB,eAAO,MAAM,KAAK,kHAAoB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
4
|
import { useUIDSeed } from 'react-uid';
|
|
5
|
-
import { Button, Card, Container, Disclosure, Grid, IconButton, Menu, Snackbar, Stack, Text,
|
|
5
|
+
import { Button, Card, Container, Disclosure, Grid, IconButton, Menu, Snackbar, Stack, Text, useBreakpoints, useBreakpointsConfig, useSSR, } from '..';
|
|
6
6
|
import * as style from './shell.module.css';
|
|
7
7
|
const story = {
|
|
8
8
|
title: 'Examples/Wireframe',
|
|
@@ -35,6 +35,6 @@ const Template = () => {
|
|
|
35
35
|
}, [isBrowser]);
|
|
36
36
|
return (_jsx(Container, { dimension: "full", padding: false, className: style.MainContainer, children: _jsxs(Stack, { direction: "row", children: [_jsxs(Stack, { id: "LeftMenu", rowGap: 16, className: style.LeftMenu, "data-is-open": isLeftOpen, children: [_jsx("div", { className: style.LeftMenuInner, "data-is-open": isLeftOpen }), isLeftOpen
|
|
37
37
|
? (_jsx("div", { children: linkIcons.map((e, i) => (_jsx(Menu.Item, { disabled: true, value: `${e}`, icon: linkIcons[i], children: e }, seed(`linkMenu${i}`)))) }))
|
|
38
|
-
: (_jsx(Stack, { inline: true, hAlign: "center", rowGap: 8, children: linkIcons.map((e, i) => (_jsx(IconButton, { disabled: true, icon: linkIcons[i], kind: "flat" }, `${e} ${seed(`icons${i}`)}`))) }))] }), _jsxs(Stack, { children: [_jsxs(Stack, { id: "MainMenu", direction: "row", vAlign: "center", hAlign: "space-between", columnGap: 16, className: style.MainMenu, children: [_jsx(Stack, { inline: true, children: _jsx(Button, { kind: "secondary", dimension: "regular", fullWidth: false, onClick: () => setIsLeftOpen(!isLeftOpen), children: "Menu" }) }), _jsx(Stack, { inline: true, children: _jsx(Button, { kind: "secondary", dimension: "regular", fullWidth: false, onClick: () => setIsRightOpen(!isRightOpen), children: "Filters" }) })] }), _jsx(Container, { ref: ref, dimension: containerValue.dimension, className: clsx(style.Container, 'ContainerEx'), children: _jsxs(Stack, { rowGap: 32, vPadding: 32, children: [_jsxs(Snackbar, {
|
|
38
|
+
: (_jsx(Stack, { inline: true, hAlign: "center", rowGap: 8, children: linkIcons.map((e, i) => (_jsx(IconButton, { disabled: true, icon: linkIcons[i], kind: "flat" }, `${e} ${seed(`icons${i}`)}`))) }))] }), _jsxs(Stack, { children: [_jsxs(Stack, { id: "MainMenu", direction: "row", vAlign: "center", hAlign: "space-between", columnGap: 16, className: style.MainMenu, children: [_jsx(Stack, { inline: true, children: _jsx(Button, { kind: "secondary", dimension: "regular", fullWidth: false, onClick: () => setIsLeftOpen(!isLeftOpen), children: "Menu" }) }), _jsx(Stack, { inline: true, children: _jsx(Button, { kind: "secondary", dimension: "regular", fullWidth: false, onClick: () => setIsRightOpen(!isRightOpen), children: "Filters" }) })] }), _jsx(Container, { ref: ref, dimension: containerValue.dimension, className: clsx(style.Container, 'ContainerEx'), children: _jsxs(Stack, { rowGap: 32, vPadding: 32, children: [_jsxs(Snackbar, { title: "Product Card Container", children: [_jsx(Text, { children: `Window Width: ${size}px - Breakpoints Match: ${matches.toUpperCase()}` }), _jsx(Text, { children: `Container Width: ${containerSize}px - Grid Columns: ${containerValue.col} - Grid Gutter: ${containerValue.gutter}px` }), _jsx(Text, { children: `useBreakpointsConfig.value: ${JSON.stringify(containerValue)} - useBreakpointsConfig.matches: ${containerMatches.toUpperCase()}` })] }), _jsx(Grid, { colMinWidth: "1rem", columns: containerValue.col, rowGap: containerValue.gutter, columnGap: containerValue.gutter, filling: false, children: Array(12).fill('Card').map((e, i) => (_jsx(Grid.Item, { children: _jsx(Card, { bordered: true, style: { height: '500px' }, children: _jsx(Stack, { hAlign: "center", children: _jsx(Text, { variant: "body-2", children: `${e} ${i + 1}` }) }) }) }, seed(`cards${i}`)))) })] }) })] }), _jsxs(Stack, { id: "RightMenu", className: style.RightMenu, "data-is-open": isRightOpen, children: [_jsx("div", { className: style.RightMenuInner }), _jsx("div", { className: style.Filter, children: Array(10).fill('Filter').map((e, i) => (_jsxs(Disclosure, { summary: `${e} ${String.fromCharCode(i + 65)}`, children: [_jsx(Menu.Item, { value: "1", subtext: "Hint Text", children: "Menu Item 1" }), _jsx(Menu.Item, { value: "2", subtext: "Hint Text", children: "Menu Item 2" }), _jsx(Menu.Item, { value: "3", subtext: "Hint Text", children: "Menu Item 3" }), _jsx(Menu.Item, { value: "4", subtext: "Hint Text", children: "Menu Item 4" })] }, seed(`filters${i}`)))) })] })] }) }));
|
|
39
39
|
};
|
|
40
40
|
export const Shell = Template.bind({});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/utils/themes.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,qBAAqB,wBAOjC,CAAC;AAEF,eAAO,MAAM,eAAe,wBAId,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
|
-
* Copyright
|
|
2
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
3
|
*
|
|
5
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,7 +13,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
export const getPrefersColorScheme = () => {
|
|
17
|
+
if (typeof window !== 'undefined') {
|
|
18
|
+
const m = window.matchMedia('(prefers-color-scheme: dark)');
|
|
19
|
+
return m.matches ? 'dark' : 'light';
|
|
20
|
+
}
|
|
21
|
+
return 'light';
|
|
22
|
+
};
|
|
23
|
+
export const getCurrentTheme = () => ((typeof window !== 'undefined'
|
|
24
|
+
&& window.document?.querySelector('htlm')?.getAttribute('data-theme') === 'dark')
|
|
25
|
+
? 'dark'
|
|
26
|
+
: 'light');
|