@gobolt/genesis 0.9.3 → 0.10.1

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.
@@ -0,0 +1,32 @@
1
+ import { ReactNode } from 'react';
2
+ import { DrawerProps } from 'antd';
3
+ import { ButtonProps } from '../Button';
4
+ type BottomDrawerAction = {
5
+ label: string;
6
+ onClick: () => void;
7
+ btnProps?: ButtonProps;
8
+ };
9
+ export interface BottomDrawerProps {
10
+ open: boolean;
11
+ onClose: () => void;
12
+ type?: "full" | "float";
13
+ /** Drawer height. Bottom drawers size on the vertical axis (default 88). */
14
+ height?: number | string;
15
+ /** Left-aligned description / status text (string is styled; nodes render as-is). */
16
+ label?: ReactNode;
17
+ /** Right-aligned action buttons (e.g. Cancel + Confirm). */
18
+ actions?: BottomDrawerAction[];
19
+ /**
20
+ * Where to mount the drawer. By default it portals to `document.body` (full
21
+ * viewport width). Pass a positioned container (a node getter) or `false` to
22
+ * render it inside a `position: relative` parent, scoped to that parent's width.
23
+ */
24
+ getContainer?: DrawerProps["getContainer"];
25
+ }
26
+ /**
27
+ * A slim slide-up drawer for user confirmation: a description on the left and
28
+ * actions on the right. Shares SidePanel's slide-up + overlay behavior, but the
29
+ * contents are intentionally trimmed to a single action row.
30
+ */
31
+ declare const BottomDrawer: ({ open, onClose, type, height, label, actions, getContainer, }: BottomDrawerProps) => import("react/jsx-runtime").JSX.Element;
32
+ export default BottomDrawer;
@@ -0,0 +1,8 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as BottomDrawer } from '../BottomDrawer';
3
+ declare const meta: Meta<typeof BottomDrawer>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof BottomDrawer>;
6
+ export declare const UnsavedChanges: Story;
7
+ export declare const FloatType: Story;
8
+ export declare const Contained: Story;
@@ -0,0 +1,2 @@
1
+ export { default } from './BottomDrawer';
2
+ export type { BottomDrawerProps } from './BottomDrawer';
@@ -0,0 +1 @@
1
+ export declare const StyledBottomDrawer: any;
@@ -67,6 +67,8 @@ export { default as Shapes } from './Shapes';
67
67
  export type { ShapesProps } from './Shapes';
68
68
  export { default as SidePanel } from './SidePanel';
69
69
  export type { SidePanelProps } from './SidePanel';
70
+ export { default as BottomDrawer } from './BottomDrawer';
71
+ export type { BottomDrawerProps } from './BottomDrawer';
70
72
  export { default as Switch } from './Switch';
71
73
  export type { SwitchProps } from './Switch';
72
74
  export { default as Table } from './Table';
package/dist/index.cjs CHANGED
@@ -87570,7 +87570,7 @@ const Shapes = ({ variant = "triangle", fill }) => {
87570
87570
  }
87571
87571
  return /* @__PURE__ */ jsxRuntime.jsx(Triangle, { fill, dataTestId: "shape-triangle" });
87572
87572
  };
87573
- const getGenesisDrawerClass = ({ borderRadius: borderRadius2, sizing: sizing2 }, $type = "float", placement = "right") => {
87573
+ const getGenesisDrawerClass$1 = ({ borderRadius: borderRadius2, sizing: sizing2 }, $type = "float", placement = "right") => {
87574
87574
  const isFloat = $type === "float";
87575
87575
  const offset2 = isFloat ? 24 : 0;
87576
87576
  const edge = placement === "right" ? "right" : "left";
@@ -87608,7 +87608,7 @@ const StyledSidePanel = styled(Drawer2).attrs({
87608
87608
  })`
87609
87609
  ${({ theme, $type = "float", placement = "right" }) => {
87610
87610
  if (!theme) return "";
87611
- return getGenesisDrawerClass(theme, $type, placement);
87611
+ return getGenesisDrawerClass$1(theme, $type, placement);
87612
87612
  }}
87613
87613
  `;
87614
87614
  const ScrollableContent = styled.div`
@@ -87851,6 +87851,116 @@ const SidePanel = ({
87851
87851
  }
87852
87852
  );
87853
87853
  };
87854
+ const getGenesisDrawerClass = ({ borderRadius: borderRadius2 }, $type = "full") => {
87855
+ const isFloat = $type === "float";
87856
+ const offset2 = isFloat ? 24 : 0;
87857
+ const radius2 = borderRadius2.BorderRadiusMd;
87858
+ return `
87859
+ .ant-drawer-content-wrapper {
87860
+ box-shadow: none !important;
87861
+ ${isFloat ? `
87862
+ left: ${offset2}px !important;
87863
+ right: ${offset2}px !important;
87864
+ bottom: ${offset2}px !important;
87865
+ width: auto !important;
87866
+ ` : ""}
87867
+ }
87868
+
87869
+ .ant-drawer-content {
87870
+ box-shadow: none !important;
87871
+ border-radius: ${isFloat ? `${radius2}px` : "0"} !important;
87872
+ }
87873
+
87874
+ .ant-drawer-body {
87875
+ padding: 0;
87876
+ display: flex;
87877
+ align-items: center;
87878
+ height: 100%;
87879
+ }
87880
+ `;
87881
+ };
87882
+ const StyledBottomDrawer = styled(Drawer2).attrs({
87883
+ destroyOnHidden: true,
87884
+ push: false
87885
+ })`
87886
+ ${({ theme, $type = "full" }) => {
87887
+ if (!theme) return "";
87888
+ return getGenesisDrawerClass(theme, $type);
87889
+ }}
87890
+ `;
87891
+ const BottomDrawer = ({
87892
+ open,
87893
+ onClose,
87894
+ type: type4 = "full",
87895
+ height = 88,
87896
+ label,
87897
+ actions = [],
87898
+ getContainer: getContainer2
87899
+ }) => {
87900
+ const theme = styled.useTheme();
87901
+ const spacing = {
87902
+ Size4: theme?.sizing?.Size4 || 16,
87903
+ Size8: theme?.sizing?.Size8 || 32
87904
+ };
87905
+ const textColor = theme?.colors?.onsurface?.active?.textColor || "#3E3E3E";
87906
+ const isFloat = type4 === "float";
87907
+ const isContained = getContainer2 !== void 0;
87908
+ const floatOffset = 24;
87909
+ const border = "1px solid var(--interactive-utility-border, #CBCBCB)";
87910
+ const sharedStyles = {
87911
+ wrapper: { boxShadow: "none" },
87912
+ content: {
87913
+ boxShadow: "none",
87914
+ borderTop: border,
87915
+ borderRadius: 0
87916
+ },
87917
+ body: { padding: 0, display: "flex", alignItems: "center", height: "100%" }
87918
+ };
87919
+ const drawerStyles = isFloat ? {
87920
+ ...sharedStyles,
87921
+ wrapper: {
87922
+ boxShadow: "none",
87923
+ left: `${floatOffset}px`,
87924
+ right: `${floatOffset}px`,
87925
+ bottom: `${floatOffset}px`,
87926
+ width: "auto"
87927
+ },
87928
+ content: { boxShadow: "none", border, borderRadius: "12px" }
87929
+ } : sharedStyles;
87930
+ return /* @__PURE__ */ jsxRuntime.jsx(
87931
+ StyledBottomDrawer,
87932
+ {
87933
+ closable: false,
87934
+ mask: false,
87935
+ onClose,
87936
+ placement: "bottom",
87937
+ height,
87938
+ open,
87939
+ $type: type4,
87940
+ styles: drawerStyles,
87941
+ getContainer: getContainer2,
87942
+ rootStyle: isContained ? { position: "absolute" } : void 0,
87943
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
87944
+ Tile,
87945
+ {
87946
+ isHorizontal: true,
87947
+ style: {
87948
+ alignItems: "center",
87949
+ justifyContent: "space-between",
87950
+ gap: `${spacing.Size4}px`,
87951
+ padding: `0 ${spacing.Size8}px`,
87952
+ width: "100%",
87953
+ height: "100%"
87954
+ },
87955
+ children: [
87956
+ typeof label === "string" ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { fontSize: "20px", fontWeight: 400, color: textColor, children: label }) : label,
87957
+ actions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Tile, { isHorizontal: true, style: { gap: `${spacing.Size4}px` }, children: actions.map((action, index2) => /* @__PURE__ */ jsxRuntime.jsx(Button$1, { ...action.btnProps, onClick: action.onClick, children: action.label }, index2)) })
87958
+ ]
87959
+ }
87960
+ )
87961
+ }
87962
+ );
87963
+ };
87854
87964
  const getGenesisClass$3 = ({ colors: colors2, borderRadius: borderRadius2 }) => `
87855
87965
  &.ant-switch {
87856
87966
  background-color: ${colors2.primary.active};
@@ -91307,6 +91417,7 @@ const GlobalStyles = styled.createGlobalStyle`
91307
91417
  exports.Avatar = Avatar;
91308
91418
  exports.Badge = Badge$1;
91309
91419
  exports.BarChart = BarChart;
91420
+ exports.BottomDrawer = BottomDrawer;
91310
91421
  exports.Breadcrumb = Breadcrumb;
91311
91422
  exports.Button = Button$1;
91312
91423
  exports.Card = Card;
package/dist/index.js CHANGED
@@ -87552,7 +87552,7 @@ const Shapes = ({ variant = "triangle", fill }) => {
87552
87552
  }
87553
87553
  return /* @__PURE__ */ jsx(Triangle, { fill, dataTestId: "shape-triangle" });
87554
87554
  };
87555
- const getGenesisDrawerClass = ({ borderRadius: borderRadius2, sizing: sizing2 }, $type = "float", placement = "right") => {
87555
+ const getGenesisDrawerClass$1 = ({ borderRadius: borderRadius2, sizing: sizing2 }, $type = "float", placement = "right") => {
87556
87556
  const isFloat = $type === "float";
87557
87557
  const offset2 = isFloat ? 24 : 0;
87558
87558
  const edge = placement === "right" ? "right" : "left";
@@ -87590,7 +87590,7 @@ const StyledSidePanel = styled(Drawer2).attrs({
87590
87590
  })`
87591
87591
  ${({ theme, $type = "float", placement = "right" }) => {
87592
87592
  if (!theme) return "";
87593
- return getGenesisDrawerClass(theme, $type, placement);
87593
+ return getGenesisDrawerClass$1(theme, $type, placement);
87594
87594
  }}
87595
87595
  `;
87596
87596
  const ScrollableContent = styled.div`
@@ -87833,6 +87833,116 @@ const SidePanel = ({
87833
87833
  }
87834
87834
  );
87835
87835
  };
87836
+ const getGenesisDrawerClass = ({ borderRadius: borderRadius2 }, $type = "full") => {
87837
+ const isFloat = $type === "float";
87838
+ const offset2 = isFloat ? 24 : 0;
87839
+ const radius2 = borderRadius2.BorderRadiusMd;
87840
+ return `
87841
+ .ant-drawer-content-wrapper {
87842
+ box-shadow: none !important;
87843
+ ${isFloat ? `
87844
+ left: ${offset2}px !important;
87845
+ right: ${offset2}px !important;
87846
+ bottom: ${offset2}px !important;
87847
+ width: auto !important;
87848
+ ` : ""}
87849
+ }
87850
+
87851
+ .ant-drawer-content {
87852
+ box-shadow: none !important;
87853
+ border-radius: ${isFloat ? `${radius2}px` : "0"} !important;
87854
+ }
87855
+
87856
+ .ant-drawer-body {
87857
+ padding: 0;
87858
+ display: flex;
87859
+ align-items: center;
87860
+ height: 100%;
87861
+ }
87862
+ `;
87863
+ };
87864
+ const StyledBottomDrawer = styled(Drawer2).attrs({
87865
+ destroyOnHidden: true,
87866
+ push: false
87867
+ })`
87868
+ ${({ theme, $type = "full" }) => {
87869
+ if (!theme) return "";
87870
+ return getGenesisDrawerClass(theme, $type);
87871
+ }}
87872
+ `;
87873
+ const BottomDrawer = ({
87874
+ open,
87875
+ onClose,
87876
+ type: type4 = "full",
87877
+ height = 88,
87878
+ label,
87879
+ actions = [],
87880
+ getContainer: getContainer2
87881
+ }) => {
87882
+ const theme = useTheme$1();
87883
+ const spacing = {
87884
+ Size4: theme?.sizing?.Size4 || 16,
87885
+ Size8: theme?.sizing?.Size8 || 32
87886
+ };
87887
+ const textColor = theme?.colors?.onsurface?.active?.textColor || "#3E3E3E";
87888
+ const isFloat = type4 === "float";
87889
+ const isContained = getContainer2 !== void 0;
87890
+ const floatOffset = 24;
87891
+ const border = "1px solid var(--interactive-utility-border, #CBCBCB)";
87892
+ const sharedStyles = {
87893
+ wrapper: { boxShadow: "none" },
87894
+ content: {
87895
+ boxShadow: "none",
87896
+ borderTop: border,
87897
+ borderRadius: 0
87898
+ },
87899
+ body: { padding: 0, display: "flex", alignItems: "center", height: "100%" }
87900
+ };
87901
+ const drawerStyles = isFloat ? {
87902
+ ...sharedStyles,
87903
+ wrapper: {
87904
+ boxShadow: "none",
87905
+ left: `${floatOffset}px`,
87906
+ right: `${floatOffset}px`,
87907
+ bottom: `${floatOffset}px`,
87908
+ width: "auto"
87909
+ },
87910
+ content: { boxShadow: "none", border, borderRadius: "12px" }
87911
+ } : sharedStyles;
87912
+ return /* @__PURE__ */ jsx(
87913
+ StyledBottomDrawer,
87914
+ {
87915
+ closable: false,
87916
+ mask: false,
87917
+ onClose,
87918
+ placement: "bottom",
87919
+ height,
87920
+ open,
87921
+ $type: type4,
87922
+ styles: drawerStyles,
87923
+ getContainer: getContainer2,
87924
+ rootStyle: isContained ? { position: "absolute" } : void 0,
87925
+ children: /* @__PURE__ */ jsxs(
87926
+ Tile,
87927
+ {
87928
+ isHorizontal: true,
87929
+ style: {
87930
+ alignItems: "center",
87931
+ justifyContent: "space-between",
87932
+ gap: `${spacing.Size4}px`,
87933
+ padding: `0 ${spacing.Size8}px`,
87934
+ width: "100%",
87935
+ height: "100%"
87936
+ },
87937
+ children: [
87938
+ typeof label === "string" ? /* @__PURE__ */ jsx(Typography, { fontSize: "20px", fontWeight: 400, color: textColor, children: label }) : label,
87939
+ actions.length > 0 && /* @__PURE__ */ jsx(Tile, { isHorizontal: true, style: { gap: `${spacing.Size4}px` }, children: actions.map((action, index2) => /* @__PURE__ */ jsx(Button$1, { ...action.btnProps, onClick: action.onClick, children: action.label }, index2)) })
87940
+ ]
87941
+ }
87942
+ )
87943
+ }
87944
+ );
87945
+ };
87836
87946
  const getGenesisClass$3 = ({ colors: colors2, borderRadius: borderRadius2 }) => `
87837
87947
  &.ant-switch {
87838
87948
  background-color: ${colors2.primary.active};
@@ -91290,6 +91400,7 @@ export {
91290
91400
  Avatar,
91291
91401
  Badge$1 as Badge,
91292
91402
  BarChart,
91403
+ BottomDrawer,
91293
91404
  Breadcrumb,
91294
91405
  Button$1 as Button,
91295
91406
  Card,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobolt/genesis",
3
- "version": "0.9.3",
3
+ "version": "0.10.1",
4
4
  "description": "genesis design system",
5
5
  "author": "gobolt",
6
6
  "license": "MIT",