@ostack.tech/ui-exhibit 1.3.2 → 1.3.4

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.
@@ -3,22 +3,6 @@ body {
3
3
  overflow-x: hidden;
4
4
  }
5
5
 
6
- #exhibit-header {
7
- display: flex;
8
- align-items: center;
9
- justify-content: space-between;
10
- margin-block: calc(var(--o-ui-space) * 15);
11
- }
12
-
13
- #exhibit-title {
14
- margin-bottom: 0;
15
- }
16
-
17
- #exhibit-main {
18
- margin-bottom: calc(var(--o-ui-space) * 15);
19
- outline: 0;
20
- }
21
-
22
6
  .exhibit-section-docs-link {
23
7
  opacity: 0 !important;
24
8
  transition: opacity var(--o-ui-transition-duration) var(--o-ui-transition-timing-function) !important;
@@ -36,7 +36,7 @@ function ExhibitGrid(t0) {
36
36
  } else t5 = $[5];
37
37
  let t6;
38
38
  if ($[6] !== cols) {
39
- t6 = Object.keys(cols).map(_temp$29);
39
+ t6 = Object.keys(cols).map(_temp$30);
40
40
  $[6] = cols;
41
41
  $[7] = t6;
42
42
  } else t6 = $[7];
@@ -83,7 +83,7 @@ function ExhibitGrid(t0) {
83
83
  } else t8 = $[16];
84
84
  return t8;
85
85
  }
86
- function _temp$29(colLabel) {
86
+ function _temp$30(colLabel) {
87
87
  return /* @__PURE__ */ jsx("div", {
88
88
  className: "exhibit-grid-col-label",
89
89
  children: colLabel
@@ -249,14 +249,14 @@ function AlertDialogSection() {
249
249
  Outlined: "outlined",
250
250
  Ghost: "ghost"
251
251
  },
252
- renderItem: _temp$28
252
+ renderItem: _temp$29
253
253
  })
254
254
  });
255
255
  $[0] = t0;
256
256
  } else t0 = $[0];
257
257
  return t0;
258
258
  }
259
- function _temp$28(t0) {
259
+ function _temp$29(t0) {
260
260
  const { col, row } = t0;
261
261
  return /* @__PURE__ */ jsxs(AlertDialog, { children: [/* @__PURE__ */ jsx(AlertDialogTrigger, { children: /* @__PURE__ */ jsx(Button, {
262
262
  variant: row,
@@ -302,14 +302,14 @@ function AlertSection() {
302
302
  Subtle: "subtle",
303
303
  Outlined: "outlined"
304
304
  },
305
- renderItem: _temp$27
305
+ renderItem: _temp$28
306
306
  })
307
307
  });
308
308
  $[0] = t0;
309
309
  } else t0 = $[0];
310
310
  return t0;
311
311
  }
312
- function _temp$27(t0) {
312
+ function _temp$28(t0) {
313
313
  const { col, row } = t0;
314
314
  return /* @__PURE__ */ jsxs(Alert, {
315
315
  variant: row,
@@ -344,14 +344,14 @@ function ButtonGroupSection() {
344
344
  Outlined: "outlined",
345
345
  Ghost: "ghost"
346
346
  },
347
- renderItem: _temp$26
347
+ renderItem: _temp$27
348
348
  })
349
349
  });
350
350
  $[0] = t0;
351
351
  } else t0 = $[0];
352
352
  return t0;
353
353
  }
354
- function _temp$26(t0) {
354
+ function _temp$27(t0) {
355
355
  const { col, row } = t0;
356
356
  return /* @__PURE__ */ jsxs(ButtonGroup, { children: [
357
357
  /* @__PURE__ */ jsx(Button, {
@@ -400,14 +400,14 @@ function ButtonSection() {
400
400
  Outlined: "outlined",
401
401
  Ghost: "ghost"
402
402
  },
403
- renderItem: _temp$25
403
+ renderItem: _temp$26
404
404
  })
405
405
  });
406
406
  $[0] = t0;
407
407
  } else t0 = $[0];
408
408
  return t0;
409
409
  }
410
- function _temp$25(t0) {
410
+ function _temp$26(t0) {
411
411
  const { col, row } = t0;
412
412
  return /* @__PURE__ */ jsx(Button, {
413
413
  icon: faBolt,
@@ -421,6 +421,213 @@ function _temp$25(t0) {
421
421
  children: "Zap"
422
422
  });
423
423
  }
424
+ -(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
425
+ /**
426
+ * @constant
427
+ * @name constructFromSymbol
428
+ * @summary Symbol enabling Date extensions to inherit properties from the reference date.
429
+ *
430
+ * The symbol is used to enable the `constructFrom` function to construct a date
431
+ * using a reference date and a value. It allows to transfer extra properties
432
+ * from the reference date to the new date. It's useful for extensions like
433
+ * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
434
+ * a constructor argument.
435
+ */
436
+ var constructFromSymbol = Symbol.for("constructDateFrom");
437
+ // ../../node_modules/date-fns/constructFrom.js
438
+ /**
439
+ * @name constructFrom
440
+ * @category Generic Helpers
441
+ * @summary Constructs a date using the reference date and the value
442
+ *
443
+ * @description
444
+ * The function constructs a new date using the constructor from the reference
445
+ * date and the given value. It helps to build generic functions that accept
446
+ * date extensions.
447
+ *
448
+ * It defaults to `Date` if the passed reference date is a number or a string.
449
+ *
450
+ * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
451
+ * enabling to transfer extra properties from the reference date to the new date.
452
+ * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
453
+ * that accept a time zone as a constructor argument.
454
+ *
455
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
456
+ *
457
+ * @param date - The reference date to take constructor from
458
+ * @param value - The value to create the date
459
+ *
460
+ * @returns Date initialized using the given date and value
461
+ *
462
+ * @example
463
+ * import { constructFrom } from "./constructFrom/date-fns";
464
+ *
465
+ * // A function that clones a date preserving the original type
466
+ * function cloneDate<DateType extends Date>(date: DateType): DateType {
467
+ * return constructFrom(
468
+ * date, // Use constructor from the given date
469
+ * date.getTime() // Use the date value to create a new date
470
+ * );
471
+ * }
472
+ */
473
+ function constructFrom(date, value) {
474
+ if (typeof date === "function") return date(value);
475
+ if (date && typeof date === "object" && constructFromSymbol in date) return date[constructFromSymbol](value);
476
+ if (date instanceof Date) return new date.constructor(value);
477
+ return new Date(value);
478
+ }
479
+ // ../../node_modules/date-fns/toDate.js
480
+ /**
481
+ * @name toDate
482
+ * @category Common Helpers
483
+ * @summary Convert the given argument to an instance of Date.
484
+ *
485
+ * @description
486
+ * Convert the given argument to an instance of Date.
487
+ *
488
+ * If the argument is an instance of Date, the function returns its clone.
489
+ *
490
+ * If the argument is a number, it is treated as a timestamp.
491
+ *
492
+ * If the argument is none of the above, the function returns Invalid Date.
493
+ *
494
+ * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
495
+ * enabling to transfer extra properties from the reference date to the new date.
496
+ * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
497
+ * that accept a time zone as a constructor argument.
498
+ *
499
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
500
+ *
501
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
502
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
503
+ *
504
+ * @param argument - The value to convert
505
+ *
506
+ * @returns The parsed date in the local time zone
507
+ *
508
+ * @example
509
+ * // Clone the date:
510
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
511
+ * //=> Tue Feb 11 2014 11:30:30
512
+ *
513
+ * @example
514
+ * // Convert the timestamp to date:
515
+ * const result = toDate(1392098430000)
516
+ * //=> Tue Feb 11 2014 11:30:30
517
+ */
518
+ function toDate(argument, context) {
519
+ return constructFrom(context || argument, argument);
520
+ }
521
+ // ../../node_modules/date-fns/addDays.js
522
+ /**
523
+ * The {@link addDays} function options.
524
+ */
525
+ /**
526
+ * @name addDays
527
+ * @category Day Helpers
528
+ * @summary Add the specified number of days to the given date.
529
+ *
530
+ * @description
531
+ * Add the specified number of days to the given date.
532
+ *
533
+ * **You don't need date-fns\***:
534
+ *
535
+ * Temporal has a built-in `add` method on all its classes:
536
+ *
537
+ * - [`Temporal.Instant.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/add)
538
+ * - [`Temporal.PlainDate.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/add)
539
+ * - [`Temporal.PlainDateTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/add)
540
+ * - [`Temporal.PlainTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/add)
541
+ * - [`Temporal.PlainYearMonth.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/add)
542
+ * - [`Temporal.ZonedDateTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/add)
543
+ *
544
+ * \* **Not really**, see: https://date-fns.org/you-dont-need-date-fns
545
+ *
546
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
547
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
548
+ *
549
+ * @param date - The date to be changed
550
+ * @param amount - The amount of days to be added.
551
+ * @param options - An object with options
552
+ *
553
+ * @returns The new date with the days added
554
+ *
555
+ * @example
556
+ * // Add 10 days to 1 September 2014:
557
+ * const result = addDays(new Date(2014, 8, 1), 10)
558
+ * //=> Thu Sep 11 2014 00:00:00
559
+ *
560
+ * @example
561
+ * // Using Temporal:
562
+ * // Add 10 days to 1 September 2014:
563
+ * Temporal.PlainDate.from("2014-09-01").add({ days: 10 }).toString();
564
+ * //=> "2014-09-11"
565
+ */
566
+ function addDays(date, amount, options) {
567
+ const _date = toDate(date, options?.in);
568
+ if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
569
+ if (!amount) return _date;
570
+ _date.setDate(_date.getDate() + amount);
571
+ return _date;
572
+ }
573
+ // ../../node_modules/date-fns/startOfDay.js
574
+ /**
575
+ * The {@link startOfDay} function options.
576
+ */
577
+ /**
578
+ * @name startOfDay
579
+ * @category Day Helpers
580
+ * @summary Return the start of a day for the given date.
581
+ *
582
+ * @description
583
+ * Return the start of a day for the given date.
584
+ * The result will be in the local timezone.
585
+ *
586
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
587
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
588
+ *
589
+ * @param date - The original date
590
+ * @param options - The options
591
+ *
592
+ * @returns The start of a day
593
+ *
594
+ * @example
595
+ * // The start of a day for 2 September 2014 11:55:00:
596
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
597
+ * //=> Tue Sep 02 2014 00:00:00
598
+ */
599
+ function startOfDay(date, options) {
600
+ const _date = toDate(date, options?.in);
601
+ _date.setHours(0, 0, 0, 0);
602
+ return _date;
603
+ }
604
+ // ../../node_modules/date-fns/startOfToday.js
605
+ /**
606
+ * The {@link startOfToday} function options.
607
+ */
608
+ /**
609
+ * @name startOfToday
610
+ * @category Day Helpers
611
+ * @summary Return the start of today.
612
+ * @pure false
613
+ *
614
+ * @description
615
+ * Return the start of today.
616
+ *
617
+ * @typeParam ContextDate - The `Date` type of the context function.
618
+ *
619
+ * @param options - An object with options
620
+ *
621
+ * @returns The start of today
622
+ *
623
+ * @example
624
+ * // If today is 6 October 2014:
625
+ * const result = startOfToday()
626
+ * //=> Mon Oct 6 2014 00:00:00
627
+ */
628
+ function startOfToday(options) {
629
+ return startOfDay(Date.now(), options);
630
+ }
424
631
  // src/sections/CalendarSection.tsx
425
632
  function CalendarSection() {
426
633
  const $ = c(1);
@@ -429,12 +636,35 @@ function CalendarSection() {
429
636
  t0 = /* @__PURE__ */ jsx(ExhibitSection, {
430
637
  title: "Calendar",
431
638
  docsPage: "ostack-ui-data-display-calendar",
432
- children: /* @__PURE__ */ jsx(Calendar, {})
639
+ children: /* @__PURE__ */ jsx(ExhibitGrid, {
640
+ cols: {
641
+ Basic: "none",
642
+ "Single selection": "single",
643
+ "Multiple selection": "multiple",
644
+ "Range selection": "range"
645
+ },
646
+ renderItem: _temp$25
647
+ })
433
648
  });
434
649
  $[0] = t0;
435
650
  } else t0 = $[0];
436
651
  return t0;
437
652
  }
653
+ function _temp$25(t0) {
654
+ const { col } = t0;
655
+ return /* @__PURE__ */ jsx(Calendar, {
656
+ selectionMode: col,
657
+ defaultValue: col === "single" ? addDays(startOfToday(), 1) : col === "multiple" ? [
658
+ addDays(startOfToday(), -12),
659
+ addDays(startOfToday(), -2),
660
+ addDays(startOfToday(), 3),
661
+ addDays(startOfToday(), 8)
662
+ ] : col === "range" ? {
663
+ start: addDays(startOfToday(), -7),
664
+ end: addDays(startOfToday(), 2)
665
+ } : void 0
666
+ });
667
+ }
438
668
  // src/sections/CheckboxGroupSection.tsx
439
669
  function CheckboxGroupSection() {
440
670
  const $ = c(1);
@@ -2910,20 +3140,22 @@ function TooltipSection() {
2910
3140
  }
2911
3141
  // src/ExhibitApp.tsx
2912
3142
  var DEFAULT_DOCS_URL = DEV ? "http://localhost:6006/" : "https://ui.ostack.tech/";
3143
+ var DEFAULT_VERSION = `v1.3.4`;
2913
3144
  function ExhibitApp(t0) {
2914
- const $ = c(17);
2915
- const { docsUrl: t1, title: t2, prefix, actions } = t0;
3145
+ const $ = c(23);
3146
+ const { docsUrl: t1, title: t2, version: t3, prefix, actions } = t0;
2916
3147
  const docsUrl = t1 === void 0 ? DEFAULT_DOCS_URL : t1;
2917
3148
  const title = t2 === void 0 ? document.title : t2;
2918
- let t3;
3149
+ const version = t3 === void 0 ? DEFAULT_VERSION : t3;
3150
+ let t4;
2919
3151
  if ($[0] !== docsUrl) {
2920
- t3 = { docsUrl };
3152
+ t4 = { docsUrl };
2921
3153
  $[0] = docsUrl;
2922
- $[1] = t3;
2923
- } else t3 = $[1];
2924
- let t4;
3154
+ $[1] = t4;
3155
+ } else t4 = $[1];
3156
+ let t5;
2925
3157
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2926
- t4 = /* @__PURE__ */ jsx(VisuallyHidden, {
3158
+ t5 = /* @__PURE__ */ jsx(VisuallyHidden, {
2927
3159
  focusable: true,
2928
3160
  asChild: true,
2929
3161
  children: /* @__PURE__ */ jsx(Link, {
@@ -2935,53 +3167,86 @@ function ExhibitApp(t0) {
2935
3167
  children: "Skip to main content"
2936
3168
  })
2937
3169
  });
2938
- $[2] = t4;
2939
- } else t4 = $[2];
2940
- let t5;
3170
+ $[2] = t5;
3171
+ } else t5 = $[2];
3172
+ let t6;
2941
3173
  if ($[3] !== title) {
2942
- t5 = /* @__PURE__ */ jsx(Heading, {
3174
+ t6 = /* @__PURE__ */ jsx(Heading, {
2943
3175
  level: 1,
2944
3176
  id: "exhibit-title",
3177
+ mb: 0,
2945
3178
  children: title
2946
3179
  });
2947
3180
  $[3] = title;
2948
- $[4] = t5;
2949
- } else t5 = $[4];
2950
- let t6;
2951
- if ($[5] !== actions) {
2952
- t6 = actions && /* @__PURE__ */ jsx(Stack, {
2953
- id: "exhibit-actions",
3181
+ $[4] = t6;
3182
+ } else t6 = $[4];
3183
+ let t7;
3184
+ if ($[5] !== version) {
3185
+ t7 = version && /* @__PURE__ */ jsx(Text, {
3186
+ color: "neutral",
3187
+ children: version
3188
+ });
3189
+ $[5] = version;
3190
+ $[6] = t7;
3191
+ } else t7 = $[6];
3192
+ let t8;
3193
+ if ($[7] !== t6 || $[8] !== t7) {
3194
+ t8 = /* @__PURE__ */ jsxs(Stack, {
3195
+ direction: "row",
3196
+ alignItems: "baseline",
3197
+ gap: 3,
3198
+ children: [t6, t7]
3199
+ });
3200
+ $[7] = t6;
3201
+ $[8] = t7;
3202
+ $[9] = t8;
3203
+ } else t8 = $[9];
3204
+ let t9;
3205
+ if ($[10] !== actions) {
3206
+ t9 = actions && /* @__PURE__ */ jsx(Stack, {
2954
3207
  direction: "row",
2955
3208
  gap: 2,
2956
3209
  children: actions
2957
3210
  });
2958
- $[5] = actions;
2959
- $[6] = t6;
2960
- } else t6 = $[6];
2961
- let t7;
2962
- if ($[7] !== t5 || $[8] !== t6) {
2963
- t7 = /* @__PURE__ */ jsx(Container, {
3211
+ $[10] = actions;
3212
+ $[11] = t9;
3213
+ } else t9 = $[11];
3214
+ let t10;
3215
+ if ($[12] !== t8 || $[13] !== t9) {
3216
+ t10 = /* @__PURE__ */ jsx(Container, {
2964
3217
  asChild: true,
2965
- children: /* @__PURE__ */ jsxs("header", {
2966
- id: "exhibit-header",
2967
- children: [t5, t6]
3218
+ children: /* @__PURE__ */ jsx(Stack, {
3219
+ asChild: true,
3220
+ direction: "row",
3221
+ alignItems: "center",
3222
+ justifyContent: "space-between",
3223
+ my: 15,
3224
+ children: /* @__PURE__ */ jsxs("header", { children: [t8, t9] })
2968
3225
  })
2969
3226
  });
2970
- $[7] = t5;
2971
- $[8] = t6;
2972
- $[9] = t7;
2973
- } else t7 = $[9];
2974
- let t8;
2975
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
2976
- t8 = /* @__PURE__ */ jsx(Stack, {
3227
+ $[12] = t8;
3228
+ $[13] = t9;
3229
+ $[14] = t10;
3230
+ } else t10 = $[14];
3231
+ let t11;
3232
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
3233
+ t11 = { outline: 0 };
3234
+ $[15] = t11;
3235
+ } else t11 = $[15];
3236
+ let t12;
3237
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
3238
+ t12 = /* @__PURE__ */ jsx(Stack, {
2977
3239
  asChild: true,
2978
3240
  gap: 15,
2979
3241
  children: /* @__PURE__ */ jsx(Container, {
2980
3242
  asChild: true,
2981
- children: /* @__PURE__ */ jsxs("main", {
3243
+ children: /* @__PURE__ */ jsx(Box, {
3244
+ asChild: true,
2982
3245
  id: "exhibit-main",
3246
+ mb: 15,
3247
+ style: t11,
2983
3248
  tabIndex: -1,
2984
- children: [
3249
+ children: /* @__PURE__ */ jsxs("main", { children: [
2985
3250
  /* @__PURE__ */ jsx(AlertSection, {}),
2986
3251
  /* @__PURE__ */ jsx(AlertDialogSection, {}),
2987
3252
  /* @__PURE__ */ jsx(ButtonSection, {}),
@@ -3019,38 +3284,38 @@ function ExhibitApp(t0) {
3019
3284
  /* @__PURE__ */ jsx(TextAreaSection, {}),
3020
3285
  /* @__PURE__ */ jsx(TooltipSection, {}),
3021
3286
  /* @__PURE__ */ jsx(KeyboardSection, {})
3022
- ]
3287
+ ] })
3023
3288
  })
3024
3289
  })
3025
3290
  });
3026
- $[10] = t8;
3027
- } else t8 = $[10];
3028
- let t9;
3029
- if ($[11] !== prefix || $[12] !== t7) {
3030
- t9 = /* @__PURE__ */ jsxs(Root, {
3291
+ $[16] = t12;
3292
+ } else t12 = $[16];
3293
+ let t13;
3294
+ if ($[17] !== prefix || $[18] !== t10) {
3295
+ t13 = /* @__PURE__ */ jsxs(Root, {
3031
3296
  prefix,
3032
3297
  locale: enGB,
3033
3298
  children: [
3034
- t4,
3035
- t7,
3036
- t8
3299
+ t5,
3300
+ t10,
3301
+ t12
3037
3302
  ]
3038
3303
  });
3039
- $[11] = prefix;
3040
- $[12] = t7;
3041
- $[13] = t9;
3042
- } else t9 = $[13];
3043
- let t10;
3044
- if ($[14] !== t3 || $[15] !== t9) {
3045
- t10 = /* @__PURE__ */ jsx(ExhibitContext, {
3046
- value: t3,
3047
- children: t9
3048
- });
3049
- $[14] = t3;
3050
- $[15] = t9;
3051
- $[16] = t10;
3052
- } else t10 = $[16];
3053
- return t10;
3304
+ $[17] = prefix;
3305
+ $[18] = t10;
3306
+ $[19] = t13;
3307
+ } else t13 = $[19];
3308
+ let t14;
3309
+ if ($[20] !== t13 || $[21] !== t4) {
3310
+ t14 = /* @__PURE__ */ jsx(ExhibitContext, {
3311
+ value: t4,
3312
+ children: t13
3313
+ });
3314
+ $[20] = t13;
3315
+ $[21] = t4;
3316
+ $[22] = t14;
3317
+ } else t14 = $[22];
3318
+ return t14;
3054
3319
  }
3055
3320
  export { ExhibitApp };
3056
3321