onekijs-ui 0.21.3 → 0.21.9
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/components/contextmenu/components/ContextMenuComponent.d.ts +4 -0
- package/dist/components/contextmenu/index.d.ts +2 -0
- package/dist/components/contextmenu/style.d.ts +4 -0
- package/dist/components/contextmenu/typings.d.ts +7 -0
- package/dist/components/icon/util.d.ts +21 -21
- package/dist/index.d.ts +5 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +81 -1
- package/dist/index.module.js.map +1 -1
- package/dist/styles/background.d.ts +1 -1
- package/dist/styles/border.d.ts +6 -6
- package/dist/styles/grid.d.ts +1 -1
- package/dist/styles/size.d.ts +6 -6
- package/dist/styles/svg.d.ts +1 -1
- package/dist/styles/typography.d.ts +4 -4
- package/package.json +3 -3
- package/src/components/contextmenu/components/ContextMenuComponent.tsx +96 -0
- package/src/components/contextmenu/index.tsx +9 -0
- package/src/components/contextmenu/style.ts +14 -0
- package/src/components/contextmenu/typings.ts +6 -0
- package/src/index.ts +5 -0
|
@@ -42,16 +42,16 @@ export declare const getIconDivProps: (props: IconProps) => {
|
|
|
42
42
|
accessKey?: string | undefined;
|
|
43
43
|
autoFocus?: boolean | undefined;
|
|
44
44
|
className?: string | undefined;
|
|
45
|
-
contentEditable?: "inherit" | (boolean | "
|
|
45
|
+
contentEditable?: "inherit" | (boolean | "false" | "true") | undefined;
|
|
46
46
|
contextMenu?: string | undefined;
|
|
47
47
|
dir?: string | undefined;
|
|
48
|
-
draggable?: (boolean | "
|
|
48
|
+
draggable?: (boolean | "false" | "true") | undefined;
|
|
49
49
|
hidden?: boolean | undefined;
|
|
50
50
|
id?: string | undefined;
|
|
51
51
|
lang?: string | undefined;
|
|
52
52
|
nonce?: string | undefined;
|
|
53
53
|
slot?: string | undefined;
|
|
54
|
-
spellCheck?: (boolean | "
|
|
54
|
+
spellCheck?: (boolean | "false" | "true") | undefined;
|
|
55
55
|
style?: import("react").CSSProperties | undefined;
|
|
56
56
|
tabIndex?: number | undefined;
|
|
57
57
|
title?: string | undefined;
|
|
@@ -83,52 +83,52 @@ export declare const getIconDivProps: (props: IconProps) => {
|
|
|
83
83
|
inputMode?: "search" | "text" | "none" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined;
|
|
84
84
|
is?: string | undefined;
|
|
85
85
|
'aria-activedescendant'?: string | undefined;
|
|
86
|
-
'aria-atomic'?: (boolean | "
|
|
87
|
-
'aria-autocomplete'?: "
|
|
86
|
+
'aria-atomic'?: (boolean | "false" | "true") | undefined;
|
|
87
|
+
'aria-autocomplete'?: "both" | "none" | "inline" | "list" | undefined;
|
|
88
88
|
'aria-braillelabel'?: string | undefined;
|
|
89
89
|
'aria-brailleroledescription'?: string | undefined;
|
|
90
|
-
'aria-busy'?: (boolean | "
|
|
91
|
-
'aria-checked'?: boolean | "
|
|
90
|
+
'aria-busy'?: (boolean | "false" | "true") | undefined;
|
|
91
|
+
'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
|
|
92
92
|
'aria-colcount'?: number | undefined;
|
|
93
93
|
'aria-colindex'?: number | undefined;
|
|
94
94
|
'aria-colindextext'?: string | undefined;
|
|
95
95
|
'aria-colspan'?: number | undefined;
|
|
96
96
|
'aria-controls'?: string | undefined;
|
|
97
|
-
'aria-current'?: boolean | "time" | "
|
|
97
|
+
'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "date" | "location" | undefined;
|
|
98
98
|
'aria-describedby'?: string | undefined;
|
|
99
99
|
'aria-description'?: string | undefined;
|
|
100
100
|
'aria-details'?: string | undefined;
|
|
101
|
-
'aria-disabled'?: (boolean | "
|
|
101
|
+
'aria-disabled'?: (boolean | "false" | "true") | undefined;
|
|
102
102
|
'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
|
|
103
103
|
'aria-errormessage'?: string | undefined;
|
|
104
|
-
'aria-expanded'?: (boolean | "
|
|
104
|
+
'aria-expanded'?: (boolean | "false" | "true") | undefined;
|
|
105
105
|
'aria-flowto'?: string | undefined;
|
|
106
|
-
'aria-grabbed'?: (boolean | "
|
|
107
|
-
'aria-haspopup'?: boolean | "dialog" | "menu" | "listbox" | "grid" | "
|
|
108
|
-
'aria-hidden'?: (boolean | "
|
|
109
|
-
'aria-invalid'?: boolean | "
|
|
106
|
+
'aria-grabbed'?: (boolean | "false" | "true") | undefined;
|
|
107
|
+
'aria-haspopup'?: boolean | "dialog" | "menu" | "listbox" | "grid" | "false" | "true" | "tree" | undefined;
|
|
108
|
+
'aria-hidden'?: (boolean | "false" | "true") | undefined;
|
|
109
|
+
'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
110
110
|
'aria-keyshortcuts'?: string | undefined;
|
|
111
111
|
'aria-label'?: string | undefined;
|
|
112
112
|
'aria-labelledby'?: string | undefined;
|
|
113
113
|
'aria-level'?: number | undefined;
|
|
114
114
|
'aria-live'?: "off" | "assertive" | "polite" | undefined;
|
|
115
|
-
'aria-modal'?: (boolean | "
|
|
116
|
-
'aria-multiline'?: (boolean | "
|
|
117
|
-
'aria-multiselectable'?: (boolean | "
|
|
115
|
+
'aria-modal'?: (boolean | "false" | "true") | undefined;
|
|
116
|
+
'aria-multiline'?: (boolean | "false" | "true") | undefined;
|
|
117
|
+
'aria-multiselectable'?: (boolean | "false" | "true") | undefined;
|
|
118
118
|
'aria-orientation'?: "horizontal" | "vertical" | undefined;
|
|
119
119
|
'aria-owns'?: string | undefined;
|
|
120
120
|
'aria-placeholder'?: string | undefined;
|
|
121
121
|
'aria-posinset'?: number | undefined;
|
|
122
|
-
'aria-pressed'?: boolean | "
|
|
123
|
-
'aria-readonly'?: (boolean | "
|
|
122
|
+
'aria-pressed'?: boolean | "mixed" | "false" | "true" | undefined;
|
|
123
|
+
'aria-readonly'?: (boolean | "false" | "true") | undefined;
|
|
124
124
|
'aria-relevant'?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
125
|
-
'aria-required'?: (boolean | "
|
|
125
|
+
'aria-required'?: (boolean | "false" | "true") | undefined;
|
|
126
126
|
'aria-roledescription'?: string | undefined;
|
|
127
127
|
'aria-rowcount'?: number | undefined;
|
|
128
128
|
'aria-rowindex'?: number | undefined;
|
|
129
129
|
'aria-rowindextext'?: string | undefined;
|
|
130
130
|
'aria-rowspan'?: number | undefined;
|
|
131
|
-
'aria-selected'?: (boolean | "
|
|
131
|
+
'aria-selected'?: (boolean | "false" | "true") | undefined;
|
|
132
132
|
'aria-setsize'?: number | undefined;
|
|
133
133
|
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
134
134
|
'aria-valuemax'?: number | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,11 @@ export { default as Dropdown } from './components/dropdown';
|
|
|
40
40
|
export { default as DropdownComponent } from './components/dropdown/components/DropdownComponent';
|
|
41
41
|
export { default as useDropdown } from './components/dropdown/hooks/useDropdown';
|
|
42
42
|
export { default as dropdownStyle } from './components/dropdown/style';
|
|
43
|
+
export { DropdownComponentProps, DropdownProps, DropdownWidthModifier } from './components/dropdown/typings';
|
|
44
|
+
export { default as ContextMenu } from './components/contextmenu';
|
|
45
|
+
export { default as ContextMenuComponent } from './components/contextmenu/components/ContextMenuComponent';
|
|
46
|
+
export { default as contextMenuStyle } from './components/contextmenu/style';
|
|
47
|
+
export { ContextMenuProps } from './components/contextmenu/typings';
|
|
43
48
|
export { default as FieldDescription } from './components/field/FieldDescription';
|
|
44
49
|
export { default as FieldDisplayer } from './components/field/FieldDisplayer';
|
|
45
50
|
export { default as FieldHelp } from './components/field/FieldHelp';
|
package/dist/index.js
CHANGED
|
@@ -4117,6 +4117,86 @@ const useDashoardBodyPanel = () => {
|
|
|
4117
4117
|
return state.body;
|
|
4118
4118
|
};
|
|
4119
4119
|
|
|
4120
|
+
const contextMenuStyle = () => {
|
|
4121
|
+
return styled.css `
|
|
4122
|
+
${preflight()}
|
|
4123
|
+
${zIndex(9999)}
|
|
4124
|
+
`;
|
|
4125
|
+
};
|
|
4126
|
+
|
|
4127
|
+
const ContextMenuComponent = ({ refElement, className, children, offsetX = 0, offsetY = 0 }) => {
|
|
4128
|
+
const [visible, setVisible] = React.useState(false);
|
|
4129
|
+
// State for the anchor (the mouse coordinates) and the menu element
|
|
4130
|
+
const [virtualElement, setVirtualElement] = React.useState(null);
|
|
4131
|
+
const [popperElement, setPopperElement] = React.useState(null);
|
|
4132
|
+
// Initialize Popper with a virtual reference
|
|
4133
|
+
const { styles, attributes } = reactPopper.usePopper(virtualElement, popperElement, {
|
|
4134
|
+
placement: 'bottom-start',
|
|
4135
|
+
modifiers: [
|
|
4136
|
+
{
|
|
4137
|
+
name: 'offset',
|
|
4138
|
+
options: {
|
|
4139
|
+
offset: [offsetX, offsetY], // Slight offset so the menu isn't directly under the cursor
|
|
4140
|
+
},
|
|
4141
|
+
},
|
|
4142
|
+
],
|
|
4143
|
+
});
|
|
4144
|
+
// Handle the right-click event
|
|
4145
|
+
const handleContextMenu = React.useCallback((e) => {
|
|
4146
|
+
e.preventDefault(); // Prevent the browser's default context menu
|
|
4147
|
+
const x = e.clientX;
|
|
4148
|
+
const y = e.clientY;
|
|
4149
|
+
// Define a VirtualElement object that implements getBoundingClientRect
|
|
4150
|
+
const newVirtualElement = {
|
|
4151
|
+
getBoundingClientRect: () => ({
|
|
4152
|
+
width: 0,
|
|
4153
|
+
height: 0,
|
|
4154
|
+
top: y,
|
|
4155
|
+
right: x,
|
|
4156
|
+
bottom: y,
|
|
4157
|
+
left: x,
|
|
4158
|
+
x: x,
|
|
4159
|
+
y: y,
|
|
4160
|
+
toJSON: () => { }
|
|
4161
|
+
}),
|
|
4162
|
+
};
|
|
4163
|
+
setVirtualElement(newVirtualElement);
|
|
4164
|
+
setVisible(true);
|
|
4165
|
+
}, []);
|
|
4166
|
+
// Close the menu on left click or scroll
|
|
4167
|
+
React.useEffect(() => {
|
|
4168
|
+
const closeMenu = () => setVisible(false);
|
|
4169
|
+
window.addEventListener('click', closeMenu);
|
|
4170
|
+
window.addEventListener('scroll', closeMenu);
|
|
4171
|
+
if (refElement instanceof HTMLElement) {
|
|
4172
|
+
refElement.addEventListener('contextmenu', handleContextMenu);
|
|
4173
|
+
}
|
|
4174
|
+
else if (refElement.current !== null) {
|
|
4175
|
+
refElement.current.addEventListener('contextmenu', handleContextMenu);
|
|
4176
|
+
}
|
|
4177
|
+
return () => {
|
|
4178
|
+
window.removeEventListener('click', closeMenu);
|
|
4179
|
+
window.removeEventListener('scroll', closeMenu);
|
|
4180
|
+
if (refElement instanceof HTMLElement) {
|
|
4181
|
+
refElement.removeEventListener('contextmenu', handleContextMenu);
|
|
4182
|
+
}
|
|
4183
|
+
else if (refElement.current !== null) {
|
|
4184
|
+
refElement.current.removeEventListener('contextmenu', handleContextMenu);
|
|
4185
|
+
}
|
|
4186
|
+
};
|
|
4187
|
+
}, []);
|
|
4188
|
+
if (visible) {
|
|
4189
|
+
return (React.createElement("div", { ref: setPopperElement, className: addClassname('o-context-menu', className), style: {
|
|
4190
|
+
...styles.popper,
|
|
4191
|
+
}, ...attributes.popper }, children));
|
|
4192
|
+
}
|
|
4193
|
+
return null;
|
|
4194
|
+
};
|
|
4195
|
+
|
|
4196
|
+
const ContextMenu = styled(ContextMenuComponent) `
|
|
4197
|
+
${contextMenuStyle}
|
|
4198
|
+
`;
|
|
4199
|
+
|
|
4120
4200
|
const IconComponent$8 = ({ className, onClick }) => {
|
|
4121
4201
|
return (React.createElement("div", { className: className, onClick: onClick },
|
|
4122
4202
|
React.createElement("svg", { className: "o-icon-close-all-svg", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
|
|
@@ -14083,6 +14163,8 @@ exports.CheckboxCellComponent = CheckboxCellComponent;
|
|
|
14083
14163
|
exports.CheckboxComponent = CheckboxComponent;
|
|
14084
14164
|
exports.CloseAllIcon = CloseAllIcon;
|
|
14085
14165
|
exports.Col = Col;
|
|
14166
|
+
exports.ContextMenu = ContextMenu;
|
|
14167
|
+
exports.ContextMenuComponent = ContextMenuComponent;
|
|
14086
14168
|
exports.ControlledSelectComponent = ControlledSelectComponent;
|
|
14087
14169
|
exports.ControlledTimerComponent = ControlledTimerComponent;
|
|
14088
14170
|
exports.ControlledWizardComponent = ControlledWizardComponent;
|
|
@@ -14318,6 +14400,7 @@ exports.columnSpan = columnSpan;
|
|
|
14318
14400
|
exports.columnWidth = columnWidth;
|
|
14319
14401
|
exports.columns = columns;
|
|
14320
14402
|
exports.container = container;
|
|
14403
|
+
exports.contextMenuStyle = contextMenuStyle;
|
|
14321
14404
|
exports.cssProperty = cssProperty;
|
|
14322
14405
|
exports.cursor = cursor;
|
|
14323
14406
|
exports.darken = darken;
|