@simplybusiness/mobius 3.5.1 → 3.6.1

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.
Files changed (123) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/components/Alert/Alert.js +1 -5
  3. package/dist/cjs/components/Alert/Alert.js.map +1 -1
  4. package/dist/cjs/components/Checkbox/Checkbox.test.js +0 -2
  5. package/dist/cjs/components/Checkbox/Checkbox.test.js.map +1 -1
  6. package/dist/cjs/components/Checkbox/CheckboxGroup.test.js +0 -2
  7. package/dist/cjs/components/Checkbox/CheckboxGroup.test.js.map +1 -1
  8. package/dist/cjs/components/Chopin/Question/Question.test.js +0 -2
  9. package/dist/cjs/components/Chopin/Question/Question.test.js.map +1 -1
  10. package/dist/cjs/components/Chopin/Steps/StepItem.js +1 -5
  11. package/dist/cjs/components/Chopin/Steps/StepItem.js.map +1 -1
  12. package/dist/cjs/components/Icon/IconFromObject.js +4 -20
  13. package/dist/cjs/components/Icon/IconFromObject.js.map +1 -1
  14. package/dist/cjs/components/Radio/Radio.js +2 -6
  15. package/dist/cjs/components/Radio/Radio.js.map +1 -1
  16. package/dist/cjs/components/Radio/Radio.test.js +0 -2
  17. package/dist/cjs/components/Radio/Radio.test.js.map +1 -1
  18. package/dist/cjs/components/Radio/RadioButton.js +2 -6
  19. package/dist/cjs/components/Radio/RadioButton.js.map +1 -1
  20. package/dist/cjs/components/Radio/RadioButton.test.js +0 -2
  21. package/dist/cjs/components/Radio/RadioButton.test.js.map +1 -1
  22. package/dist/cjs/components/Select/Select.js +1 -5
  23. package/dist/cjs/components/Select/Select.js.map +1 -1
  24. package/dist/cjs/components/Select/Select.test.js +0 -2
  25. package/dist/cjs/components/Select/Select.test.js.map +1 -1
  26. package/dist/cjs/components/Slider/Slider.js +1 -21
  27. package/dist/cjs/components/Slider/Slider.js.map +1 -1
  28. package/dist/cjs/components/Slider/Thumb.js +1 -7
  29. package/dist/cjs/components/Slider/Thumb.js.map +1 -1
  30. package/dist/cjs/components/TextArea/TextArea.js +1 -5
  31. package/dist/cjs/components/TextArea/TextArea.js.map +1 -1
  32. package/dist/cjs/components/TextField/TextField.js +1 -5
  33. package/dist/cjs/components/TextField/TextField.js.map +1 -1
  34. package/dist/cjs/components/TextField/TextField.test.js +0 -2
  35. package/dist/cjs/components/TextField/TextField.test.js.map +1 -1
  36. package/dist/cjs/contexts/ThemeContext/ThemeContext.js +1 -1
  37. package/dist/cjs/contexts/ThemeContext/ThemeContext.js.map +1 -1
  38. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  39. package/dist/esm/components/Alert/Alert.js +1 -5
  40. package/dist/esm/components/Alert/Alert.js.map +1 -1
  41. package/dist/esm/components/Checkbox/Checkbox.test.js +0 -2
  42. package/dist/esm/components/Checkbox/Checkbox.test.js.map +1 -1
  43. package/dist/esm/components/Checkbox/CheckboxGroup.test.js +0 -2
  44. package/dist/esm/components/Checkbox/CheckboxGroup.test.js.map +1 -1
  45. package/dist/esm/components/Chopin/Question/Question.test.js +0 -2
  46. package/dist/esm/components/Chopin/Question/Question.test.js.map +1 -1
  47. package/dist/esm/components/Chopin/Steps/StepItem.js +1 -5
  48. package/dist/esm/components/Chopin/Steps/StepItem.js.map +1 -1
  49. package/dist/esm/components/Icon/IconFromObject.js +4 -20
  50. package/dist/esm/components/Icon/IconFromObject.js.map +1 -1
  51. package/dist/esm/components/Radio/Radio.js +2 -6
  52. package/dist/esm/components/Radio/Radio.js.map +1 -1
  53. package/dist/esm/components/Radio/Radio.test.js +0 -2
  54. package/dist/esm/components/Radio/Radio.test.js.map +1 -1
  55. package/dist/esm/components/Radio/RadioButton.js +2 -6
  56. package/dist/esm/components/Radio/RadioButton.js.map +1 -1
  57. package/dist/esm/components/Radio/RadioButton.test.js +0 -2
  58. package/dist/esm/components/Radio/RadioButton.test.js.map +1 -1
  59. package/dist/esm/components/Select/Select.js +1 -5
  60. package/dist/esm/components/Select/Select.js.map +1 -1
  61. package/dist/esm/components/Select/Select.test.js +0 -2
  62. package/dist/esm/components/Select/Select.test.js.map +1 -1
  63. package/dist/esm/components/Slider/Slider.js +1 -21
  64. package/dist/esm/components/Slider/Slider.js.map +1 -1
  65. package/dist/esm/components/Slider/Thumb.js +1 -7
  66. package/dist/esm/components/Slider/Thumb.js.map +1 -1
  67. package/dist/esm/components/TextArea/TextArea.js +1 -5
  68. package/dist/esm/components/TextArea/TextArea.js.map +1 -1
  69. package/dist/esm/components/TextField/TextField.js +1 -5
  70. package/dist/esm/components/TextField/TextField.js.map +1 -1
  71. package/dist/esm/components/TextField/TextField.test.js +0 -2
  72. package/dist/esm/components/TextField/TextField.test.js.map +1 -1
  73. package/dist/esm/contexts/ThemeContext/ThemeContext.js +1 -1
  74. package/dist/esm/contexts/ThemeContext/ThemeContext.js.map +1 -1
  75. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  76. package/package.json +1 -4
  77. package/src/components/Alert/Alert.tsx +1 -6
  78. package/src/components/Button/Button.story.mdx +2 -6
  79. package/src/components/Checkbox/Checkbox.test.tsx +0 -3
  80. package/src/components/Checkbox/CheckboxGroup.test.tsx +0 -3
  81. package/src/components/Chopin/Question/Question.story.mdx +27 -49
  82. package/src/components/Chopin/Question/Question.story.styles.css +35 -0
  83. package/src/components/Chopin/Question/Question.test.tsx +0 -3
  84. package/src/components/Chopin/Steps/StepItem.tsx +1 -6
  85. package/src/components/Fieldset/Fieldset.story.mdx +0 -1
  86. package/src/components/Grid/Grid.story.mdx +60 -70
  87. package/src/components/Grid/Grid.story.styles.css +16 -0
  88. package/src/components/Icon/Icon.story.mdx +13 -6
  89. package/src/components/Icon/IconFromObject.tsx +4 -22
  90. package/src/components/Image/Image.story.mdx +1 -1
  91. package/src/components/Modal/Modal.story.mdx +81 -1
  92. package/src/components/NumberField/__snapshots__/NumberField.test.tsx.snap +0 -2
  93. package/src/components/Radio/Radio.test.tsx +0 -3
  94. package/src/components/Radio/Radio.tsx +5 -8
  95. package/src/components/Radio/RadioButton.test.tsx +0 -3
  96. package/src/components/Radio/RadioButton.tsx +5 -8
  97. package/src/components/Select/Select.test.tsx +0 -3
  98. package/src/components/Select/Select.tsx +2 -9
  99. package/src/components/Slider/Slider.tsx +7 -36
  100. package/src/components/Slider/Thumb.tsx +2 -9
  101. package/src/components/Text/Text.story.mdx +5 -7
  102. package/src/components/TextArea/TextArea.tsx +2 -10
  103. package/src/components/TextField/TextField.test.tsx +0 -3
  104. package/src/components/TextField/TextField.tsx +2 -10
  105. package/src/contexts/ThemeContext/ThemeContext.tsx +1 -1
  106. package/dist/cjs/components/Fieldset/stories/StyledLegend.d.ts +0 -5
  107. package/dist/cjs/components/Fieldset/stories/StyledLegend.js +0 -13
  108. package/dist/cjs/components/Fieldset/stories/StyledLegend.js.map +0 -1
  109. package/dist/cjs/utils/combineTruthyObjects.d.ts +0 -6
  110. package/dist/cjs/utils/combineTruthyObjects.js +0 -38
  111. package/dist/cjs/utils/combineTruthyObjects.js.map +0 -1
  112. package/dist/cjs/utils/combineTruthyObjects.test.d.ts +0 -1
  113. package/dist/cjs/utils/combineTruthyObjects.test.js +0 -122
  114. package/dist/cjs/utils/combineTruthyObjects.test.js.map +0 -1
  115. package/dist/esm/components/Fieldset/stories/StyledLegend.js +0 -7
  116. package/dist/esm/components/Fieldset/stories/StyledLegend.js.map +0 -1
  117. package/dist/esm/utils/combineTruthyObjects.js +0 -11
  118. package/dist/esm/utils/combineTruthyObjects.js.map +0 -1
  119. package/dist/esm/utils/combineTruthyObjects.test.js +0 -120
  120. package/dist/esm/utils/combineTruthyObjects.test.js.map +0 -1
  121. package/src/components/Fieldset/stories/StyledLegend.tsx +0 -7
  122. package/src/utils/combineTruthyObjects.test.ts +0 -125
  123. package/src/utils/combineTruthyObjects.ts +0 -12
@@ -98,7 +98,7 @@ const Demo = () => {
98
98
 
99
99
  ### Fullscreen Modal
100
100
 
101
- Set the `size` prop to "fullscreen".
101
+ Set the `size` prop to `fullscreen`.
102
102
 
103
103
  export const FullScreenDemo = props => {
104
104
  const [open, setOpen] = useState(false);
@@ -154,6 +154,70 @@ const FullScreenDemo = () => {
154
154
  };
155
155
  ```
156
156
 
157
+ ### With Custom Size
158
+
159
+ Set the `size` prop to `xs`, `sm`, `md`, `lg`, `xl` or `xxl`.
160
+
161
+ This will attach a custom CSS property `--size-[size]`.
162
+
163
+ For example, `size="sm"` will produce `--size-sm` CSS class name.
164
+
165
+ This class name can then be targeted globally or locally to set a modal size based on your application and/or feature requirements.
166
+
167
+ export const WithCustomSizeDemo = props => {
168
+ const [open, setOpen] = useState(false);
169
+ return (
170
+ <>
171
+ <Button onClick={() => setOpen(true)} variant="secondary">
172
+ Show Custom Size Modal 🔸
173
+ </Button>
174
+ <Modal
175
+ {...props}
176
+ size="sm"
177
+ isOpen={open}
178
+ onClose={() => setOpen(false)}
179
+ preventCloseOnEsc
180
+ >
181
+ <Modal.Header>The Custom Size Modal</Modal.Header>
182
+ <Modal.Content>
183
+ Aliquam fringilla quam vel purus rhoncus interdum in quis sapien. Sed
184
+ at eros et lectus mollis posuere. Morbi augue augue, venenatis vel
185
+ consectetur sed, vulputate et lorem. Integer venenatis nibh molestie
186
+ commodo lobortis. Phasellus sit amet dignissim nisi. Vivamus nisi
187
+ augue, scelerisque commodo libero vitae, vulputate interdum ex.
188
+ Integer non risus sollicitudin, cursus ipsum vitae, rhoncus nulla.
189
+ </Modal.Content>
190
+ </Modal>
191
+ </>
192
+ );
193
+ };
194
+
195
+ <WithCustomSizeDemo />
196
+
197
+ ```jsx
198
+ const WithCustomSizeDemo = () => {
199
+ const [open, setOpen] = useState(false);
200
+
201
+ return (
202
+ <>
203
+ <Button onClick={() => setOpen(true)} variant="secondary">
204
+ Show Custom Size Modal 🔸
205
+ </Button>
206
+
207
+ <Modal
208
+ size="sm"
209
+ isOpen={open}
210
+ onClose={() => setOpen(false)}
211
+ preventCloseOnEsc
212
+ >
213
+ <Modal.Header>The Latin Modal</Modal.Header>
214
+ <Modal.Content>...</Modal.Content>
215
+ </Modal>
216
+ </>
217
+ );
218
+ };
219
+ ```
220
+
157
221
  ### With Animation
158
222
 
159
223
  Set the `animation` prop to either `slideUp` or `fade`.
@@ -317,6 +381,22 @@ export const ExampleContent = ({ onClose }) => {
317
381
  {args => <FullScreenDemo {...args} />}
318
382
  </Story>
319
383
 
384
+ ### With Custom Size
385
+
386
+ <Story
387
+ name="With Custom Size"
388
+ args={{
389
+ isOpen: false,
390
+ shouldFocusAfterRender: true,
391
+ animation: "",
392
+ preventCloseOnEsc: false,
393
+ closeLabel: "Close",
394
+ size: "sm",
395
+ }}
396
+ >
397
+ {args => <WithCustomSizeDemo {...args} />}
398
+ </Story>
399
+
320
400
  ### With Animation
321
401
 
322
402
  <Story
@@ -40,7 +40,6 @@ exports[`NumberField should match snapshot 1`] = `
40
40
  class="mobius mobius/Icon"
41
41
  focusable="false"
42
42
  role="img"
43
- style="height: 1em; vertical-align: -0.2em; transform-origin: center;"
44
43
  viewBox="0 0 24 24"
45
44
  xmlns="http://www.w3.org/2000/svg"
46
45
  >
@@ -62,7 +61,6 @@ exports[`NumberField should match snapshot 1`] = `
62
61
  class="mobius mobius/Icon"
63
62
  focusable="false"
64
63
  role="img"
65
- style="height: 1em; vertical-align: -0.2em; transform-origin: center;"
66
64
  viewBox="0 0 16 16"
67
65
  xmlns="http://www.w3.org/2000/svg"
68
66
  >
@@ -1,10 +1,7 @@
1
1
  import { render, fireEvent, screen } from "@testing-library/react";
2
2
  import userEvent from "@testing-library/user-event";
3
- import { matchers } from "@emotion/jest";
4
3
  import { RadioGroup, Radio } from ".";
5
4
 
6
- expect.extend(matchers);
7
-
8
5
  describe("Radio", () => {
9
6
  it("should render without error", () => {
10
7
  const component = render(
@@ -7,11 +7,11 @@ import { useFocusRing } from "@react-aria/focus";
7
7
  import { useHover, HoverProps } from "@react-aria/interactions";
8
8
  import { DOMProps } from "@react-types/shared";
9
9
  import clsx from "clsx";
10
- import styled from '@emotion/styled';
11
10
  import { RadioContext } from "./RadioContext";
12
11
  import { ForwardedRefComponent } from "../../types/components";
13
12
  import { ErrorMessage } from "../ErrorMessage";
14
13
  import { Label } from "../Label";
14
+ import { Flex } from "../Flex";
15
15
 
16
16
  export type RadioElementType = HTMLInputElement;
17
17
 
@@ -28,11 +28,6 @@ export interface RadioProps
28
28
 
29
29
  export type RadioRef = Ref<RadioElementType>;
30
30
 
31
- const StyledLabel = styled(Label)`
32
- display: flex;
33
- align-items: center;
34
- `;
35
-
36
31
  const Radio: ForwardedRefComponent<RadioProps, RadioElementType> = forwardRef(
37
32
  (props: RadioProps, ref: RadioRef) => {
38
33
  const radioContext = useContext(RadioContext);
@@ -91,7 +86,9 @@ const Radio: ForwardedRefComponent<RadioProps, RadioElementType> = forwardRef(
91
86
 
92
87
  return (
93
88
  <>
94
- <StyledLabel
89
+ <Flex
90
+ alignItems="center"
91
+ elementType={Label}
95
92
  {...hoverProps}
96
93
  className={containerClasses}
97
94
  >
@@ -112,7 +109,7 @@ const Radio: ForwardedRefComponent<RadioProps, RadioElementType> = forwardRef(
112
109
  ) : (
113
110
  <div className="mobius/RadioContent">{label || children}</div>
114
111
  )}
115
- </StyledLabel>
112
+ </Flex>
116
113
  {errorMessage && <ErrorMessage errorMessage={errorMessage} />}
117
114
  </>
118
115
  );
@@ -1,11 +1,8 @@
1
1
  import { render, fireEvent, screen } from "@testing-library/react";
2
2
  import userEvent from "@testing-library/user-event";
3
- import { matchers } from "@emotion/jest";
4
3
  import { RadioGroup, RadioButton } from ".";
5
4
  import { Icon } from "..";
6
5
 
7
- expect.extend(matchers);
8
-
9
6
  describe("RadioButton", () => {
10
7
  it("should render without error", () => {
11
8
  const component = render(
@@ -14,9 +14,9 @@ import { useFocusRing } from "@react-aria/focus";
14
14
  import { useHover, HoverProps } from "@react-aria/interactions";
15
15
  import { DOMProps } from "@react-types/shared";
16
16
  import clsx from "clsx";
17
- import styled from '@emotion/styled';
18
17
  import { RadioContext } from "./RadioContext";
19
18
  import { ForwardedRefComponent } from "../../types/components";
19
+ import { Flex } from "../Flex";
20
20
 
21
21
  export type RadioButtonElementType = HTMLInputElement;
22
22
 
@@ -32,11 +32,6 @@ export interface RadioButtonProps
32
32
 
33
33
  export type RadioButtonRef = Ref<RadioButtonElementType>;
34
34
 
35
- const StyledLabel = styled.label`
36
- display: flex;
37
- align-items: center;
38
- `;
39
-
40
35
  const RadioButton: ForwardedRefComponent<
41
36
  RadioButtonProps,
42
37
  RadioButtonElementType
@@ -118,13 +113,15 @@ const RadioButton: ForwardedRefComponent<
118
113
  }
119
114
 
120
115
  return (
121
- <StyledLabel
116
+ <Flex
117
+ alignItems="center"
118
+ elementType="label"
122
119
  className={containerClasses}
123
120
  {...hoverProps}
124
121
  >
125
122
  {nativeInput}
126
123
  {content}
127
- </StyledLabel>
124
+ </Flex>
128
125
  );
129
126
  });
130
127
 
@@ -1,15 +1,12 @@
1
1
  import React from "react";
2
2
  import { render, screen } from "@testing-library/react";
3
3
  import userEvent from "@testing-library/user-event";
4
- import { matchers } from "@emotion/jest";
5
4
  import { Select } from ".";
6
5
  import { Option } from "..";
7
6
 
8
7
  const CLASS_NAME = "mobius/Select";
9
8
  const LABEL_CLASS_NAME = "mobius/Label";
10
9
 
11
- expect.extend(matchers);
12
-
13
10
  describe("Select", () => {
14
11
  it("should render without error", () => {
15
12
  const component = render(
@@ -13,7 +13,6 @@ import clsx from "clsx";
13
13
  import { useFocusRing } from "@react-aria/focus";
14
14
  import { HoverProps, useHover } from "@react-aria/interactions";
15
15
  import { useSlotId } from "@react-aria/utils";
16
- import styled from '@emotion/styled';
17
16
  import { ForwardedRefComponent } from "../../types/components";
18
17
  import { Flex } from "../Flex";
19
18
  import { ErrorMessage } from "../ErrorMessage";
@@ -40,10 +39,6 @@ export interface SelectProps
40
39
 
41
40
  export type SelectRef = Ref<SelectElementType>;
42
41
 
43
- const ColumnFlex = styled(Flex)`
44
- flex-direction: column;
45
- `;
46
-
47
42
  const Select: ForwardedRefComponent<SelectProps, SelectElementType> =
48
43
  forwardRef((props: SelectProps, ref: SelectRef) => {
49
44
  const {
@@ -102,9 +97,7 @@ const Select: ForwardedRefComponent<SelectProps, SelectElementType> =
102
97
  ]);
103
98
 
104
99
  return (
105
- <ColumnFlex
106
- className="mobius mobius/SelectOuter"
107
- >
100
+ <Flex flexDirection="column" className="mobius mobius/SelectOuter">
108
101
  {label && (
109
102
  <Label {...labelProps} className={labelClasses}>
110
103
  {label}
@@ -131,7 +124,7 @@ const Select: ForwardedRefComponent<SelectProps, SelectElementType> =
131
124
  <span className={iconClasses} />
132
125
  </div>
133
126
  <ErrorMessage id={errorMessageId} errorMessage={errorMessage} />
134
- </ColumnFlex>
127
+ </Flex>
135
128
  );
136
129
  });
137
130
 
@@ -7,7 +7,6 @@ import { useSliderState } from "@react-stately/slider";
7
7
  import { useNumberFormatter } from "@react-aria/i18n";
8
8
  import clsx from "clsx";
9
9
  import { DOMProps } from "@react-types/shared";
10
- import styled from '@emotion/styled';
11
10
  import { SliderThumb } from "./Thumb";
12
11
  import { Label } from "../Label";
13
12
  import { useUnwrappedHandler, useWrappedValue } from "./helpers";
@@ -22,29 +21,6 @@ export interface SliderProps extends SpectrumSliderProps<number>, DOMProps {
22
21
  formatOptions?: Intl.NumberFormatOptions;
23
22
  }
24
23
 
25
- const SliderWrapper = styled.div`
26
- position: relative;
27
- display: flex;
28
- flex-direction: column;
29
- align-items: center;
30
- touch-action: none;
31
- `;
32
-
33
- const SliderLabelWrapper = styled.div`
34
- display: flex;
35
- align-self: stretch;
36
- `;
37
-
38
- const SliderTrackWrapper = styled.div`
39
- position: relative;
40
- width: 100%;
41
- `;
42
-
43
- const SliderTrack = styled.div`
44
- position: absolute;
45
- width: 100%;
46
- `;
47
-
48
24
  export function Slider(props: SliderProps) {
49
25
  const {
50
26
  className,
@@ -96,12 +72,9 @@ export function Slider(props: SliderProps) {
96
72
  });
97
73
 
98
74
  return (
99
- <SliderWrapper
100
- {...groupProps}
101
- className={classes}
102
- >
75
+ <div {...groupProps} className={classes}>
103
76
  {/* Create a flex container for the label and output element. */}
104
- <SliderLabelWrapper>
77
+ <div className="mobius/SliderLabelWrapper">
105
78
  {label && <Label {...labelProps}>{label}</Label>}
106
79
  {label && (
107
80
  <output
@@ -111,18 +84,16 @@ export function Slider(props: SliderProps) {
111
84
  {state.getThumbValueLabel(0)}
112
85
  </output>
113
86
  )}
114
- </SliderLabelWrapper>
87
+ </div>
115
88
  {/* The track element holds the visible track line and the thumb. */}
116
- <SliderTrackWrapper
89
+ <div
117
90
  {...trackProps}
118
91
  ref={trackRef}
119
92
  className="mobius mobius/SliderTrackWrapper"
120
93
  >
121
- <SliderTrack
122
- className="mobius/SliderTrack"
123
- />
94
+ <div className="mobius/SliderTrack" />
124
95
  <SliderThumb index={0} state={state} trackRef={trackRef} />
125
- </SliderTrackWrapper>
96
+ </div>
126
97
  <div className="mobius/SliderLabels">
127
98
  <div className="mobius/SliderMinLabel" data-testid="min-label">
128
99
  {minLabel}
@@ -131,6 +102,6 @@ export function Slider(props: SliderProps) {
131
102
  {maxLabel}
132
103
  </div>
133
104
  </div>
134
- </SliderWrapper>
105
+ </div>
135
106
  );
136
107
  }
@@ -8,19 +8,12 @@ import { useSliderThumb } from "@react-aria/slider";
8
8
  import { SliderThumbProps as SpectrumSliderThumbProps } from "@react-types/slider";
9
9
  import { SliderState } from "@react-stately/slider";
10
10
  import clsx from "clsx";
11
- import styled from '@emotion/styled';
12
11
 
13
12
  export interface SliderThumbProps extends SpectrumSliderThumbProps {
14
13
  state: SliderState;
15
14
  trackRef: RefObject<HTMLElement>;
16
15
  }
17
16
 
18
- const StyledThumb = styled.div`
19
- position: absolute;
20
- top: calc(50% - 1px);
21
- transform: translateX(-50%);
22
- `;
23
-
24
17
  export function SliderThumb(props: SliderThumbProps) {
25
18
  const { state, trackRef, index, isDisabled } = props;
26
19
  const inputRef = useRef(null);
@@ -44,7 +37,7 @@ export function SliderThumb(props: SliderThumbProps) {
44
37
  const thumbClasses = clsx("mobius", "mobius/SliderThumb", classes);
45
38
 
46
39
  return (
47
- <StyledThumb
40
+ <div
48
41
  style={{
49
42
  left: `${state.getThumbPercent(index) * 100}%`,
50
43
  }}
@@ -55,6 +48,6 @@ export function SliderThumb(props: SliderThumbProps) {
55
48
  <input ref={inputRef} {...mergeProps(inputProps, focusProps)} />
56
49
  </VisuallyHidden>
57
50
  </div>
58
- </StyledThumb>
51
+ </div>
59
52
  );
60
53
  }
@@ -1,4 +1,3 @@
1
- import styled from "@emotion/styled";
2
1
  import { Meta, ArgsTable, Canvas, Story } from "@storybook/addon-docs";
3
2
  import { Text } from "./Text";
4
3
  import { Box } from "..";
@@ -86,12 +85,11 @@ import { Text } from "@simplybusiness/mobius";
86
85
 
87
86
  ### Themed
88
87
 
89
- export const StyledText = styled(Text)`
90
- color: green;
91
- `;
92
-
93
- <Story name="Themed" args={{ elementType: "h4", variant: "h4" }}>
94
- {args => <StyledText {...args}>Sample Text</StyledText>}
88
+ <Story
89
+ name="Themed"
90
+ args={{ elementType: "h4", variant: "h4", style: { color: "green" } }}
91
+ >
92
+ {args => <Text {...args}>Sample Text</Text>}
95
93
  </Story>
96
94
 
97
95
  <!-- prettier-ignore -->
@@ -6,7 +6,6 @@ import clsx from "clsx";
6
6
  import { AriaTextFieldOptions, useTextField } from "@react-aria/textfield";
7
7
  import { useFocusRing } from "@react-aria/focus";
8
8
  import { HoverProps, useHover } from "@react-aria/interactions";
9
- import styled from '@emotion/styled';
10
9
  import { TextAreaInput } from "../TextAreaInput";
11
10
  import { Label } from "../Label";
12
11
  import { ForwardedRefComponent } from "../../types/components";
@@ -27,10 +26,6 @@ export interface TextAreaProps
27
26
 
28
27
  export type TextAreaRef = Ref<TextAreaElementType>;
29
28
 
30
- const ColumnFlex = styled(Flex)`
31
- flex-direction: column;
32
- `;
33
-
34
29
  const TextArea: ForwardedRefComponent<TextAreaProps, TextAreaElementType> =
35
30
  forwardRef((props: TextAreaProps, ref: TextAreaRef) => {
36
31
  const {
@@ -77,10 +72,7 @@ const TextArea: ForwardedRefComponent<TextAreaProps, TextAreaElementType> =
77
72
  });
78
73
 
79
74
  return (
80
- <ColumnFlex
81
- className={classes}
82
- {...focusProps}
83
- >
75
+ <Flex flexDirection="column" className={classes} {...focusProps}>
84
76
  {label && (
85
77
  <Label {...labelProps} className={labelClasses}>
86
78
  {props.label}
@@ -97,7 +89,7 @@ const TextArea: ForwardedRefComponent<TextAreaProps, TextAreaElementType> =
97
89
  aria-invalid={errorMessage != null}
98
90
  />
99
91
  <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />
100
- </ColumnFlex>
92
+ </Flex>
101
93
  );
102
94
  });
103
95
 
@@ -1,14 +1,11 @@
1
1
  import React from "react";
2
2
  import { fireEvent, render, screen } from "@testing-library/react";
3
3
  import userEvent from "@testing-library/user-event";
4
- import { matchers } from "@emotion/jest";
5
4
  import { TextField } from ".";
6
5
 
7
6
  const WRAPPER_CLASS_NAME = "mobius/TextField";
8
7
  const INPUT_CLASS_NAME = "mobius/TextInput";
9
8
 
10
- expect.extend(matchers);
11
-
12
9
  describe("Test for TextField", () => {
13
10
  it("should render without errors", () => {
14
11
  render(<TextField label="First name" data-testid="textfield" />);
@@ -13,7 +13,6 @@ import { useHover } from "@react-aria/interactions";
13
13
  import { useFocusRing } from "@react-aria/focus";
14
14
  import { FocusEvents, HoverEvents, DOMProps } from "@react-types/shared";
15
15
  import clsx from "clsx";
16
- import styled from "@emotion/styled";
17
16
  import { Label } from "../Label";
18
17
  import { ErrorMessage } from "../ErrorMessage";
19
18
  import { ForwardedRefComponent } from "../../types/components";
@@ -50,10 +49,6 @@ export interface TextFieldProps
50
49
 
51
50
  export type TextFieldRef = Ref<TextFieldElementType>;
52
51
 
53
- const ColumnFlex = styled(Flex)`
54
- flex-direction: column;
55
- `;
56
-
57
52
  const TextField: ForwardedRefComponent<TextFieldProps, TextFieldElementType> =
58
53
  forwardRef((props: TextFieldProps, ref: TextFieldRef) => {
59
54
  const {
@@ -108,10 +103,7 @@ const TextField: ForwardedRefComponent<TextFieldProps, TextFieldElementType> =
108
103
  const inputClasses = clsx("mobius", "mobius/TextInput", textfieldClasses);
109
104
 
110
105
  return (
111
- <ColumnFlex
112
- className={containerClasses}
113
- {...focusProps}
114
- >
106
+ <Flex flexDirection="column" className={containerClasses} {...focusProps}>
115
107
  {label && !hidden && (
116
108
  <Label {...labelProps} className={labelClasses}>
117
109
  {label}
@@ -131,7 +123,7 @@ const TextField: ForwardedRefComponent<TextFieldProps, TextFieldElementType> =
131
123
  <div className="mobius/TextFieldChildren">{children}</div>
132
124
  </div>
133
125
  <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />
134
- </ColumnFlex>
126
+ </Flex>
135
127
  );
136
128
  });
137
129
 
@@ -46,7 +46,7 @@ export const ThemeProvider = ({ children, icons }: ThemeProviderProps) => {
46
46
  () => ({
47
47
  icons: {
48
48
  ...(baseIcons as Icons),
49
- ...(icons?.default as unknown as Icons),
49
+ ...(icons as Icons),
50
50
  },
51
51
  breakpoints: breakpointConfig,
52
52
  setBreakpoints: setConfig,
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const StyledLegend: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
5
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, {}>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.StyledLegend = void 0;
7
- const styled_1 = __importDefault(require("@emotion/styled"));
8
- exports.StyledLegend = styled_1.default.legend `
9
- margin-bottom: var(--size-20);
10
- padding-left: 0;
11
- color: var(--color-primary);
12
- `;
13
- //# sourceMappingURL=StyledLegend.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StyledLegend.js","sourceRoot":"","sources":["../../../../../src/components/Fieldset/stories/StyledLegend.tsx"],"names":[],"mappings":";;;;;;AAAA,6DAAqC;AAExB,QAAA,YAAY,GAAG,gBAAM,CAAC,MAAM,CAAA;;;;CAIxC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Combines the provided objects into a single output object,
3
- * while removing any null or false values.
4
- * @param objects - the objects to combine
5
- */
6
- export declare function combineTruthyObjects<T>(objects: (T | boolean | null)[]): T;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.combineTruthyObjects = void 0;
27
- const merge = __importStar(require("deepmerge"));
28
- /**
29
- * Combines the provided objects into a single output object,
30
- * while removing any null or false values.
31
- * @param objects - the objects to combine
32
- */
33
- function combineTruthyObjects(objects) {
34
- const truthyObjects = objects.filter(o => o && o !== null);
35
- return merge.all(truthyObjects);
36
- }
37
- exports.combineTruthyObjects = combineTruthyObjects;
38
- //# sourceMappingURL=combineTruthyObjects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"combineTruthyObjects.js","sourceRoot":"","sources":["../../../src/utils/combineTruthyObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAEnC;;;;GAIG;AACH,SAAgB,oBAAoB,CAAI,OAA+B;IACrE,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;IAE3D,OAAO,KAAK,CAAC,GAAG,CAAC,aAAyB,CAAM,CAAC;AACnD,CAAC;AAJD,oDAIC"}
@@ -1 +0,0 @@
1
- export {};