@dhasdk/simple-ui 0.0.24 → 0.0.26
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 +142 -16
- package/index.d.ts +3 -3
- package/index.js +6 -6
- package/index.mjs +1184 -1176
- package/lib/Badge.d.ts +1 -1
- package/lib/Modal.d.ts +2 -1
- package/lib/Select.d.ts +2 -1
- package/lib/SideBarNav.d.ts +1 -0
- package/lib/Skeleton.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,8 @@ This library was generated with [Nx](https://nx.dev) on React 18.x.
|
|
|
17
17
|
- [Input](#input)
|
|
18
18
|
- [List](#list)
|
|
19
19
|
- [Modal](#modal)
|
|
20
|
+
- [Pill](#pill)
|
|
21
|
+
- [Section Header](#sectionheader)
|
|
20
22
|
- [Select](#select)
|
|
21
23
|
- [Skeleton](#skeleton)
|
|
22
24
|
- [Status](#status)
|
|
@@ -130,7 +132,7 @@ Finally, if Accordion props are specified inside the parent component, those val
|
|
|
130
132
|
|
|
131
133
|
The **badge** component takes three required props, **variant**, **subVariant**, and **child** content.
|
|
132
134
|
|
|
133
|
-
Optional props are **className**, **
|
|
135
|
+
Optional props are **className**, **classNameSvg**, **imagePath**, **imageAlt**, and **classNameImage**.
|
|
134
136
|
|
|
135
137
|
As with the button component, this component also takes additional html attributes that when included are passed to the parent div.
|
|
136
138
|
|
|
@@ -145,9 +147,9 @@ This div is also styled using the tailwind **`twMerge()`** utility, so custom cl
|
|
|
145
147
|
| variant | string | No | See **(1)** below | The predefined variant of Badge to display. UX designed variants are **go**, **hazard**, and **warning** |
|
|
146
148
|
| className | string | Yes | See **(2)** below | Alternate CSS classnames to apply to the Badge component.twMerge is used to apply these styles, so they reliably overwrite existing styles |
|
|
147
149
|
| imageAlt | string | See Comment | undefined | When an imagePath is specified, please specify an imageAlt that can be used for accessibility purposes. |
|
|
148
|
-
|
|
|
150
|
+
| classNameImage | string | Yes | undefined | Alternate CSS classes that are applied to the image for variant type media. |
|
|
149
151
|
| imagePath | string | See Comment | undefined | When variant is of type "media", an imagePath has to be specified that the component can load and display. |
|
|
150
|
-
|
|
|
152
|
+
| classNameSvg | string | Yes | (2) below | alternate classes to apply style to the svg icons used in the Badge component for type icon. Applied using twMerge, and will reliabily overwrite any default CSS classes. |
|
|
151
153
|
|
|
152
154
|
|
|
153
155
|
1. Variants --> subVariants
|
|
@@ -243,7 +245,7 @@ Full list of props below
|
|
|
243
245
|
| Prop | Type | Optional | Default | Description |
|
|
244
246
|
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
245
247
|
| 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. |
|
|
246
|
-
|
|
|
248
|
+
| classNameContainer | string | Yes | | This is used to apply user supplied styling to the container `nav` element. |
|
|
247
249
|
| ...props | string | Yes | undefined | takes additional props that are not specifically defined in the component, i.e. aria-label |
|
|
248
250
|
| separator | string | Yes | > | A string separator value to place between the separate breadcrumbs. The default value is '>' |
|
|
249
251
|
| variant | string | Yes | | Allows the user to enter a pre-defined variant that includes its own pre-defined styling. |
|
|
@@ -353,7 +355,7 @@ Full list of props below
|
|
|
353
355
|
| ariaLabel | string | Yes | 'card component' | This is the aria-label applied to the parentDIV element in the Card component. |
|
|
354
356
|
| className | string | Yes | (1) below | Class names to style component |
|
|
355
357
|
| imageInset | string | Yes | | A boolean value indicating whether the image inside the card should be inset or not. See above for functional examples. |
|
|
356
|
-
|
|
|
358
|
+
| classNameImage | string | Yes | | CSS Classes to apply to the **img** element inside the Card component. These classes are applied using **`twMerge()`** and will safely override any conflicting tailwind css classes. |
|
|
357
359
|
| ...props | string | Yes | undefined | additional props that are not specifically defined in the component, i.e. aria-label |
|
|
358
360
|
| variant | string | Yes | 'default' | valid Card variant choices are 'default', 'imageLeft', 'imageBottom', and 'imageRight'. The default variant has its image on the top of the Card. |
|
|
359
361
|
| variantStyle | string | Yes | 'default' | Optoins are 'default' and 'outline' |
|
|
@@ -422,8 +424,8 @@ Full list of props below
|
|
|
422
424
|
| children | ReactNode | No | | the child Input or TextArea component |
|
|
423
425
|
| maxCharacters | number | No | | the number of characters allowed by CharacterCounter prior to it changing the displayed message and warning the user they are over the limit. |
|
|
424
426
|
| className | string | Yes | (1) below | This is used to apply user supplied styling to the CharacterCounter div element. |
|
|
425
|
-
|
|
|
426
|
-
|
|
|
427
|
+
| classNameMessage | string | Yes | | CSS classes to apply to the message text prior to the user exceeding the specified limit |
|
|
428
|
+
| classNameOverLimitMessage | string | Yes | | CSS classes to apply to the message text after the user has exceeded the specified limit. |
|
|
427
429
|
| altRemainingMessageText | string | Yes | 'remaining' | A string value containing an alternate message to display to the user as they type. If the user has typed 5 characters and is not over the limit, the default reads "5 remaining". |
|
|
428
430
|
| altOverageMessageText | string | Yes | 'characters too many' | A string value containing an alternate message to display to the user they have exceeded the specified limit. If the user has typed 15 characters and is over the limit, the default reads "5 characters too many" in red text (with dfeault overLimitMessageClassName). |
|
|
429
431
|
|
|
@@ -513,7 +515,7 @@ A reference can also be created and passed to the input component, and the compo
|
|
|
513
515
|
| className | string | Yes | **(1) below** | pass any css class names to add/change styling
|
|
514
516
|
| label | string | Yes | '' | string value of label, blank for no label |
|
|
515
517
|
| labelBaseColor | string | Yes | | Use if the page or input color is not white, this will help to blend the label background to the surrounding area |
|
|
516
|
-
|
|
|
518
|
+
| classNameLabel | string | Yes | **(2) below** | pass any css class names to add/change styling for the input label |
|
|
517
519
|
| placeHolder | string | Yes | Yes | | sets the placeholder text inside the input element |
|
|
518
520
|
| ...props | string | Yes | | takes additional props that are not specifically defined in the component, i.e. aria-label |
|
|
519
521
|
| required | boolean | Yes | | if specified, a red asterisk is prepended to the label, and the required attribute is set to true |
|
|
@@ -580,8 +582,8 @@ The **List** component is a component that creates a list of items, ordered or u
|
|
|
580
582
|
| children | React.ReactNode | Yes | undefined | this allows the component to receive any number of react components as children |
|
|
581
583
|
| className | string | Yes | undefined | takes additional classnames to add/change styling |
|
|
582
584
|
| withDividers | boolean | Yes | false | if true, this prop will display a divider to separate each item within the list |
|
|
583
|
-
|
|
|
584
|
-
|
|
|
585
|
+
| classNameDividerColor | string | Yes | undefined | this prop is used to change the color of dividers when used, for example 'red-400' |
|
|
586
|
+
| classNameItem | string | Yes | undefined | takes additional classnames to add/change styling of the items within the list |
|
|
585
587
|
| isDecimal | boolean | Yes | false | if true, this prop will change the component to be ordered as a decimal list, placing a number next toe each item |
|
|
586
588
|
| isDisc | boolean | Yes | false | if true, this prob will change the list to be unordered, placing bullet points next to each item |
|
|
587
589
|
|
|
@@ -693,13 +695,131 @@ Basic Modal
|
|
|
693
695
|
[Top of Page](#table-of-contents)
|
|
694
696
|
|
|
695
697
|
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
<!-- P I L L --------------------------------------------------------------------------- -->
|
|
701
|
+
|
|
702
|
+
## Pill
|
|
703
|
+
|
|
704
|
+
The **`Pill`** component displays a **`children`** prop as its primary content, with optional left and/or right icons. It also has the ability to display selected state via a **selected** prop, and can also take an **onClick** handler.
|
|
705
|
+
|
|
706
|
+
Optional props are **className**, **iconLeft**, **iconLeftSelected**, **iconRight**, **iconRightSelected**, **onClick**, and **selected**.
|
|
707
|
+
|
|
708
|
+
Full list of props below
|
|
709
|
+
|
|
710
|
+
### Props
|
|
711
|
+
|
|
712
|
+
| Prop | Type | Optional | Default | Description |
|
|
713
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
714
|
+
| children | ReactNode | No | | The primary content to display in this Pill, i.e. the word 'Pill' above.|
|
|
715
|
+
| className | string | Yes | | Alternate CSS classnames to apply to the Pill component, which is itself built inside a Button. **`twMerge`** is used to apply these styles, so they reliably overwrite existing classes. |
|
|
716
|
+
| iconLeft | ReactNode | Yes | | This prop takes an image to display as its left icon. It takes this value as a ReactNode.|
|
|
717
|
+
| iconLeftSelected | ReactNode | Yes | | This prop takes an image to display as its left icon when the component is in its selected state. It takes this value as a ReactNode.|
|
|
718
|
+
| iconRight | ReactNode | Yes | | This prop takes an image to display as its right icon. It takes this value as a ReactNode.|
|
|
719
|
+
| iconRightSelected | ReactNode | Yes | | This prop takes an image to display as its right icon when the component is in its selected state. It takes this value as a ReactNode|
|
|
720
|
+
| onClick | () => void() | Yes | | When included this serves as the **`onClick`** handler for the **`Pill`** component. |
|
|
721
|
+
| selected | boolean | Yes | false | This prop is a boolean that can be used to indicate if thisPill component should be in a selected state or not. This value is controled in by the developer, and assigned via this prop. See the selected state example above for example usage. |
|
|
722
|
+
|
|
723
|
+
1. Default classNames
|
|
724
|
+
|
|
725
|
+
- **`relative inline-flex items-center justify-center whitespace-nowrap rounded-3xl transition-colors focus-visible:outline-none font-[`Arial`] disabled:pointer-events-none disabled:opacity-50 py-[10px] md:py-[14px] lg:py-[16px] border-2 border-[#092068] text-[#092068] text-lg bg-white hover:bg-[#D1DBFB] active:bg-[#9fc5f0] focus:bg-white disabled:bg-[#939194] disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive focus:border-black disabled:border-dha-mc-secondary-border disabled:border-2 py-0 md:py-0 lg:py-0 h-[48px] mt-1`**
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
### Example Usage
|
|
729
|
+
|
|
730
|
+
Basic Pill
|
|
731
|
+
|
|
732
|
+
```jsx
|
|
733
|
+
<Pill
|
|
734
|
+
iconLeft={<img src={frame} alt='left header icon' />}
|
|
735
|
+
iconRight={<img src={frame} alt='right header icon' />}
|
|
736
|
+
>
|
|
737
|
+
Pill
|
|
738
|
+
</Pill>
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
### Dependencies
|
|
742
|
+
|
|
743
|
+
**_none_**
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
[Top of Page](#table-of-contents)
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
<!-- S E C T I O N H E A D E R --------------------------------------------------------------------------- -->
|
|
750
|
+
|
|
751
|
+
## SectionHeader
|
|
752
|
+
|
|
753
|
+
The **`SectionHeader`** component displays a **`children`** prop as a heading, and uses various additional props to customize the remaining portion of the Header.
|
|
754
|
+
|
|
755
|
+
Optional props are **`className`**, **`classNameChildren`**, **`classNameSubHeader`**, **`iconLeft`**, **`iconRight`**, **`subHeader`**, and **`underline`**. Various examples and
|
|
756
|
+
combinations of these props in use can be seen via the above drop down with
|
|
757
|
+
the **Usage** button
|
|
758
|
+
|
|
759
|
+
Full list of props below
|
|
760
|
+
|
|
761
|
+
### Props
|
|
762
|
+
|
|
763
|
+
| Prop | Type | Optional | Default | Description |
|
|
764
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
765
|
+
| children | ReactNode | No | | The primary content to display in this SectionHeader, i.e.the word 'Prologue' above. |
|
|
766
|
+
| 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. |
|
|
767
|
+
| 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. |
|
|
768
|
+
| 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. |
|
|
769
|
+
| iconLeft | ReactNode | Yes | | This prop takes an image to display as its left icon. It takes this value as a ReactNode, see examples above. |
|
|
770
|
+
| iconRight | ReactNode | Yes | | This prop takes an image to display as its right icon. It takes this value as a ReactNode, see examples above. |
|
|
771
|
+
| underline | boolean | Yes | false | When true, an underline is displayed underneath the entire SubHeader. |
|
|
772
|
+
| 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. |
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
1. Default classNames
|
|
776
|
+
|
|
777
|
+
- **`px-2 justify-start items-start gap-4 inline-flex w-full`**
|
|
778
|
+
|
|
779
|
+
2. children classNames
|
|
780
|
+
|
|
781
|
+
- **`self-stretch text-[#07192d] text-[40px] font-normal font-['Arial'] leading-[48px] pb-1`**
|
|
782
|
+
|
|
783
|
+
3. subHeader classNames
|
|
784
|
+
|
|
785
|
+
- **`text-[#07192d] text-xl font-normal font-['Arial'] leading-[30px]`**
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
### Example Usage
|
|
789
|
+
|
|
790
|
+
```jsx
|
|
791
|
+
<SectionHeader
|
|
792
|
+
iconLeft={
|
|
793
|
+
<img src={frame}
|
|
794
|
+
alt='left header icon' />}
|
|
795
|
+
iconRight={
|
|
796
|
+
<img src={important}
|
|
797
|
+
alt='left header icon'
|
|
798
|
+
className='size-8 mt-2' />}
|
|
799
|
+
subHeader="1st things first though"
|
|
800
|
+
underline
|
|
801
|
+
>
|
|
802
|
+
Prologue
|
|
803
|
+
</SectionHeader>
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
### Dependencies
|
|
809
|
+
|
|
810
|
+
**_none_**
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
[Top of Page](#table-of-contents)
|
|
814
|
+
|
|
815
|
+
|
|
696
816
|
<!-- S E L E C T ---------------------------------------------------------------------------- -->
|
|
697
817
|
|
|
698
818
|
## Select
|
|
699
819
|
|
|
700
820
|
The **Select** component or drop-down allow a user to make a single selection from multiple choices while preserving space on the form. Our Select component comes with several variants: default, fill, and outline.
|
|
701
821
|
|
|
702
|
-
The **Select** component takes two required props (**options** and **setSelectedOption**) as well as
|
|
822
|
+
The **Select** component takes two required props (**options** and **setSelectedOption**) as well as seven optional props (**className**, **classNameContainer**, **error**, **label**, **optionsLabel**, **width**, and **variant**), in addition to any other html attributes a normal html element would use, for example an aria-tag.
|
|
703
823
|
|
|
704
824
|
Full list of props below
|
|
705
825
|
|
|
@@ -708,6 +828,7 @@ Full list of props below
|
|
|
708
828
|
| Prop | Type | Optional | Default | Description |
|
|
709
829
|
| ----------- | -------- | -------- | -------- | ----------- |
|
|
710
830
|
| className | string | Yes | (1) below | a group of alternate css classes that can be specified by the developer for use in the input element. |
|
|
831
|
+
| classNameContainer | string | Yes | undefined | a group of alternate css classes that can be specified by the developer for use in the parent container of the component. |
|
|
711
832
|
| disabled | boolean | Yes | undefined | if true the Select component is placed in a disabled state |
|
|
712
833
|
| error | boolean | Yes | false | if true a red border is applied to the outside of the select component indicating an error state. |
|
|
713
834
|
| label | string | Yes | undefined | text used as the label for the input, i.e. 'Border Color' above |
|
|
@@ -778,9 +899,11 @@ Full list of props below
|
|
|
778
899
|
| className | string | Yes | (1) below | a group of alternate css classes that can be specified by the developer and applied to the outer **`div`** element. |
|
|
779
900
|
| clickOutsideCloses | boolean | Yes | **`false`** | clicking or tapping elsewhere on the application will close the SideBarNav |
|
|
780
901
|
| image | string | No | undefined | string path to the application logo to display |
|
|
781
|
-
|
|
|
902
|
+
| classNameImage | string | Yes | (2) below | a group of alternate classes that can be specified for the logo image, and applied to the **`img`** element |
|
|
903
|
+
| classNameImageContainer | string | Yes | (2) below | a group of alternate classes that can be specified for the logo image's
|
|
904
|
+
container, and applied to the **`img`** element |
|
|
782
905
|
| menu | boolean | Yes | false | when **`true`**, the default in-component hamburger menu is displayed and used to display or hide the SideBarNav |
|
|
783
|
-
|
|
|
906
|
+
| classNameMenu | string | Yes | (3) below | alternate css classes to apply to the **`button`** element that makes up the hamburger menu |
|
|
784
907
|
| menuItems | ListItemProps[] | No | undefined, see (4) below | The menu items to display |
|
|
785
908
|
| version | string | No | undefined | The version number to display |
|
|
786
909
|
|
|
@@ -860,6 +983,9 @@ The nested components inside of Skeleton are `SkelCircle`, `SkelLine`, `SkelSect
|
|
|
860
983
|
|
|
861
984
|
When using the `className` prop on one of the internal props inside the `Skeleton` component to alter style or size, as the container uses flexbox, note the usage examples above. For instance, to make a bar partially expand across the line, you can for example use `className="grow-0 basis-2/12"`.
|
|
862
985
|
|
|
986
|
+
In addition, you can apply a different color and opacity by using simple tailwindcss classes, i.e. to change the background color and opacity as above in the last example, applying **`bg-blue-500/50`** changes the color of the individual Skeleton sub-components to a shade of blue with 50%
|
|
987
|
+
opacity.
|
|
988
|
+
|
|
863
989
|
- `SkelCircle` - a small circle (i.e. a badge or icon)
|
|
864
990
|
- `SkelLine` - a line (i.e. text or content)
|
|
865
991
|
- `SkelSection` - a larger section on a page, or paragraph
|
|
@@ -956,9 +1082,9 @@ Full list of props below
|
|
|
956
1082
|
| children | string | No | | This prop takes children content, i.e. html and content that becomes the body of the Status. |
|
|
957
1083
|
| variant | string | No | 'available' | The predefined variant of Status to display. Predefined variants are `available`, `inProgress`, and `notAvailable` |
|
|
958
1084
|
| className | string | Yes | (1) below | Alternate CSS classnames to apply to the Status component. `twMerge` is used to apply these styles, so they reliably overwrite existing styles. |
|
|
959
|
-
|
|
|
1085
|
+
| classNameChild | string | Yes | (2) below | This prop takes in alternate classes to apply style to the `div` that contains the child content. |
|
|
960
1086
|
| image | ReactNode | Yes | | This prop takes type `ReactNode`, and is used to display a custom user supplied image. See usage examples above for more. |
|
|
961
|
-
|
|
|
1087
|
+
| classNameImage | string | Yes | (3) below | Alternate CSS classes that are applied to the div containing the childe div that contains the Status component image. |
|
|
962
1088
|
|
|
963
1089
|
1. className
|
|
964
1090
|
|
|
@@ -1034,7 +1160,7 @@ Full list of props below
|
|
|
1034
1160
|
| Prop | Type | Optional | Default | Description |
|
|
1035
1161
|
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1036
1162
|
| className | string | Yes | undefined | |
|
|
1037
|
-
|
|
|
1163
|
+
| classNameContainer | string | Yes | undefined | |
|
|
1038
1164
|
| tabs | {id: string; label: string; content: ReactNode;}[] | Yes | undefined | An array of |
|
|
1039
1165
|
| variant | string | Yes | 'default' | The predefined variant of Tabs to display. Current options are 'default', 'outline', and 'filled' |
|
|
1040
1166
|
|
package/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { CharacterCounter } from './lib/CharacterCounter';
|
|
|
9
9
|
export type { CharacterCounterProps } from './lib/CharacterCounter';
|
|
10
10
|
export { DatePicker } from './lib/DatePicker';
|
|
11
11
|
export type { DatePickerProps } from './lib/DatePicker';
|
|
12
|
+
export { IconPosition } from './lib/Tabs';
|
|
12
13
|
export { Input } from './lib/Input';
|
|
13
14
|
export { List, ListItem } from './lib/List';
|
|
14
15
|
export { Modal } from './lib/Modal';
|
|
@@ -18,14 +19,13 @@ export { SectionHeader } from './lib/SectionHeader';
|
|
|
18
19
|
export type { SectionHeaderProps } from './lib/SectionHeader';
|
|
19
20
|
export { Select } from './lib/Select';
|
|
20
21
|
export type { SelectProps } from './lib/Select';
|
|
22
|
+
export { SideBarNav } from './lib/SideBarNav';
|
|
21
23
|
export { Skeleton, SkelCircle, SkelLine, SkelRow, SkelSection } from './lib/Skeleton';
|
|
22
24
|
export type { SkeletonProps, SkelProps } from './lib/Skeleton';
|
|
25
|
+
export { SkipLink } from './lib/SkipLink';
|
|
23
26
|
export { Status } from './lib/Status';
|
|
24
27
|
export type { StatusProps } from './lib/Status';
|
|
25
28
|
export { Tabs } from './lib/Tabs';
|
|
26
29
|
export type { TabsProps } from './lib/Tabs';
|
|
27
|
-
export { IconPosition } from './lib/Tabs';
|
|
28
30
|
export { Toggle } from './lib/Toggle';
|
|
29
31
|
export type { ToggleProps } from './lib/Toggle';
|
|
30
|
-
export { SideBarNav } from './lib/SideBarNav';
|
|
31
|
-
export { SkipLink } from './lib/SkipLink';
|