@dhasdk/simple-ui 1.0.7 → 1.0.8
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/.babelrc +12 -0
- package/.storybook/main.ts +35 -0
- package/.storybook/preview.ts +4 -0
- package/BAKpostcss.config.jsBAK +15 -0
- package/BAKtailwind.config.mjsBAK +99 -0
- package/README.md +464 -16
- package/coverage/storybook/coverage-storybook.json +32411 -0
- package/coverage/storybook/lcov-report/Accordion.tsx.html +805 -0
- package/coverage/storybook/lcov-report/Badge.tsx.html +346 -0
- package/coverage/storybook/lcov-report/Breadcrumbs.tsx.html +742 -0
- package/coverage/storybook/lcov-report/Button.tsx.html +448 -0
- package/coverage/storybook/lcov-report/ButtonGroup.tsx.html +403 -0
- package/coverage/storybook/lcov-report/Card.tsx.html +292 -0
- package/coverage/storybook/lcov-report/CharacterCounter.tsx.html +253 -0
- package/coverage/storybook/lcov-report/CheckBox.tsx.html +1555 -0
- package/coverage/storybook/lcov-report/DatePicker.tsx.html +826 -0
- package/coverage/storybook/lcov-report/Input.tsx.html +1012 -0
- package/coverage/storybook/lcov-report/List.tsx.html +364 -0
- package/coverage/storybook/lcov-report/Modal.tsx.html +745 -0
- package/coverage/storybook/lcov-report/Pill.tsx.html +358 -0
- package/coverage/storybook/lcov-report/Search.tsx.html +997 -0
- package/coverage/storybook/lcov-report/SearchContent.tsx.html +235 -0
- package/coverage/storybook/lcov-report/SectionHeader.tsx.html +358 -0
- package/coverage/storybook/lcov-report/Select.tsx.html +1012 -0
- package/coverage/storybook/lcov-report/Shield.tsx.html +802 -0
- package/coverage/storybook/lcov-report/SideBarNav.tsx.html +490 -0
- package/coverage/storybook/lcov-report/Skeleton.tsx.html +394 -0
- package/coverage/storybook/lcov-report/Slider.tsx.html +385 -0
- package/coverage/storybook/lcov-report/Status.tsx.html +322 -0
- package/coverage/storybook/lcov-report/Tabs.tsx.html +610 -0
- package/coverage/storybook/lcov-report/Toggle.tsx.html +373 -0
- package/coverage/storybook/lcov-report/Tooltip.tsx.html +496 -0
- package/coverage/storybook/lcov-report/base.css +224 -0
- package/coverage/storybook/lcov-report/block-navigation.js +87 -0
- package/coverage/storybook/lcov-report/favicon.png +0 -0
- package/coverage/storybook/lcov-report/index.html +476 -0
- package/coverage/storybook/lcov-report/prettify.css +1 -0
- package/coverage/storybook/lcov-report/prettify.js +2 -0
- package/coverage/storybook/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/storybook/lcov-report/sorter.js +196 -0
- package/coverage/storybook/lcov.info +2312 -0
- package/dist/README.md +1815 -0
- package/eslint.config.mjs +13 -0
- package/package.json +6 -7
- package/project.json +11 -0
- package/src/assets/img/Frame.svg +5 -0
- package/src/assets/img/backArrowRight.svg +10 -0
- package/src/assets/img/bc-separator.png +0 -0
- package/src/assets/img/calendar.png +0 -0
- package/src/assets/img/calendar.svg +4 -0
- package/src/assets/img/check.svg +5 -0
- package/src/assets/img/check_box.svg +10 -0
- package/src/assets/img/check_box_empty.svg +10 -0
- package/src/assets/img/check_box_fill.svg +10 -0
- package/src/assets/img/check_box_fill_empty.svg +10 -0
- package/src/assets/img/chevron-down-white.svg +2 -0
- package/src/assets/img/chevron-down.svg +2 -0
- package/src/assets/img/chevron-left.svg +1 -0
- package/src/assets/img/chevron-right-light.svg +4 -0
- package/src/assets/img/chevron-right.svg +3 -0
- package/src/assets/img/chevron-up-white.svg +1 -0
- package/src/assets/img/chevron-up.svg +1 -0
- package/src/assets/img/clock.svg +6 -0
- package/src/assets/img/close.svg +1 -0
- package/src/assets/img/close2.svg +6 -0
- package/src/assets/img/closeModal.svg +10 -0
- package/src/assets/img/close_icon_dark.svg +10 -0
- package/src/assets/img/close_small.svg +3 -0
- package/src/assets/img/emergency_home.svg +10 -0
- package/src/assets/img/first-aid-kit.svg +7 -0
- package/src/assets/img/heartbeat.svg +4 -0
- package/src/assets/img/home-gray.svg +3 -0
- package/src/assets/img/home.svg +3 -0
- package/src/assets/img/hospital.jpg +0 -0
- package/src/assets/img/indeterminate_check_box.svg +10 -0
- package/src/assets/img/indeterminate_check_box_fill.svg +10 -0
- package/src/assets/img/info_24_ 1d4ed8.svg +3 -0
- package/src/assets/img/info_24_ 2c6441.svg +3 -0
- package/src/assets/img/marker_check_by_default.svg +10 -0
- package/src/assets/img/marker_check_by_default_fill.svg +10 -0
- package/src/assets/img/minus-accordion.svg +5 -0
- package/src/assets/img/minus.svg +3 -0
- package/src/assets/img/open.svg +1 -0
- package/src/assets/img/pill-white.svg +7 -0
- package/src/assets/img/pill.svg +5 -0
- package/src/assets/img/plus-accordion.svg +5 -0
- package/src/assets/img/plus.svg +4 -0
- package/src/assets/img/prescription.svg +6 -0
- package/src/assets/img/search.svg +10 -0
- package/src/assets/img/search_icon_light.svg +10 -0
- package/src/assets/img/separator.svg +3 -0
- package/src/assets/img/stethoscope-white.svg +8 -0
- package/src/assets/img/stethoscope.svg +8 -0
- package/src/assets/img/thumb_up.svg +10 -0
- package/src/assets/img/vector.svg +3 -0
- package/src/assets/img/warning-badge-disabled.svg +11 -0
- package/src/assets/img/warning-badge-green.svg +11 -0
- package/src/assets/img/warning-badge-red.svg +11 -0
- package/src/assets/img/warning-badge-yellow.svg +11 -0
- package/src/assets/img/warning.svg +10 -0
- package/src/global.d.ts +13 -0
- package/{index.d.ts → src/index.ts} +13 -5
- package/src/lib/Accordian--Accordian.stories.tsx +312 -0
- package/src/lib/Accordion.spec.tsx +384 -0
- package/src/lib/Accordion.tsx +240 -0
- package/src/lib/AppointmentPicker.spec.tsx +138 -0
- package/src/lib/AppointmentPicker.tsx +97 -0
- package/src/lib/Badge--Badge.stories.tsx +60 -0
- package/src/lib/Badge.spec.tsx +70 -0
- package/src/lib/Badge.tsx +87 -0
- package/src/lib/Breadcrumbs-Breadcrumbs.stories.tsx +114 -0
- package/src/lib/Breadcrumbs.spec.tsx +218 -0
- package/src/lib/Breadcrumbs.tsx +219 -0
- package/src/lib/Button--Button.stories.tsx +220 -0
- package/src/lib/Button.spec.tsx +241 -0
- package/src/lib/Button.tsx +121 -0
- package/src/lib/ButtonGroup--ButtonGroup.stories.tsx +129 -0
- package/src/lib/ButtonGroup.spec.tsx +89 -0
- package/src/lib/ButtonGroup.tsx +107 -0
- package/src/lib/Card--Card.stories.tsx +113 -0
- package/src/lib/Card.spec.tsx +112 -0
- package/src/lib/Card.tsx +69 -0
- package/src/lib/CharacterCounter--CharacterCounter.stories.tsx +169 -0
- package/src/lib/CharacterCounter.spec.tsx +123 -0
- package/src/lib/CharacterCounter.tsx +56 -0
- package/src/lib/CheckBox--CheckBox.stories.tsx +107 -0
- package/src/lib/CheckBox.spec.tsx +412 -0
- package/src/lib/CheckBox.tsx +491 -0
- package/src/lib/DatePicker--DatePicker.stories.tsx +228 -0
- package/src/lib/DatePicker.spec.tsx +424 -0
- package/src/lib/DatePicker.tsx +247 -0
- package/src/lib/Input--Input.stories.tsx +449 -0
- package/src/lib/Input.spec.tsx +281 -0
- package/src/lib/Input.tsx +309 -0
- package/src/lib/List--List.stories.tsx +157 -0
- package/src/lib/List.spec.tsx +211 -0
- package/src/lib/List.tsx +93 -0
- package/src/lib/Modal--Modal.stories.tsx +454 -0
- package/src/lib/Modal.spec.tsx +202 -0
- package/src/lib/Modal.tsx +220 -0
- package/src/lib/Pill--Pill.stories.tsx +98 -0
- package/src/lib/Pill.spec.tsx +103 -0
- package/src/lib/Pill.tsx +91 -0
- package/src/lib/ProgressBar.spec.tsx +106 -0
- package/src/lib/ProgressBar.tsx +112 -0
- package/src/lib/RadioGroup.spec.tsx +84 -0
- package/src/lib/RadioGroup.tsx +74 -0
- package/src/lib/RadioIcon.tsx +13 -0
- package/src/lib/Search--Search.stories.tsx +67 -0
- package/src/lib/Search.spec.tsx +182 -0
- package/src/lib/Search.tsx +304 -0
- package/src/lib/SearchContent.tsx +51 -0
- package/src/lib/SectionHeader--SectionHeader.stories.tsx +98 -0
- package/src/lib/SectionHeader.spec.tsx +60 -0
- package/src/lib/SectionHeader.tsx +91 -0
- package/src/lib/Select--Select.stories.tsx +387 -0
- package/src/lib/Select.spec.tsx +493 -0
- package/src/lib/Select.tsx +311 -0
- package/src/lib/Shield--Shield.stories.tsx +196 -0
- package/src/lib/Shield.spec.tsx +275 -0
- package/src/lib/Shield.tsx +239 -0
- package/src/lib/SideBarNav--SideBarNav.stories.tsx +136 -0
- package/src/lib/SideBarNav.spec.tsx +178 -0
- package/src/lib/SideBarNav.tsx +135 -0
- package/src/lib/Skeleton--Skeleton.stories.tsx +77 -0
- package/src/lib/Skeleton.module.css +16 -0
- package/src/lib/Skeleton.spec.tsx +83 -0
- package/src/lib/Skeleton.tsx +103 -0
- package/src/lib/SkipLink.spec.tsx +76 -0
- package/src/lib/SkipLink.tsx +48 -0
- package/src/lib/Slider--Slider.stories.tsx +108 -0
- package/src/lib/Slider.module.css +109 -0
- package/src/lib/Slider.spec.tsx +67 -0
- package/src/lib/Slider.tsx +101 -0
- package/src/lib/Status--Status.stories.tsx +93 -0
- package/src/lib/Status.spec.tsx +118 -0
- package/src/lib/Status.tsx +79 -0
- package/src/lib/Tabs--Tabs.stories.tsx +294 -0
- package/src/lib/Tabs.spec.tsx +249 -0
- package/src/lib/Tabs.tsx +188 -0
- package/src/lib/Tester.spec.tsx +17 -0
- package/src/lib/Toggle--Toggle.stories.tsx +162 -0
- package/src/lib/Toggle.spec.tsx +122 -0
- package/src/lib/Toggle.tsx +96 -0
- package/src/lib/Tooltip--Tooltip.stories.tsx +315 -0
- package/src/lib/Tooltip.spec.tsx +307 -0
- package/src/lib/Tooltip.tsx +137 -0
- package/src/lib/bak-simple-ui.stories.tsx-bak +24 -0
- package/src/styles.css +190 -0
- package/tsconfig.json +25 -0
- package/tsconfig.lib.json +42 -0
- package/tsconfig.spec.json +29 -0
- package/tsconfig.storybook.json +36 -0
- package/vite.config.mts +87 -0
- package/vitest.setup.ts +12 -0
- package/index.css +0 -1
- package/index.js +0 -35
- package/index.mjs +0 -4981
- package/lib/Accordion.d.ts +0 -36
- package/lib/AppointmentPicker.d.ts +0 -21
- package/lib/Badge.d.ts +0 -11
- package/lib/Breadcrumbs.d.ts +0 -13
- package/lib/Button.d.ts +0 -15
- package/lib/ButtonGroup.d.ts +0 -8
- package/lib/Card.d.ts +0 -11
- package/lib/CharacterCounter.d.ts +0 -11
- package/lib/CheckBox.d.ts +0 -30
- package/lib/DatePicker.d.ts +0 -7
- package/lib/Input.d.ts +0 -16
- package/lib/List.d.ts +0 -22
- package/lib/Modal.d.ts +0 -18
- package/lib/Pill.d.ts +0 -13
- package/lib/ProgressBar.d.ts +0 -19
- package/lib/RadioGroup.d.ts +0 -15
- package/lib/Search.d.ts +0 -26
- package/lib/SearchContent.d.ts +0 -6
- package/lib/SectionHeader.d.ts +0 -18
- package/lib/Select.d.ts +0 -19
- package/lib/Shield.d.ts +0 -12
- package/lib/SideBarNav.d.ts +0 -21
- package/lib/Skeleton.d.ts +0 -15
- package/lib/SkipLink.d.ts +0 -22
- package/lib/Slider.d.ts +0 -14
- package/lib/Status.d.ts +0 -10
- package/lib/Tabs.d.ts +0 -23
- package/lib/Toggle.d.ts +0 -11
- package/lib/Tooltip.d.ts +0 -14
package/dist/README.md
ADDED
|
@@ -0,0 +1,1815 @@
|
|
|
1
|
+
# simple-ui
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev) on React 18.x.
|
|
4
|
+
|
|
5
|
+
## <span style="color: orange;">*This library is under active development and not ready for production use\*</span>
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
AppointmentPicker
|
|
9
|
+
ProgressBar
|
|
10
|
+
RadioGroup
|
|
11
|
+
Search
|
|
12
|
+
Shield
|
|
13
|
+
Tooltip
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Table of Contents
|
|
18
|
+
|
|
19
|
+
- [Installation](#installation-and-setup)
|
|
20
|
+
- [Accordion](#accordion)
|
|
21
|
+
- [Badge](#badge)
|
|
22
|
+
- [BreadCrumbs](#breadcrumbs)
|
|
23
|
+
- [Button](#button)
|
|
24
|
+
- [ButtonGroup](#buttongroup)
|
|
25
|
+
- [Card](#card)
|
|
26
|
+
- [CharacterCounter](#charactercounter)
|
|
27
|
+
- [CheckBox](#checkbox)
|
|
28
|
+
- [DatePicker](#datepicker)
|
|
29
|
+
- [Input](#input)
|
|
30
|
+
- [List](#list)
|
|
31
|
+
- [Modal](#modal)
|
|
32
|
+
- [Pill](#pill)
|
|
33
|
+
- [SectionHeader](#sectionheader)
|
|
34
|
+
- [Select](#select)
|
|
35
|
+
- [SideBarNav](#sidebarnav)
|
|
36
|
+
- [Skeleton](#skeleton)
|
|
37
|
+
- [Slider](#slider)
|
|
38
|
+
- [Status](#status)
|
|
39
|
+
- [Tabs](#tabs)
|
|
40
|
+
- [Toggle](#toggle)
|
|
41
|
+
|
|
42
|
+
<!-- ## Quick Notes: -->
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<!-- I N S T A L L A T I O N ----------------------------------------------------------------------------------- -->
|
|
47
|
+
|
|
48
|
+
[Back to Main Readme](./README.md)
|
|
49
|
+
|
|
50
|
+
## Installation and Setup
|
|
51
|
+
|
|
52
|
+
1. From the terminal run the following command:
|
|
53
|
+
|
|
54
|
+
- **`npm install @dhasdk/simple-ui`**
|
|
55
|
+
|
|
56
|
+
2. Integrate simple-ui into your local tailwind configuration
|
|
57
|
+
|
|
58
|
+
- Add **`node_modules/@dhasdk/**/*.{js,jsx}`** (or similar) to the **content** block inside your **`tailwind.config.ts`** file.
|
|
59
|
+
|
|
60
|
+
3. Open the page that you are going to place the **dhasdk/simple-ui** component, and do the following:
|
|
61
|
+
|
|
62
|
+
- At the top of the file, import your desired component from **'@dhasdk'**, i.e. if you are using the **Badge** component, then:
|
|
63
|
+
- **`import { Badge } from '@dhasdk/simple-ui';`**
|
|
64
|
+
- Elsewhere in your file, use the component as documented below
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
<!-- A C C O R D I O N ----------------------------------------------------------------------------------- -->
|
|
68
|
+
|
|
69
|
+
## Accordion
|
|
70
|
+
|
|
71
|
+
The **Accordion** and **AccordionParent** components take a number of props, and work together to display a group of Accordions. The AccordionParent component is really only required for two purposes:
|
|
72
|
+
|
|
73
|
+
- Multiple accordions are displayed, and it is desired that only one can be opened at a time. This requires state management between the various accordions listed, and the parent Accordion helps with this.
|
|
74
|
+
|
|
75
|
+
- You have multiple accordions, and there are one or more identical prop values that you would like to pass to each of the Accordion components. Passing these props to the parent component instead, **AccordionParent**, will simplify **Accordion** component usage. These various props that are specified on the AccordionParent level will be automatically passed down to the children Accordion components.
|
|
76
|
+
|
|
77
|
+
A **ref** can also be created and assigned to the Accordion component, and the component will point the reference to the outer html DIV.
|
|
78
|
+
|
|
79
|
+
Separately below is the Props listing both the **AccordionParent** and **Accordion** components. All of the props listed for Accordion can be passed as values to the AccordionParent, and they will be safely passed to the child Accordion components so that they do not have to be individually specified.
|
|
80
|
+
|
|
81
|
+
Finally, if Accordion props are specified inside the parent component, those values can be overridden on an individual basis by specifying alternate values for the individual Accordion component you wish to indepentently control.
|
|
82
|
+
|
|
83
|
+
### Props for AccordionParent
|
|
84
|
+
|
|
85
|
+
| Prop | Type | Optional | Default | Description |
|
|
86
|
+
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
87
|
+
| children | ReactNode | No | undefined | This is intended to contain the child **Accordion** components |
|
|
88
|
+
| chevron | boolean | Yes | undefined | If true, displays chevron icons for open/closed status, otherwise displays plus and minus icons. |
|
|
89
|
+
| iconAccordionOpened & iconAccordionClosed | ReactNode | Yes | N/A | custom icons to display for opened and closed state. See usage example above for a demonstration. |
|
|
90
|
+
| classNameChildHeading | string | Yes | CSS classes to apply to the child Accordion component headings. These can be overridden on an individual basis using the same prop on the Accordion component. |
|
|
91
|
+
| classNameChildContent | string | No | N/A | CSS classes to apply to the child Accordion component content body. These can be overridden on an individual basis using the same prop on the Accordion component. |
|
|
92
|
+
| classNameContainer | string | Yes | undefined | CSS classes applied to the container div for the **AccordionParent** component. |
|
|
93
|
+
| classNameHr | string | Yes | CSS classes applied to the HR that sits between the accordion heading and content body when open and the prop useBackground is true. |
|
|
94
|
+
| hr | boolean | Yes | true | This boolean value when true directs the display an hr element between the Accordion heading and body when in the open state. |
|
|
95
|
+
| ...props | string | No | | takes additional props that are not specifically defined in the component, i.e. aria-label |
|
|
96
|
+
<!-- | rounded | boolean | Yes | false | This boolean value indicates whether to display rounded corners or not. By using this prop vs custom classes, only the top of the heading is rounded in an opened state, and only the bottom of the content block is rounded also. | -->
|
|
97
|
+
| singleOpen | boolean | Yes | false | This boolean value directs the accordion to allow only one opened child content body at a time. Setting a value of false will allow multiple to be opened at once. |
|
|
98
|
+
| useBackground | boolean | Yes | true | This boolean value causes the accordion content block to use the same background as the accordion heading. When true, an hr is also present at the top of the content block to separate the heading from the content. This hr can be styled separately using the classNameHr prop. |
|
|
99
|
+
| variant | string | Yes | 'default' | currently unused |
|
|
100
|
+
|
|
101
|
+
### Props for Accordion
|
|
102
|
+
|
|
103
|
+
| Prop | Type | Optional | Default | Description |
|
|
104
|
+
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
105
|
+
| children | ReactNode | No | undefined | This contains the body of the **Accordion** content. |
|
|
106
|
+
| chevron | boolean | Yes | undefined | If true, displays chevron icons for open/closed status, otherwise displays plus and minus icons. |
|
|
107
|
+
| iconAccordionOpened & iconAccordionClosed | ReactNode | Yes | N/A | custom icons to display for opened and closed state. See usage example above for a demonstration. |
|
|
108
|
+
| classNameContainer | string | Yes | undefined | CSS classes applied to the container div for the **Accordion** component. |
|
|
109
|
+
| classNameHeading | string | Yes | CSS classes to apply to the child Accordion component headings. |
|
|
110
|
+
| classNameContent | string | No | N/A | CSS classes to apply to the Accordion component content body. |
|
|
111
|
+
| classNameHr | string | Yes | CSS classes applied to the HR that sits between the accordion heading and content body when open and the prop useBackground is true. |
|
|
112
|
+
| hr | boolean | Yes | true | This boolean value when true directs the display an hr element between the Accordion heading and body when in the open state. |
|
|
113
|
+
| index | number | yes | undefined | optional index value for a specific accordion in the stack. if not present, label is used. |
|
|
114
|
+
| onExpand | (setOpen: CallbackFunction) => void | Yes | undefined | Callback function that is executed when Accordin is expanded. |
|
|
115
|
+
| ...props | string | No | | takes additional props that are not specifically defined in the component, i.e. aria-label |
|
|
116
|
+
<!-- | rounded | boolean | Yes | false | This boolean value indicates whether to display rounded corners or not. By using this prop vs custom classes, only the top of the heading is rounded in an opened state, and only the bottom of the content block is rounded also. | -->
|
|
117
|
+
| singleOpen | boolean | Yes | false | This boolean value directs the accordion to allow only one opened child content body at a time. Setting a value of false will allow multiple to be opened at once. |
|
|
118
|
+
| useBackground | boolean | Yes | true | This boolean value causes the accordion content block to use the same background as the accordion heading. When true, an hr is also present at the top of the content block to separate the heading from the content. This hr can be styled separately using the classNameHr prop. |
|
|
119
|
+
| variant | string | Yes | 'default' | currently unused |
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Example Usage
|
|
123
|
+
|
|
124
|
+
```jsx
|
|
125
|
+
<AccordionParent
|
|
126
|
+
classNameChildHeading='bg-white'
|
|
127
|
+
classNameChildContent='bg-white'>
|
|
128
|
+
<Accordion label='First Example'>
|
|
129
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ...
|
|
130
|
+
</Accordion>
|
|
131
|
+
<Accordion label='Second Example'>
|
|
132
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ...
|
|
133
|
+
</Accordion>
|
|
134
|
+
<Accordion label='Third Example'>
|
|
135
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ...
|
|
136
|
+
</Accordion>
|
|
137
|
+
</AccordionParent>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Dependencies
|
|
141
|
+
|
|
142
|
+
**_none_**
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
[Top of Page](#table-of-contents)
|
|
146
|
+
|
|
147
|
+
<!-- E N D A C C O R D I O N -->
|
|
148
|
+
|
|
149
|
+
<!-- A P P O I N T M E N T P I C K E R ----------------------------------------------------------------- -->
|
|
150
|
+
|
|
151
|
+
## Appointment Picker
|
|
152
|
+
|
|
153
|
+
The **AppointmentPicker** component allows a user to make a single selection from a list of multiple times.
|
|
154
|
+
|
|
155
|
+
This component takes multiple optional props in addition to any other html attributes a normal html element would use, for example an **aria-tag**.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
### Props for AppointmentPicker
|
|
159
|
+
|
|
160
|
+
| Prop | Type | Optional | Default | Description |
|
|
161
|
+
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
162
|
+
| className | string | Yes | see below | a group of alternate css classes that can be specified by the developer for use in the dropdown button portion of the component. |
|
|
163
|
+
| classNameContainer | string | Yes | '' | a group of alternate css classes that can be specified by the developer for use in the parent container of the component. |
|
|
164
|
+
| interval | 'hour' \| 'half-hour' \| 'quarter-hour' | Yes | **`'hour'`** | Controls the interval between times, for example 'hour' intervals would produce results like 01:00, 02:00 etc, while half hour and quarter hour would produce gaps of 30 and 15 minutes respectively. |
|
|
165
|
+
| timeFormat | '12hr' \| '24hr' | Yes | **`'24hr'`** | Controls whether the times are listed as military or standard 12 hour, am/pm times. (13:00 vs 1:00pm & 03:00 vs 3:00am) |
|
|
166
|
+
| hourRange | [number, number] | Yes | **`undefined`** | If specified, only hours within and including the range specified will be available for selection. |
|
|
167
|
+
| label | string | Yes | **`undefined`** | text used as the label for the input, i.e. 'Pick a time (hourly)' above |
|
|
168
|
+
| optionsLabel | string | Yes | **`'Select a time'`** | appears as the label in the AppointmentPicker component, i.e. 'Select a time' above. Note, this is not the label above the component. |
|
|
169
|
+
| setSelectedOption | **`(string) => void`** | No | **`undefined`** | calls the given function with the selected value if present, otherwise with name |
|
|
170
|
+
| variant | **`string`** | Yes | **`undefined`** | The predefined variant of Select to display. Current options are 'default', 'fill', and 'outline' |
|
|
171
|
+
| width | **`string`** | Yes | | This prop is intended to, like className, take in css class name values. These are intended though to only take class names relevant to the component width, as they will be applied to both the button and the drop down elements of the AppointmentPicker component. For instance, the width prop is a good way to ensure that the button and drop down are of the same width. Pay attention to the default classes below. |
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
***Base CSS Classes***
|
|
175
|
+
|
|
176
|
+
**`outline-hidden outline-offset-0 flex justify-between items-center w-[292px] md:w-[343px] lg:w-[600px] h-14 border focus:outline-4 focus:mb-2 focus:outline-[#fa89f1] shadow-sm pl-4 pr-2 py-2 bg-white text-base md:text-lg font-medium text-gray-700 hover:bg-gray-50 border-[#b3b3b3] h-12 mt-1 font-["Arial"] Separate Variant Styles`**
|
|
177
|
+
|
|
178
|
+
***default:***
|
|
179
|
+
**`hover:bg-gray-200 text-black hover:border-gray-400 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive disabled:border-dha-mc-secondary-border disabled:border-2`**
|
|
180
|
+
***fill:***
|
|
181
|
+
**`hover:bg-[#0c2c8e] text-white bg-[#092068] hover:border-gray-400 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive disabled:border-dha-mc-secondary-border disabled:border-2 py-3`**
|
|
182
|
+
***outline:***
|
|
183
|
+
**`bg-white text-[#808080] disabled:border-dha-mc-secondary-border disabled:text-dha-mc-checkbox-inactive`**
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
### Example Usage
|
|
187
|
+
|
|
188
|
+
```jsx
|
|
189
|
+
<AppointmentPicker label="Pick a time (half-hour)" interval='half-hour' />
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Dependencies
|
|
193
|
+
|
|
194
|
+
**_none_**
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
[Top of Page](#table-of-contents)
|
|
198
|
+
|
|
199
|
+
<!-- E N D A P P O I N T M E N T P I C K E R -->
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
<!-- B A D G E ----------------------------------------------------------------------------------- -->
|
|
203
|
+
|
|
204
|
+
## Badge
|
|
205
|
+
|
|
206
|
+
The **badge** component takes three required props, **variant**, **subVariant**, and **child** content.
|
|
207
|
+
|
|
208
|
+
Optional props are **className**, **svgClasses**, **imagePath**, **imageAlt**, and **classNameImage**.
|
|
209
|
+
|
|
210
|
+
As with the button component, this component also takes additional html attributes that when included are passed to the parent div.
|
|
211
|
+
|
|
212
|
+
This div is also styled using the tailwind **`twMerge()`** utility, so custom classes can be added via the classNames prop as well.
|
|
213
|
+
|
|
214
|
+
### Props
|
|
215
|
+
|
|
216
|
+
| Prop | Type | Optional | Default | Description |
|
|
217
|
+
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
218
|
+
| children | ReactNode | No | | html and content that becomes the body of the Badge. |
|
|
219
|
+
| variant | string | No | 'success ' | The predefined variant of Badge to display. UX designed variants are **success**, **caution**, **danger**, and **disabled** |
|
|
220
|
+
| className | string | Yes | See **(1)** below | Alternate CSS classnames to apply to the Badge component.twMerge is used to apply these styles, so they reliably overwrite existing styles |
|
|
221
|
+
| classNameChildren | string | Yes | See **(2)** below | Alternate CSS classnames to apply to the Children content inside the Badge component.twMerge is used to apply these styles, so they reliably overwrite existing styles. |
|
|
222
|
+
| classNameImage | string | Yes | See **(3)** below | Alternate CSS classes that are applied to the image for variant type media. |
|
|
223
|
+
| icon | ReactNode | Yes | undefined | An alternate icon to use for the instance of this Badge |
|
|
224
|
+
| iconAlt | string | Yes | undefined | When an imagePath is specified, please specify an imageAlt that can be used for accessibility purposes. |
|
|
225
|
+
|
|
226
|
+
1. Variants
|
|
227
|
+
- success
|
|
228
|
+
- className: **`w-[79px] h-[26px] px-3 py-1 bg-[#d6f4d5] rounded-[40px] outline outline-1 -outline-offset-1 outline-[#387740] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
|
|
229
|
+
- classNameChildren: **`text-[#387740] text-xs font-normal font-['Arial'] leading-[18px] md:text-md md:leading-normal lg:text-lg lg:leading-[27px`**
|
|
230
|
+
- classNameImage: **`relative size-2.5 mb-0.5 me-1.5 md:size-3.5 md:me-2 lg:size-4 lg:mb-0.5 lg:me-2.5 lg:ms-1`**
|
|
231
|
+
- caution
|
|
232
|
+
- className: **`w-[79px] h-[26px] px-3 py-1 bg-[#fff1be] rounded-[40px] outline outline-1 -outline-offset-1 outline-[#966121] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
|
|
233
|
+
- classNameImage: **`relative size-2.5 mb-0.5 me-1.5 md:size-3.5 md:me-2 lg:size-4 lg:mb-0.5 lg:me-2.5 lg:ms-1`**
|
|
234
|
+
- classNameChildren: **`text-[#966222] text-xs font-normal font-['Arial'] leading-[18px] md:text-base md:leading-normal lg:text-lg lg:leading-[27px}`**
|
|
235
|
+
- danger
|
|
236
|
+
- className: **`w-[79px] h-[26px] px-3 py-1 bg-[#f4c2c2] rounded-[40px] outline outline-1 -outline-offset-1 outline-[#a22b23] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
|
|
237
|
+
- classNameImage: **`relative size-2.5 mb-0.5 me-1.5 md:size-3.5 md:me-2 lg:size-4 lg:mb-0.5 lg:me-2.5 lg:ms-1`**
|
|
238
|
+
- classNameChildren: **`text-[#A32C24] text-xs font-normal font-['Arial'] leading-[18px] md:text-base md:leading-normal lg:text-lg lg:leading-[27px]`**
|
|
239
|
+
- disabled
|
|
240
|
+
- className: **`w-[79px] h-[26px] px-3 py-1 rounded-[40px] outline outline-1 -outline-offset-1 outline-[#394150] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
|
|
241
|
+
- classNameImage: **`relative size-2.5 mb-0.5 me-1.5 md:size-3.5 md:me-2 lg:size-4 lg:mb-0.5 lg:me-2.5 lg:ms-1`**
|
|
242
|
+
- classNameChildren: **`text-[#394150] text-xs font-normal font-['Arial'] leading-[18px] md:text-md md:leading-normal lg:text-lg lg:leading-[27px]`**
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
### Example Usage
|
|
247
|
+
|
|
248
|
+
Default Variant
|
|
249
|
+
|
|
250
|
+
```jsx
|
|
251
|
+
<Badge
|
|
252
|
+
aria-label="appropriate aria label here">
|
|
253
|
+
Badge!
|
|
254
|
+
</Badge>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
caution Variant
|
|
258
|
+
|
|
259
|
+
```jsx
|
|
260
|
+
<Badge
|
|
261
|
+
variant="caution"
|
|
262
|
+
aria-label="appropriate aria label here">
|
|
263
|
+
Badge!
|
|
264
|
+
</Badge>
|
|
265
|
+
```
|
|
266
|
+
danger Variant
|
|
267
|
+
|
|
268
|
+
```jsx
|
|
269
|
+
<Badge
|
|
270
|
+
variant="danger"
|
|
271
|
+
aria-label="appropriate aria label here">
|
|
272
|
+
Badge!
|
|
273
|
+
</Badge>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Dependencies
|
|
277
|
+
|
|
278
|
+
**_none_**
|
|
279
|
+
|
|
280
|
+
[Top of Page](#table-of-contents)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
<!-- B R E A D C R U M B S ------------------------------------------------------------------------------ -->
|
|
284
|
+
|
|
285
|
+
## BreadCrumbs
|
|
286
|
+
|
|
287
|
+
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.
|
|
288
|
+
|
|
289
|
+
When the container or window is too narrow to display the full Breadcrumbs list, the middle items are truncated into an ellipsis.
|
|
290
|
+
|
|
291
|
+
The BreadCrumbs component takes in various props in addition to any other html attributes a normal NAV element would use.
|
|
292
|
+
|
|
293
|
+
A `ref` can also be created and assigned to the button component, and the component will point the reference to the html nav element.
|
|
294
|
+
|
|
295
|
+
The `className` prop takes a list of alternate CSS classes the developer would like applied to the component. These are applied using the tailwind `twMerge` function, and will safely overwrite any conflicting classes ensuring proper styling. These classes are applied to the individual links.
|
|
296
|
+
|
|
297
|
+
The `classNameContainer` takes a list of css classes that are applied to the enclosing `nav` element.
|
|
298
|
+
|
|
299
|
+
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.
|
|
300
|
+
|
|
301
|
+
If `routes` are not specified, the Breadcrumbs component will attempt to auto-generate and display its parent routes.
|
|
302
|
+
|
|
303
|
+
Full list of props below
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
### Props
|
|
307
|
+
|
|
308
|
+
| Prop | Type | Optional | Default | Description |
|
|
309
|
+
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
310
|
+
| 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. |
|
|
311
|
+
| classNameContainer | string | Yes | | This is used to apply user supplied styling to the container `nav` element. |
|
|
312
|
+
| 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. |
|
|
313
|
+
| ...props | string | Yes | undefined | takes additional props that are not specifically defined in the component, i.e. aria-label |
|
|
314
|
+
| separator | string | Yes | | A string value providing the path name to an alternate separator |
|
|
315
|
+
| 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'. |
|
|
316
|
+
|
|
317
|
+
### Example Usage
|
|
318
|
+
|
|
319
|
+
With Auto Routes
|
|
320
|
+
|
|
321
|
+
```jsx
|
|
322
|
+
<BreadCrumbs />
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Manually Specified Routes
|
|
326
|
+
|
|
327
|
+
```jsx
|
|
328
|
+
<Breadcrumbs
|
|
329
|
+
routes =
|
|
330
|
+
{[
|
|
331
|
+
{ name: 'Path 1', route: '/path1' },
|
|
332
|
+
{ name: 'Path 2', route: '/path2' },
|
|
333
|
+
{ name: 'Path 3', route: '/path3' },
|
|
334
|
+
]}
|
|
335
|
+
/>
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Dependencies
|
|
339
|
+
|
|
340
|
+
**_none_**
|
|
341
|
+
|
|
342
|
+
[Top of Page](#table-of-contents)
|
|
343
|
+
|
|
344
|
+
<!-- B U T T O N ------------------------------------------------------------------------------ -->
|
|
345
|
+
|
|
346
|
+
## Button
|
|
347
|
+
|
|
348
|
+
The **button** component as built takes in a number of optional props in addition to any other html attributes a normal html button would use, for example an aria tag.
|
|
349
|
+
|
|
350
|
+
A reference can also be created and passed to the button component, and the component will point the reference to the html button.
|
|
351
|
+
|
|
352
|
+
### Props
|
|
353
|
+
|
|
354
|
+
| Prop | Type | Optional | Default | Description |
|
|
355
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
356
|
+
| children | ReactNode | Yes | | Content to display in the Button, overrides 'label' if both are present. |
|
|
357
|
+
| className | string | Yes | **(1) below** | Class names to style component |
|
|
358
|
+
| classNameSelected | string | Yes | undefined | Class names to apply to the components if they are in the optional selected state, see **selected** below |
|
|
359
|
+
| icon | ReactNode | Yes | undefined | image, icon, etc. to use for left or right icon as defined by **`iconPosition`** |
|
|
360
|
+
| iconPosition | 'left', 'right', 'iconOnly', undefined | Yes | | indicates the location for icon if specified |
|
|
361
|
+
| label | string | Yes | | Display text for button. If 'children' is present, that is used instead |
|
|
362
|
+
| onClick | () => void | Yes | | A click handler for the Button |
|
|
363
|
+
| ...props | string | Yes | undefined | additional props that are not specifically defined in the component, i.e. aria-label |
|
|
364
|
+
| type | string | Yes | 'button' | specifies the button type, and is one of 'button', 'submit', or 'reset' |
|
|
365
|
+
| selected | boolean | Yes | false | when specified true, button will display selected state as described by **`classNameSelected`**. See example use in the SDK demo app with the 'Usage', 'Code', and 'Docs' buttons. |
|
|
366
|
+
| variant | string | Yes | 'default' | CSS Button variant, available variants are 'default', 'filled', 'outline', and 'transparent' |
|
|
367
|
+
|
|
368
|
+
**(1) classname defaults**
|
|
369
|
+
|
|
370
|
+
- Base CSS Classes
|
|
371
|
+
|
|
372
|
+
- **`inline-flex items-center justify-center whitespace-nowrap rounded-md ring-offset-background transition-colors focus-visible:outline-hidden font-["Arial"] disabled:pointer-events-none text-sm md:text-base lg:text-lg disabled:opacity-50 px-6 py-[8px] md:py-[12px] lg:py-[16px] h-[40px] md:h-[48px] lg:h-[56px]`**
|
|
373
|
+
|
|
374
|
+
- Additional Classes per variant
|
|
375
|
+
- 'default' - **`border-2 border-gray-300 rounded-md bg-gray-200 hover:bg-slate-400 text-black text-lg hover:text-white hover:border-slate-600 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive focus:border-black disabled:border-dha-mc-bottom-nav-background disabled:border-2 py-0 md:py-0 lg:py-0 h-[48px] mt-1`**
|
|
376
|
+
- 'selected' - **`bg-gray-500 text-white`**
|
|
377
|
+
- 'filled' - **`rounded-md bg-[#092068] hover:bg-[#0c2c8e] text-white text-lg hover:text-white focus:shadow-[0px_0px_0px_3px_rgba(238,131,255,1.00)] active:bg-[#092068]/80 disabled:bg-[#e4e4e5] disabled:text-[#939194] disabled:border-[#e4e4e5]`**
|
|
378
|
+
- 'outline' - **`rounded-md border-[#092068] bg-white border-2 text-[#092068] text-lg disabled:border-dha-mc-secondary-border disabled:text-[#939194] hover:bg-[#d1dbfb] active:bg-[#9fc5f0] focus:shadow-[0px_0px_0px_3px_rgba(238,131,255,1.00)] text-lg`**
|
|
379
|
+
- 'transparent' - **`rounded-md text-lg text-[#092068] hover:bg-[#d1dbfb] active:bg-[#9fc5f0] focus:shadow-[0px_0px_0px_3px_rgba(251,137,241,1.00)] 'disabled:text-[#939194]`**
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
### Example Usage
|
|
383
|
+
|
|
384
|
+
filled variant example
|
|
385
|
+
|
|
386
|
+
```jsx
|
|
387
|
+
<Button
|
|
388
|
+
disabled={disabledState}
|
|
389
|
+
label = {buttonName}
|
|
390
|
+
onClick={handleButtonClick}
|
|
391
|
+
variant='filled'
|
|
392
|
+
/>
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
outline variant example
|
|
396
|
+
|
|
397
|
+
```jsx
|
|
398
|
+
<Button
|
|
399
|
+
disabled={disabledState}
|
|
400
|
+
label = {buttonName}
|
|
401
|
+
onClick={handleButtonClick}
|
|
402
|
+
variant='outline'
|
|
403
|
+
/>
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
icon left on filled variant
|
|
407
|
+
|
|
408
|
+
```jsx
|
|
409
|
+
<Button
|
|
410
|
+
disabled={disabledState}
|
|
411
|
+
label = {buttonName}
|
|
412
|
+
onClick={handleButtonClick}
|
|
413
|
+
variant='filled'
|
|
414
|
+
icon={<img src={filledIconLeft} alt='icon left' />}
|
|
415
|
+
iconPosition='left'
|
|
416
|
+
/>
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
using selected option w/ filled variant
|
|
420
|
+
|
|
421
|
+
```jsx
|
|
422
|
+
<Button
|
|
423
|
+
disabled={disabledState}
|
|
424
|
+
label = {buttonName}
|
|
425
|
+
onClick={setOpenUsage(!openUsage)}
|
|
426
|
+
classNameSelected='bg-slate-200'
|
|
427
|
+
selected={openUsage}
|
|
428
|
+
variant='filled'
|
|
429
|
+
/>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
### Dependencies
|
|
434
|
+
|
|
435
|
+
**_none_**
|
|
436
|
+
|
|
437
|
+
<!-- B U T T O N G R O U P ------------------------------------------------------------------------------ -->
|
|
438
|
+
|
|
439
|
+
## ButtonGroup
|
|
440
|
+
|
|
441
|
+
The **ButtonGroup** is a component that wraps a series of **Button** components, creating both a visual and functional grouping.
|
|
442
|
+
|
|
443
|
+
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.
|
|
444
|
+
|
|
445
|
+
The variants labeled **default** and **column** demonstrated in the examples below are UX defined variants.
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
### Props
|
|
449
|
+
|
|
450
|
+
| Prop | Type | Optional | Default | Description |
|
|
451
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
452
|
+
| children | ReactNode | Yes | | This contains one or more Button components that comprise this ButtonGroup. |
|
|
453
|
+
| className | string | Yes |'' | This prop applies the given classNames to the DIV that wraps and comprises the ButtonGroup component. |
|
|
454
|
+
| 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. |
|
|
455
|
+
| 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. |
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
### Example Usage
|
|
459
|
+
|
|
460
|
+
default variant w/ 3 Buttons (ux styled)
|
|
461
|
+
|
|
462
|
+
```jsx
|
|
463
|
+
<ButtonGroup className='w-full'>
|
|
464
|
+
<Button variant='outline' onClick={doSomething}>Secondary</Button>
|
|
465
|
+
<Button variant='filled' onClick={doSomething}>Primary</Button>
|
|
466
|
+
<Button variant='transparent' onClick={doSomething}>Tertiary</Button>
|
|
467
|
+
</ButtonGroup>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
default variant w/ 2 Buttons
|
|
471
|
+
|
|
472
|
+
```jsx
|
|
473
|
+
<ButtonGroup>
|
|
474
|
+
<Button variant='outline' onClick={doSomething}>Secondary</Button>
|
|
475
|
+
<Button variant='filled' onClick={doSomething}>Primary</Button>
|
|
476
|
+
</ButtonGroup>
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
column variant w/ 3 Buttons
|
|
480
|
+
|
|
481
|
+
```jsx
|
|
482
|
+
<ButtonGroup variant='column'>
|
|
483
|
+
<Button variant='outline' onClick={doSomething} >Secondary</Button>
|
|
484
|
+
<Button variant='filled' onClick={doSomething} >Primary</Button>
|
|
485
|
+
<Button variant='transparent' onClick={doSomething} >Tertiary</Button>
|
|
486
|
+
</ButtonGroup>
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
column variant w/ 2 Buttons
|
|
490
|
+
|
|
491
|
+
```jsx
|
|
492
|
+
<ButtonGroup variant='column'>
|
|
493
|
+
<Button variant='outline' onClick={doSomething}>Secondary</Button>
|
|
494
|
+
<Button variant='filled' onClick={doSomething}>Primary</Button>
|
|
495
|
+
</ButtonGroup>
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
use of common examples
|
|
499
|
+
|
|
500
|
+
```jsx
|
|
501
|
+
<ButtonGroup
|
|
502
|
+
className='w-full'
|
|
503
|
+
classNameButtons="border-2 border-green-500 bg-green-200 font-black"
|
|
504
|
+
variant='custom'
|
|
505
|
+
>
|
|
506
|
+
<Button onClick={doSomething}>A</Button>
|
|
507
|
+
<Button onClick={doSomething}>B</Button>
|
|
508
|
+
<Button onClick={doSomething}>C</Button>
|
|
509
|
+
</ButtonGroup>
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
use of custom class
|
|
513
|
+
|
|
514
|
+
```jsx
|
|
515
|
+
<ButtonGroup className='w-full' variant='custom'>
|
|
516
|
+
<Button
|
|
517
|
+
className='border-2 border-green-500 bg-green-200 font-black'
|
|
518
|
+
onClick={doSomething}
|
|
519
|
+
>A</Button>
|
|
520
|
+
<Button onClick={doSomething}>B</Button>
|
|
521
|
+
<Button onClick={doSomething}>C</Button>
|
|
522
|
+
</ButtonGroup>
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
### Dependencies
|
|
528
|
+
|
|
529
|
+
**_none_**
|
|
530
|
+
|
|
531
|
+
<!-- C A R D -------------------------------------------------------------------------------- -->
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
[Top of Page](#table-of-contents)
|
|
535
|
+
|
|
536
|
+
## Card
|
|
537
|
+
|
|
538
|
+
Cards contain content or information on a specific topic, often with a relevant image.
|
|
539
|
+
|
|
540
|
+
The **Card** component as built takes in various props (variant, variantStyle, imagePath, classNameImage, imageInset, alt, ariaLabel, and children), in addition to any other html attributes a normal html button would use, for example an **`aria-label`** tag.
|
|
541
|
+
|
|
542
|
+
A **`ref`** can also be created and assigned to the **Card** component, and the component will point the reference to the outer html DIV.
|
|
543
|
+
|
|
544
|
+
The **className** prop takes a list of alternate CSS classes the developer would like applied to the component. These are applied using the tailwind **`twMerge`** function, and will safely overwrite any conflicting classes ensuring proper styling.
|
|
545
|
+
|
|
546
|
+
Full list of props below
|
|
547
|
+
|
|
548
|
+
### Props
|
|
549
|
+
|
|
550
|
+
| Prop | Type | Optional | Default | Description |
|
|
551
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
552
|
+
| alt | string | No | | Alt tag to use inside the image displayed inside the Card component. |
|
|
553
|
+
| children | ReactNode | No | | Content to display in the Card aside from the image |
|
|
554
|
+
| ariaLabel | string | Yes | 'card component' | This is the aria-label applied to the parentDIV element in the Card component. |
|
|
555
|
+
| className | string | Yes | (1) below | Class names to style component |
|
|
556
|
+
| 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. |
|
|
557
|
+
| imageInset | string | Yes | | A boolean value indicating whether the image inside the card should be inset or not. See above for functional examples. |
|
|
558
|
+
| ...props | string | Yes | undefined | additional props that are not specifically defined in the component, i.e. aria-label |
|
|
559
|
+
| 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. |
|
|
560
|
+
| variantStyle | string | Yes | 'default' | Optoins are 'default' and 'outline' |
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
**(1) classnames for different variants**
|
|
564
|
+
|
|
565
|
+
- default --> **`flex flex-col w-64 max-w-64`**
|
|
566
|
+
- imageBottom --> **`flex flex-col-reverse w-64 mx-w-64`**
|
|
567
|
+
- imageLeft --> **`flex flex-row h-auto max-w-lg min-w-96`**
|
|
568
|
+
- imageRight --> **`flex flex-row-reverse h-auto max-w-lg min-w-96`**
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
### Example Usage
|
|
572
|
+
|
|
573
|
+
Basic example
|
|
574
|
+
|
|
575
|
+
```jsx
|
|
576
|
+
<Card
|
|
577
|
+
imagePath={imagePath}>
|
|
578
|
+
<h1 className="text-lg font-bold">Flu Season</h1>
|
|
579
|
+
<p>Flu season is approaching, and flu vaccines are
|
|
580
|
+
available now.</p>
|
|
581
|
+
</Card>
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
Using an alternate varint, custom css, etc.
|
|
585
|
+
|
|
586
|
+
```jsx
|
|
587
|
+
<Card variant='imageLeft'
|
|
588
|
+
imagePath={imagePath}
|
|
589
|
+
classNameImage="rounded-lg"
|
|
590
|
+
variantStyle="outline"
|
|
591
|
+
alt="Doctor wearing face mask"
|
|
592
|
+
imageInset>
|
|
593
|
+
<h1 className="text-lg font-bold">Flu Season</h1>
|
|
594
|
+
<p>Flu season is approaching, and flu vaccines are
|
|
595
|
+
available now.</p>
|
|
596
|
+
</Card>
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
### Dependencies
|
|
601
|
+
|
|
602
|
+
**_none_**
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
<!-- C H A R A C T E R C O U N T E R -------------------------------------------------------- -->
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
[Top of Page](#table-of-contents)
|
|
609
|
+
|
|
610
|
+
## CharacterCounter
|
|
611
|
+
|
|
612
|
+
The **CharacterCounter** component is one that you use to wrap an Input or TextArea component or element to inform a user of the number of characters they have typed. If the user goes over the specified limit the message style (further styling can be specified via the prop **classNameOverLimitMessage**) and message will change to inform the visitor of this.
|
|
613
|
+
|
|
614
|
+
The **CharacterCounter** component takes two required prop values, **children**, and **maxCharacters**, and informs the user of the number of characters they have typed or the number of characters they are over the limit for an Input or TextArea component.
|
|
615
|
+
|
|
616
|
+
The children prop will be an **input** or **textArea** element, wrapped by CharacterCounter, and is what CharacterCounter will monitor.
|
|
617
|
+
|
|
618
|
+
Full list of props below
|
|
619
|
+
|
|
620
|
+
### Props
|
|
621
|
+
|
|
622
|
+
| Prop | Type | Optional | Default | Description |
|
|
623
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
624
|
+
| children | ReactNode | No | | the child Input or TextArea component |
|
|
625
|
+
| 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. |
|
|
626
|
+
| className | string | Yes | (1) below | This is used to apply user supplied styling to the CharacterCounter div element. |
|
|
627
|
+
| classNameMessage | string | Yes | | CSS classes to apply to the message text prior to the user exceeding the specified limit |
|
|
628
|
+
| classNameOverLimitMessage | string | Yes | | CSS classes to apply to the message text after the user has exceeded the specified limit. |
|
|
629
|
+
| 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". |
|
|
630
|
+
| 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 default classNameOverLimitMessage). |
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
### Example Usage
|
|
634
|
+
|
|
635
|
+
Basic example
|
|
636
|
+
|
|
637
|
+
```jsx
|
|
638
|
+
<CharacterCounter
|
|
639
|
+
maxCharacters={15}>
|
|
640
|
+
<Input size={10} />
|
|
641
|
+
</CharacterCounter>
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
Using an altOverageMessageText and altRemainingMessageText
|
|
645
|
+
|
|
646
|
+
```jsx
|
|
647
|
+
<CharacterCounter
|
|
648
|
+
maxCharacters={15}
|
|
649
|
+
altOverageMessageText="CHARACTERS OVER THE LIMIT!"
|
|
650
|
+
altRemainingMessageText="characters remaining, use them wisely!">
|
|
651
|
+
<Input size={10} />
|
|
652
|
+
</CharacterCounter>
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
### Dependencies
|
|
656
|
+
|
|
657
|
+
**_none_**
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
[Top of Page](#table-of-contents)
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
<!-- C H E C K B O X -------------------------------------------------------- -->
|
|
664
|
+
|
|
665
|
+
[Top of Page](#table-of-contents)
|
|
666
|
+
|
|
667
|
+
## CheckBox
|
|
668
|
+
|
|
669
|
+
A **CheckBox** is a component that can be either selected or de-selected allowing the user to control a value or selection. A group of **CheckBox** components can be used together to let the user select or deselect a series of related values.
|
|
670
|
+
|
|
671
|
+
**CheckBoxGroup** is a component that allows CheckBoxes to be placed in a hierarchical order with each individual **CheckBox** placed at a different "level". This allows a user to visually see the relationship between various checkbox items, in addition to seeing the state at various levels when different selections are made.
|
|
672
|
+
|
|
673
|
+
Note the use of the **key** attribute in the above examples. Without this, toggling between the various **CheckBoxGroup** examples would potential cause errors as the components could be sharing state. If you are having inconsistencies with these components and you are using more than one, try specifying a unique key attribute value.
|
|
674
|
+
|
|
675
|
+
The **CheckBoxGroup** component can be optionally used with any number of **CheckBox** components to control indented relationships between various individual CheckBoxes. This enables parent CheckBoxes being set to 'indeterminate' state when its various children are both **checked** and **unchecked**.
|
|
676
|
+
|
|
677
|
+
**CheckBoxGroup** also takes three props that are directly passed down to **CheckBox**, allowing you to specify any of these values in one place instead of in each instance of **CheckBox**. These three props are all boolean values, described below. They are **`fill`**, **`icon`**, and **`marker`**.
|
|
678
|
+
|
|
679
|
+
Used by itself, **CheckBox** behaves as a normal checkbox component and can be used individually or in groups. It also takes the same attributes that a normal **`html input type="checkbox"`** would.
|
|
680
|
+
|
|
681
|
+
### Props for CheckBoxGroup
|
|
682
|
+
|
|
683
|
+
| Prop | Type | Optional | Default | Description |
|
|
684
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
685
|
+
| bridgePraent | boolean | Yes | {false} | When true, the lines that denote the relationships between parent CheckBoxes and their children are extended at the root level to match root level CheckBoxes to one another. In the above examples, compare 'Multi-Level' and 'bridgeParent' to see the differences. |
|
|
686
|
+
| fill | boolean | Yes | {false} | specifies using the **`fill`** variant or not. If used, the checkbox itself will have a darker solid background. |
|
|
687
|
+
| icon | boolean | Yes | {true} | When **`true`** (default value) this prop will utilize one of two UX created icons to represent a checked, indeterminate, and blank checkbox. When **marker** is true as well, a marker icon is used in place of the checked. |
|
|
688
|
+
| marker | boolean | Yes | {false} | When true this boolean will cause the normal checked checkbox to instead display an 'x' marker icon. |
|
|
689
|
+
| showBranch | boolean | Yes | {true} | When true this will cause the normal relationship lines between CheckBoxes to appear. If it is false, the indentation will still exist between various levels, but the lines will be absent. In the above examples, compare 'Multi-Level' and 'showBranch false' to see the differences. |
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
### Props for CheckBox
|
|
693
|
+
|
|
694
|
+
| Prop | Type | Optional | Default | Description |
|
|
695
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
696
|
+
| ariaLabel | string | Yes | 'CheckBox Component' | The **aria-label** to assign to this CheckBox |
|
|
697
|
+
| className | string | Yes | **`'flex items-center'`** | alternate css classes to add/change styling of the **div** that wraps the **input** element. |
|
|
698
|
+
| classNameInput | string | Yes | **`''`** | alternate css classes to add/change styling of the **input** html element. |
|
|
699
|
+
| classNameSvg | string | Yes | **`'stroke-[#a1a6a8] h-full border'`** | This prop is applied to the lines that are drawn inside the SVGs that denote the relationships between separate **CheckBox** components. The easiest change to effect is the color of the lines by applying a different custom stroke value. |
|
|
700
|
+
| fill | boolean | Yes | {false} | specifies using the **fill** variant or not. If used, the checkbox itself will have a darker solid background. |
|
|
701
|
+
| icon | boolean | Yes | {true} | When true (default value) this prop will utilize one of two UX created icons to represent a checked, indeterminate, and blank checkbox. When **marker** is true as well, a marker icon is used in place of the checked. |
|
|
702
|
+
| marker | boolean | Yes | {false} | When true this boolean will cause the normal checked checkbox to instead display an 'x' marker icon. |
|
|
703
|
+
| ...props | string | Yes | undefined | takes additional props that are not specifically defined in the component, i.e. aria-label |
|
|
704
|
+
| ref | string | Yes | undefined | ref is exposed as a prop, and can be assigned and used on this component as normal |
|
|
705
|
+
| value | string | Yes | 'on' | The value passed along if this CheckBox is checked. If checked, both the **name** and the **value** will be submitted as a name/value pair. |
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
### Example Usage
|
|
711
|
+
|
|
712
|
+
Basic example
|
|
713
|
+
|
|
714
|
+
```jsx
|
|
715
|
+
<CheckBoxGroup key='1'>
|
|
716
|
+
<CheckBox level={0} name='g1'>Group 1</CheckBox>
|
|
717
|
+
<CheckBox level={1} name='g1i1'>group 1, item 1</CheckBox>
|
|
718
|
+
<CheckBox level={1} name='g1i2'>group 1, item 2</CheckBox>
|
|
719
|
+
<CheckBox level={2} name='h1i2i1'>group 1, item 2, item 1</CheckBox>
|
|
720
|
+
<CheckBox level={2} name='g1i2i2'>group 1, item 2, item 2</CheckBox>
|
|
721
|
+
<CheckBox level={1} name='h1i3'>group 1, item 3</CheckBox>
|
|
722
|
+
<CheckBox level={0} name='g2'>Group 2</CheckBox>
|
|
723
|
+
<CheckBox level={1} name='g2i1'>group 2, item 1</CheckBox>
|
|
724
|
+
<CheckBox level={1} name='g2i2'>group 2, item 2</CheckBox>
|
|
725
|
+
<CheckBox level={2} name='h2i2i1'>group 2, item 2, item 1</CheckBox>
|
|
726
|
+
</CheckBoxGroup>
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
Using markers via the marker prop
|
|
730
|
+
|
|
731
|
+
```jsx
|
|
732
|
+
<CheckBoxGroup key='1' marker>
|
|
733
|
+
<CheckBox level={0} name='g1'>Group 1</CheckBox>
|
|
734
|
+
<CheckBox level={1} name='g1i1'>group 1, item 1</CheckBox>
|
|
735
|
+
<CheckBox level={1} name='g1i2'>group 1, item 2</CheckBox>
|
|
736
|
+
<CheckBox level={2} name='h1i2i1'>group 1, item 2, item 1</CheckBox>
|
|
737
|
+
<CheckBox level={2} name='g1i2i2'>group 1, item 2, item 2</CheckBox>
|
|
738
|
+
<CheckBox level={1} name='h1i3'>group 1, item 3</CheckBox>
|
|
739
|
+
<CheckBox level={0} name='g2'>Group 2</CheckBox>
|
|
740
|
+
<CheckBox level={1} name='g2i1'>group 2, item 1</CheckBox>
|
|
741
|
+
<CheckBox level={1} name='g2i2'>group 2, item 2</CheckBox>
|
|
742
|
+
<CheckBox level={2} name='h2i2i1'>group 2, item 2, item 1</CheckBox>
|
|
743
|
+
</CheckBoxGroup>
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### Dependencies
|
|
747
|
+
|
|
748
|
+
**_none_**
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
[Top of Page](#table-of-contents)
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
<!-- D A T E P I C K E R ------------------------------------------------------------------------------- -->
|
|
755
|
+
|
|
756
|
+
## DatePicker
|
|
757
|
+
|
|
758
|
+
DatePicker is an input that can be set typing or clicking on the day of the week displayed.
|
|
759
|
+
|
|
760
|
+
The DatePicker component as built takes in various props (id, label, value, onChange)
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
### Props
|
|
764
|
+
|
|
765
|
+
| Prop | Type | Optional | Default | Description |
|
|
766
|
+
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
767
|
+
| id | string | No | | An ID to differentiate/target the component. |
|
|
768
|
+
| label | string | No | | A label for the component |
|
|
769
|
+
| onChange | (date: string) => void \| No | undefined | Handler function to be fed to the component, executed when the date changes |
|
|
770
|
+
| value | string | Yes | | The date the component is currently set to, if not supplied, it defaults to the current date. |
|
|
771
|
+
|
|
772
|
+
### Example Usage
|
|
773
|
+
|
|
774
|
+
Default Variant
|
|
775
|
+
|
|
776
|
+
```jsx
|
|
777
|
+
import dayjs from "dayjs";
|
|
778
|
+
const [displayDate, setDisplayDate] = useState('');
|
|
779
|
+
|
|
780
|
+
<DatePicker id={""} label={""}
|
|
781
|
+
value={dayjs().startOf("day").format("MM-DD-YYYY")}
|
|
782
|
+
onChange={setDisplayDate}/>
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
### Dependencies
|
|
787
|
+
|
|
788
|
+
**dayjs**
|
|
789
|
+
|
|
790
|
+
[Top of Page](#table-of-contents)
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
<!-- I N P U T ------------------------------------------------------------------------------ -->
|
|
795
|
+
|
|
796
|
+
## Input
|
|
797
|
+
|
|
798
|
+
The **input** component as built takes seven optional props (className, classNameLabel, required, label, labelBaseColor, labelInputcolor, and textShadow), in addition to any other html attributes a normal html form input would use, for example an aria tag.
|
|
799
|
+
|
|
800
|
+
A reference can also be created and passed to the input component, and the component will point the reference to the input.
|
|
801
|
+
|
|
802
|
+
### Props
|
|
803
|
+
|
|
804
|
+
| Prop | Type | Optional | Default | Description |
|
|
805
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
806
|
+
| className | string | Yes | **(1) below** | pass any css class names to add/change styling
|
|
807
|
+
| classNameLabel | string | Yes | **(2) below** | pass any css class names to add/change styling for the input label |
|
|
808
|
+
| classNameRequired | string | Yes | | |
|
|
809
|
+
| insetLabel | boolean | Yes | false | indicates whether the label is inset into the border or resides above the input component |
|
|
810
|
+
| label | string | Yes | '' | string value of label, blank for no label |
|
|
811
|
+
| 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, color is a string hex value, i.e. **#fefefe** |
|
|
812
|
+
| error | boolean | Yes | false | boolean prop indicating if the current input is in an error state. if true, applies visual error formatting to the input component. |
|
|
813
|
+
| mask | string | Yes | undefined | a text string used to define an input mask. using the provided mask, input will format the users input into the formatted mask. In the case that the user adds invalid input, it is ignored. Non letter/number characters are also automatically entered if a valid following character type is added instead. # represents an individual number character, and @ represents a letter. All other values are themselves. |
|
|
814
|
+
| placeHolder | string | Yes | Yes | | sets the placeholder text inside the input element |
|
|
815
|
+
| ...props | string | Yes | | takes additional props that are not specifically defined in the component, i.e. aria-label |
|
|
816
|
+
| required | boolean | Yes | | if specified, a red asterisk is prepended to the label, and the required attribute is set to true |
|
|
817
|
+
| textShadow | boolean | Yes | false | indicates whether a drop shadow should be applied or not to the label text, and if used, utilizes the **labelBaseColor** above. |
|
|
818
|
+
| variant | string | Yes | | The predefined variant of Badge to display. Current options are 'default', 'MedCard', 'Outline', and 'nonHover' |
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
**(1)** Default classes are different for each variant, but the base classes are **`h-10 px-4 py-2 arial rounded-sm border-2 border-[#c6c6c6] p-1 ps-2 mx-2 bg-white hover:outline-[#c6c6c6] focus:outline-[#0256ab] active:outline-[#0256ab]`**
|
|
822
|
+
|
|
823
|
+
- **default**
|
|
824
|
+
- base classes - **`hover:bg-dha-mc-pale-blue text-black hover:dha-mc-primary-text hover:border-dha-mc-secondary-border disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive disabled:border-dha-mc-secondary-border disabled:border-2 w-[90vw] lg:max-w-[25em]`**
|
|
825
|
+
- label classes - **`ms-2.5 text-base`**
|
|
826
|
+
- insetLabelClasses - **`absolute ms-5 -translate-y-1/2 px-2 text-[0.8em] w-auto h-auto`**
|
|
827
|
+
- **outline**
|
|
828
|
+
- base classes - **`border-dha-mc-true-blue bg-white border-2 text-dha-mc-true-blue disabled:border-dha-mc-secondary-border disabled:text-dha-mc-checkbox-inactive w-[35vw] min-w-min sm:max-w-[15em]`**
|
|
829
|
+
- label classes - **`ms-2.5 text-base`**
|
|
830
|
+
- insetLabelClasses - **`absolute ms-5 -translate-y-1/2 px-2 text-[0.8em] w-auto h-auto`**
|
|
831
|
+
- **nonHover**
|
|
832
|
+
- base classes - **`text-black disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive disabled:border-dha-mc-secondary-border disabled:border-2 w-[90vw] lg:max-w-[25em]`**
|
|
833
|
+
- label classes - **`ms-2.5 text-base`**
|
|
834
|
+
- insetLabelClasses - **`absolute ms-5 -translate-y-1/2 px-2 text-[0.8em] w-auto h-auto`**
|
|
835
|
+
|
|
836
|
+
**(2)** Default classes for the label are **`absolute ms-5 -translate-y-1/2 px-2 text-[0.8em] w-auto h-auto`**
|
|
837
|
+
|
|
838
|
+
**(3)** Default classes for the required asterisk **`absolute text-red-500 ms-0.5 -mt-1`**
|
|
839
|
+
|
|
840
|
+
### Additional Properties & Attributes
|
|
841
|
+
|
|
842
|
+
This component as mentioned also takes any other property or attribute that a normnal input form field would take, including the **required** property. Setting this property to true will not only requires this input field to have a value for form completion, but also adds an asterisk to the beginning of the label.
|
|
843
|
+
|
|
844
|
+
### Example Usage
|
|
845
|
+
|
|
846
|
+
#### Simple version
|
|
847
|
+
|
|
848
|
+
```jsx
|
|
849
|
+
<Input
|
|
850
|
+
label="Default Input"
|
|
851
|
+
placeholder="placeholder text here"
|
|
852
|
+
labelBaseColor="#f5f5f5"
|
|
853
|
+
insetLabel={true}
|
|
854
|
+
/>
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
#### More complex
|
|
858
|
+
|
|
859
|
+
```jsx
|
|
860
|
+
<Input
|
|
861
|
+
label="Default Input"
|
|
862
|
+
placeholder="custom classnames"
|
|
863
|
+
className="rounded-lg border-[#0256ab] bg-[#caecf5]"
|
|
864
|
+
labelBaseColor="#f5f5f5"
|
|
865
|
+
labelInputColor="#caecf5"
|
|
866
|
+
classNameLabel="text-[#0256ab]"
|
|
867
|
+
insetLabel={true}
|
|
868
|
+
required
|
|
869
|
+
textShadow={true}
|
|
870
|
+
/>
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
#### Mask example
|
|
874
|
+
|
|
875
|
+
```jsx
|
|
876
|
+
<Input
|
|
877
|
+
label='Phone Number'
|
|
878
|
+
placeholder='(###) ###-####'
|
|
879
|
+
mask='(###) ###-####'
|
|
880
|
+
error={errorState}
|
|
881
|
+
disabled={disabledState}
|
|
882
|
+
className="mx-2 max-w-[15em] md:max-w-[20em] lg:max-w-[25em]"
|
|
883
|
+
/>
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
### Dependencies
|
|
887
|
+
|
|
888
|
+
**_none_**
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
[Top of Page](#table-of-contents)
|
|
892
|
+
|
|
893
|
+
<!-- L I S T ----------------------------------------------------------------------------------- -->
|
|
894
|
+
|
|
895
|
+
## List
|
|
896
|
+
|
|
897
|
+
The **List** component is a component that creates a list of items, ordered or unordered based on the information the developer feeds to the component. Like other components, it takes in various props for configuration. Possible props are items, children, className, withDividers, classNameDividerColor, classNameItem, variant, isDecimal and isDisc. These props are all optional and each will significantly change how the component looks. If the items prop is used, the component takes in an array of type ListItemProps, if the children prop is used, any react component can be fed to the List directly as a child. With respect to CSS, specified classnames are combined using **`twMerge`**/**`cn`**, so prior values are reliably overwritten.
|
|
898
|
+
|
|
899
|
+
### Props
|
|
900
|
+
|
|
901
|
+
| Prop | Type | Optional | Default | Description |
|
|
902
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
903
|
+
| items | ListItemProps[] | Yes | undefined | takes an array of objects of type ListItemProps, anything can be fed to the children prop of the objects in the array |
|
|
904
|
+
| header | string | Yes | undefined | takes in a string of text to be displayed above the list of items |
|
|
905
|
+
| children | React.ReactNode | Yes | undefined | this allows the component to receive any number of react components as children |
|
|
906
|
+
| className | string | Yes | undefined | takes additional classnames to add/change styling |
|
|
907
|
+
| withDividers | boolean | Yes | false | if true, this prop will display a divider to separate each item within the list |
|
|
908
|
+
| classNameDividerColor | string | Yes | undefined | this prop is used to change the color of dividers when used, for example 'red-400' |
|
|
909
|
+
| classNameItem | string | Yes | undefined | takes additional classnames to add/change styling of the items within the list |
|
|
910
|
+
| 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 |
|
|
911
|
+
| isDisc | boolean | Yes | false | if true, this prob will change the list to be unordered, placing bullet points next to each item |
|
|
912
|
+
| isAlphabetical | boolean | false | if true, this prop will change the list indicators to be alphabetical, placing a letter next to each item starting with 'a'. |
|
|
913
|
+
| isRomanNumeral | boolean | false | if true, this prop will change the list indicators to be roman numerals, placing a numeral next to each item starting with 'i'. **note:** roman numbers are currently only supported up to the decimal value 12. |
|
|
914
|
+
| isInline | boolean | false | if true, this prop will change the list to be inline, placing each item next to each other horizontally instead of stacking them vertically. |
|
|
915
|
+
|
|
916
|
+
### Example Usage
|
|
917
|
+
|
|
918
|
+
Usage can be viewed inside the **sdk component demo app**, and examples of array and children implementations are shown below.
|
|
919
|
+
|
|
920
|
+
#### Array fed to decimal list with dividers:
|
|
921
|
+
|
|
922
|
+
```jsx
|
|
923
|
+
listItems:[{
|
|
924
|
+
children: 'asdf',
|
|
925
|
+
}, {
|
|
926
|
+
children: 'asdf2'
|
|
927
|
+
}, {
|
|
928
|
+
children: 'asdf3'
|
|
929
|
+
}, {
|
|
930
|
+
children: 'asdf4'
|
|
931
|
+
}, {
|
|
932
|
+
children: 'asdf5'
|
|
933
|
+
}
|
|
934
|
+
]
|
|
935
|
+
<List items={listItems} isDecimal={true} withDividers={true}
|
|
936
|
+
/>
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
#### Children fed to disc list with dividers and specified divider color:
|
|
940
|
+
|
|
941
|
+
```jsx
|
|
942
|
+
<List isDecimal={true} withDividers={true} dividerColorClass='red-400'>
|
|
943
|
+
<ListItem>
|
|
944
|
+
<img src='src/assets/img/first-aid-kit.svg' alt='first aid kit' className='max-h-[2em] max-w-[2em] pr-1 inline'></img>
|
|
945
|
+
<p className='inline'>Hello</p>
|
|
946
|
+
</ListItem>
|
|
947
|
+
<ListItem>
|
|
948
|
+
<img src='src/assets/img/first-aid-kit.svg' alt='first aid kit' className='max-h-[2em] max-w-[2em] pr-1 inline'></img>
|
|
949
|
+
<p className='inline'>this</p>
|
|
950
|
+
</ListItem>
|
|
951
|
+
<ListItem>
|
|
952
|
+
<img src='src/assets/img/first-aid-kit.svg' alt='first aid kit' className='max-h-[2em] max-w-[2em] pr-1 inline'></img>
|
|
953
|
+
<p className='inline'>is an</p>
|
|
954
|
+
</ListItem>
|
|
955
|
+
<ListItem>
|
|
956
|
+
<img src='src/assets/img/first-aid-kit.svg' alt='first aid kit' className='max-h-[2em] max-w-[2em] pr-1 inline'></img>
|
|
957
|
+
<p className='inline'>example with icons</p>
|
|
958
|
+
</ListItem>
|
|
959
|
+
</List>
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
#### Roman Numeral example
|
|
964
|
+
|
|
965
|
+
```jsx
|
|
966
|
+
<List isRomanNumeral header="List with roman numeral indicators">
|
|
967
|
+
<ListItem>
|
|
968
|
+
<img
|
|
969
|
+
src='/mobile_apps/sdk-component-demo/src/assets/first-aid-kit.svg'
|
|
970
|
+
alt='first aid kit' className='max-h-[2em] max-w-[2em] pr-1 pb-1 inline'
|
|
971
|
+
/>
|
|
972
|
+
<p className='inline'>icon</p>
|
|
973
|
+
</ListItem>
|
|
974
|
+
<ListItem>
|
|
975
|
+
<img
|
|
976
|
+
src='/mobile_apps/sdk-component-demo/src/assets/heartbeat.svg'
|
|
977
|
+
alt='first aid kit' className='max-h-[2em] max-w-[2em] pr-1 pb-1 inline'
|
|
978
|
+
/>
|
|
979
|
+
<p className='inline'>icon</p>
|
|
980
|
+
</ListItem>
|
|
981
|
+
<ListItem>
|
|
982
|
+
<img
|
|
983
|
+
src='/mobile_apps/sdk-component-demo/src/assets/pill.svg'
|
|
984
|
+
alt='first aid kit' className='max-h-[2em] max-w-[2em] pr-1 pb-1 inline'
|
|
985
|
+
/>
|
|
986
|
+
<p className='inline'>icon</p>
|
|
987
|
+
</ListItem>
|
|
988
|
+
<ListItem>
|
|
989
|
+
<img
|
|
990
|
+
src='/mobile_apps/sdk-component-demo/src/assets/prescription.svg'
|
|
991
|
+
alt='first aid kit' className='max-h-[2em] max-w-[2em] pr-1 pb-1 inline'
|
|
992
|
+
/>
|
|
993
|
+
<p className='inline'>icon</p>
|
|
994
|
+
</ListItem>
|
|
995
|
+
</List>
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
<!-- M O D A L --------------------------------------------------------------------------- -->
|
|
999
|
+
|
|
1000
|
+
[Top of Page](#table-of-contents)
|
|
1001
|
+
|
|
1002
|
+
## Modal
|
|
1003
|
+
|
|
1004
|
+
The **Modal** component is intended to be a re-usable component that developers can include in an app that provides alert dialog functionality to users.
|
|
1005
|
+
|
|
1006
|
+
The Modal component takes four required props, **isOpen**, **onClose**, **title**, and **child** content.
|
|
1007
|
+
|
|
1008
|
+
Optional props are **className**, **clickOutsideCloses**, **displayClosingX**, **closeButtonText**,**continueButton**, **continueButtonText**, and **continueButtonHandler**.
|
|
1009
|
+
|
|
1010
|
+
As with the Button component, this component can also take additional html attributes that when included are passed to the parent div.
|
|
1011
|
+
|
|
1012
|
+
This div is also styled using the tailwind **`twMerge()`** utility, and is used to apply custom css classes via the className prop.
|
|
1013
|
+
|
|
1014
|
+
Full list of props below
|
|
1015
|
+
|
|
1016
|
+
### Props
|
|
1017
|
+
|
|
1018
|
+
| Prop | Type | Optional | Default | Description |
|
|
1019
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1020
|
+
| children | ReactNode | No | | This prop takes children content, i.e. html and content that becomes the body of the Modal. |
|
|
1021
|
+
| isOpen | boolean | No | | indicates whether the Modal is displayed or not. This value also controls the overflow: hidden css property, as well as enabling/disabling keyboard event listeners for accessibility purposes. |
|
|
1022
|
+
| onClose | () => void() | No | | This is the close handler for the Modal component. |
|
|
1023
|
+
| title | string | No | | This is the title to display in the Modal component. |
|
|
1024
|
+
| blurLevel | 'sm', 'md', 'lg', 'xl', '2xl', '3xl' | Yes | undefined | sets backdrop blur behind the modal |
|
|
1025
|
+
| className | string | Yes | **see below** | Alternate CSS classnames to apply to the Modal component. twMerge is used to apply these classes, so they reliably overwrite existing styles. |
|
|
1026
|
+
| clickOutsideCloses | boolean | Yes | false | When true, any mouse click outside of the Modal will close the Modal component. |
|
|
1027
|
+
| closeButton | boolean | Yes | true | if true, a close button is presented in the modal |
|
|
1028
|
+
| closeButtonText | string | Yes | | The string value to display in the Close button |
|
|
1029
|
+
| displayClosingX | boolean | Yes | | When true, an 'x' icon is displayed in the upper right of the Modal component that when clicked will close the component. |
|
|
1030
|
+
| continueButton | boolean | Yes | | When true, a 'Continue' button is displayed in the Modal along with a 'Close' button |
|
|
1031
|
+
| continueButtonText | string | Yes | | The string value to display in the Continue button |
|
|
1032
|
+
| continueButtonHandler | () => void | Yes | | The function handler to execute when the Continue button is clicked. |
|
|
1033
|
+
| variant | string | Yes | 'default' - **see below** | indicates the modal variant classes to apply. |
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
#### Default classes per Variant
|
|
1037
|
+
|
|
1038
|
+
- default: **`bg-white rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-hidden`**
|
|
1039
|
+
- darker: **`bg-slate-600 rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-hidden text-slate-200`**
|
|
1040
|
+
- dark: **`bg-zinc-800 rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-hidden text-slate-200`**
|
|
1041
|
+
|
|
1042
|
+
### Example Usage
|
|
1043
|
+
|
|
1044
|
+
Basic Modal
|
|
1045
|
+
|
|
1046
|
+
```jsx
|
|
1047
|
+
<Modal
|
|
1048
|
+
isOpen={isOpen}
|
|
1049
|
+
onClose={() => setIsOpen(false)}
|
|
1050
|
+
title="Test Modal"
|
|
1051
|
+
clickOutsideCloses
|
|
1052
|
+
>
|
|
1053
|
+
<p>This is a Modal dialog that can be used for many varying
|
|
1054
|
+
purposes, from informational messages to taking user input,
|
|
1055
|
+
ideal for required quick tasks on a page.
|
|
1056
|
+
</p>
|
|
1057
|
+
</Modal>
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
### Dependencies
|
|
1061
|
+
|
|
1062
|
+
**_none_**
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
[Top of Page](#table-of-contents)
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
<!-- P I L L --------------------------------------------------------------------------- -->
|
|
1069
|
+
|
|
1070
|
+
## Pill
|
|
1071
|
+
|
|
1072
|
+
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.
|
|
1073
|
+
|
|
1074
|
+
Optional props are **className**, **iconLeft**, **iconLeftSelected**, **iconRight**, **iconRightSelected**, **onClick**, and **selected**.
|
|
1075
|
+
|
|
1076
|
+
Full list of props below
|
|
1077
|
+
|
|
1078
|
+
### Props
|
|
1079
|
+
|
|
1080
|
+
| Prop | Type | Optional | Default | Description |
|
|
1081
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1082
|
+
| children | ReactNode | No | | The primary content to display in this Pill, i.e. the word 'Pill' above.|
|
|
1083
|
+
| 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. |
|
|
1084
|
+
| iconLeft | ReactNode | Yes | | This prop takes an image to display as its left icon. It takes this value as a ReactNode.|
|
|
1085
|
+
| 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.|
|
|
1086
|
+
| iconRight | ReactNode | Yes | | This prop takes an image to display as its right icon. It takes this value as a ReactNode.|
|
|
1087
|
+
| 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|
|
|
1088
|
+
| onClick | () => void() | Yes | | When included this serves as the **`onClick`** handler for the **`Pill`** component. |
|
|
1089
|
+
| 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. |
|
|
1090
|
+
|
|
1091
|
+
1. Default classNames
|
|
1092
|
+
|
|
1093
|
+
- **`relative inline-flex items-center justify-center whitespace-nowrap rounded-3xl transition-colors focus-visible:outline-hidden 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`**
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
### Example Usage
|
|
1097
|
+
|
|
1098
|
+
Basic Pill
|
|
1099
|
+
|
|
1100
|
+
```jsx
|
|
1101
|
+
<Pill
|
|
1102
|
+
iconLeft={<img src={frame} alt='left header icon' />}
|
|
1103
|
+
iconRight={<img src={frame} alt='right header icon' />}
|
|
1104
|
+
>
|
|
1105
|
+
Pill
|
|
1106
|
+
</Pill>
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
### Dependencies
|
|
1111
|
+
|
|
1112
|
+
**_none_**
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
[Top of Page](#table-of-contents)
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
<!-- S E C T I O N H E A D E R ------------------------------------------------------- -->
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
## SectionHeader
|
|
1122
|
+
|
|
1123
|
+
The **`SectionHeader`** component displays a **`children`** prop as a heading, and uses various additional props to customize the remaining portion of the Header.
|
|
1124
|
+
|
|
1125
|
+
Various examples and combinations of this components props in use can be seen via code examples below.
|
|
1126
|
+
|
|
1127
|
+
Full list of props below
|
|
1128
|
+
|
|
1129
|
+
### Props
|
|
1130
|
+
|
|
1131
|
+
| Prop | Type | Optional | Default | Description |
|
|
1132
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1133
|
+
| children | ReactNode | No | | The primary content to display in this SectionHeader, i.e.the word 'Prologue' above. |
|
|
1134
|
+
| 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. |
|
|
1135
|
+
| 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. |
|
|
1136
|
+
| 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. |
|
|
1137
|
+
| 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. |
|
|
1138
|
+
| button | boolean | Yes | false | Boolean value specifying whether to display a button or not on the right side of the SectionHeader. |
|
|
1139
|
+
| buttonOnClick | () => void | Yes | undefined | An onClick handler for the optional button. |
|
|
1140
|
+
| buttonContent | string | Yes | 'Click Me!' | The text content to display in the Button component if enabled |
|
|
1141
|
+
| iconLeft | ReactNode | Yes | | This prop takes an image to display as its left icon. It takes this value as a ReactNode, see examples above. |
|
|
1142
|
+
| iconRight | ReactNode | Yes | | This prop takes an image to display as its right icon. It takes this value as a ReactNode, see examples above. |
|
|
1143
|
+
| 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. |
|
|
1144
|
+
| 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. |
|
|
1145
|
+
| 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'. |
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
1. Default classNames
|
|
1149
|
+
|
|
1150
|
+
- type 'page' - **`pt-4 pb-2 flex pl-6 pr-2 justify-start items-center gap-4 inline-flex w-full`**
|
|
1151
|
+
|
|
1152
|
+
- type 'section'/'subsection' - **`py-2 flex pl-6 pr-2 justify-start items-center gap-4 inline-flex w-full`**
|
|
1153
|
+
|
|
1154
|
+
2. children classNames
|
|
1155
|
+
|
|
1156
|
+
- **`self-stretch text-[40px] font-normal font-["Arial"] leading-[48px] pb-1`**
|
|
1157
|
+
|
|
1158
|
+
3. subHeader classNames
|
|
1159
|
+
|
|
1160
|
+
- **`text-xl font-normal font-["Arial"] leading-[30px]`**
|
|
1161
|
+
|
|
1162
|
+
### Example Usage
|
|
1163
|
+
|
|
1164
|
+
```jsx
|
|
1165
|
+
<SectionHeader
|
|
1166
|
+
iconLeft={<img src={frameLight} alt='left header icon' className="size-10" />}
|
|
1167
|
+
iconRight={<img src={importantLight} alt='right header icon' className='size-10' />}
|
|
1168
|
+
subHeader="1st things first though"
|
|
1169
|
+
underline
|
|
1170
|
+
fill
|
|
1171
|
+
button
|
|
1172
|
+
buttonContent="Alert"
|
|
1173
|
+
buttonOnClick={() => alert('Clicked!')}
|
|
1174
|
+
>
|
|
1175
|
+
Prologue
|
|
1176
|
+
</SectionHeader>
|
|
1177
|
+
```
|
|
1178
|
+
|
|
1179
|
+
### Dependencies
|
|
1180
|
+
|
|
1181
|
+
**_none_**
|
|
1182
|
+
|
|
1183
|
+
[Top of Page](#table-of-contents)
|
|
1184
|
+
|
|
1185
|
+
<!-- S E L E C T ---------------------------------------------------------------------------- -->
|
|
1186
|
+
|
|
1187
|
+
## Select
|
|
1188
|
+
|
|
1189
|
+
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.
|
|
1190
|
+
|
|
1191
|
+
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.
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
Full list of props below
|
|
1195
|
+
|
|
1196
|
+
### Props
|
|
1197
|
+
|
|
1198
|
+
| Prop | Type | Optional | Default | Description |
|
|
1199
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1200
|
+
| className | string | Yes | (1) below | a group of alternate css classes that can be specified by the developer for use in the input element. |
|
|
1201
|
+
| 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. |
|
|
1202
|
+
| disabled | boolean | Yes | undefined | if true the Select component is placed in a disabled state |
|
|
1203
|
+
| error | boolean | Yes | false | if true a red border is applied to the outside of the select component indicating an error state. |
|
|
1204
|
+
| label | string | Yes | undefined | text used as the label for the input, i.e. 'Border Color' above |
|
|
1205
|
+
| options | {{name: ..., value:...}, ...} | Yes | undefined | options is an array of objects, each with a **name** and an optional **value** property. If value is not present, name is used in the handler function. |
|
|
1206
|
+
| optionsLabel | string | Yes | undefined | appears as the label in the Select component, i.e. 'Choose a Color' above. Note, this is not the label above the component. |
|
|
1207
|
+
| setSelectedOption | (string) => void | Yes | undefined | calls the function passed in as **`setSelectedOption`** with the selected **value** if present, otherwise with **name** |
|
|
1208
|
+
| variant | string | Yes | undefined | The predefined variant of Select to display. Current options are 'default', 'MedCard', 'Outline', and 'nonHover' |
|
|
1209
|
+
| width | string | Yes | | This prop is intended to like **`className`** take in css class name values. These are intended though to only take class names relevant to the component width, as they will be applied to both the **button** and the **drop down** elements of the **`Select`** component. For instance, the **`width`** prop is a good way to ensure that the button and drop down are of the same width. Note the default classes below, i.e. widths specified on various break points. |
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
1. Base CSS Classes
|
|
1213
|
+
|
|
1214
|
+
- **`outline-hidden outline-offset-0 flex justify-between items-center w-[292px] md:w-[343px] lg:w-[600px] h-14 border focus:outline-4 focus:mb-2 focus:outline-[#fa89f1] shadow-sm pl-4 pr-2 py-2 bg-white text-base md:text-lg font-medium text-gray-700 hover:bg-gray-50 border-[#b3b3b3] h-12 mt-1 font-["Arial"] `**
|
|
1215
|
+
|
|
1216
|
+
Separate Variant Styles
|
|
1217
|
+
|
|
1218
|
+
- default:
|
|
1219
|
+
- **`hover:bg-gray-200 text-black hover:border-gray-400 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive disabled:border-dha-mc-secondary-border disabled:border-2`**
|
|
1220
|
+
- fill:
|
|
1221
|
+
- **`hover:bg-[#0c2c8e] text-white bg-[#092068] hover:border-gray-400 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive disabled:border-dha-mc-secondary-border disabled:border-2 py-3`**
|
|
1222
|
+
- outline:
|
|
1223
|
+
- **`bg-white text-[#808080] disabled:border-dha-mc-secondary-border disabled:text-dha-mc-checkbox-inactive`**
|
|
1224
|
+
|
|
1225
|
+
### Example Usage
|
|
1226
|
+
|
|
1227
|
+
```jsx
|
|
1228
|
+
<Select
|
|
1229
|
+
label='Border Color'
|
|
1230
|
+
optionsLabel='Choose a Color'
|
|
1231
|
+
variant='MedCard'
|
|
1232
|
+
options={[
|
|
1233
|
+
{name: 'gray', value: 'border-gray-500'},
|
|
1234
|
+
{name: 'Blue', value: 'border-blue-500'}
|
|
1235
|
+
]}
|
|
1236
|
+
setSelectedOption={setSelectedBorder} />
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
### Dependencies
|
|
1241
|
+
|
|
1242
|
+
**_none_**
|
|
1243
|
+
|
|
1244
|
+
[Top of Page](#table-of-contents)
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
<!-- S H I E L D ----------------------------------------------------------------------------------- -->
|
|
1248
|
+
|
|
1249
|
+
## Shield
|
|
1250
|
+
|
|
1251
|
+
The **shield** component takes three required props, **variant**, **subVariant**, and **child** content.
|
|
1252
|
+
|
|
1253
|
+
Optional props are **className**, **classNameSvg**, **imagePath**, **imageAlt**, and **classNameImage**.
|
|
1254
|
+
|
|
1255
|
+
As with the button component, this component also takes additional html attributes that when included are passed to the parent div.
|
|
1256
|
+
|
|
1257
|
+
This div is also styled using the tailwind **`twMerge()`** utility, so custom classes can be added via the classNames prop as well.
|
|
1258
|
+
|
|
1259
|
+
### Props
|
|
1260
|
+
|
|
1261
|
+
| Prop | Type | Optional | Default | Description |
|
|
1262
|
+
| ----------- | -------- | -------- | -------- | -------------------------------------------- |
|
|
1263
|
+
| children | ReactNode | No | | html and content that becomes the body of the Badge. |
|
|
1264
|
+
| subVariant | string | No | See **(1)** below | The predefined variant of Badge to display. |
|
|
1265
|
+
| variant | string | No | See **(1)** below | The predefined variant of Badge to display. UX designed variants are **go**, **hazard**, and **warning** |
|
|
1266
|
+
| 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 |
|
|
1267
|
+
| imageAlt | string | See Comment | undefined | When an imagePath is specified, please specify an imageAlt that can be used for accessibility purposes. |
|
|
1268
|
+
| classNameImage | string | Yes | undefined | Alternate CSS classes that are applied to the image for variant type media. |
|
|
1269
|
+
| imagePath | string | See Comment | undefined | When variant is of type "media", an imagePath has to be specified that the component can load and display. |
|
|
1270
|
+
| 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. |
|
|
1271
|
+
|
|
1272
|
+
1. Variants --> subVariants
|
|
1273
|
+
- default --> default, gray, red, yellow, green, blue
|
|
1274
|
+
- warning **UX Variant** --> half, full
|
|
1275
|
+
- hazard **UX Variant** --> half, full,
|
|
1276
|
+
- go **UX Variant** --> half, full
|
|
1277
|
+
- icon --> default, gray, red, yellow, green, blue
|
|
1278
|
+
- media --> default, gray, green
|
|
1279
|
+
|
|
1280
|
+
2. classNames per variant default
|
|
1281
|
+
- default --> **`mx-2 inline-flex items-center rounded-md bg-gray-500/10 px-2 py-1 text-xs font-medium text-gray-700 ring-1 ring-inset ring-gray-400/20`**
|
|
1282
|
+
- icon --> **`inline-flex items-center gap-x-1.5 rounded-full bg-gray-500 px-2 py-1 text-xs font-medium text-gray-700`**
|
|
1283
|
+
- media --> **`w-[250px] mx-2 border-l-8 border-black grid grid-cols-6 rounded-md bg-gray-400/10 pr-2 text-xs font-medium text-gray-400 ring-1 ring-inset ring-gray-400/20 overflow-hidden`**
|
|
1284
|
+
|
|
1285
|
+
### Example Usage
|
|
1286
|
+
|
|
1287
|
+
Default Variant
|
|
1288
|
+
|
|
1289
|
+
```jsx
|
|
1290
|
+
<Shield ref={ref}
|
|
1291
|
+
variant="default"
|
|
1292
|
+
subVariant="blue"
|
|
1293
|
+
aria-label="appropriate aria label here">
|
|
1294
|
+
Shield!
|
|
1295
|
+
</Shield>
|
|
1296
|
+
```
|
|
1297
|
+
|
|
1298
|
+
icon Variant
|
|
1299
|
+
|
|
1300
|
+
```jsx
|
|
1301
|
+
<Shield ref={ref}
|
|
1302
|
+
variant="icon"
|
|
1303
|
+
subVariant="blue"
|
|
1304
|
+
aria-label="appropriate aria label here">
|
|
1305
|
+
Shield!
|
|
1306
|
+
</Shield>
|
|
1307
|
+
```
|
|
1308
|
+
media Variant
|
|
1309
|
+
|
|
1310
|
+
```jsx
|
|
1311
|
+
<Shield ref={ref} variant="media"
|
|
1312
|
+
subVariant="blue"
|
|
1313
|
+
imagePath="/src/assets/Doctor.png"
|
|
1314
|
+
aria-label="health professional icon">
|
|
1315
|
+
<h5 className='text-sm font-bold my-2'>Flu Season!</h5>
|
|
1316
|
+
<p className="mb-2">Don't be caught unprepared. </p>
|
|
1317
|
+
</Shield>
|
|
1318
|
+
```
|
|
1319
|
+
go Variant
|
|
1320
|
+
|
|
1321
|
+
```jsx
|
|
1322
|
+
<Shield
|
|
1323
|
+
className="text-left "
|
|
1324
|
+
variant='go'
|
|
1325
|
+
subVariant='full'
|
|
1326
|
+
>Lorem ipsum dolor sit amet, consectetur adipiscing
|
|
1327
|
+
elit, sed do eiusmod tempor incididunt ut labore
|
|
1328
|
+
et dolore magna aliqua</Shield>
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
### Dependencies
|
|
1333
|
+
|
|
1334
|
+
**_none_**
|
|
1335
|
+
|
|
1336
|
+
[Top of Page](#table-of-contents)
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
<!-- S I D E B A R N A V ---------------------------------------------------------------------------- -->
|
|
1341
|
+
|
|
1342
|
+
## SideBarNav
|
|
1343
|
+
|
|
1344
|
+
The **SideBarNav** component provides a navigation component that slides in from the side of the display when activated. It includes an application logo, the application name, a list of links, and the version number of the application displayed at the bottom of the navbar.
|
|
1345
|
+
|
|
1346
|
+
Future versions should include search functionality.
|
|
1347
|
+
|
|
1348
|
+
version: string;
|
|
1349
|
+
appName: string;
|
|
1350
|
+
menuItems: ListItemProps[];
|
|
1351
|
+
|
|
1352
|
+
Full list of props below
|
|
1353
|
+
|
|
1354
|
+
### Props
|
|
1355
|
+
|
|
1356
|
+
| Prop | Type | Optional | Default | Description |
|
|
1357
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1358
|
+
| appName | string | No | undefined | The application name to dispilay |
|
|
1359
|
+
| 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. |
|
|
1360
|
+
| clickOutsideCloses | boolean | Yes | **`false`** | clicking or tapping elsewhere on the application will close the SideBarNav |
|
|
1361
|
+
| image | string | No | undefined | string path to the application logo to display |
|
|
1362
|
+
| classNameImage | string | Yes | (2) below | a group of alternate classes that can be specified for the logo image, and applied to the **`img`** element |
|
|
1363
|
+
| classNameImageContainer | string | Yes | (2) below | a group of alternate classes that can be specified for the logo image's container, and applied to the **`img`** element |
|
|
1364
|
+
| menu | boolean | Yes | false | when **`true`**, the default in-component hamburger menu is displayed and used to display or hide the SideBarNav |
|
|
1365
|
+
| classNameMenu | string | Yes | empty string | alternate css classes to apply to the element that makes up the hamburger menu |
|
|
1366
|
+
| classNameMenuContainer | string | Yes | (3) below | alternate css classes to apply to the **`button`** element that wraps up the hamburger menu |
|
|
1367
|
+
| classNameMenuItem | string | Yes | 'pb-4' | allows the user to add alternate classes via **`twMerge`** to individual menu items |
|
|
1368
|
+
| menuItems | ListItemProps[] | No | undefined, see (4) below | The menu items to display |
|
|
1369
|
+
| right | boolean | Yes | false | when true right-aligns the text inside the sidebarNav |
|
|
1370
|
+
| version | string | No | undefined | The version number to display |
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
1. Default Classes outer **`div`**
|
|
1374
|
+
|
|
1375
|
+
- w/o menu **`relative w-56 h-screen flex flex-col px-4 pb-4 pt-10 bg-white overflow-y-auto`**
|
|
1376
|
+
- w/ menu, include also **`fixed z-20 right-0 top-0 translate-x-full transition-transform duration-300`**
|
|
1377
|
+
|
|
1378
|
+
2. Default classes applied to **`img`** - **`border border-[#bbbabc] w-16 h-16 bg-[#eeeeef] ring-1`**
|
|
1379
|
+
|
|
1380
|
+
3. Default classes applied to **`button`** - **`size-8 mb-4`**
|
|
1381
|
+
|
|
1382
|
+
|
|
1383
|
+
### Example Usage
|
|
1384
|
+
|
|
1385
|
+
```jsx
|
|
1386
|
+
import doctor from '../../assets/Doctor.png';
|
|
1387
|
+
// ...
|
|
1388
|
+
|
|
1389
|
+
const menuItems = [
|
|
1390
|
+
{
|
|
1391
|
+
children: <>
|
|
1392
|
+
<img className='max-h-[2em] max-w-[2em] pr-1 inline' src={arrowRight} alt='home link icon' />
|
|
1393
|
+
<p className='inline hover:underline'>Accordion</p>
|
|
1394
|
+
</>,
|
|
1395
|
+
target: '/accordion'
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
children: <>
|
|
1399
|
+
<img className='max-h-[2em] max-w-[2em] pr-1 inline' src={arrowRight} alt='home link icon' />
|
|
1400
|
+
<p className='inline hover:underline'>Badge</p>
|
|
1401
|
+
</>,
|
|
1402
|
+
target: '/badge'
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
children: <>
|
|
1406
|
+
<img className='max-h-[2em] max-w-[2em] pr-1 inline' src={arrowRight} alt='home link icon' />
|
|
1407
|
+
<p className='inline hover:underline'>Breadcrumbs</p>
|
|
1408
|
+
</>,
|
|
1409
|
+
target: '/libraries/simple-ui/bread-crumbs-page'
|
|
1410
|
+
},
|
|
1411
|
+
....
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
// in the return JSX
|
|
1415
|
+
<SideBarNav
|
|
1416
|
+
appName='A.C.M.E. Tools'
|
|
1417
|
+
version="0.0.0"
|
|
1418
|
+
menuItems={menuItems}
|
|
1419
|
+
image={doctor}
|
|
1420
|
+
clickOutsideCloses
|
|
1421
|
+
menu
|
|
1422
|
+
className='bg-slate-200 border border-slate-400 rounded-l-md h-full'
|
|
1423
|
+
/>
|
|
1424
|
+
```
|
|
1425
|
+
|
|
1426
|
+
### Dependencies
|
|
1427
|
+
|
|
1428
|
+
**_none_**
|
|
1429
|
+
|
|
1430
|
+
[Top of Page](#table-of-contents)
|
|
1431
|
+
<!-- S K E L E T O N ---------------------------------------------------------------------------- -->
|
|
1432
|
+
|
|
1433
|
+
## Skeleton
|
|
1434
|
+
|
|
1435
|
+
A Skeleton is used as a placeholder, showing a basic graphic representation of a page or resource while content is loading.
|
|
1436
|
+
|
|
1437
|
+
The `Skeleton` component serves as a container for the Skeleton content, which consists of SkelCircle, SkelLine, SkelSection, and SkelRow. Skeleton takes two optional prop values, className and variant.
|
|
1438
|
+
|
|
1439
|
+
Note that the `Skeleton` component uses `Flexbox`, and you can in theory use your own custom elements inside it, or change the layout on child components with this in mind.
|
|
1440
|
+
|
|
1441
|
+
The nested components inside of Skeleton are `SkelCircle`, `SkelLine`, `SkelSection`, and `SkelRow`. These small components serve to display shaded shapes that represent larger content on the page representation.
|
|
1442
|
+
|
|
1443
|
+
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"`.
|
|
1444
|
+
|
|
1445
|
+
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%
|
|
1446
|
+
opacity.
|
|
1447
|
+
|
|
1448
|
+
- `SkelCircle` - a small circle (i.e. a badge or icon)
|
|
1449
|
+
- `SkelLine` - a line (i.e. text or content)
|
|
1450
|
+
- `SkelSection` - a larger section on a page, or paragraph
|
|
1451
|
+
- `SkelRow` - non graphical, used to force following items to a new row after using inline variants above. Usually not required.
|
|
1452
|
+
|
|
1453
|
+
Full list of props below
|
|
1454
|
+
|
|
1455
|
+
### Props for Skeleton
|
|
1456
|
+
|
|
1457
|
+
| Prop | Type | Optional | Default | Description |
|
|
1458
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1459
|
+
| className | string | Yes | | This is used to apply user supplied styling to the `Skeleton` component. |
|
|
1460
|
+
| variant | string | Yes | | Allows the user to enter a pre-defined variant that includes its own pre-defined styling |
|
|
1461
|
+
|
|
1462
|
+
### Props for SkelCircle & SkelLine components
|
|
1463
|
+
|
|
1464
|
+
| Prop | Type | Optional | Default | Description |
|
|
1465
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1466
|
+
| className | string | Yes | | This is used to apply user supplied styling to the `SkelCircle` and `SkelLine` components. |
|
|
1467
|
+
| inline | boolean | Yes | false | if specified or true this component will be layed out inline. The `className` prop can be used to set a width, and if desired, additional inline components can be placed on the same line inside the Skeleton. |
|
|
1468
|
+
|
|
1469
|
+
### Props for SkelCircle & SkelLine components
|
|
1470
|
+
|
|
1471
|
+
| Prop | Type | Optional | Default | Description |
|
|
1472
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1473
|
+
| className | string | Yes | | This is used to apply user supplied styling to the `SkelSection` and `SkelRow` components. |
|
|
1474
|
+
|
|
1475
|
+
Tailwind CSS Classes used for Skeleton components
|
|
1476
|
+
|
|
1477
|
+
- Skeleton
|
|
1478
|
+
- **`flex flex-row flex-wrap animate-pulse h-48 w-56 pt-2`**
|
|
1479
|
+
- SkelCircle & SkelLine
|
|
1480
|
+
- **`rounded-lg bg-slate-300 h-6 inline-block mx-2 my-1 grow`**
|
|
1481
|
+
- SkelSection
|
|
1482
|
+
- **`rounded-lg bg-slate-300 grow h-24 my-1 mx-2`**
|
|
1483
|
+
- SkelRow
|
|
1484
|
+
- **`basis-full h-0`**
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
### Example Usage
|
|
1488
|
+
|
|
1489
|
+
Usage example for Example 1 below
|
|
1490
|
+
|
|
1491
|
+
```jsx
|
|
1492
|
+
import { Skeleton, SkelCircle, SkelLine, SkelRow, SkelSection } from '@dhasdk/simple-ui'
|
|
1493
|
+
// ...
|
|
1494
|
+
<Skeleton>
|
|
1495
|
+
<SkelCircle inline /><SkelLine inline />
|
|
1496
|
+
<SkelLine />
|
|
1497
|
+
<SkelSection />
|
|
1498
|
+
</Skeleton>
|
|
1499
|
+
```
|
|
1500
|
+
|
|
1501
|
+
Usage example for Example 2 below
|
|
1502
|
+
|
|
1503
|
+
```jsx
|
|
1504
|
+
import { Skeleton, SkelCircle, SkelLine, SkelRow, SkelSection } from '@dhasdk/simple-ui'
|
|
1505
|
+
// ...
|
|
1506
|
+
<Skeleton>
|
|
1507
|
+
<SkelLine className="grow-0 basis-2/12" inline />
|
|
1508
|
+
<SkelLine className="grow-0 basis-2/12" inline />
|
|
1509
|
+
<SkelLine />
|
|
1510
|
+
<SkelSection />
|
|
1511
|
+
</Skeleton>
|
|
1512
|
+
```
|
|
1513
|
+
Skeleton w/ Alternate Coloring
|
|
1514
|
+
|
|
1515
|
+
```jsx
|
|
1516
|
+
import { Skeleton, SkelCircle, SkelLine, SkelRow, SkelSection } from '@dhasdk/simple-ui'
|
|
1517
|
+
// ...
|
|
1518
|
+
<Skeleton>
|
|
1519
|
+
<SkelLine className='grow-0 basis-2/12 bg-red-500/50' inline />
|
|
1520
|
+
<SkelLine className='grow-0 basis-2/12 bg-red-500/50' inline />
|
|
1521
|
+
<SkelLine className='bg-orange-500/50' />
|
|
1522
|
+
<SkelSection className='bg-yellow-500/50' />
|
|
1523
|
+
</Skeleton>,
|
|
1524
|
+
```
|
|
1525
|
+
|
|
1526
|
+
### Dependencies
|
|
1527
|
+
|
|
1528
|
+
**_none_**
|
|
1529
|
+
|
|
1530
|
+
[Top of Page](#table-of-contents)
|
|
1531
|
+
|
|
1532
|
+
|
|
1533
|
+
[Top of Page](#table-of-contents)
|
|
1534
|
+
<!-- S L I D E R ------------------------------------------------------------------------------ -->
|
|
1535
|
+
|
|
1536
|
+
## Slider
|
|
1537
|
+
|
|
1538
|
+
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.
|
|
1539
|
+
|
|
1540
|
+
The Slider utilizes an input element of type range, and applies additional css styling via a css module.
|
|
1541
|
+
|
|
1542
|
+
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.
|
|
1543
|
+
|
|
1544
|
+
[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.
|
|
1545
|
+
|
|
1546
|
+
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.
|
|
1547
|
+
|
|
1548
|
+
Full list of props below
|
|
1549
|
+
|
|
1550
|
+
### Props for Slider
|
|
1551
|
+
|
|
1552
|
+
| Prop | Type | Optional | Default | Description |
|
|
1553
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1554
|
+
| className | string | Yes | | This is used to apply user supplied styling to the **input** element that makes up the **Slider** component. |
|
|
1555
|
+
| classNameLabel | string | Yes | | A string value of tailwind classes used to apply styling to the **label** inside the **Slider** component. |
|
|
1556
|
+
| 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. |
|
|
1557
|
+
| 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. |
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
Tailwind CSS Classes used for Slider components
|
|
1561
|
+
|
|
1562
|
+
- className defaults
|
|
1563
|
+
- **`w-full block mb-2`**
|
|
1564
|
+
- classNameLabel defaults
|
|
1565
|
+
- **`block mb-2'`**
|
|
1566
|
+
|
|
1567
|
+
|
|
1568
|
+
### Example Usage
|
|
1569
|
+
|
|
1570
|
+
Default example, no callback or label
|
|
1571
|
+
|
|
1572
|
+
```jsx
|
|
1573
|
+
<Slider />
|
|
1574
|
+
```
|
|
1575
|
+
|
|
1576
|
+
Example with callback function
|
|
1577
|
+
|
|
1578
|
+
```jsx
|
|
1579
|
+
const [value, setValue] = useState<number>(50);
|
|
1580
|
+
// ...
|
|
1581
|
+
|
|
1582
|
+
return (
|
|
1583
|
+
<>
|
|
1584
|
+
<Slider className='block mb-4' startValue={value} changeHandler={setValue} />
|
|
1585
|
+
<div className='block'>value: {value}</div>
|
|
1586
|
+
</>
|
|
1587
|
+
);
|
|
1588
|
+
```
|
|
1589
|
+
Slider w/ startValue (an input attribute) & changeHandler
|
|
1590
|
+
|
|
1591
|
+
```jsx
|
|
1592
|
+
const [value, setValue] = useState<number>(50);
|
|
1593
|
+
// ...
|
|
1594
|
+
|
|
1595
|
+
<Slider
|
|
1596
|
+
startValue={value}
|
|
1597
|
+
changeHandler={setValue}
|
|
1598
|
+
id='1'
|
|
1599
|
+
label='Volume Level'
|
|
1600
|
+
classNameLabel='font-bold text-blue-900'
|
|
1601
|
+
/>
|
|
1602
|
+
<div>value: {value}</div>
|
|
1603
|
+
```
|
|
1604
|
+
|
|
1605
|
+
### Dependencies
|
|
1606
|
+
|
|
1607
|
+
**_none_**
|
|
1608
|
+
|
|
1609
|
+
[Top of Page](#table-of-contents)
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
<!-- S T A T U S ---------------------------------------------------------------------------- -->
|
|
1613
|
+
|
|
1614
|
+
## Status
|
|
1615
|
+
|
|
1616
|
+
The `Status` component comes with three default variants, and the ability for the developer to create their own. Status is used to display in a small graphical format the status of content or a short message, accompanied by an icon - similar to a Badge.
|
|
1617
|
+
|
|
1618
|
+
This component takes five optional props that allow for customization and/or the use of pre-defined variants. The three predefined variants, specified via the `variant` prop, are `available`, `inProgress`, and `notAvailable`. If `variant` is left blank, `available` is used.
|
|
1619
|
+
|
|
1620
|
+
To create a custom iteration of Status, leave `variant` blank and utilize a combination of the remaining props. The `Status` component consists of three separate div elements, one serving as a container, and then one each for the image/icon and child data.
|
|
1621
|
+
|
|
1622
|
+
The `className` prop can be used to add alternate styling to the outer div, i.e. `border-blue-700 bg-blue-200`. Likewise, the `classNameImage` prop can be used to provide alternate styling to the div containing the image, and the `classNameChild` prop can provide alternate styling for the child div that contains the text, i.e. `text-blue-700`
|
|
1623
|
+
|
|
1624
|
+
`image` and `children` are the final two props, and are both of type `ReactNode`.
|
|
1625
|
+
|
|
1626
|
+
Full list of props below
|
|
1627
|
+
|
|
1628
|
+
### Props
|
|
1629
|
+
|
|
1630
|
+
| Prop | Type | Optional | Default | Description |
|
|
1631
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1632
|
+
| children | string | No | | This prop takes children content, i.e. html and content that becomes the body of the Status. |
|
|
1633
|
+
| 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. |
|
|
1634
|
+
| classNameChild | string | Yes | (2) below | This prop takes in alternate classes to apply style to the `div` that contains the child content. |
|
|
1635
|
+
| classNameImage | string | Yes | (3) below | Alternate CSS classes that are applied to the div containing the childe div that contains the Status component image. |
|
|
1636
|
+
| image | ReactNode | Yes | | This prop takes type `ReactNode`, and is used to display a custom user supplied image. See usage examples above for more. |
|
|
1637
|
+
| variant | string | No | 'available' | The predefined variant of Status to display. Predefined variants are `available`, `inProgress`, and `notAvailable` |
|
|
1638
|
+
|
|
1639
|
+
1. className
|
|
1640
|
+
|
|
1641
|
+
**`h-[45px] px-4 py-3 bg-green-50 rounded-[100px] border border-green-700 justify-center items-center gap-2 inline-flex`**
|
|
1642
|
+
|
|
1643
|
+
2. classNameChild
|
|
1644
|
+
|
|
1645
|
+
**`text-green-900 text-lg font-normal font-['Arial']`**
|
|
1646
|
+
|
|
1647
|
+
3. classNameImage
|
|
1648
|
+
|
|
1649
|
+
**`w-5 h-5 relative overflow-hidden`**
|
|
1650
|
+
|
|
1651
|
+
### Example Usage
|
|
1652
|
+
|
|
1653
|
+
Available variant
|
|
1654
|
+
|
|
1655
|
+
```jsx
|
|
1656
|
+
<Status
|
|
1657
|
+
className='me-4'>
|
|
1658
|
+
Available</Status>
|
|
1659
|
+
```
|
|
1660
|
+
|
|
1661
|
+
inProgress variant
|
|
1662
|
+
|
|
1663
|
+
```jsx
|
|
1664
|
+
<Status
|
|
1665
|
+
className='me-4'
|
|
1666
|
+
variant='inProgress'>
|
|
1667
|
+
In Progress</Status>
|
|
1668
|
+
```
|
|
1669
|
+
|
|
1670
|
+
notAvailable variant
|
|
1671
|
+
|
|
1672
|
+
```jsx
|
|
1673
|
+
<Status
|
|
1674
|
+
className='me-4'
|
|
1675
|
+
variant='inProgress'>
|
|
1676
|
+
In Progress</Status>
|
|
1677
|
+
```
|
|
1678
|
+
|
|
1679
|
+
Custom variant
|
|
1680
|
+
|
|
1681
|
+
```jsx
|
|
1682
|
+
<Status
|
|
1683
|
+
image={ <img src={tune}
|
|
1684
|
+
alt='information' /> }
|
|
1685
|
+
className='border-blue-700 bg-blue-200'
|
|
1686
|
+
classNameChild='text-blue-700'
|
|
1687
|
+
>
|
|
1688
|
+
Custom
|
|
1689
|
+
</Status>
|
|
1690
|
+
```
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
### Dependencies
|
|
1694
|
+
|
|
1695
|
+
**_none_**
|
|
1696
|
+
|
|
1697
|
+
[Top of Page](#table-of-contents)
|
|
1698
|
+
|
|
1699
|
+
<!-- T A B S --------------------------------------------------------------------------------- -->
|
|
1700
|
+
|
|
1701
|
+
## Tabs
|
|
1702
|
+
|
|
1703
|
+
Tabs component lets the user split the UI into independent pieces, and view each piece in isolation.
|
|
1704
|
+
|
|
1705
|
+
This component has one required prop, **tabs**, which contains the content of the various tabs as type ReactNode. Optional props are **className**, **classNameContainer**, and **variant**.
|
|
1706
|
+
|
|
1707
|
+
Full list of props below
|
|
1708
|
+
|
|
1709
|
+
### Props
|
|
1710
|
+
|
|
1711
|
+
| Prop | Type | Optional | Default | Description |
|
|
1712
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1713
|
+
| className | string | Yes | undefined | 'flex border-b border-gray-200' | Additional css classes to apply to the div containing the individual tabs |
|
|
1714
|
+
| classNameContainer | string | Yes | 'w-full' | Additional css classes to apply to the containing div for the tabs component |
|
|
1715
|
+
| tabs | {id: string; label: string; content: ReactNode;}[] | Yes | undefined | An array of objects representing the individual tabs to display |
|
|
1716
|
+
| variant | string | Yes | 'default' | The predefined variant of Tabs to display. Current options are 'default', 'outline', and 'transparent' |
|
|
1717
|
+
|
|
1718
|
+
### Example Usage
|
|
1719
|
+
|
|
1720
|
+
Tabs - a simple example
|
|
1721
|
+
|
|
1722
|
+
```jsx
|
|
1723
|
+
const tabExample = [
|
|
1724
|
+
{
|
|
1725
|
+
id: 'tab1',
|
|
1726
|
+
label: 'Tab 1',
|
|
1727
|
+
content: <TabsContent1/>,
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
id: 'tab2',
|
|
1731
|
+
label: 'Tab 2',
|
|
1732
|
+
content: <TabsContent2/>,
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
id: 'tab3',
|
|
1736
|
+
label: 'Tab 3',
|
|
1737
|
+
content: <TabsContent3/>,
|
|
1738
|
+
}
|
|
1739
|
+
]
|
|
1740
|
+
|
|
1741
|
+
<Tabs
|
|
1742
|
+
tabs={tabExample}
|
|
1743
|
+
variant='filled'
|
|
1744
|
+
/>
|
|
1745
|
+
```
|
|
1746
|
+
|
|
1747
|
+
### Dependencies
|
|
1748
|
+
|
|
1749
|
+
**_none_**
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
[Top of Page](#table-of-contents)
|
|
1754
|
+
|
|
1755
|
+
<!-- T O G G L E -------------------------------------------------------------------- -->
|
|
1756
|
+
|
|
1757
|
+
## Toggle
|
|
1758
|
+
|
|
1759
|
+
A Toggle is an element that allows the user to make a choice between two mutually exclusive states. Our Toggle comes with several variants: default, outlined, and text.
|
|
1760
|
+
|
|
1761
|
+
The Toggle component takes a "variant" prop used to indicate pre-defined styles, an optional click handler, and various other optional props described below and uses those to display a Toggle button. The variant prop currently takes one of four values, those possible values currently being 'default', 'Outline', 'nonHover', and 'MedCard'.
|
|
1762
|
+
|
|
1763
|
+
As with the button component, Toggle takes any other additional html attributes and passes them to the parent **`<button>`** tag. This div is styled using the tailwind twMerge() utility, so custom classes can be added via the classNames prop as and applied as well.
|
|
1764
|
+
|
|
1765
|
+
### Props
|
|
1766
|
+
|
|
1767
|
+
| Prop | Type | Optional | Default | Description |
|
|
1768
|
+
| ----------- | -------- | -------- | -------- | ----------- |
|
|
1769
|
+
| className | string | Yes | (1) below | alternate css classes to add/change styling of button element inside component |
|
|
1770
|
+
| classNameButton | string | Yes | (1) below | alternate css classes to add/change styling of div used inside button/toggle |
|
|
1771
|
+
| defaultChecked | boolean | Yes | **`false`** | sets default state as checked or unchecked state when first displayed |
|
|
1772
|
+
| disabled | boolean | Yes | **`false`** | sets disabled state of Toggle component || label | string | Yes | 'Toggle on/off' | The **label** prop denotes the aria label to set for the toggle component. |
|
|
1773
|
+
| onCheckedChange | (checked: boolean) => void | Yes | undefined | callback function that is called with the new value of `checked` whenever it changes. To capture the correct state, it is recommended that you use an arrow function here. |
|
|
1774
|
+
| ...props | string | Yes | undefined | takes additional props that are not specifically defined in the component, i.e. **`aria-label`** |
|
|
1775
|
+
| ref | string | Yes | undefined | ref is exposed as a prop, and can be assigned and used on this component as normal |
|
|
1776
|
+
| variant | string | Yes | 'default' | The predefined variant of Badge to display. Options are: 'default', 'Outline', 'nonHover', and 'MedCard'. |
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
(1) Base CSS Classes
|
|
1780
|
+
- w-16 h-8 flex items-center p-1 rounded-full cursor-pointer transition-colors duration-300
|
|
1781
|
+
Toggle portion Base CSS Classes
|
|
1782
|
+
- bg-white w-6 h-6 rounded-full shadow-md transform transition-transform duration-300
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
Separate Variant Styles
|
|
1786
|
+
|
|
1787
|
+
- default:
|
|
1788
|
+
- classes: 'bg-[#d0cfd1] hover:bg-[#bbbabc]'
|
|
1789
|
+
- toggledClasses: 'bg-[#053ea6] hover:bg-[#0752dc]'
|
|
1790
|
+
- buttonClasses: 'translate-x-0'
|
|
1791
|
+
- toggledButtonClasses: 'translate-x-8 lg:translate-x-6'
|
|
1792
|
+
- outlined:
|
|
1793
|
+
- classes: 'bg-slate-300 border border-black hover:bg-[#abb5c2]'
|
|
1794
|
+
- toggledClasses: 'bg-blue-500/50 hover:bg-blue-400 border border-black'
|
|
1795
|
+
- buttonClasses: 'translate-x-0'
|
|
1796
|
+
- toggledButtonClasses: 'translate-x-8 lg:translate-x-6'
|
|
1797
|
+
|
|
1798
|
+
### Example Usage
|
|
1799
|
+
|
|
1800
|
+
```jsx
|
|
1801
|
+
<Toggle
|
|
1802
|
+
onCheckedChange={(checked: boolean) => {
|
|
1803
|
+
setColor(checked ?
|
|
1804
|
+
'border-green-500' : 'border-gray-400');
|
|
1805
|
+
console.log(checked);}
|
|
1806
|
+
}
|
|
1807
|
+
variant={toggleVariant} />
|
|
1808
|
+
```
|
|
1809
|
+
|
|
1810
|
+
### Dependencies
|
|
1811
|
+
|
|
1812
|
+
**_none_**
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
[Top of Page](#table-of-contents)
|