@wonderflow/react-components 10.9.0 → 10.10.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/typography.css +1 -1
- package/core.css +1 -1
- package/dist/components/accordion/accordion-context.d.ts +1 -1
- package/dist/components/accordion/accordion-context.js +1 -1
- package/dist/components/accordion/accordion.d.ts +19 -9
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/accordion.js +1 -2
- package/dist/components/accordion/accordion.module.css +1 -1
- package/dist/components/accordion/accordion.stories.d.ts +18 -6
- package/dist/components/accordion/accordion.stories.d.ts.map +1 -1
- package/dist/components/accordion/accordion.stories.js +4 -3
- package/dist/components/aspect-ratio/aspect-ratio.stories.js +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +2 -2
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +5 -2
- package/dist/components/autocomplete/autocomplete.module.css +1 -1
- package/dist/components/autocomplete/autocomplete.stories.js +2 -2
- package/dist/components/avatar/avatar.module.css +1 -1
- package/dist/components/avatar/avatar.stories.js +1 -1
- package/dist/components/button/button.module.css +1 -1
- package/dist/components/button/button.stories.js +1 -1
- package/dist/components/card/card.module.css +1 -1
- package/dist/components/chip/chip.module.css +1 -1
- package/dist/components/chip/chip.stories.js +1 -1
- package/dist/components/circular-progress/circular-progress.module.css +1 -1
- package/dist/components/circular-progress/circular-progress.stories.js +1 -1
- package/dist/components/clamp-text/clamp-text.module.css +1 -1
- package/dist/components/clamp-text/clamp-text.stories.js +1 -1
- package/dist/components/container/container.module.css +1 -1
- package/dist/components/datetime/datetime.stories.js +1 -1
- package/dist/components/disclosure/disclosure.d.ts.map +1 -1
- package/dist/components/disclosure/disclosure.js +3 -1
- package/dist/components/disclosure/disclosure.module.css +1 -1
- package/dist/components/disclosure/disclosure.stories.js +1 -1
- package/dist/components/drawer/drawer.module.css +1 -1
- package/dist/components/drawer/drawer.stories.js +3 -3
- package/dist/components/elevator/elevator.stories.js +1 -1
- package/dist/components/grid/grid.module.css +1 -1
- package/dist/components/grid/item/grid-item.module.css +1 -1
- package/dist/components/icon-button/icon-button.d.ts +2 -2
- package/dist/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.module.css +1 -1
- package/dist/components/icon-button/icon-button.stories.d.ts +1 -1
- package/dist/components/icon-button/icon-button.stories.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.stories.js +1 -1
- package/dist/components/info-state/info-state.module.css +1 -1
- package/dist/components/info-state/info-state.stories.js +1 -1
- package/dist/components/input-group/input-group.d.ts.map +1 -1
- package/dist/components/input-group/input-group.module.css +1 -1
- package/dist/components/input-group/input-group.stories.js +1 -1
- package/dist/components/linear-progress/linear-progress.module.css +1 -1
- package/dist/components/linear-progress/linear-progress.stories.js +1 -1
- package/dist/components/list/list.d.ts +3 -3
- package/dist/components/list/list.d.ts.map +1 -1
- package/dist/components/list/list.module.css +1 -1
- package/dist/components/list/list.stories.js +1 -1
- package/dist/components/masonry/masonry.module.css +1 -1
- 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.module.css +1 -1
- package/dist/components/menu/menu.stories.js +3 -3
- package/dist/components/modal/content/modal-content.module.css +1 -1
- package/dist/components/modal/modal.module.css +1 -1
- package/dist/components/modal/modal.stories.js +3 -3
- package/dist/components/overlay-container/overlay-container.module.css +1 -1
- package/dist/components/pagination/pagination.module.css +1 -1
- package/dist/components/pagination/pagination.stories.js +1 -1
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +3 -1
- package/dist/components/popover/popover.module.css +1 -1
- package/dist/components/popover/popover.stories.js +6 -6
- package/dist/components/prose/prose.module.css +1 -1
- package/dist/components/prose/prose.stories.js +1 -1
- package/dist/components/select/select.module.css +1 -1
- package/dist/components/select/select.stories.js +1 -1
- package/dist/components/selection-controls/checkbox.stories.js +1 -1
- package/dist/components/selection-controls/radio.stories.js +1 -1
- package/dist/components/selection-controls/selection-controls.module.css +1 -1
- package/dist/components/selection-controls/toggle.stories.js +1 -1
- package/dist/components/separator/separator.module.css +1 -1
- package/dist/components/skeleton/skeleton.module.css +1 -1
- package/dist/components/skeleton/skeleton.stories.js +1 -1
- package/dist/components/slider/slider.module.css +1 -1
- package/dist/components/slider/slider.stories.js +1 -1
- package/dist/components/snackbar/snackbar.module.css +1 -1
- package/dist/components/snackbar/snackbar.stories.js +1 -1
- package/dist/components/spinner/spinner.stories.js +1 -1
- package/dist/components/split-button/split-button.module.css +1 -1
- package/dist/components/split-button/split-button.stories.js +1 -1
- package/dist/components/stack/stack.module.css +1 -1
- package/dist/components/star-meter/star-meter.module.css +1 -1
- package/dist/components/star-meter/star-meter.stories.js +1 -1
- package/dist/components/symbol/symbol.module.css +1 -1
- package/dist/components/symbol/symbol.stories.js +1 -1
- package/dist/components/tab/tab.module.css +1 -1
- package/dist/components/tab/tab.stories.js +1 -1
- package/dist/components/table/table-cell/table-cell.module.css +1 -1
- package/dist/components/table/table-checkbox/table-checkbox.module.css +1 -1
- package/dist/components/table/table-expand/table-expand.module.css +1 -1
- package/dist/components/table/table-header/table-header.module.css +1 -1
- package/dist/components/table/table.module.css +1 -1
- package/dist/components/text/text.module.css +1 -1
- package/dist/components/text/text.stories.js +1 -1
- package/dist/components/textfield/base-field/base-field.d.ts +2 -2
- package/dist/components/textfield/base-field/base-field.d.ts.map +1 -1
- package/dist/components/textfield/base-field/base-field.js +1 -1
- package/dist/components/textfield/base-field/base-field.module.css +1 -1
- package/dist/components/textfield/textfield.d.ts +3 -54
- package/dist/components/textfield/textfield.d.ts.map +1 -1
- package/dist/components/textfield/textfield.js +2 -2
- package/dist/components/textfield/textfield.module.css +1 -1
- package/dist/components/textfield/textfield.stories.d.ts +4 -56
- package/dist/components/textfield/textfield.stories.d.ts.map +1 -1
- package/dist/components/textfield/textfield.stories.js +1 -1
- package/dist/components/title/title.module.css +1 -1
- package/dist/components/title/title.stories.d.ts +1 -0
- package/dist/components/title/title.stories.d.ts.map +1 -1
- package/dist/components/title/title.stories.js +10 -1
- package/dist/components/toggle-button/toggle-button.d.ts +4 -3
- package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/toggle-button/toggle-button.js +4 -4
- package/dist/components/toggle-button/toggle-button.module.css +1 -1
- package/dist/components/toggle-button/toggle-button.stories.d.ts +2 -11
- package/dist/components/toggle-button/toggle-button.stories.d.ts.map +1 -1
- package/dist/components/toggle-button/toggle-button.stories.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.module.css +1 -1
- package/dist/components/tooltip/tooltip.stories.js +1 -1
- package/dist/types/polymorphic/index.d.ts +1 -6
- package/dist/types/polymorphic/index.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import { forwardRef, } from 'react';
|
|
4
4
|
import * as styles from './base-field.module.css';
|
|
5
5
|
export const BaseField = forwardRef(({ as: Wrapper = 'input', invalid, className, ...otherProps }, forwardedRef) => (_jsx(Wrapper, { ref: forwardedRef, "data-basefield-invalid": invalid, className: clsx(styles.BaseField, className), ...otherProps })));
|
|
6
6
|
BaseField.displayName = 'BaseField';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.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;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(--dimmed-6)}.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.5;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}
|
|
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;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(--dimmed-6)}.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.5;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}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChangeEvent } from 'react';
|
|
2
2
|
import { SymbolProps } from '../..';
|
|
3
3
|
import { BaseFieldProps, PrimitiveInputType } from './base-field';
|
|
4
|
-
export declare type TextfieldProps =
|
|
4
|
+
export declare type TextfieldProps<T = Record<string, unknown>> = BaseFieldProps<{
|
|
5
5
|
/**
|
|
6
6
|
* Set the icon to show on the left or right side of the input.
|
|
7
7
|
*/
|
|
@@ -50,57 +50,6 @@ export declare type TextfieldProps = BaseFieldProps & {
|
|
|
50
50
|
* Make the textfield full width, filling the available space.
|
|
51
51
|
*/
|
|
52
52
|
fullWidth?: boolean;
|
|
53
|
-
};
|
|
54
|
-
export declare const Textfield: import("react").ForwardRefExoticComponent<import("react").
|
|
55
|
-
invalid?: boolean | undefined;
|
|
56
|
-
} & {
|
|
57
|
-
/**
|
|
58
|
-
* Set the icon to show on the left or right side of the input.
|
|
59
|
-
*/
|
|
60
|
-
icon?: import("packages/symbols/dist").SymbolNames | import("react").ReactElement<HTMLOrSVGElement, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
61
|
-
/**
|
|
62
|
-
* Set in which side of the field the icon should be displayed.
|
|
63
|
-
*/
|
|
64
|
-
iconPosition?: "left" | "right" | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* Define the accessible label of the input. While this is not
|
|
67
|
-
* mandatory, an input should always have a label. If not using this property
|
|
68
|
-
* you can bind a custom label to the input by using an id.
|
|
69
|
-
*/
|
|
70
|
-
label?: string | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* Set the input type. The value can be anything that
|
|
73
|
-
* is supported by the HTML input element.
|
|
74
|
-
*
|
|
75
|
-
* Read more: https://developer.mozilla.org/en-US/docs/Learn/Forms/HTML5_input_types
|
|
76
|
-
*/
|
|
77
|
-
type?: string | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Set the input to be a textarea instead of a single line field.
|
|
80
|
-
* This property completely changes the rendered element from an input to a textarea.
|
|
81
|
-
*/
|
|
82
|
-
textarea?: boolean | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* Set the size of the field
|
|
85
|
-
*/
|
|
86
|
-
dimension?: "small" | "regular" | "big" | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* Set the field into a readonly state. When readonly, the field value
|
|
89
|
-
* cannot be edited but it can still be selected and copied.
|
|
90
|
-
*/
|
|
91
|
-
readOnly?: boolean | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* Set the field into a disabled state. When disabled, the field value cannot be
|
|
94
|
-
* edited, selected or copied, but it can still be focused and navigated by AT.
|
|
95
|
-
*/
|
|
96
|
-
disabled?: boolean | undefined;
|
|
97
|
-
/**
|
|
98
|
-
* The callback function that is called when the input value changes.
|
|
99
|
-
*/
|
|
100
|
-
onChange?: ((event: ChangeEvent<PrimitiveInputType>) => void) | undefined;
|
|
101
|
-
/**
|
|
102
|
-
* Make the textfield full width, filling the available space.
|
|
103
|
-
*/
|
|
104
|
-
fullWidth?: boolean | undefined;
|
|
105
|
-
} & import("react").RefAttributes<PrimitiveInputType>>;
|
|
53
|
+
}> & T;
|
|
54
|
+
export declare const Textfield: import("react").ForwardRefExoticComponent<Pick<TextfieldProps<Record<string, unknown>>, string> & import("react").RefAttributes<PrimitiveInputType>>;
|
|
106
55
|
//# sourceMappingURL=textfield.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textfield.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACZ,MAAM,OAAO,CAAC;AAGf,OAAO,EACuC,WAAW,EACxD,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAG7E,oBAAY,cAAc,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"textfield.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACZ,MAAM,OAAO,CAAC;AAGf,OAAO,EACuC,WAAW,EACxD,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAG7E,oBAAY,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,cAAc,CAAC;IACvE;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,GAAG,CAAC,CAAA;AAEN,eAAO,MAAM,SAAS,sJA8GpB,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { IconButton, Stack, Symbol, Text, } from '../..';
|
|
|
6
6
|
import { BaseField } from './base-field';
|
|
7
7
|
import * as styles from './textfield.module.css';
|
|
8
8
|
export const Textfield = forwardRef(({ children, className, disabled = false, icon, label, textarea, readOnly, invalid, id, iconPosition = 'right', dimension = 'regular', type, style, onChange, fullWidth, ...otherProps }, forwardedRef) => {
|
|
9
|
-
const [
|
|
9
|
+
const [isPasswordVisible, setPasswordVisible] = useState(false);
|
|
10
10
|
const seedID = useUIDSeed();
|
|
11
11
|
const isPassword = type === 'password';
|
|
12
12
|
const fieldID = useMemo(() => id ?? seedID('field'), [id, seedID]);
|
|
@@ -31,6 +31,6 @@ export const Textfield = forwardRef(({ children, className, disabled = false, ic
|
|
|
31
31
|
};
|
|
32
32
|
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Textfield, className), "data-textfield-has-icon": isPassword || Boolean(icon), "data-textfield-icon-position": iconPosition, "data-textfield-dimension": dimension, "data-textfield-invalid": invalid, "data-textfield-fullwidth": fullWidth, "aria-disabled": disabled, hAlign: "stretch", vAlign: "start", tabIndex: disabled ? 0 : undefined, style: style, children: [label && _jsx(Text, { as: "label", size: dimension === 'small' ? 14 : 16, 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:
|
|
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", icon: isPasswordVisible ? 'eye-slash' : 'eye' })), !textarea && icon && !isPassword && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }))] })] }));
|
|
35
35
|
});
|
|
36
36
|
Textfield.displayName = 'Textfield';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Textfield{appearance:none;padding:0;position:relative}.Textfield[data-textfield-dimension=small]{--field-height:1.50rem;--field-padding:0.33rem;--font-size:0.88rem}.Textfield[data-textfield-dimension=regular]{--field-height:2.50rem;--field-padding:1.00rem;--font-size:1.00rem}.Textfield[data-textfield-dimension=big]{--field-height:3.00rem;--field-padding:1.00rem;--font-size:1.13rem}.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)}.
|
|
1
|
+
@layer components{.Textfield{appearance:none;padding:0;position:relative}.Textfield[data-textfield-dimension=small]{--field-height:1.50rem;--field-padding:0.33rem;--font-size:0.88rem}.Textfield[data-textfield-dimension=regular]{--field-height:2.50rem;--field-padding:1.00rem;--font-size:1.00rem}.Textfield[data-textfield-dimension=big]{--field-height:3.00rem;--field-padding:1.00rem;--font-size:1.13rem}.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)}}@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)}}
|
|
@@ -3,60 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import { Textfield } from './textfield';
|
|
4
4
|
declare const story: ComponentMeta<typeof Textfield>;
|
|
5
5
|
export default story;
|
|
6
|
-
export declare const Single: ComponentStory<React.ForwardRefExoticComponent<React.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
iconPosition?: "left" | "right" | undefined;
|
|
11
|
-
label?: string | undefined;
|
|
12
|
-
type?: string | undefined;
|
|
13
|
-
textarea?: boolean | undefined;
|
|
14
|
-
dimension?: "small" | "regular" | "big" | undefined;
|
|
15
|
-
readOnly?: boolean | undefined;
|
|
16
|
-
disabled?: boolean | undefined;
|
|
17
|
-
onChange?: ((event: React.ChangeEvent<import("./base-field").PrimitiveInputType>) => void) | undefined;
|
|
18
|
-
fullWidth?: boolean | undefined;
|
|
19
|
-
} & React.RefAttributes<import("./base-field").PrimitiveInputType>>>;
|
|
20
|
-
export declare const Types: ComponentStory<React.ForwardRefExoticComponent<React.InputHTMLAttributes<import("./base-field").PrimitiveInputType> & {
|
|
21
|
-
invalid?: boolean | undefined;
|
|
22
|
-
} & {
|
|
23
|
-
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
24
|
-
iconPosition?: "left" | "right" | undefined;
|
|
25
|
-
label?: string | undefined;
|
|
26
|
-
type?: string | undefined;
|
|
27
|
-
textarea?: boolean | undefined;
|
|
28
|
-
dimension?: "small" | "regular" | "big" | undefined;
|
|
29
|
-
readOnly?: boolean | undefined;
|
|
30
|
-
disabled?: boolean | undefined;
|
|
31
|
-
onChange?: ((event: React.ChangeEvent<import("./base-field").PrimitiveInputType>) => void) | undefined;
|
|
32
|
-
fullWidth?: boolean | undefined;
|
|
33
|
-
} & React.RefAttributes<import("./base-field").PrimitiveInputType>>>;
|
|
34
|
-
export declare const Textarea: ComponentStory<React.ForwardRefExoticComponent<React.InputHTMLAttributes<import("./base-field").PrimitiveInputType> & {
|
|
35
|
-
invalid?: boolean | undefined;
|
|
36
|
-
} & {
|
|
37
|
-
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
38
|
-
iconPosition?: "left" | "right" | undefined;
|
|
39
|
-
label?: string | undefined;
|
|
40
|
-
type?: string | undefined;
|
|
41
|
-
textarea?: boolean | undefined;
|
|
42
|
-
dimension?: "small" | "regular" | "big" | undefined;
|
|
43
|
-
readOnly?: boolean | undefined;
|
|
44
|
-
disabled?: boolean | undefined;
|
|
45
|
-
onChange?: ((event: React.ChangeEvent<import("./base-field").PrimitiveInputType>) => void) | undefined;
|
|
46
|
-
fullWidth?: boolean | undefined;
|
|
47
|
-
} & React.RefAttributes<import("./base-field").PrimitiveInputType>>>;
|
|
48
|
-
export declare const WithIcon: ComponentStory<React.ForwardRefExoticComponent<React.InputHTMLAttributes<import("./base-field").PrimitiveInputType> & {
|
|
49
|
-
invalid?: boolean | undefined;
|
|
50
|
-
} & {
|
|
51
|
-
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
52
|
-
iconPosition?: "left" | "right" | undefined;
|
|
53
|
-
label?: string | undefined;
|
|
54
|
-
type?: string | undefined;
|
|
55
|
-
textarea?: boolean | undefined;
|
|
56
|
-
dimension?: "small" | "regular" | "big" | undefined;
|
|
57
|
-
readOnly?: boolean | undefined;
|
|
58
|
-
disabled?: boolean | undefined;
|
|
59
|
-
onChange?: ((event: React.ChangeEvent<import("./base-field").PrimitiveInputType>) => void) | undefined;
|
|
60
|
-
fullWidth?: boolean | undefined;
|
|
61
|
-
} & React.RefAttributes<import("./base-field").PrimitiveInputType>>>;
|
|
6
|
+
export declare const Single: ComponentStory<React.ForwardRefExoticComponent<Pick<import("./textfield").TextfieldProps<Record<string, unknown>>, string> & React.RefAttributes<import("./base-field").PrimitiveInputType>>>;
|
|
7
|
+
export declare const Types: ComponentStory<React.ForwardRefExoticComponent<Pick<import("./textfield").TextfieldProps<Record<string, unknown>>, string> & React.RefAttributes<import("./base-field").PrimitiveInputType>>>;
|
|
8
|
+
export declare const Textarea: ComponentStory<React.ForwardRefExoticComponent<Pick<import("./textfield").TextfieldProps<Record<string, unknown>>, string> & React.RefAttributes<import("./base-field").PrimitiveInputType>>>;
|
|
9
|
+
export declare const WithIcon: ComponentStory<React.ForwardRefExoticComponent<Pick<import("./textfield").TextfieldProps<Record<string, unknown>>, string> & React.RefAttributes<import("./base-field").PrimitiveInputType>>>;
|
|
62
10
|
//# sourceMappingURL=textfield.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textfield.stories.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,SAAS,CAoC1C,CAAC;AAEF,eAAe,KAAK,CAAC;AA4BrB,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"textfield.stories.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,SAAS,CAoC1C,CAAC;AAEF,eAAe,KAAK,CAAC;AA4BrB,eAAO,MAAM,MAAM,+LAA0B,CAAC;AAY9C,eAAO,MAAM,KAAK,+LAA4B,CAAC;AAgB/C,eAAO,MAAM,QAAQ,+LAA4B,CAAC;AAalD,eAAO,MAAM,QAAQ,+LAA0B,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Stack } from '../..';
|
|
3
3
|
import { Textfield } from './textfield';
|
|
4
4
|
const story = {
|
|
5
|
-
title: '
|
|
5
|
+
title: 'Inputs/Textfield',
|
|
6
6
|
component: Textfield,
|
|
7
7
|
args: {
|
|
8
8
|
dimension: 'regular',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Title:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){--lh:1.5;color:var(--heading-foreground,var(--dimmed-9));display:block;font-size:var(--fs-max);line-height:1.2;max-inline-size:var(--max-w,initial);min-block-size:.01vh;overflow-wrap:break-word;text-align:var(--t-align)}.Title[data-title-line-height=small]:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){--lh:1.2}.Title[data-title-line-height=large]:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){line-height:1.5}.Title:is(.H6){--fs-min:0.88rem;--fs-max:1.13rem;font-weight:700}.Title:is(.H5){--fs-min:1rem;--fs-max:1.33rem;font-weight:700}.Title:is(.H5):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H4){--fs-min:1.33rem;--fs-max:1.77rem;font-weight:700}.Title:is(.H4):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H3){--fs-min:1.77rem;--fs-max:2.37rem;font-weight:800}.Title:is(.H3):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H2){--fs-min:2.37rem;--fs-max:3.16rem;font-weight:800}.Title:is(.H2):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H1){--fs-min:3.16rem;--fs-max:4.2rem;font-weight:800}.Title:is(.H1):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title.Display{--fs-min:4.2rem;--fs-max:5.6rem;font-weight:800}.Title.Display:before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title[data-title-responsive=true]{font-size:var(--fs-min)}@media (min-width:48em){.Title[data-title-responsive=true]{font-size:var(--fs-max)}}.Anchor
|
|
1
|
+
@layer components{.Title:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){--lh:1.5;color:var(--heading-foreground,var(--dimmed-9));display:block;font-size:var(--fs-max);line-height:1.2;max-inline-size:var(--max-w,initial);min-block-size:.01vh;overflow-wrap:break-word;text-align:var(--t-align)}.Title[data-title-line-height=small]:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){--lh:1.2}.Title[data-title-line-height=large]:is(.H1,.H2,.H3,.H4,.H5,.H6,.Display){line-height:1.5}.Title:is(.H6){--fs-min:0.88rem;--fs-max:1.13rem;font-weight:700}.Title:is(.H5){--fs-min:1rem;--fs-max:1.33rem;font-weight:700}.Title:is(.H5):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H4){--fs-min:1.33rem;--fs-max:1.77rem;font-weight:700}.Title:is(.H4):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H3){--fs-min:1.77rem;--fs-max:2.37rem;font-weight:800}.Title:is(.H3):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H2){--fs-min:2.37rem;--fs-max:3.16rem;font-weight:800}.Title:is(.H2):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title:is(.H1){--fs-min:3.16rem;--fs-max:4.2rem;font-weight:800}.Title:is(.H1):before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title.Display{--fs-min:4.2rem;--fs-max:5.6rem;font-weight:800}.Title.Display:before{content:"";display:block;height:0;margin-top:calc((1 - var(--lh))*.6em);width:0}.Title[data-title-responsive=true]{font-size:var(--fs-min)}@media (min-width:48em){.Title[data-title-responsive=true]{font-size:var(--fs-max)}}}@layer overrides{.Anchor{align-items:center;background-color:var(--highlight-cyan-background);background-image:none;block-size:max(16px,.6em);border-radius:.5rem;color:var(--heading-foreground,var(--dimmed-9));display:inline-flex;inline-size:max(16px,.6em);justify-content:center;line-height:1;margin-left:.2em;padding:.1em;visibility:hidden}.Title:focus-within .Anchor,.Title:hover .Anchor{visibility:visible}.Anchor svg{height:100%;width:100%}}
|
|
@@ -4,4 +4,5 @@ declare const story: ComponentMeta<typeof Title>;
|
|
|
4
4
|
export default story;
|
|
5
5
|
export declare const Default: ComponentStory<typeof Title>;
|
|
6
6
|
export declare const Single: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"span", import("./title").TitleProps>>;
|
|
7
|
+
export declare const WithAnchor: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"span", import("./title").TitleProps>>;
|
|
7
8
|
//# sourceMappingURL=title.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title.stories.d.ts","sourceRoot":"","sources":["../../../src/components/title/title.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,KAAK,CAuBtC,CAAC;AAEF,eAAe,KAAK,CAAC;AAErB,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,OAAO,KAAK,CAUhD,CAAC;AAQF,eAAO,MAAM,MAAM,6GAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"title.stories.d.ts","sourceRoot":"","sources":["../../../src/components/title/title.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,KAAK,CAuBtC,CAAC;AAEF,eAAe,KAAK,CAAC;AAErB,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,OAAO,KAAK,CAUhD,CAAC;AAQF,eAAO,MAAM,MAAM,6GAAoB,CAAC;AAQxC,eAAO,MAAM,UAAU,6GAAoB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Container } from '../..';
|
|
3
3
|
import { Title } from './title';
|
|
4
4
|
const story = {
|
|
5
|
-
title: '
|
|
5
|
+
title: 'Typography/Title',
|
|
6
6
|
component: Title,
|
|
7
7
|
parameters: {
|
|
8
8
|
controls: { hideNoControlsWarning: true },
|
|
@@ -36,3 +36,12 @@ Single.args = {
|
|
|
36
36
|
maxWidth: 'auto',
|
|
37
37
|
textAlign: 'center',
|
|
38
38
|
};
|
|
39
|
+
export const WithAnchor = Template.bind({});
|
|
40
|
+
WithAnchor.args = {
|
|
41
|
+
as: 'span',
|
|
42
|
+
lineHeight: 'small',
|
|
43
|
+
level: '1',
|
|
44
|
+
maxWidth: 'auto',
|
|
45
|
+
textAlign: 'center',
|
|
46
|
+
anchor: true,
|
|
47
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Except } from 'type-fest';
|
|
2
2
|
import { IconButton, IconButtonProps, Polymorphic } from '../..';
|
|
3
|
-
|
|
3
|
+
declare type OmitIcon<T = Record<string, unknown>> = T extends IconButtonProps ? Except<T, 'icon'> : never;
|
|
4
|
+
export declare type ToggleButtonProps<T = Record<string, unknown>> = OmitIcon & PropsWithClass<{
|
|
4
5
|
/**
|
|
5
6
|
* Set the icon to show when the button is resting.
|
|
6
7
|
*/
|
|
@@ -14,8 +15,8 @@ export declare type ToggleButtonProps = Except<IconButtonProps, 'icon'> & {
|
|
|
14
15
|
* the icon will be shown instead of the resting icon.
|
|
15
16
|
*/
|
|
16
17
|
pressed?: boolean;
|
|
17
|
-
};
|
|
18
|
-
declare type PolymorphicToggleButton = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof IconButton>, Polymorphic.OwnProps<typeof IconButton
|
|
18
|
+
}> & T;
|
|
19
|
+
declare type PolymorphicToggleButton = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof IconButton>, ToggleButtonProps<Polymorphic.OwnProps<typeof IconButton>>>;
|
|
19
20
|
export declare const ToggleButton: PolymorphicToggleButton;
|
|
20
21
|
export {};
|
|
21
22
|
//# sourceMappingURL=toggle-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACL,UAAU,EAAE,eAAe,EAAE,WAAW,EAEzC,MAAM,cAAc,CAAC;AAItB,
|
|
1
|
+
{"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACL,UAAU,EAAE,eAAe,EAAE,WAAW,EAEzC,MAAM,cAAc,CAAC;AAItB,aAAK,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;AAEnG,oBAAY,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,GAAG,cAAc,CAAC;IACrF;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,GAAG,CAAC,CAAA;AAEN,aAAK,uBAAuB,GAAG,WAAW,CAAC,mBAAmB,CAC9D,WAAW,CAAC,gBAAgB,CAAC,OAAO,UAAU,CAAC,EAC/C,iBAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC,CACzD,CAAC;AAqBF,eAAO,MAAM,YAAY,yBA8EI,CAAC"}
|
|
@@ -24,9 +24,9 @@ const scaleAnimation = {
|
|
|
24
24
|
};
|
|
25
25
|
export const ToggleButton = forwardRef(({ className, restingIcon, pressedIcon, dimension, kind, disabled, iconColor, pressed = false, onClick, ...otherProps }, forwardedRef) => {
|
|
26
26
|
const [isPressed, setIsPressed] = useState(pressed);
|
|
27
|
-
const [
|
|
27
|
+
const [isFirstRender, setIsFirstRender] = useState(true);
|
|
28
28
|
useEffect(() => {
|
|
29
|
-
|
|
29
|
+
setIsFirstRender(false);
|
|
30
30
|
}, [pressed]);
|
|
31
31
|
const handleClick = useCallback((event) => {
|
|
32
32
|
setIsPressed(!isPressed);
|
|
@@ -41,6 +41,6 @@ export const ToggleButton = forwardRef(({ className, restingIcon, pressedIcon, d
|
|
|
41
41
|
return (_jsx(Symbol, { source: icon, dimension: iconSize[dimension] }));
|
|
42
42
|
}, []);
|
|
43
43
|
return (_jsx(IconButton, { as: "button", ref: forwardedRef, dimension: dimension, "aria-pressed": isPressed, kind: kind, disabled: disabled, onClick: handleClick, className: clsx(styles.ToggleButton, className), ...otherProps, children: _jsx(LazyMotion, { features: domMax, strict: true, children: isPressed && pressedIcon
|
|
44
|
-
? (_jsx(m.span, { variants: scaleAnimation, initial:
|
|
45
|
-
: restingIcon && (_jsx(m.span, { variants: scaleAnimation, initial:
|
|
44
|
+
? (_jsx(m.span, { variants: scaleAnimation, initial: isFirstRender && isPressed ? false : 'scaleOut', animate: "scaleIn", children: renderIcon(pressedIcon, dimension) }, "pressedIcon"))
|
|
45
|
+
: restingIcon && (_jsx(m.span, { variants: scaleAnimation, initial: isFirstRender && !isPressed ? false : 'scaleOut', animate: "scaleIn", children: renderIcon(restingIcon, dimension) }, "restingIcon")) }) }));
|
|
46
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ToggleButton{border-radius:200px;line-height:0;padding:0}.ToggleButton[aria-pressed=true]{box-shadow:0 0 0 var(--border-width) var(--border-color),0 0 0 var(--border-width) var(--border-color)}.ToggleButton[data-button-kind=primary]{--border-color:rgba(207,42,67,.25)}.ToggleButton[data-button-kind=primary][aria-pressed=true]{background:none;color:var(--cta-default)}.ToggleButton[data-button-kind=secondary]{--border-color:var(--dimmed-2)}.ToggleButton[data-button-kind=secondary][aria-pressed=true]{background:none;color:var(--global-vibrancy-foreground)}.ToggleButton[data-button-kind=flat]{--border-color:var(--dimmed-2)}.ToggleButton[data-button-kind=flat][aria-pressed=true]{background:none;color:var(--global-vibrancy-foreground)}.ToggleButton[data-button-dimension=small]{--border-width:2px}.ToggleButton[data-button-dimension=regular]{--border-width:4px}.ToggleButton[data-button-dimension=big]{--border-width:6px}
|
|
1
|
+
@layer components{.ToggleButton{border-radius:200px;line-height:0;padding:0}.ToggleButton[aria-pressed=true]{box-shadow:0 0 0 var(--border-width) var(--border-color),0 0 0 var(--border-width) var(--border-color)}.ToggleButton[data-button-kind=primary]{--border-color:rgba(207,42,67,.25)}.ToggleButton[data-button-kind=primary][aria-pressed=true]{background:none;color:var(--cta-default)}.ToggleButton[data-button-kind=secondary]{--border-color:var(--dimmed-2)}.ToggleButton[data-button-kind=secondary][aria-pressed=true]{background:none;color:var(--global-vibrancy-foreground)}.ToggleButton[data-button-kind=flat]{--border-color:var(--dimmed-2)}.ToggleButton[data-button-kind=flat][aria-pressed=true]{background:none;color:var(--global-vibrancy-foreground)}.ToggleButton[data-button-dimension=small]{--border-width:2px}.ToggleButton[data-button-dimension=regular]{--border-width:4px}.ToggleButton[data-button-dimension=big]{--border-width:6px}}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import { ToggleButton } from './toggle-button';
|
|
4
3
|
declare const story: ComponentMeta<typeof ToggleButton>;
|
|
5
4
|
export default story;
|
|
6
|
-
export declare const Default: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"button", import("
|
|
7
|
-
|
|
8
|
-
pressedIcon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
9
|
-
pressed?: boolean | undefined;
|
|
10
|
-
}>>;
|
|
11
|
-
export declare const MultipleIcons: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"button", import("..").ButtonProps & import("..").IconButtonProps & import("type-fest").Except<import("..").IconButtonProps, "icon"> & {
|
|
12
|
-
restingIcon: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
13
|
-
pressedIcon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
14
|
-
pressed?: boolean | undefined;
|
|
15
|
-
}>>;
|
|
5
|
+
export declare const Default: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"button", import("./toggle-button").ToggleButtonProps<import("..").IconButtonProps<import("..").ButtonProps>>>>;
|
|
6
|
+
export declare const MultipleIcons: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"button", import("./toggle-button").ToggleButtonProps<import("..").IconButtonProps<import("..").ButtonProps>>>>;
|
|
16
7
|
//# sourceMappingURL=toggle-button.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"toggle-button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,YAAY,CAmB7C,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,OAAO,sLAAoB,CAAC;AAEzC,eAAO,MAAM,aAAa,sLAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EACgE,SAAS,EAC/E,MAAM,OAAO,CAAC;AAQf,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,eAAe,CAAC,YAAY,CAiFjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Tooltip{display:contents}.Balloon{word-wrap:break-word;background-color:#31363f;border-radius:.25rem;font-size:1rem;max-inline-size:var(--max-w);padding:.5rem 1rem;position:relative;z-index:2}.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%) rotate(45deg)}.Balloon[data-popper-placement^=left] .Arrow{right:6px}.Balloon[data-popper-placement^=left] .Arrow:before{transform:translateY(-50%) rotate(45deg)}.Balloon[data-popper-placement^=bottom] .Arrow{top:-6px}.Balloon[data-popper-placement^=bottom] .Arrow:before{transform:translateX(-50%) rotate(45deg)}.Balloon[data-popper-placement^=right] .Arrow{left:-6px}.Balloon[data-popper-placement^=right] .Arrow:before{transform:translateY(-50%) rotate(45deg)}
|
|
1
|
+
@layer components{.Tooltip{display:contents}.Balloon{word-wrap:break-word;background-color:#31363f;border-radius:.25rem;font-size:1rem;max-inline-size:var(--max-w);padding:.5rem 1rem;position:relative;z-index:2}.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%) rotate(45deg)}.Balloon[data-popper-placement^=left] .Arrow{right:6px}.Balloon[data-popper-placement^=left] .Arrow:before{transform:translateY(-50%) rotate(45deg)}.Balloon[data-popper-placement^=bottom] .Arrow{top:-6px}.Balloon[data-popper-placement^=bottom] .Arrow:before{transform:translateX(-50%) rotate(45deg)}.Balloon[data-popper-placement^=right] .Arrow{left:-6px}.Balloon[data-popper-placement^=right] .Arrow:before{transform:translateY(-50%) rotate(45deg)}}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Button, Text } from '../..';
|
|
3
3
|
import { Tooltip } from './tooltip';
|
|
4
4
|
const story = {
|
|
5
|
-
title: '
|
|
5
|
+
title: 'Dialogs/Tooltip',
|
|
6
6
|
component: Tooltip,
|
|
7
7
|
args: {
|
|
8
8
|
trigger: _jsx(Text, { as: "span", children: "HTML" }),
|
|
@@ -17,12 +17,7 @@ declare type IntrinsicElement<E> = E extends ForwardRefComponent<infer I, any> ?
|
|
|
17
17
|
declare type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
|
|
18
18
|
as?: E;
|
|
19
19
|
}>>;
|
|
20
|
-
interface ForwardRefComponent<IntrinsicElementString, OwnProps = Record<string, unknown>
|
|
21
|
-
/**
|
|
22
|
-
* Extends original type to ensure built in React types play nice
|
|
23
|
-
* with polymorphic components still e.g. `React.ElementRef` etc.
|
|
24
|
-
*/
|
|
25
|
-
> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
|
|
20
|
+
interface ForwardRefComponent<IntrinsicElementString, OwnProps = Record<string, unknown>> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
|
|
26
21
|
/**
|
|
27
22
|
* When `as` prop is passed, use this overload.
|
|
28
23
|
* Merges original own props (without DOM props) and the inferred props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/polymorphic/index.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,aAAK,KAAK,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;AAEjG;;GAEG;AACH,aAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7F;;GAEG;AACH,aAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,mBAAmB,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEnF,aAAK,yBAAyB,CAAC,CAAC,EAAE,QAAQ,IAAI,KAAK,CAAC,yBAAyB,CAC7E,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,QAAQ,GAAG;IAAE,EAAE,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CACjG,CAAC;AAMF,UAAU,mBAAmB,CAC3B,sBAAsB,EACtB,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/polymorphic/index.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,aAAK,KAAK,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;AAEjG;;GAEG;AACH,aAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7F;;GAEG;AACH,aAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,mBAAmB,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEnF,aAAK,yBAAyB,CAAC,CAAC,EAAE,QAAQ,IAAI,KAAK,CAAC,yBAAyB,CAC7E,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,QAAQ,GAAG;IAAE,EAAE,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CACjG,CAAC;AAMF,UAAU,mBAAmB,CAC3B,sBAAsB,EACtB,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKlC,SAAQ,yBAAyB,CAAC,sBAAsB,EAAE,QAAQ,CAAC;IACnE;;;;;;;OAOG;IACH,CAAC,EAAE,GAAG,sBAAsB,EAC1B,KAAK,EAAE,EAAE,SAAS,EAAE,GAChB;QAAE,EAAE,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAA;KAAE,GACnC,EAAE,SAAS,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GACrC,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG;QAAE,EAAE,EAAE,EAAE,CAAA;KAAE,CAAC,GAC/B,EAAE,SAAS,MAAM,GAAG,CAAC,iBAAiB,GACpC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG;QAAE,EAAE,EAAE,EAAE,CAAA;KAAE,CAAC,GACvD,KAAK,GACZ,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;CAC9B;AAED,YAAY,EACV,mBAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,GACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.10.0",
|
|
4
4
|
"description": "UI components from Wonderflow's Wanda design system",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,22 +59,22 @@
|
|
|
59
59
|
"react-dom": ">=17.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/core": "7.19.
|
|
62
|
+
"@babel/core": "7.19.1",
|
|
63
63
|
"@babel/preset-typescript": "7.18.6",
|
|
64
|
-
"@storybook/addon-actions": "6.5.
|
|
65
|
-
"@storybook/addon-essentials": "6.5.
|
|
66
|
-
"@storybook/addon-links": "6.5.
|
|
64
|
+
"@storybook/addon-actions": "6.5.12",
|
|
65
|
+
"@storybook/addon-essentials": "6.5.12",
|
|
66
|
+
"@storybook/addon-links": "6.5.12",
|
|
67
67
|
"@storybook/addon-postcss": "2.0.0",
|
|
68
|
-
"@storybook/addons": "6.5.
|
|
69
|
-
"@storybook/builder-webpack5": "6.5.
|
|
70
|
-
"@storybook/manager-webpack5": "6.5.
|
|
71
|
-
"@storybook/react": "6.5.
|
|
72
|
-
"@storybook/theming": "6.5.
|
|
68
|
+
"@storybook/addons": "6.5.12",
|
|
69
|
+
"@storybook/builder-webpack5": "6.5.12",
|
|
70
|
+
"@storybook/manager-webpack5": "6.5.12",
|
|
71
|
+
"@storybook/react": "6.5.12",
|
|
72
|
+
"@storybook/theming": "6.5.12",
|
|
73
73
|
"@types/react": "17.0.43",
|
|
74
74
|
"@types/react-dom": "17.0.14",
|
|
75
75
|
"@types/react-table": "7.7.12",
|
|
76
|
-
"@wonderflow/config": "10.
|
|
77
|
-
"@wonderflow/tokens": "10.
|
|
76
|
+
"@wonderflow/config": "10.10.0",
|
|
77
|
+
"@wonderflow/tokens": "10.10.0",
|
|
78
78
|
"babel-loader": "8.2.5",
|
|
79
79
|
"cpy-cli": "3.1.1",
|
|
80
80
|
"postcss": "8.4.16",
|