@butternutbox/pawprint-native 0.24.3 → 0.25.1
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 +16 -0
- package/dist/index.cjs +29 -10
- 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 +29 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/Button/Button.stories.tsx +90 -16
- package/src/components/atoms/Button/Button.tsx +13 -2
- 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/dist/index.d.cts
CHANGED
|
@@ -1599,6 +1599,7 @@ declare const SelectFieldTrigger: React.ForwardRefExoticComponent<SelectFieldTri
|
|
|
1599
1599
|
|
|
1600
1600
|
declare const SelectFieldValue: React.ForwardRefExoticComponent<{
|
|
1601
1601
|
placeholder?: string;
|
|
1602
|
+
hasValue?: boolean;
|
|
1602
1603
|
} & Omit<ViewProps, "children"> & React.RefAttributes<View>>;
|
|
1603
1604
|
|
|
1604
1605
|
declare const SelectFieldContent: React.ForwardRefExoticComponent<{
|
|
@@ -2121,6 +2122,7 @@ type DatePickerOwnProps = {
|
|
|
2121
2122
|
showNextControl?: boolean;
|
|
2122
2123
|
locale?: Locale;
|
|
2123
2124
|
monthLabel?: string;
|
|
2125
|
+
getMonthLabel?: (year: number, month: number, locale?: Locale) => string;
|
|
2124
2126
|
weekDayLabels?: [string, string, string, string, string, string, string];
|
|
2125
2127
|
getDateState?: (date: Date) => DateItemState;
|
|
2126
2128
|
isDateDisabled?: (date: Date) => boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1599,6 +1599,7 @@ declare const SelectFieldTrigger: React.ForwardRefExoticComponent<SelectFieldTri
|
|
|
1599
1599
|
|
|
1600
1600
|
declare const SelectFieldValue: React.ForwardRefExoticComponent<{
|
|
1601
1601
|
placeholder?: string;
|
|
1602
|
+
hasValue?: boolean;
|
|
1602
1603
|
} & Omit<ViewProps, "children"> & React.RefAttributes<View>>;
|
|
1603
1604
|
|
|
1604
1605
|
declare const SelectFieldContent: React.ForwardRefExoticComponent<{
|
|
@@ -2121,6 +2122,7 @@ type DatePickerOwnProps = {
|
|
|
2121
2122
|
showNextControl?: boolean;
|
|
2122
2123
|
locale?: Locale;
|
|
2123
2124
|
monthLabel?: string;
|
|
2125
|
+
getMonthLabel?: (year: number, month: number, locale?: Locale) => string;
|
|
2124
2126
|
weekDayLabels?: [string, string, string, string, string, string, string];
|
|
2125
2127
|
getDateState?: (date: Date) => DateItemState;
|
|
2126
2128
|
isDateDisabled?: (date: Date) => boolean;
|
package/dist/index.js
CHANGED
|
@@ -1262,6 +1262,16 @@ var Button = React66.forwardRef(
|
|
|
1262
1262
|
};
|
|
1263
1263
|
};
|
|
1264
1264
|
const variantStyles = getVariantStyles(pressed);
|
|
1265
|
+
const renderIcon = (icon) => {
|
|
1266
|
+
if (!React66.isValidElement(icon)) return icon;
|
|
1267
|
+
const iconElement = icon;
|
|
1268
|
+
if (!pressed) {
|
|
1269
|
+
return icon;
|
|
1270
|
+
}
|
|
1271
|
+
return React66.cloneElement(iconElement, {
|
|
1272
|
+
customColour: variantStyles.textColor
|
|
1273
|
+
});
|
|
1274
|
+
};
|
|
1265
1275
|
return /* @__PURE__ */ jsxs(
|
|
1266
1276
|
StyledButton,
|
|
1267
1277
|
__spreadProps(__spreadValues({
|
|
@@ -1285,7 +1295,7 @@ var Button = React66.forwardRef(
|
|
|
1285
1295
|
buttonFullWidth: fullWidth
|
|
1286
1296
|
}, rest), {
|
|
1287
1297
|
children: [
|
|
1288
|
-
startIcon && /* @__PURE__ */ jsx(IconWrapper, { children: startIcon }),
|
|
1298
|
+
startIcon && /* @__PURE__ */ jsx(IconWrapper, { children: renderIcon(startIcon) }),
|
|
1289
1299
|
/* @__PURE__ */ jsx(
|
|
1290
1300
|
Typography,
|
|
1291
1301
|
{
|
|
@@ -1301,7 +1311,7 @@ var Button = React66.forwardRef(
|
|
|
1301
1311
|
children
|
|
1302
1312
|
}
|
|
1303
1313
|
),
|
|
1304
|
-
endIcon && /* @__PURE__ */ jsx(IconWrapper, { children: endIcon }),
|
|
1314
|
+
endIcon && /* @__PURE__ */ jsx(IconWrapper, { children: renderIcon(endIcon) }),
|
|
1305
1315
|
loading && /* @__PURE__ */ jsx(StyledSpinnerWrapper, { children: /* @__PURE__ */ jsx(
|
|
1306
1316
|
Spinner,
|
|
1307
1317
|
{
|
|
@@ -8852,14 +8862,14 @@ var SelectFieldTrigger = React66.forwardRef(
|
|
|
8852
8862
|
SelectFieldTrigger.displayName = "SelectField.Trigger";
|
|
8853
8863
|
var SelectFieldValue = React66.forwardRef(
|
|
8854
8864
|
(_a, ref) => {
|
|
8855
|
-
var _b = _a, { placeholder } = _b, rest = __objRest(_b, ["placeholder"]);
|
|
8865
|
+
var _b = _a, { placeholder, hasValue = true } = _b, rest = __objRest(_b, ["placeholder", "hasValue"]);
|
|
8856
8866
|
const theme2 = useTheme();
|
|
8857
8867
|
const { colour, field } = theme2.tokens.components.inputs;
|
|
8858
8868
|
return /* @__PURE__ */ jsx(View, __spreadProps(__spreadValues({ ref, style: { flex: 1, minWidth: 0 } }, rest), { children: /* @__PURE__ */ jsx(
|
|
8859
8869
|
Typography,
|
|
8860
8870
|
{
|
|
8861
8871
|
token: field.placeholder.default,
|
|
8862
|
-
color: colour.field.text.default,
|
|
8872
|
+
color: hasValue ? colour.field.text.default : colour.field.text.placeholder,
|
|
8863
8873
|
align: "left",
|
|
8864
8874
|
children: /* @__PURE__ */ jsx(SelectPrimitive3.Value, { placeholder: placeholder != null ? placeholder : "" })
|
|
8865
8875
|
}
|
|
@@ -9236,7 +9246,13 @@ var SelectFieldRoot = React66.forwardRef(
|
|
|
9236
9246
|
clearButtonMode: "never",
|
|
9237
9247
|
accessibilityLabel: "Search options"
|
|
9238
9248
|
}
|
|
9239
|
-
) : /* @__PURE__ */ jsx(
|
|
9249
|
+
) : /* @__PURE__ */ jsx(
|
|
9250
|
+
SelectFieldValue,
|
|
9251
|
+
{
|
|
9252
|
+
placeholder,
|
|
9253
|
+
hasValue: Boolean(currentValue)
|
|
9254
|
+
}
|
|
9255
|
+
)
|
|
9240
9256
|
}
|
|
9241
9257
|
),
|
|
9242
9258
|
description && /* @__PURE__ */ jsx(InputDescription, { state, children: description }),
|
|
@@ -11112,6 +11128,7 @@ var DatePicker = React66.forwardRef(
|
|
|
11112
11128
|
showNextControl = true,
|
|
11113
11129
|
locale,
|
|
11114
11130
|
monthLabel,
|
|
11131
|
+
getMonthLabel,
|
|
11115
11132
|
weekDayLabels = DEFAULT_WEEK_LABELS,
|
|
11116
11133
|
getDateState,
|
|
11117
11134
|
isDateDisabled,
|
|
@@ -11131,12 +11148,14 @@ var DatePicker = React66.forwardRef(
|
|
|
11131
11148
|
"showNextControl",
|
|
11132
11149
|
"locale",
|
|
11133
11150
|
"monthLabel",
|
|
11151
|
+
"getMonthLabel",
|
|
11134
11152
|
"weekDayLabels",
|
|
11135
11153
|
"getDateState",
|
|
11136
11154
|
"isDateDisabled",
|
|
11137
11155
|
"minDate",
|
|
11138
11156
|
"maxDate"
|
|
11139
11157
|
]);
|
|
11158
|
+
var _a2;
|
|
11140
11159
|
const theme2 = useTheme();
|
|
11141
11160
|
const { datePicker } = theme2.tokens.components;
|
|
11142
11161
|
const dt = datePicker.dateItem;
|
|
@@ -11171,8 +11190,8 @@ var DatePicker = React66.forwardRef(
|
|
|
11171
11190
|
);
|
|
11172
11191
|
const resolvedGetDateState = useCallback(
|
|
11173
11192
|
(date) => {
|
|
11174
|
-
var
|
|
11175
|
-
return (
|
|
11193
|
+
var _a3;
|
|
11194
|
+
return (_a3 = getDateState == null ? void 0 : getDateState(date)) != null ? _a3 : defaultGetDateState(date);
|
|
11176
11195
|
},
|
|
11177
11196
|
[getDateState]
|
|
11178
11197
|
);
|
|
@@ -11200,7 +11219,7 @@ var DatePicker = React66.forwardRef(
|
|
|
11200
11219
|
},
|
|
11201
11220
|
[isDateDisabled, minDate, maxDate]
|
|
11202
11221
|
);
|
|
11203
|
-
const resolvedMonthLabel = monthLabel != null ? monthLabel : getDefaultMonthLabel(year, month, locale);
|
|
11222
|
+
const resolvedMonthLabel = (_a2 = monthLabel != null ? monthLabel : getMonthLabel == null ? void 0 : getMonthLabel(year, month, locale)) != null ? _a2 : getDefaultMonthLabel(year, month, locale);
|
|
11204
11223
|
const calendarRows = useMemo(
|
|
11205
11224
|
() => buildCalendarGrid(year, month),
|
|
11206
11225
|
[year, month]
|
|
@@ -11211,10 +11230,10 @@ var DatePicker = React66.forwardRef(
|
|
|
11211
11230
|
);
|
|
11212
11231
|
const resolveDateCellConfig = useCallback(
|
|
11213
11232
|
(date) => {
|
|
11214
|
-
var
|
|
11233
|
+
var _a3;
|
|
11215
11234
|
const state = resolvedGetDateState(date);
|
|
11216
11235
|
const isSelectedPrimary = selectedDate != null && isSameDay(date, selectedDate);
|
|
11217
|
-
const isSelectedSecondary = (
|
|
11236
|
+
const isSelectedSecondary = (_a3 = selectedDatesSet == null ? void 0 : selectedDatesSet.has(toDateKey(date))) != null ? _a3 : false;
|
|
11218
11237
|
const isSelected = isSelectedPrimary || isSelectedSecondary;
|
|
11219
11238
|
let indicatorBg = "transparent";
|
|
11220
11239
|
let indicatorBorderColor = "transparent";
|