handy-fluentui 0.1.0
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/README.md +681 -0
- package/dist/components/fui-button-panel.d.ts +13 -0
- package/dist/components/fui-button-panel.d.ts.map +1 -0
- package/dist/components/fui-image-carousell.d.ts +17 -0
- package/dist/components/fui-image-carousell.d.ts.map +1 -0
- package/dist/components/fui-tab.d.ts +29 -0
- package/dist/components/fui-tab.d.ts.map +1 -0
- package/dist/components/fui-table.d.ts +89 -0
- package/dist/components/fui-table.d.ts.map +1 -0
- package/dist/components/input-checkbox.d.ts +17 -0
- package/dist/components/input-checkbox.d.ts.map +1 -0
- package/dist/components/input-date.d.ts +27 -0
- package/dist/components/input-date.d.ts.map +1 -0
- package/dist/components/input-dropdown.d.ts +33 -0
- package/dist/components/input-dropdown.d.ts.map +1 -0
- package/dist/components/input-group.d.ts +25 -0
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-multi-lang.d.ts +35 -0
- package/dist/components/input-multi-lang.d.ts.map +1 -0
- package/dist/components/input-number.d.ts +39 -0
- package/dist/components/input-number.d.ts.map +1 -0
- package/dist/components/input-radio.d.ts +33 -0
- package/dist/components/input-radio.d.ts.map +1 -0
- package/dist/components/input-switch.d.ts +17 -0
- package/dist/components/input-switch.d.ts.map +1 -0
- package/dist/components/input-text.d.ts +19 -0
- package/dist/components/input-text.d.ts.map +1 -0
- package/dist/components/input-textarea.d.ts +20 -0
- package/dist/components/input-textarea.d.ts.map +1 -0
- package/dist/components/input-time.d.ts +31 -0
- package/dist/components/input-time.d.ts.map +1 -0
- package/dist/components/with-input-field.d.ts +49 -0
- package/dist/components/with-input-field.d.ts.map +1 -0
- package/dist/contexts/breadcrumb-context.d.ts +20 -0
- package/dist/contexts/breadcrumb-context.d.ts.map +1 -0
- package/dist/contexts/dialog-context.d.ts +28 -0
- package/dist/contexts/dialog-context.d.ts.map +1 -0
- package/dist/contexts/handy-fluent-ui-context.d.ts +48 -0
- package/dist/contexts/handy-fluent-ui-context.d.ts.map +1 -0
- package/dist/contexts/spinner-context.d.ts +19 -0
- package/dist/contexts/spinner-context.d.ts.map +1 -0
- package/dist/contexts/toast-context.d.ts +17 -0
- package/dist/contexts/toast-context.d.ts.map +1 -0
- package/dist/hooks/use-breadcrumb.d.ts +19 -0
- package/dist/hooks/use-breadcrumb.d.ts.map +1 -0
- package/dist/hooks/use-dialog.d.ts +6 -0
- package/dist/hooks/use-dialog.d.ts.map +1 -0
- package/dist/hooks/use-logger.d.ts +9 -0
- package/dist/hooks/use-logger.d.ts.map +1 -0
- package/dist/hooks/use-mobile.d.ts +4 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-spinner.d.ts +7 -0
- package/dist/hooks/use-spinner.d.ts.map +1 -0
- package/dist/hooks/use-theme.d.ts +8 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-time-zone.d.ts +17 -0
- package/dist/hooks/use-time-zone.d.ts.map +1 -0
- package/dist/hooks/use-toast.d.ts +9 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1571 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/breadcrumb-provider.d.ts +10 -0
- package/dist/providers/breadcrumb-provider.d.ts.map +1 -0
- package/dist/providers/dialog-provider.d.ts +6 -0
- package/dist/providers/dialog-provider.d.ts.map +1 -0
- package/dist/providers/handy-fluent-ui-provider.d.ts +10 -0
- package/dist/providers/handy-fluent-ui-provider.d.ts.map +1 -0
- package/dist/providers/spinner-provider.d.ts +10 -0
- package/dist/providers/spinner-provider.d.ts.map +1 -0
- package/dist/providers/toast-provider.d.ts +9 -0
- package/dist/providers/toast-provider.d.ts.map +1 -0
- package/dist/utils/string-util.d.ts +4 -0
- package/dist/utils/string-util.d.ts.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type BaseDialogButton = {
|
|
2
|
+
label: string;
|
|
3
|
+
icon?: React.ReactElement;
|
|
4
|
+
};
|
|
5
|
+
/** Primary CTA button; action is required. */
|
|
6
|
+
type PositiveDialogButton = BaseDialogButton & {
|
|
7
|
+
action: () => void;
|
|
8
|
+
};
|
|
9
|
+
/** Secondary or tertiary button; action is optional. */
|
|
10
|
+
type NegativeDialogButton = BaseDialogButton & {
|
|
11
|
+
action?: () => void;
|
|
12
|
+
};
|
|
13
|
+
/** Props for openDialog(). primaryButton appears on the right; secondary/tertiary are to its left in order. */
|
|
14
|
+
type ConfirmationDialogProps = {
|
|
15
|
+
title: string;
|
|
16
|
+
content: string;
|
|
17
|
+
primaryButton: PositiveDialogButton;
|
|
18
|
+
secondaryButton?: NegativeDialogButton;
|
|
19
|
+
tertiaryButton?: NegativeDialogButton;
|
|
20
|
+
};
|
|
21
|
+
type DialogContextType = {
|
|
22
|
+
/** Opens the global confirmation dialog. */
|
|
23
|
+
openDialog: (dialogProps: ConfirmationDialogProps) => void;
|
|
24
|
+
};
|
|
25
|
+
declare const DialogContext: import('react').Context<DialogContextType>;
|
|
26
|
+
export { DialogContext as FuiDialogContext };
|
|
27
|
+
export type { ConfirmationDialogProps };
|
|
28
|
+
//# sourceMappingURL=dialog-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-context.d.ts","sourceRoot":"","sources":["../../src/contexts/dialog-context.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;CAAE,CAAC;AACrE,8CAA8C;AAC9C,KAAK,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AACtE,wDAAwD;AACxD,KAAK,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEvE,+GAA+G;AAC/G,KAAK,uBAAuB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,oBAAoB,CAAC;IACpC,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,cAAc,CAAC,EAAE,oBAAoB,CAAC;CACvC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,4CAA4C;IAC5C,UAAU,EAAE,CAAC,WAAW,EAAE,uBAAuB,KAAK,IAAI,CAAC;CAC5D,CAAC;AAEF,QAAA,MAAM,aAAa,4CAGjB,CAAC;AAEH,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,CAAC;AAC7C,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Theme } from '@fluentui/react-components';
|
|
2
|
+
import { SpinnerContextConfig } from './spinner-context';
|
|
3
|
+
import { ToastContextConfig } from './toast-context';
|
|
4
|
+
/** Provider-level configuration for spinner and toast. */
|
|
5
|
+
type Component = {
|
|
6
|
+
spinner?: SpinnerContextConfig;
|
|
7
|
+
toast?: ToastContextConfig;
|
|
8
|
+
};
|
|
9
|
+
/** Active theme key. 'custom' is only selectable when a custom Theme object is supplied in SupportedTheme. */
|
|
10
|
+
type ThemeType = 'light' | 'dark' | 'custom';
|
|
11
|
+
/** Per-slot theme objects for one platform. Omit a key to fall back to the built-in FluentUI theme. */
|
|
12
|
+
type ThemeMapping = {
|
|
13
|
+
light?: Theme;
|
|
14
|
+
dark?: Theme;
|
|
15
|
+
custom?: Theme;
|
|
16
|
+
};
|
|
17
|
+
/** Separate theme sets for web and mobile viewports, plus an optional startup default. */
|
|
18
|
+
type SupportedTheme = {
|
|
19
|
+
web?: ThemeMapping;
|
|
20
|
+
mobile?: ThemeMapping;
|
|
21
|
+
default?: ThemeType;
|
|
22
|
+
};
|
|
23
|
+
/** Severity levels for logMessage and useLogger. */
|
|
24
|
+
type LoggingLevel = 'info' | 'warn' | 'error' | 'debug';
|
|
25
|
+
/** Configuration prop of HandyFluentUiProvider. All fields are optional; sensible defaults are provided. */
|
|
26
|
+
type HandyFluentUiConfig = {
|
|
27
|
+
/** Viewport width (px) at which the mobile layout activates. Defaults to 600. */
|
|
28
|
+
mobileBreakpoint?: number;
|
|
29
|
+
supportedTheme?: SupportedTheme;
|
|
30
|
+
component?: Component;
|
|
31
|
+
loggerConfig?: {
|
|
32
|
+
/** Custom logger. Defaults to console.log with a [LEVEL] prefix when omitted. */
|
|
33
|
+
logMessage?: (message: string, level: LoggingLevel) => void;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/** Context shape consumed by useTheme, useLogger, and useIsMobile. */
|
|
37
|
+
type HandyFluentUiContextType = {
|
|
38
|
+
selectedTheme: ThemeType;
|
|
39
|
+
supportedThemeType: ThemeType[];
|
|
40
|
+
switchTheme: (themeType: ThemeType) => void;
|
|
41
|
+
mobileBreakpoint: number;
|
|
42
|
+
timeZone: string;
|
|
43
|
+
logMessage: (message: string, level?: LoggingLevel) => void;
|
|
44
|
+
};
|
|
45
|
+
declare const HandyFluentUiContext: import('react').Context<HandyFluentUiContextType | undefined>;
|
|
46
|
+
export { HandyFluentUiContext };
|
|
47
|
+
export type { Component, ThemeType, SupportedTheme, LoggingLevel, HandyFluentUiConfig, HandyFluentUiContextType, };
|
|
48
|
+
//# sourceMappingURL=handy-fluent-ui-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handy-fluent-ui-context.d.ts","sourceRoot":"","sources":["../../src/contexts/handy-fluent-ui-context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACN,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIrD,0DAA0D;AAC1D,KAAK,SAAS,GAAG;IACf,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAIF,8GAA8G;AAC9G,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7C,uGAAuG;AACvG,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,0FAA0F;AAC1F,KAAK,cAAc,GAAG;IACpB,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAIF,oDAAoD;AACpD,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAIxD,4GAA4G;AAC5G,KAAK,mBAAmB,GAAG;IACzB,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE;QACb,iFAAiF;QACjF,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;KAC7D,CAAC;CACH,CAAC;AAEF,sEAAsE;AACtE,KAAK,wBAAwB,GAAG;IAC9B,aAAa,EAAE,SAAS,CAAC;IACzB,kBAAkB,EAAE,SAAS,EAAE,CAAC;IAChC,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAC5C,gBAAgB,EAAE,MAAM,CAAC;IAEzB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CAC7D,CAAC;AAEF,QAAA,MAAM,oBAAoB,+DAAiE,CAAC;AAE5F,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAChC,YAAY,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,GACzB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Global spinner configuration passed to HandyFluentUiProvider via spinnerConfig. */
|
|
2
|
+
type SpinnerContextConfig = {
|
|
3
|
+
/** Milliseconds before the overlay becomes visible. Prevents flicker on fast operations. Defaults to 300. */
|
|
4
|
+
initialDelay?: number;
|
|
5
|
+
/** Default label supplier when show() is called without an explicit label. */
|
|
6
|
+
label: {
|
|
7
|
+
loading?: () => string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/** Imperative handle to the global overlay spinner, returned by useSpinner. */
|
|
11
|
+
type SpinnerContextType = {
|
|
12
|
+
/** Shows the overlay spinner, optionally overriding defaultLabel. */
|
|
13
|
+
show: (label?: string) => void;
|
|
14
|
+
hide: () => void;
|
|
15
|
+
};
|
|
16
|
+
declare const SpinnerContext: import('react').Context<SpinnerContextType>;
|
|
17
|
+
export { SpinnerContext as FuiSpinnerContext };
|
|
18
|
+
export type { SpinnerContextConfig };
|
|
19
|
+
//# sourceMappingURL=spinner-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner-context.d.ts","sourceRoot":"","sources":["../../src/contexts/spinner-context.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,KAAK,oBAAoB,GAAG;IAC1B,6GAA6G;IAC7G,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,KAAK,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,MAAM,CAAC;KACxB,CAAA;CACF,CAAC;AAEF,+EAA+E;AAC/E,KAAK,kBAAkB,GAAG;IACxB,qEAAqE;IACrE,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,cAAc,6CAGlB,CAAC;AAEH,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,CAAC;AAC/C,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ToastIntent, ToastPosition, ToastProps } from '@fluentui/react-components';
|
|
2
|
+
/** Toast display configuration passed to HandyFluentUiProvider via toastConfig. */
|
|
3
|
+
type ToastContextConfig = {
|
|
4
|
+
/** Auto-dismiss delay in milliseconds. */
|
|
5
|
+
dismissTimeout?: number;
|
|
6
|
+
position?: ToastPosition;
|
|
7
|
+
/** Fully custom toast factory. When provided, built-in toast rendering is bypassed entirely. */
|
|
8
|
+
toastCreator?: (message: string, intent: ToastIntent) => React.ReactElement<ToastProps>;
|
|
9
|
+
};
|
|
10
|
+
/** Imperative toast handle. Prefer the useToast hook which provides intent-specific helpers. */
|
|
11
|
+
type ToastContextType = {
|
|
12
|
+
show: (intent: ToastIntent, message: string, dismissLabel?: string, intentLabel?: string) => void;
|
|
13
|
+
};
|
|
14
|
+
declare const ToastContext: import('react').Context<ToastContextType>;
|
|
15
|
+
export { ToastContext as FuiToastContext };
|
|
16
|
+
export type { ToastContextConfig };
|
|
17
|
+
//# sourceMappingURL=toast-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-context.d.ts","sourceRoot":"","sources":["../../src/contexts/toast-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGpF,mFAAmF;AACnF,KAAK,kBAAkB,GAAG;IACxB,0CAA0C;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,gGAAgG;IAChG,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;CACzF,CAAC;AAEF,gGAAgG;AAChG,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACnG,CAAC;AAEF,QAAA,MAAM,YAAY,2CAEhB,CAAC;AAEH,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BreadcrumbItem } from '../contexts/breadcrumb-context';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to manage a global breadcrumb trail.
|
|
4
|
+
* Actions provided to start() or append() are automatically wrapped to truncate the trail when invoked.
|
|
5
|
+
*/
|
|
6
|
+
declare const useBreadcrumb: () => {
|
|
7
|
+
/** Current breadcrumb items in the trail. */
|
|
8
|
+
items: BreadcrumbItem[];
|
|
9
|
+
/** Resets the trail with the provided item. Action is reconstructed to handle truncation. */
|
|
10
|
+
start: (item: BreadcrumbItem) => void;
|
|
11
|
+
/** Appends an item to the current trail. Action is reconstructed to handle truncation. */
|
|
12
|
+
append: (item: BreadcrumbItem) => void;
|
|
13
|
+
/** Get the last item in current trail */
|
|
14
|
+
peek: () => BreadcrumbItem | undefined;
|
|
15
|
+
/** Removes items from the trail. If tillTag is provided, removes until that item (inclusive). Otherwise removes one. */
|
|
16
|
+
popTill: (tillTag?: string) => void;
|
|
17
|
+
};
|
|
18
|
+
export { useBreadcrumb };
|
|
19
|
+
//# sourceMappingURL=use-breadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-breadcrumb.d.ts","sourceRoot":"","sources":["../../src/hooks/use-breadcrumb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAwB,MAAM,6BAA6B,CAAC;AAInF;;;GAGG;AACH,QAAA,MAAM,aAAa;IASf,6CAA6C;;IAG7C,6FAA6F;kBAC/E,cAAc;IAe5B,0FAA0F;mBAC3E,cAAc;IA8B7B,yCAAyC;gBAC/B,cAAc,GAAG,SAAS;IAIpC,wHAAwH;wBACpG,MAAM;CAoB7B,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Returns the dialog context handle. Call openDialog() to show a confirmation dialog. */
|
|
2
|
+
declare const useDialog: () => {
|
|
3
|
+
openDialog: (dialogProps: import('../contexts/dialog-context').ConfirmationDialogProps) => void;
|
|
4
|
+
};
|
|
5
|
+
export { useDialog };
|
|
6
|
+
//# sourceMappingURL=use-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dialog.d.ts","sourceRoot":"","sources":["../../src/hooks/use-dialog.ts"],"names":[],"mappings":"AAIA,0FAA0F;AAC1F,QAAA,MAAM,SAAS;;CAAqC,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Returns error/info/warn logging functions that delegate to logMessage in HandyFluentUiContext. */
|
|
2
|
+
declare const useLogger: () => {
|
|
3
|
+
debug: (msg: string) => void;
|
|
4
|
+
error: (msg: string) => void;
|
|
5
|
+
info: (msg: string) => void;
|
|
6
|
+
warn: (msg: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export { useLogger };
|
|
9
|
+
//# sourceMappingURL=use-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-logger.d.ts","sourceRoot":"","sources":["../../src/hooks/use-logger.ts"],"names":[],"mappings":"AAIA,qGAAqG;AACrG,QAAA,MAAM,SAAS;iBAQE,MAAM;iBACN,MAAM;gBACP,MAAM;gBACN,MAAM;CAErB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mobile.d.ts","sourceRoot":"","sources":["../../src/hooks/use-mobile.ts"],"names":[],"mappings":"AAKA,4EAA4E;AAC5E,QAAA,MAAM,WAAW,QAAO,OAMvB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-spinner.d.ts","sourceRoot":"","sources":["../../src/hooks/use-spinner.ts"],"names":[],"mappings":"AAIA,gEAAgE;AAChE,QAAA,MAAM,UAAU;gBAGmW,CAAC;;CAH9T,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ThemeType } from '../contexts/handy-fluent-ui-context';
|
|
2
|
+
/** Returns the current theme and a guarded switchTheme that only accepts values in supportedThemeType. */
|
|
3
|
+
declare const useTheme: () => {
|
|
4
|
+
currentTheme: ThemeType;
|
|
5
|
+
switchTheme: (themeType: ThemeType) => void;
|
|
6
|
+
};
|
|
7
|
+
export { useTheme };
|
|
8
|
+
//# sourceMappingURL=use-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme.d.ts","sourceRoot":"","sources":["../../src/hooks/use-theme.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAEnF,0GAA0G;AAC1G,QAAA,MAAM,QAAQ;;6BASe,SAAS;CAKrC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type LocalDate = {
|
|
2
|
+
year: number;
|
|
3
|
+
month: number;
|
|
4
|
+
day: number;
|
|
5
|
+
hour: number;
|
|
6
|
+
minute: number;
|
|
7
|
+
second: number;
|
|
8
|
+
};
|
|
9
|
+
/** Returns handler to get and set current timezone, and extract date parts of a date in current timezone */
|
|
10
|
+
declare const useTimeZone: () => {
|
|
11
|
+
timeZone: string;
|
|
12
|
+
setTimeZone: (tz: string) => void;
|
|
13
|
+
zonedDate2LocalDate: (date: Date, tz?: string) => LocalDate;
|
|
14
|
+
};
|
|
15
|
+
export { useTimeZone };
|
|
16
|
+
export type { LocalDate };
|
|
17
|
+
//# sourceMappingURL=use-time-zone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-time-zone.d.ts","sourceRoot":"","sources":["../../src/hooks/use-time-zone.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,6GAA6G;AAC7G,QAAA,MAAM,WAAW;;sBAgBU,MAAM;gCAMI,IAAI,OAAO,MAAM,KAAG,SAAS;CAkDjE,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Returns intent-specific helpers (success, error, warning, info) wrapping the underlying show() call. */
|
|
2
|
+
declare const useToast: () => {
|
|
3
|
+
success: (msg: string, dismissLabel?: string, intentLabel?: string) => void;
|
|
4
|
+
error: (msg: string, dismissLabel?: string, intentLabel?: string) => void;
|
|
5
|
+
warning: (msg: string, dismissLabel?: string, intentLabel?: string) => void;
|
|
6
|
+
info: (msg: string, dismissLabel?: string, intentLabel?: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export { useToast };
|
|
9
|
+
//# sourceMappingURL=use-toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../src/hooks/use-toast.ts"],"names":[],"mappings":"AAIA,2GAA2G;AAC3G,QAAA,MAAM,QAAQ;mBAGK,MAAM,iBAAiB,MAAM,gBAAgB,MAAM;iBACrD,MAAM,iBAAiB,MAAM,gBAAgB,MAAM;mBACjD,MAAM,iBAAiB,MAAM,gBAAgB,MAAM;gBACtD,MAAM,iBAAiB,MAAM,gBAAgB,MAAM;CAElE,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("@fluentui/react-components"),l=require("react");l=s(l);let u=require("usehooks-ts"),d=require("react/jsx-runtime"),f=require("@fluentui/react-icons"),p=require("@fluentui/react-calendar-compat"),m=require("@fluentui/react-datepicker-compat");var h=(0,l.createContext)(void 0),g=(0,l.createContext)(void 0),_=({children:e})=>{let[t,n]=(0,l.useState)([]);return(0,d.jsx)(g.Provider,{value:{items:t,setItems:n},children:e})},v=(0,l.createContext)({openDialog:()=>{}}),y=({title:e,content:t,buttons:n,visible:r})=>(0,d.jsx)(c.Dialog,{modalType:`alert`,open:r,children:(0,d.jsx)(c.DialogSurface,{children:(0,d.jsxs)(c.DialogBody,{children:[(0,d.jsx)(c.DialogTitle,{children:e}),(0,d.jsx)(c.DialogContent,{children:t}),(0,d.jsx)(c.DialogActions,{children:n.map((e,t)=>(0,d.jsx)(c.Button,{appearance:n.length>1&&(e.cta??!1)?`primary`:`secondary`,disabled:e.disabled,icon:e.icon,onClick:e.action,children:e.label},t))})]})})}),b=({title:e,content:t,primaryButton:n,secondaryButton:r,tertiaryButton:i},a)=>{let o=[{...n,cta:!0}];return r&&o.push({...r,cta:!1}),i&&o.push({...i,cta:!1}),(0,d.jsx)(y,{buttons:o.reverse().map(({action:e,...t})=>({...t,action:()=>{a(),e&&e()}})),content:t,title:e,visible:!0})},x=({children:e})=>{let[t,n]=(0,l.useState)({dialogProps:void 0,openTime:0,closeTime:0}),r=(0,l.useCallback)(e=>{n(t=>({...t,dialogProps:e,openTime:Date.now()}))},[]),i=t.dialogProps&&t.openTime>t.closeTime?b(t.dialogProps,()=>n(e=>({...e,closeTime:Date.now()}))):(0,d.jsx)(d.Fragment,{});return(0,d.jsxs)(v.Provider,{value:{openDialog:r},children:[e,i]})},S=(0,l.createContext)({show:()=>{},hide:()=>{}}),C=(0,c.makeStyles)({overlay:{position:`fixed`,inset:0,backgroundColor:`rgba(0, 0, 0, 0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:9999}}),w=({children:e,config:t})=>{let n=C(),{initialDelay:r,label:i}=t??{},a=(0,l.useRef)(null),[o,s]=(0,l.useState)(0),[u,f]=(0,l.useState)();(0,l.useEffect)(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]);let p=(0,l.useCallback)(e=>{f(e||i?.loading),a.current=setTimeout(()=>{s(e=>e+1),a.current=null},r??300)},[t]),m=(0,l.useCallback)(()=>{a.current===null?s(e=>Math.max(0,e-1)):(clearTimeout(a.current),a.current=null),f(void 0)},[]),h=(0,l.useMemo)(()=>({show:p,hide:m}),[p,m]);return(0,d.jsxs)(S.Provider,{value:h,children:[e,o>0&&(0,d.jsx)(`div`,{className:n.overlay,children:(0,d.jsx)(c.Spinner,{label:u})})]})},T=(0,l.createContext)({show:()=>{}}),E=({config:e,children:t})=>{let{dismissTimeout:n,position:r,toastCreator:i}=e??{},{dispatchToast:a,updateToast:o}=(0,c.useToastController)(),s=(0,l.useCallback)((e,t,s,l)=>{if(i){a(i(t,e),{intent:e,position:r,timeout:e===`error`?-1:n});return}let u=s?(0,d.jsx)(c.ToastTrigger,{children:(0,d.jsx)(c.Link,{children:s})}):(0,d.jsx)(c.ToastTrigger,{children:(0,d.jsx)(f.DismissRegular,{})}),p=l??e.charAt(0).toUpperCase()+e.slice(1),m=e=>(0,d.jsxs)(c.Toast,{appearance:`inverted`,children:[(0,d.jsx)(c.ToastTitle,{action:e,children:p}),(0,d.jsx)(c.ToastBody,{children:t})]});if(e===`error`)if(n&&n>0){let t=`fui-toast-${Date.now()}-${Math.random()}`;a(m(void 0),{intent:e,position:r,timeout:-1,toastId:t}),setTimeout(()=>{o({content:m(u),timeout:-1,toastId:t})},n)}else a(m(u),{intent:e,position:r,timeout:-1});else a(m(u),{intent:e,position:r,timeout:n})},[e,a,o]),u=(0,l.useMemo)(()=>({show:s}),[s]);return(0,d.jsxs)(T.Provider,{value:u,children:[t,(0,d.jsx)(c.Toaster,{})]})},D={light:c.webLightTheme,dark:c.webDarkTheme},O={light:c.teamsLightV21Theme,dark:c.teamsDarkV21Theme},k=(e,t)=>({light:e?.light??t.light,dark:e?.dark??t.dark,custom:e?.custom??t.custom}),A=e=>({web:k(e?.web,{...D,custom:e?.mobile?.custom}),mobile:k(e?.mobile,{...O,custom:e?.web?.custom}),default:e?.default}),j=(e,t)=>{let n=`light`;return e===void 0||e===`custom`&&!t?.includes(`custom`)?typeof window>`u`?n:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e??n},ee={mobileBreakpoint:600,supportedLanguage:{iso:`en`,name:`English`},supportedTheme:{web:D,mobile:O}},M=({mobileBreakpoint:e,component:t,supportedTheme:n,loggerConfig:r,children:i})=>{let a=A(n),o=a.web.custom||a.mobile.custom?[`light`,`dark`,`custom`]:[`light`,`dark`],[s,f]=(0,l.useState)(j(n?.default,o)),p=e??ee.mobileBreakpoint,m=(0,u.useMediaQuery)(`(max-width: ${p}px)`)?a.mobile[s]:a.web[s],g=(0,l.useCallback)(e=>{f(e)},[]),v=Intl.DateTimeFormat().resolvedOptions().timeZone,y=(0,l.useCallback)((e,t=`info`)=>{r?.logMessage?r.logMessage(e,t):console.log(`[${t.toUpperCase()}] ${e}`)},[r]);return(0,d.jsx)(h.Provider,{value:{logMessage:y,mobileBreakpoint:p,selectedTheme:s,supportedThemeType:o,switchTheme:g,timeZone:v},children:(0,d.jsx)(c.FluentProvider,{theme:m,children:(0,d.jsx)(w,{config:t?.spinner,children:(0,d.jsx)(x,{children:(0,d.jsx)(E,{config:t?.toast,children:(0,d.jsx)(_,{children:i})})})})})})},N=()=>{let e=(0,l.useContext)(h);if(!e)throw Error(`useLogger must be used within HandyFluentUiProvider`);let t=e.logMessage;return{debug:e=>t(e,`debug`),error:e=>t(e,`error`),info:e=>t(e,`info`),warn:e=>t(e,`warn`)}},te=()=>{let e=(0,l.useContext)(g);if(!e)throw Error(`useBreadcrumb must be used within FuiBreadcrumbContextProvider`);let t=N();return{items:[...e.items],start:n=>{t.debug(`[useBreadcrumb] start() with tag ${n.tag}`);let r=n.action,i={...n,action:r?()=>{r(),e.setItems([i])}:void 0};e.setItems([i])},append:n=>{t.debug(`[useBreadcrumb] append() with tag ${n.tag}, action = ${n.action===void 0}`);let r=n.action,i={...n,action:r?()=>{r(),e.setItems(e=>{let t=e.findIndex(e=>e===i);return e.slice(0,t+1)})}:void 0};e.setItems(e=>{let r=e[e.length-1];return n.tag!==void 0&&r?.tag===n.tag?(t.warn(`[useBreadcrumb] append(), the tag of last item is ${n.tag}, ignored append`),e):[...e,i]})},peek:()=>e.items[e.items.length-1],popTill:n=>{t.debug(`[useBreadcrumb] popTill(), no of items = ${e.items.length}`),e.setItems(e=>{if(n){let r=e.findIndex(e=>e.tag===n);return r===-1?(t.warn(`[useBreadcrumb] popTill(), tag "${n}" not found, trail unchanged`),e):e.slice(0,r)}if(e.length===0)return e;let r=e.slice(0,-1);return t.debug(`[useBreadcrumb] popTill(), no of items after pop = ${r.length}`),r})}}},ne=()=>(0,l.useContext)(v),P=()=>{let e=(0,l.useContext)(h);if(!e)throw Error(`useIsMobile must be used within HandyFluentUiProvider`);return(0,u.useMediaQuery)(`(max-width: ${e.mobileBreakpoint}px)`)},re=()=>(0,l.useContext)(S),F=()=>{let e=(0,l.useContext)(h);if(!e)throw Error(`useTheme must be used within HandyFluentUiProvider`);let{selectedTheme:t,supportedThemeType:n,switchTheme:r}=e;return{currentTheme:t,switchTheme:e=>{n.includes(e)&&r(e)}}},I=()=>{let e=(0,l.useContext)(h);if(!e)throw Error(`useTimezone must be used within HandyFluentUiProvider`);let t=t=>{try{return Intl.DateTimeFormat(void 0,{timeZone:t}),!0}catch{return e.logMessage(`Invalid timeZone = ${t}`,`warn`),!1}};return{timeZone:e.timeZone,setTimeZone:n=>{t(n)&&(e.timeZone=n)},zonedDate2LocalDate:(n,r)=>{if(r&&!t(r))return{year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds()};let i=new Intl.DateTimeFormat(void 0,{timeZone:r??e.timeZone,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).formatToParts(n),{year:a,month:o,day:s,hour:c,minute:l,second:u}=Object.fromEntries(i.filter(e=>e.type!==`literal`).map(e=>[e.type,Number(e.value)]));return{year:a,month:o,day:s,hour:c,minute:l,second:u}}}},L=()=>{let{show:e}=(0,l.useContext)(T);return{success:(t,n,r)=>e(`success`,t,n,r),error:(t,n,r)=>e(`error`,t,n,r),warning:(t,n,r)=>e(`warning`,t,n,r),info:(t,n,r)=>e(`info`,t,n,r)}},ie=(0,c.makeStyles)({root:{display:`flex`,gap:c.tokens.spacingHorizontalM},row:{flexDirection:`row`},column:{flexDirection:`column`,alignItems:`stretch`},left:{justifyContent:`flex-start`},right:{justifyContent:`flex-end`}}),ae=({className:e,alignItems:t=`right`,children:n})=>{let r=ie(),i=P();return(0,d.jsx)(`div`,{className:(0,c.mergeClasses)(r.root,i?r.column:r.row,t===`left`?r.left:r.right,e),children:n})},oe=(0,c.makeStyles)({root:{display:`flex`,flexDirection:`column`,width:`100%`},rootVertical:{flexDirection:`row`},tabList:{width:`max-content`},tabListVertical:{borderBottom:`none`,borderRight:`1px solid ${c.tokens.colorNeutralStroke2}`,minWidth:`0`,width:`auto`},scrollWrapper:{width:`100%`,overflowX:`auto`,WebkitOverflowScrolling:`touch`,"::-webkit-scrollbar":{display:`none`},msOverflowStyle:`none`,scrollbarWidth:`none`},content:{paddingTop:c.tokens.spacingVerticalM,flexGrow:1},contentVertical:{paddingTop:`0`,paddingLeft:c.tokens.spacingHorizontalM},tabTextSelected:{color:c.tokens.colorBrandForeground1}}),R=Symbol.for(`FuiTab`),se=Object.assign(e=>null,{_marker:R}),ce=e=>{let{children:t,vertical:n,selectedValue:r,onTabSelect:i,...a}=e,o=P(),s=oe(),u=!o&&n,f=l.default.Children.toArray(t).filter(e=>l.default.isValidElement(e)&&e.type?._marker===R).map(e=>({props:e.props,value:e.props.value??e.props.name})),p=(e,t)=>{i?.(t)},m=(0,d.jsx)(c.TabList,{...a,className:u?s.tabListVertical:s.tabList,onTabSelect:p,selectedValue:r,vertical:u,children:f.map(e=>(0,d.jsx)(c.Tab,{...e.props,value:e.value,children:(0,d.jsx)(`span`,{className:e.value===r?s.tabTextSelected:void 0,children:e.props.name})},String(e.value)))}),h=f.find(e=>e.value===r);return(0,d.jsxs)(`div`,{className:(0,c.mergeClasses)(s.root,u&&s.rootVertical),children:[o?(0,d.jsx)(`div`,{className:s.scrollWrapper,children:m}):m,h&&(0,d.jsx)(`div`,{className:(0,c.mergeClasses)(s.content,u&&s.contentVertical),children:h.props.children})]})},z=(e,t)=>e.replace(/{{\s*([\w.]+)\s*}}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>{if(e&&typeof e==`object`&&t in e)return e[t]},t);return r==null?``:String(r)}),le=(0,c.makeStyles)({rootVertical:{display:`flex`,flexDirection:`column`,gap:`2px`},rootHorizontal:{display:`flex`,alignItems:`flex-start`,gap:c.tokens.spacingHorizontalM},rootHorizontalRow:{flexDirection:`row`},rootHorizontalColumn:{flexDirection:`column`,gap:`2px`},labelContainer:{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:`4px`,overflow:`hidden`,flexShrink:1},eraserIcon:{cursor:`pointer`,color:c.tokens.colorNeutralForeground3,fontSize:`16px`,flexShrink:0,":hover":{color:c.tokens.colorNeutralForeground2}},labelHorizontal:{minHeight:`32px`,display:`flex`,alignItems:`center`,flexShrink:0},labelHorizontalColumn:{width:`100% !important`,minHeight:`auto`},labelSmall:{width:`10%`},labelMedium:{width:`20%`},labelLarge:{width:`30%`},labelNone:{width:`auto`},labelComponent:{display:`inline-flex`,alignItems:`center`,whiteSpace:`nowrap`,overflow:`hidden`,minWidth:0,flexShrink:1},labelText:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},fieldGroup:{display:`flex`,flexDirection:`column`,flexGrow:1,width:`100%`},messageContainer:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,gap:c.tokens.spacingHorizontalM},message:{lineHeight:c.tokens.spacingVerticalL,paddingLeft:c.tokens.spacingHorizontalM},messagePlaceholder:{visibility:`hidden`},additionalMessage:{flexShrink:0,color:c.tokens.colorNeutralForeground3},errorMessage:{color:c.tokens.colorPaletteRedForeground1},infoMessage:{color:c.tokens.colorPaletteGreenForeground1}}),B=e=>t=>{let{label:n=``,required:r,hint:i,errorMessage:a,infoMessage:o,noMessage:s=!1,direction:l=`vertical`,labelWidth:u=`medium`,additionalMessage:p,clearable:m=!0,onClear:h,...g}=t,_=le(),v=P(),y=(0,c.useId)(`input-field`),b=l===`horizontal`,x=(0,c.mergeClasses)(b&&_.labelHorizontal,b&&v&&_.labelHorizontalColumn,b&&u===`small`&&_.labelSmall,b&&u===`medium`&&_.labelMedium,b&&u===`large`&&_.labelLarge,b&&u===`none`&&_.labelNone),S=n!==null,C=n===void 0||n===``?`\xA0`:n,w=(0,d.jsx)(`span`,{className:_.labelText,children:C});return(0,d.jsxs)(`div`,{className:b&&S?(0,c.mergeClasses)(_.rootHorizontal,v?_.rootHorizontalColumn:_.rootHorizontalRow):_.rootVertical,children:[S&&(0,d.jsxs)(`div`,{className:(0,c.mergeClasses)(_.labelContainer,x),children:[i?(0,d.jsx)(c.InfoLabel,{className:_.labelComponent,"data-testid":`info-label`,htmlFor:y,info:i,required:r,children:w}):(0,d.jsx)(c.Label,{className:_.labelComponent,"data-testid":`label`,htmlFor:y,required:r,children:w}),m!==!1&&h&&g.readOnly!==!0&&g.disabled!==!0&&(0,d.jsx)(f.EraserRegular,{className:_.eraserIcon,"data-testid":`eraser-icon`,onClick:h})]}),(0,d.jsxs)(`div`,{className:_.fieldGroup,children:[(0,d.jsx)(e,{...g,id:y}),!s&&(0,d.jsxs)(`div`,{className:_.messageContainer,children:[(0,d.jsx)(c.Caption1,{className:(0,c.mergeClasses)(_.message,a?_.errorMessage:o?_.infoMessage:_.messagePlaceholder),children:a??o??`\xA0`}),p&&(0,d.jsx)(c.Caption1,{className:_.additionalMessage,children:p})]})]})]})},V=(0,c.makeStyles)({drawer:{height:`auto`,maxHeight:`60vh`,overflowY:`auto`},drawerHeader:{paddingBottom:c.tokens.spacingVerticalM},listboxWrapper:{padding:c.tokens.spacingVerticalM}}),H=(e,t,n)=>n?e==null?t:t.includes(e)?t.filter(t=>t!==e):[...t,e]:e,U=({groups:e,ungrouped:t})=>{let n=e=>(0,d.jsx)(c.Option,{disabled:e.disabled,text:e.text,value:e.value,children:e.render?e.render():e.text},e.value);return(0,d.jsxs)(d.Fragment,{children:[t.map(n),Object.entries(e).map(([e,t])=>(0,d.jsx)(c.OptionGroup,{label:e,children:t.map(n)},e))]})},W=(e,t)=>{let n=(0,l.useMemo)(()=>e==null?[]:Array.isArray(e)?e:[e],[e]);return{selectedValues:n,displayValue:(0,l.useMemo)(()=>t.filter(e=>n.includes(e.value)).map(e=>e.text).join(`, `),[t,n]),groupedOptions:(0,l.useMemo)(()=>{let e={},n=[];return t.forEach(t=>{t.group?(e[t.group]??=[]).push(t):n.push(t)}),{groups:e,ungrouped:n}},[t])}},G=e=>{let{value:t,onChange:n,options:r,placeholder:i,multiselect:a=!1,className:o,style:s,disabled:u,readOnly:p=!1,drawerTitle:m,id:h}=e,g=V(),[_,v]=(0,l.useState)(!1),{selectedValues:y,displayValue:b,groupedOptions:x}=W(t,r),S=e=>{n(H(e,y,a)),a||v(!1)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.Input,{autoComplete:`off`,className:o,contentAfter:(0,d.jsx)(f.ChevronDownRegular,{onClick:()=>v(!0),style:{cursor:`pointer`}},`${h}-chevron`),disabled:u,id:h,onClick:()=>v(!0),onKeyDown:e=>e.preventDefault(),placeholder:i,readOnly:!0,style:s,type:`text`,value:b}),(0,d.jsxs)(c.OverlayDrawer,{className:g.drawer,onOpenChange:(e,{open:t})=>v(t),open:_,position:`bottom`,children:[(0,d.jsx)(c.DrawerHeader,{className:g.drawerHeader,children:(0,d.jsx)(c.DrawerHeaderTitle,{action:(0,d.jsx)(c.Button,{appearance:`subtle`,"aria-label":`Close`,icon:(0,d.jsx)(f.DismissRegular,{}),onClick:()=>v(!1)}),children:m})}),(0,d.jsx)(c.DrawerBody,{children:(0,d.jsx)(`div`,{className:g.listboxWrapper,children:(0,d.jsx)(c.Listbox,{multiselect:a,onOptionSelect:p?void 0:(e,t)=>S(t.optionValue??null),selectedOptions:y,children:U(x)})})})]})]})},ue=B(e=>{let{value:t,onChange:n,options:r,multiselect:i=!1,style:a,readOnly:o=!1,...s}=e,l=P(),{selectedValues:u,displayValue:f,groupedOptions:p}=W(t,r);if(l)return(0,d.jsx)(G,{...e});let m=e=>{n(H(e,u,i))};return(0,d.jsx)(c.Dropdown,{...s,"aria-labelledby":s.id,multiselect:i,onOptionSelect:(e,t)=>{o||m(t.optionValue??null)},selectedOptions:u,style:{width:`100%`,...a},value:f,children:U(p)})}),de=e=>{let{value:t,onChange:n,...r}=e,i=(Array.isArray(t)?t.length>0:t!==null&&t!==``)?()=>n(e.multiselect===!0?[]:null):void 0;return(0,d.jsx)(ue,{...r,drawerTitle:e.label??e.placeholder,onChange:n,onClear:i,value:t})},K=(0,c.makeStyles)({headerRow:{backgroundColor:c.tokens.colorNeutralBackground3,"& > *":{color:c.tokens.colorNeutralForeground1},width:`100%`},row:{width:`100%`},headerCell:{backgroundColor:c.tokens.colorNeutralBackground3,display:`flex`,flexDirection:`column`,justifyContent:`center`},ellipsis:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},sortableHeader:{cursor:`pointer`},cell:{paddingLeft:c.tokens.spacingHorizontalS},outerWrapper:{width:`100%`},scrollContainer:{width:`100%`,overflowX:`auto`,WebkitOverflowScrolling:`touch`},paginationBar:{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,gap:c.tokens.spacingHorizontalS,padding:`${c.tokens.spacingVerticalS} ${c.tokens.spacingHorizontalM}`,backgroundColor:c.tokens.colorNeutralBackground2},paginationBarMobile:{flexDirection:`column`,alignItems:`flex-end`,padding:`${c.tokens.spacingVerticalXXS} ${c.tokens.spacingHorizontalXXS}`,gap:c.tokens.spacingHorizontalXS},navRow:{display:`flex`,alignItems:`center`,gap:c.tokens.spacingHorizontalS,order:1},navRowMobile:{justifyContent:`center`},sizeRow:{display:`flex`,alignItems:`center`,gap:c.tokens.spacingHorizontalS,order:2},sizeRowMobile:{justifyContent:`center`,paddingRight:c.tokens.spacingHorizontalM},listbox:{minWidth:0,width:`80px`},range:{fontSize:c.tokens.fontSizeBase200,color:c.tokens.colorNeutralForeground3,fontVariantNumeric:`tabular-nums`,minWidth:`90px`,textAlign:`center`}}),q=Symbol.for(`FuiColumn`),fe=Object.assign(()=>null,{_marker:q}),pe=(e,t)=>t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e),me=e=>l.default.Children.toArray(e).filter(e=>l.default.isValidElement(e)&&e.type?._marker===q).map(e=>e.props),he=(e,t)=>{let n=pe(t,e.field);return e.builder?e.builder(n,t):e.formatter?(0,d.jsx)(c.Body1,{children:e.formatter(n,t)}):(0,d.jsx)(c.Body1,{children:n==null?``:String(n)})},J=({offset:e,pageSize:t,fastForwardPage:n=5,pageSizeOption:r,totalRecord:i,visibleCount:a,onPageChange:o,langLabel:s})=>{let l=K(),u=s?.paginationBar,p=i===0?0:e+1,m=i===0?0:e+a,h=e>0,g=e+t<i,_=P(),v=String(t),y=i===0?s?.noData||`No data`:s?.pageRange?z(s.pageRange,{from:p,to:m,total:i}):`${p} to ${m} of ${i}`,b=s?.pageSize??`Rows :`,x=u?.next??`Next page`,S=u?.nextN?z(u.nextN,{n}):`Next ${n} pages`,C=u?.previous??`Previous page`,w=u?.previousN?z(u.previousN,{n}):`Previous ${n} pages`;return(0,d.jsxs)(`div`,{className:(0,c.mergeClasses)(l.paginationBar,_&&l.paginationBarMobile),children:[(0,d.jsxs)(`div`,{className:(0,c.mergeClasses)(l.navRow,_&&l.navRowMobile),children:[(0,d.jsx)(c.Tooltip,{content:w,relationship:`label`,children:(0,d.jsx)(c.Button,{appearance:`subtle`,"aria-label":w,disabled:!h,icon:(0,d.jsx)(f.ChevronDoubleLeftRegular,{}),onClick:()=>o(Math.max(0,e-n*t),t)})}),(0,d.jsx)(c.Tooltip,{content:C,relationship:`label`,children:(0,d.jsx)(c.Button,{appearance:`subtle`,"aria-label":C,disabled:!h,icon:(0,d.jsx)(f.ChevronLeftRegular,{}),onClick:()=>o(Math.max(0,e-t),t)})}),(0,d.jsx)(`span`,{className:l.range,children:(0,d.jsx)(c.Body1,{children:y})}),(0,d.jsx)(c.Tooltip,{content:x,relationship:`label`,children:(0,d.jsx)(c.Button,{appearance:`subtle`,"aria-label":x,disabled:!g,icon:(0,d.jsx)(f.ChevronRightRegular,{}),onClick:()=>o(e+t,t)})}),(0,d.jsx)(c.Tooltip,{content:S,relationship:`label`,children:(0,d.jsx)(c.Button,{appearance:`subtle`,"aria-label":S,disabled:!g,icon:(0,d.jsx)(f.ChevronDoubleRightRegular,{}),onClick:()=>o(e+n*t,t)})}),` `,!_&&(0,d.jsx)(c.Divider,{vertical:!0})]}),(0,d.jsxs)(`div`,{className:(0,c.mergeClasses)(l.sizeRow,_&&l.sizeRowMobile),children:[(0,d.jsx)(c.Body1,{children:b}),_?(0,d.jsx)(G,{className:l.listbox,onChange:t=>{t&&!Array.isArray(t)&&o(e,Number(t))},options:r.map(e=>String(e)).map(e=>({value:e,text:e})),value:v}):(0,d.jsx)(c.Dropdown,{className:l.listbox,listbox:{className:l.listbox},onOptionSelect:(t,n)=>{n.optionValue&&o(e,Number(n.optionValue))},selectedOptions:[v],value:v,children:r.map(e=>String(e)).map(e=>(0,d.jsx)(c.Option,{text:e,value:e,children:e},e))})]})]})},ge=({data:e,onPageOrSort:t,pagination:n,width:r,langLabel:i,children:a})=>{let[o,s]=(0,l.useState)(null),[u,f]=(0,l.useState)(`asc`),p=K(),m=N(),h=me(a),g=e=>{let t=e.style?.width;return t==null?e.style??{}:{...e.style,boxSizing:`border-box`,flex:`0 0 ${t}`,minWidth:0,overflow:`hidden`}},_=h.map((e,t)=>(0,c.createTableColumn)({columnId:`${e.field}_${t}`,renderHeaderCell:()=>e.header,renderCell:t=>he(e,t)})),v=e=>{if(t||m.warn(`Sorting is not performed because onSort handler is not provided`),o===e){let r=u===`asc`?`desc`:`asc`;f(r),t?.(n,{field:e,direction:r})}else s(e),f(`asc`),t?.(n,{field:e,direction:`asc`})},y=n&&(0,d.jsx)(J,{onPageChange:(e,n)=>{t?.({offset:e,pageSize:n},o?{field:o,direction:u}:void 0)},...n,langLabel:i,visibleCount:e.length}),b=o?_.find(e=>String(e.columnId).startsWith(`${o}_`))?.columnId:void 0,x=n?Math.max(0,n.pageSize-e.length):0,S=[...e,...Array.from({length:x}).map((e,t)=>({_isFiller:!0,id:`filler-${t}`}))];return(0,d.jsxs)(`div`,{className:p.outerWrapper,children:[n?.position===`top`&&y,(0,d.jsx)(`div`,{className:p.scrollContainer,children:(0,d.jsxs)(c.DataGrid,{columns:_,items:S,sortState:{sortColumn:b,sortDirection:u===`asc`?`ascending`:`descending`},style:{minWidth:r?.minWidth??r?.width,whiteSpace:`nowrap`,width:`100%`},children:[(0,d.jsx)(c.DataGridHeader,{children:(0,d.jsx)(c.DataGridRow,{className:p.headerRow,children:({renderHeaderCell:e,columnId:t})=>{let n=h[parseInt(String(t).split(`_`).pop()||`0`)];return(0,d.jsx)(c.DataGridHeaderCell,{className:(0,c.mergeClasses)(p.headerCell,n.sortable&&p.sortableHeader),onClick:n.sortable?()=>v(n.field):void 0,sortDirection:n.sortable&&o===n.field?u===`asc`?`ascending`:`descending`:void 0,style:{...g(n),...n.headerStyle,textAlign:n.align},children:(0,d.jsx)(c.Body1Strong,{className:p.ellipsis,children:e()})},t)}})}),(0,d.jsx)(c.DataGridBody,{children:({item:e,rowId:t})=>(0,d.jsx)(c.DataGridRow,{className:p.row,children:({renderCell:t,columnId:n})=>{let r=h[parseInt(String(n).split(`_`).pop()||`0`)];return(0,d.jsx)(c.DataGridCell,{className:p.cell,style:{...g(r),textAlign:r.align},children:e._isFiller?null:t(e)},n)}},t)})]})}),(n?.position===`bottom`||!n?.position)&&y]})},_e=(e,t)=>`Carousel slide ${e+1} of ${t}`,ve=({images:e,langLabel:t})=>(0,d.jsx)(`div`,{style:{width:`100%`},children:(0,d.jsxs)(c.Carousel,{announcement:_e,circular:!0,groupSize:1,children:[(0,d.jsx)(c.CarouselViewport,{style:{width:`100%`,overflow:`hidden`},children:(0,d.jsx)(c.CarouselSlider,{style:{display:`flex`,flexWrap:`nowrap`,width:`100%`},children:e.map((t,n)=>(0,d.jsx)(c.CarouselCard,{"aria-label":`${n+1} of ${e.length}`,id:`carousel-image-${n}`,style:{aspectRatio:`5/2`,flexShrink:0,overflow:`hidden`,width:`100%`},children:(0,d.jsx)(c.Image,{fit:`cover`,role:`presentation`,src:t,style:{display:`block`,height:`100%`,objectFit:`cover`,width:`100%`}})},`image-${n}`))})}),(0,d.jsx)(c.CarouselNavContainer,{autoplayTooltip:{content:t?.autoplay??`Autoplay`,relationship:`label`},layout:`inline`,nextTooltip:{content:t?.next??`Next image`,relationship:`label`},prevTooltip:{content:t?.previous??`Previous image`,relationship:`label`},children:(0,d.jsx)(c.CarouselNav,{children:e=>(0,d.jsx)(c.CarouselNavButton,{"aria-label":`Carousel Nav Button ${e}`})})})]})}),ye=e=>{let{readOnly:t=!1,onChange:n,className:r,style:i,...a}=e,o=(e,r)=>{t||n?.(r)};return(0,d.jsx)(c.Checkbox,{...a,className:r,onChange:o,style:i})},be=(0,c.makeStyles)({drawer:{height:`auto`,maxHeight:`80vh`},drawerHeader:{paddingBottom:c.tokens.spacingVerticalM},calendarWrapper:{display:`flex`,justifyContent:`center`,padding:c.tokens.spacingVerticalM}}),Y=e=>e?e.toLocaleDateString():``,xe=e=>{let{value:t,onChange:n,formatter:r=Y,className:i,style:a,readOnly:o,...s}=e;return P()?(0,d.jsx)(Se,{...e}):o?(0,d.jsx)(c.Input,{className:i,id:s.id,placeholder:s.placeholder,readOnly:!0,style:{width:`100%`,...a},type:`text`,value:r(t)}):(0,l.createElement)(m.DatePicker,{...s,key:`${s.id}-${t?`defined`:`undefined`}`,className:i,formatDate:e=>r(e??null),onSelectDate:n,style:{width:`100%`,...a},value:t??void 0})},Se=e=>{let{value:t,onChange:n,formatter:r=Y,className:i,style:a,drawerTitle:o,readOnly:s,...u}=e,m=be(),[h,g]=(0,l.useState)(!1),_=()=>{s||g(!0)},v=e=>{n(e),g(!1)},y=s?void 0:(0,d.jsx)(f.CalendarRegular,{onClick:_,style:{cursor:`pointer`}},`${u.id}-calendar`),b=r(t);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.Input,{...u,autoComplete:`off`,className:i,contentAfter:y,onClick:_,onKeyDown:e=>e.preventDefault(),readOnly:!0,style:a,type:`text`,value:b}),(0,d.jsxs)(c.OverlayDrawer,{className:m.drawer,onOpenChange:(e,{open:t})=>g(t),open:h,position:`bottom`,children:[o&&(0,d.jsx)(c.DrawerHeader,{className:m.drawerHeader,children:(0,d.jsx)(c.DrawerHeaderTitle,{children:o})}),(0,d.jsx)(c.DrawerBody,{children:(0,d.jsx)(`div`,{className:m.calendarWrapper,children:(0,d.jsx)(p.Calendar,{onSelectDate:v,value:t??void 0},`${u.id}-${t?`defined`:`undefined`}`)})})]})]})},Ce=B(xe),we=e=>{let{value:t,onChange:n,...r}=e,i=t!==null&&!e.readOnly&&!e.disabled?()=>n(null):void 0;return(0,d.jsx)(Ce,{...r,drawerTitle:e.label??e.placeholder,onChange:n,onClear:i,value:t})},Te=(0,c.makeStyles)({arrows:{display:`flex`,flexDirection:`column`},arrowsRow:{flexDirection:`row`},arrowIcon:{cursor:`pointer`},arrowIconMobile:{fontSize:c.tokens.fontSizeBase500,height:c.tokens.fontSizeBase500,width:c.tokens.fontSizeBase500},arrowIconDisabled:{cursor:`default`,opacity:.4},amPm:{cursor:`pointer`,fontWeight:c.tokens.fontWeightSemibold,paddingRight:c.tokens.spacingHorizontalXS,userSelect:`none`},amPmDisabled:{cursor:`default`,opacity:.4}}),X={hour:0,minute:0,second:0},Ee=(e,t,n)=>{if(e===null)return``;let r=n?e.hour:e.hour%12||12,i=String(r).padStart(2,`0`),a=String(e.minute).padStart(2,`0`),o=String(e.second).padStart(2,`0`);return t?`${i}:${a}:${o}`:`${i}:${a}`},Z=(e,t)=>e==null?t?`s`:`m`:e<3?`h`:e<6?`m`:`s`,Q=(e,t,n,r)=>{let i=e??X;if(t===`s`){let e=i.second+n;return r&&e<0?Q({...i,second:59},`m`,-1,r):r&&e>=60?Q({...i,second:0},`m`,1,r):{...i,second:(e+60)%60}}if(t===`m`){let e=i.minute+n;return r&&e<0?Q({...i,minute:59},`h`,-1,r):r&&e>=60?Q({...i,minute:0},`h`,1,r):{...i,minute:(e+60)%60}}return{...i,hour:(i.hour+n+24)%24}},De=B(e=>{let{value:t,onChange:n,in24HourFormat:r=!0,withSeconds:i=!1,cascadeCarry:a=!1,readOnly:o=!1,disabled:s,className:u,style:p,id:m,...h}=e,g=Te(),_=P(),v=(0,l.useRef)(null),[y,b]=(0,l.useState)(null),x=(0,l.useRef)(null),S=!o&&!s,C=t!==null&&t.hour>=12;(0,l.useEffect)(()=>{x.current!==null&&v.current&&(v.current.setSelectionRange(x.current,x.current),x.current=null)});let w=()=>{b(Z(v.current?.selectionStart,i))},T=()=>{b(Z(v.current?.selectionStart,i))},E=()=>b(null),D=e=>{if(!S)return;let r=y??(i?`s`:`m`);x.current=v.current?.selectionStart??null,n(Q(t,r,e,a))},O=()=>{if(!S)return;let e=t??X;n({...e,hour:e.hour>=12?e.hour-12:e.hour+12})},k=(0,c.mergeClasses)(g.arrowIcon,_&&g.arrowIconMobile,!S&&g.arrowIconDisabled),A=(0,d.jsxs)(`div`,{className:(0,c.mergeClasses)(g.arrows,_&&g.arrowsRow),children:[(0,d.jsx)(f.ChevronUpRegular,{className:k,onClick:()=>D(1),onMouseDown:e=>e.preventDefault()}),(0,d.jsx)(f.ChevronDownRegular,{className:k,onClick:()=>D(-1),onMouseDown:e=>e.preventDefault()})]}),j=!r&&t!==null?(0,d.jsx)(`span`,{className:S?g.amPm:(0,c.mergeClasses)(g.amPm,g.amPmDisabled),onClick:S?O:void 0,onMouseDown:S?e=>e.preventDefault():void 0,children:C?`PM`:`AM`}):void 0;return(0,d.jsx)(c.Input,{...h,autoComplete:`off`,className:u,contentAfter:A,contentBefore:j,disabled:s,id:m,input:{ref:v,style:{minWidth:i?`8ch`:`5ch`}},onBlur:E,onClick:w,onFocus:T,onKeyDown:e=>{e.key!==`Tab`&&e.preventDefault()},readOnly:o,style:{width:`100%`,...p},type:`text`,value:Ee(t,i,r)})}),Oe=e=>{let{value:t,onChange:n,...r}=e,i=t!==null&&!e.readOnly&&!e.disabled?()=>n(null):void 0;return(0,d.jsx)(De,{...r,onChange:n,onClear:i,value:t})},ke=(0,c.makeStyles)({groupRow:{display:`flex`,flexDirection:`row`,gap:c.tokens.spacingHorizontalM,width:`100%`},groupColumn:{display:`flex`,flexDirection:`column`,gap:c.tokens.spacingVerticalXXS,width:`100%`}}),Ae=B(({items:e,className:t,style:n})=>{let r=P(),i=ke();return(0,d.jsx)(`div`,{className:`${r?i.groupColumn:i.groupRow} ${t??``}`,style:n,children:e.map(({element:e,weight:t=1},n)=>{let{label:i,placeholder:a}=e.props,o=a??i;return(0,d.jsx)(`div`,{style:r?{flex:`1 1 auto`}:{flex:`${t} 1 0px`,minWidth:0},children:l.default.cloneElement(e,{label:null,placeholder:o,noMessage:!1})},n)})})}),je=e=>{let t=P(),{items:n,className:r,style:i}=e,a=n.some(({element:e})=>{let t=e.props.value;return t!=null&&t!==``})?()=>n.forEach(({element:e})=>e.props.onChange(null)):void 0;return(0,d.jsx)(Ae,{...e,className:r,direction:t?`vertical`:e.direction,noMessage:!0,onClear:a,style:i})},Me=B(e=>{let{type:t=`text`,onChange:n,onKeyDown:r,className:i,style:a,...o}=e,[s,u]=(0,l.useState)(!1),p=t===`email`?t=>{t.key===`@`&&e.value?.includes(`@`)&&t.preventDefault(),r?.(t)}:r,m=e=>{n(e??null)},h=()=>{u(!s)},g=t===`password`&&s?`text`:t;return(0,d.jsx)(c.Input,{...o,className:i,contentAfter:t===`password`?(0,d.jsx)(c.Button,{appearance:`subtle`,icon:s?(0,d.jsx)(f.EyeOffRegular,{}):(0,d.jsx)(f.EyeRegular,{}),onClick:h,size:`small`,type:`button`}):o.contentAfter,onChange:(e,t)=>m(t.value),onKeyDown:p,style:a,type:g,value:e.value??``})}),$=e=>{let{value:t,onChange:n,...r}=e,i=t!==null&&t!==``?()=>n(null):void 0;return(0,d.jsx)(Me,{...r,onChange:n,onClear:i,value:t})},Ne=(0,c.makeStyles)({drawerBase:{height:`auto`},drawerMobile:{height:`40vh`,maxHeight:`60vh`},drawerDesktop:{width:`40vw`,maxWidth:`60vw`,maxHeight:`100vh`},drawerBody:{display:`flex`,flexDirection:`column`,gap:c.tokens.spacingVerticalL,padding:c.tokens.spacingVerticalL,overflowY:`auto`}}),Pe=B(e=>{let{value:t,onChange:n,disabled:r,drawerTitle:i,className:a,readOnly:o,style:s,langLabel:u,textComponent:p=$,...m}=e,h=P(),g=(u?.languages??[]).slice(0,3),_=Ne(),[v,y]=(0,l.useState)(!1),b=t?t.valueInLangOne??t.valueInLangTwo??t.valueInLangThree??``:``,x=e=>{if(!t){n({valueInLangOne:e||null,valueInLangTwo:null,valueInLangThree:null});return}t.valueInLangOne===null?t.valueInLangTwo===null?t.valueInLangThree===null?n({...t,valueInLangOne:e||null}):n({...t,valueInLangThree:e||null}):n({...t,valueInLangTwo:e||null}):n({...t,valueInLangOne:e||null})},S=(e,r)=>{n({valueInLangOne:t?.valueInLangOne??null,valueInLangTwo:t?.valueInLangTwo??null,valueInLangThree:t?.valueInLangThree??null,[e]:r})},C=(0,d.jsx)(f.TranslateRegular,{onClick:()=>y(!0),style:{cursor:`pointer`}}),w=(0,d.jsxs)(c.OverlayDrawer,{className:(0,c.mergeClasses)(_.drawerBase,h?_.drawerMobile:_.drawerDesktop),onOpenChange:(e,{open:t})=>y(t),open:v,position:h?`bottom`:`end`,children:[(0,d.jsx)(c.DrawerHeader,{children:(0,d.jsx)(c.DrawerHeaderTitle,{action:(0,d.jsx)(c.Button,{appearance:`subtle`,"aria-label":`Close`,icon:(0,d.jsx)(f.DismissRegular,{}),onClick:()=>y(!1)}),children:i})}),(0,d.jsxs)(c.DrawerBody,{className:_.drawerBody,children:[(0,d.jsx)(p,{disabled:r,label:g[0]||`Lang One`,onChange:e=>S(`valueInLangOne`,e),readOnly:o,value:t?.valueInLangOne??null}),g[1]&&(0,d.jsx)(p,{disabled:r,label:g[1],onChange:e=>S(`valueInLangTwo`,e),readOnly:o,value:t?.valueInLangTwo??null}),g[2]&&(0,d.jsx)(p,{disabled:r,label:g[2],onChange:e=>S(`valueInLangThree`,e),readOnly:o,value:t?.valueInLangThree??null})]})]});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(p,{...m,className:a,clearable:!1,contentAfter:g.length>1?C:void 0,disabled:r,label:null,noMessage:!0,onChange:e=>x(e),readOnly:o,style:s,value:b}),g.length>1&&w]})}),Fe=e=>{let{value:t,onChange:n}=e,r=t&&(t.valueInLangOne||t.valueInLangTwo||t.valueInLangThree)?()=>n(null):void 0;return(0,d.jsx)(Pe,{...e,drawerTitle:e.label??e.placeholder,onClear:r})},Ie=(0,c.makeStyles)({arrows:{display:`flex`,flexDirection:`row`,gap:c.tokens.spacingHorizontalXS},arrowIcon:{cursor:`pointer`,fontSize:c.tokens.fontSizeBase500,height:c.tokens.fontSizeBase500,width:c.tokens.fontSizeBase500}}),Le=B(e=>{let{value:t,onChange:n,precision:r=0,allowNegative:i=!0,formatter:a,onFocus:o,onBlur:s,step:u,min:p,max:m,className:h,style:g,..._}=e,v=P(),y=Ie(),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(t===null?``:t.toString());(0,l.useEffect)(()=>{b||C(t===null?``:t.toString())},[t,b]);let w=e=>{let t=e.key;if(![`Backspace`,`Delete`,`ArrowLeft`,`ArrowRight`,`Tab`,`Enter`,`Escape`].includes(t)){if(t===`-`){(!i||e.currentTarget.selectionStart!==0||S.includes(`-`))&&e.preventDefault();return}if(t===`.`){(r<=0||S.includes(`.`))&&e.preventDefault();return}if(/^[0-9]$/.test(t)){let t=S.indexOf(`.`);if(t!==-1){let n=S.split(`.`)[1]||``;e.currentTarget.selectionStart>t&&n.length>=r&&e.preventDefault()}return}e.preventDefault()}},T=e=>{let t=e.target.value;if(t===``||t===`-`||t===`.`){C(t),n(null);return}let r=parseFloat(t);isNaN(r)||(C(t),n(r))},E=e=>{x(!0),o?.(e)},D=e=>{x(!1),S===`-`||S===`.`?(C(``),n(null)):S.endsWith(`.`)&&C(S.slice(0,-1)),s?.(e)};if(u){let{appearance:e,size:r,...i}=_,o=t,s=!b&&o!==null?a?a(o):o.toString():S,l=(e,t)=>{n(t.value??null)};if(v){let e=!i.disabled&&!i.readOnly,t=()=>{if(!e)return;let t=(o??0)+u;m!==void 0&&t>m||n(t)},r=()=>{if(!e)return;let t=(o??0)-u;p!==void 0&&t<p||n(t)};return(0,d.jsx)(c.Input,{...i,className:h,contentAfter:(0,d.jsxs)(`div`,{className:y.arrows,children:[(0,d.jsx)(f.ChevronUpRegular,{className:y.arrowIcon,onClick:t,onMouseDown:e=>e.preventDefault()}),(0,d.jsx)(f.ChevronDownRegular,{className:y.arrowIcon,onClick:r,onMouseDown:e=>e.preventDefault()})]}),onKeyDown:e=>{e.key!==`Tab`&&e.preventDefault()},style:g,type:`text`,value:s})}return(0,d.jsx)(c.SpinButton,{...i,appearance:e===`filled-darker-shadow`?`filled-darker`:e===`filled-lighter-shadow`?`filled-lighter`:e,className:h,displayValue:s,max:m,min:p,onChange:l,onKeyDown:e=>e.preventDefault(),size:r===`large`?`medium`:r,step:u,style:g,value:o})}let O=!b&&t!==null?a?a(t):t.toString():S;return(0,d.jsx)(c.Input,{..._,className:h,onBlur:D,onChange:T,onFocus:E,onKeyDown:w,style:g,type:`text`,value:O})}),Re=e=>{let{value:t,onChange:n,...r}=e,i=t===null?void 0:()=>n(null);return(0,d.jsx)(Le,{...r,onChange:n,onClear:i,value:t})},ze=B(e=>{let{onChange:t,className:n,style:r,readOnly:i=!1,...a}=e,o=(e,n)=>{i||t?.(n)};return(0,d.jsx)(c.RadioGroup,{...a,className:n,onChange:o,style:r})}),Be=e=>{let{readOnly:t=!1,onChange:n,className:r,style:i,...a}=e,o=(e,r)=>{t||n(r.checked)};return(0,d.jsx)(c.Switch,{...a,className:r,onChange:o,style:i})},Ve=B(e=>{let{value:t,onChange:n,className:r,style:i,readOnly:a=!1,...o}=e;return(0,d.jsx)(c.Textarea,{...o,className:r,onChange:(e,t)=>{a||n(t.value??null)},style:i,value:t??``})}),He=e=>{let{value:t,maxLength:n,additionalMessage:r,onChange:i,...a}=e,o=n===void 0?void 0:`${(t??``).length}/${n}`,s=t!==null&&t!==``?()=>i(null):void 0;return(0,d.jsx)(Ve,{...a,additionalMessage:r??o,maxLength:n,onChange:i,onClear:s,value:t})};exports.FuiButtonPanel=ae,exports.FuiColumn=fe,exports.FuiImageCarousel=ve,exports.FuiInputCheckbox=ye,exports.FuiInputDate=we,exports.FuiInputDropdown=de,exports.FuiInputGroup=je,exports.FuiInputMultiLangText=Fe,exports.FuiInputNumber=Re,exports.FuiInputRadio=ze,exports.FuiInputSwitch=Be,exports.FuiInputText=$,exports.FuiInputTextArea=He,exports.FuiInputTime=Oe,exports.FuiTab=se,exports.FuiTabList=ce,exports.FuiTable=ge,exports.HandyFluentUiProvider=M,exports.useBreadcrumb=te,exports.useDialog=ne,exports.useIsMobile=P,exports.useLogger=N,exports.useSpinner=re,exports.useTheme=F,exports.useTimeZone=I,exports.useToast=L,exports.withInputField=B;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|