@dhasdk/simple-ui 0.0.12 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,81 +1,266 @@
1
1
  # simple-ui
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ This library was generated with [Nx](https://nx.dev) on React 18.x.
4
4
 
5
5
  ## <span style="color: orange;">*This library is under active development and not ready for production use\*</span>
6
6
 
7
7
  ## Table of Contents
8
8
 
9
+ - [Installation](#installation-and-setup)
10
+ - [Accordion](#accordion)
9
11
  - [Badge](#badge)
12
+ - [BreadCrumbs](#breadcrumbs)
10
13
  - [Button](#button)
11
14
  - [Card](#card)
15
+ - [CharacterCounter](#charactercounter)
16
+ - [DatePicker](#datepicker)
12
17
  - [Input](#input)
13
18
  - [List](#list)
14
19
  - [Modal](#modal)
15
20
  - [Select](#select)
21
+ - [Skeleton](#skeleton)
22
+ - [Status](#status)
23
+ - [Tabs](#tabs)
16
24
  - [Toggle](#toggle)
17
25
 
26
+ ## Quick Notes:
18
27
 
19
- ## Dependencies
28
+ - Some of these components use what are called **variants** from the **class-variance-authority** library. This allows pre-defined styles to be set, or 'variants', and those variants to be called by name via a prop when using the specified component. An example is the **Button** component below, and calling it using the 'DHAActive' style variant of that component (example code below).
20
29
 
21
- To use the simple-ui library with its available variant types, tailwindcss must be installed and setup inside your project.
30
+ <!-- I N S T A L L A T I O N ----------------------------------------------------------------------------------- -->
22
31
 
23
- ## Installation
32
+ [Back to Main Readme](./README.md)
24
33
 
25
- Install the simple-ui library with **`npm i @dhasdk/simple-ui`**
34
+ ## Installation and Setup
26
35
 
27
- ## Usage
36
+ 1. From the terminal run the following command:
28
37
 
29
- To use any of the available components, import the desired component into your source code:
38
+ **`npm install @dha-sdk/simple-ui`**
30
39
 
31
- **`import { Badge } from '@dhasdk/simple-ui`**
40
+ 2. Open the page that you are going to place the **dha-sdk/simple-ui** component, and do the following:
32
41
 
33
- Then use the component from simple-ui as described below
42
+ - At the top of the file, import your desired component from **'@dha-sdk'**, i.e. if you are using the **Badge** component, then:
43
+ - **`import { Badge } from '@dhasdk/simple-ui';`**
44
+ - Elsewhere in your file, use the component as documented below
34
45
 
35
46
 
47
+ <!-- A C C O R D I O N ----------------------------------------------------------------------------------- -->
48
+
49
+ ## Accordion
50
+
51
+ 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:
52
+
53
+ - 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.
54
+
55
+ - 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.
56
+
57
+ A **ref** can also be created and assigned to the Accordion component, and the component will point the reference to the outer html DIV.
58
+
59
+ 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.
60
+
61
+ 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.
62
+
63
+ ### Props for AccordionParent
64
+
65
+ | Prop | Type | Optional | Default | Description |
66
+ | ----------- | -------- | -------- | -------- | -------------------------------------------- |
67
+ | children | ReactNode | No | undefined | This is intended to contain the child **Accordion** components |
68
+ | chevron | boolean | Yes | undefined | If true, displays chevron icons for open/closed status, otherwise displays plus and minus icons. |
69
+ | iconAccordionOpened & iconAccordionClosed | ReactNode | Yes | N/A | custom icons to display for opened and closed state. See usage example above for a demonstration. |
70
+ | childHeadingClassName | 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. |
71
+ | childContentClassName | 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. |
72
+ | className | string | Yes | undefined | CSS classes applied to the container div for the **AccordionParent** component. |
73
+ | ...props | string | No | | takes additional props that are not specifically defined in the component, i.e. aria-label |
74
+ | 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. |
75
+ | 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. |
76
+ | variant | string | Yes | 'default' | currently unused |
77
+
78
+ ### Props for Accordion
79
+
80
+ | Prop | Type | Optional | Default | Description |
81
+ | ----------- | -------- | -------- | -------- | -------------------------------------------- |
82
+ | children | ReactNode | No | undefined | This contains the body of the **Accordion** content. |
83
+ | chevron | boolean | Yes | undefined | If true, displays chevron icons for open/closed status, otherwise displays plus and minus icons. |
84
+ | iconAccordionOpened & iconAccordionClosed | ReactNode | Yes | N/A | custom icons to display for opened and closed state. See usage example above for a demonstration. |
85
+ | childHeadingClassName | 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. |
86
+ | childContentClassName | 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. |
87
+ | className | string | Yes | undefined | CSS classes applied to the container div for the **Accordion** component. |
88
+ | ...props | string | No | | takes additional props that are not specifically defined in the component, i.e. aria-label |
89
+ | 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. |
90
+ | 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. |
91
+ | variant | string | Yes | 'default' | currently unused |
92
+
93
+
94
+
95
+ ### Example Usage
96
+
97
+ ```jsx
98
+ <AccordionParent
99
+ childHeadingClassName='bg-white'
100
+ childContentClassName='bg-white'>
101
+ <Accordion label='First Example'>
102
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ...
103
+ </Accordion>
104
+ <Accordion label='Second Example'>
105
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ...
106
+ </Accordion>
107
+ <Accordion label='Third Example'>
108
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed ...
109
+ </Accordion>
110
+ </AccordionParent>
111
+ ```
112
+
113
+ ### Dependencies
114
+
115
+ **_none_**
116
+
117
+
118
+ [Top of Page](#table-of-contents)
119
+
120
+ <!-- E N D A C C O R D I O N -->
121
+
122
+
123
+ <!-- B A D G E ----------------------------------------------------------------------------------- -->
36
124
 
37
125
  ## Badge
38
126
 
39
- The **badge** component takes three custom props plus child content, and uses that to display a badge. The custom props are an **image** URL, an **alt** tag for the icon, a **heading**, and as child data, the text content of the badge.
127
+ The **badge** component takes three required props, **variant**, **subVariant**, and **child** content.
128
+
129
+ Optional props are **className**, **svgClasses**, **imagePath**, **imageAlt**, and **imageClasses**.
40
130
 
41
- As with the **button** component, this one also takes additional html attributes that will be passed to the parent div. This div is also styled using the tailwind **`twMerge()`** utility, so custom classes can be added via the **classNames** prop as well.
131
+ As with the button component, this component also takes additional html attributes that when included are passed to the parent div.
132
+
133
+ This div is also styled using the tailwind **`twMerge()`** utility, so custom classes can be added via the classNames prop as well.
42
134
 
43
135
  ### Props
44
136
 
45
137
  | Prop | Type | Optional | Default | Description |
46
138
  | ----------- | -------- | -------- | -------- | -------------------------------------------- |
47
- | alt | string | Yes | undefined | Alt tag for icon/image |
48
- | bodyClassName | string | Yes | undefined | CSS classes to apply to the body of the badge |
49
- | children | string | No | N/A | text for badge content |
50
- | className | string | Yes | See **(1)** below | alternate css classes to apply to component |
51
- | heading | string | No | N/A | title/heading of the badge |
52
- | headingClassName | string | Yes | undefined | CSS classes to apply to Badge heading |
53
- | image | string | No | N/A | path of image to display inside image |
54
- | size | string | Yes | 'default' | CSS Badge variant sizing, avialable options are 'default' |
55
- | variant | string | Yes | 'default' | CSS Badge variant, available variants are 'default' and 'MedCard' |
139
+ | children | ReactNode | No | | html and content that becomes the body of the Badge. |
140
+ | subVariant | string | No | See **(1)** below | The predefined variant of Badge to display. |
141
+ | variant | string | No | See **(1)** below | The predefined variant of Badge to display. UX designed variants are **go**, **hazard**, and **warning** |
142
+ | 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 |
143
+ | imageAlt | string | See Comment | undefined | When an imagePath is specified, please specify an imageAlt that can be used for accessibility purposes. |
144
+ | imageClasses | string | Yes | undefined | Alternate CSS classes that are applied to the image for variant type media. |
145
+ | imagePath | string | See Comment | undefined | When variant is of type "media", an imagePath has to be specified that the component can load and display. |
146
+ | svgClasses | 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. |
147
+
148
+
149
+ 1. Variants --> subVariants
150
+ - default --> default, gray, red, yellow, green, blue
151
+ - warning **UX Variant** --> half, full
152
+ - hazard **UX Variant** --> half, full,
153
+ - go **UX Variant** --> half, full
154
+ - icon --> default, gray, red, yellow, green, blue
155
+ - media --> default, gray, green
156
+
157
+ 2. classNames per variant default
158
+ - 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`**
159
+ - 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`**
160
+ - 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`**
161
+
162
+
163
+
164
+ ### Example Usage
165
+
166
+ Default Variant
167
+
168
+ ```jsx
169
+ <Badge ref={ref}
170
+ variant="default"
171
+ subVariant="blue"
172
+ aria-label="appropriate aria label here">
173
+ Badge!
174
+ </Badge>
175
+ ```
176
+
177
+ icon Variant
178
+
179
+ ```jsx
180
+ <Badge ref={ref}
181
+ variant="icon"
182
+ subVariant="blue"
183
+ aria-label="appropriate aria label here">
184
+ Badge!
185
+ </Badge>
186
+ ```
187
+ media Variant
188
+
189
+ ```jsx
190
+ <Badge ref={ref} variant="media"
191
+ subVariant="blue"
192
+ imagePath="/src/assets/Doctor.png"
193
+ aria-label="health professional icon">
194
+ <h5 className='text-sm font-bold my-2'>Flu Season!</h5>
195
+ <p className="mb-2">Don't be caught unprepared. </p>
196
+ </Badge>
197
+ ```
198
+ go Variant
199
+
200
+ ```jsx
201
+ <Badge
202
+ className="text-left "
203
+ variant='go'
204
+ subVariant='full
205
+ >Lorem ipsum dolor sit amet, consectetur adipiscing
206
+ elit, sed do eiusmod tempor incididunt ut labore
207
+ et dolore magna aliqua</Badge>
208
+ ```
209
+
210
+
211
+ ### Dependencies
212
+
213
+ **_none_**
214
+
215
+ [Top of Page](#table-of-contents)
216
+
217
+
218
+ <!-- B R E A D C R U M B S ------------------------------------------------------------------------------ -->
219
+
220
+ ## BreadCrumbs
56
221
 
222
+ 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.
223
+
224
+ The BreadCrumbs component takes in various props (`className`, `containerClassName`, `variant`, `auto`, and `separator`), in addition to any other html attributes a normal NAV element would use.
225
+
226
+ A `ref` can also be created and assigned to the button component, and the component will point the reference to the html nav element.
227
+
228
+ 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.
229
+
230
+ The `containerClassName` takes a list of css classes that are applied to the enclosing `nav` element.
231
+
232
+ Finally, the `separator` prop is a string value that represents the separator used between bread crumbs. The default value is a greater than sign, >.
233
+
234
+ Full list of props below
235
+
236
+
237
+ ### Props
238
+
239
+ | Prop | Type | Optional | Default | Description |
240
+ | ----------- | -------- | -------- | -------- | -------------------------------------------- |
241
+ | 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. |
242
+ | containerClassName | string | Yes | | This is used to apply user supplied styling to the container `nav` element. |
243
+ | ...props | string | Yes | undefined | takes additional props that are not specifically defined in the component, i.e. aria-label |
244
+ | separator | string | Yes | > | A string separator value to place between the separate breadcrumbs. The default value is '>' |
245
+ | variant | string | Yes | | Allows the user to enter a pre-defined variant that includes its own pre-defined styling. |
57
246
 
58
- **(1)** default values applied are **`flex flex-nowrap box-border rounded-md border-t-[1px] border-r-[1px] border-b-[1px] border-dha-mc-secondary-border border-l-[1em] border-l-dha-mc-true-blue bg-white
59
- drop-shadow-md w-[90vw] lg:max-w-[25em] mx-auto py-1 min-h-20 items-center`**
60
247
 
61
248
 
62
249
  ### Example Usage
63
250
 
251
+ Default Variant
252
+
64
253
  ```jsx
65
- <Badge
66
- image="../assets/img/svg/medical-bag.svg"
67
- alt="A medical bag"
68
- heading="Patient Information"
69
- className="w-[90%] md:w-[25em]"
70
- >
71
- Fill out the patient information form to ensure appropriate care can be provided.
72
- </Badge>
254
+ <BreadCrumbs />
73
255
  ```
74
256
 
257
+
75
258
  ### Dependencies
76
259
 
77
260
  **_none_**
78
261
 
262
+ [Top of Page](#table-of-contents)
263
+
79
264
  <!-- B U T T O N ------------------------------------------------------------------------------ -->
80
265
 
81
266
  ## Button
@@ -88,84 +273,225 @@ A reference can also be created and passed to the button component, and the comp
88
273
 
89
274
  | Prop | Type | Optional | Default | Description |
90
275
  | ----------- | -------- | -------- | -------- | ----------- |
91
- | className | string | Yes | 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50' | Class names to style component **(1) below** |
92
- | handler | **`() => void`** | Yes | N/A | A click handler for the Button |
93
- | size | string | Yes | 'default' | CSS Button variant sizing, avialable options are 'default', 'sm', 'lg', and 'icon' **(2) below** |
94
- | variant | string | Yes | 'default' | CSS Button variant, available variants are 'default', 'nonHover', 'Medcard', 'Outline' |
276
+ | children | ReactNode | Yes | | Content to display in the Button, overrides 'label' if both are present. |
277
+ | className | string | Yes | **(1) below** | Class names to style component |
278
+ | label | string | Yes | | Display text for button. If 'children' is present, that is used instead |
279
+ | onClick | () => void | Yes | | A click handler for the Button |
280
+ | ...props | string | Yes | undefined | additional props that are not specifically defined in the component, i.e. aria-label |
281
+ | type | string | Yes | 'button' | specifies the button type, and is one of 'button', 'submit', or 'reset' |
282
+ | variant | string | Yes | 'default' | CSS Button variant, available variants are 'default', 'filled', 'outline', and 'transparent' |
283
+
95
284
 
96
285
 
97
286
  **(1) classname defaults**
98
- - inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
99
287
 
100
- **(2) size**
101
- - 'default'
102
- - CSS: **`h-10 px-4 py-2`**
103
- - 'sm'
104
- - CSS: **`h-9 rounded-md px-3`**
105
- - 'lg'
106
- - CSS: **`h-11 rounded-md px-8`**
107
- - 'icon'
108
- - CSS: **`h-10 px-1`**
288
+ - Base CSS Classes
289
+
290
+ - **`inline-flex items-center justify-center whitespace-nowrap rounded-md ring-offset-background transition-colors focus-visible:outline-none font-[`Arial`] disabled:pointer-events-none text-sm md:text-base lg:text-lg disabled:opacity-50 px-6 py-[12px] md:py-[14px] lg:py-[16px]`**
291
+
292
+ - Additional Classes per variant
293
+ - 'default' - **`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 disabled:border-dha-mc-secondary-border disabled:border-2 py-0 md:py-0 lg:py-0 h-[48px] mt-1`**
294
+ - 'filled' - **`rounded-md bg-[#092068] hover:bg-[#0c2c8e] text-white text-lg hover:text-white focus:shadow-[0px_0px_0px_3px_rgba(251,137,241,1.00)] active:bg-[#092068]/80 disabled:bg-[#e4e4e5] disabled:text-[#939194] disabled:border-[#e4e4e5] disabled:border-2 lg:h-14`**
295
+ - '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(251,137,241,1.00)] lg:h-14`**
296
+ - '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] w-[157px] md:w-[163px] lg:w-[169px] h-12 md:h-[52px] lg:h-14`**
109
297
 
110
298
 
111
299
  ### Example Usage
112
300
 
301
+ Basic example
302
+
113
303
  ```jsx
114
- <Button ref={ref} size="sm" variant="Outline" onClick={console.log('Clicked!')}>
115
- Click Me!
116
- </Button>
304
+ <Button ref={ref} variant="MedCard"
305
+ onClick={console.log('Clicked!')}
306
+ label='Click Me!' />
117
307
  ```
118
308
 
309
+ Using an alternate varint, className, and aria-label
310
+
311
+ ```jsx
312
+
313
+ <Button ref={ref} variant="MedCard"
314
+ onClick={console.log('Clicked!')}
315
+ className='px-10 py-6'
316
+ aria-label='Show example pop-up'
317
+ >
318
+ Click Me!</Button>
319
+ ```
320
+
321
+
119
322
  ### Dependencies
120
323
 
121
324
  **_none_**
122
325
 
123
- <!-- C A R D ------------------------------------------------------------------------------ -->
326
+ <!-- C A R D -------------------------------------------------------------------------------- -->
327
+
328
+
329
+ [Top of Page](#table-of-contents)
124
330
 
125
331
  ## Card
126
332
 
127
- The Card component as built takes in various props (`variant`, `variantStyle`, `imagePath`, `imageClassname`, `imageInset`, `alt`, `ariaLabel`, and `children`), in addition to any other HTML attributes a normal HTML button would use, for example, an `aria-label` tag.
333
+ Cards contain content or information on a specific topic, often with a relevant image.
334
+
335
+ The **Card** component as built takes in various props (variant, variantStyle, imagePath, imageClassname, imageInset, alt, ariaLabel, and children), in addition to any other html attributes a normal html button would use, for example an **`aria-label`** tag.
128
336
 
129
- A `ref` can also be created and assigned to the Card component, and the component will point the reference to the outer HTML `DIV`.
337
+ A **`ref`** can also be created and assigned to the **Card** component, and the component will point the reference to the outer html DIV.
130
338
 
131
- 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.
339
+ 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.
132
340
 
133
- Full list of props below:
341
+ Full list of props below
134
342
 
135
- ### Props for the Button Component
343
+ ### Props
344
+
345
+ | Prop | Type | Optional | Default | Description |
346
+ | ----------- | -------- | -------- | -------- | ----------- |
347
+ | alt | string | No | | Alt tag to use inside the image displayed inside the Card component. |
348
+ | children | ReactNode | No | | Content to display in the Card aside from the image |
349
+ | ariaLabel | string | Yes | 'card component' | This is the aria-label applied to the parentDIV element in the Card component. |
350
+ | className | string | Yes | (1) below | Class names to style component |
351
+ | imageInset | string | Yes | | A boolean value indicating whether the image inside the card should be inset or not. See above for functional examples. |
352
+ | imageClassName | 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. |
353
+ | ...props | string | Yes | undefined | additional props that are not specifically defined in the component, i.e. aria-label |
354
+ | 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. |
355
+ | variantStyle | string | Yes | 'default' | Optoins are 'default' and 'outline' |
356
+
357
+
358
+ **(1) classnames for different variants**
359
+
360
+ - default --> **`flex flex-col w-64 max-w-64`**
361
+ - imageBottom --> **`flex flex-col-reverse w-64 mx-w-64`**
362
+ - imageLeft --> **`flex flex-row h-auto max-w-lg min-w-96`**
363
+ - imageRight --> **`flex flex-row-reverse h-auto max-w-lg min-w-96`**
364
+
365
+
366
+ ### Example Usage
367
+
368
+ Basic example
369
+
370
+ ```jsx
371
+ <Card
372
+ imagePath={imagePath}>
373
+ <h1 className="text-lg font-bold">Flu Season</h1>
374
+ <p>Flu season is approaching, and flu vaccines are
375
+ available now.</p>
376
+ </Card>
377
+ ```
378
+
379
+ Using an alternate varint, custom css, etc.
380
+
381
+ ```jsx
382
+ <Card variant='imageLeft'
383
+ imagePath={imagePath}
384
+ imageClassname="rounded-lg"
385
+ variantStyle="outline"
386
+ alt="Doctor wearing face mask"
387
+ imageInset>
388
+ <h1 className="text-lg font-bold">Flu Season</h1>
389
+ <p>Flu season is approaching, and flu vaccines are
390
+ available now.</p>
391
+ </Card>
392
+ ```
393
+
394
+ ### Dependencies
395
+
396
+ **_none_**
397
+
398
+
399
+ <!-- C H A R A C T E R C O U N T E R -------------------------------------------------------- -->
400
+
401
+
402
+ [Top of Page](#table-of-contents)
403
+
404
+ ## CharacterCounter
405
+
406
+ 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 **overLimitMessageClassName**) and message will change to inform the visitor of this.
407
+
408
+ 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.
409
+
410
+ The children prop will be an **input** or **textArea** element, wrapped by CharacterCounter, and is what CharacterCounter will monitor.
411
+
412
+ Full list of props below
413
+
414
+ ### Props
136
415
 
137
- | Name | Type | Required | Default Value | Description |
138
- |------------------|---------------|----------|---------------|---------------------------------------------------------------------------------------------------------------------|
139
- | `alt` | string | No | | Alt tag to use inside the image displayed inside the Card component. |
140
- | `children` | ReactNode | No | | Content to display in the Card aside from the image. |
141
- | `ariaLabel` | string | Yes | `'card component'` | This is the `aria-label` applied to the parent `DIV` element in the Card component. |
142
- | `className` | string | Yes | See (1) below | Class names to style the component. |
143
- | `imageInset` | string | Yes | | A boolean value indicating whether the image inside the card should be inset or not. See above for functional examples. |
144
- | `imagePath` | string | Yes | | A path to an image to import and use inside the component. Can be constructed via `new URL('/src/assets/Doctor.png', import.meta.url).href;`. |
145
- | `imageClassname`| 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. |
146
- | `...props` | string | Yes | `undefined` | Takes additional props that are not specifically defined in the component, i.e., `aria-label`. |
147
- | `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. |
148
- | `variantStyle` | string | Yes | `'default'` | Options are `default` and `outline`. |
416
+ | Prop | Type | Optional | Default | Description |
417
+ | ----------- | -------- | -------- | -------- | ----------- |
418
+ | children | ReactNode | No | | the child Input or TextArea component |
419
+ | 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. |
420
+ | className | string | Yes | (1) below | This is used to apply user supplied styling to the CharacterCounter div element. |
421
+ | messageClassName | string | Yes | | CSS classes to apply to the message text prior to the user exceeding the specified limit |
422
+ | overLimitMessageClassName | string | Yes | | CSS classes to apply to the message text after the user has exceeded the specified limit. |
423
+ | 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". |
424
+ | altOverageMessageText | string | Yes | 'characters too many' | A string value containing an alternate message to display to the user they have exceeded the specified limit. If the user has typed 15 characters and is over the limit, the default reads "5 characters too many" in red text (with dfeault overLimitMessageClassName). |
425
+
426
+
427
+ ### Example Usage
428
+
429
+ Basic example
430
+
431
+ ```jsx
432
+ <CharacterCounter
433
+ maxCharacters={15}>
434
+ <Input size={10} />
435
+ </CharacterCounter>
436
+ ```
437
+
438
+ Using an altOverageMessageText and altRemainingMessageText
439
+
440
+ ```jsx
441
+ <CharacterCounter
442
+ maxCharacters={15}
443
+ altOverageMessageText="CHARACTERS OVER THE LIMIT!"
444
+ altRemainingMessageText="characters remaining, use them wisely!">
445
+ <Input size={10} />
446
+ </CharacterCounter>
447
+ ```
448
+
449
+ ### Dependencies
450
+
451
+ **_none_**
452
+
453
+
454
+ [Top of Page](#table-of-contents)
455
+
456
+
457
+ <!-- D A T E P I C K E R ------------------------------------------------------------------------------- -->
458
+
459
+ ## DatePicker
460
+
461
+ DatePicker is an input that can be set typing or clicking on the day of the week displayed.
462
+
463
+ The DatePicker component as built takes in various props (id, label, value, onChange)
464
+
465
+ ### Props
466
+
467
+ | Prop | Type | Optional | Default | Description |
468
+ | ----------- | -------- | -------- | -------- | -------------------------------------------- |
469
+ | id | string | No | | An ID to differentiate/target the component. |
470
+ | label | string | No | | A label for the component |
471
+ | value | string | No | | The date the component is currently set to. |
472
+ | onChange | (date: string) => void \| null | No | | Handler function to be fed to the component, executed when the date changes |
473
+
474
+
475
+ ### Example Usage
476
+
477
+ Default Variant
478
+
479
+ ```jsx
480
+ import dayjs from "dayjs";
481
+ const [displayDate, setDisplayDate] = useState('');
482
+
483
+ <DatePicker id={""} label={""}
484
+ value={dayjs().startOf("day").format("MM-DD-YYYY")}
485
+ onChange={setDisplayDate}/>
486
+ ```
487
+
488
+
489
+ ### Dependencies
149
490
 
150
- ---
491
+ **dayjs**
151
492
 
152
- ### (1) Separate Variant CSS Style Definitions
493
+ [Top of Page](#table-of-contents)
153
494
 
154
- 1. **default:**
155
- ```css
156
- flex flex-col w-64 max-w-64
157
- ```
158
- 2. **imageBottom:**
159
- ```css
160
- flex flex-col-reverse w-64 mx-w-64
161
- 3. **imageLeft:**
162
- ```css
163
- flex flex-row h-auto max-w-lg min-w-96
164
- ```
165
- 4. **imageRight:**
166
- ```css
167
- flex flex-row-reverse h-auto max-w-lg min-w-96
168
- ```
169
495
 
170
496
 
171
497
  <!-- I N P U T ------------------------------------------------------------------------------ -->
@@ -181,15 +507,20 @@ A reference can also be created and passed to the input component, and the compo
181
507
  | Prop | Type | Optional | Default | Description |
182
508
  | ----------- | -------- | -------- | -------- | ----------- |
183
509
  | className | string | Yes | **(1) below** | pass any css class names to add/change styling
184
- | labelClassName | string | Yes | **(2) below** | pass any css class names to add/change styling for the input label |
185
510
  | label | string | Yes | '' | string value of label, blank for no label |
186
- | labelInputColor | string | Yes | Yes | '#fff' | 2nd half of the **labelBaseColor** above - use if the input background is not white. If the background applied to the page and the input are different, specify the page input with this prop. This will split the background color behind the label to create a more seamless look. This is a simple css color value, e.g. **`white`**, **`#fff`**, etc.
187
- | textShadow | boolean | Yes | false | indicates whether you wish to apply a drop shadow to the label text, and if used, utilizes the **labelBaseColor** above. |
511
+ | 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 |
512
+ | labelClassName | string | Yes | **(2) below** | pass any css class names to add/change styling for the input label |
513
+ | placeHolder | string | Yes | Yes | | sets the placeholder text inside the input element |
514
+ | ...props | string | Yes | | takes additional props that are not specifically defined in the component, i.e. aria-label |
515
+ | required | boolean | Yes | | if specified, a red asterisk is prepended to the label, and the required attribute is set to true |
516
+ | 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. |
517
+ | variant | string | Yes | | The predefined variant of Badge to display. Current options are 'default', 'MedCard', 'Outline', and 'nonHover' |
518
+
188
519
 
189
- **(1)** **`'arial rounded-sm border-2 border-[#c6c6c6] p-1 ps-2 mx-2
190
- bg-white hover:outline-[#c6c6c6] focus:outline-[#0256ab] active:outline-[#0256ab]`**
520
+ **(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]`**
191
521
 
192
- **(2)** **`absolute ms-5 -translate-y-1/2 px-2 text-[0.8em] w-auto h-auto`**
522
+
523
+ **(2)** Default classes for the label are **`absolute ms-5 -translate-y-1/2 px-2 text-[0.8em] w-auto h-auto`**
193
524
 
194
525
  ### Additional Properties & Attributes
195
526
 
@@ -200,7 +531,11 @@ This component as mentioned also takes any other property or attribute that a no
200
531
  #### Simple version
201
532
 
202
533
  ```jsx
203
- <Input label="Default Input" placeholder="placeholder text here" labelBaseColor="#f5f5f5" />
534
+ <Input
535
+ label="Default Input"
536
+ placeholder="placeholder text here"
537
+ labelBaseColor="#f5f5f5"
538
+ />
204
539
  ```
205
540
 
206
541
  #### More complex
@@ -223,6 +558,9 @@ This component as mentioned also takes any other property or attribute that a no
223
558
 
224
559
  **_none_**
225
560
 
561
+
562
+ [Top of Page](#table-of-contents)
563
+
226
564
  <!-- L I S T ----------------------------------------------------------------------------------- -->
227
565
 
228
566
  ## List
@@ -234,12 +572,12 @@ The **List** component is a component that creates a list of items, ordered or u
234
572
  | Prop | Type | Optional | Default | Description |
235
573
  | ----------- | -------- | -------- | -------- | ----------- |
236
574
  | 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 |
575
+ | header | string | Yes | undefined | takes in a string of text to be displayed above the list of items |
237
576
  | children | React.ReactNode | Yes | undefined | this allows the component to receive any number of react components as children |
238
577
  | className | string | Yes | undefined | takes additional classnames to add/change styling |
239
578
  | withDividers | boolean | Yes | false | if true, this prop will display a divider to separate each item within the list |
240
579
  | dividerColorClass | string | Yes | undefined | this prop is used to change the color of dividers when used, for example 'red-400' |
241
- | itemClassName | string | Yes | undefined | takes additional classnames to add/change styling of the items within the list |
242
- | variant | string | Yes | undefined | variants can be used to change the theme of the component, for example DHA MedCard |
580
+ | itemClassName | string | Yes | undefined | takes additional classnames to add/change styling of the items within the list |
243
581
  | 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 |
244
582
  | isDisc | boolean | Yes | false | if true, this prob will change the list to be unordered, placing bullet points next to each item |
245
583
 
@@ -289,194 +627,554 @@ Usage can be viewed inside the storybook app (**`npm run storybook`**), and exam
289
627
  </List>
290
628
  ```
291
629
 
630
+ <!-- M O D A L --------------------------------------------------------------------------- -->
292
631
 
293
- <!-- M O D A L ----------------------------------------------------------------------------
294
- -->
632
+
633
+ [Top of Page](#table-of-contents)
295
634
 
296
635
  ## Modal
297
636
 
298
- The Modal component takes four required props: **`isOpen`**, **`onClose`**, **`title`**, and child content.
637
+ 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.
299
638
 
300
- Optional props are **`className`**, **`clickOutsideCloses`**, **`displayClosingX`**, **`closeButtonText`**, **`continueButton`**, **`continueButtonText`**, and **`continueButtonHandler`**.
639
+ The Modal component takes four required props, **isOpen**, **onClose**, **title**, and **child** content.
301
640
 
302
- As with the Button component, this component can also take additional HTML attributes that, when included, are passed to the parent `div`.
641
+ Optional props are **className**, **clickOutsideCloses**, **displayClosingX**, **closeButtonText**,**continueButton**, **continueButtonText**, and **continueButtonHandler**.
303
642
 
304
- This `div` is also styled using the Tailwind `twMerge()` utility and is used to apply custom CSS classes via the `className` prop.
643
+ As with the Button component, this component can also take additional html attributes that when included are passed to the parent div.
305
644
 
306
- ### Props for the Modal Component
645
+ This div is also styled using the tailwind **`twMerge()`** utility, and is used to apply custom css classes via the className prop.
307
646
 
308
- | Name | Type | Required | Default Value | Description |
309
- |-------------------------|-----------------|----------|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
310
- | `children` | ReactNode | No | | This prop takes children content, i.e., HTML and content that becomes the body of the Modal. |
311
- | `isOpen` | boolean | No | | Indicates whether the Modal is displayed or not. This value also controls the `overflow: hidden` CSS property and enables/disables keyboard listeners for accessibility. |
312
- | `onClose` | () => void | No | | This is the close handler for the Modal component. |
313
- | `title` | string | No | | This is the title to display in the Modal component. |
314
- | `className` | string | Yes | See (1) below | Alternate CSS class names to apply to the Modal component. `twMerge` is used to apply these classes, so they reliably overwrite existing styles. |
315
- | `clickOutsideCloses` | boolean | Yes | `false` | When `true`, any mouse click outside of the Modal will close the Modal component. |
316
- | `displayClosingX` | boolean | Yes | `true` | When `true`, an "x" icon is displayed in the upper right of the Modal component that, when clicked, will close the component. |
317
- | `closeButtonText` | string | Yes | `'Close'` | The string value to display in the `Close` button. |
318
- | `continueButton` | boolean | Yes | `false` | When `true`, a "Continue" button is displayed in the Modal along with a "Close" button. |
319
- | `continueButtonText` | string | Yes | `'Continue'` | The string value to display in the `Continue` button. |
320
- | `continueButtonHandler` | () => void | Yes | | The function handler to execute when the `Continue` button is clicked. |
647
+ Full list of props below
321
648
 
322
- ---
649
+ ### Props
323
650
 
324
- ### (1) Variants
651
+ | Prop | Type | Optional | Default | Description |
652
+ | ----------- | -------- | -------- | -------- | ----------- |
653
+ | children | ReactNode | No | | This prop takes children content, i.e. html and content that becomes the body of the Modal. |
654
+ | 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. |
655
+ | onClose | () => void() | No | | This is the close handler for the Modal component. |
656
+ | title | string | No | | This is the title to display in the Modal component. |
657
+ | className | string | Yes | | Alternate CSS classnames to apply to the Modal component. twMerge is used to apply these classes, so they reliably overwrite existing styles. |
658
+ | clickOutsideCloses | boolean | Yes | | When true, any mouse click outside of the Modal will close the Modal component. |
659
+ | 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. |
660
+ | closeButtonText | string | Yes | | The string value to display in the Close button |
661
+ | continueButton | boolean | Yes | | When true, a 'Continue' button is displayed in the Modal along with a 'Close' button |
662
+ | continueButtonText | string | Yes | | The string value to display in the Continue button |
663
+ | continueButtonHandler | () => void | Yes | | The function handler to execute when the Continue button is clicked. |
325
664
 
326
- 1. **`default`**:
327
- ```css
328
- bg-white rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-none
329
- ```
330
665
 
331
- 2. **`darker`**:
332
- ```css
333
- bg-slate-600 rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-none text-slate-200
334
- ```
666
+ ### Example Usage
335
667
 
336
- 3. **`dark`**:
337
- ```css
338
- bg-zinc-800 rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-none text-slate-200
339
- ```
668
+ Basic Modal
340
669
 
670
+ ```jsx
671
+ <Modal
672
+ isOpen={isOpen}
673
+ onClose={() => setIsOpen(false)}
674
+ title="Test Modal"
675
+ clickOutsideCloses
676
+ >
677
+ <p>This is a Modal dialog that can be used for many varying
678
+ purposes, from informational messages to taking user input,
679
+ ideal for required quick tasks on a page.
680
+ </p>
681
+ </Modal>
682
+ ```
683
+
684
+ ### Dependencies
685
+
686
+ **_none_**
687
+
688
+
689
+ [Top of Page](#table-of-contents)
341
690
 
342
691
 
343
692
  <!-- S E L E C T ---------------------------------------------------------------------------- -->
344
693
 
345
694
  ## Select
346
695
 
347
- <!--
348
- <div style="color: red;"><strong>TODO:</strong>
349
- <ul><li>smaller vertical space (or larger list) results on pop-up off screen w/o auto-scroll being visible
350
- </li></ul>
351
- </div>-->
696
+ 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.
697
+
698
+ The **Select** component takes two required props (**options** and **setSelectedOption**) as well as four optional props (**className**, **error**, **label**, **optionsLabel**, and **variant**), in addition to any other html attributes a normal html element would use, for example an aria-tag.
699
+
700
+ Full list of props below
701
+
702
+ ### Props
703
+
704
+ | Prop | Type | Optional | Default | Description |
705
+ | ----------- | -------- | -------- | -------- | ----------- |
706
+ | className | string | Yes | (1) below | a group of alternate css classes that can be specified by the developer for use in the input element. |
707
+ | disabled | boolean | Yes | undefined | if true the Select component is placed in a disabled state |
708
+ | error | boolean | Yes | false | if true a red border is applied to the outside of the select component indicating an error state. |
709
+ | label | string | Yes | undefined | text used as the label for the input, i.e. 'Border Color' above |
710
+ | 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. |
711
+ | 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. |
712
+ | setSelectedOption | (string) => void | Yes | undefined | calls the function passed in as **`setSelectedOption`** with the selected **value** if present, otherwise with **name** |
713
+ | variant | string | Yes | undefined | The predefined variant of Select to display. Current options are 'default', 'MedCard', 'Outline', and 'nonHover' |
714
+ | width | string | Yes | | This prop is intended to like **`className`** take in css class name values. These are
715
+ intended though to only take class names relevant to the component width, as they will be applied to both the **button**
716
+ and the **drop down** elements of the **`Select`** component. For instance, the **`width`** prop is a good way to ensure that
717
+ the button and drop down are of the same width. Note the default classes below, i.e. widths specified on various break points. |
718
+
719
+ 1. Base CSS Classes
720
+
721
+ - **`outline-none outline-offset-0 flex justify-between items-center w-[292px] md:w-[343px] lg:w-[600px] h-14 border focus:outline-4 focus:outline-[#fa89f1] shadow-sm px-4 py-2 bg-white text-lg font-medium text-gray-700 hover:bg-gray-50 border-[#b3b3b3]`**
722
+
723
+ Separate Variant Styles
724
+
725
+ - default:
726
+ - **`hover:bg-gray-200 text-black hover:border-gray-400 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive h-12 mt-1 disabled:border-dha-mc-secondary-border disabled:border-2`**
727
+ - fill:
728
+ - **`hover:bg-[#0c2c8e] text-base text-white bg-[#092068] hover:border-gray-400 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive h-12 mt-1 disabled:border-dha-mc-secondary-border disabled:border-2 py-3 pl-[15px] pr-[9px]`**
729
+ - outline:
730
+ - **`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`**
731
+
732
+
733
+ ### Example Usage
734
+
735
+ ```jsx
736
+ <Select
737
+ label='Border Color'
738
+ optionsLabel='Choose a Color'
739
+ variant='MedCard'
740
+ options={[
741
+ {name: 'gray', value: 'border-gray-500'},
742
+ {name: 'Blue', value: 'border-blue-500'}
743
+ ]}
744
+ setSelectedOption={setSelectedBorder} />
745
+ ```
746
+
747
+
748
+
749
+ ### Dependencies
750
+
751
+ **_none_**
752
+
753
+ [Top of Page](#table-of-contents)
352
754
 
353
- The **select** component is actually a compound component made up of multiple smaller components and a Provider combined together to create a select dropdown. If matching width between the select component and drop-down is not important or desired, the Provider does not have to be used.
755
+ <!-- S I D E B A R N A V ---------------------------------------------------------------------------- -->
354
756
 
355
- Additional styling can be applied to this compound component via the **`<SelectTrigger>`**, **`<SelectContent>`**, and **`<SelectItem>`** components using their respective **`className`** props. Applying className styles to **`<SelectTrigger>`** will style the component as it sits in its default state on the page, and applying className styles to **`<SelectContent>`** will style the expanded portion of the component when selected. As above, className styling is applied using the **`cn()`** utility function, and intelligently overrides existing style types with those passed in.
757
+ ## SideBarNav
356
758
 
357
- To set the component **width**, use the **`widthClass`** prop on the **`Select`** component. This width value will be applied to not just in its closed state, but in its opened state as well. If width values are set in **Select**, **SelectTrigger**, and **SelectContent**, only the value set inside of the **Select** component will apply.
759
+ 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.
358
760
 
359
- If no width value is specified then the component will determine its own best width, though most likely the Select component and the drop-down width will be different.
761
+ Future versions should include search functionality.
360
762
 
361
- Note that as in the example below, select items can be divided into groups with their own respective labels if desired. See the example for more information.
763
+ version: string;
764
+ appName: string;
765
+ menuItems: ListItemProps[];
362
766
 
363
- Note: The **`<SelectContent>..</SelectContent>`** component contains a CSS class of **` mt-[-6px]`** inside of it that controls the spacing between the drop-down and the primary select menu. This value may have to be adjusted, for example applying **`className='mt-[-10px]'`** to the component to remove this spacing if it is present on your build platform.
767
+ Full list of props below
364
768
 
365
- ### Props common to &lt;Select&gt;, &lt;SelectContent&gt;, &lt;SelectItem&gt;, and &lt;SelectTrigger&gt;
769
+ ### Props
366
770
 
367
771
  | Prop | Type | Optional | Default | Description |
368
772
  | ----------- | -------- | -------- | -------- | ----------- |
369
- | className | string | Yes | undefined | used to apply new/additional styling to the component |
773
+ | appName | string | No | undefined | The application name to dispilay |
774
+ | 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. |
775
+ | clickOutsideCloses | boolean | Yes | **`false`** | clicking or tapping elsewhere on the application will close the SideBarNav |
776
+ | image | string | No | undefined | string path to the application logo to display |
777
+ | imageClassname | string | Yes | (2) below | a group of alternate classes that can be specified for the logo image, and applied to the **`img`** element |
778
+ | menu | boolean | Yes | false | when **`true`**, the default in-component hamburger menu is displayed and used to display or hide the SideBarNav |
779
+ | menuClassName | string | Yes | (3) below | alternate css classes to apply to the **`button`** element that makes up the hamburger menu |
780
+ | menuItems | ListItemProps[] | No | undefined, see (4) below | The menu items to display |
781
+ | version | string | No | undefined | The version number to display |
782
+
783
+
784
+ 1. Default Classes outer **`div`**
785
+
786
+ - w/o menu **`relative w-56 h-screen flex flex-col px-4 pb-4 pt-10 bg-white overflow-y-auto`**
787
+ - w/ menu, include also **`fixed z-20 right-0 top-0 translate-x-full transition-transform duration-300`**
788
+
789
+ 2. Default classes applied to **`img`** - **`border border-[#bbbabc] w-16 h-16 bg-[#eeeeef] ring-1`**
790
+
791
+ 3. Default classes applied to **`button`** - **`size-8 mb-4`**
792
+
793
+
794
+ ### Example Usage
795
+
796
+ ```jsx
797
+ import doctor from '../../assets/Doctor.png';
798
+ // ...
799
+
800
+ const menuItems = [
801
+ {
802
+ children: <>
803
+ <img className='max-h-[2em] max-w-[2em] pr-1 inline' src={arrowRight} alt='home link icon' />
804
+ <p className='inline hover:underline'>Accordion</p>
805
+ </>,
806
+ target: '/accordion'
807
+ },
808
+ {
809
+ children: <>
810
+ <img className='max-h-[2em] max-w-[2em] pr-1 inline' src={arrowRight} alt='home link icon' />
811
+ <p className='inline hover:underline'>Badge</p>
812
+ </>,
813
+ target: '/badge'
814
+ },
815
+ {
816
+ children: <>
817
+ <img className='max-h-[2em] max-w-[2em] pr-1 inline' src={arrowRight} alt='home link icon' />
818
+ <p className='inline hover:underline'>Breadcrumbs</p>
819
+ </>,
820
+ target: '/libraries/simple-ui/bread-crumbs-page'
821
+ },
822
+ ....
823
+ }
824
+
825
+ // in the return JSX
826
+ <SideBarNav
827
+ appName='A.C.M.E. Tools'
828
+ version="0.0.0"
829
+ menuItems={menuItems}
830
+ image={doctor}
831
+ clickOutsideCloses
832
+ menu
833
+ className='bg-slate-200 border border-slate-400 rounded-l-md h-full'
834
+ />
835
+ ```
836
+
837
+
838
+
839
+ ### Dependencies
840
+
841
+ **_none_**
370
842
 
371
- ### Props for &lt;Select&gt;
843
+ [Top of Page](#table-of-contents)
844
+
845
+ <!-- S K E L E T O N ---------------------------------------------------------------------------- -->
846
+
847
+ ## Skeleton
848
+
849
+ A Skeleton is used as a placeholder, showing a basic graphic representation of a page or resource while content is loading.
850
+
851
+ 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.
852
+
853
+ 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.
854
+
855
+ 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.
856
+
857
+ 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"`.
858
+
859
+ - `SkelCircle` - a small circle (i.e. a badge or icon)
860
+ - `SkelLine` - a line (i.e. text or content)
861
+ - `SkelSection` - a larger section on a page, or paragraph
862
+ - `SkelRow` - non graphical, used to force following items to a new row after using inline variants above. Usually not required.
863
+
864
+ Full list of props below
865
+
866
+ ### Props for Skeleton
372
867
 
373
868
  | Prop | Type | Optional | Default | Description |
374
869
  | ----------- | -------- | -------- | -------- | ----------- |
375
- | name | string | Yes | undefined | prop to set the name of the component. This has not been tested, and its usefulness is not known. |
376
- | onValueChange | (value) => void | Yes | undefined | a function to handle the value change event |
377
- | widthClass | string | Yes | undefined | take and apply width to the component. This takes classes applying to width only as it is applied in more than one place, and if additional non-width classes are added, the results are unpredictable |
870
+ | className | string | Yes | | This is used to apply user supplied styling to the `Skeleton` component. |
871
+ | variant | string | Yes | | Allows the user to enter a pre-defined variant that includes its own pre-defined styling |
378
872
 
379
- ### Props for &lt;SelectItem&gt;
873
+ ### Props for SkelCircle & SkelLine components
380
874
 
381
875
  | Prop | Type | Optional | Default | Description |
382
876
  | ----------- | -------- | -------- | -------- | ----------- |
383
- | value | string | Yes | undefined | used to set the value of for this item that is submitted to the **`onValueChange`** function. This is not the value displayed to the user. |
877
+ | className | string | Yes | | This is used to apply user supplied styling to the `SkelCircle` and `SkelLine` components. |
878
+ | 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. |
879
+
880
+ ### Props for SkelCircle & SkelLine components
881
+
882
+ | Prop | Type | Optional | Default | Description |
883
+ | ----------- | -------- | -------- | -------- | ----------- |
884
+ | className | string | Yes | | This is used to apply user supplied styling to the `SkelSection` and `SkelRow` components. |
885
+
886
+ Tailwind CSS Classes used for Skeleton components
887
+
888
+ - Skeleton
889
+ - **`flex flex-row flex-wrap animate-pulse h-48 w-56 pt-2`**
890
+ - SkelCircle & SkelLine
891
+ - **`rounded-lg bg-slate-300 h-6 inline-block mx-2 my-1 grow`**
892
+ - SkelSection
893
+ - **`rounded-lg bg-slate-300 grow h-24 my-1 mx-2`**
894
+ - SkelRow
895
+ - **`basis-full h-0`**
896
+
384
897
 
385
898
  ### Example Usage
386
899
 
387
- <details>
388
- <summary><span style="color: green;">Click to view example source code</span></summary>
900
+ Usage example for Example 1 below
389
901
 
390
902
  ```jsx
391
- import {
392
- Select,
393
- SelectTrigger,
394
- SelectGroup,
395
- SelectLabel,
396
- SelectValue,
397
- SelectContent,
398
- SelectItem,
399
- ComponentWidthProvider,
400
- SelectScrollDownButton,
401
- SelectScrollUpButton,
402
- } from '../components/ui/select';
403
-
404
- <ComponentWidthProvider>
405
- <Select
406
- widthClass="w-[180px]"
407
- onValueChange={(value) => console.log('Clicked! Value: ', value)}
408
- name="TestSelect"
409
- >
410
- <SelectTrigger className="">
411
- <SelectValue placeholder="Theme" />
412
- </SelectTrigger>
413
- <SelectContent>
414
- <SelectGroup>
415
- <SelectLabel>Words</SelectLabel>
416
- <SelectItem value="light">Light</SelectItem>
417
- <SelectItem value="dark">Dark</SelectItem>
418
- <SelectItem value="system">System</SelectItem>
419
- </SelectGroup>
420
- <SelectGroup>
421
- <SelectLabel>Numbers</SelectLabel>
422
- <SelectItem value="1">One</SelectItem>
423
- <SelectItem value="2">Two</SelectItem>
424
- <SelectItem value="3">Three</SelectItem>
425
- <SelectItem value="4">Four</SelectItem>
426
- <SelectItem value="5">Five</SelectItem>
427
- <SelectItem value="42">Answer to Life</SelectItem>
428
- </SelectGroup>
429
- <SelectGroup>
430
- <SelectLabel>Colors</SelectLabel>
431
- <SelectItem value="red">Red</SelectItem>
432
- <SelectItem value="yellow">Yellow</SelectItem>
433
- <SelectItem value="blue">Blue</SelectItem>
434
- <SelectItem value="brown">Brown</SelectItem>
435
- <SelectItem value="green">Green</SelectItem>
436
- <SelectItem value="orange">Orange</SelectItem>
437
- <SelectItem value="purple">Purple</SelectItem>
438
- </SelectGroup>
439
- </SelectContent>
440
- </Select>
441
- </ComponentWidthProvider>;
903
+ import { Skeleton, SkelCircle, SkelLine, SkelRow, SkelSection } from '@dhasdk/simple-ui'
904
+ // ...
905
+ <Skeleton>
906
+ <SkelCircle inline /><SkelLine inline />
907
+ <SkelLine />
908
+ <SkelSection />
909
+ </Skeleton>
442
910
  ```
443
911
 
444
- </details>
912
+ Usage example for Example 2 below
913
+
914
+ ```jsx
915
+ import { Skeleton, SkelCircle, SkelLine, SkelRow, SkelSection } from '@dhasdk/simple-ui'
916
+ // ...
917
+ <Skeleton>
918
+ <SkelLine className="grow-0 basis-2/12" inline />
919
+ <SkelLine className="grow-0 basis-2/12" inline />
920
+ <SkelLine />
921
+ <SkelSection />
922
+ </Skeleton>
923
+ ```
445
924
 
446
925
  ### Dependencies
447
926
 
448
- **`@radix-ui/react-select`**
927
+ **_none_**
928
+
929
+ [Top of Page](#table-of-contents)
930
+
931
+
932
+ <!-- S T A T U S ---------------------------------------------------------------------------- -->
933
+
934
+ ## Status
935
+
936
+ 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.
937
+
938
+ 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.
939
+
940
+ 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.
941
+
942
+ The `className` prop can be used to add alternate styling to the outer div, i.e. `border-blue-700 bg-blue-200`. Likewise, the `imageClasses` prop can be used to provide alternate styling to the div containing the image, and the `childClasses` prop can provide alternate styling for the child div that contains the text, i.e. `text-blue-700`
943
+
944
+ `image` and `children` are the final two props, and are both of type `ReactNode`.
945
+
946
+ Full list of props below
947
+
948
+ ### Props
949
+
950
+ | Prop | Type | Optional | Default | Description |
951
+ | ----------- | -------- | -------- | -------- | ----------- |
952
+ | children | string | No | | This prop takes children content, i.e. html and content that becomes the body of the Status. |
953
+ | variant | string | No | 'available' | The predefined variant of Status to display. Predefined variants are `available`, `inProgress`, and `notAvailable` |
954
+ | 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. |
955
+ | childClasses | string | Yes | (2) below | This prop takes in alternate classes to apply style to the `div` that contains the child content. |
956
+ | image | ReactNode | Yes | | This prop takes type `ReactNode`, and is used to display a custom user supplied image. See usage examples above for more. |
957
+ | imageClasses | string | Yes | (3) below | Alternate CSS classes that are applied to the div containing the childe div that contains the Status component image. |
958
+
959
+ 1. className
960
+
961
+ **`h-[45px] px-4 py-3 bg-green-50 rounded-[100px] border border-green-700 justify-center items-center gap-2 inline-flex`**
962
+
963
+ 2. childClasses
964
+
965
+ **`text-green-900 text-lg font-normal font-['Arial']`**
966
+
967
+ 3. imageClasses
968
+
969
+ **`w-5 h-5 relative overflow-hidden`**
970
+
971
+ ### Example Usage
972
+
973
+ Available variant
974
+
975
+ ```jsx
976
+ <Status
977
+ className='me-4'>
978
+ Available</Status>
979
+ ```
980
+
981
+ inProgress variant
982
+
983
+ ```jsx
984
+ <Status
985
+ className='me-4'
986
+ variant='inProgress'>
987
+ In Progress</Status>
988
+ ```
989
+
990
+ notAvailable variant
991
+
992
+ ```jsx
993
+ <Status
994
+ className='me-4'
995
+ variant='inProgress'>
996
+ In Progress</Status>
997
+ ```
998
+
999
+ Custom variant
1000
+
1001
+ ```jsx
1002
+ <Status
1003
+ image={ <img src={tune}
1004
+ alt='information' /> }
1005
+ className='border-blue-700 bg-blue-200'
1006
+ childClasses='text-blue-700'
1007
+ >
1008
+ Custom
1009
+ </Status>
1010
+ ```
1011
+
1012
+ ### Dependencies
1013
+
1014
+ **_none_**
1015
+
1016
+ [Top of Page](#table-of-contents)
1017
+
1018
+ <!-- T A B S --------------------------------------------------------------------------------- -->
1019
+
1020
+ ## Tabs
1021
+
1022
+ Tabs component lets the user split the UI into independent pieces, and view each piece in isolation.
1023
+
1024
+ This component has one required prop, **tabs**, which contains the content of the various tabs as type ReactNode. Optional props are **className**, **containerClassName**, and **variant**.
1025
+
1026
+ Full list of props below
1027
+
1028
+ ### Props
1029
+
1030
+ | Prop | Type | Optional | Default | Description |
1031
+ | ----------- | -------- | -------- | -------- | ----------- |
1032
+ | className | string | Yes | undefined | |
1033
+ | containerClassName | string | Yes | undefined | |
1034
+ | tabs | {id: string; label: string; content: ReactNode;}[] | Yes | undefined | An array of |
1035
+ | variant | string | Yes | 'default' | The predefined variant of Tabs to display. Current options are 'default', 'outline', and 'filled' |
1036
+
1037
+ ### Example Usage
1038
+
1039
+ Tabs - very simple example
1040
+
1041
+ ```jsx
1042
+ <Tabs tabs={[
1043
+ {id: 'tab1', label: 'Tab 1', content: <p>I am a tab!</p>},
1044
+ {id: 'tab2', label: 'Tab 2', content: <p>I am a 2nd tab!</p>}
1045
+ ]} />
1046
+ ```
1047
+
1048
+ Tabs - more complicated example
1049
+
1050
+ ```jsx
1051
+
1052
+ const TabsContent1 = () => {
1053
+ return(
1054
+ <>
1055
+ <p>Test Data 1</p>
1056
+ <ul className="list-disc mt-2 ms-4">
1057
+ <li>Seattle</li>
1058
+ <li>Tacoma</li>
1059
+ <li>Olympia</li>
1060
+ <li>Bellevue</li>
1061
+ <li>Redmond</li>
1062
+ </ul>
1063
+ </>
1064
+ )
1065
+ };
1066
+
1067
+ const TabsContent2 = () => {
1068
+ return(
1069
+ <>
1070
+ <p>Test Data 2</p>
1071
+ <ul className="list-disc mt-2 ms-4">
1072
+ <li>Tokyo - Lorem ipsum dolor sit amet, consectetur adipiscing elit</li>
1073
+ <li>Paris - Lorem ipsum dolor sit amet, consectetur adipiscing elit</li>
1074
+ <li>London - Lorem ipsum dolor sit amet, consectetur adipiscing elit</li>
1075
+ <li>Sydney - Lorem ipsum dolor sit amet, consectetur adipiscing elit</li>
1076
+ <li>Honolulu - Lorem ipsum dolor sit amet, consectetur adipiscing elit</li>
1077
+ </ul>
1078
+ </>
1079
+ )
1080
+ };
1081
+
1082
+ const tabExample = [
1083
+ {
1084
+ id: 'tab1',
1085
+ label: 'Tab 1',
1086
+ content: <TabsContent1/>,
1087
+ },
1088
+ {
1089
+ id: 'tab2',
1090
+ label: 'Tab 2',
1091
+ content: <TabsContent2/>,
1092
+ }
1093
+ ]
1094
+ // ...
1095
+ return {
1096
+ ...
1097
+ <Tabs tabs={tabExample} />
1098
+ ...
1099
+ }
1100
+ ```
1101
+
1102
+ ### Dependencies
1103
+
1104
+ **_none_**
1105
+
1106
+
1107
+
1108
+ [Top of Page](#table-of-contents)
449
1109
 
450
1110
  <!-- T O G G L E -------------------------------------------------------------------- -->
451
1111
 
452
1112
  ## Toggle
453
1113
 
454
- className, defaultChecked = false, onCheckedChange, ...props }, ref
1114
+ 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.
455
1115
 
456
- The **Toggle** component is a toggle component that allows users to select/de-select an item or value. Like other components, it takes in various props for configuration, including a default boolean value for checked/unchecked, and a handler function that is called when the value is changed or toggled. In addition, a **`ref`** can be assigned to this component also. With respect to CSS, specified classnames are combined using **`twMerge`**/**`cn`**, so prior values are reliably overwritten.
1116
+ 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'.
1117
+
1118
+ 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.
457
1119
 
458
1120
  ### Props
459
1121
 
460
1122
  | Prop | Type | Optional | Default | Description |
461
1123
  | ----------- | -------- | -------- | -------- | ----------- |
462
- | className | string | Yes | undefined | takes additional classnames to add/change styling |
463
- | defaultChecked | boolean | Yes | false | indicates whether the toggle is in a checked or unchecked state when first displayed |
464
- | onCheckedChange | (checked: boolean) => void | Yes | undefined | callback function that is called with the new value of `checked` whenever it changes. |
1124
+ | className | string | Yes | (1) below | alternate css classes to add/change styling of button element inside component |
1125
+ | classNameButton | string | Yes | (1) below | alternate css classes to add/change styling of div used inside button/toggle |
1126
+ | defaultChecked | boolean | Yes | **`false`** | sets default state as checked or unchecked state when first displayed |
1127
+ | disabled | boolean | Yes | **`false`** | sets disabled state of Toggle component |
1128
+ | 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. |
465
1129
  | ...props | string | Yes | undefined | takes additional props that are not specifically defined in the component, i.e. **`aria-label`** |
466
1130
  | ref | string | Yes | undefined | ref is exposed as a prop, and can be assigned and used on this component as normal |
467
-
1131
+ | variant | string | Yes | 'default' | The predefined variant of Badge to display. Options are: 'default', 'Outline', 'nonHover', and 'MedCard'. |
1132
+
1133
+
1134
+ (1) Base CSS Classes
1135
+ - w-16 h-8 flex items-center p-1 rounded-full cursor-pointer transition-colors duration-300
1136
+ Toggle portion Base CSS Classes
1137
+ - bg-white w-6 h-6 rounded-full shadow-md transform transition-transform duration-300
1138
+
1139
+
1140
+ Separate Variant Styles
1141
+
1142
+ - default:
1143
+ - classes: 'bg-gray-300 hover:bg-gray-400'
1144
+ - toggledClasses: 'bg-[#092068] hover:bg-blue-700'
1145
+ - buttonClasses: 'translate-x-0'
1146
+ - toggledButtonClasses: 'translate-x-8'
1147
+ - Outline:
1148
+ - classes: 'bg-slate-200 border-2 border-blue-700 hover:bg-slate-300'
1149
+ - toggledClasses: 'bg-blue-500 border-2 border-blue-700 hover:bg-blue-400'
1150
+ - buttonClasses: 'translate-x-0'
1151
+ - toggledButtonClasses: 'translate-x-8'
1152
+ - nonHover:
1153
+ - classes: 'bg-gray-300'
1154
+ - toggledClasses: 'bg-[#092068]'
1155
+ - buttonClasses: 'translate-x-0'
1156
+ - toggledButtonClasses: 'translate-x-8'
1157
+ - MedCard:
1158
+ - classes: 'bg-[#E3EBF3] border-2 border-[#0256AB]'
1159
+ - toggledClasses: 'bg-[#0256AB] border-2 border-[#0256AB]'
1160
+ - buttonClasses: 'translate-x-0'
1161
+ - toggledButtonClasses: 'translate-x-8'
468
1162
 
469
1163
  ### Example Usage
470
1164
 
471
- Usage can be viewed inside the storybook app (**`npm run storybook`**), and an example is below. The following logs the checked state value (true or false) to the console when toggled.
472
-
473
1165
  ```jsx
474
- <Toggle
475
- defaultChecked={false}
476
- onCheckedChange={(checked: boolean) => console.log('checked: ', checked)}
477
- />
1166
+ <Toggle
1167
+ onCheckedChange={(checked: boolean) => {
1168
+ setColor(checked ?
1169
+ 'border-green-500' : 'border-gray-400');
1170
+ console.log(checked);}
1171
+ }
1172
+ variant={badgeVariant} />
478
1173
  ```
479
1174
 
480
1175
  ### Dependencies
481
1176
 
482
- **`@radix-ui/react-switch`**
1177
+ **_none_**
1178
+
1179
+
1180
+ [Top of Page](#table-of-contents)