@pnx-mixtape/ids-shape 0.0.12 → 0.0.14

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.
Files changed (3) hide show
  1. package/enums.ts +31 -0
  2. package/index.ts +93 -14
  3. package/package.json +1 -1
package/enums.ts CHANGED
@@ -3,6 +3,37 @@ export enum AlignmentTypes {
3
3
  END = "end",
4
4
  }
5
5
 
6
+ export enum FormStatusTypes {
7
+ DEFAULT = "default",
8
+ VALID = "valid",
9
+ INVALID = "invalid"
10
+ }
11
+
12
+ export enum InputTypeTypes {
13
+ BUTTON = "button",
14
+ CHECKBOX = "checkbox",
15
+ COLOR = "color",
16
+ DATE = "date",
17
+ DATETIMELOCAL = "datetime-local",
18
+ EMAIL = "email",
19
+ FILE = "file",
20
+ HIDDEN = "hidden",
21
+ IMAGE = "image",
22
+ MONTH = "month",
23
+ NUMBER = "number",
24
+ PASSWORD = "password",
25
+ RADIO = "radio",
26
+ RANGE = "range",
27
+ RESET = "reset",
28
+ SEARCH = "search",
29
+ SUBMIT = "submit",
30
+ TEL = "tel",
31
+ TEXT = "text",
32
+ TIME = "time",
33
+ URL = "url",
34
+ WEEK = "week"
35
+ }
36
+
6
37
  export enum MediaAlignmentTypes {
7
38
  LEFT = "left",
8
39
  RIGHT = "right",
package/index.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  ButtonTypes,
6
6
  CardModifier,
7
7
  FooterModifier,
8
+ FormStatusTypes,
8
9
  GlobalAlertTypes,
9
10
  GridModifiers,
10
11
  HeadingTypes,
@@ -13,6 +14,7 @@ import {
13
14
  IconRotateModifier,
14
15
  IconSizeModifier,
15
16
  InPageAlertTypes,
17
+ InputTypeTypes,
16
18
  ListItemModifiers,
17
19
  LoadingTypes,
18
20
  MastheadModifier,
@@ -45,6 +47,7 @@ export type Link = {
45
47
  download?: boolean
46
48
  iconStart?: Icon
47
49
  iconEnd?: Icon
50
+ iconOnly?: boolean
48
51
  }
49
52
 
50
53
  export type Button = {
@@ -55,6 +58,7 @@ export type Button = {
55
58
  disabled?: boolean
56
59
  iconStart?: Icon
57
60
  iconEnd?: Icon
61
+ iconOnly?: boolean
58
62
  }
59
63
 
60
64
  export type Heading = {
@@ -119,31 +123,103 @@ export type LinkedImage = {
119
123
  href: string
120
124
  }
121
125
 
122
- export type FormItem = {
123
- id: string
124
- label: string
125
- fields?: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | (HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement)[]
126
- status?: "default" | "valid" | "invalid"
127
- description?: string
128
- error?: string
129
- as?: "div" | "fieldset"
130
- }
126
+ export type WysiwygText = HTMLElement[] // just an example.
127
+
128
+ /**
129
+ * Forms
130
+ */
131
131
 
132
- export type FormControl = {
132
+ export type InputBase = {
133
133
  id: string
134
134
  name: string
135
+ required?: boolean
136
+ }
137
+
138
+ export type FormControl = InputBase & {
135
139
  label: string
136
140
  value: string
137
141
  checked?: boolean
142
+ status?: FormStatusTypes
143
+ hasDescription?: boolean
144
+ }
145
+
146
+ export type FormOption = {
147
+ label: string
148
+ value: string
149
+ selected?: boolean
150
+ }
151
+
152
+ export type FormSelect = InputBase & {
153
+ options: FormOption[]
154
+ status?: FormStatusTypes
155
+ hasDescription?: boolean
156
+ label?: string,
157
+ }
158
+
159
+ export type FormText = InputBase & {
160
+ type: InputTypeTypes
161
+ value?: string
162
+ status?: FormStatusTypes
163
+ hasDescription?: boolean
164
+ label?: string,
165
+ placeholder?: string;
166
+ }
167
+
168
+ export type FormTextArea = InputBase & {
169
+ value?: string
170
+ status?: FormStatusTypes
171
+ hasDescription?: boolean
172
+ label?: string,
173
+ }
174
+
175
+ export type FormInput = {
176
+ fieldType: "text" | "textarea" | "select" | "checkbox" | "radio"
177
+ input: FormText | FormTextArea | FormSelect | FormControl
178
+ }
179
+
180
+ export type FormDescription = {
181
+ id: string
182
+ description: string
183
+ }
184
+
185
+ export type FormStatus = {
186
+ id: string
187
+ type: FormStatusTypes
188
+ message?: string
189
+ }
190
+
191
+ export type FormLabel = {
192
+ id?: string
193
+ title: string
194
+ inline?: boolean
195
+ as?: "label" | "legend"
196
+ }
197
+
198
+ export type FormItem = {
199
+ id: string
200
+ label?: FormLabel
201
+ fields?: FormInput | FormInput[]
202
+ status?: FormStatus
203
+ descriptionStart?: FormDescription
204
+ descriptionEnd?: FormDescription
205
+ as?: "div" | "fieldset"
206
+ inline?: boolean
138
207
  }
139
208
 
140
209
  export type Form = {
141
210
  action: string
142
211
  items: FormItem | FormItem[]
143
212
  actions?: Button | Button[]
213
+ title?: string
214
+ id?: string
215
+ }
216
+
217
+ export type SearchForm = {
218
+ action: string
219
+ input: FormInput
220
+ button: Button
144
221
  }
145
222
 
146
- export type WysiwygText = HTMLElement[] // just an example.
147
223
 
148
224
  /**
149
225
  * Extendable.
@@ -223,14 +299,14 @@ export type Masthead = {
223
299
  content?: string
224
300
  links?: Link[]
225
301
  skipLinks?: Link[]
226
- background?: MastheadModifier[]
302
+ background?: MastheadModifier
227
303
  }
228
304
 
229
305
  export type Header = {
230
306
  logo: LinkedImage | LinkedImage[]
231
307
  title?: string
232
308
  description?: string
233
- search?: Form
309
+ search?: SearchForm
234
310
  navigation?: Navigation
235
311
  controls?: Button[]
236
312
  }
@@ -240,7 +316,7 @@ export type Footer = {
240
316
  aoc?: string
241
317
  links?: Link[]
242
318
  socials?: SocialLinks
243
- background?: FooterModifier[]
319
+ background?: FooterModifier
244
320
  }
245
321
 
246
322
  /**
@@ -382,6 +458,7 @@ export type SupportList = {
382
458
  export type TabItem = {
383
459
  id: string
384
460
  content: string | WysiwygText
461
+ title?: string
385
462
  }
386
463
 
387
464
  export type TabListItem = {
@@ -429,12 +506,14 @@ export {
429
506
  CardModifier,
430
507
  GlobalAlertTypes,
431
508
  GridModifiers,
509
+ FormStatusTypes,
432
510
  HeadingTypes,
433
511
  HeroBannerModifier,
434
512
  IconColourModifier,
435
513
  IconRotateModifier,
436
514
  IconSizeModifier,
437
515
  InPageAlertTypes,
516
+ InputTypeTypes,
438
517
  LoadingTypes,
439
518
  MediaAlignmentTypes,
440
519
  SectionModifiers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnx-mixtape/ids-shape",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "shape details for ids project",
5
5
  "main": "./index.ts",
6
6
  "type": "module",