@kivid/native-components 1.0.0-alpha.22 → 1.0.0-alpha.23
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/commonjs/components/ActionButton/index.js +2 -1
- package/dist/commonjs/components/ActionButton/index.js.map +1 -1
- package/dist/commonjs/components/DatePicker/index.js +30 -22
- package/dist/commonjs/components/DatePicker/index.js.map +1 -1
- package/dist/commonjs/components/LoadingDots/assets/loading-button-gray.json +739 -0
- package/dist/commonjs/components/LoadingDots/index.js +2 -1
- package/dist/commonjs/components/LoadingDots/index.js.map +1 -1
- package/dist/module/components/ActionButton/index.js +2 -1
- package/dist/module/components/ActionButton/index.js.map +1 -1
- package/dist/module/components/DatePicker/index.js +35 -27
- package/dist/module/components/DatePicker/index.js.map +1 -1
- package/dist/module/components/LoadingDots/assets/loading-button-gray.json +739 -0
- package/dist/module/components/LoadingDots/index.js +2 -1
- package/dist/module/components/LoadingDots/index.js.map +1 -1
- package/dist/typescript/components/ActionButton/types.d.ts +4 -0
- package/dist/typescript/components/DatePicker/index.d.ts +4 -2
- package/dist/typescript/components/LoadingDots/types.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/ActionButton/index.tsx +2 -0
- package/src/components/ActionButton/types.ts +4 -0
- package/src/components/DatePicker/index.tsx +103 -56
- package/src/components/LoadingDots/assets/loading-button-gray.json +739 -0
- package/src/components/LoadingDots/index.tsx +1 -0
- package/src/components/LoadingDots/types.ts +1 -1
|
@@ -14,7 +14,8 @@ export const LoadingDots = ({
|
|
|
14
14
|
const variantsMap = {
|
|
15
15
|
grape: require("./assets/loading-button-grape.json"),
|
|
16
16
|
light: require("./assets/loading-button-light.json"),
|
|
17
|
-
dark: require("./assets/loading-button-dark.json")
|
|
17
|
+
dark: require("./assets/loading-button-dark.json"),
|
|
18
|
+
gray: require("./assets/loading-button-gray.json")
|
|
18
19
|
};
|
|
19
20
|
const purposefulOverwrittenSrc = variantsMap[variant];
|
|
20
21
|
const narrowedStyle = lottieViewStyle || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LottieView","View","jsx","_jsx","LoadingDots","variant","className","style","lottieViewStyle","ref","rest","variantsMap","grape","require","light","dark","purposefulOverwrittenSrc","narrowedStyle","children","loop","autoPlay","width","height","source"],"sourceRoot":"../../../../src","sources":["components/LoadingDots/index.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,qBAAqB;AAE5C,SAASC,IAAI,QAAmB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/C,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,OAAO,GAAG,OAAO;EACjBC,SAAS;EACTC,KAAK;EACLC,eAAe;EACfC,GAAG;EACH,GAAGC;AACa,CAAC,KAAK;EACtB,MAAMC,WAA+C,GAAG;IACtDC,KAAK,EAAEC,OAAO,CAAC,oCAAoC,CAAC;IACpDC,KAAK,EAAED,OAAO,CAAC,oCAAoC,CAAC;IACpDE,IAAI,EAAEF,OAAO,CAAC,mCAAmC;EACnD,CAAC;EAED,
|
|
1
|
+
{"version":3,"names":["LottieView","View","jsx","_jsx","LoadingDots","variant","className","style","lottieViewStyle","ref","rest","variantsMap","grape","require","light","dark","gray","purposefulOverwrittenSrc","narrowedStyle","children","loop","autoPlay","width","height","source"],"sourceRoot":"../../../../src","sources":["components/LoadingDots/index.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,qBAAqB;AAE5C,SAASC,IAAI,QAAmB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/C,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,OAAO,GAAG,OAAO;EACjBC,SAAS;EACTC,KAAK;EACLC,eAAe;EACfC,GAAG;EACH,GAAGC;AACa,CAAC,KAAK;EACtB,MAAMC,WAA+C,GAAG;IACtDC,KAAK,EAAEC,OAAO,CAAC,oCAAoC,CAAC;IACpDC,KAAK,EAAED,OAAO,CAAC,oCAAoC,CAAC;IACpDE,IAAI,EAAEF,OAAO,CAAC,mCAAmC,CAAC;IAClDG,IAAI,EAAEH,OAAO,CAAC,mCAAmC;EACnD,CAAC;EAED,MAAMI,wBAAwB,GAAGN,WAAW,CAACN,OAAO,CAAC;EAErD,MAAMa,aAAa,GAAIV,eAAe,IAAkB,CAAC,CAAC;EAE1D,oBACEL,IAAA,CAACF,IAAI;IAACK,SAAS,EAAEA,SAAU;IAACC,KAAK,EAAEA,KAAM;IAACE,GAAG,EAAEA,GAAI;IAAAU,QAAA,eACjDhB,IAAA,CAACH,UAAU;MACToB,IAAI,EAAE,IAAK;MACXC,QAAQ,EAAE,IAAK;MAAA,GACXX,IAAI;MACRH,KAAK,EAAE;QAAEe,KAAK,EAAE,EAAE;QAAEC,MAAM,EAAE,EAAE;QAAE,GAAGL;MAAc,CAAE;MACnDM,MAAM,EAAEP;IAAyB,CAClC;EAAC,CACE,CAAC;AAEX,CAAC;AAED,eAAeb,WAAW","ignoreList":[]}
|
|
@@ -38,6 +38,10 @@ export interface ActionButtonProps extends VariantProps<typeof menuCardVariants>
|
|
|
38
38
|
* Whether the card is disabled
|
|
39
39
|
*/
|
|
40
40
|
disabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the card is selected (only affects outline variant)
|
|
43
|
+
*/
|
|
44
|
+
selected?: boolean;
|
|
41
45
|
/**
|
|
42
46
|
* Additional class names for the main container
|
|
43
47
|
*/
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { DatePickerProps } from "./types";
|
|
3
|
+
declare const NativeWindDatePicker: React.ComponentType<DatePickerProps>;
|
|
4
|
+
export { NativeWindDatePicker as DatePicker };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LottieViewProps } from "lottie-react-native";
|
|
2
2
|
import { StyleProp, View, ViewStyle } from "react-native";
|
|
3
|
-
export type LoadingDotsVariant = "grape" | "light" | "dark";
|
|
3
|
+
export type LoadingDotsVariant = "grape" | "light" | "dark" | "gray";
|
|
4
4
|
export interface LoadingDotsProps extends Omit<LottieViewProps, "source"> {
|
|
5
5
|
variant?: LoadingDotsVariant;
|
|
6
6
|
lottieViewStyle?: StyleProp<ViewStyle>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kivid/native-components",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.23",
|
|
4
4
|
"description": "A React Native component library for the Butterfly Design System.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"react-test-renderer": "19.0.0",
|
|
89
89
|
"ts-jest": "^29.2.5",
|
|
90
90
|
"typescript": "~5.8.3",
|
|
91
|
-
"@kivid/tailwind-preset": "1.0.0-alpha.
|
|
92
|
-
"@kivid/icons": "1.0.0-alpha.
|
|
91
|
+
"@kivid/tailwind-preset": "1.0.0-alpha.23",
|
|
92
|
+
"@kivid/icons": "1.0.0-alpha.23"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"@lottiefiles/dotlottie-react": "^0.15.1",
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"react": "19.0.0",
|
|
100
100
|
"react-native": "0.79.5",
|
|
101
101
|
"react-native-svg": "^15.12.0",
|
|
102
|
-
"@kivid/tailwind-preset": "1.0.0-alpha.
|
|
103
|
-
"@kivid/icons": "1.0.0-alpha.
|
|
102
|
+
"@kivid/tailwind-preset": "1.0.0-alpha.23",
|
|
103
|
+
"@kivid/icons": "1.0.0-alpha.23"
|
|
104
104
|
},
|
|
105
105
|
"eslintIgnore": [
|
|
106
106
|
"node_modules/",
|
|
@@ -16,6 +16,7 @@ export function ActionButton(props: ActionButtonProps) {
|
|
|
16
16
|
variant = "grape",
|
|
17
17
|
corners = CornersEnum.MEDIUM,
|
|
18
18
|
disabled = false,
|
|
19
|
+
selected = false,
|
|
19
20
|
className,
|
|
20
21
|
iconContainerClassName,
|
|
21
22
|
onPress,
|
|
@@ -45,6 +46,7 @@ export function ActionButton(props: ActionButtonProps) {
|
|
|
45
46
|
corners,
|
|
46
47
|
}),
|
|
47
48
|
isPressed && !disabled && pressedColorMap[variant],
|
|
49
|
+
selected && variant === "outline" && "border-grape-300 bg-grape-100",
|
|
48
50
|
className
|
|
49
51
|
);
|
|
50
52
|
|
|
@@ -53,6 +53,10 @@ export interface ActionButtonProps
|
|
|
53
53
|
* Whether the card is disabled
|
|
54
54
|
*/
|
|
55
55
|
disabled?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the card is selected (only affects outline variant)
|
|
58
|
+
*/
|
|
59
|
+
selected?: boolean;
|
|
56
60
|
/**
|
|
57
61
|
* Additional class names for the main container
|
|
58
62
|
*/
|
|
@@ -1,24 +1,59 @@
|
|
|
1
|
-
import { useState, useMemo, useCallback } from
|
|
2
|
-
import { View } from
|
|
3
|
-
import { Calendar, DateData, LocaleConfig } from
|
|
4
|
-
import { format } from
|
|
5
|
-
import { ptBR } from
|
|
6
|
-
import type { DatePickerProps } from
|
|
7
|
-
|
|
8
|
-
import { defaultTheme } from
|
|
9
|
-
import Typography from
|
|
10
|
-
import { ArrowLeftStroke, ArrowRightStroke } from
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import React, { useState, useMemo, useCallback } from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { Calendar, DateData, LocaleConfig } from "react-native-calendars";
|
|
4
|
+
import { format } from "date-fns";
|
|
5
|
+
import { ptBR } from "date-fns/locale";
|
|
6
|
+
import type { DatePickerProps } from "./types";
|
|
7
|
+
|
|
8
|
+
import { defaultTheme } from "./assets/theme";
|
|
9
|
+
import Typography from "../Typography";
|
|
10
|
+
import { ArrowLeftStroke, ArrowRightStroke } from "@kivid/icons/native";
|
|
11
|
+
import { cssInterop } from "nativewind";
|
|
12
|
+
|
|
13
|
+
LocaleConfig.locales["pt-br"] = {
|
|
14
|
+
monthNames: [
|
|
15
|
+
"Janeiro",
|
|
16
|
+
"Fevereiro",
|
|
17
|
+
"Março",
|
|
18
|
+
"Abril",
|
|
19
|
+
"Maio",
|
|
20
|
+
"Junho",
|
|
21
|
+
"Julho",
|
|
22
|
+
"Agosto",
|
|
23
|
+
"Setembro",
|
|
24
|
+
"Outubro",
|
|
25
|
+
"Novembro",
|
|
26
|
+
"Dezembro",
|
|
27
|
+
],
|
|
28
|
+
monthNamesShort: [
|
|
29
|
+
"Jan",
|
|
30
|
+
"Fev",
|
|
31
|
+
"Mar",
|
|
32
|
+
"Abr",
|
|
33
|
+
"Mai",
|
|
34
|
+
"Jun",
|
|
35
|
+
"Jul",
|
|
36
|
+
"Ago",
|
|
37
|
+
"Set",
|
|
38
|
+
"Out",
|
|
39
|
+
"Nov",
|
|
40
|
+
"Dez",
|
|
41
|
+
],
|
|
42
|
+
dayNames: [
|
|
43
|
+
"Domingo",
|
|
44
|
+
"Segunda",
|
|
45
|
+
"Terça",
|
|
46
|
+
"Quarta",
|
|
47
|
+
"Quinta",
|
|
48
|
+
"Sexta",
|
|
49
|
+
"Sábado",
|
|
50
|
+
],
|
|
51
|
+
dayNamesShort: ["D", "S", "T", "Q", "Q", "S", "S"],
|
|
52
|
+
today: "Hoje",
|
|
18
53
|
};
|
|
19
|
-
LocaleConfig.defaultLocale =
|
|
54
|
+
LocaleConfig.defaultLocale = "pt-br";
|
|
20
55
|
|
|
21
|
-
|
|
56
|
+
function DatePicker(props: DatePickerProps) {
|
|
22
57
|
const {
|
|
23
58
|
selectedDates,
|
|
24
59
|
onSelectedDatesChange,
|
|
@@ -32,9 +67,8 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
32
67
|
...rest
|
|
33
68
|
} = props;
|
|
34
69
|
|
|
35
|
-
|
|
36
70
|
const [currentMonth, setCurrentMonth] = useState<string>(
|
|
37
|
-
initialDate || format(new Date(),
|
|
71
|
+
initialDate || format(new Date(), "yyyy-MM-dd")
|
|
38
72
|
);
|
|
39
73
|
|
|
40
74
|
const onDayPress = useCallback(
|
|
@@ -55,7 +89,7 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
55
89
|
return;
|
|
56
90
|
}
|
|
57
91
|
|
|
58
|
-
if (selectionType ===
|
|
92
|
+
if (selectionType === "multi-dot") {
|
|
59
93
|
onSelectedDatesChange((prev) => {
|
|
60
94
|
const isSelected = prev.includes(dateString);
|
|
61
95
|
const newDates = isSelected
|
|
@@ -66,17 +100,25 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
66
100
|
return;
|
|
67
101
|
}
|
|
68
102
|
},
|
|
69
|
-
[
|
|
103
|
+
[
|
|
104
|
+
onSelectedDatesChange,
|
|
105
|
+
selectionType,
|
|
106
|
+
externalMarkedDates,
|
|
107
|
+
unavailableDates,
|
|
108
|
+
]
|
|
70
109
|
);
|
|
71
110
|
|
|
72
111
|
const markedDates = useMemo(() => {
|
|
73
112
|
const filteredExternalMarkedDates = externalMarkedDates
|
|
74
|
-
? Object.keys(externalMarkedDates).reduce(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
113
|
+
? Object.keys(externalMarkedDates).reduce(
|
|
114
|
+
(acc, date) => {
|
|
115
|
+
if (!unavailableDates?.includes(date)) {
|
|
116
|
+
acc[date] = externalMarkedDates[date];
|
|
117
|
+
}
|
|
118
|
+
return acc;
|
|
119
|
+
},
|
|
120
|
+
{} as typeof externalMarkedDates
|
|
121
|
+
)
|
|
80
122
|
: {};
|
|
81
123
|
|
|
82
124
|
const marked = { ...filteredExternalMarkedDates };
|
|
@@ -86,8 +128,8 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
86
128
|
marked[date] = {
|
|
87
129
|
disabled: true,
|
|
88
130
|
disableTouchEvent: true,
|
|
89
|
-
textColor:
|
|
90
|
-
dotColor:
|
|
131
|
+
textColor: "#D1D5DB",
|
|
132
|
+
dotColor: "#D1D5DB",
|
|
91
133
|
};
|
|
92
134
|
});
|
|
93
135
|
}
|
|
@@ -98,8 +140,8 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
98
140
|
...marked[date],
|
|
99
141
|
disableTouchEvent: true,
|
|
100
142
|
selected: true,
|
|
101
|
-
selectedColor:
|
|
102
|
-
selectedTextColor:
|
|
143
|
+
selectedColor: "#EAE0FF",
|
|
144
|
+
selectedTextColor: "#1F2937",
|
|
103
145
|
};
|
|
104
146
|
});
|
|
105
147
|
}
|
|
@@ -110,21 +152,21 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
110
152
|
marked[firstDate] = {
|
|
111
153
|
...marked[firstDate],
|
|
112
154
|
selected: true,
|
|
113
|
-
selectedColor:
|
|
114
|
-
selectedTextColor:
|
|
155
|
+
selectedColor: "#EAE0FF",
|
|
156
|
+
selectedTextColor: "#1F2937",
|
|
115
157
|
};
|
|
116
158
|
}
|
|
117
159
|
return marked;
|
|
118
160
|
}
|
|
119
161
|
|
|
120
|
-
if (selectionType ===
|
|
162
|
+
if (selectionType === "multi-dot") {
|
|
121
163
|
selectedDates.forEach((date) => {
|
|
122
164
|
if (!unavailableDates?.includes(date)) {
|
|
123
165
|
marked[date] = {
|
|
124
166
|
...marked[date],
|
|
125
167
|
selected: true,
|
|
126
|
-
selectedColor:
|
|
127
|
-
selectedTextColor:
|
|
168
|
+
selectedColor: "#EAE0FF",
|
|
169
|
+
selectedTextColor: "#1F2937",
|
|
128
170
|
};
|
|
129
171
|
}
|
|
130
172
|
});
|
|
@@ -139,26 +181,20 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
139
181
|
...customTheme,
|
|
140
182
|
};
|
|
141
183
|
|
|
142
|
-
const handlePressArrowLeft = useCallback(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
[],
|
|
147
|
-
);
|
|
184
|
+
const handlePressArrowLeft = useCallback((subtractMonth: () => void) => {
|
|
185
|
+
subtractMonth();
|
|
186
|
+
}, []);
|
|
148
187
|
|
|
149
|
-
const handlePressArrowRight = useCallback(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
[],
|
|
154
|
-
);
|
|
188
|
+
const handlePressArrowRight = useCallback((addMonth: () => void) => {
|
|
189
|
+
addMonth();
|
|
190
|
+
}, []);
|
|
155
191
|
|
|
156
192
|
const handleMonthChange = useCallback((date: DateData) => {
|
|
157
193
|
setCurrentMonth(date.dateString);
|
|
158
194
|
}, []);
|
|
159
195
|
|
|
160
196
|
return (
|
|
161
|
-
<View
|
|
197
|
+
<View>
|
|
162
198
|
<Calendar
|
|
163
199
|
current={currentMonth}
|
|
164
200
|
onDayPress={onDayPress}
|
|
@@ -174,9 +210,8 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
174
210
|
markingType={selectionType}
|
|
175
211
|
firstDay={0}
|
|
176
212
|
renderArrow={(direction) => (
|
|
177
|
-
<View
|
|
178
|
-
|
|
179
|
-
{direction === 'left' ? (
|
|
213
|
+
<View className="items-center border p-400 mb-600 rounded-500 border-chia-400 bg-chia-100">
|
|
214
|
+
{direction === "left" ? (
|
|
180
215
|
<ArrowLeftStroke size={24} className="text-gray-900" />
|
|
181
216
|
) : (
|
|
182
217
|
<ArrowRightStroke size={24} className="text-gray-900" />
|
|
@@ -184,7 +219,7 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
184
219
|
</View>
|
|
185
220
|
)}
|
|
186
221
|
renderHeader={(date) => {
|
|
187
|
-
const formattedDate = format(new Date(date),
|
|
222
|
+
const formattedDate = format(new Date(date), "MMMM yy", {
|
|
188
223
|
locale: ptBR,
|
|
189
224
|
});
|
|
190
225
|
const capitalizedDate =
|
|
@@ -192,7 +227,9 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
192
227
|
|
|
193
228
|
return (
|
|
194
229
|
<View className="items-center translate-y-[-8px]">
|
|
195
|
-
<Typography variant=
|
|
230
|
+
<Typography variant="label_large" weight="700">
|
|
231
|
+
{capitalizedDate}
|
|
232
|
+
</Typography>
|
|
196
233
|
</View>
|
|
197
234
|
);
|
|
198
235
|
}}
|
|
@@ -201,3 +238,13 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
201
238
|
</View>
|
|
202
239
|
);
|
|
203
240
|
}
|
|
241
|
+
|
|
242
|
+
const NativeWindDatePicker = cssInterop?.(DatePicker, {
|
|
243
|
+
className: {
|
|
244
|
+
target: "style",
|
|
245
|
+
},
|
|
246
|
+
}) as React.ComponentType<DatePickerProps>;
|
|
247
|
+
|
|
248
|
+
NativeWindDatePicker.displayName = "DatePicker";
|
|
249
|
+
|
|
250
|
+
export { NativeWindDatePicker as DatePicker };
|