@pnx-mixtape/ids-shape 0.0.22 → 0.0.24

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 +15 -0
  2. package/index.ts +65 -39
  3. package/package.json +1 -1
package/enums.ts CHANGED
@@ -199,3 +199,18 @@ export enum FooterModifier {
199
199
  DARK = "dark",
200
200
  LIGHT = "light",
201
201
  }
202
+
203
+ export enum PopoverPlacementModifier {
204
+ TOP = "top",
205
+ TOP_START = "top-start",
206
+ TOP_END = "top-end",
207
+ RIGHT = "right",
208
+ RIGHT_START = "right-start",
209
+ RIGHT_END = "right-end",
210
+ LEFT = "left",
211
+ LEFT_START = "left-start",
212
+ LEFT_END = "left-end",
213
+ BOTTOM = "bottom",
214
+ BOTTOM_START = "bottom-start",
215
+ BOTTOM_END = "bottom-end",
216
+ }
package/index.ts CHANGED
@@ -19,12 +19,28 @@ import {
19
19
  LoadingTypes,
20
20
  MastheadModifier,
21
21
  MediaAlignmentTypes,
22
+ PopoverPlacementModifier,
22
23
  SectionModifiers,
23
24
  SectionTypes,
24
25
  StepsModifier,
25
26
  TagTypes
26
27
  } from "./enums"
27
28
 
29
+ /**
30
+ * Flag certain slots as accepting a collection of items, which should generally be ignored by the type system,
31
+ * as they are often passed as a string of HTML or HTMLElements.
32
+ *
33
+ * This is not ideal, but it is a pragmatic solution to allow for flexibility in content management without requiring
34
+ * strict typing on every piece of content.
35
+ */
36
+ export type Collection = string | HTMLElement
37
+
38
+ /**
39
+ * Flag certain slots as accepting WYSIWYG content, which is the same as Collection, but semantically indicates that
40
+ * the content is expected to be rich text, which may include HTML elements, rather than plain text or a simple string.
41
+ */
42
+ export type WysiwygText = Collection
43
+
28
44
  /**
29
45
  * Base.
30
46
  */
@@ -72,11 +88,11 @@ export type Heading = {
72
88
 
73
89
  export type DefinitionListItem = {
74
90
  title: string
75
- content: string | WysiwygText
91
+ content: WysiwygText
76
92
  }
77
93
 
78
94
  export type DefinitionList = {
79
- items: DefinitionListItem[]
95
+ items: DefinitionListItem[] | Collection
80
96
  title?: Heading
81
97
  }
82
98
 
@@ -126,8 +142,6 @@ export type LinkedImage = {
126
142
 
127
143
  export type Logo = InlineSvg | Image
128
144
 
129
- export type WysiwygText = string[] | HTMLElement[] // just an example.
130
-
131
145
  /**
132
146
  * Forms
133
147
  */
@@ -208,7 +222,7 @@ export type FormItem = {
208
222
 
209
223
  export type Form = {
210
224
  action: string
211
- items: FormItem[]
225
+ items: FormItem[] | Collection
212
226
  actions?: Button[]
213
227
  title?: string
214
228
  id?: string
@@ -226,7 +240,7 @@ export type SearchForm = {
226
240
 
227
241
  export type WayfindingBlock = {
228
242
  title?: Heading
229
- content?: string | WysiwygText
243
+ content?: WysiwygText
230
244
  link?: Link | Button
231
245
  }
232
246
 
@@ -235,13 +249,13 @@ export type WayfindingBlock = {
235
249
  */
236
250
 
237
251
  export type Breadcrumbs = {
238
- items: Link[] | string
252
+ items: Link[] | Collection
239
253
  }
240
254
 
241
255
  export type InPageNavigation = {
242
- title?: Heading
256
+ title?: string | Heading
243
257
  levels?: HeadingTypes[]
244
- items?: Link[]
258
+ items?: Link[] | Collection
245
259
  }
246
260
 
247
261
  export type PaginationItem = {
@@ -275,14 +289,14 @@ export type SideNavigation = Navigation & {
275
289
  */
276
290
 
277
291
  export type GridItem = {
278
- item: string | HTMLElement
292
+ item: Collection
279
293
  container?: boolean
280
294
  modifiers?: GridModifiers[]
281
295
  as?: AsTypes
282
296
  }
283
297
 
284
298
  export type Grid = {
285
- items: GridItem[]
299
+ items: GridItem[] | Collection
286
300
  modifiers?: GridModifiers[]
287
301
  as?: SectionTypes
288
302
  }
@@ -292,11 +306,12 @@ export type Section = WayfindingBlock & {
292
306
  container?: boolean
293
307
  as?: SectionTypes
294
308
  modifiers?: SectionModifiers[]
309
+ linkBefore?: boolean
295
310
  }
296
311
 
297
312
  export type Masthead = {
298
- content?: string
299
- links?: Link[]
313
+ content?: Collection
314
+ links?: Link[] | Collection
300
315
  skipLinks?: Link[]
301
316
  background?: MastheadModifier
302
317
  }
@@ -312,7 +327,7 @@ export type Header = {
312
327
 
313
328
  export type Footer = {
314
329
  navigation?: Navigation
315
- aoc?: string
330
+ aoc?: WysiwygText
316
331
  links?: Link[]
317
332
  socials?: SocialLinks
318
333
  background?: FooterModifier
@@ -326,38 +341,38 @@ export type Footer = {
326
341
 
327
342
  export type LinkList = {
328
343
  title?: Heading
329
- items: Link[]
344
+ items: Link[] | Collection
330
345
  }
331
346
 
332
347
  export type AccordionItem = {
333
348
  title: string
334
- content: string | WysiwygText
349
+ content: WysiwygText
335
350
  open?: boolean
336
351
  id?: string
337
352
  }
338
353
 
339
354
  export type Accordion = {
340
- items: AccordionItem[]
355
+ items: AccordionItem[] | Collection
341
356
  title?: Heading
342
357
  toggleAll?: boolean
343
358
  }
344
359
 
345
360
  export type Callout = {
346
- title: Heading
347
- content: string
361
+ title?: Heading
362
+ content: WysiwygText
348
363
  }
349
364
 
350
365
  export type Card = WayfindingBlock & {
351
366
  image?: Image
352
367
  icon?: Icon
353
- tags?: Tags
368
+ tags?: Tags | string
354
369
  date?: string
355
370
  linkList?: LinkList
356
371
  modifiers?: CardModifier[]
357
372
  }
358
373
 
359
374
  export type Carousel = {
360
- items: GridItem[]
375
+ items: GridItem[] | Collection
361
376
  loop?: boolean
362
377
  pagination: boolean
363
378
  counter: boolean
@@ -389,7 +404,7 @@ export type GlobalAlert = {
389
404
  type: GlobalAlertTypes
390
405
  dismissible: boolean
391
406
  title: Heading
392
- content: string | WysiwygText
407
+ content: WysiwygText
393
408
  link?: Link
394
409
  }
395
410
 
@@ -408,13 +423,13 @@ export type HeroSearch = HeroBanner & {
408
423
  export type InPageAlert = {
409
424
  type: InPageAlertTypes
410
425
  title: Heading
411
- content: string | WysiwygText
426
+ content: WysiwygText
412
427
  link?: Link
413
428
  }
414
429
 
415
430
  export type ListItem = {
416
431
  link: Link
417
- content: string | WysiwygText
432
+ content: WysiwygText
418
433
  tags?: Tags
419
434
  label?: string
420
435
  info?: string
@@ -424,7 +439,10 @@ export type ListItem = {
424
439
  }
425
440
 
426
441
  export type Popover = WayfindingBlock & {
442
+ trigger: Button
427
443
  id: string
444
+ name?: string
445
+ placement?: PopoverPlacementModifier
428
446
  }
429
447
 
430
448
  export type ResultsBar = {
@@ -436,27 +454,27 @@ export type ResultsBar = {
436
454
  }
437
455
 
438
456
  export type StepItem = {
439
- content: string | WysiwygText
457
+ content: WysiwygText
440
458
  status?: boolean
441
459
  }
442
460
 
443
461
  export type Steps = {
444
- items: StepItem[],
462
+ items: StepItem[] | Collection,
445
463
  modifiers?: StepsModifier[]
446
464
  fill?: boolean
447
465
  counters?: boolean
448
466
  }
449
467
 
450
468
  export type SupportList = {
451
- logos: LinkedImage[]
469
+ logos: LinkedImage[] | Collection
452
470
  title?: Heading
453
- links?: Link[]
471
+ links?: Link[] | Collection
454
472
  showBrand?: boolean
455
473
  }
456
474
 
457
475
  export type TabItem = {
458
476
  id: string
459
- content: string | WysiwygText
477
+ content: WysiwygText
460
478
  title?: string
461
479
  }
462
480
 
@@ -467,27 +485,28 @@ export type TabListItem = {
467
485
  }
468
486
 
469
487
  export type Tabs = {
470
- items: TabItem[]
471
- listItems?: TabListItem[]
488
+ items: TabItem[] | Collection
489
+ listItems?: TabListItem[] | Collection
472
490
  id?: string
473
491
  title?: Heading
474
492
  }
475
493
 
476
494
  export type Tags = {
477
- items: Link[] | string[] | FormControl[]
495
+ items: Link[] | string[] | FormControl[] | Collection
478
496
  type: TagTypes
479
497
  }
480
498
 
481
499
  export type SocialLinks = {
482
500
  title?: Heading
483
- items: Link[] | LinkedImage[]
501
+ items: Link[] | LinkedImage[] | Collection
484
502
  }
485
503
 
486
504
  export type SocialShare = {
487
- facebook?: boolean
488
- linkedin?: boolean
489
- twitter?: boolean
490
- email?: boolean
505
+ facebook?: string
506
+ linkedin?: string
507
+ twitter?: string
508
+ bluesky?: string
509
+ email?: string
491
510
  }
492
511
 
493
512
  export type UtilityList = {
@@ -495,6 +514,7 @@ export type UtilityList = {
495
514
  print?: boolean
496
515
  pdf?: boolean
497
516
  share?: SocialShare
517
+ horizontal?: boolean
498
518
  }
499
519
 
500
520
  export type Collapsible = {
@@ -511,8 +531,8 @@ export type FilterItem = FormItem & {
511
531
  export type Filters = {
512
532
  action: string
513
533
  title: string
514
- items: FilterItem[]
515
- actions?: Button[]
534
+ items: FilterItem[] | Collection
535
+ actions?: Button[] | Collection
516
536
  direction: "right" | "down"
517
537
  instant?: boolean
518
538
  collapsible?: boolean // down in nswds - but that name is too vague, when true it's open on desktop and closed on mobile.
@@ -520,6 +540,11 @@ export type Filters = {
520
540
  counter?: boolean
521
541
  }
522
542
 
543
+ export type Tooltip = {
544
+ text: string
545
+ content: string
546
+ }
547
+
523
548
  export {
524
549
  AlignmentTypes,
525
550
  AsTypes,
@@ -545,4 +570,5 @@ export {
545
570
  ListItemModifiers,
546
571
  MastheadModifier,
547
572
  FooterModifier,
573
+ PopoverPlacementModifier,
548
574
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnx-mixtape/ids-shape",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "shape details for ids project",
5
5
  "main": "./index.ts",
6
6
  "type": "module",