@dhasdk/simple-ui 1.0.0 → 1.0.4

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This library was generated with [Nx](https://nx.dev) on React 18.x.
4
4
 
5
- ## <span style="color: orange;">*This library is under active development and not ready for production use outside of DHA WMT\*</span>
5
+ ## <span style="color: orange;">*This library is under active development and not ready for production use\*</span>
6
6
 
7
7
 
8
8
 
@@ -13,6 +13,7 @@ This library was generated with [Nx](https://nx.dev) on React 18.x.
13
13
  - [Badge](#badge)
14
14
  - [BreadCrumbs](#breadcrumbs)
15
15
  - [Button](#button)
16
+ - [ButtonGroup](#buttongroup)
16
17
  - [Card](#card)
17
18
  - [CharacterCounter](#charactercounter)
18
19
  - [DatePicker](#datepicker)
@@ -24,13 +25,14 @@ This library was generated with [Nx](https://nx.dev) on React 18.x.
24
25
  - [Select](#select)
25
26
  - [SideBarNav](#sidebarnav)
26
27
  - [Skeleton](#skeleton)
28
+ - [Slider](#slider)
27
29
  - [Status](#status)
28
30
  - [Tabs](#tabs)
29
31
  - [Toggle](#toggle)
30
32
 
31
33
  ## Quick Notes:
32
34
 
33
- - Some of these components use what are called **variants**. This allows pre-defined styles to be set, or 'variants', and those variants to be called by name via a prop when using the specified component. An example is the **Button** component below, and calling it using the 'filled' style variant of that component.
35
+ - Some of these components use what are called **variants** from the **class-variance-authority** library. This allows pre-defined styles to be set, or 'variants', and those variants to be called by name via a prop when using the specified component. An example is the **Button** component below, and calling it using the 'DHAActive' style variant of that component (example code below).
34
36
 
35
37
  <!-- I N S T A L L A T I O N ----------------------------------------------------------------------------------- -->
36
38
 
@@ -223,7 +225,9 @@ danger Variant
223
225
 
224
226
  BreadCrumbs allow users to quickly and easily see their current location in an app or sites heirarchy, as well as quickly navigate to previous levels, enabling quick navigation back to those sections.
225
227
 
226
- The BreadCrumbs component takes in various props (`className`, `classNameContainer`, `variant`, `auto`, and `separator`), in addition to any other html attributes a normal NAV element would use.
228
+ When the container or window is too narrow to display the full Breadcrumbs list, the middle items are truncated into an ellipsis.
229
+
230
+ The BreadCrumbs component takes in various props in addition to any other html attributes a normal NAV element would use.
227
231
 
228
232
  A `ref` can also be created and assigned to the button component, and the component will point the reference to the html nav element.
229
233
 
@@ -231,7 +235,9 @@ The `className` prop takes a list of alternate CSS classes the developer would l
231
235
 
232
236
  The `classNameContainer` takes a list of css classes that are applied to the enclosing `nav` element.
233
237
 
234
- Finally, the `separator` prop is a string value that represents the separator used between bread crumbs. The default value is a greater than sign, >.
238
+ The `routes` prop when specified supplies the list of supplied paths + names that are used inside the BreadCrumbs component instead of the component attempting to auto-create a routes list.
239
+
240
+ If `routes` are not specified, the Breadcrumbs component will attempt to auto-generate and display its parent routes.
235
241
 
236
242
  Full list of props below
237
243
 
@@ -242,18 +248,31 @@ Full list of props below
242
248
  | ----------- | -------- | -------- | -------- | -------------------------------------------- |
243
249
  | className | string | Yes | | This is used to apply user supplied styling to the `Link` components. Note that words are capitalized using CSS, and can be made using the prop. |
244
250
  | classNameContainer | string | Yes | | This is used to apply user supplied styling to the container `nav` element. |
251
+ | routes | []{ name: string, route: string} | Yes | undefined | When present the Breadcrumbs component will use this list of supplied routes + names instead of attempting to auto-create a routes list. |
245
252
  | ...props | string | Yes | undefined | takes additional props that are not specifically defined in the component, i.e. aria-label |
246
- | separator | string | Yes | > | A string separator value to place between the separate breadcrumbs. The default value is '>' |
247
- | variant | string | Yes | | Allows the user to enter a pre-defined variant that includes its own pre-defined styling. |
253
+ | separator | string | Yes | | A string value providing the path name to an alternate separator |
254
+ | variant | string | Yes | 'default' | Allows the user to enter a pre-defined variant that includes its own pre-defined styling, options are 'default' and 'bold'. |
248
255
 
249
256
  ### Example Usage
250
257
 
251
- Default Variant
258
+ With Auto Routes
252
259
 
253
260
  ```jsx
254
261
  <BreadCrumbs />
255
262
  ```
256
263
 
264
+ Manually Specified Routes
265
+
266
+ ```jsx
267
+ <Breadcrumbs
268
+ routes =
269
+ {[
270
+ { name: 'Path 1', route: '/path1' },
271
+ { name: 'Path 2', route: '/path2' },
272
+ { name: 'Path 3', route: '/path3' },
273
+ ]}
274
+ />
275
+ ```
257
276
 
258
277
  ### Dependencies
259
278
 
@@ -362,7 +381,8 @@ The **ButtonGroup** is a component that wraps a series of **Button** components,
362
381
 
363
382
  The **ButtonGroup** also allows the ability to pass common css classes to the individual **Button** components, while allowing individual **Button** components to still utilize their own custom/unique css classes.
364
383
 
365
- A reference can also be created and passed to the button component, and the component will point the reference to the html button.
384
+ The variants labeled **default** and **column** demonstrated in the examples below are UX defined variants.
385
+
366
386
 
367
387
  ### Props
368
388
 
@@ -371,17 +391,46 @@ A reference can also be created and passed to the button component, and the comp
371
391
  | children | ReactNode | Yes | | This contains one or more Button components that comprise this ButtonGroup. |
372
392
  | className | string | Yes |'' | This prop applies the given classNames to the DIV that wraps and comprises the ButtonGroup component. |
373
393
  | classNameButtons | string | Yes | undefined | These are common classes that are applied to each of the children Button components. These classes can be overridden on a one by one basis by using an individual Button components own className prop. |
394
+ | variant | string | Yes | 'default' | One of three possible variants that can be specified, **'default'** and **'column'** are UX defined variants that pre-layout up to three buttons for each variant. A **'custom'** variant is also present that leaves all layout and styling to the developer. |
374
395
 
375
396
 
376
397
  ### Example Usage
377
398
 
378
- simple example
399
+ default variant w/ 3 Buttons (ux styled)
379
400
 
380
401
  ```jsx
381
402
  <ButtonGroup className='w-full'>
382
- <Button>A</Button>
383
- <Button>B</Button>
384
- <Button>C</Button>
403
+ <Button variant='outline' onClick={doSomething}>Secondary</Button>
404
+ <Button variant='filled' onClick={doSomething}>Primary</Button>
405
+ <Button variant='transparent' onClick={doSomething}>Tertiary</Button>
406
+ </ButtonGroup>
407
+ ```
408
+
409
+ default variant w/ 2 Buttons
410
+
411
+ ```jsx
412
+ <ButtonGroup>
413
+ <Button variant='outline' onClick={doSomething}>Secondary</Button>
414
+ <Button variant='filled' onClick={doSomething}>Primary</Button>
415
+ </ButtonGroup>
416
+ ```
417
+
418
+ column variant w/ 3 Buttons
419
+
420
+ ```jsx
421
+ <ButtonGroup variant='column'>
422
+ <Button variant='outline' onClick={doSomething} >Secondary</Button>
423
+ <Button variant='filled' onClick={doSomething} >Primary</Button>
424
+ <Button variant='transparent' onClick={doSomething} >Tertiary</Button>
425
+ </ButtonGroup>
426
+ ```
427
+
428
+ column variant w/ 2 Buttons
429
+
430
+ ```jsx
431
+ <ButtonGroup variant='column'>
432
+ <Button variant='outline' onClick={doSomething}>Secondary</Button>
433
+ <Button variant='filled' onClick={doSomething}>Primary</Button>
385
434
  </ButtonGroup>
386
435
  ```
387
436
 
@@ -390,26 +439,30 @@ use of common examples
390
439
  ```jsx
391
440
  <ButtonGroup
392
441
  className='w-full'
393
- classNameButtons="border-2 border-green-500 bg-green-200 font-black">
394
- <Button>A</Button>
395
- <Button>B</Button>
396
- <Button>C</Button>
442
+ classNameButtons="border-2 border-green-500 bg-green-200 font-black"
443
+ variant='custom'
444
+ >
445
+ <Button onClick={doSomething}>A</Button>
446
+ <Button onClick={doSomething}>B</Button>
447
+ <Button onClick={doSomething}>C</Button>
397
448
  </ButtonGroup>
398
449
  ```
399
450
 
400
451
  use of custom class
401
452
 
402
453
  ```jsx
403
- <ButtonGroup className='w-full'>
454
+ <ButtonGroup className='w-full' variant='custom'>
404
455
  <Button
405
456
  className='border-2 border-green-500 bg-green-200 font-black'
457
+ onClick={doSomething}
406
458
  >A</Button>
407
- <Button>B</Button>
408
- <Button>C</Button>
459
+ <Button onClick={doSomething}>B</Button>
460
+ <Button onClick={doSomething}>C</Button>
409
461
  </ButtonGroup>
410
462
  ```
411
463
 
412
464
 
465
+
413
466
  ### Dependencies
414
467
 
415
468
  **_none_**
@@ -912,13 +965,12 @@ Basic Pill
912
965
 
913
966
  <!-- S E C T I O N H E A D E R ------------------------------------------------------- -->
914
967
 
968
+
915
969
  ## SectionHeader
916
970
 
917
971
  The **`SectionHeader`** component displays a **`children`** prop as a heading, and uses various additional props to customize the remaining portion of the Header.
918
972
 
919
- Optional props are **`className`**, **`classNameChildren`**, **`classNameSubHeader`**, **`iconLeft`**, **`iconRight`**, **`subHeader`**, and **`underline`**. Various examples and
920
- combinations of these props in use can be seen via the above drop down with
921
- the **Usage** button
973
+ Various examples and combinations of this components props in use can be seen via code examples below.
922
974
 
923
975
  Full list of props below
924
976
 
@@ -930,43 +982,48 @@ Full list of props below
930
982
  | className | string | Yes | (1) below | Alternate CSS classnames to apply to the SectionHeader component. **`twMerge`** is used to apply these styles, so they reliably overwrite existing classes. |
931
983
  | classNameChildren | string | Yes | (2) below | Alternate CSS classnames to apply to the **`children`** component which contains the Header content. **`twMerge`** is used to apply these styles, so they reliably overwrite existing classes. |
932
984
  | classNameSubHeader | string | Yes | (3) below | Alternate CSS classnames to apply to the subHeader portion when present. **`twMerge`** is used to apply these styles, so they reliably overwrite existing classes. |
985
+ | fill | boolean | Yes | false | if true, the background on the sectionHeader is filled. Fill is applied by applying **`bg-[#092068] text-[#f0f0f0]`** to the default classes. A custom fill can be applied by applying your own classList via the **`className`** prop and leaving **`fill`** at its default false setting. |
986
+ | button | boolean | Yes | false | Boolean value specifying whether to display a button or not on the right side of the SectionHeader. |
987
+ | buttonOnClick | () => void | Yes | undefined | An onClick handler for the optional button. |
988
+ | buttonContent | string | Yes | 'Click Me!' | The text content to display in the Button component if enabled |
933
989
  | iconLeft | ReactNode | Yes | | This prop takes an image to display as its left icon. It takes this value as a ReactNode, see examples above. |
934
990
  | iconRight | ReactNode | Yes | | This prop takes an image to display as its right icon. It takes this value as a ReactNode, see examples above. |
935
991
  | underline | boolean | Yes | false | When true, an underline is displayed underneath the entire SubHeader, this is done by applying the classes **`border-b-2 border-black`** to the default classes. A custom underline can be applied via the **`className`** prop. |
936
992
  | subHeader | string | Yes | undefined | This prop takes a string value that is displayed as a SubHeader when present. If no subHeader is passed in, nothing is displayed in this location. |
937
- | fill | boolean | Yes | false | if true, the background on the sectionHeader is filled. Fill is applied by applying **`bg-[#092068] text-[#f0f0f0]`** to the default classes. A custom fill can be applied by applying your own classList via the **`className`** prop and leaving **`fill`** at its default false setting. |
938
- | childButton | ReactNode &#124; undefined | Yes | | |
993
+ | type | 'page', 'section', or 'subsection' | Yes | 'page' | This specifies the SectionHeader type to display. Each variation is intended for a lower ordered item than the one before it. The options are 'page', 'section', and 'subsection'. |
939
994
 
940
995
 
941
- 1. Default classNames
996
+ 1. Default classNames
997
+
998
+ - type 'page' - **`pt-4 pb-2 flex pl-6 pr-2 justify-start items-center gap-4 inline-flex w-full`**
942
999
 
943
- - **`pl-6 pr-2 pt-4 pb-2 justify-start items-start gap-4 inline-flex w-full`**
1000
+ - type 'section'/'subsection' - **`py-2 flex pl-6 pr-2 justify-start items-center gap-4 inline-flex w-full`**
944
1001
 
945
1002
  2. children classNames
946
1003
 
947
- - **`self-stretch text-[40px] font-normal font-["Arial"] leading-[48px] pb-1`**
1004
+ - **`self-stretch text-[40px] font-normal font-["Arial"] leading-[48px] pb-1`**
948
1005
 
949
1006
  3. subHeader classNames
950
1007
 
951
- - **`text-xl font-normal font-["Arial"] leading-[30px]`**
1008
+ - **`text-xl font-normal font-["Arial"] leading-[30px]`**
952
1009
 
953
1010
  ### Example Usage
954
1011
 
955
1012
  ```jsx
956
- <SectionHeader
957
- iconLeft={<img src={frame} alt='left header icon' />}
958
- iconRight={<img src={important} alt='left header icon' className='size-8 mt-2' />}
1013
+ <SectionHeader
1014
+ iconLeft={<img src={frameLight} alt='left header icon' className="size-10" />}
1015
+ iconRight={<img src={importantLight} alt='right header icon' className='size-10' />}
959
1016
  subHeader="1st things first though"
960
1017
  underline
961
- childButton={<Button variant='transparent' className='h-10'
962
- icon={<img src={chevronRight} alt='right chevron' />}
963
- iconPosition='right' >Click Me</Button>}
1018
+ fill
1019
+ button
1020
+ buttonContent="Alert"
1021
+ buttonOnClick={() => alert('Clicked!')}
964
1022
  >
965
- Prologue
1023
+ Prologue
966
1024
  </SectionHeader>
967
1025
  ```
968
1026
 
969
-
970
1027
  ### Dependencies
971
1028
 
972
1029
  **_none_**
@@ -1321,6 +1378,85 @@ Skeleton w/ Alternate Coloring
1321
1378
  [Top of Page](#table-of-contents)
1322
1379
 
1323
1380
 
1381
+ [Top of Page](#table-of-contents)
1382
+ <!-- S L I D E R ------------------------------------------------------------------------------ -->
1383
+
1384
+ ## Slider
1385
+
1386
+ A Slider is an html **`input`** element of type 'range' that allows a user to enter a numeric value. It consists of a stationary 'track' and a movable 'thumb', the thumb being the ux element the user drags to indicate a desired value.
1387
+
1388
+ The Slider utilizes an input element of type range, and applies additional css styling via a css module.
1389
+
1390
+ For accessibility purposes the thumb recieves alternate styling on a focus event. Safari does not provide focus to a slider thumb though, so styling also changes on active, though that is more transient and perhaps less useful for accessibility purposes.
1391
+
1392
+ [Additional input attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/range) not defined below can be passed in as well and applied directly to the html input element.
1393
+
1394
+ For the className props, the tailwind **`twMerge`** function is used, so if tailwind classes are passed in, they will replace or add to the existing classes as appropriate.
1395
+
1396
+ Full list of props below
1397
+
1398
+ ### Props for Slider
1399
+
1400
+ | Prop | Type | Optional | Default | Description |
1401
+ | ----------- | -------- | -------- | -------- | ----------- |
1402
+ | className | string | Yes | | This is used to apply user supplied styling to the **input** element that makes up the **Slider** component. |
1403
+ | classNameLabel | string | Yes | | A string value of tailwind classes used to apply styling to the **label** inside the **Slider** component. |
1404
+ | changeHandler | **`(value: number) => void;`** | Yes | | A **callback** function can be used to pass values back to the parent. Example in the usage display of the callback example above. |
1405
+ | id | string | Yes | | The **id** value used to link the **label** and **input** elements together. If an **id** is not provided, the **label** is not displayed. |
1406
+
1407
+
1408
+ Tailwind CSS Classes used for Slider components
1409
+
1410
+ - className defaults
1411
+ - **`w-full block mb-2`**
1412
+ - classNameLabel defaults
1413
+ - **`block mb-2'`**
1414
+
1415
+
1416
+ ### Example Usage
1417
+
1418
+ Default example, no callback or label
1419
+
1420
+ ```jsx
1421
+ <Slider />
1422
+ ```
1423
+
1424
+ Example with callback function
1425
+
1426
+ ```jsx
1427
+ const [value, setValue] = useState<number>(50);
1428
+ // ...
1429
+
1430
+ return (
1431
+ <>
1432
+ <Slider className='block mb-4' startValue={value} changeHandler={setValue} />
1433
+ <div className='block'>value: {value}</div>
1434
+ </>
1435
+ );
1436
+ ```
1437
+ Slider w/ startValue (an input attribute) & changeHandler
1438
+
1439
+ ```jsx
1440
+ const [value, setValue] = useState<number>(50);
1441
+ // ...
1442
+
1443
+ <Slider
1444
+ startValue={value}
1445
+ changeHandler={setValue}
1446
+ id='1'
1447
+ label='Volume Level'
1448
+ classNameLabel='font-bold text-blue-900'
1449
+ />
1450
+ <div>value: {value}</div>
1451
+ ```
1452
+
1453
+ ### Dependencies
1454
+
1455
+ **_none_**
1456
+
1457
+ [Top of Page](#table-of-contents)
1458
+
1459
+
1324
1460
  <!-- S T A T U S ---------------------------------------------------------------------------- -->
1325
1461
 
1326
1462
  ## Status
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Accordion, AccordionParent } from './lib/Accordion';
2
2
  export type { AccordionProps, AccordionParentProps } from './lib/Accordion';
3
+ export { AppointmentPicker } from './lib/AppointmentPicker';
3
4
  export { Badge } from './lib/Badge';
4
5
  export type { BadgeProps } from './lib/Badge';
5
6
  export { Button } from './lib/Button';
@@ -18,6 +19,10 @@ export { List, ListItem } from './lib/List';
18
19
  export { Modal } from './lib/Modal';
19
20
  export { Pill } from './lib/Pill';
20
21
  export type { PillProps } from './lib/Pill';
22
+ export { Search } from './lib/Search';
23
+ export type { DataSearchResults, SearchDataItem, SearchProps } from './lib/Search';
24
+ export { RadioGroup } from './lib/RadioGroup';
25
+ export type { RadioOption } from './lib/RadioGroup';
21
26
  export { SectionHeader } from './lib/SectionHeader';
22
27
  export type { SectionHeaderProps } from './lib/SectionHeader';
23
28
  export { Select } from './lib/Select';
@@ -28,6 +33,7 @@ export { SideBarNav } from './lib/SideBarNav';
28
33
  export { Skeleton, SkelCircle, SkelLine, SkelRow, SkelSection } from './lib/Skeleton';
29
34
  export type { SkeletonProps, SkelProps } from './lib/Skeleton';
30
35
  export { SkipLink } from './lib/SkipLink';
36
+ export { Slider } from './lib/Slider';
31
37
  export { Status } from './lib/Status';
32
38
  export type { StatusProps } from './lib/Status';
33
39
  export { Tabs } from './lib/Tabs';