@mrshmllw/smores-react 2.1.17 → 2.1.18
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/ConfirmationRadioButtons/Confirmation.d.ts +2 -1
- package/dist/ConfirmationRadioButtons/Confirmation.js +19 -8
- package/dist/ConfirmationRadioButtons/Confirmation.js.map +1 -1
- package/dist/ConfirmationRadioButtons/Confirmation.stories.d.ts +1 -0
- package/dist/ConfirmationRadioButtons/Confirmation.stories.js +8 -0
- package/dist/ConfirmationRadioButtons/Confirmation.stories.js.map +1 -1
- package/package.json +1 -1
@@ -5,10 +5,11 @@ export declare type ConfirmationProps = {
|
|
5
5
|
id: string;
|
6
6
|
error?: boolean;
|
7
7
|
errorMsg?: string;
|
8
|
-
label
|
8
|
+
label?: string;
|
9
9
|
onBlur?: (e: FormEvent<HTMLInputElement>) => void;
|
10
10
|
sublabel?: string | ReactElement;
|
11
11
|
yesLabel?: string | ReactElement;
|
12
12
|
noLabel?: string | ReactElement;
|
13
|
+
labelHidden?: boolean;
|
13
14
|
};
|
14
15
|
export declare const Confirmation: FC<ConfirmationProps>;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import styled from 'styled-components';
|
2
|
+
import styled, { css } from 'styled-components';
|
3
3
|
import { theme } from '../theme';
|
4
4
|
import { Box } from '../Box';
|
5
5
|
import { Text } from '../Text';
|
6
6
|
import { RadioButton } from './RadioButtonStyled';
|
7
|
-
export const Confirmation = ({ checked, onChange, id, error = false, errorMsg = '', label, onBlur, sublabel, yesLabel = 'Yes', noLabel = 'No', }) => {
|
7
|
+
export const Confirmation = ({ checked, onChange, id, error = false, errorMsg = '', label, onBlur, sublabel, yesLabel = 'Yes', noLabel = 'No', labelHidden = false, }) => {
|
8
8
|
return (React.createElement(ConfirmationWrapper, null,
|
9
|
-
React.createElement(TextWrapper, null,
|
10
|
-
React.createElement(SectionHeadingText, { tag: "h3" }, label),
|
11
|
-
sublabel && (React.createElement(Text, { tag: "p", typo: "base-small", color: theme.colors.subtext }, sublabel))),
|
9
|
+
!labelHidden && (React.createElement(TextWrapper, null,
|
10
|
+
label && (React.createElement(SectionHeadingText, { tag: "h3", labelHidden: labelHidden }, label)),
|
11
|
+
sublabel && (React.createElement(Text, { tag: "p", typo: "base-small", color: theme.colors.subtext }, sublabel)))),
|
12
12
|
React.createElement(RadioButtonGroupWrapper, null,
|
13
13
|
React.createElement(RadioButtonGroup, null,
|
14
14
|
React.createElement(RadioButtonWrapper, { checked: checked === true, error: error },
|
@@ -59,9 +59,20 @@ const ConfirmationWrapper = styled(Box) `
|
|
59
59
|
grid-template-columns: 1fr 1fr;
|
60
60
|
align-items: center;
|
61
61
|
`;
|
62
|
-
const SectionHeadingText = styled(Text) `
|
63
|
-
|
64
|
-
|
62
|
+
const SectionHeadingText = styled(Text)(({ labelHidden }) => css `
|
63
|
+
font-weight: bold;
|
64
|
+
${labelHidden &&
|
65
|
+
`
|
66
|
+
clip: rect(1, 1, 1, 1);
|
67
|
+
clipPath: inset(50%);
|
68
|
+
height: 1;
|
69
|
+
margin: -1;
|
70
|
+
overflow: hidden;
|
71
|
+
padding: 0;
|
72
|
+
position: absolute;
|
73
|
+
width: 1;
|
74
|
+
`}
|
75
|
+
`);
|
65
76
|
const TextWrapper = styled.div `
|
66
77
|
display: flex;
|
67
78
|
flex-direction: column;
|
@@ -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;
|
1
|
+
{"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../src/ConfirmationRadioButtons/Confirmation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,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AA;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CACrC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;MAEpB,WAAW;IACb;;;;;;;;;KASC;GACF,CACF,CAAA;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG7B,CAAA"}
|
@@ -42,4 +42,12 @@ WithCustomLabel.args = {
|
|
42
42
|
label: 'Do you like marshmallows?',
|
43
43
|
yesLabel: 'Correct',
|
44
44
|
};
|
45
|
+
export const LabelHidden = Template.bind({});
|
46
|
+
LabelHidden.args = {
|
47
|
+
id: 'radioButton',
|
48
|
+
onChange: noop,
|
49
|
+
checked: undefined,
|
50
|
+
yesLabel: 'Yes',
|
51
|
+
labelHidden: true,
|
52
|
+
};
|
45
53
|
//# sourceMappingURL=Confirmation.stories.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Confirmation.stories.js","sourceRoot":"","sources":["../../src/ConfirmationRadioButtons/Confirmation.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,eAAe;IACb,KAAK,EAAE,4BAA4B;IACnC,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;CAC9C,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,KAAwB,EAAE,EAAE,CAAC,oBAAC,YAAY,oBAAK,KAAK,EAAI,CAAA;AAE1E,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAExC,OAAO,CAAC,IAAI,GAAG;IACb,EAAE,EAAE,aAAa;IACjB,Q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