@dhasdk/simple-ui 0.0.12 → 0.0.20

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