oolib 2.226.2 → 2.227.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/dist/index.d.ts
CHANGED
|
@@ -88,3 +88,4 @@ export { ButtonPrimary as ButtonPrimaryV2, ButtonSecondary as ButtonSecondaryV2,
|
|
|
88
88
|
export { colors as colors2, typo as typoV2_CSS } from "./v2/themes";
|
|
89
89
|
export { RadioInput, RadioButton } from "./v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index";
|
|
90
90
|
export { SwitchSingle, SwitchDouble } from "./v2/components/Switches";
|
|
91
|
+
export { useFloatingPosition, FloatingFocusManager, FloatingPortal } from "./utils/customHooks/useFloatingPosition";
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.BannerInfo = exports.BannerAlert = exports.GroupQuestionsInputSingle = exports.ResourceInput = exports.IFrameInput = exports.PDFInput = exports.AudioInput = exports.VideoInput = exports.ProfileImageInput = exports.ImageInput = exports.MetaBlock = exports.parseCardConfig = exports.ListProfile = exports.CardProfile = exports.CardEmbed = exports.DateTimeRangePicker = exports.DateTimePicker = exports.TimeRangePicker = exports.TimePicker = exports.DateRangePicker = exports.DatePicker = exports.TextLoader = exports.PageScrollIndicator = exports.HomeCover = exports.EmptyStates = exports.ModalSmall = exports.Modal = exports.ModalForms = exports.ModalConfirm = exports.SkeletonLoader = exports.Divider = exports.PercentCompletedPie = exports.Accordion = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.TagDisplay = exports.TagSelect = exports.TagLink = exports.TagClear = exports.LoaderOverlay = exports.Loader = exports.ProgressBar = exports.LoaderCircle = exports.applyBlackOverlayOnHover = exports.icons = exports.colors = exports.GlobalStyles = void 0;
|
|
43
43
|
exports.List = exports.SwitchDouble = exports.SwitchSingle = exports.RadioButton = exports.RadioInput = exports.RadioList = exports.CheckboxButton = exports.CheckboxInput = exports.CheckboxList = exports.AccordionV2 = exports.HomeCoverV2 = exports.DateRangePickerV2 = exports.MetaBlockV2 = exports.typoV2_CSS = exports.colors2 = exports.TabBarV2 = exports.ButtonUpload = exports.ButtonGhostCompact = exports.ButtonTertiaryCompact = exports.ButtonSecondaryCompact = exports.ButtonPrimaryCompact = exports.ButtonGhostV2 = exports.ButtonTertiaryV2 = exports.ButtonSecondaryV2 = exports.ButtonPrimaryV2 = exports.TagClearV2 = exports.TagLinkV2 = exports.TagDisplayV2 = exports.generateOptions = exports.genTagComp = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.HintsProvider = exports.BlockLabel = exports.ListContent = exports.CardContent = exports.URLInput = exports.PasswordInput = exports.PhoneInput = exports.NumberInput = exports.EmailInput = exports.TextInput = exports.TableCellResizerPlugin = exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = void 0;
|
|
44
|
-
exports.baseStyling = exports.TooltipV2 = exports.ListItem = void 0;
|
|
44
|
+
exports.FloatingPortal = exports.FloatingFocusManager = exports.useFloatingPosition = exports.baseStyling = exports.TooltipV2 = exports.ListItem = void 0;
|
|
45
45
|
//css and styling related ( styled-components )
|
|
46
46
|
var globalStyles_1 = require("./globalStyles");
|
|
47
47
|
Object.defineProperty(exports, "GlobalStyles", { enumerable: true, get: function () { return globalStyles_1.GlobalStyles; } });
|
|
@@ -252,3 +252,8 @@ Object.defineProperty(exports, "ListItem", { enumerable: true, get: function ()
|
|
|
252
252
|
var Tooltip_2 = require("./v2/components/Tooltip");
|
|
253
253
|
Object.defineProperty(exports, "TooltipV2", { enumerable: true, get: function () { return __importDefault(Tooltip_2).default; } });
|
|
254
254
|
exports.baseStyling = __importStar(require("./v2/themes/utils/baseStyling"));
|
|
255
|
+
// Floating UI hooks and utilities
|
|
256
|
+
var useFloatingPosition_1 = require("./utils/customHooks/useFloatingPosition");
|
|
257
|
+
Object.defineProperty(exports, "useFloatingPosition", { enumerable: true, get: function () { return useFloatingPosition_1.useFloatingPosition; } });
|
|
258
|
+
Object.defineProperty(exports, "FloatingFocusManager", { enumerable: true, get: function () { return useFloatingPosition_1.FloatingFocusManager; } });
|
|
259
|
+
Object.defineProperty(exports, "FloatingPortal", { enumerable: true, get: function () { return useFloatingPosition_1.FloatingPortal; } });
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { type UseFloatingOptions, type OpenChangeReason, type UseHoverProps, type UseClickProps, type UseDismissProps, type UseFocusProps, type UseRoleProps, type ArrowOptions, type OffsetOptions, type ShiftOptions, type FlipOptions, type AutoPlacementOptions, type HideOptions, type UseTransitionStylesProps, type Middleware } from "@floating-ui/react";
|
|
2
|
-
import { type CSSProperties } from "react";
|
|
2
|
+
import { type CSSProperties, type MutableRefObject } from "react";
|
|
3
|
+
export { FloatingFocusManager, FloatingPortal } from "@floating-ui/react";
|
|
4
|
+
export interface ListNavigationOptions {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
listRef: MutableRefObject<(HTMLElement | null)[]>;
|
|
7
|
+
activeIndex: number | null;
|
|
8
|
+
onNavigate?: (index: number | null) => void;
|
|
9
|
+
loop?: boolean;
|
|
10
|
+
virtual?: boolean;
|
|
11
|
+
orientation?: "vertical" | "horizontal" | "both";
|
|
12
|
+
focusItemOnOpen?: boolean | "auto";
|
|
13
|
+
focusItemOnHover?: boolean;
|
|
14
|
+
openOnArrowKeyDown?: boolean;
|
|
15
|
+
disabledIndices?: number[];
|
|
16
|
+
allowEscape?: boolean;
|
|
17
|
+
cols?: number;
|
|
18
|
+
scrollItemIntoView?: boolean | ScrollIntoViewOptions;
|
|
19
|
+
}
|
|
3
20
|
interface UseFloatingPositionPropsBase {
|
|
4
21
|
placement?: UseFloatingOptions["placement"];
|
|
5
22
|
strategy?: UseFloatingOptions["strategy"];
|
|
@@ -38,6 +55,7 @@ interface UseFloatingPositionPropsBase {
|
|
|
38
55
|
config?: HideOptions;
|
|
39
56
|
};
|
|
40
57
|
};
|
|
58
|
+
listNavigationOptions?: ListNavigationOptions;
|
|
41
59
|
}
|
|
42
60
|
interface UseFloatingPositionPropsHover extends UseFloatingPositionPropsBase {
|
|
43
61
|
enableTriggerOnClick?: false;
|
|
@@ -49,7 +67,7 @@ interface UseFloatingPositionPropsClick extends UseFloatingPositionPropsBase {
|
|
|
49
67
|
clickOptions?: Omit<UseClickProps, "enabled">;
|
|
50
68
|
}
|
|
51
69
|
export type UseFloatingPositionProps = UseFloatingPositionPropsHover | UseFloatingPositionPropsClick;
|
|
52
|
-
export declare const useFloatingPosition: ({ placement, strategy, transform, open, onOpenChange, enableTriggerOnClick, dismissOptions, focusOptions, roleOptions, showArrow, arrowRef, arrowPadding, enableDelayGroups, transitionOptions, customMiddleware, disableAutoUpdate, middlewareOptions, ...options }: UseFloatingPositionProps) => {
|
|
70
|
+
export declare const useFloatingPosition: ({ placement, strategy, transform, open, onOpenChange, enableTriggerOnClick, dismissOptions, focusOptions, roleOptions, showArrow, arrowRef, arrowPadding, enableDelayGroups, transitionOptions, customMiddleware, disableAutoUpdate, middlewareOptions, listNavigationOptions, ...options }: UseFloatingPositionProps) => {
|
|
53
71
|
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
|
|
54
72
|
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
55
73
|
getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
|
|
@@ -61,7 +79,7 @@ export declare const useFloatingPosition: ({ placement, strategy, transform, ope
|
|
|
61
79
|
x: number;
|
|
62
80
|
floatingStyles: React.CSSProperties;
|
|
63
81
|
refs: {
|
|
64
|
-
reference:
|
|
82
|
+
reference: MutableRefObject<import("@floating-ui/react-dom").ReferenceType>;
|
|
65
83
|
floating: React.MutableRefObject<HTMLElement | null>;
|
|
66
84
|
setReference: (node: import("@floating-ui/react-dom").ReferenceType) => void;
|
|
67
85
|
setFloating: (node: HTMLElement | null) => void;
|
|
@@ -96,4 +114,3 @@ export declare const useFloatingPosition: ({ placement, strategy, transform, ope
|
|
|
96
114
|
transitionStyles: CSSProperties;
|
|
97
115
|
update: () => void;
|
|
98
116
|
};
|
|
99
|
-
export {};
|
|
@@ -22,12 +22,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.useFloatingPosition = void 0;
|
|
25
|
+
exports.useFloatingPosition = exports.FloatingPortal = exports.FloatingFocusManager = void 0;
|
|
26
26
|
var react_1 = require("@floating-ui/react");
|
|
27
27
|
var react_2 = require("react");
|
|
28
|
+
// Re-export FloatingFocusManager and FloatingPortal for consumers
|
|
29
|
+
var react_3 = require("@floating-ui/react");
|
|
30
|
+
Object.defineProperty(exports, "FloatingFocusManager", { enumerable: true, get: function () { return react_3.FloatingFocusManager; } });
|
|
31
|
+
Object.defineProperty(exports, "FloatingPortal", { enumerable: true, get: function () { return react_3.FloatingPortal; } });
|
|
28
32
|
var useFloatingPosition = function (_a) {
|
|
29
|
-
var
|
|
30
|
-
var
|
|
33
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
34
|
+
var placement = _a.placement, strategy = _a.strategy, transform = _a.transform, open = _a.open, onOpenChange = _a.onOpenChange, _k = _a.enableTriggerOnClick, enableTriggerOnClick = _k === void 0 ? false : _k, dismissOptions = _a.dismissOptions, focusOptions = _a.focusOptions, roleOptions = _a.roleOptions, _l = _a.showArrow, showArrow = _l === void 0 ? false : _l, arrowRef = _a.arrowRef, arrowPadding = _a.arrowPadding, _m = _a.enableDelayGroups, enableDelayGroups = _m === void 0 ? true : _m, transitionOptions = _a.transitionOptions, customMiddleware = _a.customMiddleware, _o = _a.disableAutoUpdate, disableAutoUpdate = _o === void 0 ? false : _o, _p = _a.middlewareOptions, middlewareOptions = _p === void 0 ? {} : _p, listNavigationOptions = _a.listNavigationOptions, options = __rest(_a, ["placement", "strategy", "transform", "open", "onOpenChange", "enableTriggerOnClick", "dismissOptions", "focusOptions", "roleOptions", "showArrow", "arrowRef", "arrowPadding", "enableDelayGroups", "transitionOptions", "customMiddleware", "disableAutoUpdate", "middlewareOptions", "listNavigationOptions"]);
|
|
35
|
+
var _q = (0, react_2.useState)("unmounted"), state = _q[0], setState = _q[1];
|
|
31
36
|
var middlewares = [];
|
|
32
37
|
var offsetConfig = middlewareOptions.offset;
|
|
33
38
|
if ((offsetConfig === null || offsetConfig === void 0 ? void 0 : offsetConfig.enabled) !== false) {
|
|
@@ -57,7 +62,7 @@ var useFloatingPosition = function (_a) {
|
|
|
57
62
|
if ((hideConfig === null || hideConfig === void 0 ? void 0 : hideConfig.enabled) === true) {
|
|
58
63
|
middlewares.push((0, react_1.hide)(hideConfig === null || hideConfig === void 0 ? void 0 : hideConfig.config));
|
|
59
64
|
}
|
|
60
|
-
var
|
|
65
|
+
var _r = (0, react_1.useFloating)({
|
|
61
66
|
placement: placement,
|
|
62
67
|
strategy: strategy,
|
|
63
68
|
transform: transform,
|
|
@@ -71,7 +76,7 @@ var useFloatingPosition = function (_a) {
|
|
|
71
76
|
},
|
|
72
77
|
whileElementsMounted: disableAutoUpdate ? undefined : react_1.autoUpdate,
|
|
73
78
|
middleware: middlewares,
|
|
74
|
-
}), context =
|
|
79
|
+
}), context = _r.context, middlewareData = _r.middlewareData, isPositioned = _r.isPositioned, computedPlacement = _r.placement, update = _r.update, rest = __rest(_r, ["context", "middlewareData", "isPositioned", "placement", "update"]);
|
|
75
80
|
var delayGroupContext = (0, react_1.useDelayGroup)(context, {
|
|
76
81
|
enabled: enableDelayGroups,
|
|
77
82
|
});
|
|
@@ -107,14 +112,32 @@ var useFloatingPosition = function (_a) {
|
|
|
107
112
|
var focus = (0, react_1.useFocus)(context, focusOptions);
|
|
108
113
|
var role = (0, react_1.useRole)(context, roleOptions);
|
|
109
114
|
var dismiss = (0, react_1.useDismiss)(context, dismissOptions);
|
|
115
|
+
// List navigation for keyboard support (arrow keys)
|
|
116
|
+
var listNavigation = (0, react_1.useListNavigation)(context, {
|
|
117
|
+
listRef: (_b = listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.listRef) !== null && _b !== void 0 ? _b : { current: [] },
|
|
118
|
+
activeIndex: (_c = listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.activeIndex) !== null && _c !== void 0 ? _c : null,
|
|
119
|
+
onNavigate: listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.onNavigate,
|
|
120
|
+
loop: (_d = listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.loop) !== null && _d !== void 0 ? _d : true,
|
|
121
|
+
virtual: listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.virtual,
|
|
122
|
+
orientation: (_e = listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.orientation) !== null && _e !== void 0 ? _e : "vertical",
|
|
123
|
+
focusItemOnOpen: (_f = listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.focusItemOnOpen) !== null && _f !== void 0 ? _f : "auto",
|
|
124
|
+
focusItemOnHover: (_g = listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.focusItemOnHover) !== null && _g !== void 0 ? _g : true,
|
|
125
|
+
openOnArrowKeyDown: (_h = listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.openOnArrowKeyDown) !== null && _h !== void 0 ? _h : true,
|
|
126
|
+
disabledIndices: listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.disabledIndices,
|
|
127
|
+
allowEscape: listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.allowEscape,
|
|
128
|
+
cols: listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.cols,
|
|
129
|
+
scrollItemIntoView: listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.scrollItemIntoView,
|
|
130
|
+
enabled: (_j = listNavigationOptions === null || listNavigationOptions === void 0 ? void 0 : listNavigationOptions.enabled) !== null && _j !== void 0 ? _j : false,
|
|
131
|
+
});
|
|
110
132
|
var interactionProps = (0, react_1.useInteractions)([
|
|
111
133
|
hover,
|
|
112
134
|
click,
|
|
113
135
|
focus,
|
|
114
136
|
role,
|
|
115
137
|
dismiss,
|
|
138
|
+
listNavigation,
|
|
116
139
|
]);
|
|
117
|
-
var
|
|
140
|
+
var _s = (0, react_1.useTransitionStyles)(context, transitionOptions), isMounted = _s.isMounted, transitionStyles = _s.styles;
|
|
118
141
|
(0, react_2.useLayoutEffect)(function () {
|
|
119
142
|
if (isPositioned && state !== "positioned") {
|
|
120
143
|
setState("positioned");
|