@os-design/core 1.0.283 → 1.0.285
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/DateCalendar/index.d.ts.map +1 -1
- package/dist/DateCalendar/index.js +27 -21
- package/dist/InputDateUnstyled/index.d.ts.map +1 -1
- package/dist/InputDateUnstyled/index.js +4 -1
- package/package.json +2 -2
- package/src/DateCalendar/index.tsx +28 -25
- package/src/InputDateUnstyled/index.tsx +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateCalendar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAErE,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateCalendar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAErE,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAG1D,KAAK,WAAW,GAAG,IAAI,CACrB,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAC5B,cAAc,GAAG,UAAU,GAAG,KAAK,CACpC,CAAC;AACF,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D;;;OAGG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC;CACxC;AAED;;GAEG;AACH,QAAA,MAAM,YAAY,8GAqFjB,CAAC;AAIF,eAAe,YAAY,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
3
3
|
import Calendar from './Calendar.js';
|
|
4
4
|
import { defaultLocale } from './locale.js';
|
|
5
5
|
import MonthPicker from './MonthPicker.js';
|
|
6
|
+
import { light, ThemeOverrider } from '@os-design/theming';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
/**
|
|
8
9
|
* The component to choose a date in a calendar.
|
|
@@ -49,27 +50,32 @@ const DateCalendar = /*#__PURE__*/forwardRef(({
|
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
}, [forwardedValue]);
|
|
52
|
-
return /*#__PURE__*/_jsx(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
53
|
+
return /*#__PURE__*/_jsx(ThemeOverrider, {
|
|
54
|
+
overrides: {
|
|
55
|
+
baseHeight: light.baseHeight
|
|
56
|
+
},
|
|
57
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
58
|
+
...rest,
|
|
59
|
+
ref: ref,
|
|
60
|
+
children: showMonthPicker ? /*#__PURE__*/_jsx(MonthPicker, {
|
|
61
|
+
locale: locale,
|
|
62
|
+
month: displayedMonth,
|
|
63
|
+
onChangeMonth: month => {
|
|
64
|
+
setDisplayedMonth(month);
|
|
65
|
+
setShowMonthPicker(false);
|
|
66
|
+
},
|
|
67
|
+
today: today
|
|
68
|
+
}) : /*#__PURE__*/_jsx(Calendar, {
|
|
69
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
70
|
+
disabledDays: disabledDays,
|
|
71
|
+
locale: locale,
|
|
72
|
+
value: forwardedValue,
|
|
73
|
+
onChange: setForwardedValue,
|
|
74
|
+
month: displayedMonth,
|
|
75
|
+
onChangeMonth: setDisplayedMonth,
|
|
76
|
+
onSelectMonth: () => setShowMonthPicker(true),
|
|
77
|
+
today: today
|
|
78
|
+
})
|
|
73
79
|
})
|
|
74
80
|
});
|
|
75
81
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/InputDateUnstyled/index.tsx"],"names":[],"mappings":"AAcA,OAAoB,EAAE,KAAK,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAqB,EAAE,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIlE,eAAO,MAAM,MAAM,6DAST,CAAC;AACX,eAAO,MAAM,aAAa,UAA+C,CAAC;AAE1E,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5C,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,KAAK,aAAa,GAAG,IAAI,CACvB,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAC9B,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,KAAK,CAC9C,CAAC;AAEF,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;O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AAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClE,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AAEjC,eAAe,iBAAiB,CAAC"}
|
|
@@ -45,12 +45,15 @@ const InputDateUnstyled = /*#__PURE__*/forwardRef(({
|
|
|
45
45
|
onChange: onSelectionChange
|
|
46
46
|
});
|
|
47
47
|
const defaultInputValue = useMemo(() => {
|
|
48
|
+
if (value) {
|
|
49
|
+
return dateToString(value, format);
|
|
50
|
+
}
|
|
48
51
|
let res = format;
|
|
49
52
|
tokens.forEach(token => {
|
|
50
53
|
res = res.replaceAll(token, '_'.repeat(token.length));
|
|
51
54
|
});
|
|
52
55
|
return res;
|
|
53
|
-
}, [format]);
|
|
56
|
+
}, [format, value]);
|
|
54
57
|
const [forwardedInputValue, setForwardedInputValue] = useForwardedState({
|
|
55
58
|
value: inputValue,
|
|
56
59
|
defaultValue: defaultInputValue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-design/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.285",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design.git",
|
|
6
6
|
"type": "module",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react": "18",
|
|
59
59
|
"react-dom": "18"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "9d50e82f5c687ed71117b044c715f2f2433b37bf"
|
|
62
62
|
}
|
|
@@ -4,6 +4,7 @@ import Calendar from './Calendar.js';
|
|
|
4
4
|
import { defaultLocale, type DateCalendarLocale } from './locale.js';
|
|
5
5
|
import MonthPicker from './MonthPicker.js';
|
|
6
6
|
import type { Day, Month } from './utils/calendarDays.js';
|
|
7
|
+
import { light, ThemeOverrider } from '@os-design/theming';
|
|
7
8
|
|
|
8
9
|
type JsxDivProps = Omit<
|
|
9
10
|
JSX.IntrinsicElements['div'],
|
|
@@ -101,31 +102,33 @@ const DateCalendar = forwardRef<HTMLDivElement, DateCalendarProps>(
|
|
|
101
102
|
}, [forwardedValue]);
|
|
102
103
|
|
|
103
104
|
return (
|
|
104
|
-
<
|
|
105
|
-
{
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
105
|
+
<ThemeOverrider overrides={{ baseHeight: light.baseHeight }}>
|
|
106
|
+
<div {...rest} ref={ref}>
|
|
107
|
+
{showMonthPicker ? (
|
|
108
|
+
<MonthPicker
|
|
109
|
+
locale={locale}
|
|
110
|
+
month={displayedMonth}
|
|
111
|
+
onChangeMonth={(month) => {
|
|
112
|
+
setDisplayedMonth(month);
|
|
113
|
+
setShowMonthPicker(false);
|
|
114
|
+
}}
|
|
115
|
+
today={today}
|
|
116
|
+
/>
|
|
117
|
+
) : (
|
|
118
|
+
<Calendar
|
|
119
|
+
firstDayOfWeek={firstDayOfWeek}
|
|
120
|
+
disabledDays={disabledDays}
|
|
121
|
+
locale={locale}
|
|
122
|
+
value={forwardedValue}
|
|
123
|
+
onChange={setForwardedValue}
|
|
124
|
+
month={displayedMonth}
|
|
125
|
+
onChangeMonth={setDisplayedMonth}
|
|
126
|
+
onSelectMonth={() => setShowMonthPicker(true)}
|
|
127
|
+
today={today}
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
130
|
+
</div>
|
|
131
|
+
</ThemeOverrider>
|
|
129
132
|
);
|
|
130
133
|
}
|
|
131
134
|
);
|
|
@@ -143,12 +143,15 @@ const InputDateUnstyled = forwardRef<HTMLInputElement, InputDateUnstyledProps>(
|
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
const defaultInputValue = useMemo(() => {
|
|
146
|
+
if (value) {
|
|
147
|
+
return dateToString(value, format);
|
|
148
|
+
}
|
|
146
149
|
let res = format;
|
|
147
150
|
tokens.forEach((token) => {
|
|
148
151
|
res = res.replaceAll(token, '_'.repeat(token.length));
|
|
149
152
|
});
|
|
150
153
|
return res;
|
|
151
|
-
}, [format]);
|
|
154
|
+
}, [format, value]);
|
|
152
155
|
|
|
153
156
|
const [forwardedInputValue, setForwardedInputValue] = useForwardedState({
|
|
154
157
|
value: inputValue,
|