@headless-adminapp/fluent 1.4.27 → 1.4.29
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/DataGrid/GridTableContainer.js +14 -10
- package/Insights/Header.js +2 -2
- package/PageEntityForm/PageEntityFormDesktopContainer.js +3 -3
- package/QuickCreateContainer/FormContainer.js +1 -1
- package/components/LoginForm.js +1 -1
- package/components/fluent/FluentProvider.js +15 -0
- package/components/fluent/MessageBar.d.ts +4 -0
- package/components/fluent/MessageBar.js +17 -0
- package/components/fluent/Option.js +1 -1
- package/components/fluent/index.d.ts +1 -0
- package/components/fluent/index.js +3 -1
- package/components/fluent/tokens.d.ts +5 -0
- package/components/fluent/tokens.js +5 -0
- package/form/controls/DateControl.d.ts +1 -0
- package/form/controls/DateControl.js +43 -1
- package/form/controls/DateTimeControl.js +7 -3
- package/form/controls/TimeControl/TimeControl.d.ts +1 -0
- package/form/controls/TimeControl/TimeControl.js +12 -3
- package/package.json +2 -2
|
@@ -72,10 +72,19 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
72
72
|
alignItems: 'center',
|
|
73
73
|
},
|
|
74
74
|
table: {
|
|
75
|
-
'
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
display: 'flex',
|
|
76
|
+
flexDirection: 'column',
|
|
77
|
+
borderCollapse: 'collapse',
|
|
78
|
+
width: '100%',
|
|
79
|
+
userSelect: 'none',
|
|
80
|
+
WebkitUserSelect: 'none',
|
|
81
|
+
MozUserSelect: 'none',
|
|
82
|
+
msUserSelect: 'none',
|
|
83
|
+
'& *': {
|
|
84
|
+
userSelect: 'none',
|
|
85
|
+
WebkitUserSelect: 'none',
|
|
86
|
+
MozUserSelect: 'none',
|
|
87
|
+
msUserSelect: 'none',
|
|
79
88
|
},
|
|
80
89
|
},
|
|
81
90
|
});
|
|
@@ -211,16 +220,11 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
|
|
|
211
220
|
paddingInline: hPadding,
|
|
212
221
|
position: 'relative',
|
|
213
222
|
}, ref: tableWrapperRef, children: (0, jsx_runtime_1.jsxs)(react_components_1.Table, { style: {
|
|
214
|
-
display: 'flex',
|
|
215
|
-
flexDirection: 'column',
|
|
216
|
-
borderCollapse: 'collapse',
|
|
217
|
-
width: '100%',
|
|
218
223
|
height: virtualizer.getTotalSize() + headerHeight,
|
|
219
224
|
['--action-shadow']: !isScrolledToRight
|
|
220
225
|
? '-2px 0px 6px rgba(0, 0, 0, 0.12)'
|
|
221
226
|
: 'none',
|
|
222
|
-
|
|
223
|
-
}, ref: tableElementRef, tabIndex: 0, className: "table-pseduo", children: [(0, jsx_runtime_1.jsx)(react_components_1.TableHeader, { style: {
|
|
227
|
+
}, ref: tableElementRef, tabIndex: 0, className: (0, react_components_1.mergeClasses)('table-pseduo', styles.table), children: [(0, jsx_runtime_1.jsx)(react_components_1.TableHeader, { style: {
|
|
224
228
|
display: 'flex',
|
|
225
229
|
position: 'sticky',
|
|
226
230
|
top: 0,
|
package/Insights/Header.js
CHANGED
|
@@ -29,8 +29,8 @@ const Header = () => {
|
|
|
29
29
|
// ? tokens.colorNeutralBackground1
|
|
30
30
|
// : 'transparent',
|
|
31
31
|
// backdropFilter: isScrolled ? 'blur(15px)' : 'none',
|
|
32
|
-
backdropFilter: 'blur(
|
|
33
|
-
background: react_components_1.tokens.
|
|
32
|
+
backdropFilter: 'blur(20px)',
|
|
33
|
+
background: react_components_1.tokens.colorNeutralBackgroundAlpha2,
|
|
34
34
|
boxShadow: react_components_1.tokens.shadow4,
|
|
35
35
|
// backgroundColor: tokens.colorNeutralBackground1,
|
|
36
36
|
// backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
|
@@ -74,7 +74,7 @@ const PageEntityFormDesktopContainer = () => {
|
|
|
74
74
|
background: react_components_1.tokens.colorNeutralBackground1,
|
|
75
75
|
display: 'flex',
|
|
76
76
|
// overflow: 'hidden',
|
|
77
|
-
}, children: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, { skeleton: dataState.isFetching }) })), notifications.length > 0 && ((0, jsx_runtime_1.jsx)("div", { children: notifications.map((notification, index) => ((0, jsx_runtime_1.jsx)(
|
|
77
|
+
}, children: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, { skeleton: dataState.isFetching }) })), notifications.length > 0 && ((0, jsx_runtime_1.jsx)("div", { children: notifications.map((notification, index) => ((0, jsx_runtime_1.jsx)(fluent_1.MessageBar, { intent: notification.level, icon: null, children: (0, jsx_runtime_1.jsx)(react_components_1.MessageBarBody, { children: notification.message }) }, index))) })), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
78
78
|
display: 'flex',
|
|
79
79
|
flexDirection: 'column',
|
|
80
80
|
boxShadow: react_components_1.tokens.shadow4,
|
|
@@ -131,8 +131,8 @@ const Wrapper = ({ children, formHeaderDivRef, }) => {
|
|
|
131
131
|
const visible = !!rect && rect.bottom < headerHeight + tabContainerHeight;
|
|
132
132
|
if (isMobile) {
|
|
133
133
|
return ((0, jsx_runtime_1.jsxs)(ScrollView_1.ScrollView, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
134
|
-
background: react_components_1.tokens.
|
|
135
|
-
backdropFilter: 'blur(
|
|
134
|
+
background: react_components_1.tokens.colorNeutralBackgroundAlpha2,
|
|
135
|
+
backdropFilter: 'blur(20px)',
|
|
136
136
|
position: 'fixed',
|
|
137
137
|
transition: 'all 0.2s',
|
|
138
138
|
top: visible ? headerHeight : -headerHeight,
|
|
@@ -41,7 +41,7 @@ const FormContainer = ({ onClose, onCreate, }) => {
|
|
|
41
41
|
gap: react_components_1.tokens.spacingVerticalS,
|
|
42
42
|
paddingInline: react_components_1.tokens.spacingHorizontalS,
|
|
43
43
|
paddingTop: react_components_1.tokens.spacingVerticalS,
|
|
44
|
-
}, children: notifications.map((notification, index) => ((0, jsx_runtime_1.jsx)(
|
|
44
|
+
}, children: notifications.map((notification, index) => ((0, jsx_runtime_1.jsx)(fluent_1.MessageBar, { intent: notification.level, icon: null, children: (0, jsx_runtime_1.jsx)(react_components_1.MessageBarBody, { children: notification.message }) }, index))) }))] }) }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: {
|
|
45
45
|
display: 'flex',
|
|
46
46
|
flexDirection: 'column',
|
|
47
47
|
padding: react_components_1.tokens.spacingVerticalM,
|
package/components/LoginForm.js
CHANGED
|
@@ -79,7 +79,7 @@ function LoginForm(props) {
|
|
|
79
79
|
alignItems: 'stretch',
|
|
80
80
|
justifyContent: 'flex-start',
|
|
81
81
|
gap: 16,
|
|
82
|
-
}, children: [(0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: form.control, name: "username", render: ({ field, fieldState, formState }) => ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: "Username", labelPosition: "top", required: true, isError: !!fieldState.error?.message && formState.isSubmitted, errorMessage: fieldState.error?.message, children: (0, jsx_runtime_1.jsx)(TextControl_1.TextControl, { placeholder: "Username", appearance: "outline", name: field.name, value: field.value, onChange: field.onChange, onBlur: field.onBlur, autoCapitalize: "none", autoCorrect: "off", error: !!fieldState.error?.message && formState.isSubmitted }) })) }), (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: form.control, name: "password", render: ({ field, fieldState, formState }) => ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: "Password", labelPosition: "top", required: true, isError: !!fieldState.error?.message && formState.isSubmitted, errorMessage: fieldState.error?.message, children: (0, jsx_runtime_1.jsx)(PasswordControl_1.PasswordControl, { placeholder: "Password", name: field.name, appearance: "outline", error: !!fieldState.error?.message && formState.isSubmitted, value: field.value, onChange: field.onChange, onBlur: field.onBlur }) })) }), props.beforeLoginContent, !!form.formState.errors.root && ((0, jsx_runtime_1.jsx)(
|
|
82
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: form.control, name: "username", render: ({ field, fieldState, formState }) => ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: "Username", labelPosition: "top", required: true, isError: !!fieldState.error?.message && formState.isSubmitted, errorMessage: fieldState.error?.message, children: (0, jsx_runtime_1.jsx)(TextControl_1.TextControl, { placeholder: "Username", appearance: "outline", name: field.name, value: field.value, onChange: field.onChange, onBlur: field.onBlur, autoCapitalize: "none", autoCorrect: "off", error: !!fieldState.error?.message && formState.isSubmitted }) })) }), (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: form.control, name: "password", render: ({ field, fieldState, formState }) => ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: "Password", labelPosition: "top", required: true, isError: !!fieldState.error?.message && formState.isSubmitted, errorMessage: fieldState.error?.message, children: (0, jsx_runtime_1.jsx)(PasswordControl_1.PasswordControl, { placeholder: "Password", name: field.name, appearance: "outline", error: !!fieldState.error?.message && formState.isSubmitted, value: field.value, onChange: field.onChange, onBlur: field.onBlur }) })) }), props.beforeLoginContent, !!form.formState.errors.root && ((0, jsx_runtime_1.jsx)(fluent_1.MessageBar, { intent: "error", children: (0, jsx_runtime_1.jsx)(react_components_1.MessageBarBody, { children: form.formState.errors.root.message }) })), (0, jsx_runtime_1.jsxs)(fluent_1.Button, { appearance: "primary", type: "submit", style: {
|
|
83
83
|
marginTop: 8,
|
|
84
84
|
pointerEvents: form.formState.isSubmitting ? 'none' : 'auto',
|
|
85
85
|
}, children: [form.formState.isSubmitting && ((0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny", appearance: "inverted", style: { marginRight: 4 } })), "Login"] }), props.afterLoginContent] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 80 } })] }) }));
|
|
@@ -65,6 +65,11 @@ exports.FluentProvider = (0, react_1.forwardRef)(function FluentProvider({ corne
|
|
|
65
65
|
let optionPaddingVertical = '6px';
|
|
66
66
|
let appBarHeight = '48px';
|
|
67
67
|
let navItempaddingVertical = '10px';
|
|
68
|
+
let calendarTableWidth = '196px';
|
|
69
|
+
let calendarDayCellSize = '24px';
|
|
70
|
+
let calendarHeaderIconSize = '28px';
|
|
71
|
+
let calendarPickerItemButtonSize = '40px';
|
|
72
|
+
let calendarGoTodayButtonHeight = '30px';
|
|
68
73
|
if (density === 'comfortable') {
|
|
69
74
|
buttonMinWidthS = '72px';
|
|
70
75
|
buttonMinWidthM = '112px';
|
|
@@ -79,6 +84,11 @@ exports.FluentProvider = (0, react_1.forwardRef)(function FluentProvider({ corne
|
|
|
79
84
|
optionPaddingVertical = '9px';
|
|
80
85
|
appBarHeight = '64px';
|
|
81
86
|
navItempaddingVertical = '16px';
|
|
87
|
+
calendarTableWidth = '252px';
|
|
88
|
+
calendarDayCellSize = '32px';
|
|
89
|
+
calendarHeaderIconSize = '36px';
|
|
90
|
+
calendarPickerItemButtonSize = '54px';
|
|
91
|
+
calendarGoTodayButtonHeight = '36px';
|
|
82
92
|
}
|
|
83
93
|
let fontSizeBase100 = '10px';
|
|
84
94
|
let fontSizeBase200 = '12px';
|
|
@@ -143,6 +153,11 @@ exports.FluentProvider = (0, react_1.forwardRef)(function FluentProvider({ corne
|
|
|
143
153
|
optionPaddingVertical,
|
|
144
154
|
navItempaddingVertical,
|
|
145
155
|
appBarHeight,
|
|
156
|
+
calendarTableWidth,
|
|
157
|
+
calendarDayCellSize,
|
|
158
|
+
calendarHeaderIconSize,
|
|
159
|
+
calendarPickerItemButtonSize,
|
|
160
|
+
calendarGoTodayButtonHeight,
|
|
146
161
|
fontSizeBase100,
|
|
147
162
|
fontSizeBase200,
|
|
148
163
|
fontSizeBase300,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageBar = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const tokens_1 = require("./tokens");
|
|
8
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
9
|
+
root: {
|
|
10
|
+
fontWeight: react_components_1.tokens.fontWeightRegular,
|
|
11
|
+
borderRadius: tokens_1.extendedTokens.controlBorderRadius,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
exports.MessageBar = (0, react_1.forwardRef)(function MessageBar({ className, ...rest }, ref) {
|
|
15
|
+
const styles = useStyles();
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.MessageBar, { ...rest, className: (0, react_components_1.mergeClasses)(styles.root, className), ref: ref }));
|
|
17
|
+
});
|
|
@@ -8,7 +8,7 @@ const tokens_1 = require("./tokens");
|
|
|
8
8
|
const useStyles = (0, react_components_1.makeStyles)({
|
|
9
9
|
root: {
|
|
10
10
|
borderRadius: tokens_1.extendedTokens.controlBorderRadius,
|
|
11
|
-
|
|
11
|
+
padding: `${tokens_1.extendedTokens.optionPaddingVertical} ${react_components_1.tokens.spacingHorizontalS}`,
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
14
|
exports.Option = (0, react_1.forwardRef)(function Option({ className, ...rest }, ref) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DialogSurface = exports.PopoverSurface = exports.MenuItem = exports.Checkbox = exports.Option = exports.tokens = exports.extendedTokens = exports.FluentProvider = exports.SearchBox = exports.MenuPopover = exports.ToolbarButton = exports.SpinButton = exports.Dropdown = exports.Tag = exports.Combobox = exports.Textarea = exports.Input = exports.Button = void 0;
|
|
3
|
+
exports.MessageBar = exports.DialogSurface = exports.PopoverSurface = exports.MenuItem = exports.Checkbox = exports.Option = exports.tokens = exports.extendedTokens = exports.FluentProvider = exports.SearchBox = exports.MenuPopover = exports.ToolbarButton = exports.SpinButton = exports.Dropdown = exports.Tag = exports.Combobox = exports.Textarea = exports.Input = exports.Button = void 0;
|
|
4
4
|
var Button_1 = require("./Button");
|
|
5
5
|
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
|
|
6
6
|
var Input_1 = require("./Input");
|
|
@@ -36,3 +36,5 @@ var PopoverSurface_1 = require("./PopoverSurface");
|
|
|
36
36
|
Object.defineProperty(exports, "PopoverSurface", { enumerable: true, get: function () { return PopoverSurface_1.PopoverSurface; } });
|
|
37
37
|
var DialogSurface_1 = require("./DialogSurface");
|
|
38
38
|
Object.defineProperty(exports, "DialogSurface", { enumerable: true, get: function () { return DialogSurface_1.DialogSurface; } });
|
|
39
|
+
var MessageBar_1 = require("./MessageBar");
|
|
40
|
+
Object.defineProperty(exports, "MessageBar", { enumerable: true, get: function () { return MessageBar_1.MessageBar; } });
|
|
@@ -24,6 +24,11 @@ export type ExtendedTokens = {
|
|
|
24
24
|
optionPaddingVertical: string;
|
|
25
25
|
appBarHeight: string;
|
|
26
26
|
navItempaddingVertical: string;
|
|
27
|
+
calendarTableWidth: string;
|
|
28
|
+
calendarDayCellSize: string;
|
|
29
|
+
calendarHeaderIconSize: string;
|
|
30
|
+
calendarPickerItemButtonSize: string;
|
|
31
|
+
calendarGoTodayButtonHeight: string;
|
|
27
32
|
};
|
|
28
33
|
export { tokens } from '@fluentui/react-components';
|
|
29
34
|
export declare const extendedTokens: ExtendedTokens;
|
|
@@ -29,4 +29,9 @@ exports.extendedTokens = {
|
|
|
29
29
|
optionPaddingVertical: 'var(--optionPaddingVertical)',
|
|
30
30
|
appBarHeight: 'var(--appBarHeight)',
|
|
31
31
|
navItempaddingVertical: 'var(--navItempaddingVertical)',
|
|
32
|
+
calendarTableWidth: 'var(--calendarTableWidth)',
|
|
33
|
+
calendarDayCellSize: 'var(--calendarDayCellSize)',
|
|
34
|
+
calendarHeaderIconSize: 'var(--calendarHeaderIconSize)',
|
|
35
|
+
calendarPickerItemButtonSize: 'var(--calendarPickerItemButtonSize)',
|
|
36
|
+
calendarGoTodayButtonHeight: 'var(--calendarGoTodayButtonHeight)',
|
|
32
37
|
};
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useCalendarStyles = void 0;
|
|
6
7
|
exports.DateControl = DateControl;
|
|
7
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
9
|
const react_calendar_compat_1 = require("@fluentui/react-calendar-compat");
|
|
@@ -18,9 +19,48 @@ const fluent_1 = require("../../components/fluent");
|
|
|
18
19
|
const SkeletonControl_1 = require("./SkeletonControl");
|
|
19
20
|
dayjs_1.default.extend(utc_1.default);
|
|
20
21
|
dayjs_1.default.extend(timezone_1.default);
|
|
22
|
+
exports.useCalendarStyles = (0, react_components_1.makeStyles)({
|
|
23
|
+
calendar: {
|
|
24
|
+
width: `calc(${fluent_1.extendedTokens.calendarTableWidth} + 24px)`,
|
|
25
|
+
'& .fui-CalendarDay': {
|
|
26
|
+
width: fluent_1.extendedTokens.calendarTableWidth,
|
|
27
|
+
},
|
|
28
|
+
'& .fui-CalendarDayGrid__table': {
|
|
29
|
+
width: fluent_1.extendedTokens.calendarTableWidth,
|
|
30
|
+
},
|
|
31
|
+
'& .fui-CalendarDayGrid__dayButton': {
|
|
32
|
+
width: fluent_1.extendedTokens.calendarDayCellSize,
|
|
33
|
+
height: fluent_1.extendedTokens.calendarDayCellSize,
|
|
34
|
+
lineHeight: fluent_1.extendedTokens.calendarDayCellSize,
|
|
35
|
+
},
|
|
36
|
+
'& .fui-CalendarDay__headerIconButton': {
|
|
37
|
+
width: fluent_1.extendedTokens.calendarHeaderIconSize,
|
|
38
|
+
height: fluent_1.extendedTokens.calendarHeaderIconSize,
|
|
39
|
+
lineHeight: fluent_1.extendedTokens.calendarHeaderIconSize,
|
|
40
|
+
},
|
|
41
|
+
'& .fui-CalendarPicker__navigationButton': {
|
|
42
|
+
width: fluent_1.extendedTokens.calendarHeaderIconSize,
|
|
43
|
+
height: fluent_1.extendedTokens.calendarHeaderIconSize,
|
|
44
|
+
lineHeight: fluent_1.extendedTokens.calendarHeaderIconSize,
|
|
45
|
+
},
|
|
46
|
+
'& .fui-CalendarPicker__itemButton': {
|
|
47
|
+
width: fluent_1.extendedTokens.calendarPickerItemButtonSize,
|
|
48
|
+
height: fluent_1.extendedTokens.calendarPickerItemButtonSize,
|
|
49
|
+
lineHeight: fluent_1.extendedTokens.calendarPickerItemButtonSize,
|
|
50
|
+
},
|
|
51
|
+
'& .fui-CalendarPicker': {
|
|
52
|
+
width: fluent_1.extendedTokens.calendarTableWidth,
|
|
53
|
+
},
|
|
54
|
+
'& .fui-Calendar__goTodayButton': {
|
|
55
|
+
height: fluent_1.extendedTokens.calendarGoTodayButtonHeight,
|
|
56
|
+
lineHeight: fluent_1.extendedTokens.calendarGoTodayButtonHeight,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
21
60
|
function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, skeleton, }) {
|
|
22
61
|
const { dateFormats } = (0, locale_1.useLocale)();
|
|
23
62
|
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
63
|
+
const calendarStyles = (0, exports.useCalendarStyles)();
|
|
24
64
|
if (skeleton) {
|
|
25
65
|
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
26
66
|
}
|
|
@@ -44,5 +84,7 @@ function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder,
|
|
|
44
84
|
justifyContent: 'center',
|
|
45
85
|
marginRight: -4,
|
|
46
86
|
color: react_components_1.tokens.colorNeutralForeground2,
|
|
47
|
-
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Calendar, { size: 20 }) })
|
|
87
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Calendar, { size: 20 }) }), calendar: {
|
|
88
|
+
className: calendarStyles.calendar,
|
|
89
|
+
} }));
|
|
48
90
|
}
|
|
@@ -16,12 +16,16 @@ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
|
16
16
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
17
17
|
const react_1 = require("react");
|
|
18
18
|
const fluent_1 = require("../../components/fluent");
|
|
19
|
+
const DateControl_1 = require("./DateControl");
|
|
19
20
|
const SkeletonControl_1 = require("./SkeletonControl");
|
|
21
|
+
const TimeControl_1 = require("./TimeControl/TimeControl");
|
|
20
22
|
const utils_1 = require("./TimeControl/utils");
|
|
21
23
|
dayjs_1.default.extend(customParseFormat_1.default);
|
|
22
24
|
dayjs_1.default.extend(utc_1.default);
|
|
23
25
|
dayjs_1.default.extend(timezone_1.default);
|
|
24
26
|
function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, skeleton, }) {
|
|
27
|
+
const calendarStyles = (0, DateControl_1.useCalendarStyles)();
|
|
28
|
+
const timePickerStyles = (0, TimeControl_1.useTimePickerStyles)();
|
|
25
29
|
const { dateFormats: { short: dateFormat }, timeFormats: { short: timeFormat }, timezone, } = (0, locale_1.useLocale)();
|
|
26
30
|
const [internalTimeValue, setInternalTimeValue] = (0, react_1.useState)(value ? (0, dayjs_1.default)(value).tz(timezone).format(timeFormat) : '');
|
|
27
31
|
const internalTimeValueRef = (0, react_1.useRef)(internalTimeValue);
|
|
@@ -90,6 +94,8 @@ function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
90
94
|
style: {
|
|
91
95
|
borderRadius: fluent_1.extendedTokens.paperBorderRadius,
|
|
92
96
|
},
|
|
97
|
+
}, calendar: {
|
|
98
|
+
className: calendarStyles.calendar,
|
|
93
99
|
} }), (0, jsx_runtime_1.jsx)(react_timepicker_compat_1.TimePicker, { appearance: "filled-darker", style: {
|
|
94
100
|
flex: 1,
|
|
95
101
|
minWidth: 0,
|
|
@@ -144,8 +150,6 @@ function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
144
150
|
marginRight: -4,
|
|
145
151
|
color: react_components_1.tokens.colorNeutralForeground2,
|
|
146
152
|
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Clock, { size: 20 }) }), listbox: {
|
|
147
|
-
|
|
148
|
-
borderRadius: fluent_1.extendedTokens.paperBorderRadius,
|
|
149
|
-
},
|
|
153
|
+
className: timePickerStyles.listbox,
|
|
150
154
|
} })] }));
|
|
151
155
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ControlProps } from '../types';
|
|
2
|
+
export declare const useTimePickerStyles: () => Record<"listbox", string>;
|
|
2
3
|
export interface TimeControlProps extends ControlProps<number> {
|
|
3
4
|
}
|
|
4
5
|
export declare function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled, readOnly, skeleton, }: Readonly<TimeControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useTimePickerStyles = void 0;
|
|
6
7
|
exports.TimeControl = TimeControl;
|
|
7
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
9
|
const react_components_1 = require("@fluentui/react-components");
|
|
@@ -16,7 +17,17 @@ const fluent_1 = require("../../../components/fluent");
|
|
|
16
17
|
const SkeletonControl_1 = require("../SkeletonControl");
|
|
17
18
|
const utils_1 = require("./utils");
|
|
18
19
|
dayjs_1.default.extend(customParseFormat_1.default);
|
|
20
|
+
exports.useTimePickerStyles = (0, react_components_1.makeStyles)({
|
|
21
|
+
listbox: {
|
|
22
|
+
borderRadius: fluent_1.extendedTokens.paperBorderRadius,
|
|
23
|
+
'& .fui-Option': {
|
|
24
|
+
borderRadius: fluent_1.extendedTokens.controlBorderRadius,
|
|
25
|
+
padding: `${fluent_1.extendedTokens.optionPaddingVertical} ${react_components_1.tokens.spacingHorizontalS}`,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
19
29
|
function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled, readOnly, skeleton, }) {
|
|
30
|
+
const timePickerStyles = (0, exports.useTimePickerStyles)();
|
|
20
31
|
const { timeFormats: { short: timeFormat }, timezone, } = (0, locale_1.useLocale)();
|
|
21
32
|
const [internalTimeValue, setInternalTimeValue] = (0, react_1.useState)(value ? (0, dayjs_1.default)().startOf('day').add(value, 'minutes').format(timeFormat) : '');
|
|
22
33
|
const internalTimeValueRef = (0, react_1.useRef)(internalTimeValue);
|
|
@@ -82,8 +93,6 @@ function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled,
|
|
|
82
93
|
marginRight: -4,
|
|
83
94
|
color: react_components_1.tokens.colorNeutralForeground2,
|
|
84
95
|
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Clock, { size: 20 }) }), listbox: {
|
|
85
|
-
|
|
86
|
-
borderRadius: fluent_1.extendedTokens.paperBorderRadius,
|
|
87
|
-
},
|
|
96
|
+
className: timePickerStyles.listbox,
|
|
88
97
|
} }) }));
|
|
89
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.29",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/lodash": "4.17.20"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "bf59bd13938acd5768f93b2524fe58e103981395"
|
|
58
58
|
}
|