@juspay/blend-design-system 0.0.37-beta.7 → 0.0.37
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/{node-C_DmV86X.js → breadcrumbV2.tokens-CovJEwot.js} +16 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/AccordionV2/accordionV2.animations.d.ts +1 -1
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Breadcrumb/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/ButtonGroup/index.d.ts +1 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/CardV2/CardV2.d.ts +45 -0
- package/dist/components/CardV2/CardV2.utils.d.ts +14 -0
- package/dist/components/CardV2/CardV2Components.d.ts +8 -0
- package/dist/components/CardV2/CardV2Context.d.ts +14 -0
- package/dist/components/CardV2/CardV2Skeleton.d.ts +6 -0
- package/dist/components/CardV2/accessibility/CardV2AccessibilityReport.d.ts +2 -0
- package/dist/components/CardV2/accessibility/index.d.ts +1 -0
- package/dist/components/CardV2/cardV2.dark.tokens.d.ts +3 -0
- package/dist/components/CardV2/cardV2.light.tokens.d.ts +3 -0
- package/dist/components/CardV2/cardV2.tokens.d.ts +5 -0
- package/dist/components/CardV2/cardV2.tokens.types.d.ts +92 -0
- package/dist/components/CardV2/cardV2.types.d.ts +106 -0
- package/dist/components/CardV2/index.d.ts +5 -0
- package/dist/components/Charts/index.d.ts +10 -0
- package/dist/components/Charts/types.d.ts +2 -0
- package/dist/components/ChatInput/index.d.ts +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/CodeEditor/index.d.ts +1 -0
- package/dist/components/CodeEditor/types.d.ts +22 -2
- package/dist/components/CodeEditorV2/CodeEditorV2.d.ts +1 -1
- package/dist/components/CodeEditorV2/codeEditorV2.types.d.ts +23 -2
- package/dist/components/DataTable/PivotTableModal/pivotModal.styled.d.ts +184 -0
- package/dist/components/DataTable/TableBody/types.d.ts +3 -1
- package/dist/components/DataTable/hooks/index.d.ts +2 -0
- package/dist/components/DataTable/hooks/useReducedMotion.d.ts +1 -0
- package/dist/components/DataTable/hooks/useRowFlip.d.ts +6 -0
- package/dist/components/DataTable/types.d.ts +26 -0
- package/dist/components/DateRangePicker/CalendarGrid.d.ts +5 -2
- package/dist/components/DateRangePicker/types.d.ts +3 -1
- package/dist/components/DateRangePicker/utils.d.ts +5 -5
- package/dist/components/Directory/Directory.d.ts +1 -1
- package/dist/components/Directory/NavItem.d.ts +1 -1
- package/dist/components/Directory/Section.d.ts +1 -1
- package/dist/components/Directory/VirtualizedDirectory.d.ts +3 -0
- package/dist/components/Directory/directory.tokens.d.ts +7 -0
- package/dist/components/Directory/types.d.ts +38 -1
- package/dist/components/Directory/utils.d.ts +3 -1
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Inputs/MultiValueInput/index.d.ts +1 -0
- package/dist/components/Inputs/NumberInput/index.d.ts +1 -0
- package/dist/components/Inputs/OTPInput/index.d.ts +1 -0
- package/dist/components/Inputs/SearchInput/index.d.ts +1 -0
- package/dist/components/Inputs/TextArea/index.d.ts +1 -0
- package/dist/components/Inputs/TextInput/index.d.ts +1 -0
- package/dist/components/InputsV2/TextAreaV2/utils.d.ts +2 -1
- package/dist/components/InputsV2/TextInputV2/utils.d.ts +2 -1
- package/dist/components/InputsV2/UploadV2/UploadContainerV2.d.ts +24 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.d.ts +31 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.dark.tokens.d.ts +3 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.light.tokens.d.ts +3 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.tokens.d.ts +5 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.tokens.types.d.ts +115 -0
- package/dist/components/InputsV2/UploadV2/UploadV2.types.d.ts +56 -0
- package/dist/components/InputsV2/UploadV2/index.d.ts +3 -0
- package/dist/components/InputsV2/UploadV2/utils.d.ts +32 -0
- package/dist/components/KeyValuePair/index.d.ts +1 -0
- package/dist/components/Menu/Menu.d.ts +1 -1
- package/dist/components/Menu/index.d.ts +1 -0
- package/dist/components/Menu/types.d.ts +7 -0
- package/dist/components/Menu/utils.d.ts +10 -2
- package/dist/components/MenuV2/MenuV2Content.d.ts +1 -0
- package/dist/components/MenuV2/menuV2.types.d.ts +5 -0
- package/dist/components/MenuV2/menuV2.utils.d.ts +10 -2
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/ModalV2/ModalV2.d.ts +22 -0
- package/dist/components/ModalV2/ModalV2Footer.d.ts +10 -0
- package/dist/components/ModalV2/ModalV2Header.d.ts +15 -0
- package/dist/components/ModalV2/ModalV2Skeleton.d.ts +4 -0
- package/dist/components/ModalV2/index.d.ts +4 -0
- package/dist/components/ModalV2/mobileModalV2.d.ts +23 -0
- package/dist/components/ModalV2/modalAnimationV2.d.ts +3 -0
- package/dist/components/ModalV2/modalV2.dark.tokens.d.ts +3 -0
- package/dist/components/ModalV2/modalV2.light.tokens.d.ts +3 -0
- package/dist/components/ModalV2/modalV2.tokens.d.ts +5 -0
- package/dist/components/ModalV2/modalV2.tokens.types.d.ts +91 -0
- package/dist/components/ModalV2/modalV2.types.d.ts +66 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelectMenu.d.ts +1 -1
- package/dist/components/MultiSelect/index.d.ts +2 -0
- package/dist/components/MultiSelect/types.d.ts +2 -0
- package/dist/components/MultiSelectV2/MultiSelectV2.d.ts +1 -1
- package/dist/components/MultiSelectV2/MultiSelectV2Menu.d.ts +1 -1
- package/dist/components/MultiSelectV2/multiSelectV2.types.d.ts +2 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Primitives/Block/Block.d.ts +1 -1
- package/dist/components/ProgressBar/index.d.ts +1 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Sidebar/SidebarContent.d.ts +9 -1
- package/dist/components/Sidebar/index.d.ts +1 -0
- package/dist/components/Sidebar/types.d.ts +9 -1
- package/dist/components/SidebarV2/SidebarV2Panel.d.ts +10 -2
- package/dist/components/SidebarV2/types.d.ts +9 -1
- package/dist/components/SingleSelect/SingleSelect.d.ts +1 -1
- package/dist/components/SingleSelect/SingleSelectMenu.d.ts +2 -1
- package/dist/components/SingleSelect/index.d.ts +1 -0
- package/dist/components/SingleSelect/types.d.ts +1 -0
- package/dist/components/SingleSelectV2/SingleSelectV2.d.ts +1 -1
- package/dist/components/SingleSelectV2/SingleSelectV2Menu.d.ts +1 -1
- package/dist/components/SingleSelectV2/singleSelectV2.tokens.types.d.ts +8 -0
- package/dist/components/SingleSelectV2/singleSelectV2.types.d.ts +2 -0
- package/dist/components/Skeleton/SkeletonCompound.d.ts +24 -33
- package/dist/components/Snackbar/Snackbar.d.ts +1 -1
- package/dist/components/Snackbar/index.d.ts +2 -0
- package/dist/components/Snackbar/snackbar.tokens.d.ts +1 -0
- package/dist/components/Snackbar/types.d.ts +2 -0
- package/dist/components/StatCard/index.d.ts +1 -0
- package/dist/components/Stepper/index.d.ts +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tags/index.d.ts +1 -0
- package/dist/components/Timeline/Timeline.d.ts +13 -37
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Topbar/index.d.ts +1 -0
- package/dist/components/Upload/index.d.ts +1 -0
- package/dist/context/ThemeContext.d.ts +6 -0
- package/dist/context/useComponentToken.d.ts +4 -1
- package/dist/main.d.ts +6 -0
- package/dist/main.js +45436 -42186
- package/dist/node-B3rrXW84.js +1023 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +21 -18
- package/dist/{tokens.js → token-engine.js} +1 -1
- package/lib/components/Accordion/AccordionItem.tsx +2 -6
- package/lib/components/Accordion/index.ts +2 -0
- package/lib/components/AccordionV2/AccordionV2Item.tsx +1 -1
- package/lib/components/AccordionV2/accordionV2.animations.ts +1 -5
- package/lib/components/Alert/index.ts +1 -0
- package/lib/components/Avatar/index.ts +1 -0
- package/lib/components/Breadcrumb/index.ts +1 -0
- package/lib/components/Button/index.ts +1 -0
- package/lib/components/ButtonGroup/index.ts +1 -0
- package/lib/components/Card/index.ts +1 -0
- package/lib/components/CardV2/CardV2.tsx +327 -0
- package/lib/components/CardV2/CardV2.utils.tsx +77 -0
- package/lib/components/CardV2/CardV2Components.tsx +297 -0
- package/lib/components/CardV2/CardV2Context.tsx +18 -0
- package/lib/components/CardV2/CardV2Skeleton.tsx +40 -0
- package/lib/components/CardV2/accessibility/CardV2AccessibilityReport.ts +284 -0
- package/lib/components/CardV2/accessibility/index.ts +1 -0
- package/lib/components/CardV2/cardV2.dark.tokens.ts +177 -0
- package/lib/components/CardV2/cardV2.light.tokens.ts +177 -0
- package/lib/components/CardV2/cardV2.tokens.ts +21 -0
- package/lib/components/CardV2/cardV2.tokens.types.ts +94 -0
- package/lib/components/CardV2/cardV2.types.ts +131 -0
- package/lib/components/CardV2/index.ts +13 -0
- package/lib/components/Charts/ChartLegend.tsx +25 -5
- package/lib/components/Charts/Charts.tsx +10 -0
- package/lib/components/Charts/index.ts +10 -0
- package/lib/components/Charts/types.tsx +2 -0
- package/lib/components/ChatInput/index.tsx +1 -0
- package/lib/components/Checkbox/index.ts +1 -0
- package/lib/components/CodeEditor/MonacoEditorWrapper.tsx +6 -2
- package/lib/components/CodeEditor/index.ts +1 -0
- package/lib/components/CodeEditor/types.ts +52 -2
- package/lib/components/CodeEditorV2/MonacoEditor/MonacoEditorWrapper.tsx +6 -2
- package/lib/components/CodeEditorV2/codeEditorV2.types.ts +44 -5
- package/lib/components/DataTable/DataTable.tsx +8 -0
- package/lib/components/DataTable/TableBody/index.tsx +47 -11
- package/lib/components/DataTable/TableBody/types.ts +7 -1
- package/lib/components/DataTable/TableCell/index.tsx +1 -1
- package/lib/components/DataTable/hooks/index.ts +2 -0
- package/lib/components/DataTable/hooks/useReducedMotion.ts +19 -0
- package/lib/components/DataTable/hooks/useRowFlip.ts +170 -0
- package/lib/components/DataTable/types.ts +32 -0
- package/lib/components/DateRangePicker/CalendarGrid.tsx +39 -6
- package/lib/components/DateRangePicker/DateRangePicker.tsx +27 -4
- package/lib/components/DateRangePicker/types.ts +6 -1
- package/lib/components/DateRangePicker/utils.ts +123 -12
- package/lib/components/Directory/Directory.tsx +31 -0
- package/lib/components/Directory/NavItem.tsx +177 -86
- package/lib/components/Directory/Section.tsx +9 -0
- package/lib/components/Directory/VirtualizedDirectory.tsx +670 -0
- package/lib/components/Directory/directory.tokens.ts +21 -0
- package/lib/components/Directory/types.ts +43 -1
- package/lib/components/Directory/utils.ts +81 -1
- package/lib/components/Drawer/index.ts +1 -0
- package/lib/components/Inputs/DropdownInput/DropdownInput.tsx +6 -2
- package/lib/components/Inputs/MultiValueInput/index.ts +1 -0
- package/lib/components/Inputs/NumberInput/NumberInput.tsx +6 -2
- package/lib/components/Inputs/NumberInput/index.ts +1 -0
- package/lib/components/Inputs/OTPInput/index.ts +1 -0
- package/lib/components/Inputs/SearchInput/index.ts +1 -0
- package/lib/components/Inputs/TextArea/TextArea.tsx +4 -2
- package/lib/components/Inputs/TextArea/index.ts +1 -0
- package/lib/components/Inputs/TextInput/TextInput.tsx +6 -2
- package/lib/components/Inputs/TextInput/index.ts +1 -0
- package/lib/components/Inputs/UnitInput/UnitInput.tsx +6 -2
- package/lib/components/InputsV2/NumberInputV2/NumberInputV2.tsx +6 -2
- package/lib/components/InputsV2/TextAreaV2/TextAreaV2.tsx +2 -1
- package/lib/components/InputsV2/TextAreaV2/utils.ts +3 -1
- package/lib/components/InputsV2/TextInputV2/TextInputV2.tsx +1 -0
- package/lib/components/InputsV2/TextInputV2/utils.ts +6 -8
- package/lib/components/InputsV2/UploadV2/UploadContainerV2.tsx +470 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.dark.tokens.ts +348 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.light.tokens.ts +348 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.tokens.ts +20 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.tokens.types.ts +117 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.tsx +336 -0
- package/lib/components/InputsV2/UploadV2/UploadV2.types.ts +67 -0
- package/lib/components/InputsV2/UploadV2/index.ts +3 -0
- package/lib/components/InputsV2/UploadV2/utils.ts +170 -0
- package/lib/components/KeyValuePair/index.ts +1 -0
- package/lib/components/Menu/Menu.tsx +18 -2
- package/lib/components/Menu/SubMenu.tsx +25 -3
- package/lib/components/Menu/index.ts +1 -0
- package/lib/components/Menu/types.tsx +14 -0
- package/lib/components/Menu/utils.ts +46 -3
- package/lib/components/MenuV2/MenuV2.tsx +9 -2
- package/lib/components/MenuV2/MenuV2Content.tsx +6 -0
- package/lib/components/MenuV2/MenuV2SubMenu.tsx +16 -2
- package/lib/components/MenuV2/menuV2.types.ts +11 -0
- package/lib/components/MenuV2/menuV2.utils.ts +45 -3
- package/lib/components/Modal/index.ts +1 -0
- package/lib/components/ModalV2/ModalV2.tsx +269 -0
- package/lib/components/ModalV2/ModalV2Footer.tsx +76 -0
- package/lib/components/ModalV2/ModalV2Header.tsx +144 -0
- package/lib/components/ModalV2/ModalV2Skeleton.tsx +80 -0
- package/lib/components/ModalV2/index.ts +4 -0
- package/lib/components/ModalV2/mobileModalV2.tsx +411 -0
- package/lib/components/ModalV2/modalAnimationV2.tsx +19 -0
- package/lib/components/ModalV2/modalV2.dark.tokens.ts +183 -0
- package/lib/components/ModalV2/modalV2.light.tokens.ts +183 -0
- package/lib/components/ModalV2/modalV2.tokens.ts +21 -0
- package/lib/components/ModalV2/modalV2.tokens.types.ts +94 -0
- package/lib/components/ModalV2/modalV2.types.ts +80 -0
- package/lib/components/MultiSelect/MultiSelect.tsx +4 -1
- package/lib/components/MultiSelect/MultiSelectMenu.tsx +8 -0
- package/lib/components/MultiSelect/MultiSelectTrigger.tsx +2 -1
- package/lib/components/MultiSelect/index.ts +2 -0
- package/lib/components/MultiSelect/types.ts +2 -0
- package/lib/components/MultiSelectV2/MultiSelectV2.tsx +2 -0
- package/lib/components/MultiSelectV2/MultiSelectV2Menu.tsx +8 -0
- package/lib/components/MultiSelectV2/MultiSelectV2Trigger.tsx +4 -1
- package/lib/components/MultiSelectV2/multiSelectV2.types.ts +2 -0
- package/lib/components/Popover/index.ts +1 -0
- package/lib/components/Primitives/Block/Block.tsx +1 -1
- package/lib/components/ProgressBar/index.ts +1 -0
- package/lib/components/Radio/index.ts +2 -0
- package/lib/components/Sidebar/Sidebar.tsx +38 -0
- package/lib/components/Sidebar/SidebarContent.tsx +25 -1
- package/lib/components/Sidebar/index.ts +1 -0
- package/lib/components/Sidebar/types.ts +13 -1
- package/lib/components/SidebarV2/SidebarV2.tsx +30 -0
- package/lib/components/SidebarV2/SidebarV2Panel.tsx +25 -1
- package/lib/components/SidebarV2/types.ts +9 -1
- package/lib/components/SingleSelect/SingleSelect.tsx +4 -1
- package/lib/components/SingleSelect/SingleSelectMenu.tsx +171 -138
- package/lib/components/SingleSelect/SingleSelectTrigger.tsx +3 -1
- package/lib/components/SingleSelect/index.ts +1 -0
- package/lib/components/SingleSelect/types.ts +1 -0
- package/lib/components/SingleSelectV2/SingleSelectV2.tsx +2 -0
- package/lib/components/SingleSelectV2/SingleSelectV2Menu.tsx +84 -58
- package/lib/components/SingleSelectV2/SingleSelectV2Search.tsx +1 -0
- package/lib/components/SingleSelectV2/SingleSelectV2Trigger.tsx +3 -1
- package/lib/components/SingleSelectV2/singleSelectV2.dark.tokens.ts +8 -0
- package/lib/components/SingleSelectV2/singleSelectV2.light.tokens.ts +8 -0
- package/lib/components/SingleSelectV2/singleSelectV2.tokens.types.ts +8 -0
- package/lib/components/SingleSelectV2/singleSelectV2.types.ts +2 -0
- package/lib/components/Skeleton/SkeletonCompound.tsx +45 -31
- package/lib/components/Snackbar/Snackbar.tsx +18 -8
- package/lib/components/Snackbar/index.ts +2 -0
- package/lib/components/Snackbar/snackbar.tokens.ts +6 -0
- package/lib/components/Snackbar/types.ts +2 -0
- package/lib/components/StatCard/StatCard.tsx +29 -0
- package/lib/components/StatCard/index.ts +1 -0
- package/lib/components/Stepper/index.ts +1 -0
- package/lib/components/Switch/index.ts +2 -0
- package/lib/components/Tabs/index.ts +1 -0
- package/lib/components/Tags/index.ts +1 -0
- package/lib/components/Timeline/Timeline.tsx +9 -1
- package/lib/components/Tooltip/index.ts +1 -0
- package/lib/components/Topbar/index.ts +1 -0
- package/lib/components/Upload/index.ts +1 -0
- package/lib/context/ThemeContext.tsx +16 -0
- package/lib/context/initComponentTokens.ts +11 -0
- package/lib/context/useComponentToken.ts +15 -1
- package/lib/hooks/useResponsiveTokens.ts +63 -0
- package/lib/main.ts +16 -0
- package/lib/node.ts +2 -0
- package/package.json +5 -4
- package/dist/tokens.d.ts +0 -2
|
@@ -107,6 +107,13 @@ export type DirectoryTokenType = {
|
|
|
107
107
|
color: CSSObject['color'] // Border line color
|
|
108
108
|
leftOffset: CSSObject['left'] // Border line left position
|
|
109
109
|
}
|
|
110
|
+
connector: {
|
|
111
|
+
itemInset: CSSObject['marginLeft'] // Keeps item backgrounds clear of hierarchy lines
|
|
112
|
+
itemPaddingLeft: CSSObject['paddingLeft'] // Left padding for nested items when hierarchy lines are visible
|
|
113
|
+
elbowTop: CSSObject['top'] // Top offset for the horizontal connector elbow
|
|
114
|
+
elbowHeight: CSSObject['height'] // Height of the connector elbow
|
|
115
|
+
elbowWidthOffset: CSSObject['width'] // Extra width that carries the elbow closer to the child row
|
|
116
|
+
}
|
|
110
117
|
}
|
|
111
118
|
}
|
|
112
119
|
}
|
|
@@ -195,6 +202,13 @@ export const getDirectoryTokens = (
|
|
|
195
202
|
color: foundationToken.colors.gray[200],
|
|
196
203
|
leftOffset: foundationToken.unit[16],
|
|
197
204
|
},
|
|
205
|
+
connector: {
|
|
206
|
+
itemInset: foundationToken.unit[8],
|
|
207
|
+
itemPaddingLeft: foundationToken.unit[8],
|
|
208
|
+
elbowTop: foundationToken.unit[5],
|
|
209
|
+
elbowHeight: foundationToken.unit[10],
|
|
210
|
+
elbowWidthOffset: foundationToken.unit[6],
|
|
211
|
+
},
|
|
198
212
|
},
|
|
199
213
|
},
|
|
200
214
|
},
|
|
@@ -275,6 +289,13 @@ export const getDirectoryTokens = (
|
|
|
275
289
|
color: foundationToken.colors.gray[200],
|
|
276
290
|
leftOffset: foundationToken.unit[16],
|
|
277
291
|
},
|
|
292
|
+
connector: {
|
|
293
|
+
itemInset: foundationToken.unit[8],
|
|
294
|
+
itemPaddingLeft: foundationToken.unit[8],
|
|
295
|
+
elbowTop: foundationToken.unit[5],
|
|
296
|
+
elbowHeight: foundationToken.unit[10],
|
|
297
|
+
elbowWidthOffset: foundationToken.unit[6],
|
|
298
|
+
},
|
|
278
299
|
},
|
|
279
300
|
},
|
|
280
301
|
},
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
1
|
+
import type { ReactNode, RefObject } from 'react'
|
|
2
|
+
import type { CSSObject } from 'styled-components'
|
|
3
|
+
|
|
4
|
+
export type DirectoryExpandedItems = Set<string> | string[]
|
|
5
|
+
|
|
6
|
+
export type DirectoryVirtualizationConfig = {
|
|
7
|
+
viewportRef?: RefObject<HTMLElement | null>
|
|
8
|
+
rowHeight?: number
|
|
9
|
+
sectionHeight?: number
|
|
10
|
+
viewportHeight?: number
|
|
11
|
+
overscan?: number
|
|
12
|
+
threshold?: number
|
|
13
|
+
}
|
|
2
14
|
|
|
3
15
|
export type DirectoryProps = {
|
|
4
16
|
directoryData: DirectoryData[] | null
|
|
@@ -7,6 +19,14 @@ export type DirectoryProps = {
|
|
|
7
19
|
onActiveItemChange?: (item: string | null) => void
|
|
8
20
|
defaultActiveItem?: string | null
|
|
9
21
|
iconOnlyMode?: boolean
|
|
22
|
+
showHierarchyLines?: boolean
|
|
23
|
+
hierarchyLineBorderRadius?: CSSObject['borderRadius']
|
|
24
|
+
expandedItems?: DirectoryExpandedItems
|
|
25
|
+
defaultExpandedItems?: DirectoryExpandedItems
|
|
26
|
+
onExpandedItemsChange?: (items: string[]) => void
|
|
27
|
+
onItemExpand?: (item: NavbarItem, itemPath: string) => void | Promise<void>
|
|
28
|
+
enableVirtualization?: boolean
|
|
29
|
+
virtualization?: DirectoryVirtualizationConfig
|
|
10
30
|
}
|
|
11
31
|
|
|
12
32
|
export type DirectoryData = {
|
|
@@ -41,6 +61,8 @@ export type SectionProps = {
|
|
|
41
61
|
) => void
|
|
42
62
|
idPrefix?: string
|
|
43
63
|
iconOnlyMode?: boolean
|
|
64
|
+
showHierarchyLines?: boolean
|
|
65
|
+
hierarchyLineBorderRadius?: CSSObject['borderRadius']
|
|
44
66
|
}
|
|
45
67
|
|
|
46
68
|
export type NavItemProps = {
|
|
@@ -49,4 +71,24 @@ export type NavItemProps = {
|
|
|
49
71
|
onNavigate: (direction: 'up' | 'down', currentIndex: number) => void
|
|
50
72
|
itemPath?: string
|
|
51
73
|
iconOnlyMode?: boolean
|
|
74
|
+
showHierarchyLines?: boolean
|
|
75
|
+
hierarchyLineBorderRadius?: CSSObject['borderRadius']
|
|
76
|
+
isLast?: boolean
|
|
77
|
+
isNested?: boolean
|
|
52
78
|
}
|
|
79
|
+
|
|
80
|
+
export type DirectoryFlatRow =
|
|
81
|
+
| {
|
|
82
|
+
type: 'section'
|
|
83
|
+
section: DirectoryData
|
|
84
|
+
sectionIndex: number
|
|
85
|
+
}
|
|
86
|
+
| {
|
|
87
|
+
type: 'item'
|
|
88
|
+
item: NavbarItem
|
|
89
|
+
sectionIndex: number
|
|
90
|
+
itemPath: string
|
|
91
|
+
depth: number
|
|
92
|
+
isLast: boolean
|
|
93
|
+
ancestorIsLast: boolean[]
|
|
94
|
+
}
|
|
@@ -1,9 +1,89 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
DirectoryData,
|
|
3
|
+
DirectoryExpandedItems,
|
|
4
|
+
DirectoryFlatRow,
|
|
5
|
+
NavbarItem,
|
|
6
|
+
} from './types'
|
|
2
7
|
|
|
3
8
|
export const normalizeDirectoryData = (
|
|
4
9
|
directoryData: DirectoryData[] | null
|
|
5
10
|
): DirectoryData[] => (Array.isArray(directoryData) ? directoryData : [])
|
|
6
11
|
|
|
12
|
+
export const normalizeExpandedItems = (
|
|
13
|
+
expandedItems?: DirectoryExpandedItems
|
|
14
|
+
): Set<string> =>
|
|
15
|
+
expandedItems ? new Set(Array.from(expandedItems)) : new Set<string>()
|
|
16
|
+
|
|
17
|
+
const getItemPath = (parentPath: string, item: NavbarItem): string =>
|
|
18
|
+
parentPath ? `${parentPath}/${item.label}` : item.label
|
|
19
|
+
|
|
20
|
+
const flattenDirectoryItems = (
|
|
21
|
+
items: NavbarItem[],
|
|
22
|
+
expandedItems: Set<string>,
|
|
23
|
+
rows: DirectoryFlatRow[],
|
|
24
|
+
sectionIndex: number,
|
|
25
|
+
parentPath = '',
|
|
26
|
+
depth = 0,
|
|
27
|
+
ancestorIsLast: boolean[] = []
|
|
28
|
+
) => {
|
|
29
|
+
items.forEach((item, index) => {
|
|
30
|
+
const itemPath = getItemPath(parentPath, item)
|
|
31
|
+
const hasChildren = !!item.items?.length
|
|
32
|
+
const isLast = index === items.length - 1
|
|
33
|
+
|
|
34
|
+
rows.push({
|
|
35
|
+
type: 'item',
|
|
36
|
+
item,
|
|
37
|
+
sectionIndex,
|
|
38
|
+
itemPath,
|
|
39
|
+
depth,
|
|
40
|
+
isLast,
|
|
41
|
+
ancestorIsLast,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
if (hasChildren && expandedItems.has(itemPath) && item.items) {
|
|
45
|
+
flattenDirectoryItems(
|
|
46
|
+
item.items,
|
|
47
|
+
expandedItems,
|
|
48
|
+
rows,
|
|
49
|
+
sectionIndex,
|
|
50
|
+
itemPath,
|
|
51
|
+
depth + 1,
|
|
52
|
+
[...ancestorIsLast, isLast]
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const flattenDirectoryData = (
|
|
59
|
+
directoryData: DirectoryData[],
|
|
60
|
+
expandedItems: Set<string>,
|
|
61
|
+
openSections: Set<number>
|
|
62
|
+
): DirectoryFlatRow[] => {
|
|
63
|
+
const rows: DirectoryFlatRow[] = []
|
|
64
|
+
|
|
65
|
+
directoryData.forEach((section, sectionIndex) => {
|
|
66
|
+
if (section.label) {
|
|
67
|
+
rows.push({
|
|
68
|
+
type: 'section',
|
|
69
|
+
section,
|
|
70
|
+
sectionIndex,
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (section.items && openSections.has(sectionIndex)) {
|
|
75
|
+
flattenDirectoryItems(
|
|
76
|
+
section.items,
|
|
77
|
+
expandedItems,
|
|
78
|
+
rows,
|
|
79
|
+
sectionIndex
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return rows
|
|
85
|
+
}
|
|
86
|
+
|
|
7
87
|
export const handleSectionNavigation = (
|
|
8
88
|
direction: 'up' | 'down',
|
|
9
89
|
currentIndex: number,
|
|
@@ -278,12 +278,16 @@ const DropdownInput = ({
|
|
|
278
278
|
paddingInlineStart={paddingInlineStart}
|
|
279
279
|
paddingInlineEnd={paddingInlineEnd}
|
|
280
280
|
paddingTop={
|
|
281
|
-
|
|
281
|
+
label &&
|
|
282
|
+
isSmallScreenWithLargeSize &&
|
|
283
|
+
inputFocusedOrWithValue
|
|
282
284
|
? paddingY * 1.5
|
|
283
285
|
: paddingY
|
|
284
286
|
}
|
|
285
287
|
paddingBottom={
|
|
286
|
-
|
|
288
|
+
label &&
|
|
289
|
+
isSmallScreenWithLargeSize &&
|
|
290
|
+
inputFocusedOrWithValue
|
|
287
291
|
? paddingY / 2
|
|
288
292
|
: paddingY
|
|
289
293
|
}
|
|
@@ -276,12 +276,16 @@ const NumberInput = ({
|
|
|
276
276
|
aria-describedby={ariaDescribedBy}
|
|
277
277
|
paddingX={paddingX}
|
|
278
278
|
paddingTop={
|
|
279
|
-
|
|
279
|
+
label &&
|
|
280
|
+
isSmallScreenWithLargeSize &&
|
|
281
|
+
inputFocusedOrWithValue
|
|
280
282
|
? paddingY * 1.5
|
|
281
283
|
: paddingY
|
|
282
284
|
}
|
|
283
285
|
paddingBottom={
|
|
284
|
-
|
|
286
|
+
label &&
|
|
287
|
+
isSmallScreenWithLargeSize &&
|
|
288
|
+
inputFocusedOrWithValue
|
|
285
289
|
? paddingY / 2
|
|
286
290
|
: paddingY
|
|
287
291
|
}
|
|
@@ -153,12 +153,14 @@ const TextArea = ({
|
|
|
153
153
|
resize={resize}
|
|
154
154
|
paddingX={paddingX}
|
|
155
155
|
paddingTop={
|
|
156
|
-
isSmallScreen && inputFocusedOrWithValue
|
|
156
|
+
label && isSmallScreen && inputFocusedOrWithValue
|
|
157
157
|
? paddingY + 14
|
|
158
158
|
: paddingY
|
|
159
159
|
}
|
|
160
160
|
paddingBottom={
|
|
161
|
-
isSmallScreen && inputFocusedOrWithValue
|
|
161
|
+
label && isSmallScreen && inputFocusedOrWithValue
|
|
162
|
+
? 0
|
|
163
|
+
: paddingY
|
|
162
164
|
}
|
|
163
165
|
border={
|
|
164
166
|
textAreaTokens.inputContainer.border[
|
|
@@ -319,12 +319,16 @@ const TextInput = ({
|
|
|
319
319
|
paddingInlineStart={paddingInlineStart}
|
|
320
320
|
paddingInlineEnd={paddingInlineEnd}
|
|
321
321
|
paddingTop={
|
|
322
|
-
|
|
322
|
+
label &&
|
|
323
|
+
isSmallScreenWithLargeSize &&
|
|
324
|
+
inputFocusedOrWithValue
|
|
323
325
|
? paddingY * 1.5
|
|
324
326
|
: paddingY
|
|
325
327
|
}
|
|
326
328
|
paddingBottom={
|
|
327
|
-
|
|
329
|
+
label &&
|
|
330
|
+
isSmallScreenWithLargeSize &&
|
|
331
|
+
inputFocusedOrWithValue
|
|
328
332
|
? paddingY / 2
|
|
329
333
|
: paddingY
|
|
330
334
|
}
|
|
@@ -282,12 +282,16 @@ const UnitInput = ({
|
|
|
282
282
|
paddingInlineStart={paddingInlineStart}
|
|
283
283
|
paddingInlineEnd={paddingInlineEnd}
|
|
284
284
|
paddingTop={
|
|
285
|
-
|
|
285
|
+
label &&
|
|
286
|
+
isSmallScreenWithLargeSize &&
|
|
287
|
+
inputFocusedOrWithValue
|
|
286
288
|
? paddingY * 1.5
|
|
287
289
|
: paddingY
|
|
288
290
|
}
|
|
289
291
|
paddingBottom={
|
|
290
|
-
|
|
292
|
+
label &&
|
|
293
|
+
isSmallScreenWithLargeSize &&
|
|
294
|
+
inputFocusedOrWithValue
|
|
291
295
|
? paddingY / 2
|
|
292
296
|
: paddingY
|
|
293
297
|
}
|
|
@@ -537,12 +537,16 @@ const NumberInputV2 = forwardRef<HTMLInputElement, NumberInputV2Props>(
|
|
|
537
537
|
paddingLeft={inputPaddingLeft}
|
|
538
538
|
paddingRight={inputPaddingRight}
|
|
539
539
|
paddingTop={
|
|
540
|
-
|
|
540
|
+
Boolean(label.text?.trim()) &&
|
|
541
|
+
smallScreenLarge &&
|
|
542
|
+
inputFocusedOrWithValue
|
|
541
543
|
? paddingY * 1.5
|
|
542
544
|
: inputContainerTokens.paddingTop[size]
|
|
543
545
|
}
|
|
544
546
|
paddingBottom={
|
|
545
|
-
|
|
547
|
+
Boolean(label.text?.trim()) &&
|
|
548
|
+
smallScreenLarge &&
|
|
549
|
+
inputFocusedOrWithValue
|
|
546
550
|
? paddingY / 2
|
|
547
551
|
: inputContainerTokens.paddingBottom[size]
|
|
548
552
|
}
|
|
@@ -85,8 +85,9 @@ const TextAreaV2 = forwardRef<HTMLTextAreaElement, TextAreaV2Props>(
|
|
|
85
85
|
size,
|
|
86
86
|
isSmallScreen,
|
|
87
87
|
inputFocusedOrWithValue,
|
|
88
|
+
hasLabel: Boolean(label),
|
|
88
89
|
}),
|
|
89
|
-
[ic, size, isSmallScreen, inputFocusedOrWithValue]
|
|
90
|
+
[ic, size, isSmallScreen, inputFocusedOrWithValue, label]
|
|
90
91
|
)
|
|
91
92
|
|
|
92
93
|
const {
|
|
@@ -45,18 +45,20 @@ export function getTextAreaInputPadding({
|
|
|
45
45
|
size,
|
|
46
46
|
isSmallScreen,
|
|
47
47
|
inputFocusedOrWithValue,
|
|
48
|
+
hasLabel,
|
|
48
49
|
}: {
|
|
49
50
|
inputContainer: TextAreaV2TokensType['inputContainer']
|
|
50
51
|
size: InputSizeV2
|
|
51
52
|
isSmallScreen: boolean
|
|
52
53
|
inputFocusedOrWithValue: boolean
|
|
54
|
+
hasLabel: boolean
|
|
53
55
|
}): TextAreaInputPadding {
|
|
54
56
|
const paddingTopBase = toPixels(inputContainer.padding.top[size])
|
|
55
57
|
const paddingBottomBase = toPixels(inputContainer.padding.bottom[size])
|
|
56
58
|
const paddingLeft = toPixels(inputContainer.padding.left[size])
|
|
57
59
|
const paddingRight = toPixels(inputContainer.padding.right[size])
|
|
58
60
|
|
|
59
|
-
const isFloating = isSmallScreen && inputFocusedOrWithValue
|
|
61
|
+
const isFloating = hasLabel && isSmallScreen && inputFocusedOrWithValue
|
|
60
62
|
const paddingTop = isFloating
|
|
61
63
|
? paddingTopBase + paddingTopBase
|
|
62
64
|
: paddingTopBase
|
|
@@ -171,6 +171,7 @@ const TextInputV2 = forwardRef<HTMLInputElement, TextInputV2Props>(
|
|
|
171
171
|
} = getVerticalInputPadding({
|
|
172
172
|
isSmallScreenWithLargeSize,
|
|
173
173
|
inputFocusedOrWithValue,
|
|
174
|
+
hasLabel: Boolean(label),
|
|
174
175
|
paddingTop: inputContainerPaddingTop,
|
|
175
176
|
paddingBottom: inputContainerPaddingBottom,
|
|
176
177
|
})
|
|
@@ -22,23 +22,21 @@ export const getInputState = (
|
|
|
22
22
|
export const getVerticalInputPadding = ({
|
|
23
23
|
isSmallScreenWithLargeSize,
|
|
24
24
|
inputFocusedOrWithValue,
|
|
25
|
+
hasLabel,
|
|
25
26
|
paddingTop,
|
|
26
27
|
paddingBottom,
|
|
27
28
|
}: {
|
|
28
29
|
isSmallScreenWithLargeSize: boolean
|
|
29
30
|
inputFocusedOrWithValue: boolean
|
|
31
|
+
hasLabel: boolean
|
|
30
32
|
paddingTop: number
|
|
31
33
|
paddingBottom: number
|
|
32
34
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
isSmallScreenWithLargeSize && inputFocusedOrWithValue
|
|
35
|
-
? paddingTop * 1.5
|
|
36
|
-
: paddingTop
|
|
35
|
+
const shouldFloat =
|
|
36
|
+
hasLabel && isSmallScreenWithLargeSize && inputFocusedOrWithValue
|
|
37
37
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
? paddingBottom / 2
|
|
41
|
-
: paddingBottom
|
|
38
|
+
const top = shouldFloat ? paddingTop * 1.5 : paddingTop
|
|
39
|
+
const bottom = shouldFloat ? paddingBottom / 2 : paddingBottom
|
|
42
40
|
|
|
43
41
|
return { top, bottom }
|
|
44
42
|
}
|