@algolia/satellite 1.0.0-beta.140 → 1.0.0-beta.142
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/cjs/AutoComplete/AutoComplete.d.ts +1 -0
- package/cjs/AutoComplete/AutoComplete.js +49 -40
- package/cjs/Badge/Badge.d.ts +2 -2
- package/cjs/Banners/Alert/Alert.d.ts +2 -2
- package/cjs/Banners/Promote/Promote.js +1 -0
- package/cjs/Button/ButtonGroup.d.ts +4 -0
- package/cjs/Button/types.d.ts +2 -2
- package/cjs/Card/Card.d.ts +6 -0
- package/cjs/Card/Card.js +16 -11
- package/cjs/Checkbox/Checkbox.d.ts +2 -2
- package/cjs/ClickAwayContainer/ClickAwayContainer.d.ts +1 -1
- package/cjs/ClickAwayContainer/ClickAwayContainer.js +1 -1
- package/cjs/DatePicker/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/DatePicker/DatePicker/DatePicker.js +6 -3
- package/cjs/DatePicker/DatePicker.tailwind.js +81 -23
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.js +50 -31
- package/cjs/DatePicker/DateRangePicker/dateRangePickerReducer.d.ts +2 -2
- package/cjs/DatePicker/components/Calendar.d.ts +3 -3
- package/cjs/DatePicker/components/Calendar.js +31 -48
- package/cjs/DatePicker/components/NavBar.d.ts +3 -9
- package/cjs/DatePicker/components/NavBar.js +81 -40
- package/cjs/DatePicker/index.d.ts +0 -1
- package/cjs/DatePicker/index.js +2 -9
- package/cjs/DatePicker/types.d.ts +13 -0
- package/cjs/DatePicker/utils.d.ts +7 -0
- package/cjs/DatePicker/utils.js +29 -1
- package/cjs/Dropdown/components/DropdownButtonItem.d.ts +1 -1
- package/cjs/Dropdown/components/DropdownButtonItem.js +1 -1
- package/cjs/Input/Input.js +1 -1
- package/cjs/Link/Link.js +2 -2
- package/cjs/Modal/Modal.js +2 -0
- package/cjs/Tooltip/TooltipWrapper.js +4 -4
- package/cjs/styles/base.tailwind.js +7 -2
- package/esm/AutoComplete/AutoComplete.d.ts +1 -0
- package/esm/AutoComplete/AutoComplete.js +49 -40
- package/esm/Badge/Badge.d.ts +2 -2
- package/esm/Banners/Alert/Alert.d.ts +2 -2
- package/esm/Banners/Promote/Promote.js +1 -0
- package/esm/Button/ButtonGroup.d.ts +4 -0
- package/esm/Button/types.d.ts +2 -2
- package/esm/Card/Card.d.ts +6 -0
- package/esm/Card/Card.js +16 -12
- package/esm/Checkbox/Checkbox.d.ts +2 -2
- package/esm/ClickAwayContainer/ClickAwayContainer.d.ts +1 -1
- package/esm/ClickAwayContainer/ClickAwayContainer.js +1 -1
- package/esm/DatePicker/DatePicker/DatePicker.d.ts +1 -1
- package/esm/DatePicker/DatePicker/DatePicker.js +6 -3
- package/esm/DatePicker/DatePicker.tailwind.js +81 -23
- package/esm/DatePicker/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/esm/DatePicker/DateRangePicker/DateRangePicker.js +48 -31
- package/esm/DatePicker/DateRangePicker/dateRangePickerReducer.d.ts +2 -2
- package/esm/DatePicker/components/Calendar.d.ts +3 -3
- package/esm/DatePicker/components/Calendar.js +31 -47
- package/esm/DatePicker/components/NavBar.d.ts +3 -9
- package/esm/DatePicker/components/NavBar.js +78 -39
- package/esm/DatePicker/index.d.ts +0 -1
- package/esm/DatePicker/index.js +1 -2
- package/esm/DatePicker/types.d.ts +13 -0
- package/esm/DatePicker/utils.d.ts +7 -0
- package/esm/DatePicker/utils.js +20 -1
- package/esm/Dropdown/components/DropdownButtonItem.d.ts +1 -1
- package/esm/Dropdown/components/DropdownButtonItem.js +1 -1
- package/esm/Input/Input.js +1 -1
- package/esm/Link/Link.js +2 -2
- package/esm/Modal/Modal.js +2 -0
- package/esm/Tooltip/TooltipWrapper.js +4 -4
- package/esm/styles/base.tailwind.js +7 -2
- package/package.json +3 -3
- package/satellite.min.css +2 -2
@@ -45,6 +45,7 @@ export declare class AutoComplete<T extends Option = Option> extends Component<A
|
|
45
45
|
state: State;
|
46
46
|
inputContainerRef: HTMLDivElement | null;
|
47
47
|
inputRef: HTMLInputElement | null;
|
48
|
+
menuWrapperRef: HTMLDivElement | null;
|
48
49
|
componentDidUpdate(prevProps: AutoCompleteProps<T>): void;
|
49
50
|
handleClearClick: () => void;
|
50
51
|
handleFakeInputClick: () => void | null;
|
@@ -45,6 +45,8 @@ var _Button = _interopRequireDefault(require("../Button"));
|
|
45
45
|
|
46
46
|
var _Card = _interopRequireDefault(require("../Card"));
|
47
47
|
|
48
|
+
var _ClickAwayContainer = require("../ClickAwayContainer");
|
49
|
+
|
48
50
|
var _FieldStateContext = require("../Field/FieldStateContext");
|
49
51
|
|
50
52
|
var _Satellite = require("../Satellite");
|
@@ -202,6 +204,7 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
202
204
|
});
|
203
205
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "inputContainerRef", null);
|
204
206
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "inputRef", null);
|
207
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "menuWrapperRef", null);
|
205
208
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleClearClick", function () {
|
206
209
|
return _this.setState({
|
207
210
|
inputValue: ""
|
@@ -524,47 +527,53 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
524
527
|
strategy: "fixed",
|
525
528
|
referenceElement: (_this$inputContainerR3 = _this.inputContainerRef) !== null && _this$inputContainerR3 !== void 0 ? _this$inputContainerR3 : undefined,
|
526
529
|
modifiers: MENU_POPPER_MODFIERS,
|
530
|
+
innerRef: function innerRef(wrapperEl) {
|
531
|
+
return _this.menuWrapperRef = wrapperEl;
|
532
|
+
},
|
527
533
|
children: function children(popper) {
|
528
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
children:
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
534
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickAwayContainer.ClickAwayContainer, {
|
535
|
+
element: _this.menuWrapperRef,
|
536
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
537
|
+
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["z-dropdown"]))), menuClassName),
|
538
|
+
style: _objectSpread(_objectSpread({}, popper.style), dropdownStyle),
|
539
|
+
"data-popper-placement": popper.placement,
|
540
|
+
ref: popper.ref,
|
541
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Card["default"], {
|
542
|
+
fullBleed: true,
|
543
|
+
elevation: "300",
|
544
|
+
children: [results.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, getMenuProps()), {}, {
|
545
|
+
className: (0, _satellitePrefixer["default"])(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["min-h-10"]))),
|
546
|
+
children: emptyState
|
547
|
+
})) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScrollIndicator["default"], {
|
548
|
+
className: menuSize === "large" ? (0, _satellitePrefixer["default"])(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["max-h-96"]))) : (0, _satellitePrefixer["default"])(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["max-h-64"]))),
|
549
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", _objectSpread(_objectSpread({}, getMenuProps()), {}, {
|
550
|
+
children: [results.slice(0, showAllResults ? Number.MAX_SAFE_INTEGER : maxResults).map(function (result, index) {
|
551
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", _objectSpread(_objectSpread({}, getItemProps({
|
552
|
+
item: result,
|
553
|
+
disabled: result.disabled,
|
554
|
+
className: (0, _satellitePrefixer["default"])(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n autocomplete-result\n flex items-center min-h-10 px-4 cursor-pointer\n ", "\n ", "\n "])), index === highlightedIndex && "bg-grey-100", result.disabled && "cursor-not-allowed")
|
555
|
+
})), {}, {
|
556
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(OptionItem, _objectSpread(_objectSpread({}, optionItemProps), {}, {
|
557
|
+
highlighted: index === highlightedIndex,
|
558
|
+
option: result,
|
559
|
+
optionItemPrefix: _this.locale.optionItemPrefix
|
560
|
+
}))
|
561
|
+
}), result.value);
|
562
|
+
}), extraResults > 0 && !showAllResults && /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
563
|
+
className: (0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["p-2 text-right"]))),
|
564
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
565
|
+
variant: "subtle",
|
566
|
+
size: "small",
|
567
|
+
onMouseDown: _this.handleShowAllResults,
|
568
|
+
children: _this.locale.showMoreButton(extraResults)
|
569
|
+
})
|
570
|
+
})]
|
571
|
+
}))
|
572
|
+
}), menuFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)("footer", {
|
573
|
+
className: (0, _satellitePrefixer["default"])(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["flex items-center justify-center min-h-12 p-4 bg-grey-100 border-t border-grey-200 text-grey-600"]))),
|
574
|
+
children: menuFooter
|
575
|
+
})]
|
576
|
+
})
|
568
577
|
})
|
569
578
|
});
|
570
579
|
}
|
package/cjs/Badge/Badge.d.ts
CHANGED
@@ -3,9 +3,9 @@ import type { AtLeastOne, ColorVariant, IconComponentType } from "../types";
|
|
3
3
|
export declare type BadgeSizes = "default" | "small";
|
4
4
|
export declare type BadgeVariants = ColorVariant | "pink";
|
5
5
|
interface BaseBadgeProps extends HTMLAttributes<HTMLDivElement> {
|
6
|
-
/** @default grey */
|
6
|
+
/** @default "grey" */
|
7
7
|
variant?: BadgeVariants;
|
8
|
-
/** @default default */
|
8
|
+
/** @default "default" */
|
9
9
|
size?: BadgeSizes;
|
10
10
|
}
|
11
11
|
declare type BadgeContentProps = {
|
@@ -9,11 +9,11 @@ export interface AlertProps {
|
|
9
9
|
style?: CSSProperties;
|
10
10
|
/** Descriptive title for `Alert` */
|
11
11
|
title?: ReactNode;
|
12
|
-
/** @default grey */
|
12
|
+
/** @default "grey" */
|
13
13
|
variant?: AlertColorVariant;
|
14
14
|
/**
|
15
15
|
* Usage context description
|
16
|
-
* @default section
|
16
|
+
* @default "section"
|
17
17
|
*/
|
18
18
|
usageContext?: AlertContextType;
|
19
19
|
icon?: IconComponentType;
|
@@ -82,6 +82,7 @@ var Promote = function Promote(_ref) {
|
|
82
82
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Card["default"], {
|
83
83
|
className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["relative flex"]))),
|
84
84
|
fullBleed: true,
|
85
|
+
as: "section",
|
85
86
|
children: [illustration && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
86
87
|
className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["w-full min-w-24 max-w-64 flex items-center justify-center bg-grey-100"]))),
|
87
88
|
children: illustration
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import type { FunctionComponent, ReactNode } from "react";
|
2
2
|
export interface ButtonGroupProps {
|
3
3
|
className?: string;
|
4
|
+
/**
|
5
|
+
* Specify HTML element `ButtonGroup` should be presented as.
|
6
|
+
* @default "div"
|
7
|
+
*/
|
4
8
|
as?: keyof JSX.IntrinsicElements;
|
5
9
|
children: ReactNode;
|
6
10
|
}
|
package/cjs/Button/types.d.ts
CHANGED
@@ -8,9 +8,9 @@ export declare type MinimalButtonProps = {
|
|
8
8
|
export declare type AcceptableButtonType = "a" | "button" | ComponentType<MinimalButtonProps>;
|
9
9
|
export declare type ExtractProps<T> = T extends "a" | "button" ? JSX.IntrinsicElements[T] : T extends ComponentType<infer P> ? P : never;
|
10
10
|
export interface ButtonBaseProps {
|
11
|
-
/** @default neutral */
|
11
|
+
/** @default "neutral" */
|
12
12
|
variant?: ButtonVariant;
|
13
|
-
/** @default medium */
|
13
|
+
/** @default "medium" */
|
14
14
|
size?: ButtonSize;
|
15
15
|
/** Left aligned icon */
|
16
16
|
startIcon?: IconComponentType;
|
package/cjs/Card/Card.d.ts
CHANGED
@@ -2,12 +2,18 @@ import type { CSSProperties, ForwardRefExoticComponent, PropsWithoutRef, ReactNo
|
|
2
2
|
import CardHeader from "./components/CardHeader";
|
3
3
|
import CardTitle from "./components/CardTitle";
|
4
4
|
export declare type CardElevation = "100" | "200" | "300" | "400" | "500";
|
5
|
+
declare type CardAs = "section" | "aside" | "main" | "div" | "span";
|
5
6
|
export interface CardProps {
|
6
7
|
id?: string;
|
7
8
|
/** @ignore */
|
8
9
|
className?: string;
|
9
10
|
/** @ignore */
|
10
11
|
style?: CSSProperties;
|
12
|
+
/**
|
13
|
+
* Specify HTML element `Card` should be presented as.
|
14
|
+
* @default "div"
|
15
|
+
*/
|
16
|
+
as?: CardAs;
|
11
17
|
/** Should the content take up full full width of the `Card`. */
|
12
18
|
fullBleed?: boolean;
|
13
19
|
children: ReactNode;
|
package/cjs/Card/Card.js
CHANGED
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports["default"] = exports.Card = void 0;
|
9
9
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
+
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13
|
+
|
10
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
11
15
|
|
12
16
|
var _clsx = _interopRequireDefault(require("clsx"));
|
@@ -19,10 +23,14 @@ var _CardHeader = _interopRequireDefault(require("./components/CardHeader"));
|
|
19
23
|
|
20
24
|
var _CardTitle = _interopRequireDefault(require("./components/CardTitle"));
|
21
25
|
|
22
|
-
var
|
26
|
+
var _excluded = ["className", "as", "elevation", "fullBleed"];
|
23
27
|
|
24
28
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
25
29
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
31
|
+
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
33
|
+
|
26
34
|
var ELEVATION_CLASSNAMES = {
|
27
35
|
"100": (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["card-z100"]))),
|
28
36
|
"200": (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["card-z200"]))),
|
@@ -33,20 +41,17 @@ var ELEVATION_CLASSNAMES = {
|
|
33
41
|
|
34
42
|
/** The `Card` is a useful component for containing content within a page. */
|
35
43
|
var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
36
|
-
var
|
37
|
-
|
44
|
+
var className = _ref.className,
|
45
|
+
_ref$as = _ref.as,
|
46
|
+
as = _ref$as === void 0 ? "section" : _ref$as,
|
38
47
|
_ref$elevation = _ref.elevation,
|
39
48
|
elevation = _ref$elevation === void 0 ? "100" : _ref$elevation,
|
40
|
-
style = _ref.style,
|
41
49
|
fullBleed = _ref.fullBleed,
|
42
|
-
|
43
|
-
return /*#__PURE__*/(0,
|
44
|
-
id: id,
|
50
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
51
|
+
return /*#__PURE__*/(0, _react.createElement)(as, _objectSpread(_objectSpread({}, props), {}, {
|
45
52
|
ref: ref,
|
46
|
-
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["card ", " display-body"])), fullBleed && "card-fullbleed"), ELEVATION_CLASSNAMES[elevation], className)
|
47
|
-
|
48
|
-
children: children
|
49
|
-
});
|
53
|
+
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["card ", " display-body"])), fullBleed && "card-fullbleed"), ELEVATION_CLASSNAMES[elevation], className)
|
54
|
+
}));
|
50
55
|
});
|
51
56
|
exports.Card = Card;
|
52
57
|
Card.displayName = "Card";
|
@@ -2,13 +2,13 @@ import type { HTMLAttributes, InputHTMLAttributes } from "react";
|
|
2
2
|
declare type CheckboxCustomProps = {
|
3
3
|
/**
|
4
4
|
* `Checkbox` text position
|
5
|
-
* @default right
|
5
|
+
* @default "right"
|
6
6
|
*/
|
7
7
|
textPosition?: "left" | "right";
|
8
8
|
indeterminate?: boolean;
|
9
9
|
/**
|
10
10
|
* Color of the `Checkbox`
|
11
|
-
* @default accent.600
|
11
|
+
* @default "accent.600"
|
12
12
|
*/
|
13
13
|
checkedColor?: string;
|
14
14
|
};
|
@@ -13,7 +13,7 @@ export interface ClickAwayContainerProps {
|
|
13
13
|
/** Will be called if a click away event (mousedown, touchstart, focusin)
|
14
14
|
* happens outside of the subtree tracked by this component instance
|
15
15
|
* */
|
16
|
-
onClickAway(evt: Event): void;
|
16
|
+
onClickAway?(evt: Event): void;
|
17
17
|
children?: ReactNode;
|
18
18
|
}
|
19
19
|
/**
|
@@ -78,7 +78,7 @@ var ClickAwayContainer = function ClickAwayContainer(_ref) {
|
|
78
78
|
});
|
79
79
|
|
80
80
|
if (!isEventInside) {
|
81
|
-
onClickAway(evt);
|
81
|
+
onClickAway === null || onClickAway === void 0 ? void 0 : onClickAway(evt);
|
82
82
|
}
|
83
83
|
}, [elementsSet, onClickAway]);
|
84
84
|
(0, _useClickAway["default"])(fakeElementRef, handleClickAway, AWAY_EVENTS);
|
@@ -17,7 +17,7 @@ interface RenderTargetParams {
|
|
17
17
|
isOpen: boolean;
|
18
18
|
}
|
19
19
|
export declare type DatePickerProps = {
|
20
|
-
calendarProps?: Pick<CalendarProps, "fromMonth" | "toMonth" | "
|
20
|
+
calendarProps?: Pick<CalendarProps, "fromMonth" | "toMonth" | "disabled">;
|
21
21
|
onOpen?: DisplayProps["onClick"];
|
22
22
|
onChange?: (value: Date | null) => void;
|
23
23
|
onSubmit?: (event: MouseEvent<HTMLButtonElement>, value: Date | null) => void;
|
@@ -119,7 +119,8 @@ var DatePicker = function DatePicker(props) {
|
|
119
119
|
} : {
|
120
120
|
editableYear: false
|
121
121
|
};
|
122
|
-
},
|
122
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
123
|
+
[props]);
|
123
124
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
124
125
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
125
126
|
ref: setTargetElement,
|
@@ -152,9 +153,11 @@ var DatePicker = function DatePicker(props) {
|
|
152
153
|
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["flex"]))),
|
153
154
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
154
155
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Calendar["default"], _objectSpread(_objectSpread(_objectSpread({
|
155
|
-
|
156
|
+
mode: "single",
|
157
|
+
numberOfMonths: 1,
|
158
|
+
defaultMonth: value !== null && value !== void 0 ? value : undefined
|
156
159
|
}, (_props$calendarProps = props === null || props === void 0 ? void 0 : props.calendarProps) !== null && _props$calendarProps !== void 0 ? _props$calendarProps : {}), {}, {
|
157
|
-
|
160
|
+
selected: value !== null && value !== void 0 ? value : undefined,
|
158
161
|
onDayClick: handleDayClick
|
159
162
|
}, yearProps), {}, {
|
160
163
|
locale: locale
|
@@ -8,7 +8,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
8
8
|
var plugin = require("tailwindcss/plugin");
|
9
9
|
|
10
10
|
var datePickerPlugin = plugin(function (_ref) {
|
11
|
-
var
|
11
|
+
var _rdpDay, _rdpDay2, _rdpDay4, _addComponents;
|
12
12
|
|
13
13
|
var addComponents = _ref.addComponents,
|
14
14
|
theme = _ref.theme,
|
@@ -29,12 +29,12 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
return modifiers.map(function (modifier) {
|
32
|
-
return ":not(.
|
32
|
+
return ":not(.rdp-day_".concat(modifier, ")");
|
33
33
|
}).join("");
|
34
34
|
};
|
35
35
|
|
36
36
|
addComponents((_addComponents = {
|
37
|
-
".
|
37
|
+
".rdp-year": {
|
38
38
|
// ChevronDown svg from react-feather,
|
39
39
|
backgroundImage: 'url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>\')',
|
40
40
|
backgroundRepeat: "no-repeat",
|
@@ -42,17 +42,69 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
42
42
|
backgroundPositionY: "5px",
|
43
43
|
paddingRight: "1rem"
|
44
44
|
},
|
45
|
-
".
|
46
|
-
|
45
|
+
".rdp-caption_end": {
|
46
|
+
marginLeft: "1em",
|
47
|
+
marginRight: "0"
|
48
|
+
},
|
49
|
+
".rdp-caption_start": {
|
50
|
+
marginLeft: "0",
|
51
|
+
marginRight: "1em"
|
47
52
|
}
|
48
53
|
}, (0, _defineProperty2["default"])(_addComponents, prefix(".date-picker, .date-range-picker"), {
|
49
|
-
"
|
50
|
-
|
51
|
-
|
54
|
+
".rdp[dir='rtl']": {
|
55
|
+
".rdp-months": {
|
56
|
+
".rdp-caption_start": {
|
57
|
+
"margin-left": "0",
|
58
|
+
marginLeft: "0",
|
59
|
+
marginRight: "1em"
|
60
|
+
},
|
61
|
+
".rdp-caption_end": {
|
62
|
+
marginLeft: "1em",
|
63
|
+
marginRight: "0"
|
64
|
+
}
|
65
|
+
},
|
66
|
+
".rdp-day": (_rdpDay = {}, (0, _defineProperty2["default"])(_rdpDay, "&_displayedRanges".concat(not("outside")), {
|
67
|
+
borderRadius: "0px",
|
68
|
+
backgroundColor: theme("colors.grey.200")
|
69
|
+
}), (0, _defineProperty2["default"])(_rdpDay, "&_displayedRangesStart".concat(not("outside")), {
|
70
|
+
color: theme("colors.white"),
|
71
|
+
backgroundColor: theme("colors.grey.600"),
|
72
|
+
borderTopRightRadius: defaultRadius,
|
73
|
+
borderBottomRightRadius: defaultRadius
|
74
|
+
}), (0, _defineProperty2["default"])(_rdpDay, "&_displayedRangesEnd".concat(not("outside")), {
|
75
|
+
color: theme("colors.white"),
|
76
|
+
backgroundColor: theme("colors.grey.600"),
|
77
|
+
borderTopLeftRadius: defaultRadius,
|
78
|
+
borderBottomLeftRadius: defaultRadius
|
79
|
+
}), (0, _defineProperty2["default"])(_rdpDay, "&_range_start".concat(not("outside")), {
|
80
|
+
color: theme("colors.white"),
|
81
|
+
borderRadius: "0px",
|
82
|
+
borderTopRightRadius: defaultRadius,
|
83
|
+
borderBottomRightRadius: defaultRadius,
|
84
|
+
backgroundColor: accent600,
|
85
|
+
"&:hover": {
|
86
|
+
backgroundColor: accent600
|
87
|
+
}
|
88
|
+
}), (0, _defineProperty2["default"])(_rdpDay, "&_range_end".concat(not("outside")), {
|
89
|
+
color: theme("colors.white"),
|
90
|
+
borderRadius: "0px",
|
91
|
+
borderTopLeftRadius: defaultRadius,
|
92
|
+
borderBottomLeftRadius: defaultRadius,
|
93
|
+
backgroundColor: accent600,
|
94
|
+
"&:hover": {
|
95
|
+
backgroundColor: accent600
|
96
|
+
}
|
97
|
+
}), _rdpDay)
|
98
|
+
},
|
99
|
+
"& .rdp-head_cell": {
|
100
|
+
textTransform: "capitalize",
|
101
|
+
fontWeight: "normal",
|
102
|
+
fontSize: "0.95em",
|
103
|
+
color: theme("colors.grey.500")
|
52
104
|
},
|
53
|
-
"& .
|
105
|
+
"& .rdp-day": (_rdpDay2 = {
|
54
106
|
borderRadius: defaultRadius
|
55
|
-
}, (0, _defineProperty2["default"])(
|
107
|
+
}, (0, _defineProperty2["default"])(_rdpDay2, "&_today".concat(not("outside")), {
|
56
108
|
color: theme("colors.grey.900"),
|
57
109
|
position: "relative",
|
58
110
|
"&:before": {
|
@@ -69,48 +121,54 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
69
121
|
transform: "translate(-50%, -50%)",
|
70
122
|
zIndex: "-1"
|
71
123
|
}
|
72
|
-
}), (0, _defineProperty2["default"])(
|
124
|
+
}), (0, _defineProperty2["default"])(_rdpDay2, "&_selected".concat(not("outside")), {
|
73
125
|
color: theme("colors.white")
|
74
|
-
}),
|
126
|
+
}), _rdpDay2)
|
75
127
|
}), (0, _defineProperty2["default"])(_addComponents, prefix(".date-picker"), (0, _defineProperty2["default"])({
|
76
|
-
".
|
128
|
+
".rdp-day": (0, _defineProperty2["default"])({
|
77
129
|
borderRadius: defaultRadius,
|
78
|
-
"
|
130
|
+
"&_today": {
|
79
131
|
color: accent600
|
80
132
|
}
|
81
|
-
}, "
|
133
|
+
}, "&_selected".concat(not("outside")), {
|
82
134
|
backgroundColor: accent600,
|
83
135
|
"&:hover": {
|
84
136
|
backgroundColor: accent600
|
137
|
+
},
|
138
|
+
"&:focus": {
|
139
|
+
border: "0px"
|
85
140
|
}
|
86
141
|
})
|
87
|
-
}, "
|
142
|
+
}, "&_selected".concat(not("outside")), {
|
88
143
|
backgroundColor: accent600,
|
89
144
|
"&:hover": {
|
90
145
|
backgroundColor: accent600
|
91
146
|
}
|
92
147
|
})), (0, _defineProperty2["default"])(_addComponents, prefix(".date-range-picker"), {
|
93
|
-
"& .
|
148
|
+
"& .rdp-day": (_rdpDay4 = {}, (0, _defineProperty2["default"])(_rdpDay4, "&_displayedRanges".concat(not("outside")), {
|
94
149
|
borderRadius: "0px",
|
95
150
|
backgroundColor: theme("colors.grey.200")
|
96
|
-
}), (0, _defineProperty2["default"])(
|
151
|
+
}), (0, _defineProperty2["default"])(_rdpDay4, "&_displayedRangesStart".concat(not("outside")), {
|
97
152
|
color: theme("colors.white"),
|
98
153
|
backgroundColor: theme("colors.grey.600"),
|
99
154
|
borderTopLeftRadius: defaultRadius,
|
100
155
|
borderBottomLeftRadius: defaultRadius
|
101
|
-
}), (0, _defineProperty2["default"])(
|
156
|
+
}), (0, _defineProperty2["default"])(_rdpDay4, "&_displayedRangesEnd".concat(not("outside")), {
|
102
157
|
color: theme("colors.white"),
|
103
158
|
backgroundColor: theme("colors.grey.600"),
|
104
159
|
borderTopRightRadius: defaultRadius,
|
105
160
|
borderBottomRightRadius: defaultRadius
|
106
|
-
}), (0, _defineProperty2["default"])(
|
161
|
+
}), (0, _defineProperty2["default"])(_rdpDay4, "&_selected".concat(not("outside")), {
|
107
162
|
color: theme("colors.black"),
|
108
163
|
borderRadius: "0px",
|
109
164
|
backgroundColor: accent200,
|
110
165
|
"&:hover": {
|
111
166
|
backgroundColor: accent200
|
167
|
+
},
|
168
|
+
"&:focus": {
|
169
|
+
border: "0px"
|
112
170
|
}
|
113
|
-
}), (0, _defineProperty2["default"])(
|
171
|
+
}), (0, _defineProperty2["default"])(_rdpDay4, "&_range_start".concat(not("outside")), {
|
114
172
|
color: theme("colors.white"),
|
115
173
|
borderRadius: "0px",
|
116
174
|
borderTopLeftRadius: defaultRadius,
|
@@ -119,7 +177,7 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
119
177
|
"&:hover": {
|
120
178
|
backgroundColor: accent600
|
121
179
|
}
|
122
|
-
}), (0, _defineProperty2["default"])(
|
180
|
+
}), (0, _defineProperty2["default"])(_rdpDay4, "&_range_end".concat(not("outside")), {
|
123
181
|
color: theme("colors.white"),
|
124
182
|
borderRadius: "0px",
|
125
183
|
borderTopRightRadius: defaultRadius,
|
@@ -128,7 +186,7 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
128
186
|
"&:hover": {
|
129
187
|
backgroundColor: accent600
|
130
188
|
}
|
131
|
-
}),
|
189
|
+
}), _rdpDay4)
|
132
190
|
}), _addComponents), {
|
133
191
|
respectPrefix: false
|
134
192
|
});
|
@@ -20,7 +20,7 @@ export declare type DateRangePickerProps = {
|
|
20
20
|
id?: string;
|
21
21
|
range: DateRangePickerTimeRange | null;
|
22
22
|
displayOnlyRanges?: DateRangePickerTimeRange[];
|
23
|
-
calendarProps?: Pick<CalendarProps, "fromMonth" | "toMonth" | "
|
23
|
+
calendarProps?: Pick<CalendarProps, "fromMonth" | "toMonth" | "disabled" | "numberOfMonths">;
|
24
24
|
stateReducer?: (state: DateRangePickerReducerState, action: DateRangePickerReducerAction, defaultReducer: typeof dateRangePickerReducer) => DateRangePickerReducerState;
|
25
25
|
initialState?: Partial<DateRangePickerReducerState>;
|
26
26
|
onAction?: (action: DateRangePickerReducerAction, state: DateRangePickerReducerState) => void;
|
@@ -30,5 +30,5 @@ export declare type DateRangePickerProps = {
|
|
30
30
|
renderRightPanel?: (args: RightSidePanelComponentArgs) => ReactNode;
|
31
31
|
buttonSize?: DateRangePickerDisplayProps["buttonSize"];
|
32
32
|
} & SharedDatePickerProps;
|
33
|
-
declare const DateRangePicker: FunctionComponent<DateRangePickerProps>;
|
33
|
+
export declare const DateRangePicker: FunctionComponent<DateRangePickerProps>;
|
34
34
|
export default DateRangePicker;
|