@synerise/ds-date-range-picker 2.2.0 → 2.3.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/CHANGELOG.md +22 -0
- package/dist/AddonCollapse/AddonCollapse.styles.js +1 -1
- package/dist/DateRangePicker.js +1 -4
- package/dist/DateRangePicker.styles.js +3 -3
- package/dist/Footer/Footer.styles.js +2 -2
- package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.js +1 -2
- package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.styles.js +2 -2
- package/dist/RangeFilter/Filters/new/Daily/Daily.js +1 -2
- package/dist/RangeFilter/RangeFilter.styles.js +2 -2
- package/dist/RangeFilter/Shared/FilterDropdown/FilterDropdown.js +1 -2
- package/dist/RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.js +1 -2
- package/dist/RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.styles.js +2 -2
- package/dist/RangeFilter/Shared/SelectionHint/SelectionHint.d.ts +3 -8
- package/dist/RangeFilter/Shared/SelectionHint/SelectionHint.js +5 -8
- package/dist/RangeFilter/Shared/TimeWindow/Day/Day.js +1 -2
- package/dist/RangeFilter/Shared/TimeWindow/Day/Day.styles.js +2 -2
- package/dist/RangeFilter/Shared/TimeWindow/RangeActions/RangeActions.js +2 -5
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.js +2 -2
- package/dist/RangeFilter/Shared/TimeWindow/RangeSummary/RangeSummary.styles.js +2 -2
- package/dist/RangeFilter/Shared/TimeWindow/TimeWindow.styles.js +1 -1
- package/dist/RangePicker/RangePicker.styles.js +2 -2
- package/dist/RangePickerInput/RangePickerInput.js +7 -8
- package/dist/RangePickerInput/RangePickerInput.styles.d.ts +4 -4
- package/dist/RangePickerInput/RangePickerInput.styles.js +10 -10
- package/dist/RelativeRangePicker/Elements/ModeDropdown/ModeDropdown.js +1 -2
- package/dist/RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.js +1 -2
- package/dist/RelativeRangePicker/RelativeRangePicker.styles.js +2 -2
- package/dist/RelativeRangePicker/utils/findMatchingPreset.utils.d.ts +2 -2
- package/dist/dateUtils/relativeToAbsolute.d.ts +5 -1
- package/dist/dateUtils/relativeToAbsolute.js +4 -34
- package/package.json +22 -22
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.3.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@2.3.0...@synerise/ds-date-range-picker@2.3.1) (2026-11-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **date-range-picker:** resolve forceAbsolute ranges like the panel ([b0f63d3](https://github.com/Synerise/synerise-design/commit/b0f63d3fcaf8a76183b817c5eebf05e2e55fefa5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.3.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@2.2.0...@synerise/ds-date-range-picker@2.3.0) (2026-10-29)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* integrate Token Studio design tokens across the design system ([aabb447](https://github.com/Synerise/synerise-design/commit/aabb447edfb2d0c85e3de1f07e809ef84083453b))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [2.2.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@2.1.8...@synerise/ds-date-range-picker@2.2.0) (2026-10-28)
|
|
7
29
|
|
|
8
30
|
|
|
@@ -6,7 +6,7 @@ const AddonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
|
6
6
|
const Title = /* @__PURE__ */ styled.h3.withConfig({
|
|
7
7
|
displayName: "AddonCollapsestyles__Title",
|
|
8
8
|
componentId: "sc-7edaw-1"
|
|
9
|
-
})(["font-size:16px;line-height:1.39;color:
|
|
9
|
+
})(["font-size:16px;line-height:1.39;color:var(--ds-color-text-base-default);"]);
|
|
10
10
|
const AddonHeader = /* @__PURE__ */ styled.div.withConfig({
|
|
11
11
|
displayName: "AddonCollapsestyles__AddonHeader",
|
|
12
12
|
componentId: "sc-7edaw-2"
|
package/dist/DateRangePicker.js
CHANGED
|
@@ -35,7 +35,6 @@ const DateRangePicker = forwardRef((props, forwardedRef) => {
|
|
|
35
35
|
const selectedRange = value || defaultValue;
|
|
36
36
|
const [popupVisible, setPopupVisible] = useState(false);
|
|
37
37
|
const [selectedDate, setSelectedDate] = useState(selectedRange);
|
|
38
|
-
const [inputActive, setInputActive] = useState(false);
|
|
39
38
|
const floatingPlacement = getPlacement(placement);
|
|
40
39
|
const allTexts = useMemo(() => getDefaultTexts(intl, disableDefaultTexts, texts), [texts, disableDefaultTexts, intl]);
|
|
41
40
|
useEffect(() => {
|
|
@@ -48,7 +47,6 @@ const DateRangePicker = forwardRef((props, forwardedRef) => {
|
|
|
48
47
|
onApply && onApply(finalDateRange);
|
|
49
48
|
setSelectedDate(finalDateRange);
|
|
50
49
|
setPopupVisible(false);
|
|
51
|
-
setInputActive(false);
|
|
52
50
|
}, [defaultValue, onApply]);
|
|
53
51
|
const conditionalVisibilityProps = {
|
|
54
52
|
...popupVisible !== void 0 && {
|
|
@@ -61,7 +59,7 @@ const DateRangePicker = forwardRef((props, forwardedRef) => {
|
|
|
61
59
|
}, [popupVisible, onVisibleChange]);
|
|
62
60
|
const triggerElement = popoverTrigger || renderPopoverTrigger({
|
|
63
61
|
setPopupVisible
|
|
64
|
-
}) || /* @__PURE__ */ jsx(RangePickerInput, { onClick: readOnly ? void 0 : togglePopup, value: selectedDate, showTime, texts: allTexts, valueFormatOptions, onChange: onApplyCallback, active:
|
|
62
|
+
}) || /* @__PURE__ */ jsx(RangePickerInput, { onClick: readOnly ? void 0 : togglePopup, value: selectedDate, showTime, texts: allTexts, valueFormatOptions, onChange: onApplyCallback, active: popupVisible, timeZone: resolvedTimeZone, ...rangePickerInputProps, readOnly, disabled });
|
|
65
63
|
const hasCustomTrigger = Boolean(popoverTrigger || renderPopoverTrigger);
|
|
66
64
|
const handleTriggerClick = hasCustomTrigger ? () => {
|
|
67
65
|
if (hasCustomTrigger) {
|
|
@@ -73,7 +71,6 @@ const DateRangePicker = forwardRef((props, forwardedRef) => {
|
|
|
73
71
|
}
|
|
74
72
|
return /* @__PURE__ */ jsxs(Popover, { getPopupContainer: getPopupContainer || (() => document.body), trigger: "click", onOpenChange: (openState) => {
|
|
75
73
|
setPopupVisible(openState);
|
|
76
|
-
setInputActive(openState);
|
|
77
74
|
onVisibleChange && onVisibleChange(openState);
|
|
78
75
|
}, placement: floatingPlacement, testId: "date-range-picker", componentId: "date-range-picker", returnFocus: false, offsetConfig: POPOVER_OFFSET_CONFIG, flipConfig: POPOVER_FLIP_CONFIG, shiftConfig: POPOVER_SHIFT_CONFIG, autoUpdate: true, stickyPlacement: true, ...conditionalVisibilityProps, ...popoverProps, children: [
|
|
79
76
|
/* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsx(DateRangePickerOverlay, { className: "ds-date-range-popover", "data-testid": "ds-date-range-picker-overlay", children: /* @__PURE__ */ jsx(RawDateRangePicker, { ...props, showTime, onApply: onApplyCallback, value: selectedDate, texts: allTexts, forceAdjacentMonths }) }) }),
|
|
@@ -7,7 +7,7 @@ const DateRangePickerWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
|
7
7
|
const DateRangePickerOverlay = /* @__PURE__ */ styled.div.withConfig({
|
|
8
8
|
displayName: "DateRangePickerstyles__DateRangePickerOverlay",
|
|
9
9
|
componentId: "sc-zmtbjf-1"
|
|
10
|
-
})(["background:
|
|
10
|
+
})(["background:var(--ds-dropdown-bg);box-shadow:var(--ds-dropdown-shadow);border-radius:3px;overflow:hidden;overflow-y:auto;max-width:700px;max-height:100vh;font-weight:unset;"]);
|
|
11
11
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
12
12
|
displayName: "DateRangePickerstyles__Container",
|
|
13
13
|
componentId: "sc-zmtbjf-2"
|
|
@@ -15,11 +15,11 @@ const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
|
15
15
|
const Separator = /* @__PURE__ */ styled.div.withConfig({
|
|
16
16
|
displayName: "DateRangePickerstyles__Separator",
|
|
17
17
|
componentId: "sc-zmtbjf-3"
|
|
18
|
-
})(["margin:0;border-top:1px solid
|
|
18
|
+
})(["margin:0;border-top:1px solid var(--ds-color-border-base-default);"]);
|
|
19
19
|
const Addon = /* @__PURE__ */ styled.div.withConfig({
|
|
20
20
|
displayName: "DateRangePickerstyles__Addon",
|
|
21
21
|
componentId: "sc-zmtbjf-4"
|
|
22
|
-
})(["", ""], (props) => !props.last && `border-bottom: 1px solid
|
|
22
|
+
})(["", ""], (props) => !props.last && `border-bottom: 1px solid var(--ds-color-border-base-default);`);
|
|
23
23
|
const PickerWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
24
24
|
displayName: "DateRangePickerstyles__PickerWrapper",
|
|
25
25
|
componentId: "sc-zmtbjf-5"
|
|
@@ -3,7 +3,7 @@ import Button from "@synerise/ds-button";
|
|
|
3
3
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
4
4
|
displayName: "Footerstyles__Container",
|
|
5
5
|
componentId: "sc-1oatjb7-0"
|
|
6
|
-
})(["display:flex;align-items:center;padding:24px 24px;background:
|
|
6
|
+
})(["display:flex;align-items:center;padding:24px 24px;background:var(--ds-dropdown-footer-bg);"]);
|
|
7
7
|
const Actions = /* @__PURE__ */ styled.div.withConfig({
|
|
8
8
|
displayName: "Footerstyles__Actions",
|
|
9
9
|
componentId: "sc-1oatjb7-1"
|
|
@@ -19,7 +19,7 @@ const ActionsPlaceholder = /* @__PURE__ */ styled.div.withConfig({
|
|
|
19
19
|
const ChosenRange = /* @__PURE__ */ styled.div.withConfig({
|
|
20
20
|
displayName: "Footerstyles__ChosenRange",
|
|
21
21
|
componentId: "sc-1oatjb7-4"
|
|
22
|
-
})(["font-weight:500;line-height:24px;color:
|
|
22
|
+
})(["font-weight:500;line-height:24px;color:var(--ds-dropdown-text-default);.ds-icon svg{margin-top:-2px;fill:var(--ds-color-icon-base-disabled);}"]);
|
|
23
23
|
const InvisibleTextContent = /* @__PURE__ */ styled.span.withConfig({
|
|
24
24
|
displayName: "Footerstyles__InvisibleTextContent",
|
|
25
25
|
componentId: "sc-1oatjb7-5"
|
|
@@ -2,7 +2,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { PureComponent } from "react";
|
|
3
3
|
import { FormattedMessage, injectIntl } from "react-intl";
|
|
4
4
|
import Button from "@synerise/ds-button";
|
|
5
|
-
import { theme } from "@synerise/ds-core";
|
|
6
5
|
import { ContentItem } from "@synerise/ds-manageable-list";
|
|
7
6
|
import Tag, { TagShape } from "@synerise/ds-tag";
|
|
8
7
|
import { generateUuid } from "@synerise/ds-utils";
|
|
@@ -277,7 +276,7 @@ const _MonthlyFilter = class _MonthlyFilter extends PureComponent {
|
|
|
277
276
|
const deletableDueToEntriesLimit = (key) => min === void 0 || min !== void 0 && key >= min;
|
|
278
277
|
return /* @__PURE__ */ jsxs(MonthlyFilterWrapper, { className: "monthly-wrapper", children: [
|
|
279
278
|
data.map((item, key) => /* @__PURE__ */ jsx(ContentItem, { hideExpander: false, onExpand: this.handleCollapse, expanded: visible[item.id], onRemove: () => this.handleRemoveRow(key), item: {
|
|
280
|
-
tag: /* @__PURE__ */ jsx(Tag, { name: String(key + 1), shape: TagShape.SINGLE_CHARACTER_ROUND, color:
|
|
279
|
+
tag: /* @__PURE__ */ jsx(Tag, { name: String(key + 1), shape: TagShape.SINGLE_CHARACTER_ROUND, color: "var(--ds-color-background-base-muted)", textColor: "var(--ds-color-text-neutral-default)" }),
|
|
281
280
|
canDelete: !disabled && deletableDueToEntriesLimit(key),
|
|
282
281
|
id: item.id,
|
|
283
282
|
// @ts-expect-error
|
|
@@ -23,7 +23,7 @@ const DropdownHeader = /* @__PURE__ */ styled.div.withConfig({
|
|
|
23
23
|
const DropdownDeleteBtn = /* @__PURE__ */ styled.div.withConfig({
|
|
24
24
|
displayName: "MonthlyFilterstyles__DropdownDeleteBtn",
|
|
25
25
|
componentId: "sc-5ul7nk-5"
|
|
26
|
-
})(["&&{&:hover .icon{color:
|
|
26
|
+
})(["&&{&:hover .icon{color:var(--ds-color-icon-danger-default);}}"]);
|
|
27
27
|
const AddContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
28
28
|
displayName: "MonthlyFilterstyles__AddContainer",
|
|
29
29
|
componentId: "sc-5ul7nk-6"
|
|
@@ -39,7 +39,7 @@ const Select = /* @__PURE__ */ styled(InlineSelect).withConfig({
|
|
|
39
39
|
const PeriodMode = /* @__PURE__ */ styled.span.withConfig({
|
|
40
40
|
displayName: "MonthlyFilterstyles__PeriodMode",
|
|
41
41
|
componentId: "sc-5ul7nk-9"
|
|
42
|
-
})(["color:
|
|
42
|
+
})(["color:var(--ds-color-text-brand-default);"]);
|
|
43
43
|
export {
|
|
44
44
|
AddButton,
|
|
45
45
|
AddContainer,
|
|
@@ -6,7 +6,6 @@ import { getDefaultTexts } from "../../../../utils.js";
|
|
|
6
6
|
import { NewFilterContainer } from "../../../RangeFilter.styles.js";
|
|
7
7
|
import AddButton from "../../../Shared/AddButton/AddButton.js";
|
|
8
8
|
import "@synerise/ds-button";
|
|
9
|
-
import "@synerise/ds-core";
|
|
10
9
|
import "@synerise/ds-dropdown";
|
|
11
10
|
import "@synerise/ds-icon";
|
|
12
11
|
import "@synerise/ds-tooltip";
|
|
@@ -17,7 +16,7 @@ import "@synerise/ds-button/dist/Button.styles";
|
|
|
17
16
|
import "@synerise/ds-manageable-list";
|
|
18
17
|
import "@synerise/ds-input";
|
|
19
18
|
import "../../../Shared/SelectionCount/SelectionCount.js";
|
|
20
|
-
import "
|
|
19
|
+
import "lodash.range";
|
|
21
20
|
import "../../../Shared/TimeWindow/TimeWindow.js";
|
|
22
21
|
import RangeFormContainer from "../../../Shared/TimeWindow/RangeFormContainer/RangeFormContainer.js";
|
|
23
22
|
import { DEFAULT_RANGE_END, DEFAULT_RANGE_START, DEFAULT_TIME_FORMAT, NOOP, RENDER_EMPTY_NODE_FN, EMPTY_OBJECT, DEFAULT_MAX_ENTRIES } from "../constants.js";
|
|
@@ -26,11 +26,11 @@ const FooterSeparator = /* @__PURE__ */ styled.div.withConfig({
|
|
|
26
26
|
const Footer = /* @__PURE__ */ styled.div.withConfig({
|
|
27
27
|
displayName: "RangeFilterstyles__Footer",
|
|
28
28
|
componentId: "sc-1tcjwxp-6"
|
|
29
|
-
})(["display:flex;align-items:center;justify-content:flex-end;padding:24px;background-color:
|
|
29
|
+
})(["display:flex;align-items:center;justify-content:flex-end;padding:24px;background-color:var(--ds-dropdown-footer-bg);> *:not(:last-child){margin-right:16px;}"]);
|
|
30
30
|
const Title = /* @__PURE__ */ styled.div.withConfig({
|
|
31
31
|
displayName: "RangeFilterstyles__Title",
|
|
32
32
|
componentId: "sc-1tcjwxp-7"
|
|
33
|
-
})(["font-size:16px;line-height:1.39;font-weight:500;color:
|
|
33
|
+
})(["font-size:16px;line-height:1.39;font-weight:500;color:var(--ds-dropdown-text-default);"]);
|
|
34
34
|
const WeeklyFilterContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
35
35
|
displayName: "RangeFilterstyles__WeeklyFilterContainer",
|
|
36
36
|
componentId: "sc-1tcjwxp-8"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import Button from "@synerise/ds-button";
|
|
4
|
-
import { theme } from "@synerise/ds-core";
|
|
5
4
|
import Dropdown from "@synerise/ds-dropdown";
|
|
6
5
|
import Icon, { TrashS, AngleDownS } from "@synerise/ds-icon";
|
|
7
6
|
import Tooltip from "@synerise/ds-tooltip";
|
|
@@ -17,7 +16,7 @@ const FilterDropdown = ({
|
|
|
17
16
|
onFilterSelect && onFilterSelect(filter);
|
|
18
17
|
}, suffixel: /* @__PURE__ */ jsx(Tooltip, { title: removeTooltip, children: /* @__PURE__ */ jsx(RemoveIconWrapper, { onClick: () => {
|
|
19
18
|
onFilterRemove && onFilterRemove(filter?.id);
|
|
20
|
-
}, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(TrashS, {}), color:
|
|
19
|
+
}, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(TrashS, {}), color: "var(--ds-color-icon-danger-default)" }) }) }) }, filter?.name)) }), [filters, onFilterRemove, onFilterSelect, removeTooltip]);
|
|
21
20
|
return /* @__PURE__ */ jsx(Dropdown, { overlay, trigger: ["click"], align: {
|
|
22
21
|
points: ["tr", "br"]
|
|
23
22
|
}, getPopupContainer: (node) => node.parentElement !== null ? node.parentElement : document.body, popoverProps: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useIntl } from "react-intl";
|
|
3
3
|
import Badge from "@synerise/ds-badge";
|
|
4
|
-
import { theme } from "@synerise/ds-core";
|
|
5
4
|
import Icon, { FilterM, CloseS } from "@synerise/ds-icon";
|
|
6
5
|
import Tooltip from "@synerise/ds-tooltip";
|
|
7
6
|
import { Container, Title, CreatorButton, ContentItem, BadgeWrapper, SuffixText } from "./RangeFilterStatus.styles.js";
|
|
@@ -24,7 +23,7 @@ const RangeFilterStatus = ({
|
|
|
24
23
|
/* @__PURE__ */ jsx(Tooltip, { title: texts.remove, children: /* @__PURE__ */ jsx(Icon, { onClick: (event) => {
|
|
25
24
|
event.stopPropagation();
|
|
26
25
|
onFilterRemove && onFilterRemove();
|
|
27
|
-
}, component: /* @__PURE__ */ jsx(CloseS, {}), color:
|
|
26
|
+
}, component: /* @__PURE__ */ jsx(CloseS, {}), color: "var(--ds-color-icon-danger-default)" }) })
|
|
28
27
|
] }), item: {
|
|
29
28
|
id: "filter-trigger",
|
|
30
29
|
// @ts-expect-error requires DRP types refactor
|
|
@@ -13,11 +13,11 @@ const BadgeWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
|
13
13
|
const Title = /* @__PURE__ */ styled.h3.withConfig({
|
|
14
14
|
displayName: "RangeFilterStatusstyles__Title",
|
|
15
15
|
componentId: "sc-1ei851t-2"
|
|
16
|
-
})(["font-size:16px;line-height:1.39;color:
|
|
16
|
+
})(["font-size:16px;line-height:1.39;color:var(--ds-color-text-base-default);margin-bottom:1em;"]);
|
|
17
17
|
const SuffixText = /* @__PURE__ */ styled.span.withConfig({
|
|
18
18
|
displayName: "RangeFilterStatusstyles__SuffixText",
|
|
19
19
|
componentId: "sc-1ei851t-3"
|
|
20
|
-
})(["color:
|
|
20
|
+
})(["color:var(--ds-color-text-brand-default);font-weight:500;margin-right:16px;"]);
|
|
21
21
|
const CreatorButton = /* @__PURE__ */ styled(Creator).withConfig({
|
|
22
22
|
displayName: "RangeFilterStatusstyles__CreatorButton",
|
|
23
23
|
componentId: "sc-1ei851t-4"
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { ThemeProps } from '@synerise/ds-core';
|
|
3
2
|
export type SelectionHintProps = {
|
|
4
3
|
message: React.ReactNode | string;
|
|
5
|
-
}
|
|
6
|
-
declare const
|
|
7
|
-
|
|
8
|
-
} & {
|
|
9
|
-
theme?: any;
|
|
10
|
-
}>;
|
|
11
|
-
export default _default;
|
|
4
|
+
};
|
|
5
|
+
declare const SelectionHint: ({ message }: SelectionHintProps) => JSX.Element;
|
|
6
|
+
export default SelectionHint;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { withTheme } from "styled-components";
|
|
3
2
|
import Icon, { InfoM } from "@synerise/ds-icon";
|
|
4
|
-
import { SelectionHint as SelectionHint$
|
|
3
|
+
import { SelectionHint as SelectionHint$1 } from "../TimeWindow/TimeWindow.styles.js";
|
|
5
4
|
const SelectionHint = ({
|
|
6
|
-
message
|
|
7
|
-
theme
|
|
5
|
+
message
|
|
8
6
|
}) => {
|
|
9
|
-
return /* @__PURE__ */ jsxs(SelectionHint$
|
|
10
|
-
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoM, {}), color:
|
|
7
|
+
return /* @__PURE__ */ jsxs(SelectionHint$1, { children: [
|
|
8
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoM, {}), color: "var(--ds-color-icon-base-default)" }),
|
|
11
9
|
" ",
|
|
12
10
|
message
|
|
13
11
|
] });
|
|
14
12
|
};
|
|
15
|
-
const SelectionHint$1 = withTheme(SelectionHint);
|
|
16
13
|
export {
|
|
17
|
-
SelectionHint
|
|
14
|
+
SelectionHint as default
|
|
18
15
|
};
|
|
@@ -3,7 +3,6 @@ import dayjs from "dayjs";
|
|
|
3
3
|
import customParseFormatPlugin from "dayjs/plugin/customParseFormat.js";
|
|
4
4
|
import { memo, useState, useMemo, useCallback } from "react";
|
|
5
5
|
import Button from "@synerise/ds-button";
|
|
6
|
-
import { theme } from "@synerise/ds-core";
|
|
7
6
|
import Icon, { Close3S, CheckS } from "@synerise/ds-icon";
|
|
8
7
|
import Tooltip from "@synerise/ds-tooltip";
|
|
9
8
|
import { Container, Content, IconWrapper } from "./Day.styles.js";
|
|
@@ -32,7 +31,7 @@ const Day = ({
|
|
|
32
31
|
onToggle && onToggle(dayKey, true);
|
|
33
32
|
}, [onToggle, dayKey]);
|
|
34
33
|
const icon = useMemo(() => {
|
|
35
|
-
return hovered && !readOnly ? /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Close3S, {}), onClick: handleIconClick, color:
|
|
34
|
+
return hovered && !readOnly ? /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Close3S, {}), onClick: handleIconClick, color: "var(--ds-color-icon-danger-default)" }) : /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CheckS, {}), color: "var(--ds-color-icon-success-default)" });
|
|
36
35
|
}, [hovered, handleIconClick, readOnly]);
|
|
37
36
|
const getPopupContainer = useCallback((node) => node.parentElement ? node.parentElement : document.body, []);
|
|
38
37
|
const labelForTooltip = typeof label === "function" ? label(false) : label;
|
|
@@ -6,7 +6,7 @@ const DayTooltip = /* @__PURE__ */ styled.div.withConfig({
|
|
|
6
6
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
7
7
|
displayName: "Daystyles__Container",
|
|
8
8
|
componentId: "sc-1214nkf-1"
|
|
9
|
-
})(["position:relative;&:hover{", "{height:24px;position:absolute;top:-30px;margin-left:calc(-50%);display:block;white-space:nowrap;background-color:
|
|
9
|
+
})(["position:relative;&:hover{", "{height:24px;position:absolute;top:-30px;margin-left:calc(-50%);display:block;white-space:nowrap;background-color:var(--ds-color-background-overlay-solid);padding:3px 8px;border-radius:3px;z-index:9;font-weight:400;color:var(--ds-color-text-base-onsolid);}}"], DayTooltip);
|
|
10
10
|
const Content = /* @__PURE__ */ styled.div.withConfig({
|
|
11
11
|
displayName: "Daystyles__Content",
|
|
12
12
|
componentId: "sc-1214nkf-2"
|
|
@@ -14,7 +14,7 @@ const Content = /* @__PURE__ */ styled.div.withConfig({
|
|
|
14
14
|
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
15
15
|
displayName: "Daystyles__IconWrapper",
|
|
16
16
|
componentId: "sc-1214nkf-3"
|
|
17
|
-
})(["position:absolute;top:3px;right:3px;pointer-events:", ";&&& .ds-icon svg{fill:", " !important;}"], (props) => props.readonly ? "none" : "all", (props) => props.active && !props.readonly ?
|
|
17
|
+
})(["position:absolute;top:3px;right:3px;pointer-events:", ";&&& .ds-icon svg{fill:", " !important;}"], (props) => props.readonly ? "none" : "all", (props) => props.active && !props.readonly ? "var(--ds-color-icon-danger-default)" : "var(--ds-color-icon-success-default)");
|
|
18
18
|
export {
|
|
19
19
|
Container,
|
|
20
20
|
Content,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import Button from "@synerise/ds-button";
|
|
4
|
-
import { theme } from "@synerise/ds-core";
|
|
5
4
|
import Dropdown from "@synerise/ds-dropdown";
|
|
6
5
|
import Icon, { DuplicateM, ArrowDownCircleM, CloseM, OptionHorizontalM } from "@synerise/ds-icon";
|
|
7
6
|
import { ActionsMenu, ActionItem } from "./RangeActions.styles.js";
|
|
@@ -19,15 +18,13 @@ const RangeActions = ({
|
|
|
19
18
|
/* @__PURE__ */ jsx(ActionItem, { onClick: () => {
|
|
20
19
|
onRangePaste && onRangePaste();
|
|
21
20
|
}, prefixel: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(ArrowDownCircleM, {}) }), children: texts.pasteRange }),
|
|
22
|
-
/* @__PURE__ */ jsx(ActionItem, { onClick: onRangeClear, prefixel: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseM, {}), color:
|
|
21
|
+
/* @__PURE__ */ jsx(ActionItem, { onClick: onRangeClear, prefixel: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseM, {}), color: "var(--ds-color-icon-danger-default)" }) }), children: texts.clearRange })
|
|
23
22
|
] });
|
|
24
23
|
}, [texts, onRangePaste, onRangeCopy, onRangeClear]);
|
|
25
24
|
const trigger = React.useMemo(() => {
|
|
26
25
|
return /* @__PURE__ */ jsx(Button, { mode: "single-icon", type: "ghost", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(OptionHorizontalM, {}) }) });
|
|
27
26
|
}, []);
|
|
28
|
-
return /* @__PURE__ */ jsx(Dropdown, { overlay,
|
|
29
|
-
boxShadow: "0 4px 12px 0 rgba(35, 41, 54, 0.07)"
|
|
30
|
-
}, trigger: ["click"], align: {
|
|
27
|
+
return /* @__PURE__ */ jsx(Dropdown, { overlay, trigger: ["click"], align: {
|
|
31
28
|
points: ["tr", "br"]
|
|
32
29
|
}, getPopupContainer: (node) => node.parentElement !== null ? node.parentElement : document.body, asChild: true, popoverProps: {
|
|
33
30
|
testId: "date-range-picker-filter-actions"
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
|
-
import { useDataFormat
|
|
5
|
+
import { useDataFormat } from "@synerise/ds-core";
|
|
6
6
|
import Icon, { CloseS } from "@synerise/ds-icon";
|
|
7
7
|
import Select from "@synerise/ds-select";
|
|
8
8
|
import Slider from "@synerise/ds-slider";
|
|
@@ -122,7 +122,7 @@ const RangeForm = ({
|
|
|
122
122
|
return /* @__PURE__ */ jsx(Container, { "data-testid": "range-filter-form", children: /* @__PURE__ */ jsxs(Row, { justifyContent: "flex-start", mode: rangeDisplayMode, children: [
|
|
123
123
|
rangeDisplayMode !== RANGE_DISPLAY_MODES.SLIDER && limitModeSelect(),
|
|
124
124
|
mode === FORM_MODES.HOUR ? singleHourPicker() : renderRangeUI(),
|
|
125
|
-
!!onRangeDelete && !disabled && /* @__PURE__ */ jsx(RemoveIconWrapper, { onClick: onRangeDelete, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseS, {}), color:
|
|
125
|
+
!!onRangeDelete && !disabled && /* @__PURE__ */ jsx(RemoveIconWrapper, { onClick: onRangeDelete, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseS, {}), color: "var(--ds-color-icon-danger-default)" }) })
|
|
126
126
|
] }) });
|
|
127
127
|
};
|
|
128
128
|
export {
|
|
@@ -2,11 +2,11 @@ import styled from "styled-components";
|
|
|
2
2
|
const DayShortname = /* @__PURE__ */ styled.span.withConfig({
|
|
3
3
|
displayName: "RangeSummarystyles__DayShortname",
|
|
4
4
|
componentId: "sc-9rwr7-0"
|
|
5
|
-
})(["font-weight:500;color:
|
|
5
|
+
})(["font-weight:500;color:var(--ds-color-text-base-default);"]);
|
|
6
6
|
const TitleWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
7
7
|
displayName: "RangeSummarystyles__TitleWrapper",
|
|
8
8
|
componentId: "sc-9rwr7-1"
|
|
9
|
-
})(["color:
|
|
9
|
+
})(["color:var(--ds-color-text-base-subtle);display:flex;flex-wrap:wrap;"]);
|
|
10
10
|
export {
|
|
11
11
|
DayShortname,
|
|
12
12
|
TitleWrapper
|
|
@@ -23,7 +23,7 @@ const HeaderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
|
23
23
|
const SelectionHint = /* @__PURE__ */ styled.div.withConfig({
|
|
24
24
|
displayName: "TimeWindowstyles__SelectionHint",
|
|
25
25
|
componentId: "sc-1mddrq2-5"
|
|
26
|
-
})(["margin-top:4px;background:
|
|
26
|
+
})(["margin-top:4px;background:var(--ds-dropdown-footer-bg);padding:16px 24px;display:flex;justify-content:flex-start;align-items:center;.ds-icon{margin-right:12px;}"]);
|
|
27
27
|
const GridContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
28
28
|
displayName: "TimeWindowstyles__GridContainer",
|
|
29
29
|
componentId: "sc-1mddrq2-6"
|
|
@@ -7,10 +7,10 @@ const Sides = /* @__PURE__ */ styled.div.withConfig({
|
|
|
7
7
|
const Side = /* @__PURE__ */ styled.div.withConfig({
|
|
8
8
|
displayName: "RangePickerstyles__Side",
|
|
9
9
|
componentId: "sc-15wk36w-1"
|
|
10
|
-
})(["padding:16px 12px 0 12px;display:grid;grid-template-rows:48px 290px;align-items:stretch;justify-content:stretch;width:318px;", " > *:not(:last-child){border-bottom:1px solid
|
|
10
|
+
})(["padding:16px 12px 0 12px;display:grid;grid-template-rows:48px 290px;align-items:stretch;justify-content:stretch;width:318px;", " > *:not(:last-child){border-bottom:1px solid var(--ds-color-border-base-default);}&& .ds-time-picker{padding:16px 16px 0px 16px;}"], (props) => props.mode === "time" && `.long-prev,
|
|
11
11
|
.long-next {
|
|
12
12
|
display: none;
|
|
13
|
-
}
|
|
13
|
+
}`);
|
|
14
14
|
const PickerFooter = /* @__PURE__ */ styled.div.withConfig({
|
|
15
15
|
displayName: "RangePickerstyles__PickerFooter",
|
|
16
16
|
componentId: "sc-15wk36w-2"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useDataFormat, getDefaultDataTimeOptions } from "@synerise/ds-core";
|
|
4
4
|
import FormField from "@synerise/ds-form-field";
|
|
5
5
|
import Icon, { ArrowRightS, Close3S, CalendarM } from "@synerise/ds-icon";
|
|
6
6
|
import Tooltip from "@synerise/ds-tooltip";
|
|
@@ -34,7 +34,6 @@ const RangePickerInput = ({
|
|
|
34
34
|
preferRelativeDesc = false,
|
|
35
35
|
timeZone
|
|
36
36
|
}) => {
|
|
37
|
-
const theme = useTheme();
|
|
38
37
|
const {
|
|
39
38
|
formatValue
|
|
40
39
|
} = useDataFormat();
|
|
@@ -62,10 +61,10 @@ const RangePickerInput = ({
|
|
|
62
61
|
}, [dateRangeValue, getText, active, disabled, texts, highlight]);
|
|
63
62
|
const renderEndDate = useCallback(() => {
|
|
64
63
|
const isEndDateDefined = dateRangeValue && dateRangeValue.to;
|
|
65
|
-
const isFromDateDefined = dateRangeValue
|
|
64
|
+
const isFromDateDefined = dateRangeValue?.from;
|
|
66
65
|
const text = dateRangeValue && isDateLimit(dateRangeValue.to) ? /* @__PURE__ */ jsx(DateValue, { children: getText(dateRangeValue.to) }) : texts?.endDatePlaceholder;
|
|
67
|
-
return /* @__PURE__ */ jsx(DateWrapper, { highlight: active && !!isFromDateDefined && !isEndDateDefined && highlight, children: text });
|
|
68
|
-
}, [dateRangeValue, getText, active, texts, highlight]);
|
|
66
|
+
return /* @__PURE__ */ jsx(DateWrapper, { highlight: active && !disabled && !!isFromDateDefined && !isEndDateDefined && highlight, children: text });
|
|
67
|
+
}, [dateRangeValue, getText, active, disabled, texts, highlight]);
|
|
69
68
|
const placeholder = useMemo(() => {
|
|
70
69
|
if (isLifetime(value)) {
|
|
71
70
|
return /* @__PURE__ */ jsx(Fragment, { children: texts?.allTime || "Lifetime" });
|
|
@@ -73,15 +72,15 @@ const RangePickerInput = ({
|
|
|
73
72
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
73
|
preferRelativeDesc && dateRangeValue?.translationKey && `${texts?.[dateRangeValue.translationKey] || dateRangeValue?.translationKey} (`,
|
|
75
74
|
renderFromDate(),
|
|
76
|
-
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(ArrowRightS, {}), color:
|
|
75
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(ArrowRightS, {}), color: "var(--ds-color-icon-base-disabled)" }),
|
|
77
76
|
renderEndDate(),
|
|
78
77
|
preferRelativeDesc && dateRangeValue?.translationKey && value && ")"
|
|
79
78
|
] });
|
|
80
|
-
}, [value, preferRelativeDesc, dateRangeValue?.translationKey, texts, renderFromDate,
|
|
79
|
+
}, [value, preferRelativeDesc, dateRangeValue?.translationKey, texts, renderFromDate, renderEndDate]);
|
|
81
80
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(FormField, { errorText, label, tooltip, tooltipConfig, description, children: /* @__PURE__ */ jsx(Container, { tabIndex: 0, onFocus, onClick: !disabled ? onClick : void 0, onBlur, "data-testid": "date-range-picker-input-wrapper", onMouseEnter: handleIconMouseEnter, onMouseLeave: handleIconMouseLeave, children: /* @__PURE__ */ jsxs(RangeInputWrapper, { error: showError, disabled, active: !!highlight && !disabled, tabIndex: disabled ? -1 : 0, focus: active && !disabled, children: [
|
|
82
81
|
placeholder,
|
|
83
82
|
/* @__PURE__ */ jsx(IconSeparator, {}),
|
|
84
|
-
!readOnly && !disabled && hovered && hasValue && allowClear ? /* @__PURE__ */ jsx(Tooltip, { title: texts?.clear, children: /* @__PURE__ */ jsx(ClearIconWrapper, { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Close3S, {}), "data-testid": "date-range-picker-input-clear", onClick: handleClear }) }) }) : /* @__PURE__ */ jsx(DefaultIconWrapper, { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CalendarM, {})
|
|
83
|
+
!readOnly && !disabled && hovered && hasValue && allowClear ? /* @__PURE__ */ jsx(Tooltip, { title: texts?.clear, children: /* @__PURE__ */ jsx(ClearIconWrapper, { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Close3S, {}), "data-testid": "date-range-picker-input-clear", onClick: handleClear }) }) }) : /* @__PURE__ */ jsx(DefaultIconWrapper, { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CalendarM, {}) }) })
|
|
85
84
|
] }) }) }) });
|
|
86
85
|
};
|
|
87
86
|
export {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export declare const Container: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export declare const ClearIconWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const DefaultIconWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const DateWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
5
|
+
highlight?: boolean;
|
|
6
|
+
}, never>;
|
|
7
|
+
export declare const DateValue: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
8
|
export declare const RangeInputWrapper: import('styled-components').StyledComponent<"div", any, import('@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles').InputWrapperProps & {
|
|
5
9
|
error?: boolean;
|
|
6
10
|
focus?: boolean;
|
|
@@ -8,9 +12,5 @@ export declare const RangeInputWrapper: import('styled-components').StyledCompon
|
|
|
8
12
|
hover?: boolean;
|
|
9
13
|
active?: boolean;
|
|
10
14
|
}, never>;
|
|
11
|
-
export declare const DateWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
12
|
-
highlight?: boolean;
|
|
13
|
-
}, never>;
|
|
14
|
-
export declare const DateValue: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
15
15
|
export declare const IconSeparator: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
16
16
|
export declare const SuffixWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
2
|
import { InputWrapper } from "@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles";
|
|
3
3
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
4
4
|
displayName: "RangePickerInputstyles__Container",
|
|
@@ -7,23 +7,23 @@ const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
|
7
7
|
const ClearIconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
8
8
|
displayName: "RangePickerInputstyles__ClearIconWrapper",
|
|
9
9
|
componentId: "sc-1b9h1ef-1"
|
|
10
|
-
})(["margin-left:3px
|
|
10
|
+
})(["margin-left:3px;color:var(--ds-form-clear-icon);cursor:pointer;&:hover{color:var(--ds-form-clear-icon);}"]);
|
|
11
11
|
const DefaultIconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
12
12
|
displayName: "RangePickerInputstyles__DefaultIconWrapper",
|
|
13
13
|
componentId: "sc-1b9h1ef-2"
|
|
14
|
-
})(["margin-left:3px;&&:hover{
|
|
15
|
-
const RangeInputWrapper = /* @__PURE__ */ styled(InputWrapper).withConfig({
|
|
16
|
-
displayName: "RangePickerInputstyles__RangeInputWrapper",
|
|
17
|
-
componentId: "sc-1b9h1ef-3"
|
|
18
|
-
})(["display:flex;align-items:center;&{opacity:1;padding:2px 8px 2px 12px;}", "{opacity:0.4;}"], DefaultIconWrapper);
|
|
14
|
+
})(["margin-left:3px;color:var(--ds-form-icon-color-default);cursor:pointer;&&:hover{color:var(--ds-color-icon-brand-default);}"]);
|
|
19
15
|
const DateWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
20
16
|
displayName: "RangePickerInputstyles__DateWrapper",
|
|
21
|
-
componentId: "sc-1b9h1ef-
|
|
22
|
-
})(["color:", ";"], (props) => props.highlight ?
|
|
17
|
+
componentId: "sc-1b9h1ef-3"
|
|
18
|
+
})(["color:", ";"], (props) => props.highlight ? "var(--ds-form-field-text-active)" : "var(--ds-form-field-text-placeholder)");
|
|
23
19
|
const DateValue = /* @__PURE__ */ styled.div.withConfig({
|
|
24
20
|
displayName: "RangePickerInputstyles__DateValue",
|
|
21
|
+
componentId: "sc-1b9h1ef-4"
|
|
22
|
+
})(["color:var(--ds-form-field-text-value);"]);
|
|
23
|
+
const RangeInputWrapper = /* @__PURE__ */ styled(InputWrapper).withConfig({
|
|
24
|
+
displayName: "RangePickerInputstyles__RangeInputWrapper",
|
|
25
25
|
componentId: "sc-1b9h1ef-5"
|
|
26
|
-
})(["
|
|
26
|
+
})(["display:flex;align-items:center;&{opacity:1;padding:2px 8px 2px 12px;}", ""], (props) => props.disabled && css(["&&{background:var(--ds-form-field-bg-disabled);color:var(--ds-form-field-text-disabled);}", ",", "{color:var(--ds-form-field-text-disabled);}", "{opacity:var(--ds-opacity-disabled);}"], DateWrapper, DateValue, DefaultIconWrapper));
|
|
27
27
|
const IconSeparator = /* @__PURE__ */ styled.div.withConfig({
|
|
28
28
|
displayName: "RangePickerInputstyles__IconSeparator",
|
|
29
29
|
componentId: "sc-1b9h1ef-6"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useCallback } from "react";
|
|
3
|
-
import { theme } from "@synerise/ds-core";
|
|
4
3
|
import Icon, { CheckS } from "@synerise/ds-icon";
|
|
5
4
|
import { useOnClickOutside } from "@synerise/ds-utils";
|
|
6
5
|
import { RANGES_ICON } from "../../../constants.js";
|
|
@@ -25,7 +24,7 @@ const ModeDrop = ({
|
|
|
25
24
|
useOnClickOutside(overlayRef, () => {
|
|
26
25
|
setDropVisible(false);
|
|
27
26
|
});
|
|
28
|
-
const overlay = /* @__PURE__ */ jsx(OverlayWrapper, { visible: dropVisible, ref: overlayRef, width: 180, children: /* @__PURE__ */ jsx(DropMenu, { children: modes.map((mode) => /* @__PURE__ */ jsx(DropMenuItem, { onClick: () => handleMenuItemClick(mode), prefixel: /* @__PURE__ */ jsx(Icon, { component: RANGES_ICON[mode] }), suffixel: mode === currentGroup ? /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CheckS, {}), color:
|
|
27
|
+
const overlay = /* @__PURE__ */ jsx(OverlayWrapper, { visible: dropVisible, ref: overlayRef, width: 180, children: /* @__PURE__ */ jsx(DropMenu, { children: modes.map((mode) => /* @__PURE__ */ jsx(DropMenuItem, { onClick: () => handleMenuItemClick(mode), prefixel: /* @__PURE__ */ jsx(Icon, { component: RANGES_ICON[mode] }), suffixel: mode === currentGroup ? /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CheckS, {}), color: "var(--ds-color-icon-success-default)" }) : null, children: texts[MODE_TRANSLATION_KEYS[mode]] }, mode)) }) });
|
|
29
28
|
return /* @__PURE__ */ jsxs(DropdownContainer, { children: [
|
|
30
29
|
/* @__PURE__ */ jsx(ModeDropdownTrigger, { mode: "single-icon", type: "secondary", onClick: () => setDropVisible(true), disabled: !modes || !modes?.length || modes.length === 1, children: !!currentGroup && /* @__PURE__ */ jsx(Icon, { component: [RANGES_ICON[currentGroup]] }, currentGroup) }, "TOGGLE"),
|
|
31
30
|
overlay
|
|
@@ -2,7 +2,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import isEqual from "lodash.isequal";
|
|
3
3
|
import find from "ramda/src/find.js";
|
|
4
4
|
import { useState, useRef, useCallback } from "react";
|
|
5
|
-
import { theme } from "@synerise/ds-core";
|
|
6
5
|
import Icon, { CheckS, AngleDownS } from "@synerise/ds-icon";
|
|
7
6
|
import Scrollbar from "@synerise/ds-scrollbar";
|
|
8
7
|
import { useOnClickOutside } from "@synerise/ds-utils";
|
|
@@ -57,7 +56,7 @@ const RangeDropdown = ({
|
|
|
57
56
|
width: DROPDOWN_WIDTH - DROPDOWN_PADDING
|
|
58
57
|
}, absolute: true, children: /* @__PURE__ */ jsx(DropMenu, { children: ranges.map((range) => {
|
|
59
58
|
const selected = currentRange?.key === range.key || isLifetime(currentRange) && range.key === ALL_TIME;
|
|
60
|
-
return /* @__PURE__ */ jsx(DropMenuItem, { onClick: onMenuItemClick, itemKey: range.key || range.id, suffixel: selected && /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CheckS, {}), color:
|
|
59
|
+
return /* @__PURE__ */ jsx(DropMenuItem, { onClick: onMenuItemClick, itemKey: range.key || range.id, suffixel: selected && /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CheckS, {}), color: "var(--ds-color-icon-success-default)" }), children: range.translationKey ? texts[range.translationKey] : range.key }, range.key || range.id);
|
|
61
60
|
}) }) }) });
|
|
62
61
|
return /* @__PURE__ */ jsxs(DropdownContainer, { ref: dropdownRef, children: [
|
|
63
62
|
/* @__PURE__ */ jsxs(Range, { "data-testid": "relative-ranges-dropdown", activated: !!containsCurrentRange, mode: "label-icon", onClick: () => setDropVisible(!dropVisible), children: [
|
|
@@ -19,7 +19,7 @@ const Title = /* @__PURE__ */ styled.div.withConfig({
|
|
|
19
19
|
const Help = /* @__PURE__ */ styled.div.withConfig({
|
|
20
20
|
displayName: "RelativeRangePickerstyles__Help",
|
|
21
21
|
componentId: "sc-17ul7sp-3"
|
|
22
|
-
})(["flex:0;color:
|
|
22
|
+
})(["flex:0;color:var(--ds-color-text-base-disabled);"]);
|
|
23
23
|
const Ranges = /* @__PURE__ */ styled.div.withConfig({
|
|
24
24
|
displayName: "RelativeRangePickerstyles__Ranges",
|
|
25
25
|
componentId: "sc-17ul7sp-4"
|
|
@@ -65,7 +65,7 @@ const DropMenuItem = /* @__PURE__ */ styled(ListItem).withConfig({
|
|
|
65
65
|
const OverlayWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
66
66
|
displayName: "RelativeRangePickerstyles__OverlayWrapper",
|
|
67
67
|
componentId: "sc-17ul7sp-13"
|
|
68
|
-
})(["position:absolute;bottom:40px;padding:8px 0 8px 8px;background-color:
|
|
68
|
+
})(["position:absolute;bottom:40px;padding:8px 0 8px 8px;background-color:var(--ds-dropdown-bg);display:", ";z-index:15;box-shadow:var(--ds-shadows-shadow-1);", " &,& > ul{border-radius:3px;}.scrollbar-container > .ps__rail-y > .ps__thumb-y{transform:translateX(1px) !important;}"], (props) => props.visible ? "block" : "none", (props) => !!props.width && `width:${props.width}px;`);
|
|
69
69
|
const DropdownContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
70
70
|
displayName: "RelativeRangePickerstyles__DropdownContainer",
|
|
71
71
|
componentId: "sc-17ul7sp-14"
|
|
@@ -2,7 +2,7 @@ import { DateRange } from '../../date.types';
|
|
|
2
2
|
export declare const findMatchingPreset: (range: DateRange) => {
|
|
3
3
|
type: "RELATIVE" | "SINCE";
|
|
4
4
|
offset: {
|
|
5
|
-
type: import('
|
|
5
|
+
type: import('../..').RelativeUnits;
|
|
6
6
|
value: number;
|
|
7
7
|
};
|
|
8
8
|
duration: import('../../date.types').Duration;
|
|
@@ -10,7 +10,7 @@ export declare const findMatchingPreset: (range: DateRange) => {
|
|
|
10
10
|
to?: import('../../date.types').NullableDateLimit;
|
|
11
11
|
key: import('../../date.types').RangeKey | string;
|
|
12
12
|
future?: boolean;
|
|
13
|
-
filter?: import('
|
|
13
|
+
filter?: import('../..').DateFilter;
|
|
14
14
|
translationKey?: string;
|
|
15
15
|
id?: React.ReactText;
|
|
16
16
|
timestamp?: Date;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { DateFilter, RelativeDateRange } from '../date.types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The bounds `forceAbsolute` emits, which must be the range the panel showed — so they come from
|
|
4
|
+
* `normalizeRange` rather than a second implementation of the arithmetic. `timeZone` is the
|
|
5
|
+
* clock "now" is read from, as in `normalizeRange`'s relative branch.
|
|
6
|
+
*/
|
|
3
7
|
declare const relativeToAbsolute: (range: RelativeDateRange, timeZone?: string) => DateFilter;
|
|
4
8
|
export default relativeToAbsolute;
|
|
@@ -1,39 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { currentTimeInTimezone } from "@synerise/ds-core";
|
|
3
|
-
import ADD from "./add.js";
|
|
4
|
-
import endOf from "./endOf.js";
|
|
5
|
-
import startOf from "./startOf.js";
|
|
6
|
-
import toDateValue from "./toDateValue.js";
|
|
1
|
+
import { normalizeRange } from "../utils.js";
|
|
7
2
|
const relativeToAbsolute = (range, timeZone) => {
|
|
8
3
|
const {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} = range;
|
|
13
|
-
const now = timeZone ? currentTimeInTimezone(timeZone) : /* @__PURE__ */ new Date();
|
|
14
|
-
let left;
|
|
15
|
-
let right;
|
|
16
|
-
if (future) {
|
|
17
|
-
left = toDateValue(
|
|
18
|
-
// @ts-expect-error - requires type refactor
|
|
19
|
-
ADD[offset.type](startOf[offset.type](now), offset.value)
|
|
20
|
-
);
|
|
21
|
-
right = toDateValue(
|
|
22
|
-
// @ts-expect-error - requires type refactor
|
|
23
|
-
ADD[duration.type](endOf[duration.type](left), duration.value - 1)
|
|
24
|
-
);
|
|
25
|
-
} else {
|
|
26
|
-
right = toDateValue(
|
|
27
|
-
// @ts-expect-error - requires type refactor
|
|
28
|
-
ADD[offset.type](endOf[offset.type](now), -offset.value)
|
|
29
|
-
);
|
|
30
|
-
left = toDateValue(
|
|
31
|
-
// @ts-expect-error - requires type refactor
|
|
32
|
-
ADD[duration.type](startOf[duration.type](right), 1 - duration.value)
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
const from = min([left, right]);
|
|
36
|
-
const to = max([left, right]);
|
|
4
|
+
from,
|
|
5
|
+
to
|
|
6
|
+
} = normalizeRange(range, timeZone);
|
|
37
7
|
return {
|
|
38
8
|
from,
|
|
39
9
|
to,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-date-range-picker",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Date-Range-Picker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -46,26 +46,26 @@
|
|
|
46
46
|
],
|
|
47
47
|
"types": "dist/index.d.ts",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@synerise/ds-badge": "^2.
|
|
50
|
-
"@synerise/ds-button": "^2.1
|
|
51
|
-
"@synerise/ds-button-group": "^2.
|
|
52
|
-
"@synerise/ds-date-picker": "^2.1
|
|
53
|
-
"@synerise/ds-dropdown": "^2.1
|
|
54
|
-
"@synerise/ds-form-field": "^2.
|
|
55
|
-
"@synerise/ds-icon": "^2.
|
|
56
|
-
"@synerise/ds-inline-edit": "^2.
|
|
57
|
-
"@synerise/ds-input": "^2.
|
|
58
|
-
"@synerise/ds-input-number": "^2.
|
|
59
|
-
"@synerise/ds-list-item": "^2.
|
|
60
|
-
"@synerise/ds-manageable-list": "^2.1
|
|
61
|
-
"@synerise/ds-popover": "^2.
|
|
62
|
-
"@synerise/ds-scrollbar": "^2.
|
|
63
|
-
"@synerise/ds-select": "^2.1
|
|
64
|
-
"@synerise/ds-slider": "^2.
|
|
65
|
-
"@synerise/ds-tag": "^2.
|
|
66
|
-
"@synerise/ds-time-picker": "^2.
|
|
67
|
-
"@synerise/ds-tooltip": "^2.
|
|
68
|
-
"@synerise/ds-utils": "^2.
|
|
49
|
+
"@synerise/ds-badge": "^2.1.1",
|
|
50
|
+
"@synerise/ds-button": "^2.2.1",
|
|
51
|
+
"@synerise/ds-button-group": "^2.1.1",
|
|
52
|
+
"@synerise/ds-date-picker": "^2.2.1",
|
|
53
|
+
"@synerise/ds-dropdown": "^2.2.1",
|
|
54
|
+
"@synerise/ds-form-field": "^2.1.1",
|
|
55
|
+
"@synerise/ds-icon": "^2.3.1",
|
|
56
|
+
"@synerise/ds-inline-edit": "^2.1.1",
|
|
57
|
+
"@synerise/ds-input": "^2.1.1",
|
|
58
|
+
"@synerise/ds-input-number": "^2.1.1",
|
|
59
|
+
"@synerise/ds-list-item": "^2.4.0",
|
|
60
|
+
"@synerise/ds-manageable-list": "^2.2.1",
|
|
61
|
+
"@synerise/ds-popover": "^2.3.0",
|
|
62
|
+
"@synerise/ds-scrollbar": "^2.1.1",
|
|
63
|
+
"@synerise/ds-select": "^2.2.1",
|
|
64
|
+
"@synerise/ds-slider": "^2.1.1",
|
|
65
|
+
"@synerise/ds-tag": "^2.1.1",
|
|
66
|
+
"@synerise/ds-time-picker": "^2.1.1",
|
|
67
|
+
"@synerise/ds-tooltip": "^2.1.1",
|
|
68
|
+
"@synerise/ds-utils": "^2.3.1",
|
|
69
69
|
"date-fns": "^4.1.0",
|
|
70
70
|
"dayjs": "^1.8.35",
|
|
71
71
|
"lodash.clonedeep": "^4.5.0",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
104
104
|
"styled-components": "^5.3.3"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "2d2a540b35fddf8855da45f0dec2f4612c6d87b6"
|
|
107
107
|
}
|