@mrshmllw/smores-react 2.4.1 → 2.4.4
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.d.ts +2 -1
- package/dist/Accordion/Accordion.js +14 -2
- package/dist/Accordion/Accordion.js.map +1 -1
- package/dist/ActionDropdown/ActionDropdown.d.ts +2 -1
- package/dist/ActionDropdown/ActionDropdown.js +19 -6
- package/dist/ActionDropdown/ActionDropdown.js.map +1 -1
- package/dist/Box/Box.d.ts +3 -3
- package/dist/Box/Box.js +3 -2
- package/dist/Box/Box.js.map +1 -1
- package/dist/Button/Button.d.ts +2 -2
- package/dist/Button/Button.js +10 -12
- package/dist/Button/Button.js.map +1 -1
- package/dist/Card/Card.d.ts +2 -1
- package/dist/Card/Card.js +17 -2
- package/dist/Card/Card.js.map +1 -1
- package/dist/CheckBoxGroup/CheckBoxGroup.d.ts +4 -3
- package/dist/CheckBoxGroup/CheckBoxGroup.js +17 -2
- package/dist/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
- package/dist/CheckBoxGroup/CheckBoxGroup.stories.d.ts +1 -1
- package/dist/Chip/Chip.d.ts +2 -1
- package/dist/Chip/Chip.js +3 -2
- package/dist/Chip/Chip.js.map +1 -1
- package/dist/ConfirmationRadioButtons/Confirmation.d.ts +2 -1
- package/dist/ConfirmationRadioButtons/Confirmation.js +17 -5
- package/dist/ConfirmationRadioButtons/Confirmation.js.map +1 -1
- package/dist/Datepicker/Datepicker.d.ts +2 -2
- package/dist/Datepicker/Datepicker.js +15 -3
- package/dist/Datepicker/Datepicker.js.map +1 -1
- package/dist/Datepicker/DatesList.d.ts +0 -1
- package/dist/Datepicker/DatesList.js +4 -5
- package/dist/Datepicker/DatesList.js.map +1 -1
- package/dist/Dropdown/Dropdown.d.ts +2 -2
- package/dist/Dropdown/Dropdown.js +1 -1
- package/dist/Dropdown/Dropdown.stories.d.ts +2 -2
- package/dist/Emoji/Emoji.d.ts +2 -6
- package/dist/Emoji/Emoji.js +17 -6
- package/dist/Emoji/Emoji.js.map +1 -1
- package/dist/Field/Field.d.ts +1 -1
- package/dist/Field/Field.js +19 -6
- package/dist/Field/Field.js.map +1 -1
- package/dist/Field/types/commonFieldTypes.d.ts +2 -1
- package/dist/Fieldset/Fieldset.d.ts +4 -3
- package/dist/Fieldset/Fieldset.js +14 -2
- package/dist/Fieldset/Fieldset.js.map +1 -1
- package/dist/Icon/Icon.d.ts +2 -6
- package/dist/Icon/Icon.js +819 -808
- package/dist/Icon/Icon.js.map +1 -1
- package/dist/IconWrapper/IconWrapper.d.ts +2 -1
- package/dist/IconWrapper/IconWrapper.js +21 -6
- package/dist/IconWrapper/IconWrapper.js.map +1 -1
- package/dist/LabelledText/LabelledText.d.ts +2 -1
- package/dist/LabelledText/LabelledText.js +19 -4
- package/dist/LabelledText/LabelledText.js.map +1 -1
- package/dist/NumberInput/NumberInput.d.ts +17 -30
- package/dist/NumberInput/NumberInput.js +84 -62
- package/dist/NumberInput/NumberInput.js.map +1 -1
- package/dist/NumberInput/NumberInput.stories.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts +2 -1
- package/dist/Pagination/Pagination.js +14 -2
- package/dist/Pagination/Pagination.js.map +1 -1
- package/dist/RadioButton/RadioButton.d.ts +2 -1
- package/dist/RadioButton/RadioButton.js +14 -2
- package/dist/RadioButton/RadioButton.js.map +1 -1
- package/dist/Row/Row.d.ts +2 -1
- package/dist/Row/Row.js +15 -3
- package/dist/Row/Row.js.map +1 -1
- package/dist/SearchInput/SearchInput.d.ts +0 -1
- package/dist/SearchInput/SearchInput.js +15 -3
- package/dist/SearchInput/SearchInput.js.map +1 -1
- package/dist/SupportMessage/Collection.js +44 -29
- package/dist/SupportMessage/Collection.js.map +1 -1
- package/dist/SupportMessage/SupportMessage.d.ts +2 -1
- package/dist/SupportMessage/SupportMessage.js +27 -12
- package/dist/SupportMessage/SupportMessage.js.map +1 -1
- package/dist/Tag/Tag.d.ts +2 -1
- package/dist/Tag/Tag.js +18 -3
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Text/Text.d.ts +2 -1
- package/dist/Text/Text.js +2 -1
- package/dist/Text/Text.js.map +1 -1
- package/dist/TextInput/TextInput.js +2 -1
- package/dist/TextInput/TextInput.js.map +1 -1
- package/dist/Textarea/Textarea.d.ts +3 -5
- package/dist/Textarea/Textarea.js +1 -1
- package/dist/Textarea/Textarea.js.map +1 -1
- package/dist/Textarea/Textarea.stories.d.ts +1 -0
- package/dist/Textarea/Textarea.stories.js +11 -0
- package/dist/Textarea/Textarea.stories.js.map +1 -1
- package/dist/Toggle/Toggle.d.ts +2 -1
- package/dist/Toggle/Toggle.js +16 -3
- package/dist/Toggle/Toggle.js.map +1 -1
- package/dist/Toggle/Toggle.stories.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/space.d.ts +4 -4
- package/dist/utils/space.js +7 -2
- package/dist/utils/space.js.map +1 -1
- package/package.json +1 -1
@@ -1,8 +1,9 @@
|
|
1
1
|
import { FC } from 'react';
|
2
|
+
import { MarginProps } from '../utils/space';
|
2
3
|
export declare type AccordionProps = {
|
3
4
|
title: string;
|
4
5
|
subTitle?: string;
|
5
6
|
borderTop?: boolean;
|
6
7
|
fullBorder?: boolean;
|
7
|
-
};
|
8
|
+
} & MarginProps;
|
8
9
|
export declare const Accordion: FC<AccordionProps>;
|
@@ -1,12 +1,24 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React, { useState } from 'react';
|
2
13
|
import styled, { css } from 'styled-components';
|
3
14
|
import { Box } from '../Box';
|
4
15
|
import { Icon } from '../Icon';
|
5
16
|
import { theme } from '../theme';
|
6
17
|
import { Text } from '../Text';
|
7
|
-
export const Accordion = (
|
18
|
+
export const Accordion = (_a) => {
|
19
|
+
var { title, children, borderTop = false, subTitle, fullBorder = false } = _a, marginProps = __rest(_a, ["title", "children", "borderTop", "subTitle", "fullBorder"]);
|
8
20
|
const [isOpen, setIsOpen] = useState(false);
|
9
|
-
return (React.createElement(Wrapper, { borderTop: borderTop, fullBorder: fullBorder },
|
21
|
+
return (React.createElement(Wrapper, Object.assign({ borderTop: borderTop, fullBorder: fullBorder }, marginProps),
|
10
22
|
React.createElement(TopContainer, { flex: true, alignItems: "center", justifyContent: "space-between", onClick: () => setIsOpen(!isOpen), fullBorder: fullBorder, isOpen: isOpen },
|
11
23
|
React.createElement(TitleContainer, null,
|
12
24
|
React.createElement(Title, null, title),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/Accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAM,QAAQ,EA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ACX,CAAA;AACH,CAAC,CAAA;AAQD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CACzB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;+BACL,KAAK,CAAC,MAAM,CAAC,OAAO;;kBAEjC,SAAS,IAAI,aAAa,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;;MAE5D,UAAU;IACZ,GAAG,CAAA;0BACmB,KAAK,CAAC,MAAM,CAAC,OAAO;;;;KAIzC;GACF,CACF,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGhC,CAAA;AACD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAC9B,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;MAG3B,UAAU;IACZ,GAAG,CAAA;;KAEF;;MAEC,MAAM;IACR,GAAG,CAAA;;KAEF;GACF,CACF,CAAA;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAA;WACZ,KAAK,CAAC,MAAM,CAAC,SAAS;;;iBAGhB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;CACxC,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAC5B,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;iBACJ,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc;;GAExD,CACF,CAAA"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { FC } from 'react';
|
2
2
|
import { ActionListItem } from './List';
|
3
|
+
import { MarginProps } from '../utils/space';
|
3
4
|
export declare type ActionDropdownProps = {
|
4
5
|
id?: string;
|
5
6
|
className?: string;
|
@@ -11,5 +12,5 @@ export declare type ActionDropdownProps = {
|
|
11
12
|
list: ActionListItem[];
|
12
13
|
/** onSelect handler */
|
13
14
|
onSelect: (action: ActionListItem) => void;
|
14
|
-
};
|
15
|
+
} & MarginProps;
|
15
16
|
export declare const ActionDropdown: FC<ActionDropdownProps>;
|
@@ -1,17 +1,30 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React, { useState } from 'react';
|
2
13
|
import styled, { css } from 'styled-components';
|
14
|
+
import { Box } from '../Box';
|
3
15
|
import { Text } from '../Text';
|
4
16
|
import { Icon } from '../Icon';
|
5
17
|
import { List } from './List';
|
6
18
|
import { theme } from '../theme';
|
7
|
-
export const ActionDropdown = (
|
8
|
-
var
|
19
|
+
export const ActionDropdown = (_a) => {
|
20
|
+
var _b, _c, _d;
|
21
|
+
var { id, className = '', label, value, list, onSelect } = _a, marginProps = __rest(_a, ["id", "className", "label", "value", "list", "onSelect"]);
|
9
22
|
const [open, setOpen] = useState(false);
|
10
|
-
return (React.createElement(Container, { id: id, className: className, onClick: () => setOpen((currentOpen) => !currentOpen) },
|
23
|
+
return (React.createElement(Container, Object.assign({ id: id, className: className, onClick: () => setOpen((currentOpen) => !currentOpen) }, marginProps),
|
11
24
|
label && (React.createElement(Text, { tag: "label", color: "subtext", typo: "label" }, label)),
|
12
|
-
React.createElement(Label, { text: (
|
25
|
+
React.createElement(Label, { text: (_b = value.textColor) !== null && _b !== void 0 ? _b : 'secondary', bg: (_c = value.bgColor) !== null && _c !== void 0 ? _c : 'subtext' },
|
13
26
|
React.createElement(SelectedOption, null, value.label),
|
14
|
-
React.createElement(Icon, { render: "caret", color: (
|
27
|
+
React.createElement(Icon, { render: "caret", color: (_d = value.textColor) !== null && _d !== void 0 ? _d : 'subtext', size: 24, rotate: open ? 180 : 0 })),
|
15
28
|
React.createElement(OuterContainer, { open: open },
|
16
29
|
React.createElement(List, { options: list, selectOption: onSelect }))));
|
17
30
|
};
|
@@ -36,7 +49,7 @@ const SelectedOption = styled.span `
|
|
36
49
|
overflow: hidden;
|
37
50
|
text-overflow: ellipsis;
|
38
51
|
`;
|
39
|
-
const Container = styled
|
52
|
+
const Container = styled(Box) `
|
40
53
|
position: relative;
|
41
54
|
display: block;
|
42
55
|
width: 210px;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ActionDropdown.js","sourceRoot":"","sources":["../../src/ActionDropdown/ActionDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAS,KAAK,EAAE,MAAM,UAAU,CAAA;
|
1
|
+
{"version":3,"file":"ActionDropdown.js","sourceRoot":"","sources":["../../src/ActionDropdown/ActionDropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC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M,KAAK,GAAG,MAAM,CAAC,GAAG,CACtB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;aACV,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;wBACP,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;;;;;;;;;;;;GAYrC,CACF,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;CAKjC,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;;;;;;;;CAS5B,CAAA;AAMD,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAC/B,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;;;eAKJ,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;kBACpB,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;wBACjB,KAAK,CAAC,MAAM,CAAC,KAAK;wBAClB,KAAK,CAAC,MAAM,CAAC,OAAO;kBAC1B,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;;;GAGvC,CACF,CAAA"}
|
package/dist/Box/Box.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { FlexProps } from '../utils/flex';
|
2
2
|
import { MeasureProps } from '../utils/measure';
|
3
|
-
import {
|
4
|
-
export declare type BoxProps =
|
5
|
-
export declare const Box: import("styled-components").StyledComponent<"div", any,
|
3
|
+
import { MarginProps, PaddingProps } from '../utils/space';
|
4
|
+
export declare type BoxProps = MarginProps & PaddingProps & FlexProps & MeasureProps;
|
5
|
+
export declare const Box: import("styled-components").StyledComponent<"div", any, MarginProps & PaddingProps & FlexProps & MeasureProps, never>;
|
package/dist/Box/Box.js
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import styled from 'styled-components';
|
2
2
|
import { flex } from '../utils/flex';
|
3
3
|
import { measure } from '../utils/measure';
|
4
|
-
import {
|
4
|
+
import { margin, padding } from '../utils/space';
|
5
5
|
export const Box = styled.div `
|
6
|
-
${
|
6
|
+
${margin};
|
7
|
+
${padding};
|
7
8
|
${flex};
|
8
9
|
${measure};
|
9
10
|
`;
|
package/dist/Box/Box.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../src/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAa,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../src/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAa,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,OAAO,EAA6B,MAAM,gBAAgB,CAAA;AAI3E,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAU;IACnC,MAAM;IACN,OAAO;IACP,IAAI;IACJ,OAAO;CACV,CAAA"}
|
package/dist/Button/Button.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { FC, ReactNode, ButtonHTMLAttributes } from 'react';
|
2
2
|
import { Color } from '../theme';
|
3
|
+
import { MarginProps } from '../utils/space';
|
3
4
|
declare type Props = {
|
4
5
|
children: ReactNode;
|
5
6
|
id?: string;
|
@@ -17,8 +18,7 @@ declare type Props = {
|
|
17
18
|
icon?: string;
|
18
19
|
forcedWidth?: string;
|
19
20
|
form?: string;
|
20
|
-
type?: 'button' | 'submit' | 'reset';
|
21
21
|
};
|
22
|
-
export declare type ButtonProps = Props & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
|
22
|
+
export declare type ButtonProps = Props & MarginProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
|
23
23
|
export declare const Button: FC<ButtonProps>;
|
24
24
|
export {};
|
package/dist/Button/Button.js
CHANGED
@@ -16,6 +16,7 @@ import { theme } from '../theme';
|
|
16
16
|
import { focusOutline } from '../utils/focusOutline';
|
17
17
|
import { useDeprecatedWarning } from '../utils/deprecated';
|
18
18
|
import { LegacyButton } from './LegacyButton';
|
19
|
+
import { Box } from '../Box';
|
19
20
|
import { Loader } from '../Loader';
|
20
21
|
import { Icon as IconComponent } from '../Icon';
|
21
22
|
export const Button = forwardRef((props, ref) => {
|
@@ -32,9 +33,7 @@ export const Button = forwardRef((props, ref) => {
|
|
32
33
|
handleClick && handleClick(e);
|
33
34
|
} }, children));
|
34
35
|
}
|
35
|
-
return (React.createElement(Container, Object.assign({ id: id, className: className, disabled: disabled || loading, onClick: (
|
36
|
-
handleClick && handleClick(e);
|
37
|
-
}, isLoading: loading, primary: primary, secondary: secondary, tertiary: tertiary, icon: icon, forcedWidth: forcedWidth }, (form ? { form } : {}), { type: type }, otherProps, { ref: ref }),
|
36
|
+
return (React.createElement(Container, Object.assign({ as: "button", id: id, className: className, disabled: disabled || loading, onClick: handleClick, "$loading": loading, primary: primary, secondary: secondary, tertiary: tertiary, icon: icon, forcedWidth: forcedWidth }, (form ? { form } : {}), { type: type }, otherProps, { ref: ref }),
|
38
37
|
loading && (React.createElement(LoaderContainer, null,
|
39
38
|
React.createElement(Loader, { color: primary ? 'white' : 'secondary', height: "16" }))),
|
40
39
|
React.createElement(ContentContainer, { icon: icon, "$loading": loading },
|
@@ -42,7 +41,7 @@ export const Button = forwardRef((props, ref) => {
|
|
42
41
|
React.createElement(ChildrenContainer, null, children))));
|
43
42
|
});
|
44
43
|
Button.displayName = 'Button';
|
45
|
-
const Container = styled
|
44
|
+
const Container = styled(Box)(({ disabled, $loading, primary, secondary, tertiary, forcedWidth }) => css `
|
46
45
|
${focusOutline()}
|
47
46
|
position: relative;
|
48
47
|
background-color: ${theme.colors.primary};
|
@@ -53,7 +52,7 @@ const Container = styled.button(({ disabled, isLoading, primary, secondary, tert
|
|
53
52
|
outline: none;
|
54
53
|
border-radius: 8px;
|
55
54
|
font-weight: ${theme.font.weight.medium};
|
56
|
-
cursor: ${disabled ||
|
55
|
+
cursor: ${disabled || $loading ? 'not-allowed' : 'pointer'};
|
57
56
|
line-height: 100%;
|
58
57
|
font-size: 16px;
|
59
58
|
opacity: ${disabled ? '0.5' : '1'};
|
@@ -65,9 +64,9 @@ const Container = styled.button(({ disabled, isLoading, primary, secondary, tert
|
|
65
64
|
border-color: ${theme.colors.primary};
|
66
65
|
|
67
66
|
&:hover {
|
68
|
-
background-color: ${!(disabled ||
|
67
|
+
background-color: ${!(disabled || $loading) &&
|
69
68
|
darken(0.1, theme.colors.primary)};
|
70
|
-
border-color: ${!(disabled ||
|
69
|
+
border-color: ${!(disabled || $loading) &&
|
71
70
|
darken(0.1, theme.colors.primary)};
|
72
71
|
}
|
73
72
|
&:active {
|
@@ -81,9 +80,8 @@ const Container = styled.button(({ disabled, isLoading, primary, secondary, tert
|
|
81
80
|
border-color: ${theme.colors.secondary};
|
82
81
|
|
83
82
|
&:hover {
|
84
|
-
background-color: ${!(disabled ||
|
85
|
-
|
86
|
-
border: ${!(disabled || isLoading) &&
|
83
|
+
background-color: ${!(disabled || $loading) && theme.colors.background};
|
84
|
+
border: ${!(disabled || $loading) &&
|
87
85
|
`2px solid ${theme.colors.secondary}`};
|
88
86
|
}
|
89
87
|
&:active {
|
@@ -97,9 +95,9 @@ const Container = styled.button(({ disabled, isLoading, primary, secondary, tert
|
|
97
95
|
border-color: ${theme.colors.background};
|
98
96
|
|
99
97
|
&:hover {
|
100
|
-
background-color: ${!(disabled ||
|
98
|
+
background-color: ${!(disabled || $loading) &&
|
101
99
|
darken(0.1, theme.colors.background)};
|
102
|
-
border-color: ${!(disabled ||
|
100
|
+
border-color: ${!(disabled || $loading) &&
|
103
101
|
darken(0.1, theme.colors.background)};
|
104
102
|
}
|
105
103
|
&:active {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAuC,UAAU,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAS,KAAK,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAuC,UAAU,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAS,KAAK,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,W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AAM,CAAC,UAAU,CAAC;wBACpB,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC;QACvC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;;;4BAGhB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;wBACxC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;;KAEvD;GACF,CACF,CAAA;AAED,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;CASjC,CAAA;AAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAElC;;;qBAGoB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC;aACxD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;CACpD,CAAA;AAED,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;CAE1C,CAAA;AAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGnC,CAAA"}
|
package/dist/Card/Card.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
2
|
+
import { MarginProps } from '../utils/space';
|
2
3
|
export declare type CardProps = {
|
3
4
|
children: ReactNode;
|
4
5
|
className?: string;
|
@@ -12,5 +13,5 @@ export declare type CardProps = {
|
|
12
13
|
narrow?: boolean;
|
13
14
|
/** Wide padding */
|
14
15
|
wide?: boolean;
|
15
|
-
};
|
16
|
+
} & MarginProps;
|
16
17
|
export declare const Card: FC<CardProps>;
|
package/dist/Card/Card.js
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React from 'react';
|
2
13
|
import styled from 'styled-components';
|
3
14
|
import { theme } from '../theme';
|
4
|
-
|
5
|
-
const
|
15
|
+
import { Box } from '../Box';
|
16
|
+
export const Card = (_a) => {
|
17
|
+
var { children, className = '', maxWidth = '', marginX = '', marginY = '', narrow = false, wide = false } = _a, otherProps = __rest(_a, ["children", "className", "maxWidth", "marginX", "marginY", "narrow", "wide"]);
|
18
|
+
return (React.createElement(Container, Object.assign({ className: className, maxWidth: maxWidth, marginX: marginX, marginY: marginY, narrow: narrow, wide: wide }, otherProps), children));
|
19
|
+
};
|
20
|
+
const Container = styled(Box) `
|
6
21
|
background: ${theme.colors.white};
|
7
22
|
border: 1px solid ${theme.colors.outline};
|
8
23
|
box-sizing: border-box;
|
package/dist/Card/Card.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAA;AAC5C,OAAO,MAAM,MAAM,mBAAmB,CAAA;
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAwB,MAAM,OAAO,CAAA;AAC5C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,GAAG,EAAE,M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,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;;CAEnE,CAAA"}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { FC } from 'react';
|
2
|
+
import { MarginProps } from '../utils/space';
|
2
3
|
declare type Item = {
|
3
4
|
id: number;
|
4
5
|
label: string;
|
5
6
|
checked: boolean;
|
6
7
|
};
|
7
|
-
declare type
|
8
|
+
declare type CheckBoxGroupProps = {
|
8
9
|
list: Item[];
|
9
10
|
onToggle: (id: number) => void;
|
10
|
-
};
|
11
|
-
export declare const CheckBoxGroup: FC<
|
11
|
+
} & MarginProps;
|
12
|
+
export declare const CheckBoxGroup: FC<CheckBoxGroupProps>;
|
12
13
|
export {};
|
@@ -1,8 +1,23 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React from 'react';
|
2
13
|
import styled from 'styled-components';
|
14
|
+
import { Box } from '../Box';
|
3
15
|
import { CheckBox } from '../CheckBox';
|
4
|
-
export const CheckBoxGroup = (
|
5
|
-
|
16
|
+
export const CheckBoxGroup = (_a) => {
|
17
|
+
var { list, onToggle } = _a, marginProps = __rest(_a, ["list", "onToggle"]);
|
18
|
+
return (React.createElement(Container, null, list.map((item) => (React.createElement(CheckBox, Object.assign({ key: item.id, id: String(item.id), checked: item.checked, toggle: () => onToggle(item.id) }, marginProps), item.label)))));
|
19
|
+
};
|
20
|
+
const Container = styled(Box) `
|
6
21
|
display: flex;
|
7
22
|
flex-direction: column;
|
8
23
|
gap: 16px;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CheckBoxGroup.js","sourceRoot":"","sources":["../../src/CheckBoxGroup/CheckBoxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAA;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;
|
1
|
+
{"version":3,"file":"CheckBoxGroup.js","sourceRoot":"","sources":["../../src/CheckBoxGroup/CheckBoxGroup.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAa,MAAM,OAAO,CAAA;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AActC,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,EAIrD,EAAE,EAAE;QAJiD,EACpD,IAAI,EACJ,QAAQ,OAET,EADI,WAAW,cAHsC,oBAIrD,CADe;IACV,OAAA,CACJ,oBAAC,SAAS,QACP,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAClB,oBAAC,QAAQ,kBACP,GAAG,EAAE,IAAI,CAAC,EAAE,EACZ,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAC3B,WAAW,GAEd,IAAI,CAAC,KAAK,CACF,CACZ,CAAC,CACQ,CACb,CAAA;CAAA,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;;;CAI5B,CAAA"}
|
package/dist/Chip/Chip.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import React, { FC, ReactNode, ButtonHTMLAttributes } from 'react';
|
2
|
+
import { MarginProps } from '../utils/space';
|
2
3
|
declare type Props = {
|
3
4
|
children: ReactNode;
|
4
5
|
handleClick: (e: React.FormEvent<HTMLButtonElement>) => void;
|
@@ -7,7 +8,7 @@ declare type Props = {
|
|
7
8
|
icon?: string;
|
8
9
|
disabled?: boolean;
|
9
10
|
loading?: boolean;
|
10
|
-
};
|
11
|
+
} & MarginProps;
|
11
12
|
export declare type ChipProps = Props & ButtonHTMLAttributes<HTMLButtonElement>;
|
12
13
|
export declare const Chip: FC<ChipProps>;
|
13
14
|
export {};
|
package/dist/Chip/Chip.js
CHANGED
@@ -12,17 +12,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
12
12
|
import React, { forwardRef } from 'react';
|
13
13
|
import styled, { css } from 'styled-components';
|
14
14
|
import { theme } from '../theme';
|
15
|
+
import { Box } from '../Box';
|
15
16
|
import { Icon as IconComponent } from '../Icon';
|
16
17
|
import { Loader } from '../Loader';
|
17
18
|
import { focusOutline } from '../utils/focusOutline';
|
18
19
|
export const Chip = forwardRef((_a, ref) => {
|
19
20
|
var { children, handleClick, primary = false, secondary = false, disabled = false, loading = false, icon = '' } = _a, props = __rest(_a, ["children", "handleClick", "primary", "secondary", "disabled", "loading", "icon"]);
|
20
|
-
return (React.createElement(Container, Object.assign({ primary: primary, secondary: secondary, disabled: disabled || loading, "$loading": loading, onClick: handleClick, icon: icon }, props, { ref: ref }), loading ? (React.createElement(Loader, { color: primary ? 'white' : 'primary', height: "16" })) : (React.createElement(React.Fragment, null,
|
21
|
+
return (React.createElement(Container, Object.assign({ as: "button", primary: primary, secondary: secondary, disabled: disabled || loading, "$loading": loading, onClick: handleClick, icon: icon }, props, { ref: ref }), loading ? (React.createElement(Loader, { color: primary ? 'white' : 'primary', height: "16" })) : (React.createElement(React.Fragment, null,
|
21
22
|
icon && (React.createElement(IconComponent, { render: icon, size: 20, color: primary ? 'white' : 'primary' })),
|
22
23
|
React.createElement(ChildrenContainer, null, children)))));
|
23
24
|
});
|
24
25
|
Chip.displayName = 'Chip';
|
25
|
-
const Container = styled
|
26
|
+
const Container = styled(Box)(({ primary, secondary, icon, $loading, disabled }) => css `
|
26
27
|
${focusOutline()}
|
27
28
|
|
28
29
|
align-items: center;
|
package/dist/Chip/Chip.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../src/Chip/Chip.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAuC,UAAU,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;
|
1
|
+
{"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../src/Chip/Chip.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAuC,UAAU,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAuBpD,MAAM,CAAC,MAAM,IAAI,GAAkB,UAAU,CAC3C,CACE,EASC,EACD,GAAG,EACH,EAAE;QAXF,EACE,QAAQ,EACR,WAAW,EAC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AAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM;;cAEnC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;eAC/C,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG;;MAE/B,OAAO;IACT,GAAG,CAAA;;4BAEqB,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO;;KAErE;MACC,SAAS;IACX,GAAG,CAAA;eACQ,KAAK,CAAC,MAAM,CAAC,OAAO;0BACT,KAAK,CAAC,MAAM,CAAC,KAAK;;4BAEhB,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU;;KAEzE;GACF,CACF,CAAA;AAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEnC,CAAA"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { FC, FormEvent, ReactElement } from 'react';
|
2
|
+
import { MarginProps } from '../utils/space';
|
2
3
|
export declare type ConfirmationProps = {
|
3
4
|
onChange(value?: boolean): void;
|
4
5
|
checked?: boolean;
|
@@ -11,5 +12,5 @@ export declare type ConfirmationProps = {
|
|
11
12
|
yesLabel?: string | ReactElement;
|
12
13
|
noLabel?: string | ReactElement;
|
13
14
|
required?: boolean;
|
14
|
-
};
|
15
|
+
} & MarginProps;
|
15
16
|
export declare const Confirmation: FC<ConfirmationProps>;
|
@@ -1,3 +1,14 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React from 'react';
|
2
13
|
import styled from 'styled-components';
|
3
14
|
import { theme } from '../theme';
|
@@ -5,9 +16,10 @@ import { Box } from '../Box';
|
|
5
16
|
import { Text } from '../Text';
|
6
17
|
import { RadioButton } from './RadioButtonStyled';
|
7
18
|
import { useUniqueId } from '../utils/id';
|
8
|
-
export const Confirmation = (
|
19
|
+
export const Confirmation = (_a) => {
|
20
|
+
var { checked, onChange, id: idProp, error = false, errorMsg = '', label, onBlur, sublabel, yesLabel = 'Yes', noLabel = 'No', required = false } = _a, marginProps = __rest(_a, ["checked", "onChange", "id", "error", "errorMsg", "label", "onBlur", "sublabel", "yesLabel", "noLabel", "required"]);
|
9
21
|
const id = useUniqueId(idProp);
|
10
|
-
return (React.createElement(ConfirmationWrapper,
|
22
|
+
return (React.createElement(ConfirmationWrapper, Object.assign({}, marginProps),
|
11
23
|
(label || sublabel) && (React.createElement(TextWrapper, null,
|
12
24
|
label && (React.createElement(SectionHeadingText, { tag: "h3" },
|
13
25
|
label,
|
@@ -59,9 +71,8 @@ const ErrorBox = styled.span `
|
|
59
71
|
color: ${theme.colors.error};
|
60
72
|
`;
|
61
73
|
const ConfirmationWrapper = styled(Box) `
|
62
|
-
display:
|
63
|
-
|
64
|
-
align-items: center;
|
74
|
+
display: flex;
|
75
|
+
flex-direction: column;
|
65
76
|
`;
|
66
77
|
const SectionHeadingText = styled(Text) `
|
67
78
|
font-weight: bold;
|
@@ -69,6 +80,7 @@ const SectionHeadingText = styled(Text) `
|
|
69
80
|
const TextWrapper = styled.div `
|
70
81
|
display: flex;
|
71
82
|
flex-direction: column;
|
83
|
+
margin-bottom: 8px;
|
72
84
|
`;
|
73
85
|
const Asterisk = styled.span `
|
74
86
|
font-size: 14px;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../src/ConfirmationRadioButtons/Confirmation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAa,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
1
|
+
{"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../src/ConfirmationRadioButtons/Confirmation.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAa,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAiBzC,MAAM,CAAC,MAAM,YAAY,GAA0B,CAAC,EAahC,EAAE,EAAE;QAb4B,EAClD,OAAO,EACP,QAAQ,EACR,EAAE,EAAE,MAAM,EACV,KAAK,GAAG,KAAK,EACb,QAAQ,GAAG,EAAE,EACb,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,KAAK,OAEE,EADf,WAAW,cAZoC,oHAanD,CADe;IAEd,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IAC9B,OAAO,CACL,oBAAC,mBAAmB,oBAAK,WAAW;QACjC,CAAC,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,MAAM,QAAQ,GAAG,CAAC,OAAiB,EAAE,KAAe,EAAE,EAAE;IACtD,IAAI,KAAK,EAAE;QACT,OAAO,aAAa,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;KACzC;SAAM,IAAI,OAAO,EAAE;QAClB,OAAO,aAAa,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,CAAA;KAC7C;SAAM;QACL,OAAO,MAAM,CAAA;KACd;AACH,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAW;sBAC1B,CAAC,EAAE,OAAO,EAAa,EAAE,EAAE,CAC7C,CAAC,OAAO,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE;YAChC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;;;;;;;;;CAStE,CAAA;AAED,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAA;;;;WAIjB,KAAK,CAAC,MAAM,CAAC,KAAK;CAC5B,CAAA;AAED,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;;CAGtC,CAAA;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAEtC,CAAA;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAI7B,CAAA;AAED,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAA;;WAEjB,KAAK,CAAC,MAAM,CAAC,KAAK;CAC5B,CAAA"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { FC } from 'react';
|
2
|
+
import { MarginProps } from '../utils/space';
|
2
3
|
export declare type DatepickerProps = {
|
3
4
|
disableWeekend?: boolean;
|
4
|
-
firstDayShift?: boolean;
|
5
5
|
fromDate?: Date;
|
6
6
|
range?: number;
|
7
7
|
onDateSelect: (date: string) => void;
|
8
|
-
};
|
8
|
+
} & MarginProps;
|
9
9
|
export declare const Datepicker: FC<DatepickerProps>;
|
@@ -1,3 +1,14 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React, { useState } from 'react';
|
2
13
|
import styled from 'styled-components';
|
3
14
|
import { format, addDays, getMonth, getYear, eachMonthOfInterval, isSameDay, isWithinInterval, getDaysInMonth, isWeekend, } from 'date-fns';
|
@@ -17,7 +28,8 @@ const getAvailableMonths = (startDate, endDate) => {
|
|
17
28
|
label: format(monthDate, 'MMMM'),
|
18
29
|
}));
|
19
30
|
};
|
20
|
-
export const Datepicker = (
|
31
|
+
export const Datepicker = (_a) => {
|
32
|
+
var { disableWeekend = true, range = 14, fromDate = new Date(), onDateSelect } = _a, marginProps = __rest(_a, ["disableWeekend", "range", "fromDate", "onDateSelect"]);
|
21
33
|
// We want to make sure that the date is in the UK timezone,
|
22
34
|
// this might need to be revisit when opening up to new countries
|
23
35
|
const startDate = convertToUkDate(fromDate);
|
@@ -46,7 +58,7 @@ export const Datepicker = ({ disableWeekend = true, firstDayShift = false, range
|
|
46
58
|
}
|
47
59
|
return filteredDays;
|
48
60
|
};
|
49
|
-
return (React.createElement(Container, { id: "datepicker" },
|
61
|
+
return (React.createElement(Container, Object.assign({ id: "datepicker" }, marginProps),
|
50
62
|
React.createElement(Header, { flex: true, alignItems: "center", justifyContent: "space-between", direction: "row" },
|
51
63
|
React.createElement(Circle, { disabled: activeMonthIndex === 0, onClick: () => setActiveMonth(activeMonthIndex - 1) },
|
52
64
|
React.createElement(Caret, { render: "caret", color: "white", size: 24, rotate: 90 })),
|
@@ -54,7 +66,7 @@ export const Datepicker = ({ disableWeekend = true, firstDayShift = false, range
|
|
54
66
|
React.createElement(Circle, { disabled: activeMonthIndex === availableMonths.length - 1, onClick: () => setActiveMonth(activeMonthIndex + 1) },
|
55
67
|
React.createElement(Caret, { render: "caret", color: "white", size: 24, rotate: -90 }))),
|
56
68
|
React.createElement(Box, { flex: true, alignItems: "center", justifyContent: "center" },
|
57
|
-
React.createElement(DatesList, { items: generateDaysForMonth(availableMonths[activeMonthIndex].date), handleDateSelect: handleSelectEvent
|
69
|
+
React.createElement(DatesList, { items: generateDaysForMonth(availableMonths[activeMonthIndex].date), handleDateSelect: handleSelectEvent }))));
|
58
70
|
};
|
59
71
|
const Container = styled(Box) `
|
60
72
|
font-family: ${theme.font.system};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Datepicker.js","sourceRoot":"","sources":["../../src/Datepicker/Datepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;
|
1
|
+
{"version":3,"file":"Datepicker.js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AM,CAAC,GAAG,CAAC,CAAA;iBACZ,KAAK,CAAC,IAAI,CAAC,MAAM;;;sBAGZ,KAAK,CAAC,MAAM,CAAC,KAAK;;;gCAGR,KAAK,CAAC,MAAM,CAAC,OAAO;CACnD,CAAA;AAED,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;WACf,KAAK,CAAC,MAAM,CAAC,SAAS;;;6BAGJ,KAAK,CAAC,MAAM,CAAC,OAAO;;;;;;CAMhD,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;iBAGX,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;CACxC,CAAA;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;CAIzB,CAAA;AAED,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;sBACN,KAAK,CAAC,MAAM,CAAC,SAAS;;;;;;;;;;;;CAY3C,CAAA"}
|
@@ -6,12 +6,11 @@ const getBlankDaysCount = (firstDayOfTheMonth) => {
|
|
6
6
|
const dayOfTheWeek = getISODay(firstDayOfTheMonth);
|
7
7
|
return dayOfTheWeek - 1;
|
8
8
|
};
|
9
|
-
export const DatesList = ({ items, handleDateSelect
|
9
|
+
export const DatesList = ({ items, handleDateSelect }) => {
|
10
10
|
return (React.createElement(Container, null,
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
.map((_, index) => React.createElement(ListItem, { key: `blankItem-${index}`, disabled: true })),
|
11
|
+
Array(getBlankDaysCount(items[0].date))
|
12
|
+
.fill(null)
|
13
|
+
.map((_, index) => (React.createElement(ListItem, { key: `blankItem-${index}`, disabled: true }))),
|
15
14
|
items.map((item, i) => (React.createElement(ListItem, { key: i, disabled: item.disabled, className: `ListItem ${item.active ? 'active' : ''}`, onClick: () => handleDateSelect(item.date) }, item.label)))));
|
16
15
|
};
|
17
16
|
const Container = styled.ul `
|