@clickhouse/click-ui 0.2.0-rc.7 → 0.2.0-rc.8
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/components/DatePicker/Common.cjs +79 -48
- package/dist/cjs/components/DatePicker/Common.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DateRangePicker.cjs +24 -24
- package/dist/cjs/components/DatePicker/DateRangePicker.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DateTimeRangePicker.cjs +78 -40
- package/dist/cjs/components/DatePicker/DateTimeRangePicker.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/index.cjs +29 -18
- package/dist/cjs/components/DatePicker/index.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/utils.cjs +42 -14
- package/dist/cjs/components/DatePicker/utils.cjs.map +1 -1
- package/dist/esm/components/DatePicker/Common.js +80 -49
- package/dist/esm/components/DatePicker/Common.js.map +1 -1
- package/dist/esm/components/DatePicker/DateRangePicker.js +25 -25
- package/dist/esm/components/DatePicker/DateRangePicker.js.map +1 -1
- package/dist/esm/components/DatePicker/DateTimeRangePicker.js +79 -41
- package/dist/esm/components/DatePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/esm/components/DatePicker/index.js +30 -19
- package/dist/esm/components/DatePicker/index.js.map +1 -1
- package/dist/esm/components/DatePicker/utils.js +36 -10
- package/dist/esm/components/DatePicker/utils.js.map +1 -1
- package/dist/types/components/DatePicker/Common.d.ts +9 -4
- package/dist/types/components/DatePicker/DatePicker.d.ts +11 -2
- package/dist/types/components/DatePicker/DateRangePicker.d.ts +3 -2
- package/dist/types/components/DatePicker/DateTimeRangePicker.d.ts +3 -2
- package/dist/types/components/DatePicker/index.d.ts +2 -1
- package/dist/types/components/DatePicker/utils.d.ts +9 -8
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -3
- package/dist/types/components/DatePicker/DatePicker.types.d.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/components/DatePicker/utils.ts"],"sourcesContent":["import dayjs from '
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/DatePicker/utils.ts"],"sourcesContent":["import { dayjs } from '@/utils/date';\n\nexport type Timezone = 'system' | 'UTC';\n\nexport interface DateRange {\n startDate: Date;\n endDate: Date;\n}\n\nconst locale = 'en-US';\n\nexport type Meridiem = 'am' | 'pm';\n\nexport interface Time {\n hour: number;\n minutes: number;\n}\n\nexport interface DateRangeListItem {\n dateRange: DateRange;\n label: string;\n}\n\nconst createFormatter = (options: Intl.DateTimeFormatOptions) => {\n const timezoneFormatters: Partial<Record<Timezone, Intl.DateTimeFormat>> = {};\n\n return (timezone: Timezone, date: Date): string => {\n if (!timezoneFormatters[timezone]) {\n const opts = timezone === 'UTC' ? { ...options, timeZone: 'UTC' } : options;\n timezoneFormatters[timezone] = new Intl.DateTimeFormat(locale, opts);\n }\n return timezoneFormatters[timezone].format(date);\n };\n};\n\nexport const formatSelectedDate = createFormatter({\n day: '2-digit',\n month: 'short',\n year: 'numeric',\n});\n\nexport const formatWeekday = createFormatter({ weekday: 'short' });\n\nexport const formatSelectedDateTime = createFormatter({\n day: '2-digit',\n month: 'short',\n hour: '2-digit',\n minute: '2-digit',\n});\n\nexport const formatSelectedDateTimeWithSeconds = createFormatter({\n day: '2-digit',\n month: 'short',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n});\n\nexport const formatDateHeader = createFormatter({\n month: 'short',\n year: 'numeric',\n});\n\n// In UTC mode, shift by the host offset so local-time getters return UTC\n// values. shiftFromTimezone reverses it.\n//\n// Caveat: round-tripping across a DST boundary drifts by an hour — each\n// direction reads getTimezoneOffset on its own input. Call sites don't\n// round-trip the same Date, so this hasn't bitten us.\nexport const shiftToTimezone = (date: Date, timezone: Timezone): Date => {\n if (timezone !== 'UTC') {\n return date;\n }\n return new Date(date.getTime() + date.getTimezoneOffset() * 60_000);\n};\n\nexport const shiftFromTimezone = (date: Date, timezone: Timezone): Date => {\n if (timezone !== 'UTC') {\n return date;\n }\n return new Date(date.getTime() - date.getTimezoneOffset() * 60_000);\n};\n\nexport const getPredefinedMonthsForDateRangePicker = (\n numberOfMonths: number\n): DateRange[] => {\n const now = dayjs();\n\n if (numberOfMonths < 0) {\n const lastSixMonths: DateRange[] = [];\n for (let i = 0; i < Math.abs(numberOfMonths); i++) {\n const date = now.subtract(i, 'month');\n if (date.date() === 1 && date.month() === now.month()) {\n continue;\n }\n lastSixMonths.push({\n startDate: date.startOf('month').toDate(),\n endDate: i === 0 ? now.toDate() : date.endOf('month').toDate(),\n });\n }\n\n return lastSixMonths.reverse();\n }\n\n const nextSixMonths: DateRange[] = [];\n for (let i = 0; i < numberOfMonths; i++) {\n const date = now.add(i, 'month');\n nextSixMonths.push({\n startDate: date.startOf('month').toDate(),\n endDate: date.endOf('month').toDate(),\n });\n }\n\n return nextSixMonths;\n};\n\nexport const getPredefinedTimePeriodsForDateTimePicker = (): DateRangeListItem[] => {\n const now = dayjs();\n\n const fifteenMinutesAgo = now.subtract(15, 'minute');\n const thirtyMinutesAgo = now.subtract(30, 'minute');\n const oneHourAgo = now.subtract(1, 'hour');\n const sixHoursAgo = now.subtract(6, 'hour');\n const oneDayAgo = now.subtract(1, 'day');\n const oneMonthAgo = now.subtract(1, 'month');\n\n const dateRangeList: DateRangeListItem[] = [\n {\n dateRange: {\n startDate: fifteenMinutesAgo.toDate(),\n endDate: now.toDate(),\n },\n label: 'Past 15 minutes',\n },\n {\n dateRange: {\n startDate: thirtyMinutesAgo.toDate(),\n endDate: now.toDate(),\n },\n label: 'Past 30 minutes',\n },\n {\n dateRange: {\n startDate: oneHourAgo.toDate(),\n endDate: now.toDate(),\n },\n label: 'Past hour',\n },\n {\n dateRange: {\n startDate: sixHoursAgo.toDate(),\n endDate: now.toDate(),\n },\n label: 'Past 6 hours',\n },\n {\n dateRange: {\n startDate: oneDayAgo.toDate(),\n endDate: now.toDate(),\n },\n label: 'Past day',\n },\n {\n dateRange: {\n startDate: oneMonthAgo.toDate(),\n endDate: now.toDate(),\n },\n label: 'Past month',\n },\n ];\n\n return dateRangeList;\n};\n\nexport const getNextNDatesForDatePickerAllowOnlyList = (numberOfDays: number): Date[] => {\n const now = dayjs();\n\n return Array.from({ length: numberOfDays }, (_, i) =>\n now.add(i, 'day').startOf('day').toDate()\n );\n};\n\nexport const datesAreWithinMaxRange = (\n startDate: Date,\n endDate: Date,\n maxRangeLength: number\n): boolean => {\n const daysDifference = Math.abs(dayjs(startDate).diff(dayjs(endDate), 'days'));\n\n return daysDifference <= maxRangeLength;\n};\n\nexport const isDateRangeTheWholeMonth = (\n { startDate, endDate }: DateRange,\n timezone: Timezone = 'system'\n): boolean => {\n const start = timezone === 'UTC' ? dayjs.utc(startDate) : dayjs(startDate);\n const end = timezone === 'UTC' ? dayjs.utc(endDate) : dayjs(endDate);\n\n if (start.month() !== end.month()) {\n return false;\n }\n\n const startDateIsFirstDay = start.isSame(start.startOf('month'), 'day');\n const endDateIsLastDay = end.isSame(end.endOf('month'), 'day');\n\n return startDateIsFirstDay && endDateIsLastDay;\n};\n"],"names":["locale","createFormatter","options","timezoneFormatters","timezone","date","opts","timeZone","Intl","DateTimeFormat","format","formatSelectedDate","day","month","year","formatWeekday","weekday","formatSelectedDateTime","hour","minute","formatSelectedDateTimeWithSeconds","second","formatDateHeader","shiftToTimezone","Date","getTime","getTimezoneOffset","shiftFromTimezone","getPredefinedMonthsForDateRangePicker","numberOfMonths","now","dayjs","lastSixMonths","i","Math","abs","subtract","push","startDate","startOf","toDate","endDate","endOf","reverse","nextSixMonths","add","datesAreWithinMaxRange","maxRangeLength","daysDifference","diff","isDateRangeTheWholeMonth","start","utc","end","startDateIsFirstDay","isSame","endDateIsLastDay"],"mappings":";;;AASA,MAAMA,MAAAA,GAAS,OAAA;AAcf,MAAMC,eAAAA,GAAkBA,CAACC,OAAAA,KAAwC;AAC/D,EAAA,MAAMC,qBAAqE,EAAC;AAE5E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AAA,EAAM,KAAMwC,GAAAA,CAAIxC,OAAM,EAAG;AACjC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAMyC,sBAAsBH,KAAAA,CAAMI,MAAAA,CAAOJ,MAAMZ,OAAAA,CAAQ,OAAO,GAAG,KAAK,CAAA;AACtE,EAAA,MAAMiB,mBAAmBH,GAAAA,CAAIE,MAAAA,CAAOF,IAAIX,KAAAA,CAAM,OAAO,GAAG,KAAK,CAAA;AAE7D,EAAA,OAAOY,mBAAAA,IAAuBE,gBAAAA;AAChC;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { useCalendar, UseCalendarOptions } from '@h6s/calendar';
|
|
3
|
+
import { Timezone } from './utils';
|
|
3
4
|
interface DatePickerInputProps {
|
|
4
5
|
isActive: boolean;
|
|
5
6
|
disabled: boolean;
|
|
@@ -8,8 +9,9 @@ interface DatePickerInputProps {
|
|
|
8
9
|
partialYear?: number;
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
selectedDate?: Date;
|
|
12
|
+
timezone?: Timezone;
|
|
11
13
|
}
|
|
12
|
-
export declare const DatePickerInput: ({ isActive, disabled, id, partialMonth, partialYear, placeholder, selectedDate, }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const DatePickerInput: ({ isActive, disabled, id, partialMonth, partialYear, placeholder, selectedDate, timezone, }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
interface DateRangePickerInputProps {
|
|
14
16
|
isActive: boolean;
|
|
15
17
|
disabled: boolean;
|
|
@@ -17,8 +19,9 @@ interface DateRangePickerInputProps {
|
|
|
17
19
|
placeholder?: string;
|
|
18
20
|
selectedEndDate?: Date;
|
|
19
21
|
selectedStartDate?: Date;
|
|
22
|
+
timezone?: Timezone;
|
|
20
23
|
}
|
|
21
|
-
export declare const DateRangePickerInput: ({ isActive, disabled, id, placeholder, selectedEndDate, selectedStartDate, }: DateRangePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare const DateRangePickerInput: ({ isActive, disabled, id, placeholder, selectedEndDate, selectedStartDate, timezone, }: DateRangePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
25
|
interface DateTimeRangePickerInputProps {
|
|
23
26
|
isActive: boolean;
|
|
24
27
|
disabled: boolean;
|
|
@@ -27,8 +30,9 @@ interface DateTimeRangePickerInputProps {
|
|
|
27
30
|
selectedEndDate?: Date;
|
|
28
31
|
selectedStartDate?: Date;
|
|
29
32
|
shouldShowSeconds?: boolean;
|
|
33
|
+
timezone?: Timezone;
|
|
30
34
|
}
|
|
31
|
-
export declare const DateTimeRangePickerInput: ({ isActive, disabled, id, placeholder, selectedEndDate, selectedStartDate, shouldShowSeconds, }: DateTimeRangePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare const DateTimeRangePickerInput: ({ isActive, disabled, id, placeholder, selectedEndDate, selectedStartDate, shouldShowSeconds, timezone, }: DateTimeRangePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
36
|
export declare const DateTableCell: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {
|
|
33
37
|
$isCurrentMonth?: boolean;
|
|
34
38
|
$isDisabled?: boolean;
|
|
@@ -47,6 +51,7 @@ interface CalendarRendererProps {
|
|
|
47
51
|
onYearSelect?: (year: number) => void;
|
|
48
52
|
onMonthSelect?: (year: number, month: number) => void;
|
|
49
53
|
selectedDate?: Date;
|
|
54
|
+
timezone?: Timezone;
|
|
50
55
|
}
|
|
51
|
-
export declare const CalendarRenderer: ({ calendarOptions, children, allowYearMonthSelection, onYearSelect, onMonthSelect, selectedDate, ...props }: CalendarRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare const CalendarRenderer: ({ calendarOptions, children, allowYearMonthSelection, onYearSelect, onMonthSelect, selectedDate, timezone, ...props }: CalendarRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
52
57
|
export {};
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { Timezone } from './utils';
|
|
2
|
+
export interface DatePickerProps {
|
|
3
|
+
allowOnlyDatesList?: Array<Date>;
|
|
4
|
+
date?: Date;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
futureDatesDisabled?: boolean;
|
|
7
|
+
onSelectDate: (selectedDate: Date) => void;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
timezone?: Timezone;
|
|
10
|
+
}
|
|
11
|
+
export declare const DatePicker: ({ allowOnlyDatesList, date, disabled, futureDatesDisabled, onSelectDate, placeholder, timezone, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateRange } from './utils';
|
|
1
|
+
import { DateRange, Timezone } from './utils';
|
|
2
2
|
type OpenDirection = 'left' | 'right';
|
|
3
3
|
export interface DateRangePickerProps {
|
|
4
4
|
endDate?: Date;
|
|
@@ -12,6 +12,7 @@ export interface DateRangePickerProps {
|
|
|
12
12
|
maxRangeLength?: number;
|
|
13
13
|
startDate?: Date;
|
|
14
14
|
responsivePositioning?: boolean;
|
|
15
|
+
timezone?: Timezone;
|
|
15
16
|
}
|
|
16
|
-
export declare const DateRangePicker: ({ endDate, startDate, disabled, futureDatesDisabled, futureStartDatesDisabled, maxRangeLength, onSelectDateRange, openDirection, placeholder, predefinedDatesList, responsivePositioning, }: DateRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const DateRangePicker: ({ endDate, startDate, disabled, futureDatesDisabled, futureStartDatesDisabled, maxRangeLength, onSelectDateRange, openDirection, placeholder, predefinedDatesList, responsivePositioning, timezone, }: DateRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateRangeListItem } from './utils';
|
|
1
|
+
import { DateRangeListItem, Timezone } from './utils';
|
|
2
2
|
type OpenDirection = 'left' | 'right';
|
|
3
3
|
export type Tab = 'startDate' | 'endDate';
|
|
4
4
|
export interface DateTimeRangePickerProps {
|
|
@@ -15,6 +15,7 @@ export interface DateTimeRangePickerProps {
|
|
|
15
15
|
maxRangeLength?: number;
|
|
16
16
|
shouldShowSeconds?: boolean;
|
|
17
17
|
startDate?: Date;
|
|
18
|
+
timezone?: Timezone;
|
|
18
19
|
}
|
|
19
|
-
export declare const DateTimeRangePicker: ({ closeOnDateRangeSelected, defaultActiveTab, disabled, endDate, futureDatesDisabled, futureStartDatesDisabled, maxRangeLength, onSelectDateRange, openDirection, placeholder, predefinedTimesList, shouldShowSeconds, startDate, }: DateTimeRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const DateTimeRangePicker: ({ closeOnDateRangeSelected, defaultActiveTab, disabled, endDate, futureDatesDisabled, futureStartDatesDisabled, maxRangeLength, onSelectDateRange, openDirection, placeholder, predefinedTimesList, shouldShowSeconds, startDate, timezone, }: DateTimeRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DatePicker } from './DatePicker';
|
|
2
2
|
export { DateRangePicker } from './DateRangePicker';
|
|
3
3
|
export { DateTimeRangePicker } from './DateTimeRangePicker';
|
|
4
|
-
export type { DatePickerProps } from './DatePicker
|
|
4
|
+
export type { DatePickerProps } from './DatePicker';
|
|
5
5
|
export type { DateRangePickerProps } from './DateRangePicker';
|
|
6
6
|
export type { DateTimeRangePickerProps, Tab } from './DateTimeRangePicker';
|
|
7
|
+
export type { Timezone } from './utils';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type Timezone = 'system' | 'UTC';
|
|
1
2
|
export interface DateRange {
|
|
2
3
|
startDate: Date;
|
|
3
4
|
endDate: Date;
|
|
@@ -11,15 +12,15 @@ export interface DateRangeListItem {
|
|
|
11
12
|
dateRange: DateRange;
|
|
12
13
|
label: string;
|
|
13
14
|
}
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
15
|
+
export declare const formatSelectedDate: (timezone: Timezone, date: Date) => string;
|
|
16
|
+
export declare const formatWeekday: (timezone: Timezone, date: Date) => string;
|
|
17
|
+
export declare const formatSelectedDateTime: (timezone: Timezone, date: Date) => string;
|
|
18
|
+
export declare const formatSelectedDateTimeWithSeconds: (timezone: Timezone, date: Date) => string;
|
|
19
|
+
export declare const formatDateHeader: (timezone: Timezone, date: Date) => string;
|
|
20
|
+
export declare const shiftToTimezone: (date: Date, timezone: Timezone) => Date;
|
|
21
|
+
export declare const shiftFromTimezone: (date: Date, timezone: Timezone) => Date;
|
|
21
22
|
export declare const getPredefinedMonthsForDateRangePicker: (numberOfMonths: number) => DateRange[];
|
|
22
23
|
export declare const getPredefinedTimePeriodsForDateTimePicker: () => DateRangeListItem[];
|
|
23
24
|
export declare const getNextNDatesForDatePickerAllowOnlyList: (numberOfDays: number) => Date[];
|
|
24
25
|
export declare const datesAreWithinMaxRange: (startDate: Date, endDate: Date, maxRangeLength: number) => boolean;
|
|
25
|
-
export declare const isDateRangeTheWholeMonth: ({ startDate, endDate }: DateRange) => boolean;
|
|
26
|
+
export declare const isDateRangeTheWholeMonth: ({ startDate, endDate }: DateRange, timezone?: Timezone) => boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export type { DateRangePickerProps } from './components/DatePicker/DateRangePick
|
|
|
51
51
|
export { DateTimeRangePicker } from './components/DatePicker/DateTimeRangePicker';
|
|
52
52
|
export type { DateTimeRangePickerProps } from './components/DatePicker/DateTimeRangePicker';
|
|
53
53
|
export { getPredefinedMonthsForDateRangePicker } from './components/DatePicker/utils';
|
|
54
|
-
export type { DateRange } from './components/DatePicker/utils';
|
|
54
|
+
export type { DateRange, Timezone } from './components/DatePicker/utils';
|
|
55
55
|
export { Dialog } from './components/Dialog';
|
|
56
56
|
export type { DialogContentProps, DialogProps, DialogTriggerProps, } from './components/Dialog';
|
|
57
57
|
export { Dropdown } from './components/Dropdown';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clickhouse/click-ui",
|
|
3
|
-
"version": "v0.2.0-rc.
|
|
3
|
+
"version": "v0.2.0-rc.8",
|
|
4
4
|
"description": "Official ClickHouse design system react library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -383,7 +383,7 @@
|
|
|
383
383
|
"lint:code:fix": "eslint src --report-unused-disable-directives --fix",
|
|
384
384
|
"lint:css": "stylelint \"src/**/*.css\"",
|
|
385
385
|
"lint:css:fix": "stylelint \"src/**/*.css\" --fix",
|
|
386
|
-
"prepare": "
|
|
386
|
+
"prepare": "yarn test && yarn format && yarn lint && yarn changeset:verify && yarn circular-dependency:check",
|
|
387
387
|
"prettify": "yarn format:fix",
|
|
388
388
|
"preview": "vite preview",
|
|
389
389
|
"storybook": "storybook dev -p 6006",
|
|
@@ -463,7 +463,6 @@
|
|
|
463
463
|
"fs-extra": "^11.3.4",
|
|
464
464
|
"glob": "^13.0.6",
|
|
465
465
|
"globals": "^16.5.0",
|
|
466
|
-
"husky": "^9.1.7",
|
|
467
466
|
"jsdom": "^24.0.0",
|
|
468
467
|
"postcss": "^8.5.8",
|
|
469
468
|
"postcss-modules": "^6.0.1",
|