@mailstep/design-system 0.7.12 → 0.7.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.7.12",
3
+ "version": "0.7.13",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -1,3 +1,3 @@
1
1
  import { Props } from './types';
2
- declare const Toggle: ({ onChange, label, name, checked, defaultChecked, spaceAround, disabled, labelPosition, variant, spaceBetween, readOnly, ...rest }: Props) => JSX.Element;
2
+ declare const Toggle: ({ onChange, label, name, checked, defaultChecked, spaceAround, disabled, labelPosition, labelJustify, variant, spaceBetween, readOnly, ...rest }: Props) => JSX.Element;
3
3
  export default Toggle;
@@ -33,8 +33,8 @@ var StyledSpaceAroundWrap = styled(SpaceAroundWrap)(templateObject_1 || (templat
33
33
  var labelPosition = _a.labelPosition;
34
34
  return labelPosition === 'left' ? 'row' : labelPosition === 'right' ? 'row-reverse' : 'column';
35
35
  }, function (_a) {
36
- var labelPosition = _a.labelPosition;
37
- return (labelPosition === 'right' ? 'flex-end' : 'flex-start');
36
+ var labelPosition = _a.labelPosition, labelJustify = _a.labelJustify;
37
+ return labelPosition === 'right' ? 'flex-end' : labelJustify === 'between' ? 'space-between' : 'flex-start';
38
38
  }, function (_a) {
39
39
  var labelPosition = _a.labelPosition;
40
40
  return (isHorizontal(labelPosition) ? 'margin-top: 1rem' : '');
@@ -55,8 +55,8 @@ var HiddenInput = styled.input(templateObject_6 || (templateObject_6 = __makeTem
55
55
  });
56
56
  var Wrapper = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: relative;\n border-radius: 8px;\n overflow: hidden;\n flex-shrink: 0;\n &[data-appearance='primary'] {\n width: 24px;\n height: 14px;\n ", " {\n height: 10px;\n }\n }\n &[data-appearance='grid'] {\n width: 28px;\n height: 16px;\n ", " {\n height: 12px;\n }\n }\n"], ["\n position: relative;\n border-radius: 8px;\n overflow: hidden;\n flex-shrink: 0;\n &[data-appearance='primary'] {\n width: 24px;\n height: 14px;\n ", " {\n height: 10px;\n }\n }\n &[data-appearance='grid'] {\n width: 28px;\n height: 16px;\n ", " {\n height: 12px;\n }\n }\n"])), StyledDot, StyledDot);
57
57
  var Toggle = function (_a) {
58
- var onChange = _a.onChange, label = _a.label, name = _a.name, checked = _a.checked, defaultChecked = _a.defaultChecked, _b = _a.spaceAround, spaceAround = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.labelPosition, labelPosition = _d === void 0 ? 'default' : _d, _e = _a.variant, variant = _e === void 0 ? 'primary' : _e, _f = _a.spaceBetween, spaceBetween = _f === void 0 ? false : _f, readOnly = _a.readOnly, rest = __rest(_a, ["onChange", "label", "name", "checked", "defaultChecked", "spaceAround", "disabled", "labelPosition", "variant", "spaceBetween", "readOnly"]);
59
- return (_jsxs(StyledSpaceAroundWrap, { spaceBetween: spaceBetween, spaceAround: spaceAround, labelPosition: labelPosition, children: [label && (_jsx(StyledFieldLabel, { htmlFor: name, labelPosition: labelPosition, children: label })), _jsxs(Wrapper, { "data-appearance": variant, children: [_jsx(HiddenInput, { id: name, name: name, type: "checkbox", checked: checked, "$enabled": !disabled, defaultChecked: defaultChecked, onChange: !disabled ? onChange : undefined, disabled: disabled, "data-cy": "".concat(name, "Switch"), readOnly: readOnly }), _jsx(StyledToggle, __assign({ active: !!checked, disabled: disabled }, rest, { children: _jsx(StyledDot, {}) }))] })] }));
58
+ var onChange = _a.onChange, label = _a.label, name = _a.name, checked = _a.checked, defaultChecked = _a.defaultChecked, _b = _a.spaceAround, spaceAround = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.labelPosition, labelPosition = _d === void 0 ? 'default' : _d, labelJustify = _a.labelJustify, _e = _a.variant, variant = _e === void 0 ? 'primary' : _e, _f = _a.spaceBetween, spaceBetween = _f === void 0 ? false : _f, readOnly = _a.readOnly, rest = __rest(_a, ["onChange", "label", "name", "checked", "defaultChecked", "spaceAround", "disabled", "labelPosition", "labelJustify", "variant", "spaceBetween", "readOnly"]);
59
+ return (_jsxs(StyledSpaceAroundWrap, { spaceBetween: spaceBetween, spaceAround: spaceAround, labelPosition: labelPosition, labelJustify: labelJustify, children: [label && (_jsx(StyledFieldLabel, { htmlFor: name, labelPosition: labelPosition, children: label })), _jsxs(Wrapper, { "data-appearance": variant, children: [_jsx(HiddenInput, { id: name, name: name, type: "checkbox", checked: checked, "$enabled": !disabled, defaultChecked: defaultChecked, onChange: !disabled ? onChange : undefined, disabled: disabled, "data-cy": "".concat(name, "Switch"), readOnly: readOnly }), _jsx(StyledToggle, __assign({ active: !!checked, disabled: disabled }, rest, { children: _jsx(StyledDot, {}) }))] })] }));
60
60
  };
61
61
  export default Toggle;
62
62
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -2,7 +2,7 @@
2
2
  import type { StoryObj } from '@storybook/react';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ onChange, label, name, checked, defaultChecked, spaceAround, disabled, labelPosition, variant, spaceBetween, readOnly, ...rest }: import("../types").Props) => JSX.Element;
5
+ component: ({ onChange, label, name, checked, defaultChecked, spaceAround, disabled, labelPosition, labelJustify, variant, spaceBetween, readOnly, ...rest }: import("../types").Props) => JSX.Element;
6
6
  tags: string[];
7
7
  argTypes: {};
8
8
  };
@@ -13,4 +13,5 @@ export declare const Checked: Story;
13
13
  export declare const Disabled: Story;
14
14
  export declare const LabelRight: Story;
15
15
  export declare const LabelLeft: Story;
16
+ export declare const LabelJustifyBetween: Story;
16
17
  export declare const VariantGrid: Story;
@@ -3,7 +3,7 @@ var meta = {
3
3
  title: 'Elements/Toggle',
4
4
  component: Toggle,
5
5
  tags: ['autodocs'],
6
- argTypes: {},
6
+ argTypes: {}
7
7
  };
8
8
  export default meta;
9
9
  export var Default = {
@@ -11,7 +11,7 @@ export var Default = {
11
11
  name: 'name',
12
12
  label: 'Label',
13
13
  onChange: console.log
14
- },
14
+ }
15
15
  };
16
16
  export var Checked = {
17
17
  args: {
@@ -19,15 +19,15 @@ export var Checked = {
19
19
  label: 'Label',
20
20
  checked: true,
21
21
  onChange: console.log
22
- },
22
+ }
23
23
  };
24
24
  export var Disabled = {
25
25
  args: {
26
26
  name: 'name',
27
27
  label: 'Label',
28
28
  checked: true,
29
- disabled: true,
30
- },
29
+ disabled: true
30
+ }
31
31
  };
32
32
  export var LabelRight = {
33
33
  args: {
@@ -35,7 +35,7 @@ export var LabelRight = {
35
35
  label: 'Label',
36
36
  checked: true,
37
37
  labelPosition: 'right'
38
- },
38
+ }
39
39
  };
40
40
  export var LabelLeft = {
41
41
  args: {
@@ -43,13 +43,22 @@ export var LabelLeft = {
43
43
  label: 'Label',
44
44
  checked: true,
45
45
  labelPosition: 'left'
46
- },
46
+ }
47
+ };
48
+ export var LabelJustifyBetween = {
49
+ args: {
50
+ name: 'name',
51
+ label: 'Label',
52
+ checked: true,
53
+ labelPosition: 'left',
54
+ labelJustify: 'between'
55
+ }
47
56
  };
48
57
  export var VariantGrid = {
49
58
  args: {
50
59
  name: 'name',
51
60
  label: 'Label',
52
61
  checked: true,
53
- variant: 'grid',
54
- },
62
+ variant: 'grid'
63
+ }
55
64
  };
@@ -7,6 +7,7 @@ type SpaceAroundProps = {
7
7
  };
8
8
  type SpaceAround = boolean | SpaceAroundProps;
9
9
  export type LabelPosition = 'default' | 'left' | 'right';
10
+ export type LabelJustify = 'between';
10
11
  export type Variant = 'primary' | 'grid';
11
12
  export type Props = {
12
13
  onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
@@ -18,6 +19,7 @@ export type Props = {
18
19
  spaceBetween?: boolean;
19
20
  disabled?: boolean;
20
21
  labelPosition?: LabelPosition;
22
+ labelJustify?: LabelJustify;
21
23
  variant?: Variant;
22
24
  readOnly?: boolean;
23
25
  };
package/ui/index.es.js CHANGED
@@ -28693,8 +28693,9 @@ const U4e = z.div`
28693
28693
  labelPosition: e
28694
28694
  }) => e === "left" ? "row" : e === "right" ? "row-reverse" : "column"};
28695
28695
  justify-content: ${({
28696
- labelPosition: e
28697
- }) => e === "right" ? "flex-end" : "flex-start"};
28696
+ labelPosition: e,
28697
+ labelJustify: t
28698
+ }) => e === "right" ? "flex-end" : t === "between" ? "space-between" : "flex-start"};
28698
28699
  ${({
28699
28700
  labelPosition: e
28700
28701
  }) => eP(e) ? "margin-top: 1rem" : ""}
@@ -28781,15 +28782,16 @@ const U4e = z.div`
28781
28782
  spaceAround: a = !1,
28782
28783
  disabled: o = !1,
28783
28784
  labelPosition: s = "default",
28784
- variant: l = "primary",
28785
- spaceBetween: u = !1,
28786
- readOnly: f,
28787
- ...A
28788
- }) => /* @__PURE__ */ p.jsxs(K4e, { spaceBetween: u, spaceAround: a, labelPosition: s, children: [
28785
+ labelJustify: l,
28786
+ variant: u = "primary",
28787
+ spaceBetween: f = !1,
28788
+ readOnly: A,
28789
+ ...h
28790
+ }) => /* @__PURE__ */ p.jsxs(K4e, { spaceBetween: f, spaceAround: a, labelPosition: s, labelJustify: l, children: [
28789
28791
  t && /* @__PURE__ */ p.jsx(q4e, { htmlFor: r, labelPosition: s, children: t }),
28790
- /* @__PURE__ */ p.jsxs(rve, { "data-appearance": l, children: [
28791
- /* @__PURE__ */ p.jsx(tve, { id: r, name: r, type: "checkbox", checked: n, $enabled: !o, defaultChecked: i, onChange: o ? void 0 : e, disabled: o, "data-cy": `${r}Switch`, readOnly: f }),
28792
- /* @__PURE__ */ p.jsx(eve, { active: !!n, disabled: o, ...A, children: /* @__PURE__ */ p.jsx(l3, {}) })
28792
+ /* @__PURE__ */ p.jsxs(rve, { "data-appearance": u, children: [
28793
+ /* @__PURE__ */ p.jsx(tve, { id: r, name: r, type: "checkbox", checked: n, $enabled: !o, defaultChecked: i, onChange: o ? void 0 : e, disabled: o, "data-cy": `${r}Switch`, readOnly: A }),
28794
+ /* @__PURE__ */ p.jsx(eve, { active: !!n, disabled: o, ...h, children: /* @__PURE__ */ p.jsx(l3, {}) })
28793
28795
  ] })
28794
28796
  ] }), tP = z.div`
28795
28797
  padding-right: 12px;
package/ui/index.umd.js CHANGED
@@ -2109,7 +2109,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2109
2109
  `,Pfe=({name:e,label:t,onChange:r,checked:n,defaultChecked:i,size:a=4,className:o,disabled:s,inputRef:l,readOnly:u,minusIcon:f=!1})=>{const A=at(),h=R.fontSize(a)({theme:A}),g=x.useId();return p.jsxs(kfe,{size:h,className:o,children:[p.jsx("input",{type:"checkbox",ref:l,name:e,checked:n,defaultChecked:i,disabled:s,onChange:r,value:"",readOnly:u,"data-cy":e&&`${e}Checkbox`,id:g}),p.jsx(k3,{size:h,children:p.jsx(Ife,{icon:f?"minus":"check",size:h})}),t&&p.jsx(Ofe,{htmlFor:g,children:t})]})},Dc=x.memo(Pfe),tE=e=>e&&["left","right"].includes(e),Tfe=G(Io)`
2110
2110
  display: flex;
2111
2111
  flex-direction: ${({labelPosition:e})=>e==="left"?"row":e==="right"?"row-reverse":"column"};
2112
- justify-content: ${({labelPosition:e})=>e==="right"?"flex-end":"flex-start"};
2112
+ justify-content: ${({labelPosition:e,labelJustify:t})=>e==="right"?"flex-end":t==="between"?"space-between":"flex-start"};
2113
2113
  ${({labelPosition:e})=>tE(e)?"margin-top: 1rem":""}
2114
2114
  `,Mfe=G(ic)`
2115
2115
  cursor: pointer;
@@ -2179,7 +2179,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2179
2179
  height: 12px;
2180
2180
  }
2181
2181
  }
2182
- `,Lc=({onChange:e,label:t,name:r,checked:n,defaultChecked:i,spaceAround:a=!1,disabled:o=!1,labelPosition:s="default",variant:l="primary",spaceBetween:u=!1,readOnly:f,...A})=>p.jsxs(Tfe,{spaceBetween:u,spaceAround:a,labelPosition:s,children:[t&&p.jsx(Mfe,{htmlFor:r,labelPosition:s,children:t}),p.jsxs(Bfe,{"data-appearance":l,children:[p.jsx(Nfe,{id:r,name:r,type:"checkbox",checked:n,$enabled:!o,defaultChecked:i,onChange:o?void 0:e,disabled:o,"data-cy":`${r}Switch`,readOnly:f}),p.jsx(Lfe,{active:!!n,disabled:o,...A,children:p.jsx(O3,{})})]})]}),rE=G.div`
2182
+ `,Lc=({onChange:e,label:t,name:r,checked:n,defaultChecked:i,spaceAround:a=!1,disabled:o=!1,labelPosition:s="default",labelJustify:l,variant:u="primary",spaceBetween:f=!1,readOnly:A,...h})=>p.jsxs(Tfe,{spaceBetween:f,spaceAround:a,labelPosition:s,labelJustify:l,children:[t&&p.jsx(Mfe,{htmlFor:r,labelPosition:s,children:t}),p.jsxs(Bfe,{"data-appearance":u,children:[p.jsx(Nfe,{id:r,name:r,type:"checkbox",checked:n,$enabled:!o,defaultChecked:i,onChange:o?void 0:e,disabled:o,"data-cy":`${r}Switch`,readOnly:A}),p.jsx(Lfe,{active:!!n,disabled:o,...h,children:p.jsx(O3,{})})]})]}),rE=G.div`
2183
2183
  padding-right: 12px;
2184
2184
  `,jfe=G.div`
2185
2185
  display: flex;