@veracity/vui 2.25.0 → 2.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/datePicker/datePicker.d.ts.map +1 -1
- package/dist/cjs/datePicker/datePicker.js +3 -8
- package/dist/cjs/datePicker/datePicker.js.map +1 -1
- package/dist/cjs/datePicker/datePicker.types.d.ts +7 -2
- package/dist/cjs/datePicker/datePicker.types.d.ts.map +1 -1
- package/dist/cjs/theme/foundations/colors.js +1 -1
- package/dist/esm/datePicker/datePicker.d.ts.map +1 -1
- package/dist/esm/datePicker/datePicker.js +5 -10
- package/dist/esm/datePicker/datePicker.js.map +1 -1
- package/dist/esm/datePicker/datePicker.types.d.ts +7 -2
- package/dist/esm/datePicker/datePicker.types.d.ts.map +1 -1
- package/dist/esm/theme/foundations/colors.js +1 -1
- package/dist/tsconfig.legacy.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/datePicker/datePicker.tsx +16 -16
- package/src/datePicker/datePicker.types.ts +7 -2
- package/src/theme/foundations/colors.ts +1 -1
- package/dist/cjs/datePicker/components/pickerPanel.d.ts +0 -6
- package/dist/cjs/datePicker/components/pickerPanel.d.ts.map +0 -1
- package/dist/cjs/datePicker/components/pickerPanel.js +0 -26
- package/dist/cjs/datePicker/components/pickerPanel.js.map +0 -1
- package/dist/esm/datePicker/components/pickerPanel.d.ts +0 -6
- package/dist/esm/datePicker/components/pickerPanel.d.ts.map +0 -1
- package/dist/esm/datePicker/components/pickerPanel.js +0 -20
- package/dist/esm/datePicker/components/pickerPanel.js.map +0 -1
- package/src/datePicker/components/pickerPanel.tsx +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.1",
|
|
4
4
|
"description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
import Box from '../box'
|
|
4
4
|
import Button, { LineButton } from '../button'
|
|
5
5
|
import Calendar, { DateRange, maxDateTimestamp, minDateTimestamp } from '../calendar'
|
|
6
|
-
import { omitThemingProps,
|
|
6
|
+
import { omitThemingProps, useStyleConfig, vui } from '../core'
|
|
7
|
+
import Popover from '../popover'
|
|
7
8
|
import { cs, useClickOutside } from '../utils'
|
|
8
|
-
import { PickerPanel } from './components/pickerPanel'
|
|
9
9
|
import { DateInput } from './dateInput'
|
|
10
10
|
import { DatePickerProps } from './datePicker.types'
|
|
11
11
|
|
|
12
|
-
const DatePickerPanel = styled(PickerPanel)`
|
|
13
|
-
width: 320px;
|
|
14
|
-
`
|
|
15
|
-
|
|
16
12
|
/** Select or input a date. */
|
|
17
13
|
export const DatePicker = vui<'span', DatePickerProps>((props, ref) => {
|
|
18
14
|
const {
|
|
19
15
|
autoOpened,
|
|
20
16
|
boundaries,
|
|
21
|
-
popupPosition
|
|
17
|
+
popupPosition,
|
|
18
|
+
placement,
|
|
22
19
|
selectedDate: selectedDateProps,
|
|
23
20
|
showClearButton,
|
|
24
21
|
slotBottom,
|
|
@@ -35,11 +32,8 @@ export const DatePicker = vui<'span', DatePickerProps>((props, ref) => {
|
|
|
35
32
|
const [isInvalidInputDate, setIsInvalidInputDate] = useState(true)
|
|
36
33
|
const [isInvalidSelectedDate, setIsInvalidSelectedDate] = useState(!selectedDate)
|
|
37
34
|
const initialDateRef = useRef<Date | undefined>(selectedDateProps)
|
|
38
|
-
const popupRef = useRef<HTMLDivElement>(null)
|
|
39
35
|
const isClearButtonVisible = showClearButton && initialDateRef.current
|
|
40
36
|
|
|
41
|
-
useClickOutside(popupRef, () => setIsOpen(false))
|
|
42
|
-
|
|
43
37
|
const isStartDateInRange = (date: Date) =>
|
|
44
38
|
!!boundaries?.startDate && !!date ? date.getTime() - boundaries.startDate.getTime() >= 0 : true
|
|
45
39
|
|
|
@@ -116,9 +110,15 @@ export const DatePicker = vui<'span', DatePickerProps>((props, ref) => {
|
|
|
116
110
|
|
|
117
111
|
return (
|
|
118
112
|
<Box className={cs('vui-datePicker', className)} position="relative" ref={ref} {...styles} {...rest}>
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
<Popover
|
|
114
|
+
isOpen={isOpen}
|
|
115
|
+
onClose={() => setIsOpen(false)}
|
|
116
|
+
placement={placement ? placement : popupPosition === 'right' ? 'bottom-end' : undefined}
|
|
117
|
+
>
|
|
118
|
+
<Popover.Trigger as={Box} onClick={onToggle}>
|
|
119
|
+
{children}
|
|
120
|
+
</Popover.Trigger>
|
|
121
|
+
<Popover.Content column>
|
|
122
122
|
{!!slotTop && <Box px={2}>{slotTop}</Box>}
|
|
123
123
|
<Box display="block" mb={0} mt={2} mx={2}>
|
|
124
124
|
<DateInput
|
|
@@ -160,8 +160,8 @@ export const DatePicker = vui<'span', DatePickerProps>((props, ref) => {
|
|
|
160
160
|
</Box>
|
|
161
161
|
</Box>
|
|
162
162
|
{!!slotBottom && <Box px={2}>{slotBottom}</Box>}
|
|
163
|
-
</
|
|
164
|
-
|
|
163
|
+
</Popover.Content>
|
|
164
|
+
</Popover>
|
|
165
165
|
</Box>
|
|
166
166
|
)
|
|
167
167
|
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react'
|
|
2
|
+
import { Placement } from 'tippy.js'
|
|
2
3
|
|
|
3
4
|
import { BoxProps } from '../box'
|
|
4
5
|
import { DateRange } from '../calendar'
|
|
@@ -12,14 +13,18 @@ export type DatePickerProps = Omit<BoxProps, 'size' | 'variant'> &
|
|
|
12
13
|
autoOpened?: boolean
|
|
13
14
|
/** Available date range for the Calendar */
|
|
14
15
|
boundaries?: DateRange
|
|
15
|
-
/**
|
|
16
|
+
/** @deprecated Please use placement ↓ */
|
|
16
17
|
popupPosition?: DatePickerPopupPosition
|
|
18
|
+
/** Preferred placement of the content. Might be flipped if needs more space. */
|
|
19
|
+
placement?: Placement
|
|
20
|
+
/** Selected date */
|
|
17
21
|
selectedDate?: Date
|
|
22
|
+
/** Should the clear button be visible */
|
|
18
23
|
showClearButton?: boolean
|
|
19
24
|
/** Custom content displayed at the bottom of the panel */
|
|
20
25
|
slotBottom?: ReactNode
|
|
21
26
|
/** Custom content displayed at the top of the panel */
|
|
22
27
|
slotTop?: ReactNode
|
|
23
|
-
/** Date selected */
|
|
28
|
+
/** Date selected callback */
|
|
24
29
|
onSelected?: (date?: Date) => void
|
|
25
30
|
}
|
|
@@ -211,7 +211,7 @@ export const seaBlue = {
|
|
|
211
211
|
65: 'hsl(218, 100%, 65%)',
|
|
212
212
|
60: 'hsl(218, 100%, 60%)',
|
|
213
213
|
55: 'hsl(218, 100%, 55%)',
|
|
214
|
-
50: 'hsl(218, 100%,
|
|
214
|
+
50: 'hsl(218, 100%, 50%)',
|
|
215
215
|
45: 'hsl(218, 100%, 45%)',
|
|
216
216
|
40: 'hsl(218, 100%, 40%)',
|
|
217
217
|
35: 'hsl(218, 100%, 35%)',
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DatePickerPopupPosition } from '../datePicker.types';
|
|
2
|
-
export declare const PickerPanel: import("styled-components").StyledComponent<import("../../core").VuiComponent<"div", import("../../panel").PanelProps>, import("styled-components").DefaultTheme, {
|
|
3
|
-
popupPosition: DatePickerPopupPosition;
|
|
4
|
-
showPopupBelow: boolean;
|
|
5
|
-
}, never>;
|
|
6
|
-
//# sourceMappingURL=pickerPanel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickerPanel.d.ts","sourceRoot":"","sources":["../../../../src/datePicker/components/pickerPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,eAAO,MAAM,WAAW;mBAAkC,uBAAuB;oBAAkB,OAAO;SAiBzG,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PickerPanel = void 0;
|
|
7
|
-
const core_1 = require("../../core");
|
|
8
|
-
const panel_1 = __importDefault(require("../../panel"));
|
|
9
|
-
exports.PickerPanel = (0, core_1.styled)(panel_1.default) `
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
padding: 0px;
|
|
13
|
-
position: absolute;
|
|
14
|
-
z-index: 999;
|
|
15
|
-
${p => (p.popupPosition === 'right' ? 'right: 0;' : 'left: 0;')}
|
|
16
|
-
${p => p.showPopupBelow
|
|
17
|
-
? (0, core_1.css) `
|
|
18
|
-
margin-top: 50px;
|
|
19
|
-
top: 0;
|
|
20
|
-
`
|
|
21
|
-
: (0, core_1.css) `
|
|
22
|
-
bottom: 0;
|
|
23
|
-
margin-bottom: 50px;
|
|
24
|
-
`}
|
|
25
|
-
`;
|
|
26
|
-
//# sourceMappingURL=pickerPanel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickerPanel.js","sourceRoot":"","sources":["../../../../src/datePicker/components/pickerPanel.tsx"],"names":[],"mappings":";;;;;;AAAA,qCAAwC;AACxC,wDAA+B;AAGlB,QAAA,WAAW,GAAG,IAAA,aAAM,EAAC,eAAK,CAAC,CAAqE;;;;;;IAMzG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;IAC7D,CAAC,CAAC,EAAE,CACJ,CAAC,CAAC,cAAc;IACd,CAAC,CAAC,IAAA,UAAG,EAAA;;;SAGF;IACH,CAAC,CAAC,IAAA,UAAG,EAAA;;;SAGF;CACR,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DatePickerPopupPosition } from '../datePicker.types';
|
|
2
|
-
export declare const PickerPanel: import("styled-components").StyledComponent<import("../../core").VuiComponent<"div", import("../../panel").PanelProps>, import("styled-components").DefaultTheme, {
|
|
3
|
-
popupPosition: DatePickerPopupPosition;
|
|
4
|
-
showPopupBelow: boolean;
|
|
5
|
-
}, never>;
|
|
6
|
-
//# sourceMappingURL=pickerPanel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickerPanel.d.ts","sourceRoot":"","sources":["../../../../src/datePicker/components/pickerPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,eAAO,MAAM,WAAW;mBAAkC,uBAAuB;oBAAkB,OAAO;SAiBzG,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { css, styled } from '../../core';
|
|
2
|
-
import Panel from '../../panel';
|
|
3
|
-
export const PickerPanel = styled(Panel) `
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
padding: 0px;
|
|
7
|
-
position: absolute;
|
|
8
|
-
z-index: 999;
|
|
9
|
-
${p => (p.popupPosition === 'right' ? 'right: 0;' : 'left: 0;')}
|
|
10
|
-
${p => p.showPopupBelow
|
|
11
|
-
? css `
|
|
12
|
-
margin-top: 50px;
|
|
13
|
-
top: 0;
|
|
14
|
-
`
|
|
15
|
-
: css `
|
|
16
|
-
bottom: 0;
|
|
17
|
-
margin-bottom: 50px;
|
|
18
|
-
`}
|
|
19
|
-
`;
|
|
20
|
-
//# sourceMappingURL=pickerPanel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickerPanel.js","sourceRoot":"","sources":["../../../../src/datePicker/components/pickerPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,MAAM,aAAa,CAAA;AAG/B,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAqE;;;;;;IAMzG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;IAC7D,CAAC,CAAC,EAAE,CACJ,CAAC,CAAC,cAAc;IACd,CAAC,CAAC,GAAG,CAAA;;;SAGF;IACH,CAAC,CAAC,GAAG,CAAA;;;SAGF;CACR,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { css, styled } from '../../core'
|
|
2
|
-
import Panel from '../../panel'
|
|
3
|
-
import { DatePickerPopupPosition } from '../datePicker.types'
|
|
4
|
-
|
|
5
|
-
export const PickerPanel = styled(Panel)<{ popupPosition: DatePickerPopupPosition; showPopupBelow: boolean }>`
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
padding: 0px;
|
|
9
|
-
position: absolute;
|
|
10
|
-
z-index: 999;
|
|
11
|
-
${p => (p.popupPosition === 'right' ? 'right: 0;' : 'left: 0;')}
|
|
12
|
-
${p =>
|
|
13
|
-
p.showPopupBelow
|
|
14
|
-
? css`
|
|
15
|
-
margin-top: 50px;
|
|
16
|
-
top: 0;
|
|
17
|
-
`
|
|
18
|
-
: css`
|
|
19
|
-
bottom: 0;
|
|
20
|
-
margin-bottom: 50px;
|
|
21
|
-
`}
|
|
22
|
-
`
|