@dhasdk/simple-ui 1.0.7 → 1.0.9

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,15 +1,23 @@
1
1
  # simple-ui
2
2
 
3
- This library was generated with [Nx](https://nx.dev) on React 18.x.
3
+ This library was generated with [Nx](https://nx.dev) on React 19.1
4
4
 
5
- ## <span style="color: orange;">*This library is under active development and not ready for production use\*</span>
5
+ ## <span style="color: orange;">*This library is under active development and not ready for external production use\*</span>
6
6
 
7
+ <!--
8
+ AppointmentPicker
9
+ ProgressBar
10
+ RadioGroup
11
+ Search
12
+ Tooltip
13
+ -->
7
14
 
8
15
 
9
16
  ## Table of Contents
10
17
 
11
18
  - [Installation](#installation-and-setup)
12
19
  - [Accordion](#accordion)
20
+ - [AppointmentPicker](#appointment-picker)
13
21
  - [Badge](#badge)
14
22
  - [BreadCrumbs](#breadcrumbs)
15
23
  - [Button](#button)
@@ -22,18 +30,23 @@ This library was generated with [Nx](https://nx.dev) on React 18.x.
22
30
  - [List](#list)
23
31
  - [Modal](#modal)
24
32
  - [Pill](#pill)
33
+ - [ProgressBar](#progress-bar)
34
+ - [RadioGroup](#radio-group)
35
+ - [Search](#search)
25
36
  - [SectionHeader](#sectionheader)
26
37
  - [Select](#select)
38
+ - [Shield](#shield)
27
39
  - [SideBarNav](#sidebarnav)
28
40
  - [Skeleton](#skeleton)
29
41
  - [Slider](#slider)
30
42
  - [Status](#status)
31
43
  - [Tabs](#tabs)
32
44
  - [Toggle](#toggle)
45
+ - [Tooltip](#tooltip)
46
+
47
+ <!-- ## Quick Notes: -->
33
48
 
34
- ## Quick Notes:
35
49
 
36
- - 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).
37
50
 
38
51
  <!-- I N S T A L L A T I O N ----------------------------------------------------------------------------------- -->
39
52
 
@@ -49,9 +62,9 @@ This library was generated with [Nx](https://nx.dev) on React 18.x.
49
62
 
50
63
  - Add **`node_modules/@dhasdk/**/*.{js,jsx}`** (or similar) to the **content** block inside your **`tailwind.config.ts`** file.
51
64
 
52
- 3. Open the page that you are going to place the **dha-sdk/simple-ui** component, and do the following:
65
+ 3. Open the page that you are going to place the **dhasdk/simple-ui** component, and do the following:
53
66
 
54
- - At the top of the file, import your desired component from **'@dha-sdk'**, i.e. if you are using the **Badge** component, then:
67
+ - At the top of the file, import your desired component from **'@dhasdk'**, i.e. if you are using the **Badge** component, then:
55
68
  - **`import { Badge } from '@dhasdk/simple-ui';`**
56
69
  - Elsewhere in your file, use the component as documented below
57
70
 
@@ -138,6 +151,58 @@ Finally, if Accordion props are specified inside the parent component, those val
138
151
 
139
152
  <!-- E N D A C C O R D I O N -->
140
153
 
154
+ <!-- A P P O I N T M E N T P I C K E R ----------------------------------------------------------------- -->
155
+
156
+ ## Appointment Picker
157
+
158
+ The **AppointmentPicker** component allows a user to make a single selection from a list of multiple times.
159
+
160
+ This component takes multiple optional props in addition to any other html attributes a normal html element would use, for example an **aria-tag**.
161
+
162
+
163
+ ### Props for AppointmentPicker
164
+
165
+ | Prop | Type | Optional | Default | Description |
166
+ | ----------- | -------- | -------- | -------- | -------------------------------------------- |
167
+ | className | string | Yes | see below | a group of alternate css classes that can be specified by the developer for use in the dropdown button portion of the component. |
168
+ | classNameContainer | string | Yes | '' | a group of alternate css classes that can be specified by the developer for use in the parent container of the component. |
169
+ | interval | 'hour' \| 'half-hour' \| 'quarter-hour' | Yes | **`'hour'`** | Controls the interval between times, for example 'hour' intervals would produce results like 01:00, 02:00 etc, while half hour and quarter hour would produce gaps of 30 and 15 minutes respectively. |
170
+ | timeFormat | '12hr' \| '24hr' | Yes | **`'24hr'`** | Controls whether the times are listed as military or standard 12 hour, am/pm times. (13:00 vs 1:00pm & 03:00 vs 3:00am) |
171
+ | hourRange | [number, number] | Yes | **`undefined`** | If specified, only hours within and including the range specified will be available for selection. |
172
+ | label | string | Yes | **`undefined`** | text used as the label for the input, i.e. 'Pick a time (hourly)' above |
173
+ | optionsLabel | string | Yes | **`'Select a time'`** | appears as the label in the AppointmentPicker component, i.e. 'Select a time' above. Note, this is not the label above the component. |
174
+ | setSelectedOption | **`(string) => void`** | No | **`undefined`** | calls the given function with the selected value if present, otherwise with name |
175
+ | variant | **`string`** | Yes | **`undefined`** | The predefined variant of Select to display. Current options are 'default', 'fill', and 'outline' |
176
+ | width | **`string`** | Yes | | This prop is intended to, like className, take in css class name values. These are intended though to only take class names relevant to the component width, as they will be applied to both the button and the drop down elements of the AppointmentPicker component. For instance, the width prop is a good way to ensure that the button and drop down are of the same width. Pay attention to the default classes below. |
177
+
178
+
179
+ ***Base CSS Classes***
180
+
181
+ **`outline-hidden outline-offset-0 flex justify-between items-center w-[292px] md:w-[343px] lg:w-[600px] h-14 border focus:outline-4 focus:mb-2 focus:outline-[#fa89f1] shadow-sm pl-4 pr-2 py-2 bg-white text-base md:text-lg font-medium text-gray-700 hover:bg-gray-50 border-[#b3b3b3] h-12 mt-1 font-["Arial"] Separate Variant Styles`**
182
+
183
+ ***default:***
184
+ **`hover:bg-gray-200 text-black hover:border-gray-400 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive disabled:border-dha-mc-secondary-border disabled:border-2`**
185
+ ***fill:***
186
+ **`hover:bg-[#0c2c8e] text-white bg-[#092068] hover:border-gray-400 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive disabled:border-dha-mc-secondary-border disabled:border-2 py-3`**
187
+ ***outline:***
188
+ **`bg-white text-[#808080] disabled:border-dha-mc-secondary-border disabled:text-dha-mc-checkbox-inactive`**
189
+
190
+
191
+ ### Example Usage
192
+
193
+ ```jsx
194
+ <AppointmentPicker label="Pick a time (half-hour)" interval='half-hour' />
195
+ ```
196
+
197
+ ### Dependencies
198
+
199
+ **_none_**
200
+
201
+
202
+ [Top of Page](#table-of-contents)
203
+
204
+ <!-- E N D A P P O I N T M E N T P I C K E R -->
205
+
141
206
 
142
207
  <!-- B A D G E ----------------------------------------------------------------------------------- -->
143
208
 
@@ -165,19 +230,19 @@ This div is also styled using the tailwind **`twMerge()`** utility, so custom cl
165
230
 
166
231
  1. Variants
167
232
  - success
168
- - className: **`w-[79px] h-[26px] px-3 py-1 bg-[#d6f4d5] rounded-[40px] outline outline-1 outline-offset-[-1px] outline-[#387740] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
233
+ - className: **`w-[79px] h-[26px] px-3 py-1 bg-[#d6f4d5] rounded-[40px] outline outline-1 -outline-offset-1 outline-[#387740] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
169
234
  - classNameChildren: **`text-[#387740] text-xs font-normal font-['Arial'] leading-[18px] md:text-md md:leading-normal lg:text-lg lg:leading-[27px`**
170
235
  - classNameImage: **`relative size-2.5 mb-0.5 me-1.5 md:size-3.5 md:me-2 lg:size-4 lg:mb-0.5 lg:me-2.5 lg:ms-1`**
171
236
  - caution
172
- - className: **`w-[79px] h-[26px] px-3 py-1 bg-[#fff1be] rounded-[40px] outline outline-1 outline-offset-[-1px] outline-[#966121] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
237
+ - className: **`w-[79px] h-[26px] px-3 py-1 bg-[#fff1be] rounded-[40px] outline outline-1 -outline-offset-1 outline-[#966121] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
173
238
  - classNameImage: **`relative size-2.5 mb-0.5 me-1.5 md:size-3.5 md:me-2 lg:size-4 lg:mb-0.5 lg:me-2.5 lg:ms-1`**
174
239
  - classNameChildren: **`text-[#966222] text-xs font-normal font-['Arial'] leading-[18px] md:text-base md:leading-normal lg:text-lg lg:leading-[27px}`**
175
240
  - danger
176
- - className: **`w-[79px] h-[26px] px-3 py-1 bg-[#f4c2c2] rounded-[40px] outline outline-1 outline-offset-[-1px] outline-[#a22b23] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
241
+ - className: **`w-[79px] h-[26px] px-3 py-1 bg-[#f4c2c2] rounded-[40px] outline outline-1 -outline-offset-1 outline-[#a22b23] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
177
242
  - classNameImage: **`relative size-2.5 mb-0.5 me-1.5 md:size-3.5 md:me-2 lg:size-4 lg:mb-0.5 lg:me-2.5 lg:ms-1`**
178
243
  - classNameChildren: **`text-[#A32C24] text-xs font-normal font-['Arial'] leading-[18px] md:text-base md:leading-normal lg:text-lg lg:leading-[27px]`**
179
244
  - disabled
180
- - className: **`w-[79px] h-[26px] px-3 py-1 rounded-[40px] outline outline-1 outline-offset-[-1px] outline-[#394150] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
245
+ - className: **`w-[79px] h-[26px] px-3 py-1 rounded-[40px] outline outline-1 -outline-offset-1 outline-[#394150] inline-flex justify-center items-center gap-0 md:w-[113px] md:h-[36px] md:px-5 md:py-1.5 md:gap-0.5 lg:w-[133px] lg:h-[43px] lg:px-6 lg:py-2 lg:gap-0`**
181
246
  - classNameImage: **`relative size-2.5 mb-0.5 me-1.5 md:size-3.5 md:me-2 lg:size-4 lg:mb-0.5 lg:me-2.5 lg:ms-1`**
182
247
  - classNameChildren: **`text-[#394150] text-xs font-normal font-['Arial'] leading-[18px] md:text-md md:leading-normal lg:text-lg lg:leading-[27px]`**
183
248
 
@@ -309,7 +374,7 @@ A reference can also be created and passed to the button component, and the comp
309
374
 
310
375
  - Base CSS Classes
311
376
 
312
- - **`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-[8px] md:py-[12px] lg:py-[16px] h-[40px] md:h-[48px] lg:h-[56px]`**
377
+ - **`inline-flex items-center justify-center whitespace-nowrap rounded-md ring-offset-background transition-colors focus-visible:outline-hidden font-["Arial"] disabled:pointer-events-none text-sm md:text-base lg:text-lg disabled:opacity-50 px-6 py-[8px] md:py-[12px] lg:py-[16px] h-[40px] md:h-[48px] lg:h-[56px]`**
313
378
 
314
379
  - Additional Classes per variant
315
380
  - 'default' - **`border-2 border-gray-300 rounded-md bg-gray-200 hover:bg-slate-400 text-black text-lg hover:text-white hover:border-slate-600 disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive focus:border-black disabled:border-dha-mc-bottom-nav-background disabled:border-2 py-0 md:py-0 lg:py-0 h-[48px] mt-1`**
@@ -975,9 +1040,9 @@ Full list of props below
975
1040
 
976
1041
  #### Default classes per Variant
977
1042
 
978
- - default: **`bg-white rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-none`**
979
- - darker: **`bg-slate-600 rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-none text-slate-200`**
980
- - dark: **`bg-zinc-800 rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-none text-slate-200`**
1043
+ - default: **`bg-white rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-hidden`**
1044
+ - darker: **`bg-slate-600 rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-hidden text-slate-200`**
1045
+ - dark: **`bg-zinc-800 rounded-lg shadow-lg w-full max-w-lg p-6 focus:outline-hidden text-slate-200`**
981
1046
 
982
1047
  ### Example Usage
983
1048
 
@@ -1030,7 +1095,7 @@ Full list of props below
1030
1095
 
1031
1096
  1. Default classNames
1032
1097
 
1033
- - **`relative inline-flex items-center justify-center whitespace-nowrap rounded-3xl transition-colors focus-visible:outline-none font-[`Arial`] disabled:pointer-events-none disabled:opacity-50 py-[10px] md:py-[14px] lg:py-[16px] border-2 border-[#092068] text-[#092068] text-lg bg-white hover:bg-[#D1DBFB] active:bg-[#9fc5f0] focus:bg-white disabled:bg-[#939194] disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive focus:border-black disabled:border-dha-mc-secondary-border disabled:border-2 py-0 md:py-0 lg:py-0 h-[48px] mt-1`**
1098
+ - **`relative inline-flex items-center justify-center whitespace-nowrap rounded-3xl transition-colors focus-visible:outline-hidden font-[`Arial`] disabled:pointer-events-none disabled:opacity-50 py-[10px] md:py-[14px] lg:py-[16px] border-2 border-[#092068] text-[#092068] text-lg bg-white hover:bg-[#D1DBFB] active:bg-[#9fc5f0] focus:bg-white disabled:bg-[#939194] disabled:bg-dha-mc-bottom-nav-background disabled:text-dha-mc-checkbox-inactive focus:border-black disabled:border-dha-mc-secondary-border disabled:border-2 py-0 md:py-0 lg:py-0 h-[48px] mt-1`**
1034
1099
 
1035
1100
 
1036
1101
  ### Example Usage
@@ -1055,6 +1120,276 @@ Basic Pill
1055
1120
  [Top of Page](#table-of-contents)
1056
1121
 
1057
1122
 
1123
+ <!-- P R O G R E S S B A R ------------------------------------------------------------------------ -->
1124
+
1125
+ ## Progress Bar
1126
+
1127
+ The **`ProgressBar`** component is used to display the number of steps in a task, as well as styling to indicate completed and current steps.
1128
+
1129
+ This component takes multiple required and optional props in addition to any other html attributes a normal html element would use, for example an **`aria-tag`**.
1130
+
1131
+ Full list of props below
1132
+
1133
+ ### Props
1134
+
1135
+ | Prop | Type | Optional | Default | Description |
1136
+ | ----------- | -------- | -------- | -------- | ----------- |
1137
+ | totalSteps | **`number`** | No | **`undefined`** | Total number of steps to be displayed in the progress bar. |
1138
+ | currentStep | **`number`** | No | **`undefined`** | Current (active) step. |
1139
+ | isStep | **`boolean`** | Yes | **`true`** | Controls whether steps inside the circle are displayed as numbers, or if false, displayed as checkmarks/dashes. |
1140
+ | classNameArrowColor | **`string`** | Yes | **`fill-[#305B25]`** | Controls the color of the arrow that points from last completed step to current step. |
1141
+ | classNameBorderColor | **`string`** | Yes | **`border-[#305B25]`** | Controls the color of the border around each completed step's circle. |
1142
+ | classNameFillColor | **`string`** | Yes | **`bg-green-500`** | Controls the fill color of each completed step's circle. |
1143
+ | classNameGradient | **`string`** | Yes | **`from-[#305B25] to-[#5AAB46]`** | Controls the colors used in the gradient for the bars between each completed step. |
1144
+
1145
+ 1. Base CSS Classes
1146
+
1147
+ - circle for each step **(note use of classNameFillColor & classNameBorderColor)**:
1148
+
1149
+ **`flex items-center justify-center size-8 rounded-full border-[3px] border-gray-300 text-gray-500`**
1150
+ **`${isActive && ${classNameFillColor} ${classNameBorderColor}}`**
1151
+ **`${!isActive ? 'text-gray-400' : 'text-white'}`**
1152
+
1153
+ - bar between steps **(twMerged w/ classNameGradient)**:
1154
+
1155
+ **`relative -z-10 -mx-[0.1em] flex-1 h-1 bg-gray-300 bg-linear-to-r from-50%`**
1156
+
1157
+
1158
+ ### Example Usage
1159
+
1160
+ Basic Progress Bar
1161
+
1162
+ ```jsx
1163
+ <ProgressBar totalSteps={3} currentStep={1}/>
1164
+ ```
1165
+
1166
+ Progress Bar with CheckMarks, options, and completions
1167
+
1168
+ ```jsx
1169
+ <ProgressBar totalSteps={3} currentStep={1}/>
1170
+ ```
1171
+
1172
+
1173
+ ### Dependencies
1174
+
1175
+ **_none_**
1176
+
1177
+
1178
+ [Top of Page](#table-of-contents)
1179
+
1180
+
1181
+
1182
+ <!-- R A D I O G R O U P ------------------------------------------------------------------------ -->
1183
+
1184
+ ## Radio Group
1185
+
1186
+ The **`RadioGroup`** component allows a user to select one option from a list of radio buttons.
1187
+
1188
+ This component takes multiple optional props in addition to any other html attributes a normal html element would use, for example an **`aria-tag`**.
1189
+
1190
+ See **example usage** below for an example of retrieving the selected radio item.
1191
+
1192
+
1193
+ Full list of props below
1194
+
1195
+ ### Props
1196
+
1197
+ | Prop | Type | Optional | Default | Description |
1198
+ | ----------- | -------- | -------- | -------- | ----------- |
1199
+ | title | **`string`** | Yes | **`undefined`** | A title for the radio group component. Will be displayed above the radio group. |
1200
+ | classNameContainer | **`string`** | Yes | **`undefined`** | a group of alternate css classes that can be specified by the developer for use in the container (fieldset) element. |
1201
+ | classNameInput | **`string`** | Yes | see below | a group of alternate css classes that can be specified by the developer for use in the input element of the component. |
1202
+ | classNameLabel | **`string`** | Yes | see below | a group of alternate css classes that can be specified by the developer for use in the label element of the component. |
1203
+ | options | **`string`** | No | | Array of RadioOption objects that define the options available for selection. |
1204
+
1205
+ 1. Base CSS Classes
1206
+
1207
+ - label:
1208
+
1209
+ **`flex items-center gap-1 cursor-pointer border border-black disabled ? opacity-50 cursor-not-allowed`**
1210
+
1211
+ - input:
1212
+
1213
+ **`appearance-none w-4 h-4 rounded-[50%] border border-black bg-clip-content checked:bg-black checked:p-[2.5px] checked:border-black`**
1214
+
1215
+
1216
+ ### Example Usage
1217
+
1218
+ Basic RadioGroup
1219
+
1220
+ ```jsx
1221
+ const radioOptions: RadioOption[] = [
1222
+ {
1223
+ id: 0,
1224
+ label: 'Option One',
1225
+ value:'some-value'
1226
+ },
1227
+ {
1228
+ id: 1,
1229
+ label: 'Option Two',
1230
+ value: 'some-value2'
1231
+ }
1232
+ ]
1233
+
1234
+ // somewhere in code ...
1235
+ const radio = document.getElementById("1") as HTMLInputElement;
1236
+ console.log(radio?.checked);
1237
+
1238
+ <RadioGroup title="Radio Title" options={radioOptions} />
1239
+ ```
1240
+
1241
+ RadioGroup w/ 5 options
1242
+
1243
+ ```jsx
1244
+
1245
+ const fiveRadioOptions: RadioOption[] = [
1246
+ {
1247
+ id: 0,
1248
+ label: 'Option One',
1249
+ value: 'some-value'
1250
+ },
1251
+ {
1252
+ id: 1,
1253
+ label: 'Option Two',
1254
+ value: 'some-value2'
1255
+ },
1256
+ {
1257
+ id: 2,
1258
+ label: 'Option Three',
1259
+ value: 'some-value3'
1260
+ },
1261
+ {
1262
+ id: 3,
1263
+ label: 'Option Four',
1264
+ value: 'some-value4'
1265
+ },
1266
+ {
1267
+ id: 4,
1268
+ label: 'Option Five',
1269
+ value: 'some-value5'
1270
+ },
1271
+ ]
1272
+
1273
+ <RadioGroup title="Radio Title" options={fiveRadioOptions} />
1274
+ ```
1275
+
1276
+ Example checking radio items for checked state
1277
+
1278
+ ```tsx
1279
+ const radio = document.getElementById("1") as HTMLInputElement;
1280
+ console.log(radio?.checked);
1281
+ ```
1282
+
1283
+ ### Dependencies
1284
+
1285
+ **_none_**
1286
+
1287
+
1288
+ [Top of Page](#table-of-contents)
1289
+
1290
+
1291
+ <!-- S E A R C H ------------------------------------------------------------------------ -->
1292
+
1293
+ ## Search
1294
+
1295
+ The **`Search`** component is used to allow a user to search your sites content via a developer provided data file. The default behavior is to present results in real time as the user types, presenting matching strings organized by pages. The user can tab into the results list or click on a page title in the results list to be taken to a the relevant page or location.
1296
+
1297
+ Additional behavior provides for the return of the search results to a dev provided function on 'Enter' or clicking the search icon. This is demonstrated inside the 2nd example in the drop down below. See documentation for additional options
1298
+
1299
+ The **`Search`** component presents a responsive Input element styled with a search icon that changes appearance as appropriate based on screen size. On mobile and tablet sized screens an 'X' icon is present that clears the search bar content.
1300
+
1301
+ This component is combined with a required input data file that the component uses to source its data. The data must match the SearchDataItem interface, shown below:
1302
+
1303
+ Full list of props below
1304
+
1305
+ ### Props
1306
+
1307
+ | Prop | Type | Optional | Default | Description |
1308
+ | ----------- | -------- | -------- | -------- | ----------- |
1309
+ | airaLabel | **`string`** | Yes | **`'Search'`** | The aria-label to assign to this Search component |
1310
+ | className | **`string`** | Yes | see (1) below | alternate css classes to add/change styling of the div that wraps the input element. |
1311
+ | iconLink | **`boolean`** | Yes | **`{false}`** | If set to true, a search icon is displayed that when clicked will expand into a wider Search component. |
1312
+ | searchableData | **`SearchDataItem[]`** | No | undefined | The data that the search component uses as its data source. This data must conform to the SearchDataItem interface. An example data file is shown above. |
1313
+ | setSearchResults | **`(DataSearchResults) => return void`** | Yes |undefined | If the use case entails sending the user to a separate results page, provide a function here that takes those search and performs the desired action. See (2) below for the DataSearchResults definition. |
1314
+
1315
+ 1. Default className
1316
+
1317
+ **`grow appearance-none h-8 md:h-[32px] lg:h-14 py-2 lg:ps-[19px] rounded-tl rounded-bl rounded-br-none rounded-tr-none lg:border border-[#07192d] font-['Arial'] bg-white text-[#333234] text-base lg:text-lg hover:border-[#5992fa] focus:border-[#5992fa] outline-hidden`**
1318
+
1319
+
1320
+ ### Example Usage
1321
+
1322
+ Example Data File
1323
+
1324
+ ```ts
1325
+ export interface SearchDataItem {
1326
+ path: string;
1327
+ title?: string;
1328
+ content: string;
1329
+ }
1330
+
1331
+
1332
+ export const SearchableData: SearchDataItem[] = [
1333
+ {
1334
+ path: 'http://localhost:4200/mobile_apps/sdk-component-demo/',
1335
+ title: 'SDK Component Demo Site',
1336
+ content: `The SDK will act as a single source of truth for components. Developers, UX designers, and other stakeholders can view and interact with components without needing to set up the full application, improving feedback loops and collaboration.
1337
+ If you have feedback on this demo site or any of the DHA SDK components, please email us at: b04eb4d0.chenega.onmicrosoft.com@amer.teams.ms
1338
+ For installation instructions for the simple-ui package, please visit install instructions`
1339
+ },
1340
+ {
1341
+ path: 'http://localhost:4200/mobile_apps/sdk-component-demo/buttons',
1342
+ title: 'Button Component',
1343
+ content: `Buttons allow users to interact and make choices within an app with a simple touch. Our Button comes with several variants: default, outlined, and text.
1344
+ The button component as built takes in various props in addition to any other html attributes a normal html button would use, for example an aria-label tag.
1345
+ A ref can also be created and assigned to the button component, and the component will point the reference to the html button.
1346
+ 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.
1347
+ If you would like the button to display a toggled or selected status as the Usage, Code, and Docs buttons above (changing background color when clicked), the selected and optionally the classNameSelected props can be used, explained below.
1348
+ `,
1349
+ },
1350
+ {
1351
+ path: 'http://localhost:4200/mobile_apps/sdk-component-demo/input',
1352
+ title: 'Input Component',
1353
+ content: `The input component as built takes seven optional props (className, classNameLabel, required, label, labelBaseColor, labelInputcolor, mask, and textShadow), in addition to any other html attributes a normal html form input would use, for example an aria tag.
1354
+ The mask prop allows the developer to specify an input mask prop such as (###) ###-### that gaurantees formatting for input data. See usage examples in the drop-down, usage examples, as well as notes in the documentation. Note that the mask is not a placeholder, that is a separate mechanism built into html input elements.
1355
+ A reference can also be created and passed to the input component, and the component will point the reference to the input
1356
+ The input component as built takes seven optional props in addition to any other html attributes a normal html form input would use, for example an aria tag.
1357
+ A reference can also be created and passed to the input component, and the component will point the reference to the input.
1358
+ `,
1359
+ },
1360
+
1361
+ ```
1362
+
1363
+
1364
+ Example Usage
1365
+
1366
+ ```jsx
1367
+ <Search searchableData={SearchableData} />
1368
+ ```
1369
+
1370
+ The Search Results Interface
1371
+
1372
+ ```ts
1373
+ export interface DataSearchResults {
1374
+ input: string;
1375
+ pages: {
1376
+ title?: string;
1377
+ path?: string;
1378
+ results: {
1379
+ characters: string;
1380
+ index: number;
1381
+ }[]
1382
+ }[]
1383
+ }
1384
+ ```
1385
+
1386
+ ### Dependencies
1387
+
1388
+ **_none_**
1389
+
1390
+
1391
+ [Top of Page](#table-of-contents)
1392
+
1058
1393
  <!-- S E C T I O N H E A D E R ------------------------------------------------------- -->
1059
1394
 
1060
1395
 
@@ -1151,7 +1486,7 @@ Full list of props below
1151
1486
 
1152
1487
  1. Base CSS Classes
1153
1488
 
1154
- - **`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:mb-2 focus:outline-[#fa89f1] shadow-sm pl-4 pr-2 py-2 bg-white text-base md:text-lg font-medium text-gray-700 hover:bg-gray-50 border-[#b3b3b3] h-12 mt-1 font-["Arial"] `**
1489
+ - **`outline-hidden outline-offset-0 flex justify-between items-center w-[292px] md:w-[343px] lg:w-[600px] h-14 border focus:outline-4 focus:mb-2 focus:outline-[#fa89f1] shadow-sm pl-4 pr-2 py-2 bg-white text-base md:text-lg font-medium text-gray-700 hover:bg-gray-50 border-[#b3b3b3] h-12 mt-1 font-["Arial"] `**
1155
1490
 
1156
1491
  Separate Variant Styles
1157
1492
 
@@ -1692,6 +2027,7 @@ Tabs - a simple example
1692
2027
 
1693
2028
  [Top of Page](#table-of-contents)
1694
2029
 
2030
+
1695
2031
  <!-- T O G G L E -------------------------------------------------------------------- -->
1696
2032
 
1697
2033
  ## Toggle
@@ -1752,4 +2088,116 @@ Separate Variant Styles
1752
2088
  **_none_**
1753
2089
 
1754
2090
 
2091
+ [Top of Page](#table-of-contents)
2092
+
2093
+ <!-- T O O L T I P ------------------------------------------------------------------------------- -->
2094
+
2095
+ ## Tooltip
2096
+
2097
+ The **`Tooltip`** is a component that wraps an area the developer wants to create a tooltip for, providing a pop up tooltip on hover for the user. The component consists of the root **`Tooltip`** component plus the **`TooltipContent`** sub-component.
2098
+
2099
+ The examples below wrap a box that contains a Badge component with a Tooltip, and hovering over the box will trigger the **`TooltipContent`** to display.
2100
+
2101
+ The Tooltip component also contains an optional **`delay`** prop that takes a number as ms, causing that length of time delay prior to displaying the tooltip. This allows users to incedentally mouse over something without unintentially displaying the tooltip.
2102
+
2103
+ The **`TooltipContent`** can take various html content allowing for a range of options
2104
+
2105
+ The **`Tooltip`** and **`TooltipContent`** components combine to provide developers with a means of providing a tooltip to a wrapped component. The above examples demonstrate a **`Tooltip`** component wrapping a **`div`** that contains a Badge. When the user hovers over the wrapped div the contents of a **`TooltipContent`** component is displayed.
2106
+
2107
+ For accessibility purposes the **`TooltipContent`** component also takes an **`id`** attribute that can be paired with a [aria-describedby](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-describedby) attribute in the target element for screen reader use.
2108
+
2109
+
2110
+ ### Props for the Tooltip component
2111
+
2112
+ | Prop | Type | Optional | Default | Description |
2113
+ | ----------- | -------- | -------- | -------- | ----------- |
2114
+ | children | **`ReactNode`** | No | | This contains the wrapped content that when hovered will cause the tooltip to display. |
2115
+ | className | **`string`** | Yes | **`relative inline-block`** | alternate css classes to add/change styling of the Tooltip (Not the TooltipContent) component. There is very little here wrt CSS classes, so will probably not be touched. |
2116
+ | delay | **`number`** | Yes | **`0`** | Sets a numeric value that delays the tooltip displaying by this number of milliseconds. Default value is 0, or no delay. |
2117
+
2118
+ ### Props for the TooltipContent component
2119
+
2120
+ | Prop | Type | Optional | Default | Description |
2121
+ | ----------- | -------- | -------- | -------- | ----------- |
2122
+ | children | **`ReactNode `** | No | | This contains the content to display inside the tooltip. |
2123
+ | className | **`string`** | Yes | See (1) below | Alternate CSS styling to change (or alter) the display position and/or style of the tooltip. See below for current css class values. |
2124
+ | position | **`string`** | Yes | **`undefined`** | Determines the position of the tooltip when displayed relative to the wrapped component. Default positioning is on the bottom-left, or southwest location. Other options are 'w', 'nw', 'n', 'ne', 'e', 'se', 's', and 'c' (center) |
2125
+
2126
+
2127
+ 1. Base CSS Classes
2128
+
2129
+ **`absolute z-10 px-4 py-2 origin-center bg-slate-800 text-slate-100 border border-slate-500 text-sm rounded-sm shadow-md`**
2130
+
2131
+ - c - center
2132
+
2133
+ **`left-1/2 -translate-x-1/2 top-1/2 -translate-y-1/2`**
2134
+
2135
+ - n - north
2136
+
2137
+ **`left-0 -top-1 -translate-y-full`**
2138
+
2139
+ - nw - northwest
2140
+
2141
+ **`left-1/2 -translate-x-1/2 -top-1 -translate-y-full`**
2142
+
2143
+ - ne - northeast
2144
+
2145
+ **`right-0 -top-1 -translate-y-full`**
2146
+
2147
+ - e - east
2148
+
2149
+ **`-right-2 translate-x-full -translate-y-1/2 top-1/2`**
2150
+
2151
+ - se - south east
2152
+
2153
+ **`right-0 top-full mt-2`**
2154
+
2155
+ - s - south
2156
+
2157
+ **`left-1/2 -translate-x-1/2 top-full mt-2`**
2158
+
2159
+ - w - west
2160
+
2161
+ **`-translate-x-full -left-2 -translate-y-1/2 top-1/2`**
2162
+
2163
+ - c - center
2164
+
2165
+ **`left-1/2 -translate-x-1/2 top-1/2 -translate-y-1/2`**
2166
+
2167
+
2168
+
2169
+ ### Example Usage
2170
+
2171
+ Tooltip - a simple example
2172
+
2173
+ ```jsx
2174
+ <Tooltip className='w-full' delay={500}>
2175
+ <div className='w-full flex justify-center
2176
+ p-8 border-2 rounded-lg'>
2177
+ <Badge className="lg:w-[200px]">Hover Box</Badge>
2178
+ </div>
2179
+ <TooltipContent position='c'>This is a Tooltip
2180
+ with a centered position</TooltipContent>
2181
+ </Tooltip>
2182
+ ```
2183
+
2184
+ Tooltip - bottom/right (or SE) display
2185
+
2186
+ ```jsx
2187
+ <Tooltip className='w-full'>
2188
+ <div className='w-full flex justify-center
2189
+ p-8 border-2 rounded-lg'>
2190
+ <Badge className="lg:w-[200px]">Hover Box</Badge>
2191
+ </div>
2192
+ <TooltipContent position='se'
2193
+ >This is a Tooltip with a south east
2194
+ position</TooltipContent>
2195
+ </Tooltip>
2196
+ ```
2197
+
2198
+ ### Dependencies
2199
+
2200
+ **_none_**
2201
+
2202
+
1755
2203
  [Top of Page](#table-of-contents)