@qoretechnologies/reqore 0.30.2 → 0.30.3
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/__tests__/collection.test.tsx +1 -1
- package/__tests__/panel.test.tsx +47 -0
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +21 -22
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +4 -21
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +5 -2
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +25 -25
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Tag/index.d.ts +2 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/helpers/utils.d.ts +2 -0
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +3 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/types/global.d.ts +13 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/Collection/index.tsx +25 -28
- package/src/components/ControlGroup/index.tsx +2 -22
- package/src/components/Panel/index.tsx +44 -35
- package/src/components/Tag/index.tsx +3 -1
- package/src/helpers/utils.ts +3 -0
- package/src/stories/Checkbox/Checkbox.stories.tsx +2 -0
- package/src/stories/Panel/Panel.stories.tsx +52 -11
- package/src/stories/Tag/Tag.stories.tsx +2 -2
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":"AAUA,OAAO,EAAyC,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEnF,eAAO,MAAM,KAAK,OAAc,MAAM,qBAAgD,CAAC;AAEvF,eAAO,MAAM,gBAAgB,EAAE,QA8B9B,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,MAM5C,CAAC;AAEF,eAAO,MAAM,2BAA2B,UAAW,MAAM,YAAiB,MAAM,KAAG,MAsBlF,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,MAAM,GAAG,MAAM,YAE3D,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,MAO7C,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAyC,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEnF,eAAO,MAAM,KAAK,OAAc,MAAM,qBAAgD,CAAC;AAEvF,eAAO,MAAM,gBAAgB,EAAE,QA8B9B,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,MAM5C,CAAC;AAEF,eAAO,MAAM,2BAA2B,UAAW,MAAM,YAAiB,MAAM,KAAG,MAsBlF,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,MAAM,GAAG,MAAM,YAE3D,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,MAO7C,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,kBAAkB,YAA0B,CAAC"}
|
package/dist/helpers/utils.js
CHANGED
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
exports.__esModule = true;
|
|
39
|
-
exports.getOneLessSize = exports.isStringSize = exports.calculateStringSizeInPixels = exports.getLineCount = exports.getTypeFromValue = exports.sleep = void 0;
|
|
39
|
+
exports.isActionShown = exports.getOneLessSize = exports.isStringSize = exports.calculateStringSizeInPixels = exports.getLineCount = exports.getTypeFromValue = exports.sleep = void 0;
|
|
40
40
|
var lodash_1 = require("lodash");
|
|
41
41
|
var sizes_1 = require("../constants/sizes");
|
|
42
42
|
var sleep = function (ms) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
@@ -115,4 +115,6 @@ var getOneLessSize = function (size) {
|
|
|
115
115
|
return sizes_1.NUMBER_TO_SIZE[oneLessSizeNumber];
|
|
116
116
|
};
|
|
117
117
|
exports.getOneLessSize = getOneLessSize;
|
|
118
|
+
var isActionShown = function (action) { return action.show !== false; };
|
|
119
|
+
exports.isActionShown = isActionShown;
|
|
118
120
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCASgB;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCASgB;AAEhB,4CAAmF;AAE5E,IAAM,KAAK,GAAG,UAAO,EAAU;;gBAAK,qBAAM,IAAI,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,EAAjB,CAAiB,CAAC,EAAA;gBAA3C,sBAAA,SAA2C,EAAA;;SAAA,CAAC;AAA1E,QAAA,KAAK,SAAqE;AAEhF,IAAM,gBAAgB,GAAa,UAAC,IAAS;IAClD,IAAI,IAAA,kBAAS,EAAC,IAAI,CAAC,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,IAAA,iBAAQ,EAAC,IAAI,CAAC,EAAE;QAClB,OAAO,QAAQ,CAAC;KACjB;IAED,IAAI,IAAA,iBAAQ,EAAC,IAAI,CAAC,EAAE;QAClB,OAAO,QAAQ,CAAC;KACjB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AE,GAAG,YAAK,OAAA,GAAG,GAAG,CAAC,MAAA,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,mCAAI,GAAG,CAAC,CAAA,EAAA,EAAE,CAAC,CAAC;QACnF,CAAC,QAAQ,GAAG,IAAI,CAAC,CAClB,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,2BAA2B,+BAsBtC;AAEK,IAAM,YAAY,GAAG,UAAC,KAA+B;IAC1D,OAAO,aAAK,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC;AACzC,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,IAAM,cAAc,GAAG,UAAC,IAAY;IACzC,+BAA+B;IAC/B,IAAM,iBAAiB,GAAW,sBAAc,CAAC,IAAI,CAAC,CAAC;IACvD,gCAAgC;IAChC,IAAM,iBAAiB,GAAW,iBAAiB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC;IAC1F,oCAAoC;IACpC,OAAO,sBAAc,CAAC,iBAAiB,CAAC,CAAC;AAC3C,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB;AAEK,IAAM,aAAa,GAAG,UAAC,MAA0B,IAAK,OAAA,MAAM,CAAC,IAAI,KAAK,KAAK,EAArB,CAAqB,CAAC;AAAtE,QAAA,aAAa,iBAAyD"}
|
package/dist/types/global.d.ts
CHANGED
|
@@ -129,6 +129,19 @@ export interface IWithReqoreFluid {
|
|
|
129
129
|
*/
|
|
130
130
|
fluid?: boolean;
|
|
131
131
|
}
|
|
132
|
+
export interface IWithReqoreFixed {
|
|
133
|
+
/**
|
|
134
|
+
* If true, the component will be fixed in fluid containers
|
|
135
|
+
* @default false
|
|
136
|
+
* @type boolean
|
|
137
|
+
* @example
|
|
138
|
+
* <ReqoreInput fixed />
|
|
139
|
+
* <ReqoreInput fixed={true} />
|
|
140
|
+
* <ReqoreInput fixed={false} />
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
fixed?: boolean;
|
|
144
|
+
}
|
|
132
145
|
export interface IWithReqoreMinimal {
|
|
133
146
|
/**
|
|
134
147
|
* If true, the component will be minimal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG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C;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;CAAG;AAC1D,oBAAY,kBAAkB,GAAG,MAAM,GAAG,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoretechnologies/reqore",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.3",
|
|
4
4
|
"description": "ReQore is a highly theme-able and modular UI library for React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"qorus",
|
|
25
25
|
"react"
|
|
26
26
|
],
|
|
27
|
+
"pre-push": [
|
|
28
|
+
"build:test",
|
|
29
|
+
"test"
|
|
30
|
+
],
|
|
27
31
|
"author": "Qore Technologies",
|
|
28
32
|
"license": "ISC",
|
|
29
33
|
"bugs": {
|
|
@@ -60,6 +64,7 @@
|
|
|
60
64
|
"jest-github-actions-reporter": "^1.0.2",
|
|
61
65
|
"npm-cli-login": "^0.1.1",
|
|
62
66
|
"playwright": "^1.16.3",
|
|
67
|
+
"pre-push": "^0.1.4",
|
|
63
68
|
"react": "^17.0.2",
|
|
64
69
|
"react-dom": "^17.0.2",
|
|
65
70
|
"react-test-renderer": "^17.0.2",
|
|
@@ -6,7 +6,7 @@ import { IReqoreIconName } from '../../types/icons';
|
|
|
6
6
|
import { IReqoreColumnsProps, StyledColumns } from '../Columns';
|
|
7
7
|
import ReqoreInput from '../Input';
|
|
8
8
|
import ReqoreMessage from '../Message';
|
|
9
|
-
import { IReqorePanelAction, IReqorePanelProps, ReqorePanel } from '../Panel';
|
|
9
|
+
import { IReqorePanelAction, IReqorePanelProps, ReqorePanel, TReqorePanelActions } from '../Panel';
|
|
10
10
|
import { sortTableData } from '../Table/helpers';
|
|
11
11
|
import { IReqoreCollectionItemProps, ReqoreCollectionItem } from './item';
|
|
12
12
|
|
|
@@ -134,10 +134,29 @@ export const ReqoreCollection = ({
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
const finalItems = filteredItems;
|
|
137
|
-
const finalActions:
|
|
138
|
-
let actions:
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
const finalActions: TReqorePanelActions = useMemo(() => {
|
|
138
|
+
let actions: TReqorePanelActions = rest.actions ? [...rest.actions] : [];
|
|
139
|
+
|
|
140
|
+
const toolbarGroup: IReqorePanelAction = {
|
|
141
|
+
responsive: false,
|
|
142
|
+
group: [
|
|
143
|
+
{
|
|
144
|
+
icon: _showAs === 'grid' ? 'ListOrdered' : 'GridLine',
|
|
145
|
+
onClick: () => setShowAs(_showAs === 'grid' ? 'list' : 'grid'),
|
|
146
|
+
tooltip: _showAs === 'grid' ? 'Show as list' : 'Show as grid',
|
|
147
|
+
disabled: !size(finalItems),
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
if (sortable) {
|
|
153
|
+
toolbarGroup.group.push({
|
|
154
|
+
icon: sort === 'desc' ? 'SortDesc' : 'SortAsc',
|
|
155
|
+
onClick: () => setSort(sort === 'desc' ? 'asc' : 'desc'),
|
|
156
|
+
tooltip: sort === 'desc' ? 'Sort ascending' : 'Sort descending',
|
|
157
|
+
disabled: !size(finalItems),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
141
160
|
|
|
142
161
|
if (filterable) {
|
|
143
162
|
actions = [
|
|
@@ -156,29 +175,7 @@ export const ReqoreCollection = ({
|
|
|
156
175
|
];
|
|
157
176
|
}
|
|
158
177
|
|
|
159
|
-
|
|
160
|
-
actions = [
|
|
161
|
-
...actions,
|
|
162
|
-
{
|
|
163
|
-
icon: sort === 'desc' ? 'SortDesc' : 'SortAsc',
|
|
164
|
-
onClick: () => setSort(sort === 'desc' ? 'asc' : 'desc'),
|
|
165
|
-
tooltip: sort === 'desc' ? 'Sort ascending' : 'Sort descending',
|
|
166
|
-
disabled: !size(finalItems),
|
|
167
|
-
responsive: false,
|
|
168
|
-
},
|
|
169
|
-
];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return [
|
|
173
|
-
...actions,
|
|
174
|
-
{
|
|
175
|
-
icon: _showAs === 'grid' ? 'ListOrdered' : 'GridLine',
|
|
176
|
-
onClick: () => setShowAs(_showAs === 'grid' ? 'list' : 'grid'),
|
|
177
|
-
tooltip: _showAs === 'grid' ? 'Show as list' : 'Show as grid',
|
|
178
|
-
disabled: !size(finalItems),
|
|
179
|
-
responsive: false,
|
|
180
|
-
},
|
|
181
|
-
];
|
|
178
|
+
return [...actions, toolbarGroup];
|
|
182
179
|
}, [filterable, handleQueryChange, query, rest.actions, _showAs, sort, sortable, finalItems]);
|
|
183
180
|
|
|
184
181
|
return (
|
|
@@ -131,12 +131,9 @@ const ReqoreControlGroup = memo(
|
|
|
131
131
|
|
|
132
132
|
const [overflowingChildren, setOverflowingChildren] = useState<number | undefined>(0);
|
|
133
133
|
const [lastReSize, setLastReSize] = useState<number>(0);
|
|
134
|
-
const [isResizing, setIsResizing] = useState<boolean>(false);
|
|
135
134
|
const [isOverflownDialogOpen, setIsOverflownDialogOpen] = useState<boolean>(false);
|
|
136
135
|
const observer = useRef<ResizeObserver | null>(null);
|
|
137
136
|
const ref = useRef<HTMLDivElement>(null);
|
|
138
|
-
const resizeTimerObserver = useRef<ResizeObserver | null>(null);
|
|
139
|
-
const resizingTimer = useRef<any>(null);
|
|
140
137
|
|
|
141
138
|
const realChildCount = useMemo((): number => {
|
|
142
139
|
let count = 0;
|
|
@@ -180,18 +177,7 @@ const ReqoreControlGroup = memo(
|
|
|
180
177
|
}, 200)
|
|
181
178
|
);
|
|
182
179
|
|
|
183
|
-
resizeTimerObserver.current = new ResizeObserver(() => {
|
|
184
|
-
if (ref && ref.current) {
|
|
185
|
-
setIsResizing(true);
|
|
186
|
-
clearTimeout(resizingTimer.current);
|
|
187
|
-
resizingTimer.current = setTimeout(() => {
|
|
188
|
-
setIsResizing(false);
|
|
189
|
-
}, 500);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
180
|
observer.current.observe(ref.current);
|
|
194
|
-
resizeTimerObserver.current.observe(ref.current);
|
|
195
181
|
}
|
|
196
182
|
}
|
|
197
183
|
});
|
|
@@ -200,12 +186,6 @@ const ReqoreControlGroup = memo(
|
|
|
200
186
|
if (observer.current) {
|
|
201
187
|
observer.current.disconnect();
|
|
202
188
|
}
|
|
203
|
-
|
|
204
|
-
if (resizeTimerObserver.current) {
|
|
205
|
-
resizeTimerObserver.current.disconnect();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
clearTimeout(resizingTimer.current);
|
|
209
189
|
});
|
|
210
190
|
|
|
211
191
|
useEffect(() => {
|
|
@@ -429,9 +409,10 @@ const ReqoreControlGroup = memo(
|
|
|
429
409
|
content: `Show ${React.Children.count(overflownChildren)} hidden items`,
|
|
430
410
|
}}
|
|
431
411
|
fixed
|
|
412
|
+
active={isOverflownDialogOpen}
|
|
432
413
|
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
|
|
433
414
|
e.stopPropagation();
|
|
434
|
-
setIsOverflownDialogOpen(
|
|
415
|
+
setIsOverflownDialogOpen(!isOverflownDialogOpen);
|
|
435
416
|
}}
|
|
436
417
|
flat
|
|
437
418
|
/>,
|
|
@@ -465,7 +446,6 @@ const ReqoreControlGroup = memo(
|
|
|
465
446
|
vertical={vertical}
|
|
466
447
|
style={{
|
|
467
448
|
overflowX: responsive ? 'auto' : undefined,
|
|
468
|
-
visibility: isResizing ? 'hidden' : undefined,
|
|
469
449
|
...rest.style,
|
|
470
450
|
}}
|
|
471
451
|
size={size}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
getMainBackgroundColor,
|
|
20
20
|
getReadableColor,
|
|
21
21
|
} from '../../helpers/colors';
|
|
22
|
+
import { isActionShown } from '../../helpers/utils';
|
|
22
23
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
23
24
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
24
25
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
@@ -45,6 +46,7 @@ import { ReqoreHorizontalSpacer, ReqoreSpacer } from '../Spacer';
|
|
|
45
46
|
export interface IReqorePanelAction extends IReqoreButtonProps, IWithReqoreTooltip, IReqoreIntent {
|
|
46
47
|
label?: string | number;
|
|
47
48
|
onClick?: () => void;
|
|
49
|
+
group?: IReqorePanelAction[];
|
|
48
50
|
actions?: Omit<IReqoreDropdownItem[], 'value'>;
|
|
49
51
|
// Custom react element
|
|
50
52
|
as?: React.ElementType;
|
|
@@ -60,6 +62,8 @@ export interface IReqorePanelBottomAction extends IReqorePanelAction {
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
export interface IReqorePanelContent {}
|
|
65
|
+
export type TReqorePanelActions = IReqorePanelAction[];
|
|
66
|
+
export type TReqorePanelBottomActions = IReqorePanelBottomAction[];
|
|
63
67
|
|
|
64
68
|
export interface IReqorePanelProps
|
|
65
69
|
extends IWithReqoreSize,
|
|
@@ -78,8 +82,8 @@ export interface IReqorePanelProps
|
|
|
78
82
|
isCollapsed?: boolean;
|
|
79
83
|
onClose?: () => void;
|
|
80
84
|
rounded?: boolean;
|
|
81
|
-
actions?:
|
|
82
|
-
bottomActions?:
|
|
85
|
+
actions?: TReqorePanelActions;
|
|
86
|
+
bottomActions?: TReqorePanelBottomActions;
|
|
83
87
|
unMountContentOnCollapse?: boolean;
|
|
84
88
|
onCollapseChange?: (isCollapsed?: boolean) => void;
|
|
85
89
|
fill?: boolean;
|
|
@@ -305,7 +309,13 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
305
309
|
|
|
306
310
|
// Return true if the card has a title bar, otherwise return false.
|
|
307
311
|
const hasTitleBar: boolean = useMemo(
|
|
308
|
-
() =>
|
|
312
|
+
() =>
|
|
313
|
+
!!label ||
|
|
314
|
+
collapsible ||
|
|
315
|
+
!!onClose ||
|
|
316
|
+
!!size(actions.filter(isActionShown)) ||
|
|
317
|
+
!!badge ||
|
|
318
|
+
!!icon,
|
|
309
319
|
[label, collapsible, onClose, actions, badge]
|
|
310
320
|
);
|
|
311
321
|
|
|
@@ -332,60 +342,42 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
332
342
|
|
|
333
343
|
// Calculates whether or not the bottom actions should be displayed.
|
|
334
344
|
const hasBottomActions: boolean = useMemo(
|
|
335
|
-
() =>
|
|
345
|
+
() =>
|
|
346
|
+
!!(
|
|
347
|
+
size(leftBottomActions.filter(isActionShown)) ||
|
|
348
|
+
size(rightBottomActions.filter(isActionShown))
|
|
349
|
+
),
|
|
336
350
|
[leftBottomActions, rightBottomActions]
|
|
337
351
|
);
|
|
338
352
|
|
|
339
353
|
const renderResponsiveActions = useCallback(
|
|
340
|
-
(
|
|
341
|
-
return renderActions(
|
|
354
|
+
(action: IReqorePanelAction, index: number) => {
|
|
355
|
+
return renderActions(action, index, true);
|
|
342
356
|
},
|
|
343
357
|
[actions]
|
|
344
358
|
);
|
|
345
359
|
|
|
346
360
|
const hasNonResponsiveActions = useCallback(
|
|
347
|
-
(data:
|
|
348
|
-
data.some(
|
|
349
|
-
(action) => !Array.isArray(action) && action.responsive === false && action.show !== false
|
|
350
|
-
),
|
|
361
|
+
(data: TReqorePanelActions) =>
|
|
362
|
+
data.some((action) => action.responsive === false && action.show !== false),
|
|
351
363
|
[actions, bottomActions]
|
|
352
364
|
);
|
|
353
365
|
|
|
354
366
|
const hasResponsiveActions = useCallback(
|
|
355
|
-
(data:
|
|
356
|
-
data.some(
|
|
357
|
-
(action) =>
|
|
358
|
-
Array.isArray(action) || (action.responsive !== false && action.show !== false)
|
|
359
|
-
),
|
|
367
|
+
(data: TReqorePanelActions) =>
|
|
368
|
+
data.some((action) => action.responsive !== false && action.show !== false),
|
|
360
369
|
[actions, bottomActions]
|
|
361
370
|
);
|
|
362
371
|
|
|
363
372
|
const renderNonResponsiveActions = useCallback(
|
|
364
|
-
(
|
|
365
|
-
return renderActions(
|
|
373
|
+
(action: IReqorePanelAction, index: number) => {
|
|
374
|
+
return renderActions(action, index, false);
|
|
366
375
|
},
|
|
367
376
|
[actions]
|
|
368
377
|
);
|
|
369
378
|
|
|
370
379
|
const renderActions = useCallback(
|
|
371
|
-
(
|
|
372
|
-
actionOrActions: IReqorePanelAction | IReqorePanelAction[],
|
|
373
|
-
index: number,
|
|
374
|
-
includeResponsive
|
|
375
|
-
) => {
|
|
376
|
-
const action: IReqorePanelAction = Array.isArray(actionOrActions)
|
|
377
|
-
? {
|
|
378
|
-
show: true,
|
|
379
|
-
responsive: true,
|
|
380
|
-
as: ReqoreControlGroup,
|
|
381
|
-
props: {
|
|
382
|
-
stack: true,
|
|
383
|
-
fluid: true,
|
|
384
|
-
children: actionOrActions.map(renderActions),
|
|
385
|
-
},
|
|
386
|
-
}
|
|
387
|
-
: actionOrActions;
|
|
388
|
-
|
|
380
|
+
(action: IReqorePanelAction, index: number, includeResponsive) => {
|
|
389
381
|
if (
|
|
390
382
|
action.show === false ||
|
|
391
383
|
(includeResponsive && action.responsive === false) ||
|
|
@@ -402,9 +394,26 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
402
394
|
className,
|
|
403
395
|
as: CustomElement,
|
|
404
396
|
props = {},
|
|
397
|
+
group,
|
|
405
398
|
...rest
|
|
406
399
|
}: IReqorePanelAction = action;
|
|
407
400
|
|
|
401
|
+
if (size(group)) {
|
|
402
|
+
return (
|
|
403
|
+
<ReqoreControlGroup
|
|
404
|
+
intent={intent}
|
|
405
|
+
stack
|
|
406
|
+
customTheme={rest.customTheme || theme}
|
|
407
|
+
size={rest.size}
|
|
408
|
+
fixed
|
|
409
|
+
fluid={rest.fluid}
|
|
410
|
+
key={index}
|
|
411
|
+
>
|
|
412
|
+
{group.map((action, index) => renderActions(action, index, true))}
|
|
413
|
+
</ReqoreControlGroup>
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
|
|
408
417
|
if (size(actions)) {
|
|
409
418
|
return (
|
|
410
419
|
<ReqoreDropdown<IReqoreButtonProps>
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
IReqoreDisabled,
|
|
27
27
|
IReqoreIntent,
|
|
28
28
|
IWithReqoreEffect,
|
|
29
|
+
IWithReqoreFixed,
|
|
29
30
|
IWithReqoreFluid,
|
|
30
31
|
IWithReqoreMinimal,
|
|
31
32
|
IWithReqoreTooltip,
|
|
@@ -46,7 +47,8 @@ export interface IReqoreTagProps
|
|
|
46
47
|
IReqoreDisabled,
|
|
47
48
|
IWithReqoreEffect,
|
|
48
49
|
IWithReqoreMinimal,
|
|
49
|
-
IWithReqoreFluid
|
|
50
|
+
IWithReqoreFluid,
|
|
51
|
+
IWithReqoreFixed {
|
|
50
52
|
size?: TSizes;
|
|
51
53
|
label?: string | number;
|
|
52
54
|
labelKey?: string | number;
|
package/src/helpers/utils.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isString,
|
|
9
9
|
isUndefined,
|
|
10
10
|
} from 'lodash';
|
|
11
|
+
import { IReqorePanelAction } from '../components/Panel';
|
|
11
12
|
import { NUMBER_TO_SIZE, SIZES, SIZE_TO_NUMBER, TSizes } from '../constants/sizes';
|
|
12
13
|
|
|
13
14
|
export const sleep = async (ms: number) => await new Promise((r) => setTimeout(r, ms));
|
|
@@ -88,3 +89,5 @@ export const getOneLessSize = (size: TSizes): TSizes => {
|
|
|
88
89
|
// Get the size name from the number
|
|
89
90
|
return NUMBER_TO_SIZE[oneLessSizeNumber];
|
|
90
91
|
};
|
|
92
|
+
|
|
93
|
+
export const isActionShown = (action: IReqorePanelAction) => action.show !== false;
|
|
@@ -35,6 +35,8 @@ const Template: ComponentStory<typeof Checkbox> = (args) => {
|
|
|
35
35
|
effect={{ gradient: { colors: { 0: '#00fafd', 100: '#ff00d0' } } }}
|
|
36
36
|
/>
|
|
37
37
|
<ReqoreCheckbox {...args} disabled onText='yes' offText='no' />
|
|
38
|
+
<ReqoreCheckbox {...args} onText='yes' offText='no' />
|
|
39
|
+
<ReqoreCheckbox {...args} onText='yes' offText='no' checked />
|
|
38
40
|
<ReqoreCheckbox
|
|
39
41
|
{...args}
|
|
40
42
|
label='Label'
|
|
@@ -124,7 +124,6 @@ const Template: Story<IReqorePanelProps> = (args: IReqorePanelProps) => {
|
|
|
124
124
|
|
|
125
125
|
return (
|
|
126
126
|
<ReqorePanel
|
|
127
|
-
{...args}
|
|
128
127
|
badge={[
|
|
129
128
|
10,
|
|
130
129
|
0,
|
|
@@ -144,15 +143,25 @@ const Template: Story<IReqorePanelProps> = (args: IReqorePanelProps) => {
|
|
|
144
143
|
]}
|
|
145
144
|
actions={[
|
|
146
145
|
{
|
|
147
|
-
label: 'Non responsive',
|
|
148
|
-
icon: '24HoursFill',
|
|
149
|
-
customTheme: { main: '#eb0e8c' },
|
|
150
146
|
responsive: false,
|
|
147
|
+
group: [
|
|
148
|
+
{
|
|
149
|
+
label: 'Non responsive',
|
|
150
|
+
icon: '24HoursFill',
|
|
151
|
+
customTheme: { main: '#eb0e8c' },
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
icon: 'FullscreenExitLine',
|
|
155
|
+
customTheme: { main: '#a40a62' },
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
group: [
|
|
161
|
+
{ label: 'Stacked Action 1', icon: 'BallPenLine', intent: 'warning' },
|
|
162
|
+
{ icon: 'CopperCoinFill', intent: 'danger' },
|
|
163
|
+
],
|
|
151
164
|
},
|
|
152
|
-
[
|
|
153
|
-
{ label: 'Stacked Action 1', icon: 'BallPenLine', intent: 'warning' },
|
|
154
|
-
{ icon: 'CopperCoinFill', intent: 'danger' },
|
|
155
|
-
],
|
|
156
165
|
{
|
|
157
166
|
as: ReqoreInput,
|
|
158
167
|
props: {
|
|
@@ -171,7 +180,14 @@ const Template: Story<IReqorePanelProps> = (args: IReqorePanelProps) => {
|
|
|
171
180
|
},
|
|
172
181
|
]}
|
|
173
182
|
bottomActions={[
|
|
174
|
-
{
|
|
183
|
+
{
|
|
184
|
+
position: 'left',
|
|
185
|
+
intent: 'success',
|
|
186
|
+
group: [
|
|
187
|
+
{ label: 'Test 1', icon: '24HoursFill' },
|
|
188
|
+
{ label: 'Test 2', icon: '24HoursFill' },
|
|
189
|
+
],
|
|
190
|
+
},
|
|
175
191
|
{
|
|
176
192
|
label: 'More actions',
|
|
177
193
|
position: 'right',
|
|
@@ -181,6 +197,7 @@ const Template: Story<IReqorePanelProps> = (args: IReqorePanelProps) => {
|
|
|
181
197
|
],
|
|
182
198
|
},
|
|
183
199
|
]}
|
|
200
|
+
{...args}
|
|
184
201
|
>
|
|
185
202
|
Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system
|
|
186
203
|
of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant.
|
|
@@ -220,9 +237,33 @@ export const Flat = Template.bind({});
|
|
|
220
237
|
Flat.args = {
|
|
221
238
|
flat: true,
|
|
222
239
|
};
|
|
223
|
-
export const
|
|
224
|
-
|
|
240
|
+
export const NoBars: Story<IReqorePanelProps> = Template.bind({});
|
|
241
|
+
NoBars.args = {
|
|
225
242
|
label: undefined,
|
|
243
|
+
badge: undefined,
|
|
244
|
+
icon: undefined,
|
|
245
|
+
actions: [
|
|
246
|
+
{ label: 'test', show: false },
|
|
247
|
+
{
|
|
248
|
+
show: false,
|
|
249
|
+
group: [
|
|
250
|
+
{ label: 'test 2', show: true },
|
|
251
|
+
{ label: 'test 3', show: true },
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
bottomActions: [
|
|
256
|
+
{ label: 'test', show: false, position: 'left' },
|
|
257
|
+
{
|
|
258
|
+
position: 'right',
|
|
259
|
+
show: false,
|
|
260
|
+
group: [
|
|
261
|
+
{ label: 'test 2', show: true },
|
|
262
|
+
{ label: 'test 3', show: true },
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
collapsible: false,
|
|
226
267
|
};
|
|
227
268
|
|
|
228
269
|
export const Transparent: Story<IReqorePanelProps> = Template.bind({});
|
|
@@ -3,7 +3,7 @@ import { noop } from 'lodash';
|
|
|
3
3
|
import { IReqoreTagProps } from '../../components/Tag';
|
|
4
4
|
import { IReqoreTagGroup } from '../../components/Tag/group';
|
|
5
5
|
import { ReqoreTag, ReqoreTagGroup } from '../../index';
|
|
6
|
-
import {
|
|
6
|
+
import { SizeArg, argManager } from '../utils/args';
|
|
7
7
|
|
|
8
8
|
const { createArg } = argManager<IReqoreTagGroup & IReqoreTagProps>();
|
|
9
9
|
|
|
@@ -85,7 +85,7 @@ const Template: Story<IReqoreTagGroup & IReqoreTagProps> = ({ columns, ...args }
|
|
|
85
85
|
/>
|
|
86
86
|
<ReqoreTag labelKey='Tag with' label='Label Key' icon='AlarmWarningLine' {...args} />
|
|
87
87
|
<ReqoreTag labelKey='Key' label='value' {...args} />
|
|
88
|
-
<ReqoreTag icon='QuestionAnswerLine' {...args} />
|
|
88
|
+
<ReqoreTag icon='QuestionAnswerLine' {...args} fixed />
|
|
89
89
|
<ReqoreTag label='Disabled Tag' disabled icon='AlarmWarningLine' {...args} />
|
|
90
90
|
<ReqoreTag
|
|
91
91
|
label='300px Tag'
|
package/src/types/global.ts
CHANGED
|
@@ -140,6 +140,20 @@ export interface IWithReqoreFluid {
|
|
|
140
140
|
fluid?: boolean;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
export interface IWithReqoreFixed {
|
|
144
|
+
/**
|
|
145
|
+
* If true, the component will be fixed in fluid containers
|
|
146
|
+
* @default false
|
|
147
|
+
* @type boolean
|
|
148
|
+
* @example
|
|
149
|
+
* <ReqoreInput fixed />
|
|
150
|
+
* <ReqoreInput fixed={true} />
|
|
151
|
+
* <ReqoreInput fixed={false} />
|
|
152
|
+
*
|
|
153
|
+
*/
|
|
154
|
+
fixed?: boolean;
|
|
155
|
+
}
|
|
156
|
+
|
|
143
157
|
export interface IWithReqoreMinimal {
|
|
144
158
|
/**
|
|
145
159
|
* If true, the component will be minimal
|