dce-reactkit 3.9.8 → 3.9.10
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/cjs/index.js +16 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/RadioButton.d.ts +2 -0
- package/dist/esm/index.js +16 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/RadioButton.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/CheckboxButton.tsx +15 -15
- package/src/components/RadioButton.tsx +25 -2
- package/src/components/SimpleDateChooser.tsx +8 -2
|
@@ -11,10 +11,12 @@ type Props = {
|
|
|
11
11
|
title?: string;
|
|
12
12
|
selected?: boolean;
|
|
13
13
|
id?: string;
|
|
14
|
+
className?: string;
|
|
14
15
|
noMarginOnRight?: boolean;
|
|
15
16
|
selectedVariant?: Variant;
|
|
16
17
|
unselectedVariant?: Variant;
|
|
17
18
|
small?: boolean;
|
|
19
|
+
useComplexFormatting?: boolean;
|
|
18
20
|
};
|
|
19
21
|
declare const RadioButton: React.FC<Props>;
|
|
20
22
|
export default RadioButton;
|
package/dist/index.d.ts
CHANGED
|
@@ -244,10 +244,12 @@ type Props$i = {
|
|
|
244
244
|
title?: string;
|
|
245
245
|
selected?: boolean;
|
|
246
246
|
id?: string;
|
|
247
|
+
className?: string;
|
|
247
248
|
noMarginOnRight?: boolean;
|
|
248
249
|
selectedVariant?: Variant;
|
|
249
250
|
unselectedVariant?: Variant;
|
|
250
251
|
small?: boolean;
|
|
252
|
+
useComplexFormatting?: boolean;
|
|
251
253
|
};
|
|
252
254
|
declare const RadioButton: React$1.FC<Props$i>;
|
|
253
255
|
|
package/package.json
CHANGED
|
@@ -126,21 +126,21 @@ const CheckboxButton: React.FC<Props> = (props) => {
|
|
|
126
126
|
</div>
|
|
127
127
|
{
|
|
128
128
|
useComplexFormatting
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
? (
|
|
130
|
+
<pre
|
|
131
|
+
className="ps-2 text-start text-break"
|
|
132
|
+
style={{
|
|
133
|
+
whiteSpace: 'pre-wrap',
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
{text}
|
|
137
|
+
</pre>
|
|
138
|
+
)
|
|
139
|
+
: (
|
|
140
|
+
<div className="flex-grow-1 text-start text-break ps-2">
|
|
141
|
+
{text}
|
|
142
|
+
</div>
|
|
143
|
+
)
|
|
144
144
|
}
|
|
145
145
|
</div>
|
|
146
146
|
</button>
|
|
@@ -32,6 +32,8 @@ type Props = {
|
|
|
32
32
|
selected?: boolean,
|
|
33
33
|
// The id of the button
|
|
34
34
|
id?: string,
|
|
35
|
+
// Custom class name of the button
|
|
36
|
+
className?: string,
|
|
35
37
|
// If true, no margin on right
|
|
36
38
|
noMarginOnRight?: boolean,
|
|
37
39
|
// Variant for when radio is selected
|
|
@@ -40,6 +42,8 @@ type Props = {
|
|
|
40
42
|
unselectedVariant?: Variant,
|
|
41
43
|
// True if using a small button
|
|
42
44
|
small?: boolean,
|
|
45
|
+
// If true, use complex formatting (tabs, newlines) in the text
|
|
46
|
+
useComplexFormatting?: boolean,
|
|
43
47
|
};
|
|
44
48
|
|
|
45
49
|
/*------------------------------------------------------------------------*/
|
|
@@ -60,6 +64,7 @@ const RadioButton: React.FC<Props> = (props) => {
|
|
|
60
64
|
title,
|
|
61
65
|
selected,
|
|
62
66
|
id,
|
|
67
|
+
className,
|
|
63
68
|
noMarginOnRight,
|
|
64
69
|
selectedVariant = (
|
|
65
70
|
isDarkModeOn()
|
|
@@ -72,6 +77,7 @@ const RadioButton: React.FC<Props> = (props) => {
|
|
|
72
77
|
: Variant.Light
|
|
73
78
|
),
|
|
74
79
|
small,
|
|
80
|
+
useComplexFormatting,
|
|
75
81
|
} = props;
|
|
76
82
|
|
|
77
83
|
/*------------------------------------------------------------------------*/
|
|
@@ -87,7 +93,7 @@ const RadioButton: React.FC<Props> = (props) => {
|
|
|
87
93
|
type="button"
|
|
88
94
|
id={id}
|
|
89
95
|
title={title}
|
|
90
|
-
className={`btn btn-${selected ? selectedVariant : unselectedVariant}${selected ? ' selected' : ''}${small ? ' btn-sm' : ''} m-0${noMarginOnRight ? '' : ' me-1'}`}
|
|
96
|
+
className={`btn btn-${selected ? selectedVariant : unselectedVariant}${selected ? ' selected' : ''}${small ? ' btn-sm' : ''} m-0${noMarginOnRight ? '' : ' me-1'} ${className ?? ''}`}
|
|
91
97
|
aria-label={`${ariaLabel}${selected ? ': currently selected' : ''}`}
|
|
92
98
|
onClick={() => {
|
|
93
99
|
if (!selected) {
|
|
@@ -99,7 +105,24 @@ const RadioButton: React.FC<Props> = (props) => {
|
|
|
99
105
|
icon={selected ? faDotCircle : faCircle}
|
|
100
106
|
className="me-1"
|
|
101
107
|
/>
|
|
102
|
-
{
|
|
108
|
+
{
|
|
109
|
+
useComplexFormatting
|
|
110
|
+
? (
|
|
111
|
+
<pre
|
|
112
|
+
className="ps-2 text-start text-break"
|
|
113
|
+
style={{
|
|
114
|
+
whiteSpace: 'pre-wrap',
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{text}
|
|
118
|
+
</pre>
|
|
119
|
+
)
|
|
120
|
+
: (
|
|
121
|
+
<div className="flex-grow-1 text-start text-break ps-2">
|
|
122
|
+
{text}
|
|
123
|
+
</div>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
103
126
|
</button>
|
|
104
127
|
);
|
|
105
128
|
};
|
|
@@ -94,7 +94,13 @@ const SimpleDateChooser: React.FC<Props> = (props) => {
|
|
|
94
94
|
}
|
|
95
95
|
const monthName = getMonthName(month).full;
|
|
96
96
|
// Year is start year +1 for each 12 months
|
|
97
|
-
|
|
97
|
+
let yearsToAdd = 0;
|
|
98
|
+
let monthsOfYearsToAdd = unmoddedMonth;
|
|
99
|
+
while (monthsOfYearsToAdd > 12) {
|
|
100
|
+
monthsOfYearsToAdd -= 12;
|
|
101
|
+
yearsToAdd += 1;
|
|
102
|
+
}
|
|
103
|
+
const year = startYear + yearsToAdd;
|
|
98
104
|
|
|
99
105
|
// Figure out which days are allowed
|
|
100
106
|
const days = [];
|
|
@@ -174,7 +180,7 @@ const SimpleDateChooser: React.FC<Props> = (props) => {
|
|
|
174
180
|
return (
|
|
175
181
|
<div
|
|
176
182
|
className="SimpleDateChooser d-inline-block"
|
|
177
|
-
aria-label={`date chooser with selected date: ${month}
|
|
183
|
+
aria-label={`date chooser with selected date: ${month}/${day}/${year}`}
|
|
178
184
|
>
|
|
179
185
|
{/* Month Chooser */}
|
|
180
186
|
<select
|