@bento-core/query-bar 1.0.1-icdc.23 → 1.0.1-icdc.25

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.
@@ -16,61 +16,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
16
16
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
17
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
18
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
- const ViewFullLinkComponent = _ref => {
20
- let {
21
- classes,
22
- url,
23
- maxWidth = 1200
24
- } = _ref;
25
- const linkRef = (0, _react.useRef)(null);
26
- const [collapseLink, setCollapseLink] = (0, _react.useState)(false);
27
-
28
- /**
29
- * Compute url link width based on the windowsize
30
- */
31
- (0, _react.useEffect)(() => {
32
- var _linkRef$current;
33
- const urlWidth = linkRef === null || linkRef === void 0 ? void 0 : (_linkRef$current = linkRef.current) === null || _linkRef$current === void 0 ? void 0 : _linkRef$current.offsetWidth;
34
- if (urlWidth > maxWidth / 2) {
35
- setCollapseLink(true);
36
- }
37
- }, []);
38
- const expandUrl = () => {
39
- setCollapseLink(false);
40
- };
41
- const collapseUrl = () => {
42
- setCollapseLink(true);
43
- };
44
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
45
- ref: linkRef,
46
- className: classes.link
47
- }, /*#__PURE__*/_react.default.createElement("span", {
48
- className: (0, _clsx.default)(classes.viewLink, {
49
- [classes.collapseLink]: collapseLink
50
- })
51
- }, /*#__PURE__*/_react.default.createElement("span", {
52
- className: (0, _clsx.default)(classes.urlView, {
53
- [classes.urlViewBtn]: !collapseLink
54
- }),
55
- type: "button",
56
- onClick: collapseUrl
57
- }, url), collapseLink && /*#__PURE__*/_react.default.createElement("span", {
58
- className: classes.expandLinkBtn,
59
- type: "button",
60
- onClick: expandUrl
61
- }, "..."))));
62
- };
63
- const QueryUrl = _ref2 => {
64
- var _queryRef$current;
19
+ const QueryUrl = _ref => {
65
20
  let {
66
21
  classes,
67
22
  filterItems,
68
23
  localFind = {},
69
24
  rootPath
70
- } = _ref2;
25
+ } = _ref;
71
26
  const [display, setDisplay] = (0, _react.useState)(false);
72
27
  const toggleDisplay = () => setDisplay(!display);
73
- const [expand, setExpand] = (0, _react.useState)(false);
74
28
  const [open, toggleOpen] = (0, _react.useState)(false);
75
29
  const pathFilterParams = filterItems.reduce((acc, item) => {
76
30
  const {
@@ -93,15 +47,10 @@ const QueryUrl = _ref2 => {
93
47
  }, /*#__PURE__*/_react.default.createElement(_core.Button, {
94
48
  onClick: toggleDisplay,
95
49
  className: classes.viewLinkToggleBtn
96
- }, display ? 'Hide Query URL' : 'Show Query URL'), display && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, expand ? /*#__PURE__*/_react.default.createElement("span", {
50
+ }, display ? 'Hide Query URL' : 'Show Query URL'), display && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
97
51
  type: "button",
98
- onClick: () => setExpand(!expand),
99
- className: (0, _clsx.default)(classes.link, classes.viewLink, classes.expandLink)
100
- }, url) : /*#__PURE__*/_react.default.createElement(ViewFullLinkComponent, {
101
- url: url,
102
- classes: classes,
103
- maxWidth: queryRef === null || queryRef === void 0 ? void 0 : (_queryRef$current = queryRef.current) === null || _queryRef$current === void 0 ? void 0 : _queryRef$current.offsetWidth
104
- }), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
52
+ className: (0, _clsx.default)(classes.viewLink)
53
+ }, url), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
105
54
  arrow: true,
106
55
  title: "Copy to Clipboard"
107
56
  }, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
@@ -127,48 +76,43 @@ const QueryUrl = _ref2 => {
127
76
  const styles = () => ({
128
77
  urlContainer: {
129
78
  display: 'flex',
130
- marginTop: '10px',
79
+ marginTop: '3px',
131
80
  minHeight: '10px'
132
81
  },
133
- link: {
134
- lineBreak: 'anywhere',
82
+ viewLink: {
135
83
  overflow: 'hidden',
84
+ textOverflow: 'ellipsis',
136
85
  fontFamily: 'Nunito',
137
86
  fontSize: '12px',
138
87
  fontWeight: '500',
139
88
  lineHeight: '16px',
140
89
  letterSpacing: '0em',
141
- padding: '5px',
90
+ padding: '2px 5px',
142
91
  borderRadius: '5px',
143
92
  float: 'left',
144
93
  color: '#1D79A8',
145
94
  backgroundColor: '#fff',
146
- maxWidth: '80%'
147
- },
148
- viewLink: {
149
- margin: '0'
95
+ margin: '0',
96
+ whiteSpace: 'nowrap',
97
+ wordBreak: 'break-all',
98
+ '@media (max-width: 2560px)': {
99
+ maxWidth: '1800px'
100
+ },
101
+ '@media (max-width: 2000px)': {
102
+ maxWidth: '1500px'
103
+ },
104
+ '@media (max-width: 1600px)': {
105
+ maxWidth: '1100px'
106
+ },
107
+ '@media (max-width: 1300px)': {
108
+ maxWidth: '900px'
109
+ }
150
110
  },
151
111
  urlViewBtn: {
152
112
  cursor: 'pointer'
153
113
  },
154
- collapseLink: {
155
- maxHeight: '1em',
156
- display: 'block',
157
- // display: '-webkit-box',
158
- '-webkit-box-orient': 'vertical',
159
- '-webkit-line-clamp': '1',
160
- overflow: 'hidden'
161
- },
162
- expandLink: {
163
- cursor: 'pointer'
164
- },
165
- expandLinkBtn: {
166
- float: 'left',
167
- '&:hover': {
168
- cursor: 'pointer'
169
- }
170
- },
171
114
  viewLinkToggleBtn: {
115
+ padding: '5px 10px 5px 10px',
172
116
  height: '20px',
173
117
  fontFamily: 'Nunito',
174
118
  fontSize: '12px',
@@ -181,28 +125,12 @@ const styles = () => ({
181
125
  color: '#fff',
182
126
  float: 'left',
183
127
  margin: '0px 10px 0px 0px',
128
+ whiteSpace: 'nowrap',
184
129
  '&:hover': {
185
130
  backgroundColor: '#1D79A8',
186
131
  color: '#fff'
187
132
  }
188
133
  },
189
- urlView: {
190
- float: 'left',
191
- width: 'calc(100% - 13px)',
192
- minWidth: '840px',
193
- '@media (max-width: 2560px)': {
194
- maxWidth: '1800px'
195
- },
196
- '@media (max-width: 2000px)': {
197
- maxWidth: '1400px'
198
- },
199
- '@media (max-width: 1600px)': {
200
- maxWidth: '1200px'
201
- },
202
- '@media (max-width: 1300px)': {
203
- maxWidth: '1050px'
204
- }
205
- },
206
134
  copyIconBtn: {
207
135
  padding: '0px',
208
136
  height: '20px',
@@ -96,7 +96,7 @@ const QueryBarGenerator = function QueryBarGenerator() {
96
96
  color: "primary",
97
97
  variant: "outlined",
98
98
  onClick: clearAll
99
- }, "Clear"), /*#__PURE__*/_react.default.createElement("span", {
99
+ }, "Clear Query"), /*#__PURE__*/_react.default.createElement("span", {
100
100
  className: classes.divider
101
101
  }), /*#__PURE__*/_react.default.createElement("span", {
102
102
  className: classes.queryContainer
@@ -106,7 +106,7 @@ const QueryBarGenerator = function QueryBarGenerator() {
106
106
  }, "INPUT CASE SET") : null, autocomplete.length ? /*#__PURE__*/_react.default.createElement("span", null, ' ', /*#__PURE__*/_react.default.createElement("span", {
107
107
  className: (0, _clsx.default)(classes.filterName, classes.localFindBackground),
108
108
  onClick: clearAutocomplete
109
- }, "Case ID"), ' ', ' ', /*#__PURE__*/_react.default.createElement("span", {
109
+ }, "Case IDs"), ' ', ' ', /*#__PURE__*/_react.default.createElement("span", {
110
110
  className: classes.operators
111
111
  }, autocomplete.length === 1 && !upload.length ? 'IS ' : 'IN ')) : null, /*#__PURE__*/_react.default.createElement("span", null, (upload.length > 0 ? 1 : 0) + autocomplete.length > 1 ? /*#__PURE__*/_react.default.createElement("span", {
112
112
  className: classes.bracketsOpen
@@ -18,6 +18,15 @@ var _default = {
18
18
  * @var {boolean}
19
19
  */
20
20
  displayAllActiveFilters: false,
21
+ /**
22
+ * set root path for copy url
23
+ * @var {boolean}
24
+ */
25
+ rootPath: "".concat(window.location.href, "/"),
26
+ /**
27
+ * display copy url button
28
+ * @var {boolean}
29
+ */
21
30
  viewQueryURL: false
22
31
  },
23
32
  /* Component Helper Functions */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/query-bar",
3
- "version": "1.0.1-icdc.23",
3
+ "version": "1.0.1-icdc.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useRef } from 'react';
1
+ import React, { useState, useRef } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import {
4
4
  Button,
@@ -12,62 +12,6 @@ import {
12
12
  } from '@material-ui/core';
13
13
  import CopyIcon from '../assets/CopyIcon.svg';
14
14
 
15
- const ViewFullLinkComponent = ({
16
- classes,
17
- url,
18
- maxWidth = 1200,
19
- }) => {
20
- const linkRef = useRef(null);
21
- const [collapseLink, setCollapseLink] = useState(false);
22
-
23
- /**
24
- * Compute url link width based on the windowsize
25
- */
26
- useEffect(() => {
27
- const urlWidth = linkRef?.current?.offsetWidth;
28
- if (urlWidth > maxWidth / 2) {
29
- setCollapseLink(true);
30
- }
31
- }, []);
32
-
33
- const expandUrl = () => {
34
- setCollapseLink(false);
35
- };
36
-
37
- const collapseUrl = () => {
38
- setCollapseLink(true);
39
- };
40
-
41
- return (
42
- <>
43
- <span ref={linkRef} className={classes.link}>
44
- <span
45
- className={clsx(classes.viewLink,
46
- { [classes.collapseLink]: collapseLink })}
47
- >
48
- <span
49
- className={clsx(classes.urlView,
50
- { [classes.urlViewBtn]: !collapseLink })}
51
- type="button"
52
- onClick={collapseUrl}
53
- >
54
- {url}
55
- </span>
56
- {(collapseLink) && (
57
- <span
58
- className={classes.expandLinkBtn}
59
- type="button"
60
- onClick={expandUrl}
61
- >
62
- ...
63
- </span>
64
- )}
65
- </span>
66
- </span>
67
- </>
68
- );
69
- };
70
-
71
15
  const QueryUrl = ({
72
16
  classes,
73
17
  filterItems,
@@ -77,8 +21,6 @@ const QueryUrl = ({
77
21
  const [display, setDisplay] = useState(false);
78
22
  const toggleDisplay = () => setDisplay(!display);
79
23
 
80
- const [expand, setExpand] = useState(false);
81
-
82
24
  const [open, toggleOpen] = useState(false);
83
25
 
84
26
  const pathFilterParams = filterItems.reduce((acc, item) => {
@@ -112,21 +54,12 @@ const QueryUrl = ({
112
54
  {
113
55
  (display) && (
114
56
  <>
115
- {(expand) ? (
116
- <span
117
- type="button"
118
- onClick={() => setExpand(!expand)}
119
- className={clsx(classes.link, classes.viewLink, classes.expandLink)}
120
- >
121
- {url}
122
- </span>
123
- ) : (
124
- <ViewFullLinkComponent
125
- url={url}
126
- classes={classes}
127
- maxWidth={queryRef?.current?.offsetWidth}
128
- />
129
- )}
57
+ <div
58
+ type="button"
59
+ className={clsx(classes.viewLink)}
60
+ >
61
+ {url}
62
+ </div>
130
63
  <Tooltip
131
64
  arrow
132
65
  title="Copy to Clipboard"
@@ -164,48 +97,43 @@ const QueryUrl = ({
164
97
  const styles = () => ({
165
98
  urlContainer: {
166
99
  display: 'flex',
167
- marginTop: '10px',
100
+ marginTop: '3px',
168
101
  minHeight: '10px',
169
102
  },
170
- link: {
171
- lineBreak: 'anywhere',
103
+ viewLink: {
172
104
  overflow: 'hidden',
105
+ textOverflow: 'ellipsis',
173
106
  fontFamily: 'Nunito',
174
107
  fontSize: '12px',
175
108
  fontWeight: '500',
176
109
  lineHeight: '16px',
177
110
  letterSpacing: '0em',
178
- padding: '5px',
111
+ padding: '2px 5px',
179
112
  borderRadius: '5px',
180
113
  float: 'left',
181
114
  color: '#1D79A8',
182
115
  backgroundColor: '#fff',
183
- maxWidth: '80%',
184
- },
185
- viewLink: {
186
116
  margin: '0',
117
+ whiteSpace: 'nowrap',
118
+ wordBreak: 'break-all',
119
+ '@media (max-width: 2560px)': {
120
+ maxWidth: '1800px',
121
+ },
122
+ '@media (max-width: 2000px)': {
123
+ maxWidth: '1500px',
124
+ },
125
+ '@media (max-width: 1600px)': {
126
+ maxWidth: '1100px',
127
+ },
128
+ '@media (max-width: 1300px)': {
129
+ maxWidth: '900px',
130
+ },
187
131
  },
188
132
  urlViewBtn: {
189
133
  cursor: 'pointer',
190
134
  },
191
- collapseLink: {
192
- maxHeight: '1em',
193
- display: 'block',
194
- // display: '-webkit-box',
195
- '-webkit-box-orient': 'vertical',
196
- '-webkit-line-clamp': '1',
197
- overflow: 'hidden',
198
- },
199
- expandLink: {
200
- cursor: 'pointer',
201
- },
202
- expandLinkBtn: {
203
- float: 'left',
204
- '&:hover': {
205
- cursor: 'pointer',
206
- },
207
- },
208
135
  viewLinkToggleBtn: {
136
+ padding: '5px 10px 5px 10px',
209
137
  height: '20px',
210
138
  fontFamily: 'Nunito',
211
139
  fontSize: '12px',
@@ -218,28 +146,12 @@ const styles = () => ({
218
146
  color: '#fff',
219
147
  float: 'left',
220
148
  margin: '0px 10px 0px 0px',
149
+ whiteSpace: 'nowrap',
221
150
  '&:hover': {
222
151
  backgroundColor: '#1D79A8',
223
152
  color: '#fff',
224
153
  },
225
154
  },
226
- urlView: {
227
- float: 'left',
228
- width: 'calc(100% - 13px)',
229
- minWidth: '840px',
230
- '@media (max-width: 2560px)': {
231
- maxWidth: '1800px',
232
- },
233
- '@media (max-width: 2000px)': {
234
- maxWidth: '1400px',
235
- },
236
- '@media (max-width: 1600px)': {
237
- maxWidth: '1200px',
238
- },
239
- '@media (max-width: 1300px)': {
240
- maxWidth: '1050px',
241
- },
242
- },
243
155
  copyIconBtn: {
244
156
  padding: '0px',
245
157
  height: '20px',
@@ -100,7 +100,7 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
100
100
  variant="outlined"
101
101
  onClick={clearAll}
102
102
  >
103
- Clear
103
+ Clear Query
104
104
  </Button>
105
105
  <span className={classes.divider} />
106
106
  <span className={classes.queryContainer}>
@@ -126,7 +126,7 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
126
126
  className={clsx(classes.filterName, classes.localFindBackground)}
127
127
  onClick={clearAutocomplete}
128
128
  >
129
- Case ID
129
+ Case IDs
130
130
  </span>
131
131
  {' '}
132
132
  {' '}
@@ -187,6 +187,7 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
187
187
  </span>
188
188
  </span>
189
189
  ) : null}
190
+
190
191
  {/* Facet Sidebar Selections */}
191
192
  {((autocomplete.length || upload.length) && mappedInputs.length)
192
193
  ? <span className={classes.operators}> AND </span>
@@ -12,6 +12,15 @@ export default {
12
12
  * @var {boolean}
13
13
  */
14
14
  displayAllActiveFilters: false,
15
+ /**
16
+ * set root path for copy url
17
+ * @var {boolean}
18
+ */
19
+ rootPath: `${window.location.href}/`,
20
+ /**
21
+ * display copy url button
22
+ * @var {boolean}
23
+ */
15
24
  viewQueryURL: false,
16
25
  },
17
26