@butternutbox/pawprint-native 0.24.2 → 0.25.0
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs +17 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
- package/src/components/molecules/DatePicker/DatePicker.stories.tsx +39 -0
- package/src/components/molecules/DatePicker/DatePicker.tsx +5 -1
- package/src/components/molecules/SelectField/SelectField.tsx +4 -1
- package/src/components/molecules/SelectField/SelectFieldValue.tsx +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@butternutbox/pawprint-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ButternutBox Pawprint Design System - React Native Components",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@rn-primitives/switch": "^1.4.0",
|
|
36
36
|
"@rn-primitives/tabs": "^1.4.0",
|
|
37
37
|
"@rn-primitives/tooltip": "^1.4.0",
|
|
38
|
-
"date-fns": "^4.1.0"
|
|
39
|
-
"expo": "^55.0.9"
|
|
38
|
+
"date-fns": "^4.1.0"
|
|
40
39
|
},
|
|
41
40
|
"peerDependencies": {
|
|
41
|
+
"expo-font": ">=14.0.0",
|
|
42
42
|
"react": ">=18.0.0",
|
|
43
43
|
"react-native": ">=0.74.0",
|
|
44
44
|
"react-native-gesture-handler": ">=2.20.0",
|
|
@@ -47,6 +47,11 @@
|
|
|
47
47
|
"react-native-svg": ">=15.0.0",
|
|
48
48
|
"react-native-worklets": ">=0.5.0"
|
|
49
49
|
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"expo-font": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
50
55
|
"devDependencies": {
|
|
51
56
|
"@butternutbox/pawprint-icons": "workspace:*",
|
|
52
57
|
"@butternutbox/pawprint-illustrations": "workspace:*",
|
|
@@ -59,6 +64,7 @@
|
|
|
59
64
|
"@types/react": "~19.1.10",
|
|
60
65
|
"@types/react-native": "^0.73.0",
|
|
61
66
|
"eslint": "^8.57.0",
|
|
67
|
+
"expo-font": "~56.0.7",
|
|
62
68
|
"jsdom": "^26.1.0",
|
|
63
69
|
"react": "19.1.0",
|
|
64
70
|
"react-native": "0.81.5",
|
|
@@ -287,6 +287,45 @@ export const AllDateStates = {
|
|
|
287
287
|
)
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
export const CustomMonthLabels = {
|
|
291
|
+
render: () => {
|
|
292
|
+
const { year, month, selectedDate, setSelectedDate, prevMonth, nextMonth } =
|
|
293
|
+
useCalendarState()
|
|
294
|
+
|
|
295
|
+
const CUSTOM_MONTH_NAMES = [
|
|
296
|
+
"January",
|
|
297
|
+
"February",
|
|
298
|
+
"March",
|
|
299
|
+
"April",
|
|
300
|
+
"May",
|
|
301
|
+
"June",
|
|
302
|
+
"July",
|
|
303
|
+
"August",
|
|
304
|
+
"September",
|
|
305
|
+
"October",
|
|
306
|
+
"November",
|
|
307
|
+
"December"
|
|
308
|
+
]
|
|
309
|
+
|
|
310
|
+
const customMonthLabel = (y: number, m: number): string =>
|
|
311
|
+
`${CUSTOM_MONTH_NAMES[m]} ${y}`
|
|
312
|
+
|
|
313
|
+
return (
|
|
314
|
+
<View style={styles.container}>
|
|
315
|
+
<DatePicker
|
|
316
|
+
year={year}
|
|
317
|
+
month={month}
|
|
318
|
+
selectedDate={selectedDate}
|
|
319
|
+
onDateSelect={setSelectedDate}
|
|
320
|
+
onPrevMonth={prevMonth}
|
|
321
|
+
onNextMonth={nextMonth}
|
|
322
|
+
getMonthLabel={customMonthLabel}
|
|
323
|
+
/>
|
|
324
|
+
</View>
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
290
329
|
const styles = StyleSheet.create({
|
|
291
330
|
container: {
|
|
292
331
|
padding: 16
|
|
@@ -118,6 +118,7 @@ type DatePickerOwnProps = {
|
|
|
118
118
|
showNextControl?: boolean
|
|
119
119
|
locale?: Locale
|
|
120
120
|
monthLabel?: string
|
|
121
|
+
getMonthLabel?: (year: number, month: number, locale?: Locale) => string
|
|
121
122
|
weekDayLabels?: [string, string, string, string, string, string, string]
|
|
122
123
|
getDateState?: (date: Date) => DateItemState
|
|
123
124
|
isDateDisabled?: (date: Date) => boolean
|
|
@@ -266,6 +267,7 @@ export const DatePicker = React.forwardRef<View, DatePickerProps>(
|
|
|
266
267
|
showNextControl = true,
|
|
267
268
|
locale,
|
|
268
269
|
monthLabel,
|
|
270
|
+
getMonthLabel,
|
|
269
271
|
weekDayLabels = DEFAULT_WEEK_LABELS,
|
|
270
272
|
getDateState,
|
|
271
273
|
isDateDisabled,
|
|
@@ -341,7 +343,9 @@ export const DatePicker = React.forwardRef<View, DatePickerProps>(
|
|
|
341
343
|
)
|
|
342
344
|
|
|
343
345
|
const resolvedMonthLabel =
|
|
344
|
-
monthLabel ??
|
|
346
|
+
monthLabel ??
|
|
347
|
+
getMonthLabel?.(year, month, locale) ??
|
|
348
|
+
getDefaultMonthLabel(year, month, locale)
|
|
345
349
|
|
|
346
350
|
const calendarRows = useMemo(
|
|
347
351
|
() => buildCalendarGrid(year, month),
|
|
@@ -453,7 +453,10 @@ const SelectFieldRoot = React.forwardRef<View, SelectFieldProps>(
|
|
|
453
453
|
accessibilityLabel="Search options"
|
|
454
454
|
/>
|
|
455
455
|
) : (
|
|
456
|
-
<SelectFieldValue
|
|
456
|
+
<SelectFieldValue
|
|
457
|
+
placeholder={placeholder}
|
|
458
|
+
hasValue={Boolean(currentValue)}
|
|
459
|
+
/>
|
|
457
460
|
)}
|
|
458
461
|
</SelectFieldTrigger>
|
|
459
462
|
{description && (
|
|
@@ -6,10 +6,11 @@ import { Typography } from "../../atoms/Typography"
|
|
|
6
6
|
|
|
7
7
|
type SelectFieldValueProps = {
|
|
8
8
|
placeholder?: string
|
|
9
|
+
hasValue?: boolean
|
|
9
10
|
} & Omit<ViewProps, "children">
|
|
10
11
|
|
|
11
12
|
export const SelectFieldValue = React.forwardRef<View, SelectFieldValueProps>(
|
|
12
|
-
({ placeholder, ...rest }, ref) => {
|
|
13
|
+
({ placeholder, hasValue = true, ...rest }, ref) => {
|
|
13
14
|
const theme = useTheme()
|
|
14
15
|
const { colour, field } = theme.tokens.components.inputs
|
|
15
16
|
|
|
@@ -17,7 +18,9 @@ export const SelectFieldValue = React.forwardRef<View, SelectFieldValueProps>(
|
|
|
17
18
|
<View ref={ref} style={{ flex: 1, minWidth: 0 }} {...rest}>
|
|
18
19
|
<Typography
|
|
19
20
|
token={field.placeholder.default}
|
|
20
|
-
color={
|
|
21
|
+
color={
|
|
22
|
+
hasValue ? colour.field.text.default : colour.field.text.placeholder
|
|
23
|
+
}
|
|
21
24
|
align="left"
|
|
22
25
|
>
|
|
23
26
|
<SelectPrimitive.Value placeholder={placeholder ?? ""} />
|