@kanda-libs/ks-component-ts 0.2.291 → 0.2.292
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/index.d.ts +8645 -8643
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +3 -3
- package/dist/library.css +20 -5
- package/package.json +1 -1
- package/src/field/components/RadioSelect/RadioSelectUncontrolled/Option/constants.ts +50 -2
- package/src/field/components/RadioSelect/RadioSelectUncontrolled/Option/index.tsx +23 -2
- package/src/field/components/RadioSelect/RadioSelectUncontrolled/Option/useOption.ts +7 -2
- package/src/field/components/RadioSelect/RadioSelectUncontrolled/index.tsx +3 -0
- package/src/field/components/RangeInput/constants.ts +1 -1
- package/src/field/components/Select/types.d.ts +2 -0
- package/src/generated/widget/index.tsx +44353 -44352
- package/src/styles/library.css +20 -5
package/dist/library.css
CHANGED
|
@@ -2273,6 +2273,16 @@ input[type="number"]::-webkit-inner-spin-button,
|
|
|
2273
2273
|
border-color: rgb(247 249 252 / var(--tw-border-opacity));
|
|
2274
2274
|
}
|
|
2275
2275
|
|
|
2276
|
+
.border-orange-200 {
|
|
2277
|
+
--tw-border-opacity: 1;
|
|
2278
|
+
border-color: rgb(235 125 50 / var(--tw-border-opacity));
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
.border-orange-100 {
|
|
2282
|
+
--tw-border-opacity: 1;
|
|
2283
|
+
border-color: rgb(253 240 232 / var(--tw-border-opacity));
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2276
2286
|
.border-neutral-500 {
|
|
2277
2287
|
--tw-border-opacity: 1;
|
|
2278
2288
|
border-color: rgb(156 173 196 / var(--tw-border-opacity));
|
|
@@ -2366,6 +2376,11 @@ input[type="number"]::-webkit-inner-spin-button,
|
|
|
2366
2376
|
background-color: rgb(229 245 255 / var(--tw-bg-opacity));
|
|
2367
2377
|
}
|
|
2368
2378
|
|
|
2379
|
+
.bg-orange-100 {
|
|
2380
|
+
--tw-bg-opacity: 1;
|
|
2381
|
+
background-color: rgb(253 240 232 / var(--tw-bg-opacity));
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2369
2384
|
.bg-neutral-900 {
|
|
2370
2385
|
--tw-bg-opacity: 1;
|
|
2371
2386
|
background-color: rgb(13 27 46 / var(--tw-bg-opacity));
|
|
@@ -2593,11 +2608,6 @@ input[type="number"]::-webkit-inner-spin-button,
|
|
|
2593
2608
|
padding-right: 32px;
|
|
2594
2609
|
}
|
|
2595
2610
|
|
|
2596
|
-
.px-5 {
|
|
2597
|
-
padding-left: 20px;
|
|
2598
|
-
padding-right: 20px;
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
2611
|
.py-2\.5 {
|
|
2602
2612
|
padding-top: 10px;
|
|
2603
2613
|
padding-bottom: 10px;
|
|
@@ -2623,6 +2633,11 @@ input[type="number"]::-webkit-inner-spin-button,
|
|
|
2623
2633
|
padding-right: 10px;
|
|
2624
2634
|
}
|
|
2625
2635
|
|
|
2636
|
+
.px-5 {
|
|
2637
|
+
padding-left: 20px;
|
|
2638
|
+
padding-right: 20px;
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2626
2641
|
.px-6 {
|
|
2627
2642
|
padding-left: 24px;
|
|
2628
2643
|
padding-right: 24px;
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { string } from "io-ts";
|
|
2
1
|
import { StringIndexedObject } from "~/types";
|
|
3
2
|
|
|
4
3
|
interface VariantProps {
|
|
@@ -9,10 +8,22 @@ interface VariantProps {
|
|
|
9
8
|
selected: {
|
|
10
9
|
option: string;
|
|
11
10
|
container: string;
|
|
11
|
+
icon?: string;
|
|
12
12
|
};
|
|
13
13
|
notSelected: {
|
|
14
14
|
option: string;
|
|
15
15
|
container: string;
|
|
16
|
+
icon?: string;
|
|
17
|
+
};
|
|
18
|
+
warning: {
|
|
19
|
+
option: string;
|
|
20
|
+
container: string;
|
|
21
|
+
icon?: string;
|
|
22
|
+
};
|
|
23
|
+
warningNotSelected: {
|
|
24
|
+
option: string;
|
|
25
|
+
container: string;
|
|
26
|
+
icon?: string;
|
|
16
27
|
};
|
|
17
28
|
disabled?: {
|
|
18
29
|
option: string;
|
|
@@ -26,6 +37,21 @@ interface VariantProps {
|
|
|
26
37
|
};
|
|
27
38
|
}
|
|
28
39
|
|
|
40
|
+
// TODO: Make variant specific
|
|
41
|
+
const warning = {
|
|
42
|
+
option: "bg-orange-100 cursor-pointer",
|
|
43
|
+
container:
|
|
44
|
+
"rounded bg-orange-100 flex flex-full w-full px-4 py-2 text-orange-200 border border-orange-200",
|
|
45
|
+
icon: "text-orange-200",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const warningNotSelected = {
|
|
49
|
+
option: "bg-orange-100 border-orange-100 cursor-pointer",
|
|
50
|
+
container:
|
|
51
|
+
"rounded bg-orange-100 flex flex-full w-full px-4 py-2 text-orange-200 border border-orange-100",
|
|
52
|
+
icon: "text-orange-200",
|
|
53
|
+
};
|
|
54
|
+
|
|
29
55
|
export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
30
56
|
default: {
|
|
31
57
|
span: "ml-3 select-none w-full text-style-f my-auto",
|
|
@@ -39,6 +65,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
39
65
|
option: "overflow-hidden border border-neutral-300 cursor-pointer",
|
|
40
66
|
container: "bg-neutral-000 flex flex-full w-full p-4 text-neutral-600",
|
|
41
67
|
},
|
|
68
|
+
warning,
|
|
69
|
+
warningNotSelected,
|
|
42
70
|
multiline: {
|
|
43
71
|
option: "flex flex-1 rounded-xl mt-2 last:mb-2",
|
|
44
72
|
},
|
|
@@ -60,6 +88,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
60
88
|
container:
|
|
61
89
|
"bg-neutral-000 flex flex-full w-full px-4 py-3.5 text-neutral-600",
|
|
62
90
|
},
|
|
91
|
+
warning,
|
|
92
|
+
warningNotSelected,
|
|
63
93
|
multiline: {
|
|
64
94
|
option: "flex flex-1 rounded-xl mt-2 last:mb-2",
|
|
65
95
|
},
|
|
@@ -81,6 +111,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
81
111
|
"overflow-hidden border-b border-neutral-100 cursor-pointer last:border-0",
|
|
82
112
|
container: "bg-neutral-000 flex flex-full w-full p-4 text-neutral-700",
|
|
83
113
|
},
|
|
114
|
+
warning,
|
|
115
|
+
warningNotSelected,
|
|
84
116
|
multiline: {
|
|
85
117
|
option: "flex flex-1 rounded-xl mt-2 last:mb-2",
|
|
86
118
|
},
|
|
@@ -101,6 +133,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
101
133
|
option: "border-neutral-000 overflow-hidden cursor-pointer",
|
|
102
134
|
container: "bg-neutral-000 flex flex-full w-full py-2 text-neutral-600",
|
|
103
135
|
},
|
|
136
|
+
warning,
|
|
137
|
+
warningNotSelected,
|
|
104
138
|
multiline: {
|
|
105
139
|
option: "flex flex-1 rounded-xl mt-2 last:mb-2",
|
|
106
140
|
},
|
|
@@ -121,6 +155,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
121
155
|
option: "border-neutral-000 overflow-hidden cursor-pointer",
|
|
122
156
|
container: "bg-neutral-000 flex flex-full w-full text-neutral-600",
|
|
123
157
|
},
|
|
158
|
+
warning,
|
|
159
|
+
warningNotSelected,
|
|
124
160
|
multiline: {
|
|
125
161
|
option: "flex flex-1 rounded-xl mt-2 last:mb-2",
|
|
126
162
|
},
|
|
@@ -142,6 +178,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
142
178
|
container:
|
|
143
179
|
"bg-neutral-000 px-3 py-2.25 flex flex-full w-full text-neutral-900 rounded hover:bg-neutral-100",
|
|
144
180
|
},
|
|
181
|
+
warning,
|
|
182
|
+
warningNotSelected,
|
|
145
183
|
multiline: {
|
|
146
184
|
option: "flex flex-1 rounded-xl first:mt-2 last:mb-2",
|
|
147
185
|
},
|
|
@@ -165,6 +203,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
165
203
|
container:
|
|
166
204
|
"bg-neutral-000 flex flex-full w-full p-1.5 text-neutral-600 hover:text-turquoise-300",
|
|
167
205
|
},
|
|
206
|
+
warning,
|
|
207
|
+
warningNotSelected,
|
|
168
208
|
multiline: {
|
|
169
209
|
option: "flex flex-1",
|
|
170
210
|
},
|
|
@@ -187,6 +227,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
187
227
|
"overflow-hidden border border-neutral-300 cursor-pointer border-l-0 first:border-l",
|
|
188
228
|
container: "bg-neutral-000 flex flex-full w-full p-2.5 text-neutral-600",
|
|
189
229
|
},
|
|
230
|
+
warning,
|
|
231
|
+
warningNotSelected,
|
|
190
232
|
multiline: {
|
|
191
233
|
option: "flex flex-1",
|
|
192
234
|
},
|
|
@@ -195,7 +237,7 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
195
237
|
},
|
|
196
238
|
},
|
|
197
239
|
streamline: {
|
|
198
|
-
span: "select-none w-full text-14-22-em whitespace-nowrap my-auto text-center",
|
|
240
|
+
span: "select-none w-full text-14-22-em whitespace-nowrap my-auto text-center flex flex-row items-center justify-center gap-x-2",
|
|
199
241
|
skeleton: "w-full",
|
|
200
242
|
skeletonWrapper: "w-10 -mt-0.5",
|
|
201
243
|
handleContainer: "hidden",
|
|
@@ -209,6 +251,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
209
251
|
container:
|
|
210
252
|
"rounded bg-neutral-000 flex flex-full w-full px-4 py-2 text-neutral-600",
|
|
211
253
|
},
|
|
254
|
+
warning,
|
|
255
|
+
warningNotSelected,
|
|
212
256
|
disabled: {
|
|
213
257
|
option: "border border-neutral-300 cursor-not-allowed",
|
|
214
258
|
container:
|
|
@@ -236,6 +280,8 @@ export const VARIANTS: StringIndexedObject<VariantProps> = {
|
|
|
236
280
|
container:
|
|
237
281
|
"rounded bg-neutral-000 flex flex-full w-full px-2.5 py-2.25 md:py-1.5 text-neutral-900",
|
|
238
282
|
},
|
|
283
|
+
warning,
|
|
284
|
+
warningNotSelected,
|
|
239
285
|
multiline: {
|
|
240
286
|
option: "",
|
|
241
287
|
},
|
|
@@ -257,6 +303,8 @@ export const CLASS_NAMES_MULTIPLE: VariantProps = {
|
|
|
257
303
|
option: "overflow-hidden border border-neutral-300 cursor-pointer",
|
|
258
304
|
container: "bg-neutral-000 flex flex-full w-full p-4 flex-row-reverse",
|
|
259
305
|
},
|
|
306
|
+
warning,
|
|
307
|
+
warningNotSelected,
|
|
260
308
|
multiline: {
|
|
261
309
|
option: "flex flex-1 rounded-xl mt-2 last:mb-2",
|
|
262
310
|
},
|
|
@@ -3,6 +3,7 @@ import { RadioSelectVariant } from "~/field/components/RadioSelect/types";
|
|
|
3
3
|
import { FieldRegisterMethod } from "~/field/types";
|
|
4
4
|
import useOption from "./useOption";
|
|
5
5
|
import Skeleton from "react-loading-skeleton";
|
|
6
|
+
import { Icon } from "@kanda-libs/ks-design-library";
|
|
6
7
|
|
|
7
8
|
export interface Props {
|
|
8
9
|
/**
|
|
@@ -49,6 +50,14 @@ export interface Props {
|
|
|
49
50
|
* Event handler for clicking the option
|
|
50
51
|
*/
|
|
51
52
|
onClick?: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Whether or not to show the option in a warning state
|
|
55
|
+
*/
|
|
56
|
+
warning?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Icon to display next to the option
|
|
59
|
+
*/
|
|
60
|
+
icon?: string;
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
const Option: FunctionComponent<Props> = function ({
|
|
@@ -63,6 +72,8 @@ const Option: FunctionComponent<Props> = function ({
|
|
|
63
72
|
wrap = false,
|
|
64
73
|
register,
|
|
65
74
|
onClick = () => {},
|
|
75
|
+
warning = false,
|
|
76
|
+
icon,
|
|
66
77
|
}) {
|
|
67
78
|
const { id, classNames, handleProps, Handle } = useOption(
|
|
68
79
|
multiple,
|
|
@@ -72,7 +83,8 @@ const Option: FunctionComponent<Props> = function ({
|
|
|
72
83
|
inline,
|
|
73
84
|
wrap,
|
|
74
85
|
register,
|
|
75
|
-
disabled
|
|
86
|
+
disabled,
|
|
87
|
+
warning
|
|
76
88
|
);
|
|
77
89
|
|
|
78
90
|
return (
|
|
@@ -99,7 +111,16 @@ const Option: FunctionComponent<Props> = function ({
|
|
|
99
111
|
</div>
|
|
100
112
|
</div>
|
|
101
113
|
) : (
|
|
102
|
-
<span className={classNames.span as string}>
|
|
114
|
+
<span className={classNames.span as string}>
|
|
115
|
+
{icon && (
|
|
116
|
+
<Icon
|
|
117
|
+
icon={icon}
|
|
118
|
+
size={12}
|
|
119
|
+
className={classNames.icon as string}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
{name}
|
|
123
|
+
</span>
|
|
103
124
|
)}
|
|
104
125
|
</div>
|
|
105
126
|
</label>
|
|
@@ -28,7 +28,8 @@ export default function useOption(
|
|
|
28
28
|
inline: boolean,
|
|
29
29
|
wrap: boolean,
|
|
30
30
|
register: FieldRegisterMethod | null = null,
|
|
31
|
-
disabled?: boolean
|
|
31
|
+
disabled?: boolean,
|
|
32
|
+
warning?: boolean
|
|
32
33
|
): Hook {
|
|
33
34
|
const { skeletonClasses } = useFormTheme();
|
|
34
35
|
|
|
@@ -53,7 +54,10 @@ export default function useOption(
|
|
|
53
54
|
|
|
54
55
|
const optionFlex = inline ? ".inline.option" : ".multiline.option";
|
|
55
56
|
|
|
56
|
-
const
|
|
57
|
+
const defaultSelectedPrefix = isSelected ? "selected" : "notSelected";
|
|
58
|
+
const warningPrefix = isSelected ? "warning" : "warningNotSelected";
|
|
59
|
+
|
|
60
|
+
const selectedPrefix = warning ? warningPrefix : defaultSelectedPrefix;
|
|
57
61
|
|
|
58
62
|
const classNames = useClasses(variant, {
|
|
59
63
|
option: [
|
|
@@ -73,6 +77,7 @@ export default function useOption(
|
|
|
73
77
|
skeleton: [
|
|
74
78
|
variant?.skeleton ? `.${selectedPrefix}.skeleton` : skeletonClasses,
|
|
75
79
|
],
|
|
80
|
+
icon: [variant?.[selectedPrefix]?.icon],
|
|
76
81
|
});
|
|
77
82
|
|
|
78
83
|
/**
|
|
@@ -8,6 +8,7 @@ const RadioSelectUncontrolled: FunctionComponent<
|
|
|
8
8
|
DefaultFormFieldProps<RadioSelectUncontrolledProps>
|
|
9
9
|
> = function ({ name, inline = false, wrap = false, options, ...restProps }) {
|
|
10
10
|
const classNames = useRadioSelectUncontrolledClassNames(inline, wrap);
|
|
11
|
+
|
|
11
12
|
return (
|
|
12
13
|
<div className={classNames.container}>
|
|
13
14
|
{options?.map((option) => (
|
|
@@ -19,6 +20,8 @@ const RadioSelectUncontrolled: FunctionComponent<
|
|
|
19
20
|
wrap={wrap}
|
|
20
21
|
key={option.value}
|
|
21
22
|
disabled={option?.disabled || false}
|
|
23
|
+
warning={option.warning || false}
|
|
24
|
+
icon={option.icon}
|
|
22
25
|
{...restProps}
|
|
23
26
|
/>
|
|
24
27
|
))}
|
|
@@ -2,7 +2,7 @@ export const BG_COLOR =
|
|
|
2
2
|
"linear-gradient(to right, transparent 10px, #1cb69c 10px, #1cb69c $PCT%, #e0e7f0 $PCT%, #e0e7f0 calc(100% - 10px), transparent calc(100% - 10px))";
|
|
3
3
|
|
|
4
4
|
export const CLASS_NAMES = {
|
|
5
|
-
container: "flex flex-col w-full
|
|
5
|
+
container: "flex flex-col w-full",
|
|
6
6
|
skeletonWrapper: "flex w-full",
|
|
7
7
|
skeletonContainer: "w-full",
|
|
8
8
|
labels: "flex flex-row justify-between first:mb-1 last:mt-1",
|