@team-frieeren/components 1.0.1 → 1.0.2

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/dist/client.d.ts CHANGED
@@ -3,3 +3,5 @@ export { safeLocalStorage, safeSessionStorage } from "./shared/storage";
3
3
  export { RouterProvider, useRouter } from "./hooks/useRouter";
4
4
  export { WindowRouter } from "./router/windowRouter";
5
5
  export { useToast, ToastProvider } from "./components/Toast";
6
+ export { Popup } from "./components/Popup";
7
+ export { BottomSheet } from "./components/BottomSheet";
package/dist/client.js CHANGED
@@ -3,6 +3,8 @@ import * as React from 'react';
3
3
  import { Children, isValidElement, useEffect, createContext, useContext, useMemo, useCallback, useState, Fragment as Fragment$1 } from 'react';
4
4
  import cx from 'classnames';
5
5
  import { createPortal } from 'react-dom';
6
+ import { Dialog } from 'radix-ui';
7
+ import { Drawer } from 'vaul';
6
8
 
7
9
  var _assign = function __assign() {
8
10
  _assign = Object.assign || function __assign(t) {
@@ -630,4 +632,222 @@ var useToast = function useToast() {
630
632
  return context;
631
633
  };
632
634
 
633
- export { RouterProvider, ToastProvider, WindowRouter, safeLocalStorage, safeSessionStorage, useFunnel, useRouter, useToast };
635
+ var Popup = function Popup(props) {
636
+ var _a;
637
+ var className = props.className,
638
+ children = props.children,
639
+ buttonLayoutType = props.buttonLayoutType,
640
+ container = props.container,
641
+ title = props.title,
642
+ description = props.description,
643
+ onClose = props.onClose,
644
+ rest = __rest(props, ["className", "children", "buttonLayoutType", "container", "title", "description", "onClose"]);
645
+ return jsx(Dialog.Root, _assign({}, rest, {
646
+ defaultOpen: true,
647
+ children: jsxs(Dialog.Portal, {
648
+ container: container || document.body,
649
+ children: [jsx(Dialog.Overlay, {
650
+ className: "popup--overlay",
651
+ onClick: onClose
652
+ }), jsxs(Dialog.Content, {
653
+ "data-frieeren-component": "Popup",
654
+ className: cx("popup", (_a = {}, _a["popup--layout-".concat(buttonLayoutType)] = buttonLayoutType, _a), className),
655
+ children: [jsx(Dialog.Title, {
656
+ className: "visually-hidden",
657
+ children: title || "Popup"
658
+ }), jsx(Dialog.Description, {
659
+ className: "visually-hidden",
660
+ children: description || "Popup"
661
+ }), jsx("div", {
662
+ className: "popup--body",
663
+ children: children
664
+ }), buttonLayoutType === "typeA" && "button" in props && props.button && jsx("div", {
665
+ className: "popup--actions",
666
+ children: props.button
667
+ }), buttonLayoutType === "typeB" && "leftButton" in props && "rightButton" in props && jsxs("div", {
668
+ className: "popup--actions popup--actions-typeB",
669
+ children: [jsx("div", {
670
+ className: "popup--actions-left",
671
+ children: props.leftButton
672
+ }), jsx("div", {
673
+ className: "popup--actions-right",
674
+ children: props.rightButton
675
+ })]
676
+ })]
677
+ })]
678
+ })
679
+ }));
680
+ };
681
+
682
+ var SpacingMap = {
683
+ m: ["margin"],
684
+ mx: ["marginLeft", "marginRight"],
685
+ my: ["marginTop", "marginBottom"],
686
+ mt: ["marginTop"],
687
+ mb: ["marginBottom"],
688
+ ml: ["marginLeft"],
689
+ mr: ["marginRight"],
690
+ p: ["padding"],
691
+ px: ["paddingLeft", "paddingRight"],
692
+ py: ["paddingTop", "paddingBottom"],
693
+ pt: ["paddingTop"],
694
+ pb: ["paddingBottom"],
695
+ pl: ["paddingLeft"],
696
+ pr: ["paddingRight"]
697
+ };
698
+ var getSpacingStyle = function getSpacingStyle(props) {
699
+ var style = {};
700
+ Object.entries(props).forEach(function (_a) {
701
+ var key = _a[0],
702
+ value = _a[1];
703
+ if (value === undefined) return;
704
+ var properties = SpacingMap[key];
705
+ properties.forEach(function (property) {
706
+ style[property] = value;
707
+ });
708
+ });
709
+ return style;
710
+ };
711
+
712
+ function Box(_a) {
713
+ var _b = _a.as,
714
+ Component = _b === void 0 ? "div" : _b,
715
+ className = _a.className,
716
+ style = _a.style,
717
+ width = _a.width,
718
+ height = _a.height,
719
+ _c = _a.display,
720
+ display = _c === void 0 ? "inline-block" : _c,
721
+ children = _a.children,
722
+ rest = __rest(_a, ["as", "className", "style", "width", "height", "display", "children"]);
723
+ var m = rest.m,
724
+ mt = rest.mt,
725
+ mb = rest.mb,
726
+ ml = rest.ml,
727
+ mr = rest.mr,
728
+ mx = rest.mx,
729
+ my = rest.my,
730
+ p = rest.p,
731
+ pt = rest.pt,
732
+ pb = rest.pb,
733
+ pl = rest.pl,
734
+ pr = rest.pr,
735
+ px = rest.px,
736
+ py = rest.py,
737
+ props = __rest(rest, ["m", "mt", "mb", "ml", "mr", "mx", "my", "p", "pt", "pb", "pl", "pr", "px", "py"]);
738
+ var spacingStyle = getSpacingStyle({
739
+ m: m,
740
+ mt: mt,
741
+ mb: mb,
742
+ ml: ml,
743
+ mr: mr,
744
+ mx: mx,
745
+ my: my,
746
+ p: p,
747
+ pt: pt,
748
+ pb: pb,
749
+ pl: pl,
750
+ pr: pr,
751
+ px: px,
752
+ py: py
753
+ });
754
+ return jsx(Component, _assign({
755
+ "data-frieeren-component": "Box",
756
+ className: cx("box", className),
757
+ style: _assign(_assign({
758
+ width: width,
759
+ height: height,
760
+ display: display
761
+ }, spacingStyle), style)
762
+ }, props, {
763
+ children: children
764
+ }));
765
+ }
766
+
767
+ function Flex(_a) {
768
+ var _b = _a.as,
769
+ Component = _b === void 0 ? "div" : _b,
770
+ align = _a.align,
771
+ justify = _a.justify,
772
+ flex = _a.flex,
773
+ direction = _a.direction,
774
+ wrap = _a.wrap,
775
+ gap = _a.gap,
776
+ className = _a.className,
777
+ style = _a.style,
778
+ rest = __rest(_a, ["as", "align", "justify", "flex", "direction", "wrap", "gap", "className", "style"]);
779
+ return jsx(Box, _assign({
780
+ "data-frieeren-component": "Flex",
781
+ as: Component,
782
+ className: cx("flex", className),
783
+ style: _assign({
784
+ display: "flex",
785
+ alignItems: align,
786
+ justifyContent: justify,
787
+ flex: flex,
788
+ flexDirection: direction,
789
+ flexWrap: wrap,
790
+ gap: gap
791
+ }, style)
792
+ }, rest));
793
+ }
794
+
795
+ var BottomSheet = function BottomSheet(_a) {
796
+ var _b;
797
+ var open = _a.open,
798
+ onClose = _a.onClose,
799
+ _c = _a.locked,
800
+ locked = _c === void 0 ? true : _c,
801
+ _d = _a.showHandle,
802
+ showHandle = _d === void 0 ? true : _d,
803
+ _e = _a.handleOnly,
804
+ handleOnly = _e === void 0 ? false : _e,
805
+ radius = _a.radius,
806
+ _f = _a.theme,
807
+ theme = _f === void 0 ? "light" : _f,
808
+ _g = _a.zIndex,
809
+ zIndex = _g === void 0 ? 1 : _g,
810
+ className = _a.className,
811
+ children = _a.children;
812
+ return jsx(Drawer.Root, {
813
+ open: open,
814
+ onClose: onClose,
815
+ modal: locked,
816
+ handleOnly: handleOnly,
817
+ children: jsxs(Drawer.Portal, {
818
+ children: [jsx(Drawer.Overlay, {
819
+ className: "overlay",
820
+ "data-frieeren-component": "BottomSheetOverlay",
821
+ style: {
822
+ zIndex: zIndex
823
+ }
824
+ }), jsxs(Drawer.Content, {
825
+ className: cx("drawer-content", (_b = {}, _b["bottomsheet-container--radius-".concat(radius)] = radius, _b["bottomsheet-container--theme-".concat(theme)] = theme, _b), className),
826
+ "data-frieeren-component": "BottomSheet",
827
+ style: {
828
+ zIndex: zIndex
829
+ },
830
+ children: [jsx(SwitchCase, {
831
+ value: String(showHandle),
832
+ caseBy: {
833
+ "true": jsx(Flex, {
834
+ className: "drawer-handle",
835
+ align: "center",
836
+ justify: "center",
837
+ children: jsx(Drawer.Handle, {
838
+ style: {
839
+ width: 36
840
+ }
841
+ })
842
+ })
843
+ }
844
+ }), jsx("div", {
845
+ className: "drawer-content-inner",
846
+ children: children
847
+ })]
848
+ })]
849
+ })
850
+ });
851
+ };
852
+
853
+ export { BottomSheet, Popup, RouterProvider, ToastProvider, WindowRouter, safeLocalStorage, safeSessionStorage, useFunnel, useRouter, useToast };
package/dist/index.css CHANGED
@@ -1669,75 +1669,6 @@ button {
1669
1669
  .toggle-thumb[data-state=checked] {
1670
1670
  transform: translateX(26px);
1671
1671
  }
1672
- .popup {
1673
- background-color: var(--seed-ui-color-background-white);
1674
- border-radius: 16px;
1675
- box-shadow: 0px 4px 16px 0px rgba(109, 109, 109, 0.07);
1676
- position: fixed;
1677
- top: 50%;
1678
- left: 50%;
1679
- transform: translate(-50%, -50%);
1680
- width: 100%;
1681
- max-width: 450px;
1682
- max-height: 85vh;
1683
- padding: 24px 16px;
1684
- animation: popup-content-show 150ms cubic-bezier(0.16, 1, 0.3, 1);
1685
- overflow-y: auto;
1686
- }
1687
- .popup:focus {
1688
- outline: none;
1689
- }
1690
- .popup--actions {
1691
- display: flex;
1692
- justify-content: flex-end;
1693
- gap: 8px;
1694
- margin-top: 24px;
1695
- }
1696
- .popup--actions > * {
1697
- flex: 1;
1698
- }
1699
- .popup--actions-typeB {
1700
- display: flex;
1701
- justify-content: space-between;
1702
- gap: 8px;
1703
- }
1704
- .popup--actions-left {
1705
- min-width: 76px;
1706
- flex: 0 0 auto;
1707
- }
1708
- .popup--actions-right {
1709
- flex: 1 1 auto;
1710
- }
1711
- @keyframes popup-overlay-show {
1712
- from {
1713
- opacity: 0;
1714
- }
1715
- to {
1716
- opacity: 1;
1717
- }
1718
- }
1719
- @keyframes popup-content-show {
1720
- from {
1721
- opacity: 0;
1722
- transform: translate(-50%, -48%) scale(0.96);
1723
- }
1724
- to {
1725
- opacity: 1;
1726
- transform: translate(-50%, -50%) scale(1);
1727
- }
1728
- }
1729
- .visually-hidden {
1730
- border: 0;
1731
- clip: rect(0 0 0 0);
1732
- height: 1px;
1733
- margin: -1px;
1734
- overflow: hidden;
1735
- padding: 0;
1736
- position: absolute;
1737
- width: 1px;
1738
- white-space: nowrap;
1739
- word-wrap: normal;
1740
- }
1741
1672
  @charset "UTF-8";
1742
1673
  :root {
1743
1674
  --input-transition: 0.2s ease-in-out;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,5 @@ export { RadioGroup } from "./components/RadioGroup";
9
9
  export { Checkbox } from "./components/Checkbox";
10
10
  export { Toggle } from "./components/Toggle";
11
11
  export { Select } from "./components/Select";
12
- export { Popup } from "./components/Popup";
13
- export { BottomSheet } from "./components/BottomSheet";
14
12
  export { Input } from "./components/Input";
15
13
  export { Tabs } from "./components/Tabs";
package/dist/index.js CHANGED
@@ -4,9 +4,8 @@ import * as React from 'react';
4
4
  import { forwardRef, useState, useCallback, useEffect, useRef } from 'react';
5
5
  import * as RadioGroupBase from '@radix-ui/react-radio-group';
6
6
  import * as CheckboxBase from '@radix-ui/react-checkbox';
7
- import { Switch, Dialog } from 'radix-ui';
7
+ import { Switch } from 'radix-ui';
8
8
  import * as SelectBase from '@radix-ui/react-select';
9
- import { Drawer } from 'vaul';
10
9
  import * as TabsBase from '@radix-ui/react-tabs';
11
10
 
12
11
  var _assign = function __assign() {
@@ -434,123 +433,6 @@ var Select = {
434
433
  Value: Value
435
434
  };
436
435
 
437
- var Popup = function Popup(props) {
438
- var _a;
439
- var className = props.className,
440
- children = props.children,
441
- buttonLayoutType = props.buttonLayoutType,
442
- container = props.container,
443
- title = props.title,
444
- description = props.description,
445
- onClose = props.onClose,
446
- rest = __rest(props, ["className", "children", "buttonLayoutType", "container", "title", "description", "onClose"]);
447
- return jsx(Dialog.Root, _assign({}, rest, {
448
- defaultOpen: true,
449
- children: jsxs(Dialog.Portal, {
450
- container: container || document.body,
451
- children: [jsx(Dialog.Overlay, {
452
- className: "popup--overlay",
453
- onClick: onClose
454
- }), jsxs(Dialog.Content, {
455
- "data-frieeren-component": "Popup",
456
- className: cx("popup", (_a = {}, _a["popup--layout-".concat(buttonLayoutType)] = buttonLayoutType, _a), className),
457
- children: [jsx(Dialog.Title, {
458
- className: "visually-hidden",
459
- children: title || "Popup"
460
- }), jsx(Dialog.Description, {
461
- className: "visually-hidden",
462
- children: description || "Popup"
463
- }), jsx("div", {
464
- className: "popup--body",
465
- children: children
466
- }), buttonLayoutType === "typeA" && "button" in props && props.button && jsx("div", {
467
- className: "popup--actions",
468
- children: props.button
469
- }), buttonLayoutType === "typeB" && "leftButton" in props && "rightButton" in props && jsxs("div", {
470
- className: "popup--actions popup--actions-typeB",
471
- children: [jsx("div", {
472
- className: "popup--actions-left",
473
- children: props.leftButton
474
- }), jsx("div", {
475
- className: "popup--actions-right",
476
- children: props.rightButton
477
- })]
478
- })]
479
- })]
480
- })
481
- }));
482
- };
483
-
484
- function SwitchCase(_a) {
485
- var _b;
486
- var value = _a.value,
487
- caseBy = _a.caseBy,
488
- _c = _a.defaultComponent,
489
- defaultComponent = _c === void 0 ? null : _c;
490
- if (value == null) {
491
- return defaultComponent;
492
- }
493
- return (_b = caseBy[value]) !== null && _b !== void 0 ? _b : defaultComponent;
494
- }
495
-
496
- var BottomSheet = function BottomSheet(_a) {
497
- var _b;
498
- var open = _a.open,
499
- onClose = _a.onClose,
500
- _c = _a.locked,
501
- locked = _c === void 0 ? true : _c,
502
- _d = _a.showHandle,
503
- showHandle = _d === void 0 ? true : _d,
504
- _e = _a.handleOnly,
505
- handleOnly = _e === void 0 ? false : _e,
506
- radius = _a.radius,
507
- _f = _a.theme,
508
- theme = _f === void 0 ? "light" : _f,
509
- _g = _a.zIndex,
510
- zIndex = _g === void 0 ? 1 : _g,
511
- className = _a.className,
512
- children = _a.children;
513
- return jsx(Drawer.Root, {
514
- open: open,
515
- onClose: onClose,
516
- modal: locked,
517
- handleOnly: handleOnly,
518
- children: jsxs(Drawer.Portal, {
519
- children: [jsx(Drawer.Overlay, {
520
- className: "overlay",
521
- "data-frieeren-component": "BottomSheetOverlay",
522
- style: {
523
- zIndex: zIndex
524
- }
525
- }), jsxs(Drawer.Content, {
526
- className: cx("drawer-content", (_b = {}, _b["bottomsheet-container--radius-".concat(radius)] = radius, _b["bottomsheet-container--theme-".concat(theme)] = theme, _b), className),
527
- "data-frieeren-component": "BottomSheet",
528
- style: {
529
- zIndex: zIndex
530
- },
531
- children: [jsx(SwitchCase, {
532
- value: String(showHandle),
533
- caseBy: {
534
- "true": jsx(Flex, {
535
- className: "drawer-handle",
536
- align: "center",
537
- justify: "center",
538
- children: jsx(Drawer.Handle, {
539
- style: {
540
- width: 36
541
- }
542
- })
543
- })
544
- }
545
- }), jsx("div", {
546
- className: "drawer-content-inner",
547
- children: children
548
- })]
549
- })]
550
- })
551
- });
552
- };
553
-
554
436
  var _rect, _path$1;
555
437
  function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
556
438
  var SvgClose = function SvgClose(props) {
@@ -783,4 +665,4 @@ var Tabs = function Tabs(props) {
783
665
  }));
784
666
  };
785
667
 
786
- export { BottomSheet, Box, Button, Checkbox, Container, Flex, Grid, Input, Popup, RadioGroup, Select, Tabs, Text, Toggle };
668
+ export { Box, Button, Checkbox, Container, Flex, Grid, Input, RadioGroup, Select, Tabs, Text, Toggle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-frieeren/components",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",