@algolia/satellite 2.3.0-rc.4 → 2.3.0-rc.6

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 (60) hide show
  1. package/dist/cjs/Actions/ButtonLink/ButtonLink.d.ts +2 -0
  2. package/dist/cjs/Actions/ButtonLink/ButtonLink.js +4 -2
  3. package/dist/cjs/Actions/ToggleGroup/ToggleGroup.d.ts +13 -14
  4. package/dist/cjs/Fields/AutoComplete/AutoComplete.js +5 -7
  5. package/dist/cjs/Fields/AutoComplete/types.d.ts +0 -8
  6. package/dist/cjs/Fields/AutoComplete/utils.d.ts +1 -1
  7. package/dist/cjs/Fields/AutoComplete/utils.js +2 -3
  8. package/dist/cjs/Fields/Checkbox/Checkbox.d.ts +2 -2
  9. package/dist/cjs/Fields/Checkbox/Checkbox.js +2 -2
  10. package/dist/cjs/Fields/Dropzone/Dropzone.js +1 -1
  11. package/dist/cjs/Fields/Form/stories/Complex.js +123 -50
  12. package/dist/cjs/Fields/RadioGroup/RadioButton.js +9 -2
  13. package/dist/cjs/Fields/RadioGroup/RadioButton.tailwind.js +1 -1
  14. package/dist/cjs/Fields/RadioGroup/RadioGroupItem.js +1 -1
  15. package/dist/cjs/Fields/Select/Select.tailwind.js +4 -3
  16. package/dist/cjs/Fields/SelectableCard/SelectableCard.d.ts +35 -0
  17. package/dist/cjs/Fields/SelectableCard/SelectableCard.js +105 -0
  18. package/dist/cjs/Fields/SelectableCard/SelectableCardContext.d.ts +13 -0
  19. package/dist/cjs/Fields/SelectableCard/SelectableCardContext.js +15 -0
  20. package/dist/cjs/Fields/SelectableCard/SelectableCardGroup.d.ts +13 -0
  21. package/dist/cjs/Fields/SelectableCard/SelectableCardGroup.js +55 -0
  22. package/dist/cjs/Fields/SelectableCard/index.d.ts +2 -0
  23. package/dist/cjs/Fields/SelectableCard/index.js +27 -0
  24. package/dist/cjs/Fields/Switch/Switch.js +1 -1
  25. package/dist/cjs/Fields/index.d.ts +1 -0
  26. package/dist/cjs/Fields/index.js +11 -0
  27. package/dist/cjs/Helpers/utilities/focusable.tailwind.js +1 -1
  28. package/dist/cjs/Navigation/Link/Link.d.ts +10 -0
  29. package/dist/cjs/Navigation/Link/Link.js +4 -2
  30. package/dist/esm/Actions/ButtonLink/ButtonLink.d.ts +2 -0
  31. package/dist/esm/Actions/ButtonLink/ButtonLink.js +4 -2
  32. package/dist/esm/Actions/ToggleGroup/ToggleGroup.d.ts +13 -14
  33. package/dist/esm/Fields/AutoComplete/AutoComplete.js +5 -7
  34. package/dist/esm/Fields/AutoComplete/types.d.ts +0 -8
  35. package/dist/esm/Fields/AutoComplete/utils.d.ts +1 -1
  36. package/dist/esm/Fields/AutoComplete/utils.js +2 -3
  37. package/dist/esm/Fields/Checkbox/Checkbox.d.ts +2 -2
  38. package/dist/esm/Fields/Checkbox/Checkbox.js +2 -2
  39. package/dist/esm/Fields/Dropzone/Dropzone.js +1 -1
  40. package/dist/esm/Fields/Form/stories/Complex.js +123 -50
  41. package/dist/esm/Fields/RadioGroup/RadioButton.js +10 -3
  42. package/dist/esm/Fields/RadioGroup/RadioButton.tailwind.js +1 -1
  43. package/dist/esm/Fields/RadioGroup/RadioGroupItem.js +1 -1
  44. package/dist/esm/Fields/Select/Select.tailwind.js +4 -3
  45. package/dist/esm/Fields/SelectableCard/SelectableCard.d.ts +35 -0
  46. package/dist/esm/Fields/SelectableCard/SelectableCard.js +100 -0
  47. package/dist/esm/Fields/SelectableCard/SelectableCardContext.d.ts +13 -0
  48. package/dist/esm/Fields/SelectableCard/SelectableCardContext.js +9 -0
  49. package/dist/esm/Fields/SelectableCard/SelectableCardGroup.d.ts +13 -0
  50. package/dist/esm/Fields/SelectableCard/SelectableCardGroup.js +48 -0
  51. package/dist/esm/Fields/SelectableCard/index.d.ts +2 -0
  52. package/dist/esm/Fields/SelectableCard/index.js +2 -0
  53. package/dist/esm/Fields/Switch/Switch.js +1 -1
  54. package/dist/esm/Fields/index.d.ts +1 -0
  55. package/dist/esm/Fields/index.js +1 -0
  56. package/dist/esm/Helpers/utilities/focusable.tailwind.js +1 -1
  57. package/dist/esm/Navigation/Link/Link.d.ts +10 -0
  58. package/dist/esm/Navigation/Link/Link.js +4 -2
  59. package/dist/satellite.min.css +1 -1
  60. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50;
4
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58;
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import { zodResolver } from "@hookform/resolvers/zod";
@@ -19,6 +19,8 @@ import { Input } from "./../../Input";
19
19
  import { RadioButton, RadioGroup } from "./../../RadioGroup";
20
20
  import { RangeSlider } from "./../../RangeSlider";
21
21
  import { Select } from "./../../Select";
22
+ import { SelectableCard } from "./../../SelectableCard/SelectableCard";
23
+ import { SelectableCardGroup } from "./../../SelectableCard/SelectableCardGroup";
22
24
  import { Switch } from "./../../Switch";
23
25
  import { TextArea } from "./../../TextArea";
24
26
  import stl from "./../../../styles/helpers/satellitePrefixer";
@@ -33,6 +35,7 @@ var initialFormData = {
33
35
  employmentStatus: "",
34
36
  birthday: null,
35
37
  age: "",
38
+ hobbies: [],
36
39
  interest: 0,
37
40
  idealLocation: [0, 50],
38
41
  profilePicture: null,
@@ -50,6 +53,7 @@ var jobPositions = ["Frontend Developer", "Backend Developer", "Fullstack Develo
50
53
  var now = new Date();
51
54
  var genders = ["please select", "woman", "man", "transgender man", "transgender woman", "non-binary", "agender", "prefer not to state"];
52
55
  var employmentStatuses = ["employed", "unemployed", "student"];
56
+ var hobbies = ["reading", "writing", "coding"];
53
57
  var zodSchema = z.object({
54
58
  firstName: z.string().min(1, {
55
59
  message: "You must specify a first name"
@@ -110,6 +114,15 @@ var zodSchema = z.object({
110
114
  }).lte(100, {
111
115
  message: "You must be at most 100 years old"
112
116
  }),
117
+ hobbies: z.array(z["enum"](hobbies, {
118
+ errorMap: function errorMap() {
119
+ return {
120
+ message: "You must specify at least one hobby"
121
+ };
122
+ }
123
+ })).min(1, {
124
+ message: "You must specify at least one hobby"
125
+ }),
113
126
  interest: z.number().min(5, {
114
127
  message: "Your level of interest must be at least 5"
115
128
  }),
@@ -405,18 +418,50 @@ export var RHFComplexComponent = function RHFComplexComponent() {
405
418
  });
406
419
  }
407
420
  }), /*#__PURE__*/_jsx(Controller, {
408
- name: "interest",
421
+ name: "hobbies",
409
422
  control: control,
410
423
  render: function render(_ref10) {
411
424
  var field = _ref10.field;
425
+ return /*#__PURE__*/_jsx(Field, {
426
+ label: "Hobbies",
427
+ labelFor: hobbies[0],
428
+ description: "Please specify your hobbies",
429
+ state: getFieldState("hobbies"),
430
+ className: stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["w-full"]))),
431
+ children: /*#__PURE__*/_jsx(SelectableCardGroup, {
432
+ type: "multiple",
433
+ className: stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["flex gap-2"]))),
434
+ value: field.value,
435
+ onValueChange: field.onChange,
436
+ required: true,
437
+ children: hobbies.map(function (hobby) {
438
+ return /*#__PURE__*/_jsx("label", {
439
+ htmlFor: hobby,
440
+ className: stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["flex-1 cursor-pointer"]))),
441
+ children: /*#__PURE__*/_jsx(SelectableCard, {
442
+ id: hobby,
443
+ value: hobby,
444
+ className: stl(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["p-4"]))),
445
+ children: capitalize(hobby)
446
+ })
447
+ }, hobby);
448
+ })
449
+ })
450
+ });
451
+ }
452
+ }), /*#__PURE__*/_jsx(Controller, {
453
+ name: "interest",
454
+ control: control,
455
+ render: function render(_ref11) {
456
+ var field = _ref11.field;
412
457
  return /*#__PURE__*/_jsxs(Field, {
413
458
  label: "Interest",
414
459
  labelFor: "interest",
415
460
  description: "Please specify your interest",
416
461
  state: getFieldState("interest"),
417
- className: stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["w-full"]))),
462
+ className: stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["w-full"]))),
418
463
  children: [/*#__PURE__*/_jsxs("p", {
419
- className: stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["display-caption flex justify-between mb-2"]))),
464
+ className: stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["display-caption flex justify-between mb-2"]))),
420
465
  children: [/*#__PURE__*/_jsx("span", {
421
466
  children: "0"
422
467
  }), /*#__PURE__*/_jsx("span", {
@@ -435,16 +480,16 @@ export var RHFComplexComponent = function RHFComplexComponent() {
435
480
  }), /*#__PURE__*/_jsx(Controller, {
436
481
  name: "idealLocation",
437
482
  control: control,
438
- render: function render(_ref11) {
439
- var field = _ref11.field;
483
+ render: function render(_ref12) {
484
+ var field = _ref12.field;
440
485
  return /*#__PURE__*/_jsxs(Field, {
441
486
  label: "Ideal Location",
442
487
  labelFor: "idealLocation",
443
488
  description: "Please specify your ideal location",
444
489
  state: getFieldState("idealLocation"),
445
- className: stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["w-full"]))),
490
+ className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["w-full"]))),
446
491
  children: [/*#__PURE__*/_jsxs("p", {
447
- className: stl(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["display-caption flex justify-between mb-2"]))),
492
+ className: stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["display-caption flex justify-between mb-2"]))),
448
493
  children: [/*#__PURE__*/_jsx("span", {
449
494
  children: "0 km"
450
495
  }), /*#__PURE__*/_jsx("span", {
@@ -470,14 +515,14 @@ export var RHFComplexComponent = function RHFComplexComponent() {
470
515
  }), /*#__PURE__*/_jsx(Controller, {
471
516
  name: "profilePicture",
472
517
  control: control,
473
- render: function render(_ref12) {
474
- var field = _ref12.field;
518
+ render: function render(_ref13) {
519
+ var field = _ref13.field;
475
520
  return /*#__PURE__*/_jsx(Field, {
476
521
  label: "Profile Picture",
477
522
  labelFor: "profilePicture",
478
523
  description: "Please upload your profile picture, 1 MB minimum",
479
524
  state: getFieldState("profilePicture"),
480
- className: stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["w-full"]))),
525
+ className: stl(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["w-full"]))),
481
526
  children: /*#__PURE__*/_jsx(Dropzone, _objectSpread(_objectSpread({
482
527
  id: "profilePicture",
483
528
  minSize: 1024 * 1024 * 1,
@@ -493,14 +538,14 @@ export var RHFComplexComponent = function RHFComplexComponent() {
493
538
  }), /*#__PURE__*/_jsx(Controller, {
494
539
  name: "bio",
495
540
  control: control,
496
- render: function render(_ref13) {
497
- var field = _ref13.field;
541
+ render: function render(_ref14) {
542
+ var field = _ref14.field;
498
543
  return /*#__PURE__*/_jsx(Field, {
499
544
  label: "Bio",
500
545
  labelFor: "bio",
501
546
  description: "Please write a short bio",
502
547
  state: getFieldState("bio"),
503
- className: stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["w-full"]))),
548
+ className: stl(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["w-full"]))),
504
549
  children: /*#__PURE__*/_jsx(TextArea, _objectSpread({
505
550
  id: "bio",
506
551
  required: true
@@ -510,14 +555,14 @@ export var RHFComplexComponent = function RHFComplexComponent() {
510
555
  }), /*#__PURE__*/_jsx(Controller, {
511
556
  name: "acceptTerms",
512
557
  control: control,
513
- render: function render(_ref14) {
514
- var field = _ref14.field;
558
+ render: function render(_ref15) {
559
+ var field = _ref15.field;
515
560
  return /*#__PURE__*/_jsx(Field, {
516
561
  label: "Accept Terms",
517
562
  labelFor: "acceptTerms",
518
563
  description: "Please accept the terms",
519
564
  state: getFieldState("acceptTerms"),
520
- className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["w-full"]))),
565
+ className: stl(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["w-full"]))),
521
566
  inline: true,
522
567
  children: /*#__PURE__*/_jsx(Checkbox, _objectSpread({
523
568
  id: "acceptTerms",
@@ -529,14 +574,14 @@ export var RHFComplexComponent = function RHFComplexComponent() {
529
574
  }), /*#__PURE__*/_jsx(Controller, {
530
575
  name: "newsletter",
531
576
  control: control,
532
- render: function render(_ref15) {
533
- var field = _ref15.field;
577
+ render: function render(_ref16) {
578
+ var field = _ref16.field;
534
579
  return /*#__PURE__*/_jsx(Field, {
535
580
  label: "Receive Newsletter",
536
581
  labelFor: "newsletter",
537
582
  description: "Do you want to receive our newsletter?",
538
583
  state: getFieldState("newsletter"),
539
- className: stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["w-full"]))),
584
+ className: stl(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["w-full"]))),
540
585
  inline: true,
541
586
  children: /*#__PURE__*/_jsx(Switch, _objectSpread({
542
587
  id: "newsletter",
@@ -546,7 +591,7 @@ export var RHFComplexComponent = function RHFComplexComponent() {
546
591
  });
547
592
  }
548
593
  }), /*#__PURE__*/_jsxs("div", {
549
- className: stl(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["flex gap-2"]))),
594
+ className: stl(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["flex gap-2"]))),
550
595
  children: [/*#__PURE__*/_jsx(FormSubmit, {
551
596
  variant: "primary",
552
597
  "aria-label": "Save the form",
@@ -560,9 +605,9 @@ export var RHFComplexComponent = function RHFComplexComponent() {
560
605
  })]
561
606
  })]
562
607
  }), /*#__PURE__*/_jsx("hr", {
563
- className: stl(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["text-grey-500"])))
608
+ className: stl(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["text-grey-500"])))
564
609
  }), /*#__PURE__*/_jsx("code", {
565
- className: stl(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["whitespace-pre display-code"]))),
610
+ className: stl(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["whitespace-pre display-code"]))),
566
611
  children: JSON.stringify(formData, null, 2)
567
612
  })]
568
613
  })
@@ -583,10 +628,11 @@ var yupSchema = yup.object({
583
628
  return value < now;
584
629
  }),
585
630
  age: yup.number().min(18, "You must be at least 18 years old").max(100, "You must be at most 100 years old").required("You must specify an age"),
631
+ hobbies: yup.array(yup.string().oneOf(hobbies)).min(1, "You must specify at least one hobby"),
586
632
  interest: yup.number().min(5, "Your level of interest must be at least 5").required(),
587
633
  idealLocation: yup.array(yup.number().min(10, "Your minimum ideal location must be 10 km").max(40, "Your maximum ideal location must be 40 km").required()).required(),
588
- profilePicture: yup.mixed().nullable().test("profilePicture", function (_ref16) {
589
- var value = _ref16.value;
634
+ profilePicture: yup.mixed().nullable().test("profilePicture", function (_ref17) {
635
+ var value = _ref17.value;
590
636
  return value.errors.map(function (error) {
591
637
  return error.message;
592
638
  }).join(", ");
@@ -638,9 +684,9 @@ export var FormikComplexComponent = function FormikComplexComponent() {
638
684
  };
639
685
  useFormikAutoFocusOnError(formik);
640
686
  return /*#__PURE__*/_jsx("div", {
641
- className: stl(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["@container w-full flex justify-center"]))),
687
+ className: stl(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["@container w-full flex justify-center"]))),
642
688
  children: /*#__PURE__*/_jsxs("div", {
643
- className: stl(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["flex flex-col gap-8 w-full @lg:w-1/2"]))),
689
+ className: stl(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["flex flex-col gap-8 w-full @lg:w-1/2"]))),
644
690
  children: [/*#__PURE__*/_jsxs(Form, {
645
691
  onSubmit: function onSubmit(e) {
646
692
  setRevalidationEnabled(true);
@@ -650,13 +696,13 @@ export var FormikComplexComponent = function FormikComplexComponent() {
650
696
  setRevalidationEnabled(false);
651
697
  formik.handleReset(e);
652
698
  },
653
- className: stl(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["flex flex-col items-start gap-6 min-w-72"]))),
699
+ className: stl(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["flex flex-col items-start gap-6 min-w-72"]))),
654
700
  children: [/*#__PURE__*/_jsx(FormErrorMessage, {}), /*#__PURE__*/_jsx(Field, {
655
701
  label: "First Name",
656
702
  labelFor: "firstName",
657
703
  description: "Please enter your first name",
658
704
  state: getFieldState("firstName"),
659
- className: stl(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["w-full"]))),
705
+ className: stl(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["w-full"]))),
660
706
  children: /*#__PURE__*/_jsx(Input, _objectSpread({
661
707
  id: "firstName",
662
708
  placeholder: "John",
@@ -667,7 +713,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
667
713
  labelFor: "lastName",
668
714
  description: "Please enter your last name",
669
715
  state: getFieldState("lastName"),
670
- className: stl(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["w-full"]))),
716
+ className: stl(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["w-full"]))),
671
717
  children: /*#__PURE__*/_jsx(Input, _objectSpread({
672
718
  id: "lastName",
673
719
  placeholder: "Doe",
@@ -678,7 +724,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
678
724
  labelFor: "password",
679
725
  description: "Please enter your password",
680
726
  state: getFieldState("password"),
681
- className: stl(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["w-full"]))),
727
+ className: stl(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["w-full"]))),
682
728
  children: /*#__PURE__*/_jsx(Input, _objectSpread({
683
729
  id: "password",
684
730
  placeholder: "Password",
@@ -690,14 +736,14 @@ export var FormikComplexComponent = function FormikComplexComponent() {
690
736
  labelFor: civilities[0],
691
737
  description: "Please enter your civility",
692
738
  state: getFieldState("civility"),
693
- className: stl(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["w-full"]))),
739
+ className: stl(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["w-full"]))),
694
740
  children: /*#__PURE__*/_jsx("div", {
695
- className: stl(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["flex gap-4 display-body"]))),
741
+ className: stl(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["flex gap-4 display-body"]))),
696
742
  children: civilities.map(function (civility, index) {
697
743
  return /*#__PURE__*/_jsxs("label", {
698
744
  id: index === 0 ? "civility" : undefined,
699
745
  htmlFor: civility,
700
- className: stl(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["flex items-center gap-1"]))),
746
+ className: stl(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["flex items-center gap-1"]))),
701
747
  children: [/*#__PURE__*/_jsx(RadioButton, _objectSpread({
702
748
  id: civility,
703
749
  "aria-labelledby": civility,
@@ -715,7 +761,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
715
761
  labelFor: "gender",
716
762
  description: "Please specify your gender",
717
763
  state: getFieldState("gender"),
718
- className: stl(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["w-full"]))),
764
+ className: stl(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["w-full"]))),
719
765
  children: /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
720
766
  id: "gender",
721
767
  required: true
@@ -732,7 +778,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
732
778
  labelFor: "jobPositions",
733
779
  description: "Please specify the job positions you are interested in",
734
780
  state: getFieldState("jobPositions"),
735
- className: stl(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["w-full"]))),
781
+ className: stl(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["w-full"]))),
736
782
  children: /*#__PURE__*/_jsx(AutoComplete, {
737
783
  id: "jobPositions",
738
784
  options: jobPositions,
@@ -751,7 +797,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
751
797
  labelFor: "employmentStatus",
752
798
  description: "Please specify your employment status",
753
799
  state: getFieldState("employmentStatus"),
754
- className: stl(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["w-full"]))),
800
+ className: stl(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["w-full"]))),
755
801
  children: /*#__PURE__*/_jsx(RadioGroup, {
756
802
  id: "employmentStatus",
757
803
  required: true,
@@ -771,7 +817,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
771
817
  labelFor: "birthday",
772
818
  description: "Please specify your birthday",
773
819
  state: getFieldState("birthday"),
774
- className: stl(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["w-full"]))),
820
+ className: stl(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["w-full"]))),
775
821
  children: /*#__PURE__*/_jsx(DateInput, {
776
822
  id: "birthday",
777
823
  required: true,
@@ -792,7 +838,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
792
838
  labelFor: "age",
793
839
  description: "Please specify your age",
794
840
  state: getFieldState("age"),
795
- className: stl(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral(["w-full"]))),
841
+ className: stl(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["w-full"]))),
796
842
  children: /*#__PURE__*/_jsx(Input, _objectSpread({
797
843
  id: "age",
798
844
  type: "number",
@@ -800,14 +846,41 @@ export var FormikComplexComponent = function FormikComplexComponent() {
800
846
  step: 1,
801
847
  required: true
802
848
  }, formik.getFieldProps("age")))
849
+ }), /*#__PURE__*/_jsx(Field, {
850
+ label: "Hobbies",
851
+ labelFor: hobbies[0],
852
+ description: "Please specify your hobbies",
853
+ state: getFieldState("hobbies"),
854
+ className: stl(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["w-full"]))),
855
+ children: /*#__PURE__*/_jsx(SelectableCardGroup, {
856
+ type: "multiple",
857
+ className: stl(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["flex gap-2"]))),
858
+ value: formik.values.hobbies,
859
+ onValueChange: function onValueChange(value) {
860
+ return formik.setFieldValue("hobbies", value);
861
+ },
862
+ required: true,
863
+ children: hobbies.map(function (hobby) {
864
+ return /*#__PURE__*/_jsx("label", {
865
+ htmlFor: hobby,
866
+ className: stl(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["flex-1 cursor-pointer"]))),
867
+ children: /*#__PURE__*/_jsx(SelectableCard, {
868
+ id: hobby,
869
+ value: hobby,
870
+ className: stl(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["p-4"]))),
871
+ children: capitalize(hobby)
872
+ })
873
+ }, hobby);
874
+ })
875
+ })
803
876
  }), /*#__PURE__*/_jsxs(Field, {
804
877
  label: "Interest",
805
878
  labelFor: "interest",
806
879
  description: "Please specify your interest",
807
880
  state: getFieldState("interest"),
808
- className: stl(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["w-full"]))),
881
+ className: stl(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["w-full"]))),
809
882
  children: [/*#__PURE__*/_jsxs("p", {
810
- className: stl(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["display-caption flex justify-between mb-2"]))),
883
+ className: stl(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["display-caption flex justify-between mb-2"]))),
811
884
  children: [/*#__PURE__*/_jsx("span", {
812
885
  children: "0"
813
886
  }), /*#__PURE__*/_jsx("span", {
@@ -830,9 +903,9 @@ export var FormikComplexComponent = function FormikComplexComponent() {
830
903
  labelFor: "idealLocation",
831
904
  description: "Please specify your ideal location",
832
905
  state: getFieldState("idealLocation"),
833
- className: stl(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["w-full"]))),
906
+ className: stl(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["w-full"]))),
834
907
  children: [/*#__PURE__*/_jsxs("p", {
835
- className: stl(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["display-caption flex justify-between mb-2"]))),
908
+ className: stl(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["display-caption flex justify-between mb-2"]))),
836
909
  children: [/*#__PURE__*/_jsx("span", {
837
910
  children: "0 km"
838
911
  }), /*#__PURE__*/_jsx("span", {
@@ -862,7 +935,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
862
935
  labelFor: "profilePicture",
863
936
  description: "Please upload your profile picture, 1 MB minimum",
864
937
  state: getFieldState("profilePicture"),
865
- className: stl(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["w-full"]))),
938
+ className: stl(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["w-full"]))),
866
939
  children: /*#__PURE__*/_jsx(Dropzone, {
867
940
  id: "profilePicture",
868
941
  minSize: 1024 * 1024 * 1,
@@ -877,7 +950,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
877
950
  labelFor: "bio",
878
951
  description: "Please write a short bio",
879
952
  state: getFieldState("bio"),
880
- className: stl(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["w-full"]))),
953
+ className: stl(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["w-full"]))),
881
954
  children: /*#__PURE__*/_jsx(TextArea, _objectSpread({
882
955
  id: "bio",
883
956
  required: true
@@ -887,7 +960,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
887
960
  labelFor: "acceptTerms",
888
961
  description: "Please accept the terms",
889
962
  state: getFieldState("acceptTerms"),
890
- className: stl(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["w-full"]))),
963
+ className: stl(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["w-full"]))),
891
964
  inline: true,
892
965
  children: /*#__PURE__*/_jsx(Checkbox, _objectSpread({
893
966
  id: "acceptTerms",
@@ -899,7 +972,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
899
972
  labelFor: "newsletter",
900
973
  description: "Do you want to receive our newsletter?",
901
974
  state: getFieldState("newsletter"),
902
- className: stl(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["w-full"]))),
975
+ className: stl(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["w-full"]))),
903
976
  inline: true,
904
977
  children: /*#__PURE__*/_jsx(Switch, _objectSpread({
905
978
  id: "newsletter",
@@ -907,7 +980,7 @@ export var FormikComplexComponent = function FormikComplexComponent() {
907
980
  checked: formik.values.newsletter
908
981
  }, formik.getFieldProps("newsletter")))
909
982
  }), /*#__PURE__*/_jsxs("div", {
910
- className: stl(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["flex gap-2"]))),
983
+ className: stl(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["flex gap-2"]))),
911
984
  children: [/*#__PURE__*/_jsx(FormSubmit, {
912
985
  variant: "primary",
913
986
  "aria-label": "Save the form",
@@ -921,9 +994,9 @@ export var FormikComplexComponent = function FormikComplexComponent() {
921
994
  })]
922
995
  })]
923
996
  }), /*#__PURE__*/_jsx("hr", {
924
- className: stl(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["text-grey-500"])))
997
+ className: stl(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["text-grey-500"])))
925
998
  }), /*#__PURE__*/_jsx("code", {
926
- className: stl(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["whitespace-pre display-code"]))),
999
+ className: stl(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["whitespace-pre display-code"]))),
927
1000
  children: JSON.stringify(formData, null, 2)
928
1001
  })]
929
1002
  })
@@ -6,9 +6,10 @@ var _excluded = ["className", "required"];
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  import cx from "clsx";
9
- import { forwardRef } from "react";
9
+ import { forwardRef, useMemo } from "react";
10
10
  import { useField } from "./../Field";
11
11
  import stl from "./../../styles/helpers/satellitePrefixer";
12
+ import { uniqueId } from "./../../utils";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  /**
14
15
  * The `RadioButton` component is a control that allows single selection from a set of options.
@@ -24,14 +25,20 @@ export var RadioButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
24
25
  required: required
25
26
  }),
26
27
  state = _useField.state,
27
- descriptionId = _useField.descriptionId;
28
+ descriptionId = _useField.descriptionId,
29
+ inputId = _useField.inputId;
30
+ var id = useMemo(function () {
31
+ var _ref2, _props$id;
32
+ return (_ref2 = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : inputId) !== null && _ref2 !== void 0 ? _ref2 : uniqueId("radio-button");
33
+ }, [props.id, inputId]);
28
34
  var isInvalid = state.status === "invalid";
29
35
  return /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({
30
36
  "aria-describedby": descriptionId
31
37
  }, props), {}, {
32
38
  required: required,
39
+ id: id,
33
40
  "aria-invalid": isInvalid,
34
- className: cx(stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["radio-button focusable ", ""])), isInvalid && "radio-button-invalid"), className),
41
+ className: cx(stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["radio-button focusable-visible ", ""])), isInvalid && "radio-button-invalid"), className),
35
42
  type: "radio",
36
43
  ref: ref
37
44
  }));
@@ -38,7 +38,7 @@ var radioButtonPlugin = plugin(function (_ref) {
38
38
  background: theme("colors.accent.600"),
39
39
  borderRadius: "50%"
40
40
  },
41
- "&:hover": {
41
+ "&:not(.radio-button:disabled):hover": {
42
42
  borderColor: theme("colors.accent.700")
43
43
  }
44
44
  },
@@ -43,7 +43,7 @@ export var RadioGroupItem = function RadioGroupItem(_ref) {
43
43
  className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex-1 truncate ", ""])), textPosition === "right" ? "ml-2" : "mr-2"),
44
44
  children: children
45
45
  }), /*#__PURE__*/_jsx(RadioButton, {
46
- id: checked || isFirstChild && !contextValue ? id : undefined,
46
+ id: checked || isFirstChild && !contextValue ? id : uniqueId("radio-group-item"),
47
47
  className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["shrink-0 self-start mt-1"]))),
48
48
  value: value,
49
49
  checked: checked,
@@ -50,9 +50,10 @@ var selectPlugin = plugin(function (_ref) {
50
50
  },
51
51
  "&:disabled": {
52
52
  cursor: "not-allowed",
53
- color: theme("colors.grey.300"),
54
- backgroundImage: "\n ".concat(selectIconBG(theme("colors.grey.300")), ",\n linear-gradient(-180deg, ").concat(theme("colors.white"), " 0%, ").concat(theme("colors.grey.100"), " 100%)\n "),
55
- borderColor: disabledColor(theme("colors.grey.200")),
53
+ color: theme("colors.grey.600"),
54
+ backgroundColor: theme("colors.grey.100"),
55
+ backgroundImage: selectIconBG(theme("colors.grey.600")),
56
+ borderColor: theme("colors.grey.200"),
56
57
  boxShadow: "none"
57
58
  }
58
59
  },
@@ -0,0 +1,35 @@
1
+ import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
2
+ import type { CardProps } from "../../Layout";
3
+ import { Card } from "../../Layout";
4
+ declare type SelectableCardBaseProps = Omit<CardProps, "elevation"> & {
5
+ /**
6
+ * The color of the selected card.
7
+ */
8
+ selectedColor?: keyof typeof SELECTED_COLOR_CLASSNAMES;
9
+ };
10
+ export declare type SelectableCardProps = SelectableCardBaseProps & {
11
+ /**
12
+ * Whether the `SelectableCard` is disabled.
13
+ */
14
+ disabled?: boolean;
15
+ /**
16
+ * The value of the `SelectableCard`.
17
+ */
18
+ value: string;
19
+ };
20
+ interface SelectableCardType extends ForwardRefExoticComponent<PropsWithoutRef<SelectableCardProps> & RefAttributes<HTMLElement>> {
21
+ Header: typeof Card.Header;
22
+ Title: typeof Card.Title;
23
+ }
24
+ declare const SELECTED_COLOR_CLASSNAMES: {
25
+ readonly grey: string;
26
+ readonly pink: string;
27
+ readonly accent: string;
28
+ readonly blue: string;
29
+ readonly green: string;
30
+ readonly orange: string;
31
+ readonly red: string;
32
+ readonly xenon: string;
33
+ };
34
+ export declare const SelectableCard: SelectableCardType;
35
+ export {};