@homebound/beam 2.339.0 → 2.341.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/dist/components/internal/DatePicker/DatePicker.d.ts +1 -0
- package/dist/components/internal/DatePicker/DatePicker.js +2 -2
- package/dist/inputs/Checkbox.d.ts +5 -0
- package/dist/inputs/CheckboxBase.d.ts +5 -0
- package/dist/inputs/CheckboxBase.js +3 -3
- package/dist/inputs/DateFields/DateFieldBase.d.ts +2 -0
- package/dist/inputs/DateFields/DateFieldBase.js +3 -3
- package/package.json +1 -1
|
@@ -5,5 +5,6 @@ export interface DatePickerProps {
|
|
|
5
5
|
onSelect: (value: Date) => void;
|
|
6
6
|
disabledDays?: Matcher | Matcher[];
|
|
7
7
|
dottedDays?: Matcher[];
|
|
8
|
+
useYearPicker?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare function DatePicker(props: DatePickerProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -10,9 +10,9 @@ const Css_1 = require("../../../Css");
|
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
11
|
require("./DatePicker.css");
|
|
12
12
|
function DatePicker(props) {
|
|
13
|
-
const { value, onSelect, disabledDays, dottedDays } = props;
|
|
13
|
+
const { value, onSelect, disabledDays, dottedDays, useYearPicker } = props;
|
|
14
14
|
const tid = (0, utils_1.useTestIds)(props, "datePicker");
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.dib.bgWhite.xs.$, ...tid, children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { components: { Caption: Header_1.Header, Head: WeekHeader_1.WeekHeader, Day: Day_1.Day },
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.dib.bgWhite.xs.$, ...tid, children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { components: { Caption: useYearPicker ? Header_1.YearSkipHeader : Header_1.Header, Head: WeekHeader_1.WeekHeader, Day: Day_1.Day },
|
|
16
16
|
// DatePicker only allows for a single date to be `selected` (per our props) though DayPicker expects an array of dates
|
|
17
17
|
selected: value ? [value] : [], defaultMonth: value !== null && value !== void 0 ? value : new Date(), onDayClick: (day, modifiers) => {
|
|
18
18
|
if (modifiers.disabled)
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
export interface CheckboxProps {
|
|
3
3
|
label: string;
|
|
4
|
+
/** If false this will be wrap in a div element instead of the label
|
|
5
|
+
* Expects implementer to wrap within a label element to work properly
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
withLabelElement?: boolean;
|
|
4
9
|
checkboxOnly?: boolean;
|
|
5
10
|
selected: boolean | "indeterminate";
|
|
6
11
|
/** Handler that is called when the element's selection state changes. */
|
|
@@ -19,6 +19,11 @@ export interface CheckboxBaseProps extends BeamFocusableProps {
|
|
|
19
19
|
checkboxOnly?: boolean;
|
|
20
20
|
errorMsg?: string;
|
|
21
21
|
helperText?: string | ReactNode;
|
|
22
|
+
/** If false this will be wrap in a div element instead of the label
|
|
23
|
+
* Expects implementer to wrap within a label element to work properly
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
withLabelElement?: boolean;
|
|
22
27
|
}
|
|
23
28
|
export declare function CheckboxBase(props: CheckboxBaseProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
24
29
|
interface StyledCheckboxProps {
|
|
@@ -10,12 +10,12 @@ const ErrorMessage_1 = require("./ErrorMessage");
|
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const defaultTestId_1 = require("../utils/defaultTestId");
|
|
12
12
|
function CheckboxBase(props) {
|
|
13
|
-
const { ariaProps, description, isDisabled = false, isIndeterminate = false,
|
|
13
|
+
const { ariaProps, description, isDisabled = false, isIndeterminate = false, inputProps, label, errorMsg, helperText, checkboxOnly = false, withLabelElement = true, } = props;
|
|
14
14
|
const ref = (0, react_1.useRef)(null);
|
|
15
15
|
const { isFocusVisible, focusProps } = (0, react_aria_1.useFocusRing)(ariaProps);
|
|
16
|
-
const { hoverProps, isHovered } = (0, react_aria_1.useHover)({ isDisabled });
|
|
17
16
|
const tid = (0, utils_1.useTestIds)(props, (0, defaultTestId_1.defaultTestId)(label));
|
|
18
|
-
|
|
17
|
+
const Tag = withLabelElement ? "label" : "div";
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(Tag, { css: Css_1.Css.df.cursorPointer.relative
|
|
19
19
|
// Prevents accidental checkbox clicks due to label width being longer
|
|
20
20
|
// than the content.
|
|
21
21
|
.w("max-content")
|
|
@@ -33,6 +33,8 @@ export interface DateFieldBaseProps extends Pick<TextFieldBaseProps<Properties>,
|
|
|
33
33
|
mode: DateFieldMode;
|
|
34
34
|
/** Range filters should only allow a full DateRange or nothing */
|
|
35
35
|
isRangeFilterField?: boolean;
|
|
36
|
+
/** Render header that skips years in addition to months */
|
|
37
|
+
useYearPicker?: boolean;
|
|
36
38
|
}
|
|
37
39
|
export interface DateSingleFieldBaseProps extends DateFieldBaseProps {
|
|
38
40
|
mode: "single";
|
|
@@ -18,7 +18,7 @@ function DateFieldBase(props) {
|
|
|
18
18
|
var _a;
|
|
19
19
|
const { label, disabled, required, value, onFocus, onBlur,
|
|
20
20
|
// Pull `onChange` out of the props, but we're not directly using it. Do not want to keep it in `...others`
|
|
21
|
-
onChange: _onChange, errorMsg, helperText, readOnly, format = "short", iconLeft = false, hideCalendarIcon = false, disabledDays, onEnter, defaultOpen, mode, isRangeFilterField = false, ...others } = props;
|
|
21
|
+
onChange: _onChange, errorMsg, helperText, readOnly, format = "short", iconLeft = false, hideCalendarIcon = false, disabledDays, onEnter, defaultOpen, mode, isRangeFilterField = false, useYearPicker = false, ...others } = props;
|
|
22
22
|
const isRangeMode = mode === "range";
|
|
23
23
|
const inputRef = (0, react_1.useRef)(null);
|
|
24
24
|
const inputWrapRef = (0, react_1.useRef)(null);
|
|
@@ -169,12 +169,12 @@ function DateFieldBase(props) {
|
|
|
169
169
|
// Note: Do not close date range picker on select to allow the user to select multiple dates at a time
|
|
170
170
|
setInputValue((_a = (0, utils_1.formatDateRange)(dr, utils_1.dateFormats.short)) !== null && _a !== void 0 ? _a : "");
|
|
171
171
|
onChange(dr);
|
|
172
|
-
}, useYearPicker: isRangeFilterField, ...tid.datePicker })) : ((0, jsx_runtime_1.jsx)(internal_1.DatePicker, { value: wipValue, disabledDays: disabledDays, onSelect: (d) => {
|
|
172
|
+
}, useYearPicker: isRangeFilterField || useYearPicker, ...tid.datePicker })) : ((0, jsx_runtime_1.jsx)(internal_1.DatePicker, { value: wipValue, disabledDays: disabledDays, onSelect: (d) => {
|
|
173
173
|
var _a;
|
|
174
174
|
state.close();
|
|
175
175
|
setInputValue((_a = (0, utils_1.formatDate)(d, utils_1.dateFormats.short)) !== null && _a !== void 0 ? _a : "");
|
|
176
176
|
onChange(d);
|
|
177
|
-
}, ...tid.datePicker })) }) }) }))] }));
|
|
177
|
+
}, useYearPicker: useYearPicker, ...tid.datePicker })) }) }) }))] }));
|
|
178
178
|
}
|
|
179
179
|
exports.DateFieldBase = DateFieldBase;
|
|
180
180
|
function isParsedDateValid(d) {
|