@algolia/satellite 1.0.0-beta.140 → 1.0.0-beta.141
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 +4 -2
- package/cjs/DatePicker/DatePicker.tailwind.js +81 -23
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.js +47 -30
- 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 +82 -39
- 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 +4 -2
- package/esm/DatePicker/DatePicker.tailwind.js +81 -23
- package/esm/DatePicker/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/esm/DatePicker/DateRangePicker/DateRangePicker.js +46 -29
- 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 -37
- 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
@@ -19,6 +19,12 @@ var basePlugin = plugin(function (_ref) {
|
|
19
19
|
/* Enable kerning and optional ligatures */
|
20
20
|
"text-rendering": "optimizeLegibility"
|
21
21
|
}
|
22
|
+
}); // Accent color
|
23
|
+
|
24
|
+
addBase({
|
25
|
+
":root": {
|
26
|
+
"accent-color": theme("colors.accent.600")
|
27
|
+
}
|
22
28
|
}); // Text selection
|
23
29
|
|
24
30
|
addBase({
|
@@ -26,8 +32,7 @@ var basePlugin = plugin(function (_ref) {
|
|
26
32
|
background: theme("colors.accent.600"),
|
27
33
|
color: theme("colors.white")
|
28
34
|
}
|
29
|
-
}); //
|
30
|
-
// Base styles for links
|
35
|
+
}); // Base styles for links
|
31
36
|
|
32
37
|
addBase({
|
33
38
|
a: {
|
@@ -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;
|
@@ -36,6 +36,7 @@ import { X } from "react-feather";
|
|
36
36
|
import { Popper } from "react-popper";
|
37
37
|
import Button from "../Button";
|
38
38
|
import Card from "../Card";
|
39
|
+
import { ClickAwayContainer } from "../ClickAwayContainer";
|
39
40
|
import { FieldStateContext } from "../Field/FieldStateContext";
|
40
41
|
import { SatelliteContext } from "../Satellite";
|
41
42
|
import ScrollIndicator from "../ScrollIndicator";
|
@@ -172,6 +173,8 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
172
173
|
|
173
174
|
_defineProperty(_assertThisInitialized(_this), "inputRef", null);
|
174
175
|
|
176
|
+
_defineProperty(_assertThisInitialized(_this), "menuWrapperRef", null);
|
177
|
+
|
175
178
|
_defineProperty(_assertThisInitialized(_this), "handleClearClick", function () {
|
176
179
|
return _this.setState({
|
177
180
|
inputValue: ""
|
@@ -508,47 +511,53 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
508
511
|
strategy: "fixed",
|
509
512
|
referenceElement: (_this$inputContainerR3 = _this.inputContainerRef) !== null && _this$inputContainerR3 !== void 0 ? _this$inputContainerR3 : undefined,
|
510
513
|
modifiers: MENU_POPPER_MODFIERS,
|
514
|
+
innerRef: function innerRef(wrapperEl) {
|
515
|
+
return _this.menuWrapperRef = wrapperEl;
|
516
|
+
},
|
511
517
|
children: function children(popper) {
|
512
|
-
return /*#__PURE__*/_jsx(
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
children:
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
518
|
+
return /*#__PURE__*/_jsx(ClickAwayContainer, {
|
519
|
+
element: _this.menuWrapperRef,
|
520
|
+
children: /*#__PURE__*/_jsx("div", {
|
521
|
+
className: cx(stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
|
522
|
+
style: _objectSpread(_objectSpread({}, popper.style), dropdownStyle),
|
523
|
+
"data-popper-placement": popper.placement,
|
524
|
+
ref: popper.ref,
|
525
|
+
children: /*#__PURE__*/_jsxs(Card, {
|
526
|
+
fullBleed: true,
|
527
|
+
elevation: "300",
|
528
|
+
children: [results.length === 0 ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, getMenuProps()), {}, {
|
529
|
+
className: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["min-h-10"]))),
|
530
|
+
children: emptyState
|
531
|
+
})) : /*#__PURE__*/_jsx(ScrollIndicator, {
|
532
|
+
className: menuSize === "large" ? stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["max-h-96"]))) : stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["max-h-64"]))),
|
533
|
+
children: /*#__PURE__*/_jsxs("ul", _objectSpread(_objectSpread({}, getMenuProps()), {}, {
|
534
|
+
children: [results.slice(0, showAllResults ? Number.MAX_SAFE_INTEGER : maxResults).map(function (result, index) {
|
535
|
+
return /*#__PURE__*/_jsx("li", _objectSpread(_objectSpread({}, getItemProps({
|
536
|
+
item: result,
|
537
|
+
disabled: result.disabled,
|
538
|
+
className: stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\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")
|
539
|
+
})), {}, {
|
540
|
+
children: /*#__PURE__*/_jsx(OptionItem, _objectSpread(_objectSpread({}, optionItemProps), {}, {
|
541
|
+
highlighted: index === highlightedIndex,
|
542
|
+
option: result,
|
543
|
+
optionItemPrefix: _this.locale.optionItemPrefix
|
544
|
+
}))
|
545
|
+
}), result.value);
|
546
|
+
}), extraResults > 0 && !showAllResults && /*#__PURE__*/_jsx("li", {
|
547
|
+
className: stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["p-2 text-right"]))),
|
548
|
+
children: /*#__PURE__*/_jsx(Button, {
|
549
|
+
variant: "subtle",
|
550
|
+
size: "small",
|
551
|
+
onMouseDown: _this.handleShowAllResults,
|
552
|
+
children: _this.locale.showMoreButton(extraResults)
|
553
|
+
})
|
554
|
+
})]
|
555
|
+
}))
|
556
|
+
}), menuFooter && /*#__PURE__*/_jsx("footer", {
|
557
|
+
className: stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["flex items-center justify-center min-h-12 p-4 bg-grey-100 border-t border-grey-200 text-grey-600"]))),
|
558
|
+
children: menuFooter
|
559
|
+
})]
|
560
|
+
})
|
552
561
|
})
|
553
562
|
});
|
554
563
|
}
|
package/esm/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;
|
@@ -68,6 +68,7 @@ export var Promote = function Promote(_ref) {
|
|
68
68
|
return /*#__PURE__*/_jsxs(Card, {
|
69
69
|
className: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["relative flex"]))),
|
70
70
|
fullBleed: true,
|
71
|
+
as: "section",
|
71
72
|
children: [illustration && /*#__PURE__*/_jsx("div", {
|
72
73
|
className: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["w-full min-w-24 max-w-64 flex items-center justify-center bg-grey-100"]))),
|
73
74
|
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/esm/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/esm/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/esm/Card/Card.js
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
1
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
4
|
+
var _excluded = ["className", "as", "elevation", "fullBleed"];
|
2
5
|
|
3
6
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
4
7
|
|
8
|
+
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; }
|
9
|
+
|
10
|
+
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) { _defineProperty(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; }
|
11
|
+
|
5
12
|
import cx from "clsx";
|
6
|
-
import { forwardRef } from "react";
|
13
|
+
import { createElement, forwardRef } from "react";
|
7
14
|
import stl from "../styles/helpers/satellitePrefixer";
|
8
15
|
import CardHeader from "./components/CardHeader";
|
9
16
|
import CardTitle from "./components/CardTitle";
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
11
17
|
var ELEVATION_CLASSNAMES = {
|
12
18
|
"100": stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["card-z100"]))),
|
13
19
|
"200": stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["card-z200"]))),
|
@@ -18,20 +24,18 @@ var ELEVATION_CLASSNAMES = {
|
|
18
24
|
|
19
25
|
/** The `Card` is a useful component for containing content within a page. */
|
20
26
|
export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
21
|
-
var
|
22
|
-
|
27
|
+
var className = _ref.className,
|
28
|
+
_ref$as = _ref.as,
|
29
|
+
as = _ref$as === void 0 ? "section" : _ref$as,
|
23
30
|
_ref$elevation = _ref.elevation,
|
24
31
|
elevation = _ref$elevation === void 0 ? "100" : _ref$elevation,
|
25
|
-
style = _ref.style,
|
26
32
|
fullBleed = _ref.fullBleed,
|
27
|
-
|
28
|
-
|
29
|
-
|
33
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
34
|
+
|
35
|
+
return /*#__PURE__*/createElement(as, _objectSpread(_objectSpread({}, props), {}, {
|
30
36
|
ref: ref,
|
31
|
-
className: cx(stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["card ", " display-body"])), fullBleed && "card-fullbleed"), ELEVATION_CLASSNAMES[elevation], className)
|
32
|
-
|
33
|
-
children: children
|
34
|
-
});
|
37
|
+
className: cx(stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["card ", " display-body"])), fullBleed && "card-fullbleed"), ELEVATION_CLASSNAMES[elevation], className)
|
38
|
+
}));
|
35
39
|
});
|
36
40
|
Card.displayName = "Card";
|
37
41
|
Card.Header = CardHeader;
|
@@ -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
|
/**
|
@@ -60,7 +60,7 @@ export var ClickAwayContainer = function ClickAwayContainer(_ref) {
|
|
60
60
|
});
|
61
61
|
|
62
62
|
if (!isEventInside) {
|
63
|
-
onClickAway(evt);
|
63
|
+
onClickAway === null || onClickAway === void 0 ? void 0 : onClickAway(evt);
|
64
64
|
}
|
65
65
|
}, [elementsSet, onClickAway]);
|
66
66
|
useClickAway(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;
|
@@ -99,7 +99,8 @@ var DatePicker = function DatePicker(props) {
|
|
99
99
|
} : {
|
100
100
|
editableYear: false
|
101
101
|
};
|
102
|
-
},
|
102
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
103
|
+
[props]);
|
103
104
|
return /*#__PURE__*/_jsxs("div", {
|
104
105
|
children: [/*#__PURE__*/_jsx("span", {
|
105
106
|
ref: setTargetElement,
|
@@ -132,9 +133,10 @@ var DatePicker = function DatePicker(props) {
|
|
132
133
|
className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex"]))),
|
133
134
|
children: [/*#__PURE__*/_jsxs("div", {
|
134
135
|
children: [/*#__PURE__*/_jsx(Calendar, _objectSpread(_objectSpread(_objectSpread({
|
136
|
+
mode: "single",
|
135
137
|
numberOfMonths: 1
|
136
138
|
}, (_props$calendarProps = props === null || props === void 0 ? void 0 : props.calendarProps) !== null && _props$calendarProps !== void 0 ? _props$calendarProps : {}), {}, {
|
137
|
-
|
139
|
+
selected: value !== null && value !== void 0 ? value : undefined,
|
138
140
|
onDayClick: handleDayClick
|
139
141
|
}, yearProps), {}, {
|
140
142
|
locale: locale
|
@@ -3,7 +3,7 @@ import _plugin from "tailwindcss/plugin";
|
|
3
3
|
// @ts-check
|
4
4
|
var plugin = _plugin;
|
5
5
|
var datePickerPlugin = plugin(function (_ref) {
|
6
|
-
var
|
6
|
+
var _rdpDay, _rdpDay2, _rdpDay4, _addComponents;
|
7
7
|
|
8
8
|
var addComponents = _ref.addComponents,
|
9
9
|
theme = _ref.theme,
|
@@ -24,12 +24,12 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
return modifiers.map(function (modifier) {
|
27
|
-
return ":not(.
|
27
|
+
return ":not(.rdp-day_".concat(modifier, ")");
|
28
28
|
}).join("");
|
29
29
|
};
|
30
30
|
|
31
31
|
addComponents((_addComponents = {
|
32
|
-
".
|
32
|
+
".rdp-year": {
|
33
33
|
// ChevronDown svg from react-feather,
|
34
34
|
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>\')',
|
35
35
|
backgroundRepeat: "no-repeat",
|
@@ -37,17 +37,69 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
37
37
|
backgroundPositionY: "5px",
|
38
38
|
paddingRight: "1rem"
|
39
39
|
},
|
40
|
-
".
|
41
|
-
|
40
|
+
".rdp-caption_end": {
|
41
|
+
marginLeft: "1em",
|
42
|
+
marginRight: "0"
|
43
|
+
},
|
44
|
+
".rdp-caption_start": {
|
45
|
+
marginLeft: "0",
|
46
|
+
marginRight: "1em"
|
42
47
|
}
|
43
48
|
}, _defineProperty(_addComponents, prefix(".date-picker, .date-range-picker"), {
|
44
|
-
"
|
45
|
-
|
46
|
-
|
49
|
+
".rdp[dir='rtl']": {
|
50
|
+
".rdp-months": {
|
51
|
+
".rdp-caption_start": {
|
52
|
+
"margin-left": "0",
|
53
|
+
marginLeft: "0",
|
54
|
+
marginRight: "1em"
|
55
|
+
},
|
56
|
+
".rdp-caption_end": {
|
57
|
+
marginLeft: "1em",
|
58
|
+
marginRight: "0"
|
59
|
+
}
|
60
|
+
},
|
61
|
+
".rdp-day": (_rdpDay = {}, _defineProperty(_rdpDay, "&_displayedRanges".concat(not("outside")), {
|
62
|
+
borderRadius: "0px",
|
63
|
+
backgroundColor: theme("colors.grey.200")
|
64
|
+
}), _defineProperty(_rdpDay, "&_displayedRangesStart".concat(not("outside")), {
|
65
|
+
color: theme("colors.white"),
|
66
|
+
backgroundColor: theme("colors.grey.600"),
|
67
|
+
borderTopRightRadius: defaultRadius,
|
68
|
+
borderBottomRightRadius: defaultRadius
|
69
|
+
}), _defineProperty(_rdpDay, "&_displayedRangesEnd".concat(not("outside")), {
|
70
|
+
color: theme("colors.white"),
|
71
|
+
backgroundColor: theme("colors.grey.600"),
|
72
|
+
borderTopLeftRadius: defaultRadius,
|
73
|
+
borderBottomLeftRadius: defaultRadius
|
74
|
+
}), _defineProperty(_rdpDay, "&_range_start".concat(not("outside")), {
|
75
|
+
color: theme("colors.white"),
|
76
|
+
borderRadius: "0px",
|
77
|
+
borderTopRightRadius: defaultRadius,
|
78
|
+
borderBottomRightRadius: defaultRadius,
|
79
|
+
backgroundColor: accent600,
|
80
|
+
"&:hover": {
|
81
|
+
backgroundColor: accent600
|
82
|
+
}
|
83
|
+
}), _defineProperty(_rdpDay, "&_range_end".concat(not("outside")), {
|
84
|
+
color: theme("colors.white"),
|
85
|
+
borderRadius: "0px",
|
86
|
+
borderTopLeftRadius: defaultRadius,
|
87
|
+
borderBottomLeftRadius: defaultRadius,
|
88
|
+
backgroundColor: accent600,
|
89
|
+
"&:hover": {
|
90
|
+
backgroundColor: accent600
|
91
|
+
}
|
92
|
+
}), _rdpDay)
|
93
|
+
},
|
94
|
+
"& .rdp-head_cell": {
|
95
|
+
textTransform: "capitalize",
|
96
|
+
fontWeight: "normal",
|
97
|
+
fontSize: "0.95em",
|
98
|
+
color: theme("colors.grey.500")
|
47
99
|
},
|
48
|
-
"& .
|
100
|
+
"& .rdp-day": (_rdpDay2 = {
|
49
101
|
borderRadius: defaultRadius
|
50
|
-
}, _defineProperty(
|
102
|
+
}, _defineProperty(_rdpDay2, "&_today".concat(not("outside")), {
|
51
103
|
color: theme("colors.grey.900"),
|
52
104
|
position: "relative",
|
53
105
|
"&:before": {
|
@@ -64,48 +116,54 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
64
116
|
transform: "translate(-50%, -50%)",
|
65
117
|
zIndex: "-1"
|
66
118
|
}
|
67
|
-
}), _defineProperty(
|
119
|
+
}), _defineProperty(_rdpDay2, "&_selected".concat(not("outside")), {
|
68
120
|
color: theme("colors.white")
|
69
|
-
}),
|
121
|
+
}), _rdpDay2)
|
70
122
|
}), _defineProperty(_addComponents, prefix(".date-picker"), _defineProperty({
|
71
|
-
".
|
123
|
+
".rdp-day": _defineProperty({
|
72
124
|
borderRadius: defaultRadius,
|
73
|
-
"
|
125
|
+
"&_today": {
|
74
126
|
color: accent600
|
75
127
|
}
|
76
|
-
}, "
|
128
|
+
}, "&_selected".concat(not("outside")), {
|
77
129
|
backgroundColor: accent600,
|
78
130
|
"&:hover": {
|
79
131
|
backgroundColor: accent600
|
132
|
+
},
|
133
|
+
"&:focus": {
|
134
|
+
border: "0px"
|
80
135
|
}
|
81
136
|
})
|
82
|
-
}, "
|
137
|
+
}, "&_selected".concat(not("outside")), {
|
83
138
|
backgroundColor: accent600,
|
84
139
|
"&:hover": {
|
85
140
|
backgroundColor: accent600
|
86
141
|
}
|
87
142
|
})), _defineProperty(_addComponents, prefix(".date-range-picker"), {
|
88
|
-
"& .
|
143
|
+
"& .rdp-day": (_rdpDay4 = {}, _defineProperty(_rdpDay4, "&_displayedRanges".concat(not("outside")), {
|
89
144
|
borderRadius: "0px",
|
90
145
|
backgroundColor: theme("colors.grey.200")
|
91
|
-
}), _defineProperty(
|
146
|
+
}), _defineProperty(_rdpDay4, "&_displayedRangesStart".concat(not("outside")), {
|
92
147
|
color: theme("colors.white"),
|
93
148
|
backgroundColor: theme("colors.grey.600"),
|
94
149
|
borderTopLeftRadius: defaultRadius,
|
95
150
|
borderBottomLeftRadius: defaultRadius
|
96
|
-
}), _defineProperty(
|
151
|
+
}), _defineProperty(_rdpDay4, "&_displayedRangesEnd".concat(not("outside")), {
|
97
152
|
color: theme("colors.white"),
|
98
153
|
backgroundColor: theme("colors.grey.600"),
|
99
154
|
borderTopRightRadius: defaultRadius,
|
100
155
|
borderBottomRightRadius: defaultRadius
|
101
|
-
}), _defineProperty(
|
156
|
+
}), _defineProperty(_rdpDay4, "&_selected".concat(not("outside")), {
|
102
157
|
color: theme("colors.black"),
|
103
158
|
borderRadius: "0px",
|
104
159
|
backgroundColor: accent200,
|
105
160
|
"&:hover": {
|
106
161
|
backgroundColor: accent200
|
162
|
+
},
|
163
|
+
"&:focus": {
|
164
|
+
border: "0px"
|
107
165
|
}
|
108
|
-
}), _defineProperty(
|
166
|
+
}), _defineProperty(_rdpDay4, "&_range_start".concat(not("outside")), {
|
109
167
|
color: theme("colors.white"),
|
110
168
|
borderRadius: "0px",
|
111
169
|
borderTopLeftRadius: defaultRadius,
|
@@ -114,7 +172,7 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
114
172
|
"&:hover": {
|
115
173
|
backgroundColor: accent600
|
116
174
|
}
|
117
|
-
}), _defineProperty(
|
175
|
+
}), _defineProperty(_rdpDay4, "&_range_end".concat(not("outside")), {
|
118
176
|
color: theme("colors.white"),
|
119
177
|
borderRadius: "0px",
|
120
178
|
borderTopRightRadius: defaultRadius,
|
@@ -123,7 +181,7 @@ var datePickerPlugin = plugin(function (_ref) {
|
|
123
181
|
"&:hover": {
|
124
182
|
backgroundColor: accent600
|
125
183
|
}
|
126
|
-
}),
|
184
|
+
}), _rdpDay4)
|
127
185
|
}), _addComponents), {
|
128
186
|
respectPrefix: false
|
129
187
|
});
|
@@ -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;
|