@seeqdev/qomponents 0.0.76 → 0.0.78

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.
Binary file
Binary file
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@fortawesome/fontawesome-free": "^6.4.0",
14
- "@seeqdev/qomponents": "0.0.20",
14
+ "@seeqdev/qomponents": "0.0.72",
15
15
  "react": "^18.2.0",
16
16
  "react-dom": "^18.2.0"
17
17
  },
@@ -1,6 +1,20 @@
1
1
  import React from 'react';
2
- import { Button, Checkbox, Icon, QTip, Select, TextArea, TextField } from '@seeqdev/qomponents';
2
+ import {
3
+ Button,
4
+ ButtonWithDropdown,
5
+ ButtonWithPopover,
6
+ Checkbox,
7
+ Icon,
8
+ Modal,
9
+ QTip,
10
+ Select,
11
+ Tabs,
12
+ TextArea,
13
+ TextField,
14
+ ToolbarButton,
15
+ } from '@seeqdev/qomponents';
3
16
  import ComplexSelectExample, { SelectOption } from './ComplexSelectExample';
17
+ import Accordion from '../../src/Accordion';
4
18
 
5
19
  const availableThemes = [
6
20
  { display: 'Analysis', value: 'color_analysis' },
@@ -14,6 +28,76 @@ const options = [
14
28
  { value: '3', label: 'Expert' },
15
29
  ];
16
30
 
31
+ const Trigger = ({ label }: { label: string }) => (
32
+ <div className="tw-flex tw-justify-start tw-items-center tw-border-b tw-px-2 tw-text-sq-color-dark">
33
+ <Icon icon="fc-arrow-dropdown" extraClassNames="tw-text-sq-color-dark tw-mr-[0.5rem] tw-text-[12px]" type="text" />
34
+ {label}
35
+ </div>
36
+ );
37
+
38
+ const accordionItems = [
39
+ {
40
+ value: 'phone',
41
+ id: 'phone',
42
+ itemTestId: 'phonecall',
43
+ trigger: <Trigger label="Phone" />,
44
+ content: (
45
+ <div className="tw-p-2 tw-text-[13px] dark:tw-text-sq-white">
46
+ If you need to reach us, please call us at 555-555-5555.
47
+ </div>
48
+ ),
49
+ },
50
+ {
51
+ value: 'email',
52
+ id: 'email',
53
+ itemTestId: 'email',
54
+ trigger: <Trigger label="Email" />,
55
+ content: (
56
+ <div className="tw-p-2 tw-text-[13px] dark:tw-text-sq-white">
57
+ If you need to reach us, please mail example@seeqtest.com
58
+ </div>
59
+ ),
60
+ },
61
+ {
62
+ value: 'address',
63
+ id: 'address',
64
+ itemTestId: 'address',
65
+ trigger: <Trigger label="Address" />,
66
+ content: (
67
+ <div className="tw-p-2 tw-text-[13px] dark:tw-text-sq-white">
68
+ If you need to reach us, please visit us at 1234 Main St., Anytown, USA.
69
+ </div>
70
+ ),
71
+ },
72
+ ];
73
+
74
+ const renderData = (text: string) => (
75
+ <div className="tw-text-sq-color-gray dark:tw-text-sq-white tw-p-6">
76
+ <p className="tw-mb-5 tw-text-[15px] tw-leading-normal">{text}</p>
77
+ </div>
78
+ );
79
+
80
+ const tabsList = [
81
+ {
82
+ id: 'plugins',
83
+ label: 'Plugins',
84
+ icon: 'fc-data',
85
+ content: renderData("Here's where you can find all the plugins you need. Enjoy!"),
86
+ },
87
+ {
88
+ id: 'addons',
89
+ label: 'Addons',
90
+ icon: 'fc-gears-2',
91
+ content: renderData("Here's where you can find all the addons you need. Enjoy!"),
92
+ },
93
+ {
94
+ id: 'shelf',
95
+ label: 'Shelf',
96
+ icon: 'fc-workbook-lock',
97
+ content: renderData("Here's where you can find all the private documents you need. Enjoy!"),
98
+ },
99
+ ];
100
+
17
101
  function Example() {
18
102
  /**
19
103
  * Theming is supported "out of the box". To apply a theme wrap your addOn in a div and assign the class that
@@ -40,6 +124,12 @@ function Example() {
40
124
  const [easeOfUse, setEaseOfUse] = React.useState(false);
41
125
  const [lookAndFeel, setLookAndFeel] = React.useState(false);
42
126
  const [speed, setSpeed] = React.useState(false);
127
+ const [help, setHelp] = React.useState('phone');
128
+ const [openDropdown, setOpenDropdown] = React.useState('');
129
+ const [openPopver, setOpenPopover] = React.useState('');
130
+ const [modalOpen, setModalOpen] = React.useState(false);
131
+ const [modalTitle, setModalTitle] = React.useState('Modal Title');
132
+ const [activeTab, setActiveTab] = React.useState('plugins');
43
133
 
44
134
  return (
45
135
  // outer-wrapper div that assigns the mode (dark-mode or light) as well as the theme
@@ -140,6 +230,157 @@ function Example() {
140
230
  onChange={(selectedOption: SelectOption) => setComplexSelectedValue(selectedOption)}
141
231
  />
142
232
  </div>
233
+ <div className="formRow">
234
+ <div className="labelWidth">Website tools</div>
235
+ <div className="formElementWidth tw-border tw-rounded-sm">
236
+ <Tabs
237
+ stretchTabs={true}
238
+ activeTab={activeTab}
239
+ onTabSelect={setActiveTab}
240
+ defaultActiveTab="data"
241
+ tabs={tabsList}
242
+ />
243
+ </div>
244
+ </div>
245
+ <div className="formRow">
246
+ <div className="labelWidth">Get help</div>
247
+ <div className="formElementWidth tw-border tw-rounded-sm">
248
+ <Accordion
249
+ accordionItems={accordionItems}
250
+ value={help}
251
+ testId="basic-accordion1"
252
+ onItemSelect={(value) => setHelp(value)}
253
+ />
254
+ </div>
255
+ </div>
256
+ <div className="formRow">
257
+ <div className="labelWidth">Tools</div>
258
+ <div className="formElementWidth formRow tw-border tw-rounded-sm tw-p-4 tw-flex tw-justify-center">
259
+ <ToolbarButton
260
+ icon="fc-y-axis"
261
+ label="Analyzer"
262
+ testId="basic-analyzer"
263
+ tooltipText="Analize data from any csv document"
264
+ hasArrow
265
+ tooltipOptions={{ position: 'top', delay: 0 }}
266
+ isHtmlTooltip={false}
267
+ popoverContent={
268
+ <div className="tw-text-sm dark:tw-text-white">
269
+ <p className="tw-p-2">Select file from your computer or google drive</p>
270
+ <Button type="button" label="Click to select file" />
271
+ </div>
272
+ }
273
+ />
274
+ <ToolbarButton
275
+ icon="fc-sun"
276
+ label={mode === 'tw-light' ? 'Dark Mode' : 'Light Mode'}
277
+ testId="basic-toggler"
278
+ isActive={mode === 'tw-light'}
279
+ tooltipText="Toggle light and dark modes"
280
+ onClick={() => setMode(mode === 'tw-light' ? 'tw-dark' : 'tw-light')}
281
+ tooltipOptions={{ position: 'top', delay: 0 }}
282
+ isHtmlTooltip={false}
283
+ />
284
+ <ToolbarButton
285
+ icon="fc-marker"
286
+ label="Language"
287
+ testId="basic-language-changer"
288
+ tooltipText="Disabled toolbar to change website language"
289
+ tooltipOptions={{ position: 'top', delay: 0 }}
290
+ disabled
291
+ />
292
+ </div>
293
+ </div>
294
+ <div className="formRow">
295
+ <div className="labelWidth">Take action</div>
296
+ <div className="formElementWidth">
297
+ <ButtonWithDropdown
298
+ onOpenChange={(isOpen) => setOpenDropdown(isOpen ? 'dropdown-1' : '')}
299
+ isOpen={openDropdown === 'dropdown-1'}
300
+ triggerIcon={
301
+ <Icon
302
+ icon="fc-more"
303
+ type="text"
304
+ extraClassNames="tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]"
305
+ />
306
+ }
307
+ containerTestId="basic-dropdown1"
308
+ tooltip="See actions to take for plugins"
309
+ tooltipDelay={0}
310
+ hasArrow
311
+ tooltipPlacement="top"
312
+ dropdownItems={[
313
+ { label: 'Create', icon: 'fc-add-row', onClick: () => setOpenDropdown('') },
314
+ { label: 'Update', icon: 'fc-asset-tree', onClick: () => setOpenDropdown(''), hasDivider: true },
315
+ {
316
+ label: 'Sort',
317
+ icon: 'fc-search-power',
318
+ onClick: () => setOpenDropdown(''),
319
+ subMenuItems: [
320
+ { label: 'Ascending', iconClass: 'fc-arrow_up', onClick: () => setOpenDropdown('') },
321
+ { label: 'Descending', iconClass: 'fc-arrow_down', onClick: () => setOpenDropdown('') },
322
+ ],
323
+ },
324
+ { label: 'Delete', icon: 'fc-delete', onClick: () => setOpenDropdown('') },
325
+ ]}
326
+ />
327
+ </div>
328
+ </div>
329
+ <div className="formRow tw-mt-4">
330
+ <div className="labelWidth">More information</div>
331
+ <div className="formElementWidth">
332
+ <ButtonWithPopover
333
+ trigger={<Icon type="text" icon="fc-circle_info" />}
334
+ containerTestId="basic-popover-1"
335
+ isOpen={openPopver === 'basic-popover-1'}
336
+ onOpenChange={(isOpen) => setOpenPopover(isOpen ? 'basic-popover-1' : '')}
337
+ isHoverEnabled={false}
338
+ align="start"
339
+ tooltipPlacement="top"
340
+ hasArrow
341
+ isHtmlTooltip={false}>
342
+ <div className="tw-text-sm dark:tw-text-white tw-w-72 tw-p-4">
343
+ <p className="tw-font-bold">What are plugins?</p>
344
+ Plugins are modular software components that extend the functionality of an application. They allow
345
+ users to add new features or customize existing ones. Plugins can be easily integrated into an
346
+ application and provide a way to enhance its capabilities without modifying the core codebase.Plugins
347
+ are modular software components that extend the functionality of an application.
348
+ </div>
349
+ </ButtonWithPopover>
350
+ </div>
351
+ </div>
352
+ <div className="formRow">
353
+ <div className="labelWidth">Accept terms</div>
354
+ <div className="formElementWidth">
355
+ <Button
356
+ onClick={() => {
357
+ setModalOpen(true);
358
+ }}
359
+ label="View terms of use"
360
+ />
361
+ <Modal
362
+ open={modalOpen}
363
+ onClose={() => setModalOpen(false)}
364
+ title="Terms of use"
365
+ titleIcon="fc-circle_info"
366
+ isTitleEditable
367
+ onTitleChanged={(event) => setModalTitle(event.target.value)}
368
+ hideCloseIcon={false}
369
+ size="lg"
370
+ customButton={true}
371
+ customButtonLabel="Back">
372
+ <div>
373
+ <p>
374
+ By using this website, you agree to the following terms of use: Lorem ipsum dolor sit amet,
375
+ consectetur adipiscing elit. Sed euismod, justo id aliquet aliquam, elit enim tincidunt mauris, nec
376
+ aliquam nunc elit vitae nunc. Sed vitae fringilla mauris. Nulla facilisi. Sed auctor, nunc vel
377
+ aliquet luctus, nisl nunc tincidunt nunc, id lacinia mauris metus id nunc. Sed auctor, nunc vel
378
+ aliquet luctus, nisl nunc tincidunt nunc, id lacinia mauris metus id nunc.
379
+ </p>
380
+ </div>
381
+ </Modal>
382
+ </div>
383
+ </div>
143
384
  <div className="buttonRow">
144
385
  <Button
145
386
  label="Cancel"
package/dist/index.esm.js CHANGED
@@ -6476,6 +6476,10 @@ const HTMLTip = ({ text }) => {
6476
6476
  dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(text) },
6477
6477
  });
6478
6478
  };
6479
+ /** Tooltips can cause SystemTests to be flaky, so we suppress them in Playwright and Protractor */
6480
+ const suppressTooltip = () => {
6481
+ return window.navigator.userAgent === 'Playwright' || window.navigator.userAgent.includes('Protractor');
6482
+ };
6479
6483
  /**
6480
6484
  * QTip
6481
6485
  *
@@ -6522,9 +6526,9 @@ const QTip = () => {
6522
6526
  }
6523
6527
  }, 300, show);
6524
6528
  useEffect(() => {
6525
- document.body.addEventListener('mousemove', onMouseMove);
6529
+ !suppressTooltip() && document.body.addEventListener('mousemove', onMouseMove);
6526
6530
  return () => {
6527
- document.removeEventListener('mousemove', onMouseMove);
6531
+ !suppressTooltip() && document.removeEventListener('mousemove', onMouseMove);
6528
6532
  };
6529
6533
  }, []);
6530
6534
  const ttTimeout = useRef();