@gobolt/genesis 0.9.2 → 0.10.0

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,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { ButtonProps } from '../Button';
3
+ type BottomDrawerAction = {
4
+ label: string;
5
+ onClick: () => void;
6
+ btnProps?: ButtonProps;
7
+ };
8
+ export interface BottomDrawerProps {
9
+ open: boolean;
10
+ onClose: () => void;
11
+ type?: "full" | "float";
12
+ /** Drawer height. Bottom drawers size on the vertical axis (default 88). */
13
+ height?: number | string;
14
+ /** Left-aligned description / status text (string is styled; nodes render as-is). */
15
+ label?: ReactNode;
16
+ /** Right-aligned action buttons (e.g. Cancel + Confirm). */
17
+ actions?: BottomDrawerAction[];
18
+ }
19
+ /**
20
+ * A slim slide-up drawer for user confirmation: a description on the left and
21
+ * actions on the right. Shares SidePanel's slide-up + overlay behavior, but the
22
+ * contents are intentionally trimmed to a single action row.
23
+ */
24
+ declare const BottomDrawer: ({ open, onClose, type, height, label, actions, }: BottomDrawerProps) => import("react/jsx-runtime").JSX.Element;
25
+ export default BottomDrawer;
@@ -0,0 +1,7 @@
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;
@@ -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
@@ -77694,7 +77694,7 @@ const GlobalHeader = ({
77694
77694
  children: [
77695
77695
  /* @__PURE__ */ jsxRuntime.jsxs(Tile, { isHorizontal: true, style: { flex: 1, gap: "16px", minWidth: "200px" }, children: [
77696
77696
  onBack && /* @__PURE__ */ jsxRuntime.jsx(UtilityButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(RefIcon$j, {}), onClick: onBack }),
77697
- /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "display3", children: title })
77697
+ /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "display3", style: { marginTop: 0 }, children: title })
77698
77698
  ] }),
77699
77699
  /* @__PURE__ */ jsxRuntime.jsxs(
77700
77700
  Tile,
@@ -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,112 @@ 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
+ }) => {
87899
+ const theme = styled.useTheme();
87900
+ const spacing = {
87901
+ Size4: theme?.sizing?.Size4 || 16,
87902
+ Size8: theme?.sizing?.Size8 || 32
87903
+ };
87904
+ const textColor = theme?.colors?.onsurface?.active?.textColor || "#3E3E3E";
87905
+ const isFloat = type4 === "float";
87906
+ const floatOffset = 24;
87907
+ const border = "1px solid var(--interactive-utility-border, #CBCBCB)";
87908
+ const sharedStyles = {
87909
+ wrapper: { boxShadow: "none" },
87910
+ content: {
87911
+ boxShadow: "none",
87912
+ borderTop: border,
87913
+ borderRadius: 0
87914
+ },
87915
+ body: { padding: 0, display: "flex", alignItems: "center", height: "100%" }
87916
+ };
87917
+ const drawerStyles = isFloat ? {
87918
+ ...sharedStyles,
87919
+ wrapper: {
87920
+ boxShadow: "none",
87921
+ left: `${floatOffset}px`,
87922
+ right: `${floatOffset}px`,
87923
+ bottom: `${floatOffset}px`,
87924
+ width: "auto"
87925
+ },
87926
+ content: { boxShadow: "none", border, borderRadius: "12px" }
87927
+ } : sharedStyles;
87928
+ return /* @__PURE__ */ jsxRuntime.jsx(
87929
+ StyledBottomDrawer,
87930
+ {
87931
+ closable: false,
87932
+ mask: false,
87933
+ onClose,
87934
+ placement: "bottom",
87935
+ height,
87936
+ open,
87937
+ $type: type4,
87938
+ styles: drawerStyles,
87939
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
87940
+ Tile,
87941
+ {
87942
+ isHorizontal: true,
87943
+ style: {
87944
+ alignItems: "center",
87945
+ justifyContent: "space-between",
87946
+ gap: `${spacing.Size4}px`,
87947
+ padding: `0 ${spacing.Size8}px`,
87948
+ width: "100%",
87949
+ height: "100%"
87950
+ },
87951
+ children: [
87952
+ typeof label === "string" ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { fontSize: "20px", fontWeight: 400, color: textColor, children: label }) : label,
87953
+ 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)) })
87954
+ ]
87955
+ }
87956
+ )
87957
+ }
87958
+ );
87959
+ };
87854
87960
  const getGenesisClass$3 = ({ colors: colors2, borderRadius: borderRadius2 }) => `
87855
87961
  &.ant-switch {
87856
87962
  background-color: ${colors2.primary.active};
@@ -91307,6 +91413,7 @@ const GlobalStyles = styled.createGlobalStyle`
91307
91413
  exports.Avatar = Avatar;
91308
91414
  exports.Badge = Badge$1;
91309
91415
  exports.BarChart = BarChart;
91416
+ exports.BottomDrawer = BottomDrawer;
91310
91417
  exports.Breadcrumb = Breadcrumb;
91311
91418
  exports.Button = Button$1;
91312
91419
  exports.Card = Card;
package/dist/index.js CHANGED
@@ -77676,7 +77676,7 @@ const GlobalHeader = ({
77676
77676
  children: [
77677
77677
  /* @__PURE__ */ jsxs(Tile, { isHorizontal: true, style: { flex: 1, gap: "16px", minWidth: "200px" }, children: [
77678
77678
  onBack && /* @__PURE__ */ jsx(UtilityButton, { icon: /* @__PURE__ */ jsx(RefIcon$j, {}), onClick: onBack }),
77679
- /* @__PURE__ */ jsx(Typography, { variant: "display3", children: title })
77679
+ /* @__PURE__ */ jsx(Typography, { variant: "display3", style: { marginTop: 0 }, children: title })
77680
77680
  ] }),
77681
77681
  /* @__PURE__ */ jsxs(
77682
77682
  Tile,
@@ -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,112 @@ 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
+ }) => {
87881
+ const theme = useTheme$1();
87882
+ const spacing = {
87883
+ Size4: theme?.sizing?.Size4 || 16,
87884
+ Size8: theme?.sizing?.Size8 || 32
87885
+ };
87886
+ const textColor = theme?.colors?.onsurface?.active?.textColor || "#3E3E3E";
87887
+ const isFloat = type4 === "float";
87888
+ const floatOffset = 24;
87889
+ const border = "1px solid var(--interactive-utility-border, #CBCBCB)";
87890
+ const sharedStyles = {
87891
+ wrapper: { boxShadow: "none" },
87892
+ content: {
87893
+ boxShadow: "none",
87894
+ borderTop: border,
87895
+ borderRadius: 0
87896
+ },
87897
+ body: { padding: 0, display: "flex", alignItems: "center", height: "100%" }
87898
+ };
87899
+ const drawerStyles = isFloat ? {
87900
+ ...sharedStyles,
87901
+ wrapper: {
87902
+ boxShadow: "none",
87903
+ left: `${floatOffset}px`,
87904
+ right: `${floatOffset}px`,
87905
+ bottom: `${floatOffset}px`,
87906
+ width: "auto"
87907
+ },
87908
+ content: { boxShadow: "none", border, borderRadius: "12px" }
87909
+ } : sharedStyles;
87910
+ return /* @__PURE__ */ jsx(
87911
+ StyledBottomDrawer,
87912
+ {
87913
+ closable: false,
87914
+ mask: false,
87915
+ onClose,
87916
+ placement: "bottom",
87917
+ height,
87918
+ open,
87919
+ $type: type4,
87920
+ styles: drawerStyles,
87921
+ children: /* @__PURE__ */ jsxs(
87922
+ Tile,
87923
+ {
87924
+ isHorizontal: true,
87925
+ style: {
87926
+ alignItems: "center",
87927
+ justifyContent: "space-between",
87928
+ gap: `${spacing.Size4}px`,
87929
+ padding: `0 ${spacing.Size8}px`,
87930
+ width: "100%",
87931
+ height: "100%"
87932
+ },
87933
+ children: [
87934
+ typeof label === "string" ? /* @__PURE__ */ jsx(Typography, { fontSize: "20px", fontWeight: 400, color: textColor, children: label }) : label,
87935
+ 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)) })
87936
+ ]
87937
+ }
87938
+ )
87939
+ }
87940
+ );
87941
+ };
87836
87942
  const getGenesisClass$3 = ({ colors: colors2, borderRadius: borderRadius2 }) => `
87837
87943
  &.ant-switch {
87838
87944
  background-color: ${colors2.primary.active};
@@ -91290,6 +91396,7 @@ export {
91290
91396
  Avatar,
91291
91397
  Badge$1 as Badge,
91292
91398
  BarChart,
91399
+ BottomDrawer,
91293
91400
  Breadcrumb,
91294
91401
  Button$1 as Button,
91295
91402
  Card,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobolt/genesis",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "genesis design system",
5
5
  "author": "gobolt",
6
6
  "license": "MIT",