From eeee10fd6050684e2daa3c4df24f1dea71c2eb8b Mon Sep 17 00:00:00 2001 From: saurabhdaware Date: Mon, 15 Jul 2024 17:26:30 +0530 Subject: [PATCH] docs: add rowDensity control --- .../BottomSheet.web.test.tsx.snap | 8 +- .../Dropdown.native.test.tsx.snap | 8 +- .../BaseInput.native.test.tsx.snap | 213 ++++++++++++++++++ .../AutoComplete.native.test.tsx.snap | 12 +- .../AutoComplete.web.test.tsx.snap | 8 +- .../__snapshots__/Menu.web.test.tsx.snap | 8 +- .../TableEditableCellAPI.stories.tsx | 50 ++-- 7 files changed, 272 insertions(+), 35 deletions(-) diff --git a/packages/blade/src/components/BottomSheet/__tests__/__snapshots__/BottomSheet.web.test.tsx.snap b/packages/blade/src/components/BottomSheet/__tests__/__snapshots__/BottomSheet.web.test.tsx.snap index 501bd58c13b..572f5bc33d9 100644 --- a/packages/blade/src/components/BottomSheet/__tests__/__snapshots__/BottomSheet.web.test.tsx.snap +++ b/packages/blade/src/components/BottomSheet/__tests__/__snapshots__/BottomSheet.web.test.tsx.snap @@ -110,10 +110,10 @@ exports[` should compose with DropdownButton 1`] = ` -webkit-box-align: flex-start; -ms-flex-align: flex-start; align-items: flex-start; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; + -webkit-box-pack: left; + -webkit-justify-content: left; + -ms-flex-pack: left; + justify-content: left; width: 100%; } diff --git a/packages/blade/src/components/Dropdown/__tests__/__snapshots__/Dropdown.native.test.tsx.snap b/packages/blade/src/components/Dropdown/__tests__/__snapshots__/Dropdown.native.test.tsx.snap index 76d56b674c0..04f81871f73 100644 --- a/packages/blade/src/components/Dropdown/__tests__/__snapshots__/Dropdown.native.test.tsx.snap +++ b/packages/blade/src/components/Dropdown/__tests__/__snapshots__/Dropdown.native.test.tsx.snap @@ -1126,13 +1126,13 @@ exports[` should render dropdown 1`] = ` alignItems="flex-start" data-blade-component="box" display="flex" - justifyContent="center" + justifyContent="left" style={ [ { "alignItems": "flex-start", "display": "flex", - "justifyContent": "center", + "justifyContent": "left", "width": "100%", }, ] @@ -1305,13 +1305,13 @@ exports[` should render dropdown 1`] = ` alignItems="flex-start" data-blade-component="box" display="flex" - justifyContent="center" + justifyContent="left" style={ [ { "alignItems": "flex-start", "display": "flex", - "justifyContent": "center", + "justifyContent": "left", "width": "100%", }, ] diff --git a/packages/blade/src/components/Input/BaseInput/__tests__/__snapshots__/BaseInput.native.test.tsx.snap b/packages/blade/src/components/Input/BaseInput/__tests__/__snapshots__/BaseInput.native.test.tsx.snap index fced27d621b..99b1423c3e3 100644 --- a/packages/blade/src/components/Input/BaseInput/__tests__/__snapshots__/BaseInput.native.test.tsx.snap +++ b/packages/blade/src/components/Input/BaseInput/__tests__/__snapshots__/BaseInput.native.test.tsx.snap @@ -606,6 +606,32 @@ exports[` should render input with no borders 1`] = ` + + + `; @@ -900,6 +926,193 @@ exports[` should render input with no borders in error state 1`] = + + + + + + + + + + + + + + Something went wrong + + + + + `; diff --git a/packages/blade/src/components/Input/DropdownInputTriggers/__tests__/__snapshots__/AutoComplete.native.test.tsx.snap b/packages/blade/src/components/Input/DropdownInputTriggers/__tests__/__snapshots__/AutoComplete.native.test.tsx.snap index a5a1a571bc4..363c3bc465e 100644 --- a/packages/blade/src/components/Input/DropdownInputTriggers/__tests__/__snapshots__/AutoComplete.native.test.tsx.snap +++ b/packages/blade/src/components/Input/DropdownInputTriggers/__tests__/__snapshots__/AutoComplete.native.test.tsx.snap @@ -922,13 +922,13 @@ exports[` with should render AutoComplete 1`] = ` alignItems="flex-start" data-blade-component="box" display="flex" - justifyContent="center" + justifyContent="left" style={ [ { "alignItems": "flex-start", "display": "flex", - "justifyContent": "center", + "justifyContent": "left", "width": "100%", }, ] @@ -1226,13 +1226,13 @@ exports[` with should render AutoComplete 1`] = ` alignItems="flex-start" data-blade-component="box" display="flex" - justifyContent="center" + justifyContent="left" style={ [ { "alignItems": "flex-start", "display": "flex", - "justifyContent": "center", + "justifyContent": "left", "width": "100%", }, ] @@ -1530,13 +1530,13 @@ exports[` with should render AutoComplete 1`] = ` alignItems="flex-start" data-blade-component="box" display="flex" - justifyContent="center" + justifyContent="left" style={ [ { "alignItems": "flex-start", "display": "flex", - "justifyContent": "center", + "justifyContent": "left", "width": "100%", }, ] diff --git a/packages/blade/src/components/Input/DropdownInputTriggers/__tests__/__snapshots__/AutoComplete.web.test.tsx.snap b/packages/blade/src/components/Input/DropdownInputTriggers/__tests__/__snapshots__/AutoComplete.web.test.tsx.snap index dfd7e663989..a6a965c2746 100644 --- a/packages/blade/src/components/Input/DropdownInputTriggers/__tests__/__snapshots__/AutoComplete.web.test.tsx.snap +++ b/packages/blade/src/components/Input/DropdownInputTriggers/__tests__/__snapshots__/AutoComplete.web.test.tsx.snap @@ -290,10 +290,10 @@ exports[` & with should render Bott -webkit-box-align: flex-start; -ms-flex-align: flex-start; align-items: flex-start; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; + -webkit-box-pack: left; + -webkit-justify-content: left; + -ms-flex-pack: left; + justify-content: left; width: 100%; } diff --git a/packages/blade/src/components/Menu/__tests__/__snapshots__/Menu.web.test.tsx.snap b/packages/blade/src/components/Menu/__tests__/__snapshots__/Menu.web.test.tsx.snap index 033905ca7ef..d565363185a 100644 --- a/packages/blade/src/components/Menu/__tests__/__snapshots__/Menu.web.test.tsx.snap +++ b/packages/blade/src/components/Menu/__tests__/__snapshots__/Menu.web.test.tsx.snap @@ -138,10 +138,10 @@ exports[`Menu renders a Menu 1`] = ` -webkit-box-align: flex-start; -ms-flex-align: flex-start; align-items: flex-start; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; + -webkit-box-pack: left; + -webkit-justify-content: left; + -ms-flex-pack: left; + justify-content: left; width: 100%; } diff --git a/packages/blade/src/components/Table/docs/APIStories/TableEditableCellAPI.stories.tsx b/packages/blade/src/components/Table/docs/APIStories/TableEditableCellAPI.stories.tsx index 751882c0d82..1190b2eced0 100644 --- a/packages/blade/src/components/Table/docs/APIStories/TableEditableCellAPI.stories.tsx +++ b/packages/blade/src/components/Table/docs/APIStories/TableEditableCellAPI.stories.tsx @@ -1,9 +1,17 @@ import type { StoryFn, Meta } from '@storybook/react'; -import type { TableData } from '../../types'; -import { Table as TableComponent } from '../../Table'; -import { TableHeader, TableHeaderRow, TableHeaderCell } from '../../TableHeader'; -import { TableBody, TableRow, TableCell } from '../../TableBody'; -import { TableFooter, TableFooterRow, TableFooterCell } from '../../TableFooter'; +import type { TableProps, TableData, TableEditableCellProps } from '../../index'; +import { + Table as TableComponent, + TableHeader, + TableHeaderRow, + TableHeaderCell, + TableBody, + TableRow, + TableCell, + TableFooter, + TableFooterRow, + TableFooterCell, +} from '../../index'; import StoryPageWrapper from '~utils/storybook/StoryPageWrapper'; import { Box } from '~components/Box'; import { Code } from '~components/Typography'; @@ -27,6 +35,15 @@ export default { disable: true, }, }, + rowDensity: { + options: ['comfortable', 'normal', 'compact'], + control: { + type: 'radio', + }, + table: { + category: 'TableProps', + }, + }, }, parameters: { docs: { @@ -81,7 +98,9 @@ const data: TableData = { nodes, }; -const TableTemplate: StoryFn = ({ ...args }) => { +type TableTemplateProps = TableEditableCellProps & { rowDensity: TableProps['rowDensity'] }; + +const TableTemplate: StoryFn = ({ rowDensity, ...args }) => { return ( = ({ ...args }) => { overflow="auto" minHeight="400px" > - + {(tableData) => ( <> @@ -109,9 +128,9 @@ const TableTemplate: StoryFn = ({ ...args }) => { {tableItem.paymentId} = ({ ...args }) => { @@ -145,7 +161,12 @@ const TableTemplate: StoryFn = ({ ...args }) => { })} - + @@ -175,5 +196,8 @@ const TableTemplate: StoryFn = ({ ...args }) => { }; export const TableEditableCellStory = TableTemplate.bind({}); +TableEditableCellStory.args = { + rowDensity: 'normal', +}; // Need to do this because of storybook's weird naming convention, More details here: https://storybook.js.org/docs/react/writing-stories/naming-components-and-hierarchy#single-story-hoisting TableEditableCellStory.storyName = 'TableEditableCell';