@mrshmllw/smores-react 14.1.1 → 14.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.js +5 -3
- package/dist/Accordion/Accordion.js.map +1 -1
- package/dist/ActionDropdown/ActionDropdown.js +6 -2
- package/dist/ActionDropdown/ActionDropdown.js.map +1 -1
- package/dist/Alert/Alert.js +9 -8
- package/dist/Alert/Alert.js.map +1 -1
- package/dist/Banner/BannerItem.js +8 -2
- package/dist/Banner/BannerItem.js.map +1 -1
- package/dist/Banner/types.d.ts +3 -1
- package/dist/Banner/types.js.map +1 -1
- package/dist/Box/index.d.ts +1 -0
- package/dist/Box/index.js.map +1 -1
- package/dist/Button/Button.d.ts +2 -1
- package/dist/Button/Button.js +5 -3
- package/dist/Button/Button.js.map +1 -1
- package/dist/Card/Card.d.ts +2 -16
- package/dist/Card/Card.js +7 -4
- package/dist/Card/Card.js.map +1 -1
- package/dist/Chip/Chip.d.ts +2 -1
- package/dist/Chip/Chip.js +11 -3
- package/dist/Chip/Chip.js.map +1 -1
- package/dist/CurrencyInput/CurrencyInput.js +6 -3
- package/dist/CurrencyInput/CurrencyInput.js.map +1 -1
- package/dist/Datepicker/Datepicker.js +7 -4
- package/dist/Datepicker/Datepicker.js.map +1 -1
- package/dist/Dropdown/Dropdown.d.ts +3 -2
- package/dist/Dropdown/Dropdown.js +11 -7
- package/dist/Dropdown/Dropdown.js.map +1 -1
- package/dist/Dropdown/index.d.ts +1 -1
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Icon/Icon.js +5 -0
- package/dist/Icon/Icon.js.map +1 -1
- package/dist/Icon/index.d.ts +1 -0
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconStrict/IconStrict.d.ts +1 -1
- package/dist/IconStrict/IconStrict.js +5 -0
- package/dist/IconStrict/IconStrict.js.map +1 -1
- package/dist/IconWrapper/IconWrapper.d.ts +1 -1
- package/dist/IconWrapper/IconWrapper.js.map +1 -1
- package/dist/Link/Link.d.ts +2 -1
- package/dist/Link/Link.js +7 -2
- package/dist/Link/Link.js.map +1 -1
- package/dist/Modal/Modal.js +12 -3
- package/dist/Modal/Modal.js.map +1 -1
- package/dist/NumberInput/NumberInput.js +11 -6
- package/dist/NumberInput/NumberInput.js.map +1 -1
- package/dist/Pagination/Pagination.js +5 -3
- package/dist/Pagination/Pagination.js.map +1 -1
- package/dist/ProgressIndicator/components/StepItem.js +6 -3
- package/dist/ProgressIndicator/components/StepItem.js.map +1 -1
- package/dist/RadioGroup/RadioGroup.d.ts +3 -2
- package/dist/RadioGroup/RadioGroup.js +1 -1
- package/dist/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/RadioGroup/RadioItem.d.ts +3 -2
- package/dist/RadioGroup/RadioItem.js +7 -2
- package/dist/RadioGroup/RadioItem.js.map +1 -1
- package/dist/RichText/RichText.js +4 -2
- package/dist/RichText/RichText.js.map +1 -1
- package/dist/RichTextEditor/plugins/ToolbarPlugin.js +7 -5
- package/dist/RichTextEditor/plugins/ToolbarPlugin.js.map +1 -1
- package/dist/Row/Row.d.ts +4 -2
- package/dist/Row/Row.js +8 -3
- package/dist/Row/Row.js.map +1 -1
- package/dist/SearchInput/SearchInput.d.ts +0 -9
- package/dist/SearchInput/SearchInput.js +11 -6
- package/dist/SearchInput/SearchInput.js.map +1 -1
- package/dist/Snackbar/SnackbarItem.js +8 -3
- package/dist/Snackbar/SnackbarItem.js.map +1 -1
- package/dist/Snackbar/types.d.ts +2 -1
- package/dist/Snackbar/types.js.map +1 -1
- package/dist/SupportMessage/SupportMessage.js +11 -10
- package/dist/SupportMessage/SupportMessage.js.map +1 -1
- package/dist/Table/index.d.ts +1 -0
- package/dist/Table/index.js.map +1 -1
- package/dist/Tag/Tag.d.ts +3 -2
- package/dist/Tag/Tag.js +4 -2
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Tag/Tag.spec.js +10 -0
- package/dist/Tag/Tag.spec.js.map +1 -1
- package/dist/TextInput/TextInput.js +8 -4
- package/dist/TextInput/TextInput.js.map +1 -1
- package/dist/ThemeProvider/utils/colourMap.d.ts +2 -8
- package/dist/ThemeProvider/utils/colourMap.js.map +1 -1
- package/dist/fields/commonFieldTypes.d.ts +3 -1
- package/dist/fields/commonFieldTypes.js.map +1 -1
- package/dist/fields/components/CommonInput.d.ts +10 -2
- package/dist/fields/components/CommonInput.js +16 -0
- package/dist/fields/components/CommonInput.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/sharedStyles/shared.styles.d.ts +5 -0
- package/dist/sharedStyles/shared.styles.js +22 -0
- package/dist/sharedStyles/shared.styles.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/deprecated.js +8 -2
- package/dist/utils/deprecated.js.map +1 -1
- package/dist/utils/flex.d.ts +4 -1
- package/dist/utils/flex.js +4 -4
- package/dist/utils/flex.js.map +1 -1
- package/dist/utils/space.d.ts +12 -5
- package/dist/utils/space.js +31 -21
- package/dist/utils/space.js.map +1 -1
- package/package.json +30 -27
package/dist/Tag/Tag.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.spec.js","sourceRoot":"","sources":["../../src/Tag/Tag.spec.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAG5B,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAC1B,KAAC,GAAG,IACF,KAAK,EAAC,mBAAmB,EACzB,KAAK,EAAC,gCAAgC,EACtC,OAAO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5F,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,YAAY;SACP;KACd;CACF,CAAA;AAED,MAAM,2BAA2B,GAAG;IAClC;QACE,WAAW,EAAE,sCAAsC;QACnD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,KAAK,EAAE,6BAA6B;YACpC,OAAO,EAAE,6BAA6B;SAC3B;KACd;IACD;QACE,WAAW,EAAE,oDAAoD;QACjE,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,KAAK,EAAE,6BAA6B;YACpC,OAAO,EAAE,6BAA6B;YACtC,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,gCAAgC;SAChC;KACd;IACD;QACE,WAAW,EACT,gHAAgH;QAClH,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,KAAK,EAAE,6BAA6B;YACpC,OAAO,EAAE,6BAA6B;YACtC,SAAS,EAAE,gCAAgC;SAChC;KACd;IACD;QACE,WAAW,EACT,0FAA0F;QAC5F,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,KAAK,EAAE,6BAA6B;YACpC,OAAO,EAAE,6BAA6B;YACtC,IAAI,EAAE,YAAY;SACP;KACd;CACF,CAAA","sourcesContent":["import { render, screen } from '../testUtils'\nimport { it, expect } from 'vitest'\nimport { Tag } from '../Tag'\nimport { TagProps } from './Tag'\n\ndescribe('Tag Component', () => {\n it('renders snapshot test correctly', () => {\n const { container } = render(\n <Tag\n label=\"Snapshot Test Tag\"\n color=\"color.illustration.neutral.400\"\n bgColor=\"extended1.20\"\n />,\n )\n expect(container).toMatchSnapshot()\n })\n\n describe('old colour name', () => {\n testCases.forEach(({ description, props }) => {\n test(description, () => {\n const { container } = render(<Tag {...props} />)\n\n expect(screen.getByText(props.label)).toBeInTheDocument()\n\n if (props.icon) {\n const iconElement = screen.getByTestId(`tag-icon-${props.icon}`)\n expect(iconElement).toBeInTheDocument()\n } else {\n const iconElement = screen.queryByTestId(`tag-icon-${props.icon}`)\n expect(iconElement).not.toBeInTheDocument()\n }\n\n expect(container.firstChild).toHaveStyle('backgroundColor: #d2d2d2')\n })\n })\n })\n describe('new colour name', () => {\n testCasesWithNewColourNames.forEach(({ description, props }) => {\n test(description, () => {\n const { container } = render(<Tag {...props} />)\n\n expect(screen.getByText(props.label)).toBeInTheDocument()\n\n if (props.icon) {\n const iconElement = screen.getByTestId(`tag-icon-${props.icon}`)\n expect(iconElement).toBeInTheDocument()\n } else {\n const iconElement = screen.queryByTestId(`tag-icon-${props.icon}`)\n expect(iconElement).not.toBeInTheDocument()\n }\n\n expect(container.firstChild).toHaveStyle('backgroundColor: #d2d2d2')\n })\n })\n })\n})\n\nconst testCases = [\n {\n description: 'Renders Tag with label Test Tag 0001',\n props: {\n label: 'Test Tag 0001',\n color: 'apple',\n bgColor: 'chia',\n } as TagProps,\n },\n {\n description: 'Renders Tag with label Test Tag 0002 and flag icon',\n props: {\n label: 'Test Tag 0002',\n color: 'apple',\n bgColor: 'chia',\n icon: 'flag',\n iconColor: 'color.illustration.accent2.200',\n } as TagProps,\n },\n {\n description:\n 'Renders Tag with label Test Tag 0003 and no icon if iconColor: color.illustration.accent2.200, icon: undefined',\n props: {\n label: 'Test Tag 0003',\n color: 'apple',\n bgColor: 'chia',\n iconColor: 'color.illustration.accent2.200',\n } as TagProps,\n },\n {\n description:\n 'Renders Tag with label Test Tag 0004 and icon with default color if iconColor: undefined',\n props: {\n label: 'Test Tag 0004',\n color: 'apple',\n bgColor: 'chia',\n icon: 'flagFilled',\n } as TagProps,\n },\n]\n\nconst testCasesWithNewColourNames = [\n {\n description: 'Renders Tag with label Test Tag 0001',\n props: {\n label: 'Test Tag 0001',\n color: 'color.feedback.positive.200',\n bgColor: 'color.feedback.inactive.100',\n } as TagProps,\n },\n {\n description: 'Renders Tag with label Test Tag 0002 and flag icon',\n props: {\n label: 'Test Tag 0002',\n color: 'color.feedback.positive.200',\n bgColor: 'color.feedback.inactive.100',\n icon: 'flag',\n iconColor: 'color.illustration.accent2.200',\n } as TagProps,\n },\n {\n description:\n 'Renders Tag with label Test Tag 0003 and no icon if iconColor: color.illustration.accent2.200, icon: undefined',\n props: {\n label: 'Test Tag 0003',\n color: 'color.feedback.positive.200',\n bgColor: 'color.feedback.inactive.100',\n iconColor: 'color.illustration.accent2.200',\n } as TagProps,\n },\n {\n description:\n 'Renders Tag with label Test Tag 0004 and icon with default color if iconColor: undefined',\n props: {\n label: 'Test Tag 0004',\n color: 'color.feedback.positive.200',\n bgColor: 'color.feedback.inactive.100',\n icon: 'flagFilled',\n } as TagProps,\n },\n]\n"]}
|
|
1
|
+
{"version":3,"file":"Tag.spec.js","sourceRoot":"","sources":["../../src/Tag/Tag.spec.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAG5B,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,8BAAkB,iBAAiB,GAAG,CAAA;AAE/D,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAC1B,KAAC,GAAG,IACF,KAAK,EAAC,mBAAmB,EACzB,KAAK,EAAC,gCAAgC,EACtC,OAAO,EAAC,cAAc,GACtB,CACH,CAAA;QACD,MAAM,CAAC,SAAS,CAAC,CAAC,eAAe,EAAE,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE;YAC3C,IAAI,CAAC,WAAW,EAAE,GAAG,E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B;YACtC,IAAI,EAAE,YAAY;SACP;KACd;CACF,CAAA","sourcesContent":["import { render, screen } from '../testUtils'\nimport { it, expect } from 'vitest'\nimport { Tag } from '../Tag'\nimport { TagProps } from './Tag'\n\nconst CustomIcon = () => <span data-testid=\"tag-custom-icon\" />\n\ndescribe('Tag Component', () => {\n it('renders snapshot test correctly', () => {\n const { container } = render(\n <Tag\n label=\"Snapshot Test Tag\"\n color=\"color.illustration.neutral.400\"\n bgColor=\"extended1.20\"\n />,\n )\n expect(container).toMatchSnapshot()\n })\n\n describe('old colour name', () => {\n testCases.forEach(({ description, props }) => {\n test(description, () => {\n const { container } = render(<Tag {...props} />)\n\n expect(screen.getByText(props.label)).toBeInTheDocument()\n\n if (props.icon) {\n const iconElement = screen.getByTestId(`tag-icon-${props.icon}`)\n expect(iconElement).toBeInTheDocument()\n } else {\n const iconElement = screen.queryByTestId(`tag-icon-${props.icon}`)\n expect(iconElement).not.toBeInTheDocument()\n }\n\n expect(container.firstChild).toHaveStyle('backgroundColor: #d2d2d2')\n })\n })\n })\n describe('new colour name', () => {\n testCasesWithNewColourNames.forEach(({ description, props }) => {\n test(description, () => {\n const { container } = render(<Tag {...props} />)\n\n expect(screen.getByText(props.label)).toBeInTheDocument()\n\n if (props.icon) {\n const iconElement = screen.getByTestId(`tag-icon-${props.icon}`)\n expect(iconElement).toBeInTheDocument()\n } else {\n const iconElement = screen.queryByTestId(`tag-icon-${props.icon}`)\n expect(iconElement).not.toBeInTheDocument()\n }\n\n expect(container.firstChild).toHaveStyle('backgroundColor: #d2d2d2')\n })\n })\n })\n\n it('renders a custom icon component when provided', () => {\n render(\n <Tag\n label=\"Tag with Custom Icon\"\n color=\"apple\"\n bgColor=\"chia\"\n icon=\"flag\"\n iconComponent={<CustomIcon />}\n />,\n )\n\n expect(screen.getByTestId('tag-custom-icon')).toBeInTheDocument()\n expect(screen.queryByTestId('tag-icon-flag')).not.toBeInTheDocument()\n })\n\n it('renders without an icon when none is provided', () => {\n const { container } = render(\n <Tag label=\"Tag without Icon\" color=\"apple\" bgColor=\"chia\" />,\n )\n\n expect(container.querySelector('[data-testid$=\"-icon\"]')).toBeNull()\n })\n})\n\nconst testCases = [\n {\n description: 'Renders Tag with label Test Tag 0001',\n props: {\n label: 'Test Tag 0001',\n color: 'apple',\n bgColor: 'chia',\n } as TagProps,\n },\n {\n description: 'Renders Tag with label Test Tag 0002 and flag icon',\n props: {\n label: 'Test Tag 0002',\n color: 'apple',\n bgColor: 'chia',\n icon: 'flag',\n iconColor: 'color.illustration.accent2.200',\n } as TagProps,\n },\n {\n description:\n 'Renders Tag with label Test Tag 0003 and no icon if iconColor: color.illustration.accent2.200, icon: undefined',\n props: {\n label: 'Test Tag 0003',\n color: 'apple',\n bgColor: 'chia',\n iconColor: 'color.illustration.accent2.200',\n } as TagProps,\n },\n {\n description:\n 'Renders Tag with label Test Tag 0004 and icon with default color if iconColor: undefined',\n props: {\n label: 'Test Tag 0004',\n color: 'apple',\n bgColor: 'chia',\n icon: 'flagFilled',\n } as TagProps,\n },\n]\n\nconst testCasesWithNewColourNames = [\n {\n description: 'Renders Tag with label Test Tag 0001',\n props: {\n label: 'Test Tag 0001',\n color: 'color.feedback.positive.200',\n bgColor: 'color.feedback.inactive.100',\n } as TagProps,\n },\n {\n description: 'Renders Tag with label Test Tag 0002 and flag icon',\n props: {\n label: 'Test Tag 0002',\n color: 'color.feedback.positive.200',\n bgColor: 'color.feedback.inactive.100',\n icon: 'flag',\n iconColor: 'color.illustration.accent2.200',\n } as TagProps,\n },\n {\n description:\n 'Renders Tag with label Test Tag 0003 and no icon if iconColor: color.illustration.accent2.200, icon: undefined',\n props: {\n label: 'Test Tag 0003',\n color: 'color.feedback.positive.200',\n bgColor: 'color.feedback.inactive.100',\n iconColor: 'color.illustration.accent2.200',\n } as TagProps,\n },\n {\n description:\n 'Renders Tag with label Test Tag 0004 and icon with default color if iconColor: undefined',\n props: {\n label: 'Test Tag 0004',\n color: 'color.feedback.positive.200',\n bgColor: 'color.feedback.inactive.100',\n icon: 'flagFilled',\n } as TagProps,\n },\n]\n"]}
|
|
@@ -2,8 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, } from 'react';
|
|
3
3
|
import { Box } from '../Box';
|
|
4
4
|
import { Field } from '../fields/Field';
|
|
5
|
-
import { Input, StyledFrontIcon, StyledTrailingIcon, } from '../fields/components/CommonInput';
|
|
5
|
+
import { Input, InputLeadingIconContainer, StyledFrontIcon, StyledTrailingIcon, } from '../fields/components/CommonInput';
|
|
6
6
|
import { useUniqueId } from '../utils/id';
|
|
7
|
+
import { useTheme } from 'styled-components';
|
|
7
8
|
/**
|
|
8
9
|
* A reusable TextInput component that supports various input types, custom styling, icons,
|
|
9
10
|
* and autofill detection.
|
|
@@ -12,16 +13,19 @@ import { useUniqueId } from '../utils/id';
|
|
|
12
13
|
* - `onAutoFill` triggers after animation end (animation duration is 2s),
|
|
13
14
|
* the animation starts when a user selects or hovers over an autofill option
|
|
14
15
|
*/
|
|
15
|
-
export const TextInput = forwardRef(function TextInput({ id: idProp, type = 'text', placeholder, name, value, error = false, onBlur, onChange, onInputChange, onAutoFill, disabled = false, frontIcon, trailingIcon, fallbackStyle, autoCompleteAttr = 'off', inputModeAttr, ...fieldProps }, ref) {
|
|
16
|
+
export const TextInput = forwardRef(function TextInput({ id: idProp, type = 'text', placeholder, name, value, error = false, onBlur, onChange, onInputChange, onAutoFill, disabled = false, frontIcon, frontIconComponent, trailingIconComponent, trailingIcon, fallbackStyle, autoCompleteAttr = 'off', inputModeAttr, ...fieldProps }, ref) {
|
|
16
17
|
const id = useUniqueId(idProp);
|
|
18
|
+
const theme = useTheme();
|
|
17
19
|
const handleAnimationEnd = (e) => {
|
|
18
20
|
if (e.animationName === 'onAutoFillStart' && onAutoFill && !!value) {
|
|
19
21
|
onAutoFill();
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
|
-
|
|
24
|
+
const frontIconToRender = frontIconComponent ? (_jsx(InputLeadingIconContainer, { "$size": 20, "$iconColor": theme.color.text.subtle, children: frontIconComponent })) : frontIcon ? (_jsx(StyledFrontIcon, { "$disabled": disabled, render: frontIcon, color: "color.icon.base" })) : null;
|
|
25
|
+
const trailingIconToRender = trailingIconComponent ? (_jsx(InputLeadingIconContainer, { "$size": 20, "$iconColor": theme.color.text.subtle, children: trailingIconComponent })) : trailingIcon ? (_jsx(StyledTrailingIcon, { "$disabled": disabled, render: trailingIcon, color: "color.icon.base" })) : null;
|
|
26
|
+
return (_jsx(Field, { ...fieldProps, htmlFor: id, error: error, children: _jsxs(Box, { flex: true, alignItems: "center", justifyContent: "flex-start", children: [frontIconToRender && frontIconToRender, _jsx(Input, { disabled: disabled, type: type, id: id, name: name, ref: ref, onAnimationEnd: handleAnimationEnd, placeholder: placeholder, value: value, "$error": error, "$frontIcon": Boolean(frontIconToRender), "$fallbackStyle": fallbackStyle, autoComplete: autoCompleteAttr, onChange: (e) => {
|
|
23
27
|
onChange?.(e.currentTarget.value);
|
|
24
28
|
onInputChange?.(e);
|
|
25
|
-
}, onBlur: onBlur, inputMode: inputModeAttr }),
|
|
29
|
+
}, onBlur: onBlur, inputMode: inputModeAttr }), trailingIconToRender && trailingIconToRender] }) }));
|
|
26
30
|
});
|
|
27
31
|
//# sourceMappingURL=TextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,UAAU,GAEX,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,OAAO,EACL,KAAK,EACL,eAAe,EACf,kBAAkB,GACnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"T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BAAoB,IAAI,oBAAoB,IACzC,GACA,CACT,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import {\n FocusEvent,\n AnimationEvent,\n FormEvent,\n ForwardedRef,\n forwardRef,\n HTMLInputAutoCompleteAttribute,\n} from 'react'\n\nimport { Box } from '../Box'\nimport { Field } from '../fields/Field'\nimport { CommonFieldProps } from '../fields/commonFieldTypes'\nimport {\n Input,\n InputLeadingIconContainer,\n StyledFrontIcon,\n StyledTrailingIcon,\n} from '../fields/components/CommonInput'\nimport { useUniqueId } from '../utils/id'\nimport { useTheme } from 'styled-components'\n\ninterface Props extends CommonFieldProps {\n type?: 'text' | 'email' | 'password' | 'time' | 'date' | 'tel'\n placeholder: string\n name?: string\n value: string\n onBlur?: (e: FocusEvent<HTMLInputElement>) => void\n /**\n * Triggers after animation end (animation duration is 2s),\n * the animation starts when a user selects or hovers over an autofill option\n */\n onAutoFill?: () => void\n}\n\ntype InputMode = 'text' | 'email' | 'numeric'\n\n/** on change or on input required */\ntype InputProps = (\n | {\n /** on change is required and on input optional */\n onChange: (e: string) => void\n onInputChange?: (e: FormEvent<HTMLInputElement>) => void\n }\n | {\n /** on input is required and on change optional */\n onChange?: (e: string) => void\n onInputChange: (e: FormEvent<HTMLInputElement>) => void\n }\n) & {\n autoCompleteAttr?: HTMLInputAutoCompleteAttribute\n inputModeAttr?: InputMode\n}\n\nexport type TextInputProps = Props & InputProps\n\n/**\n * A reusable TextInput component that supports various input types, custom styling, icons,\n * and autofill detection.\n *\n * ### Caveats:\n * - `onAutoFill` triggers after animation end (animation duration is 2s),\n * the animation starts when a user selects or hovers over an autofill option\n */\nexport const TextInput = forwardRef(function TextInput(\n {\n id: idProp,\n type = 'text',\n placeholder,\n name,\n value,\n error = false,\n onBlur,\n onChange,\n onInputChange,\n onAutoFill,\n disabled = false,\n frontIcon,\n frontIconComponent,\n trailingIconComponent,\n trailingIcon,\n fallbackStyle,\n autoCompleteAttr = 'off',\n inputModeAttr,\n ...fieldProps\n }: TextInputProps,\n ref: ForwardedRef<HTMLInputElement>,\n) {\n const id = useUniqueId(idProp)\n const theme = useTheme()\n\n const handleAnimationEnd = (e: AnimationEvent<HTMLInputElement>) => {\n if (e.animationName === 'onAutoFillStart' && onAutoFill && !!value) {\n onAutoFill()\n }\n }\n\n const frontIconToRender = frontIconComponent ? (\n <InputLeadingIconContainer $size={20} $iconColor={theme.color.text.subtle}>\n {frontIconComponent}\n </InputLeadingIconContainer>\n ) : frontIcon ? (\n <StyledFrontIcon\n $disabled={disabled}\n render={frontIcon}\n color=\"color.icon.base\"\n />\n ) : null\n\n const trailingIconToRender = trailingIconComponent ? (\n <InputLeadingIconContainer $size={20} $iconColor={theme.color.text.subtle}>\n {trailingIconComponent}\n </InputLeadingIconContainer>\n ) : trailingIcon ? (\n <StyledTrailingIcon\n $disabled={disabled}\n render={trailingIcon}\n color=\"color.icon.base\"\n />\n ) : null\n\n return (\n <Field {...fieldProps} htmlFor={id} error={error}>\n <Box flex alignItems=\"center\" justifyContent=\"flex-start\">\n {frontIconToRender && frontIconToRender}\n <Input\n disabled={disabled}\n type={type}\n id={id}\n name={name}\n ref={ref}\n onAnimationEnd={handleAnimationEnd}\n placeholder={placeholder}\n value={value}\n $error={error}\n $frontIcon={Boolean(frontIconToRender)}\n $fallbackStyle={fallbackStyle}\n autoComplete={autoCompleteAttr}\n onChange={(e: FormEvent<HTMLInputElement>) => {\n onChange?.(e.currentTarget.value)\n onInputChange?.(e)\n }}\n onBlur={onBlur}\n inputMode={inputModeAttr}\n />\n {trailingIconToRender && trailingIconToRender}\n </Box>\n </Field>\n )\n})\n"]}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import * as designTokens from '@mrshmllw/smores-foundations/build/web/variables.json';
|
|
2
2
|
import { Color } from '../../theme';
|
|
3
|
+
import { Flatten, Prettify } from '../../types';
|
|
3
4
|
import { Theme } from '../ThemeProvider';
|
|
4
|
-
type Flatten<T, Prefix extends string = ''> = {
|
|
5
|
-
[K in keyof T & string]: T[K] extends Record<string, any> ? Flatten<T[K], `${Prefix}${K}.`> : `${Prefix}${K}`;
|
|
6
|
-
}[keyof T & string];
|
|
7
|
-
type Prettify<T> = {
|
|
8
|
-
[K in keyof T]: T[K];
|
|
9
|
-
} & {};
|
|
10
5
|
export type NewColor = Prettify<Flatten<Pick<typeof designTokens, 'color' | 'extended1' | 'thirdParty'>>>;
|
|
11
6
|
export type ColorTypes = Color | NewColor;
|
|
12
7
|
export declare const resolveToThemeColor: (color: ColorTypes, theme: Theme) => string;
|
|
13
|
-
export declare const getColorPath: (color: ColorTypes) => "meta" | "onfido" | "rac" | "color.text.base" | "color.text.subtle" | "color.text.contrast" | "color.text.inverse" | "color.text.nonEssential" | "color.interactive.primary.base" | "color.interactive.primary.hover" | "color.interactive.primary.pressed" | "color.interactive.primary.active" | "color.interactive.secondary.base" | "color.interactive.secondary.hover" | "color.interactive.secondary.pressed" | "color.interactive.secondary.active" | "color.interactive.tertiary.base" | "color.interactive.tertiary.hover" | "color.interactive.tertiary.pressed" | "color.interactive.tertiary.active" | "color.interactive.destructive.base" | "color.interactive.destructive.hover" | "color.interactive.destructive.pressed" | "color.interactive.destructive.active" | "color.background.100" | "color.background.200" | "color.background.000" | "color.icon.base" | "color.icon.subtle" | "color.icon.contrast" | "color.icon.inverse" | "color.icon.nonEssential" | "color.surface.base.400" | "color.surface.base.100" | "color.surface.base.200" | "color.surface.base.
|
|
8
|
+
export declare const getColorPath: (color: ColorTypes) => "meta" | "onfido" | "rac" | "color.text.base" | "color.text.subtle" | "color.text.contrast" | "color.text.inverse" | "color.text.nonEssential" | "color.interactive.primary.base" | "color.interactive.primary.hover" | "color.interactive.primary.pressed" | "color.interactive.primary.active" | "color.interactive.secondary.base" | "color.interactive.secondary.hover" | "color.interactive.secondary.pressed" | "color.interactive.secondary.active" | "color.interactive.tertiary.base" | "color.interactive.tertiary.hover" | "color.interactive.tertiary.pressed" | "color.interactive.tertiary.active" | "color.interactive.destructive.base" | "color.interactive.destructive.hover" | "color.interactive.destructive.pressed" | "color.interactive.destructive.active" | "color.background.100" | "color.background.200" | "color.background.000" | "color.icon.base" | "color.icon.subtle" | "color.icon.contrast" | "color.icon.inverse" | "color.icon.nonEssential" | "color.surface.base.400" | "color.surface.base.100" | "color.surface.base.200" | "color.surface.base.300" | "color.surface.base.000" | "color.surface.base.900" | "color.surface.brand.400" | "color.surface.brand.100" | "color.surface.brand.200" | "color.surface.brand.300" | "color.surface.brand.accent1" | "color.surface.brand.accent2" | "color.surface.brand.accent3" | "color.surface.brand.accent4" | "color.feedback.negative.100" | "color.feedback.negative.200" | "color.feedback.positive.100" | "color.feedback.positive.200" | "color.feedback.notice.100" | "color.feedback.notice.200" | "color.feedback.informative.100" | "color.feedback.informative.200" | "color.feedback.inactive.100" | "color.feedback.inactive.50" | "color.focus.onLight" | "color.focus.onDark" | "color.border.base" | "color.border.subtle" | "color.border.contrast" | "color.illustration.accent1.100" | "color.illustration.accent1.200" | "color.illustration.accent2.100" | "color.illustration.accent2.200" | "color.illustration.accent3.100" | "color.illustration.accent3.200" | "color.illustration.accent4.100" | "color.illustration.accent4.200" | "color.illustration.neutral.400" | "color.illustration.neutral.100" | "color.illustration.neutral.200" | "color.illustration.neutral.300" | "color.illustration.neutral.000" | "color.illustration.neutral.900" | "extended1.100" | "extended1.20" | "compareTheMarket" | "ravelin" | "stripe" | "intercom" | "checkout" | "hometree" | "premfina" | "thirdParty.onfido" | "thirdParty.rac" | "thirdParty.compareTheMarket" | "thirdParty.facebook" | "thirdParty.ravelin" | "thirdParty.confusedCom" | "thirdParty.stripe" | "thirdParty.intercom" | "thirdParty.twitter" | "thirdParty.checkout" | "thirdParty.hometree" | "thirdParty.premfina" | "lollipop" | "marshmallowPink" | "bubblegum" | "fairyFloss" | "boba" | "liquorice" | "sesame" | "chia" | "custard" | "mascarpone" | "coconut" | "cream" | "spearmint" | "feijoa" | "blueberry" | "macaroon" | "pistachio" | "matcha" | "caramel" | "peanut" | "marzipan" | "oatmeal" | "satsuma" | "strawberry" | "watermelon" | "apple" | "mint" | "lemon" | "sherbert" | "tangerine" | "confused" | "x";
|
|
14
9
|
export declare const formatDesignTokenColor: () => string;
|
|
15
10
|
export declare const legacyColorMap: Record<Color, NewColor>;
|
|
16
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colourMap.js","sourceRoot":"","sources":["../../../src/ThemeProvider/utils/colourMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,uDAAuD,CAAA;
|
|
1
|
+
{"version":3,"file":"colourMap.js","sourceRoot":"","sources":["../../../src/ThemeProvider/utils/colourMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,uDAAuD,CAAA;AAIrF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAQzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAiB,EACjB,KAAY,EACJ,EAAE;IACV,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IACtC,OAAO,aAAa,CAAC;QACnB,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,UAAU;KACjB,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,yFAAyF;AACzF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAE,EAAE;IAChD,OAAO,KAAK,IAAI,cAAc;QAC5B,CAAC,CAAC,cAAc,CAAC,KAAoC,CAAC;QACtD,CAAC,CAAC,KAAK,CAAA;AACX,CAAC,CAAA;AAED,mFAAmF;AACnF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAW,EAAE;IACjD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,YAAY,CAAA;IACrD,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA;IAE/C,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,EAAE,CAAA;IACX,CAA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B;IAC7B,GAAG,EAAE,gBAAgB;IACrB,QAAQ,EAAE,qBAAqB;CACvB,CAAA","sourcesContent":["import * as designTokens from '@mrshmllw/smores-foundations/build/web/variables.json'\nimport { Color } from '../../theme'\nimport { Flatten, Prettify } from '../../types'\nimport { Theme } from '../ThemeProvider'\nimport { getFromObject } from '../../utils/getFromObject'\n\nexport type NewColor = Prettify<\n Flatten<Pick<typeof designTokens, 'color' | 'extended1' | 'thirdParty'>>\n>\n\nexport type ColorTypes = Color | NewColor\n\nexport const resolveToThemeColor = (\n color: ColorTypes,\n theme: Theme,\n): string => {\n const colourPath = getColorPath(color)\n return getFromObject({\n obj: theme,\n path: colourPath,\n })\n}\n\n// a function that returns a flattened dot notation string path to access the color value\nexport const getColorPath = (color: ColorTypes) => {\n return color in legacyColorMap\n ? legacyColorMap[color as keyof typeof legacyColorMap]\n : color\n}\n\n// a function that returns the design token color paths as a comma-separated string\nexport const formatDesignTokenColor = (): string => {\n const { color, extended1, thirdParty } = designTokens\n const colors = { color, extended1, thirdParty }\n\n if (colors === null) {\n return ''\n }\n\n const result: string[] = []\n const destructureNestedObject = (obj: any, currentPath: string) => {\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const value = obj[key]\n const newPath = currentPath ? `${currentPath}.${key}` : key\n if (typeof value === 'object' && value !== null) {\n destructureNestedObject(value, newPath)\n } else {\n result.push(newPath)\n }\n }\n }\n }\n destructureNestedObject(colors, '')\n return result.join(', ')\n}\n\n// old colour name → new colour path // base token value\nexport const legacyColorMap: Record<Color, NewColor> = {\n fairyFloss: 'color.surface.brand.100', // palette.primary.040\n bubblegum: 'color.surface.brand.200', // palette.primary.060\n marshmallowPink: 'color.surface.brand.300', // palette.primary.100\n lollipop: 'color.surface.brand.400', // palatte.primary.120\n\n // Core Secondary\n chia: 'color.feedback.inactive.100', // palette.secondary.040\n sesame: 'color.text.subtle', // palette.secondary.060\n liquorice: 'color.text.base', // palette.secondary.100\n boba: 'color.text.contrast', // palette.secondary.120\n\n // Core Tertiary\n cream: 'color.surface.base.000', // palette.neutral.000\n coconut: 'color.surface.base.100', // palette.neutral.010\n mascarpone: 'color.surface.base.200', // palette.neutral.020\n custard: 'color.surface.base.300', // palette.neutral.040\n\n // Brand Secondary\n feijoa: 'color.illustration.accent1.100', // palette.brand1.060\n spearmint: 'color.illustration.accent1.200', // palette.brand1.100\n macaroon: 'color.illustration.accent2.100', // palette.brand2.060\n blueberry: 'color.illustration.accent2.200', // palette.brand2.100\n pistachio: 'color.illustration.accent3.200', // palette.brand3.100\n matcha: 'color.illustration.accent3.100', // palette.brand3.060\n caramel: 'color.illustration.accent4.200', // palette.brand4.100\n peanut: 'color.illustration.accent4.100', // palette.brand4.060\n marzipan: 'color.illustration.neutral.400', // palette.neutral.100\n oatmeal: 'color.illustration.neutral.300', // palette.neutral.060\n satsuma: 'extended1.20', // extended1.020\n\n // Traffic light\n watermelon: 'color.feedback.negative.100', // palette.negative.020\n strawberry: 'color.feedback.negative.200', // palette.negative.100\n apple: 'color.feedback.positive.200', // palette.positive.100\n mint: 'color.feedback.positive.100', // palette.positive.020\n lemon: 'color.feedback.notice.200', // palette.notice.100\n sherbert: 'color.feedback.notice.100', // palette.notice.020\n tangerine: 'extended1.100', // extended1.100\n\n // Third-party brand colours\n compareTheMarket: 'thirdParty.compareTheMarket',\n confused: 'thirdParty.confusedCom',\n onfido: 'thirdParty.onfido',\n x: 'thirdParty.twitter', // x rebrand not yet reflected in foundations\n premfina: 'thirdParty.premfina',\n checkout: 'thirdParty.checkout',\n meta: 'thirdParty.facebook', // Meta rebrand not yet reflected in foundations\n stripe: 'thirdParty.stripe',\n intercom: 'thirdParty.intercom',\n ravelin: 'thirdParty.ravelin',\n rac: 'thirdParty.rac',\n hometree: 'thirdParty.hometree',\n} as const\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { Icons } from '../Icon/iconsList';
|
|
3
2
|
import { MarginProps } from '../utils/space';
|
|
3
|
+
import { Icons } from '../Icon';
|
|
4
4
|
export interface CommonFieldProps extends MarginProps {
|
|
5
5
|
id?: string;
|
|
6
6
|
className?: string;
|
|
@@ -13,7 +13,9 @@ export interface CommonFieldProps extends MarginProps {
|
|
|
13
13
|
errorMsg?: string | ReactElement<any>;
|
|
14
14
|
completed?: boolean;
|
|
15
15
|
frontIcon?: Icons;
|
|
16
|
+
frontIconComponent?: ReactNode;
|
|
16
17
|
trailingIcon?: Icons;
|
|
18
|
+
trailingIconComponent?: ReactNode;
|
|
17
19
|
fallbackStyle?: boolean;
|
|
18
20
|
disabled?: boolean;
|
|
19
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonFieldTypes.js","sourceRoot":"","sources":["../../src/fields/commonFieldTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactElement, ReactNode } from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"commonFieldTypes.js","sourceRoot":"","sources":["../../src/fields/commonFieldTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactElement, ReactNode } from 'react'\nimport { MarginProps } from '../utils/space'\nimport { Icons } from '../Icon'\n\nexport interface CommonFieldProps extends MarginProps {\n id?: string\n className?: string\n children?: ReactNode\n label?: string\n renderAsTitle?: boolean\n assistiveText?: string | ReactElement<any>\n required?: boolean\n error?: boolean\n errorMsg?: string | ReactElement<any>\n completed?: boolean\n frontIcon?: Icons\n frontIconComponent?: ReactNode\n trailingIcon?: Icons\n trailingIconComponent?: ReactNode\n fallbackStyle?: boolean\n disabled?: boolean\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Icons } from '../../Icon
|
|
1
|
+
import { Icons } from '../../Icon';
|
|
2
2
|
interface IInput {
|
|
3
3
|
$error?: boolean;
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
selected?: boolean;
|
|
6
6
|
step?: number;
|
|
7
7
|
value?: string;
|
|
8
|
-
$frontIcon?:
|
|
8
|
+
$frontIcon?: boolean;
|
|
9
9
|
$trailingIcon?: Icons;
|
|
10
10
|
$fallbackStyle?: boolean;
|
|
11
11
|
}
|
|
@@ -13,6 +13,10 @@ interface SIcon {
|
|
|
13
13
|
$disabled?: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare const Input: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, IInput>> & string;
|
|
16
|
+
export declare const InputLeadingIconContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$size" | "$iconColor"> & {
|
|
17
|
+
$size: import("../../types").IconSize;
|
|
18
|
+
$iconColor?: string;
|
|
19
|
+
}, SIcon>> & string;
|
|
16
20
|
export declare const StyledFrontIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<{
|
|
17
21
|
className?: string;
|
|
18
22
|
render: Icons;
|
|
@@ -27,4 +31,8 @@ export declare const StyledTrailingIcon: import("styled-components/dist/types").
|
|
|
27
31
|
color?: import("../..").ColorTypes;
|
|
28
32
|
rotate?: number;
|
|
29
33
|
} & import("../..").MarginProps, SIcon>> & string & Omit<import("react").FC<import("../../Icon/Icon").IconProps>, keyof import("react").Component<any, {}, any>>;
|
|
34
|
+
export declare const InputTrailingIconContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$size" | "$iconColor"> & {
|
|
35
|
+
$size: import("../../types").IconSize;
|
|
36
|
+
$iconColor?: string;
|
|
37
|
+
}, SIcon>> & string;
|
|
30
38
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { Icon } from '../../Icon';
|
|
3
|
+
import { IconContainer } from '../../sharedStyles/shared.styles';
|
|
3
4
|
export const Input = styled.input `
|
|
4
5
|
border: none;
|
|
5
6
|
color: ${({ $error, theme }) => $error ? theme.color.feedback.negative[200] : theme.color.text.base};
|
|
@@ -64,6 +65,14 @@ export const Input = styled.input `
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
`;
|
|
68
|
+
export const InputLeadingIconContainer = styled(IconContainer) `
|
|
69
|
+
position: relative;
|
|
70
|
+
left: 36px;
|
|
71
|
+
margin-left: -24px;
|
|
72
|
+
z-index: 1;
|
|
73
|
+
opacity: ${({ $disabled }) => ($disabled ? '0.5' : '1')};
|
|
74
|
+
color: ${({ theme }) => theme.color.text.base};
|
|
75
|
+
`;
|
|
67
76
|
export const StyledFrontIcon = styled(Icon) `
|
|
68
77
|
position: relative;
|
|
69
78
|
left: 36px;
|
|
@@ -79,4 +88,11 @@ export const StyledTrailingIcon = styled(Icon) `
|
|
|
79
88
|
opacity: ${({ $disabled }) => ($disabled ? '0.5' : '1')};
|
|
80
89
|
color: ${({ theme }) => theme.color.text.base};
|
|
81
90
|
`;
|
|
91
|
+
export const InputTrailingIconContainer = styled(IconContainer) `
|
|
92
|
+
position: relative;
|
|
93
|
+
right: 36px;
|
|
94
|
+
margin-right: -36px;
|
|
95
|
+
opacity: ${({ $disabled }) => ($disabled ? '0.5' : '1')};
|
|
96
|
+
color: ${({ theme }) => theme.color.text.base};
|
|
97
|
+
`;
|
|
82
98
|
//# sourceMappingURL=CommonInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonInput.js","sourceRoot":"","sources":["../../../src/fields/components/CommonInput.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"CommonInput.js","sourceRoot":"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AC9C,CAAA;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,aAAa,CAAC,CAAO;;;;aAIzD,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;WAC9C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI;CAC9C,CAAA","sourcesContent":["import styled, { css } from 'styled-components'\nimport { Icon, Icons } from '../../Icon'\nimport { IconContainer } from '../../sharedStyles/shared.styles'\n\ninterface IInput {\n $error?: boolean\n disabled?: boolean\n selected?: boolean\n step?: number\n value?: string\n $frontIcon?: boolean\n $trailingIcon?: Icons\n $fallbackStyle?: boolean\n}\n\ninterface SIcon {\n $disabled?: boolean\n}\n\nexport const Input = styled.input<IInput>`\n border: none;\n color: ${({ $error, theme }) =>\n $error ? theme.color.feedback.negative[200] : theme.color.text.base};\n font-size: 16px;\n width: 100%;\n outline: none;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'initial')};\n opacity: ${({ disabled }) => (disabled ? '0.5' : '1')};\n padding: 18px 14px;\n background-color: ${({ $fallbackStyle, theme }) =>\n $fallbackStyle\n ? theme.color.surface.base[300]\n : theme.color.background['000']};\n border: 2px solid\n ${({ $error, theme }) =>\n $error ? theme.color.feedback.negative[200] : theme.color.border.subtle};\n\n ${({ disabled, $error, theme }) =>\n !disabled &&\n !$error &&\n css`\n &:hover,\n &:focus-within {\n border-color: ${theme.color.border.base};\n }\n `}\n\n border-radius: 12px;\n height: auto;\n\n ${({ $frontIcon }) =>\n $frontIcon &&\n `\n padding-left: 42px;\n `}\n\n ${({ $trailingIcon }) =>\n $trailingIcon &&\n `\n padding-right: 42px;\n `}\n\n /* Remove the spinner on Firefox and Webkit browsers */\n -moz-appearance: textfield;\n\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n &::placeholder {\n color: ${({ theme }) => theme.color.text.subtle};\n }\n\n &:-webkit-autofill {\n animation-name: onAutoFillStart;\n animation-duration: 2s;\n }\n\n @keyframes onAutoFillStart {\n from {\n background-color: inherit;\n }\n to {\n background-color: inherit;\n }\n }\n`\n\nexport const InputLeadingIconContainer = styled(IconContainer)<SIcon>`\n position: relative;\n left: 36px;\n margin-left: -24px;\n z-index: 1;\n opacity: ${({ $disabled }) => ($disabled ? '0.5' : '1')};\n color: ${({ theme }) => theme.color.text.base};\n`\n\nexport const StyledFrontIcon = styled(Icon)<SIcon>`\n position: relative;\n left: 36px;\n margin-left: -24px;\n z-index: 1;\n opacity: ${({ $disabled }) => ($disabled ? '0.5' : '1')};\n color: ${({ theme }) => theme.color.text.base};\n`\n\nexport const StyledTrailingIcon = styled(Icon)<SIcon>`\n position: relative;\n right: 36px;\n margin-right: -36px;\n opacity: ${({ $disabled }) => ($disabled ? '0.5' : '1')};\n color: ${({ theme }) => theme.color.text.base};\n`\n\nexport const InputTrailingIconContainer = styled(IconContainer)<SIcon>`\n position: relative;\n right: 36px;\n margin-right: -36px;\n opacity: ${({ $disabled }) => ($disabled ? '0.5' : '1')};\n color: ${({ theme }) => theme.color.text.base};\n`\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export * from './Tooltip';
|
|
|
50
50
|
export * from './utils/dateOfBirth/dateOfBirthValidator';
|
|
51
51
|
export * from './utils/dateOfBirth/dateOfBirthValidator.utils';
|
|
52
52
|
export * from './utils/dateOfBirth/schema';
|
|
53
|
+
export * from './utils/utilTypes';
|
|
53
54
|
export * from './utils/space';
|
|
54
55
|
export * from './ThemeProvider';
|
|
55
56
|
export * from './styled';
|
|
57
|
+
export * from './sharedStyles/shared.styles';
|
package/dist/index.js
CHANGED
|
@@ -50,7 +50,9 @@ export * from './Tooltip';
|
|
|
50
50
|
export * from './utils/dateOfBirth/dateOfBirthValidator';
|
|
51
51
|
export * from './utils/dateOfBirth/dateOfBirthValidator.utils';
|
|
52
52
|
export * from './utils/dateOfBirth/schema';
|
|
53
|
+
export * from './utils/utilTypes';
|
|
53
54
|
export * from './utils/space';
|
|
54
55
|
export * from './ThemeProvider';
|
|
55
56
|
export * from './styled';
|
|
57
|
+
export * from './sharedStyles/shared.styles';
|
|
56
58
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,0CAA0C,CAAA;AACxD,cAAc,gDAAgD,CAAA;AAC9D,cAAc,4BAA4B,CAAA;AAC1C,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA","sourcesContent":["export * from './Accordion'\nexport * from './ActionDropdown'\nexport * from './Badge'\nexport * from './Alert'\nexport * from './BadgeList'\nexport * from './Banner'\nexport * from './Box'\nexport * from './Button'\nexport * from './Card'\nexport * from './CheckBox'\nexport * from './CheckBoxGroup'\nexport * from './Chip'\nexport * from './CurrencyInput'\nexport * from './Datepicker'\nexport * from './Divider'\nexport * from './Dropdown'\nexport * from './fields/Field'\nexport * from './fields/Fieldset'\nexport * from './fontStyle'\nexport * from './hooks'\nexport * from './Icon'\nexport * from './IconStrict'\nexport * from './IconWrapper'\nexport * from './LabelledText'\nexport * from './Link'\nexport * from './Loader'\nexport * from './Logo'\nexport * from './Modal'\nexport * from './NumberInput'\nexport * from './Pagination'\nexport * from './ProgressIndicator'\nexport * from './RadioGroup'\nexport * from './RichText'\nexport * from './RichTextEditor'\nexport * from './Row'\nexport * from './SearchInput'\nexport * from './SegmentedControl'\nexport * from './SliderInput'\nexport * from './Snackbar'\nexport * from './SupportMessage'\nexport * from './Table'\nexport * from './Tag'\nexport * from './Text'\nexport * from './Textarea'\nexport * from './TextDateOfBirthInput'\nexport * from './TextInput'\nexport * from './theme'\nexport * from './Toggle'\nexport * from './Tooltip'\nexport * from './utils/dateOfBirth/dateOfBirthValidator'\nexport * from './utils/dateOfBirth/dateOfBirthValidator.utils'\nexport * from './utils/dateOfBirth/schema'\nexport * from './utils/space'\nexport * from './ThemeProvider'\nexport * from './styled'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,0CAA0C,CAAA;AACxD,cAAc,gDAAgD,CAAA;AAC9D,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,8BAA8B,CAAA","sourcesContent":["export * from './Accordion'\nexport * from './ActionDropdown'\nexport * from './Badge'\nexport * from './Alert'\nexport * from './BadgeList'\nexport * from './Banner'\nexport * from './Box'\nexport * from './Button'\nexport * from './Card'\nexport * from './CheckBox'\nexport * from './CheckBoxGroup'\nexport * from './Chip'\nexport * from './CurrencyInput'\nexport * from './Datepicker'\nexport * from './Divider'\nexport * from './Dropdown'\nexport * from './fields/Field'\nexport * from './fields/Fieldset'\nexport * from './fontStyle'\nexport * from './hooks'\nexport * from './Icon'\nexport * from './IconStrict'\nexport * from './IconWrapper'\nexport * from './LabelledText'\nexport * from './Link'\nexport * from './Loader'\nexport * from './Logo'\nexport * from './Modal'\nexport * from './NumberInput'\nexport * from './Pagination'\nexport * from './ProgressIndicator'\nexport * from './RadioGroup'\nexport * from './RichText'\nexport * from './RichTextEditor'\nexport * from './Row'\nexport * from './SearchInput'\nexport * from './SegmentedControl'\nexport * from './SliderInput'\nexport * from './Snackbar'\nexport * from './SupportMessage'\nexport * from './Table'\nexport * from './Tag'\nexport * from './Text'\nexport * from './Textarea'\nexport * from './TextDateOfBirthInput'\nexport * from './TextInput'\nexport * from './theme'\nexport * from './Toggle'\nexport * from './Tooltip'\nexport * from './utils/dateOfBirth/dateOfBirthValidator'\nexport * from './utils/dateOfBirth/dateOfBirthValidator.utils'\nexport * from './utils/dateOfBirth/schema'\nexport * from './utils/utilTypes'\nexport * from './utils/space'\nexport * from './ThemeProvider'\nexport * from './styled'\nexport * from './sharedStyles/shared.styles'\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IconSize } from '../types';
|
|
2
|
+
export declare const IconContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
3
|
+
$size: IconSize;
|
|
4
|
+
$iconColor?: string;
|
|
5
|
+
}>> & string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
export const IconContainer = styled.span `
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
|
|
7
|
+
${({ $size }) => css `
|
|
8
|
+
width: ${$size}px;
|
|
9
|
+
height: ${$size}px;
|
|
10
|
+
`}
|
|
11
|
+
|
|
12
|
+
svg {
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
|
|
16
|
+
${({ $iconColor }) => $iconColor &&
|
|
17
|
+
css `
|
|
18
|
+
fill: ${$iconColor};
|
|
19
|
+
`}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
//# sourceMappingURL=shared.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.styles.js","sourceRoot":"","sources":["../../src/sharedStyles/shared.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAG/C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAGtC;;;;;IAKE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;aACT,KAAK;cACJ,KAAK;GAChB;;;;;;MAMG,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CACnB,UAAU;IACV,GAAG,CAAA;gBACO,UAAU;OACnB;;CAEN,CAAA","sourcesContent":["import styled, { css } from 'styled-components'\nimport { IconSize } from '../types'\n\nexport const IconContainer = styled.span<{\n $size: IconSize\n $iconColor?: string\n}>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n ${({ $size }) => css`\n width: ${$size}px;\n height: ${$size}px;\n `}\n\n svg {\n width: 100%;\n height: 100%;\n\n ${({ $iconColor }) =>\n $iconColor &&\n css`\n fill: ${$iconColor};\n `}\n }\n`\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,3 +3,10 @@ export type GeneralEvent = Event | UIEvent;
|
|
|
3
3
|
export type GenericEventCallback = (e: GeneralEvent) => unknown;
|
|
4
4
|
export type KeyboardEventCallback = (e: KeyboardEvent) => unknown;
|
|
5
5
|
export type MouseEventCallBack = (event: MouseEvent<HTMLElement>) => void;
|
|
6
|
+
export type IconSize = 12 | 16 | 20 | 24 | 32 | 40;
|
|
7
|
+
export type Flatten<T, Prefix extends string = ''> = {
|
|
8
|
+
[K in keyof T & string]: T[K] extends Record<string, any> ? Flatten<T[K], `${Prefix}${K}.`> : `${Prefix}${K}`;
|
|
9
|
+
}[keyof T & string];
|
|
10
|
+
export type Prettify<T> = {
|
|
11
|
+
[K in keyof T]: T[K];
|
|
12
|
+
} & {};
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent, UIEvent } from 'react'\n// Events Types\nexport type GeneralEvent = Event | UIEvent\nexport type GenericEventCallback = (e: GeneralEvent) => unknown\nexport type KeyboardEventCallback = (e: KeyboardEvent) => unknown\nexport type MouseEventCallBack = (event: MouseEvent<HTMLElement>) => void\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent, UIEvent } from 'react'\n// Events Types\nexport type GeneralEvent = Event | UIEvent\nexport type GenericEventCallback = (e: GeneralEvent) => unknown\nexport type KeyboardEventCallback = (e: KeyboardEvent) => unknown\nexport type MouseEventCallBack = (event: MouseEvent<HTMLElement>) => void\n\n// Common types\nexport type IconSize = 12 | 16 | 20 | 24 | 32 | 40\n\nexport type Flatten<T, Prefix extends string = ''> = {\n [K in keyof T & string]: T[K] extends Record<string, any>\n ? Flatten<T[K], `${Prefix}${K}.`>\n : `${Prefix}${K}`\n}[keyof T & string]\n\nexport type Prettify<T> = {\n [K in keyof T]: T[K]\n} & {}\n"]}
|
package/dist/utils/deprecated.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
const
|
|
3
|
-
|
|
2
|
+
const detectEnv = () => {
|
|
3
|
+
const env = (typeof process !== 'undefined' && process?.env?.REACT_APP_NODE_ENV) ||
|
|
4
|
+
(typeof process !== 'undefined' && process?.env?.NODE_ENV);
|
|
5
|
+
if (env === 'development' || env === 'production' || env === 'local')
|
|
6
|
+
return env;
|
|
7
|
+
return null;
|
|
8
|
+
};
|
|
9
|
+
export const isLocal = detectEnv() === 'local';
|
|
4
10
|
const stripUndefinedProps = (props) => {
|
|
5
11
|
const propKeys = Object.keys(props);
|
|
6
12
|
return propKeys.reduce((acc, key) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../src/utils/deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../src/utils/deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,MAAM,SAAS,GAAG,GAAe,EAAE;IACjC,MAAM,GAAG,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ACH,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;QACvB,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;AACf,CAAC,CAAA","sourcesContent":["import { useEffect } from 'react'\n\ntype Env = 'development' | 'production' | 'local'\n\nconst detectEnv = (): Env | null => {\n const env =\n (typeof process !== 'undefined' && process?.env?.REACT_APP_NODE_ENV) ||\n (typeof process !== 'undefined' && process?.env?.NODE_ENV)\n\n if (env === 'development' || env === 'production' || env === 'local')\n return env\n return null\n}\n\nexport const isLocal = detectEnv() === 'local'\n\nconst stripUndefinedProps = (props: Record<string, unknown>) => {\n const propKeys = Object.keys(props)\n\n return propKeys.reduce<Record<string, unknown>>((acc, key) => {\n if (props[key] !== undefined) {\n acc[key] = props[key]\n }\n return acc\n }, {})\n}\n\ntype UseDeprecatedWarningParams = {\n enabled?: boolean\n title: string\n message: string\n componentProps?: Record<string, any>\n}\n\nexport const useDeprecatedWarning = ({\n enabled = true,\n title,\n message,\n componentProps,\n}: UseDeprecatedWarningParams): void => {\n useEffect(() => {\n if (isLocal && enabled) {\n const logs: any[] = [\n `%c[Deprecated] ${title}`,\n 'font-weight:bold;',\n '\\n',\n '\\n',\n message,\n ]\n\n if (componentProps) {\n logs.push(\n '\\n',\n '\\n',\n 'Component props:',\n stripUndefinedProps(componentProps),\n )\n }\n\n console.warn(...logs)\n }\n }, [enabled])\n}\n"]}
|
package/dist/utils/flex.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { Theme } from '../ThemeProvider/ThemeProvider';
|
|
1
2
|
import { ResponsiveProp } from './responsiveProp';
|
|
2
3
|
import { SpacingProp } from './space';
|
|
3
4
|
import { TransientProps } from './utilTypes';
|
|
4
|
-
type FlexFN = (arg: TransientFlexProps
|
|
5
|
+
type FlexFN = (arg: TransientFlexProps & {
|
|
6
|
+
theme: Theme;
|
|
7
|
+
}) => string;
|
|
5
8
|
export interface FlexProps {
|
|
6
9
|
direction?: ResponsiveProp<'column' | 'column-reverse' | 'row' | 'row-reverse'>;
|
|
7
10
|
wrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
package/dist/utils/flex.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveResponsiveProp } from './responsiveProp';
|
|
2
2
|
import { resolveSpacing } from './space';
|
|
3
3
|
export const flex = (props) => {
|
|
4
|
-
const { $flex, $direction, $wrap, $flow, $justifyContent, $alignItems, $alignContent, $gap, $columnGap, $rowGap, } = props;
|
|
4
|
+
const { $flex, $direction, $wrap, $flow, $justifyContent, $alignItems, $alignContent, $gap, $columnGap, $rowGap, theme, } = props;
|
|
5
5
|
return `
|
|
6
6
|
${$flex ? `display: flex;` : ''}
|
|
7
7
|
${$direction
|
|
@@ -19,13 +19,13 @@ export const flex = (props) => {
|
|
|
19
19
|
? resolveResponsiveProp($alignContent, (value) => `align-content: ${value};`)
|
|
20
20
|
: ''}
|
|
21
21
|
${$gap
|
|
22
|
-
? resolveResponsiveProp($gap, (value) => `gap: ${resolveSpacing(value)};`)
|
|
22
|
+
? resolveResponsiveProp($gap, (value) => `gap: ${resolveSpacing(value, theme)};`)
|
|
23
23
|
: ''}
|
|
24
24
|
${$columnGap
|
|
25
|
-
? resolveResponsiveProp($columnGap, (value) => `column-gap: ${resolveSpacing(value)};`)
|
|
25
|
+
? resolveResponsiveProp($columnGap, (value) => `column-gap: ${resolveSpacing(value, theme)};`)
|
|
26
26
|
: ''}
|
|
27
27
|
${$rowGap
|
|
28
|
-
? resolveResponsiveProp($rowGap, (value) => `row-gap: ${resolveSpacing(value)};`)
|
|
28
|
+
? resolveResponsiveProp($rowGap, (value) => `row-gap: ${resolveSpacing(value, theme)};`)
|
|
29
29
|
: ''}
|
|
30
30
|
`;
|
|
31
31
|
};
|
package/dist/utils/flex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flex.js","sourceRoot":"","sources":["../../src/utils/flex.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flex.js","sourceRoot":"","sources":["../../src/utils/flex.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAkB,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,cAAc,EAAe,MAAM,SAAS,CAAA;AAuCrD,MAAM,CAAC,MAAM,IAAI,GAAW,CAAC,KAAK,EAAE,EAAE;IACpC,MAAM,EACJ,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,eAAe,EACf,WAAW,EACX,aAAa,EACb,IAAI,EACJ,UAAU,EACV,OAAO,EACP,KAAK,GACN,GAAG,KAAK,CAAA;IAET,OAAO;MACH,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE;MAE7B,UAAU;QACR,CAAC,CAAC,qBAAqB,CACnB,UAAU,EACV,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,KAAK,GAAG,CACvC;QACH,CAAC,CAAC,EACN;MACE,KAAK,CAAC,CAAC,CAAC,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE;MACnC,KAAK,CAAC,CAAC,CAAC,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE;MAEnC,eAAe;QACb,CAAC,CAAC,qBAAqB,CACnB,eAAe,EACf,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,KAAK,GAAG,CACxC;QACH,CAAC,CAAC,EACN;MAEE,WAAW;QACT,CAAC,CAAC,qBAAqB,CACnB,WAAW,EACX,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,KAAK,GAAG,CACpC;QACH,CAAC,CAAC,EACN;MAEE,aAAa;QACX,CAAC,CAAC,qBAAqB,CACnB,aAAa,EACb,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,KAAK,GAAG,CACtC;QACH,CAAC,CAAC,EACN;MAEE,IAAI;QACF,CAAC,CAAC,qBAAqB,CACnB,IAAI,EACJ,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CACnD;QACH,CAAC,CAAC,EACN;MAEE,UAAU;QACR,CAAC,CAAC,qBAAqB,CACnB,UAAU,EACV,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAC1D;QACH,CAAC,CAAC,EACN;MAEE,OAAO;QACL,CAAC,CAAC,qBAAqB,CACnB,OAAO,EACP,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CACvD;QACH,CAAC,CAAC,EACN;GACD,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { Theme } from '../ThemeProvider/ThemeProvider'\nimport { resolveResponsiveProp, ResponsiveProp } from './responsiveProp'\nimport { resolveSpacing, SpacingProp } from './space'\nimport { TransientProps } from './utilTypes'\n\ntype FlexFN = (arg: TransientFlexProps & { theme: Theme }) => string\n\nexport interface FlexProps {\n direction?: ResponsiveProp<\n 'column' | 'column-reverse' | 'row' | 'row-reverse'\n >\n wrap?: 'nowrap' | 'wrap' | 'wrap-reverse'\n flex?: boolean\n flow?: string\n justifyContent?: ResponsiveProp<\n | 'center'\n | 'flex-end'\n | 'flex-start'\n | 'space-around'\n | 'space-between'\n | 'space-evenly'\n >\n\n alignItems?: ResponsiveProp<\n 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch'\n >\n alignContent?: ResponsiveProp<\n | 'center'\n | 'flex-end'\n | 'flex-start'\n | 'space-around'\n | 'space-between'\n | 'stretch'\n >\n gap?: ResponsiveProp<SpacingProp>\n rowGap?: ResponsiveProp<SpacingProp>\n columnGap?: ResponsiveProp<SpacingProp>\n}\n\nexport type TransientFlexProps = TransientProps<FlexProps>\n\nexport const flex: FlexFN = (props) => {\n const {\n $flex,\n $direction,\n $wrap,\n $flow,\n $justifyContent,\n $alignItems,\n $alignContent,\n $gap,\n $columnGap,\n $rowGap,\n theme,\n } = props\n\n return `\n ${$flex ? `display: flex;` : ''}\n ${\n $direction\n ? resolveResponsiveProp(\n $direction,\n (value) => `flex-direction: ${value};`,\n )\n : ''\n }\n ${$wrap ? `flex-wrap: ${$wrap};` : ''}\n ${$flow ? `flex-flow: ${$flow};` : ''}\n ${\n $justifyContent\n ? resolveResponsiveProp(\n $justifyContent,\n (value) => `justify-content: ${value};`,\n )\n : ''\n }\n ${\n $alignItems\n ? resolveResponsiveProp(\n $alignItems,\n (value) => `align-items: ${value};`,\n )\n : ''\n }\n ${\n $alignContent\n ? resolveResponsiveProp(\n $alignContent,\n (value) => `align-content: ${value};`,\n )\n : ''\n }\n ${\n $gap\n ? resolveResponsiveProp(\n $gap,\n (value) => `gap: ${resolveSpacing(value, theme)};`,\n )\n : ''\n }\n ${\n $columnGap\n ? resolveResponsiveProp(\n $columnGap,\n (value) => `column-gap: ${resolveSpacing(value, theme)};`,\n )\n : ''\n }\n ${\n $rowGap\n ? resolveResponsiveProp(\n $rowGap,\n (value) => `row-gap: ${resolveSpacing(value, theme)};`,\n )\n : ''\n }\n `\n}\n"]}
|
package/dist/utils/space.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { Theme } from '../ThemeProvider/ThemeProvider';
|
|
2
|
+
import { Flatten, Prettify } from '../types';
|
|
1
3
|
import { ResponsiveProp } from './responsiveProp';
|
|
2
4
|
import { TransientProps } from './utilTypes';
|
|
3
|
-
type
|
|
4
|
-
export type
|
|
5
|
+
type LegacySpacing = '8px' | '12px' | '16px' | '24px' | '32px' | '48px' | '64px';
|
|
6
|
+
export type ThemeSpacing = Prettify<Flatten<Pick<Theme, 'space'>>>;
|
|
7
|
+
export type SpacingProp = '0' | LegacySpacing | ThemeSpacing | {
|
|
5
8
|
custom: number | string;
|
|
6
9
|
};
|
|
7
|
-
export declare const resolveSpacing: (value: SpacingProp | "auto") => string;
|
|
10
|
+
export declare const resolveSpacing: (value: SpacingProp | "auto", theme?: Theme) => string;
|
|
8
11
|
export interface MarginProps {
|
|
9
12
|
m?: ResponsiveProp<SpacingProp>;
|
|
10
13
|
mx?: ResponsiveProp<SpacingProp | 'auto'>;
|
|
@@ -25,6 +28,10 @@ export interface PaddingProps {
|
|
|
25
28
|
}
|
|
26
29
|
export type TransientMarginProps = TransientProps<MarginProps>;
|
|
27
30
|
export type TransientPaddingProps = TransientProps<PaddingProps>;
|
|
28
|
-
export declare const margin: (props: TransientMarginProps
|
|
29
|
-
|
|
31
|
+
export declare const margin: (props: TransientMarginProps & {
|
|
32
|
+
theme: Theme;
|
|
33
|
+
}) => string;
|
|
34
|
+
export declare const padding: (props: TransientPaddingProps & {
|
|
35
|
+
theme: Theme;
|
|
36
|
+
}) => string;
|
|
30
37
|
export {};
|