@pega/cosmos-react-core 9.0.0-build.6.5 → 9.0.0-build.6.7

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.
Files changed (37) hide show
  1. package/lib/components/PageTemplates/GridLayout/EditorBackground.js +1 -1
  2. package/lib/components/PageTemplates/GridLayout/EditorBackground.js.map +1 -1
  3. package/lib/components/PageTemplates/GridLayout/GridLayoutEditor.js +1 -1
  4. package/lib/components/PageTemplates/GridLayout/GridLayoutEditor.js.map +1 -1
  5. package/lib/components/PageTemplates/GridLayout/GridLayoutViewer.d.ts +5 -0
  6. package/lib/components/PageTemplates/GridLayout/GridLayoutViewer.d.ts.map +1 -1
  7. package/lib/components/PageTemplates/GridLayout/GridLayoutViewer.js +2 -2
  8. package/lib/components/PageTemplates/GridLayout/GridLayoutViewer.js.map +1 -1
  9. package/lib/components/PageTemplates/GridLayout/config.d.ts +1 -1
  10. package/lib/components/PageTemplates/GridLayout/config.d.ts.map +1 -1
  11. package/lib/components/PageTemplates/GridLayout/config.js +3 -3
  12. package/lib/components/PageTemplates/GridLayout/config.js.map +1 -1
  13. package/lib/hooks/index.d.ts +1 -0
  14. package/lib/hooks/index.d.ts.map +1 -1
  15. package/lib/hooks/index.js +1 -0
  16. package/lib/hooks/index.js.map +1 -1
  17. package/lib/hooks/useAnimatedText.d.ts +11 -0
  18. package/lib/hooks/useAnimatedText.d.ts.map +1 -0
  19. package/lib/hooks/useAnimatedText.js +93 -0
  20. package/lib/hooks/useAnimatedText.js.map +1 -0
  21. package/lib/hooks/useI18n.d.ts +28 -0
  22. package/lib/hooks/useI18n.d.ts.map +1 -1
  23. package/lib/i18n/default.d.ts +28 -0
  24. package/lib/i18n/default.d.ts.map +1 -1
  25. package/lib/i18n/default.js +32 -0
  26. package/lib/i18n/default.js.map +1 -1
  27. package/lib/i18n/i18n.d.ts +28 -0
  28. package/lib/i18n/i18n.d.ts.map +1 -1
  29. package/lib/utils/index.d.ts +1 -0
  30. package/lib/utils/index.d.ts.map +1 -1
  31. package/lib/utils/index.js +1 -0
  32. package/lib/utils/index.js.map +1 -1
  33. package/lib/utils/markdownTokenizer.d.ts +3 -0
  34. package/lib/utils/markdownTokenizer.d.ts.map +1 -0
  35. package/lib/utils/markdownTokenizer.js +159 -0
  36. package/lib/utils/markdownTokenizer.js.map +1 -0
  37. package/package.json +1 -1
@@ -55,7 +55,7 @@ StyledPageBreak.defaultProps = defaultThemeProp;
55
55
  */
56
56
  const EditorBackground = ({ layout, numColumns, rowHeight, rowsPerPage, highlighted }) => {
57
57
  const t = useI18n();
58
- const { margin, containerPadding } = useGridLayoutConfig();
58
+ const { margin, containerPadding } = useGridLayoutConfig(true);
59
59
  const maxYInLayout = layout ? Math.max(...layout.map(item => item.y + item.h)) : 0;
60
60
  const maxY = Math.max(maxYInLayout, rowsPerPage || 0);
61
61
  const numGridCells = (maxY + 1) * numColumns;
@@ -1 +1 @@
1
- {"version":3,"file":"EditorBackground.js","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/EditorBackground.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,IAAI,MAAM,YAAY,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,mBAAmB,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;CAK9B,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAC/B,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE;IACpC,MAAM,EACJ,IAAI,EAA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Ed,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,WAAY,EACjC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAL5B,CAAC,CAMN,CACH,CAAC,IACS,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import type { FC } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { Layout } from 'react-grid-layout';\nimport { rgba } from 'polished';\n\nimport Grid from '../../Grid';\nimport type { NoChildrenProp } from '../../../types';\nimport { defaultThemeProp } from '../../../theme';\nimport { useI18n } from '../../../hooks';\n\nimport useGridLayoutConfig from './config';\nimport { getArrayFromRange } from './utils';\n\nconst StyledGrid = styled(Grid)`\n position: absolute;\n z-index: -1;\n pointer-events: none;\n inline-size: 100%;\n`;\n\nconst StyledGridCell = styled.div<{ rowHeight: number; highlighted: boolean }>(\n ({ theme, highlighted, rowHeight }) => {\n const {\n base: { palette }\n } = theme;\n const borderColor = palette[highlighted ? 'warn' : 'border-line'];\n const background = highlighted ? rgba(palette.warn, 0.1) : 'transparent';\n\n return css`\n /* stylelint-disable-next-line unit-allowed-list */\n border: 1px solid ${borderColor};\n background: ${background};\n block-size: ${rowHeight}px;\n `;\n }\n);\nStyledGridCell.defaultProps = defaultThemeProp;\n\ninterface PageBreakProps {\n rowsAbove: number;\n rowHeight: number;\n margin: [number, number];\n containerPadding: [number, number];\n prefix: string;\n}\n\nconst StyledPageBreak = styled.div<PageBreakProps>(\n ({ containerPadding, rowHeight, theme, margin, rowsAbove, prefix }) => {\n const {\n base: { palette }\n } = theme;\n return css`\n position: absolute;\n inset-inline-start: ${containerPadding[0]}px;\n inset-inline-end: ${containerPadding[0]}px;\n inset-block-start: ${containerPadding[1] + rowsAbove * (rowHeight + margin[1])}px;\n /* stylelint-disable-next-line unit-allowed-list */\n margin-block-start: ${-margin[1] / 2 - 1}px;\n /* stylelint-disable-next-line unit-allowed-list */\n border-block-start: 2px dashed ${palette['border-line']};\n\n &::before {\n content: '${prefix}';\n position: absolute;\n font-size: 0.75rem;\n line-height: 1;\n transform: translate(0, -50%);\n background-color: ${palette['app-background']};\n color: ${palette['border-line']};\n padding-inline-end: 0.25rem;\n }\n `;\n }\n);\nStyledPageBreak.defaultProps = defaultThemeProp;\n\ninterface EditorBackgroundProps extends NoChildrenProp {\n layout?: Layout[];\n numColumns: number;\n rowHeight: number;\n rowsPerPage: number | null; // null when not applying auto-fit\n highlighted: boolean;\n}\n\n/**\n * Renders background grid-cells for GridEditor\n * @component\n */\nconst EditorBackground: FC<EditorBackgroundProps> = ({\n layout,\n numColumns,\n rowHeight,\n rowsPerPage,\n highlighted\n}) => {\n const t = useI18n();\n const { margin, containerPadding } = useGridLayoutConfig();\n\n const maxYInLayout = layout ? Math.max(...layout.map(item => item.y + item.h)) : 0;\n const maxY = Math.max(maxYInLayout, rowsPerPage || 0);\n const numGridCells = (maxY + 1) * numColumns;\n const cells = getArrayFromRange(0, numGridCells, false);\n\n // rowsPerPage will be null if auto-fit is disabled. Don't show pageBreaks in that case.\n const numPageBreaks = rowsPerPage ? Math.floor(maxY / rowsPerPage) : 0;\n const pageBreaks = getArrayFromRange(0, numPageBreaks, false);\n\n return (\n <StyledGrid container={{ cols: `repeat(${numColumns}, 1fr)`, gap: 2, pad: [0, 2, 2, 2] }}>\n {cells.map(n => (\n <StyledGridCell\n key={n}\n rowHeight={rowHeight}\n // Highlight all cells except the dummy row at the bottom\n highlighted={highlighted && n < numGridCells - numColumns}\n />\n ))}\n {pageBreaks.map(n => (\n <StyledPageBreak\n key={n}\n rowsAbove={(n + 1) * rowsPerPage!}\n rowHeight={rowHeight}\n margin={margin}\n containerPadding={containerPadding}\n prefix={t('page_number', [n + 1])}\n />\n ))}\n </StyledGrid>\n );\n};\n\nexport default EditorBackground;\n"]}
1
+ {"version":3,"file":"EditorBackground.js","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/EditorBackground.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,IAAI,MAAM,YAAY,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,mBAAmB,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;CAK9B,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAC/B,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE;IACpC,MAAM,EACJ,IAAI,EAAE,EAAE,OAAO,EAAE,EAClB,GAAG,KAAK,CAAC;IACV,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAEzE,OAAO,GAAG,CAAA;;0BAEY,WAAW;oBACjB,UAAU;oBACV,SAAS;KACxB,CAAC;AACJ,CAAC,CACF,CAAC;AACF,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAU/C,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAChC,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE;IACpE,MAAM,EACJ,IAA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,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,iBAAiB,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;IAE9D,OAAO,CACL,MAAC,UAAU,IAAC,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,UAAU,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,aACrF,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CACd,KAAC,cAAc,IAEb,SAAS,EAAE,SAAS;gBACpB,yDAAyD;gBACzD,WAAW,EAAE,WAAW,IAAI,CAAC,GAAG,YAAY,GAAG,UAAU,IAHpD,CAAC,CAIN,CACH,CAAC,EACD,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CACnB,KAAC,eAAe,IAEd,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,WAAY,EACjC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAL5B,CAAC,CAMN,CACH,CAAC,IACS,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import type { FC } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { Layout } from 'react-grid-layout';\nimport { rgba } from 'polished';\n\nimport Grid from '../../Grid';\nimport type { NoChildrenProp } from '../../../types';\nimport { defaultThemeProp } from '../../../theme';\nimport { useI18n } from '../../../hooks';\n\nimport useGridLayoutConfig from './config';\nimport { getArrayFromRange } from './utils';\n\nconst StyledGrid = styled(Grid)`\n position: absolute;\n z-index: -1;\n pointer-events: none;\n inline-size: 100%;\n`;\n\nconst StyledGridCell = styled.div<{ rowHeight: number; highlighted: boolean }>(\n ({ theme, highlighted, rowHeight }) => {\n const {\n base: { palette }\n } = theme;\n const borderColor = palette[highlighted ? 'warn' : 'border-line'];\n const background = highlighted ? rgba(palette.warn, 0.1) : 'transparent';\n\n return css`\n /* stylelint-disable-next-line unit-allowed-list */\n border: 1px solid ${borderColor};\n background: ${background};\n block-size: ${rowHeight}px;\n `;\n }\n);\nStyledGridCell.defaultProps = defaultThemeProp;\n\ninterface PageBreakProps {\n rowsAbove: number;\n rowHeight: number;\n margin: [number, number];\n containerPadding: [number, number];\n prefix: string;\n}\n\nconst StyledPageBreak = styled.div<PageBreakProps>(\n ({ containerPadding, rowHeight, theme, margin, rowsAbove, prefix }) => {\n const {\n base: { palette }\n } = theme;\n return css`\n position: absolute;\n inset-inline-start: ${containerPadding[0]}px;\n inset-inline-end: ${containerPadding[0]}px;\n inset-block-start: ${containerPadding[1] + rowsAbove * (rowHeight + margin[1])}px;\n /* stylelint-disable-next-line unit-allowed-list */\n margin-block-start: ${-margin[1] / 2 - 1}px;\n /* stylelint-disable-next-line unit-allowed-list */\n border-block-start: 2px dashed ${palette['border-line']};\n\n &::before {\n content: '${prefix}';\n position: absolute;\n font-size: 0.75rem;\n line-height: 1;\n transform: translate(0, -50%);\n background-color: ${palette['app-background']};\n color: ${palette['border-line']};\n padding-inline-end: 0.25rem;\n }\n `;\n }\n);\nStyledPageBreak.defaultProps = defaultThemeProp;\n\ninterface EditorBackgroundProps extends NoChildrenProp {\n layout?: Layout[];\n numColumns: number;\n rowHeight: number;\n rowsPerPage: number | null; // null when not applying auto-fit\n highlighted: boolean;\n}\n\n/**\n * Renders background grid-cells for GridEditor\n * @component\n */\nconst EditorBackground: FC<EditorBackgroundProps> = ({\n layout,\n numColumns,\n rowHeight,\n rowsPerPage,\n highlighted\n}) => {\n const t = useI18n();\n const { margin, containerPadding } = useGridLayoutConfig(true);\n\n const maxYInLayout = layout ? Math.max(...layout.map(item => item.y + item.h)) : 0;\n const maxY = Math.max(maxYInLayout, rowsPerPage || 0);\n const numGridCells = (maxY + 1) * numColumns;\n const cells = getArrayFromRange(0, numGridCells, false);\n\n // rowsPerPage will be null if auto-fit is disabled. Don't show pageBreaks in that case.\n const numPageBreaks = rowsPerPage ? Math.floor(maxY / rowsPerPage) : 0;\n const pageBreaks = getArrayFromRange(0, numPageBreaks, false);\n\n return (\n <StyledGrid container={{ cols: `repeat(${numColumns}, 1fr)`, gap: 2, pad: [0, 2, 2, 2] }}>\n {cells.map(n => (\n <StyledGridCell\n key={n}\n rowHeight={rowHeight}\n // Highlight all cells except the dummy row at the bottom\n highlighted={highlighted && n < numGridCells - numColumns}\n />\n ))}\n {pageBreaks.map(n => (\n <StyledPageBreak\n key={n}\n rowsAbove={(n + 1) * rowsPerPage!}\n rowHeight={rowHeight}\n margin={margin}\n containerPadding={containerPadding}\n prefix={t('page_number', [n + 1])}\n />\n ))}\n </StyledGrid>\n );\n};\n\nexport default EditorBackground;\n"]}
@@ -41,7 +41,7 @@ const GridLayoutEditor = ({ handle, children, layoutModel, rows, onModelChange,
41
41
  const size = useMonitoredSize(wrapperEl);
42
42
  const width = size?.width;
43
43
  const height = size?.height;
44
- const commonGridConfig = useGridLayoutConfig();
44
+ const commonGridConfig = useGridLayoutConfig(true);
45
45
  const t = useI18n();
46
46
  const { breakpoint, numColumns } = useMemo(() => getBreakpointAndCols(width || 0, restProps.breakpoints, restProps.cols), [width, restProps.breakpoints, restProps.cols]);
47
47
  const { rowHeight, numRowsPerPage } = useMemo(() => getRowHeight(breakpoint, height || 0, commonGridConfig.margin[0], rows, layoutModel), [breakpoint, commonGridConfig.margin, height, rows, layoutModel]);
@@ -1 +1 @@
1
- {"version":3,"file":"GridLayoutEditor.js","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/GridLayoutEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,SAAS,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,CAA6D,CAC3E,IACoB,IACtB,CACJ,IACY,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import {\n type FC,\n type ReactElement,\n type Ref,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState\n} from 'react';\nimport {\n Responsive as ResponsiveGridLayout,\n type Layout,\n type Layouts,\n type CoreProps\n} from 'react-grid-layout';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../../Flex';\nimport { useElement, useI18n } from '../../../hooks';\nimport { defaultThemeProp } from '../../../theme';\n\nimport useGridLayoutConfig, { type GridBreakPointWiseValues, type GridLayoutModel } from './config';\nimport EditorBackground from './EditorBackground';\nimport EditorGridItem, { ResizeHandle, resizeHandleClassName } from './EditorGridItem';\nimport {\n checkLayoutForGaps,\n getBreakpointAndCols,\n getRowHeight,\n useGridItemSorter,\n useMonitoredSize,\n type GridLayoutRowsProp\n} from './utils';\nimport ReactResizableStyles from './ReactResizableStyles';\nimport ReactGridLayoutStyles from './ReactGridLayoutStyles';\n\nconst StyledEditor = styled(Flex)(({ theme }) => {\n const {\n base: {\n palette: { interactive }\n }\n } = theme;\n return css`\n position: relative;\n\n /* Needed for the background grid to be visible */\n z-index: 0;\n block-size: 100%;\n overflow-y: auto;\n\n /* To minimize height triggers during dragging due to horizontal scrollbar showing up */\n overflow-x: hidden;\n\n .react-grid-item.react-grid-placeholder {\n background: ${interactive};\n opacity: 0.3;\n }\n `;\n});\nStyledEditor.defaultProps = defaultThemeProp;\n\nexport interface GridLayoutHandleValue {\n /** Used to get layout model with imperative handle. Returns the layout model from all breakpoints. Returns undefined when no children. */\n getLayoutModel: () => GridLayoutModel | undefined;\n\n /**\n * Returns a flag indicating whether there are any gaps in the current layout.\n * Highlights all background cells to indicate the same.\n */\n checkForGaps: () => boolean;\n}\n\n/** Props for GridLayoutEditor component */\nexport interface GridLayoutEditorProps {\n /**\n * Called whenever there's a change in the layoutModel.\n * Change-handler of the CONTROLLED COMPONENT\n */\n onModelChange: (newModel: GridLayoutModel | undefined) => void;\n\n /**\n * Value of the CONTROLLED component\n * Passed when editing a previously saved layout.\n * Can be `undefined` when no children.\n * It should be the same as the one emitted by `getLayoutModel` or `handle`\n */\n layoutModel: GridLayoutModel | undefined;\n\n /**\n * Breakpoints set on the Grid.\n * Needs to be aligned with `rows` and `cols`\n */\n breakpoints: GridBreakPointWiseValues;\n\n /**\n * # of rows to fit into the container height at each breakpoint (unless a fixed rowHeight is preferred)\n * rows should be aligned with `breakpoints` prop\n */\n rows: GridLayoutRowsProp;\n\n /**\n * Breakpoint-wise numColumns on the Grid.\n * cols should be aligned with `breakpoints` prop\n */\n cols: GridBreakPointWiseValues;\n\n /**\n * If parent DOM node of ResponsiveReactGridLayout or ReactGridLayout has \"transform: scale(n)\" css property,\n * we should set scale coefficient to avoid render artifacts while dragging.\n */\n transformScale?: CoreProps['transformScale'];\n\n /** Ref to access the editor state. Used to get the current layout-model when persisting it. */\n handle?: Ref<GridLayoutHandleValue>;\n\n /**\n * Child elements to be rendered as Grid items.\n * Each element should have a unique `key`\n * Memoize children for a better performance: https://github.com/react-grid-layout/react-grid-layout#performance\n * Set up an `itemLabel` prop with the text to call out when the item is focused.\n * If a child needs to be initialized with a specific x/y/w/h,\n * or if you want to specify any special properties like minW, minH, etc.,\n * set up a `data-grid` in layoutModel prop with any subset of properties\n * The prop can be undefined on init when no elements.\n */\n children?: ReactElement[];\n\n /** Item label mapped with item id for a11y */\n itemLabelMap: Record<string, string>;\n}\n\n/**\n * Editor component to create Grid Layouts\n * @component\n */\nconst GridLayoutEditor: FC<GridLayoutEditorProps> = ({\n handle,\n children,\n layoutModel,\n rows,\n onModelChange,\n itemLabelMap,\n ...restProps\n}) => {\n // Track width changes: https://github.com/react-grid-layout/react-grid-layout#providing-grid-width\n const [wrapperEl, setWrapperEl] = useElement<HTMLElement>();\n const size = useMonitoredSize(wrapperEl);\n const width = size?.width;\n const height = size?.height;\n const commonGridConfig = useGridLayoutConfig();\n const t = useI18n();\n const { breakpoint, numColumns } = useMemo(\n () => getBreakpointAndCols(width || 0, restProps.breakpoints, restProps.cols),\n [width, restProps.breakpoints, restProps.cols]\n );\n const { rowHeight, numRowsPerPage } = useMemo(\n () => getRowHeight(breakpoint, height || 0, commonGridConfig.margin[0], rows, layoutModel),\n [breakpoint, commonGridConfig.margin, height, rows, layoutModel]\n );\n const currentLayout = useMemo(() => layoutModel?.[breakpoint], [breakpoint, layoutModel]);\n\n const onLayoutChange = useCallback(\n (curLayout: Layout[], allLayouts: Layouts) => {\n onModelChange(!children || children.length === 0 ? undefined : allLayouts);\n },\n [children, onModelChange]\n );\n\n // Callback to sort child DOM nodes to ensure an intuitive tabbing order\n const gridItemSorter = useGridItemSorter(currentLayout, numColumns);\n\n // Set up keyboard accessibility\n const [listEl, setListEl] = useElement<HTMLElement>();\n useEffect(() => {\n if (listEl) {\n listEl.setAttribute('role', 'list');\n listEl.setAttribute('tabindex', '0');\n listEl.setAttribute('aria-label', t('configurable_layout_instructions'));\n }\n }, [listEl, t]);\n\n const moveItem = useCallback(\n (itemKey: ReactElement['key'], deltaX: number, deltaY: number) => {\n // Should be initialized by this point\n if (!currentLayout) return;\n const itemIndex = currentLayout.findIndex(item => item.i === itemKey);\n // Should be present on the currentLayout by this point.\n if (itemIndex === -1) return;\n\n const oldItem = currentLayout[itemIndex];\n const newItem: Layout = {\n ...oldItem,\n // `Math.max` needed to avoid a glitch when moving left beyond the left edge\n x: Math.max(0, oldItem.x + deltaX),\n y: Math.max(0, oldItem.y + deltaY)\n };\n const newLayout = [\n ...currentLayout.slice(0, itemIndex),\n newItem,\n ...currentLayout.slice(itemIndex + 1)\n ];\n const newModel = { ...layoutModel, [breakpoint]: newLayout };\n onModelChange(!children || children.length === 0 ? undefined : newModel);\n },\n [breakpoint, children, currentLayout, layoutModel, onModelChange]\n );\n\n const addOrSubtractItemSize = useCallback(\n (itemKey: ReactElement['key'], deltaW: number, deltaH: number) => {\n // Should be initialized by this point\n if (!currentLayout) return;\n const itemIndex = currentLayout.findIndex(item => item.i === itemKey);\n // Should be present on the currentLayout by this point.\n if (itemIndex === -1) return;\n\n const oldItem = currentLayout[itemIndex];\n const newItem: Layout = {\n ...oldItem,\n // `Math.max` needed to avoid a glitch when moving left beyond the left edge\n w: Math.max(oldItem.minW || 2, oldItem.w + deltaW),\n h: Math.max(oldItem.minH || 2, oldItem.h + deltaH)\n };\n const newLayout = [\n ...currentLayout.slice(0, itemIndex),\n newItem,\n ...currentLayout.slice(itemIndex + 1)\n ];\n const newModel = { ...layoutModel, [breakpoint]: newLayout };\n onModelChange(!children || children.length === 0 ? undefined : newModel);\n },\n [breakpoint, children, currentLayout, layoutModel, onModelChange]\n );\n\n // Provide a way for the parent component to get layout-model on demand\n const [highlightedBG, setHighlightedBG] = useState(false);\n useImperativeHandle(\n handle,\n () => ({\n getLayoutModel: () => {\n // Without this check, we'll end up with the dummy model set up down below for this case\n if (!children || children.length === 0) return undefined;\n return layoutModel;\n },\n\n checkForGaps: () => {\n // On load when no items are added.\n if (!currentLayout) return true;\n const hasGaps = checkLayoutForGaps(currentLayout, numColumns);\n setHighlightedBG(hasGaps);\n return hasGaps;\n }\n }),\n [children, layoutModel, currentLayout, numColumns]\n );\n\n return (\n // Editor is always in LTR. At runtime, the layout is mirrored depending on locale.\n <StyledEditor ref={setWrapperEl} dir='ltr'>\n <ReactResizableStyles />\n <ReactGridLayoutStyles />\n\n {!!width && !!height && (\n <>\n <EditorBackground\n data-testid='editor'\n layout={currentLayout}\n numColumns={numColumns}\n rowHeight={rowHeight}\n rowsPerPage={numRowsPerPage}\n highlighted={highlightedBG}\n />\n\n <ResponsiveGridLayout\n {...commonGridConfig}\n width={width}\n rowHeight={rowHeight}\n onLayoutChange={onLayoutChange}\n resizeHandles={['s', 'e', 'n', 'w', 'sw', 'nw', 'se', 'ne']}\n resizeHandle={<ResizeHandle />}\n // To prevent drag event on the resize handles\n draggableCancel={`.${resizeHandleClassName}`}\n innerRef={setListEl}\n layouts={layoutModel}\n {...restProps}\n >\n {children?.sort(gridItemSorter).map(child => {\n const gridLayoutModel = layoutModel?.[breakpoint]?.filter(\n layout => layout.i === child.key\n );\n return (\n <EditorGridItem\n key={child.key}\n itemKey={child.key}\n data-grid={gridLayoutModel && gridLayoutModel[0]}\n itemLabel={itemLabelMap[child.key!] || ''}\n moveItem={moveItem}\n addOrSubtractItemSize={addOrSubtractItemSize}\n >\n {child}\n </EditorGridItem>\n );\n })}\n\n {(!children || children.length === 0) && (\n // Placeholder when no children. Needed to avoid exceptions:\n // https://github.com/react-grid-layout/react-grid-layout/issues/216\n <div key='--' data-grid={{ x: 0, y: 0, w: 1, h: 1, resizeHandles: [] }} />\n )}\n </ResponsiveGridLayout>\n </>\n )}\n </StyledEditor>\n );\n};\n\nexport default GridLayoutEditor;\n"]}
1
+ {"version":3,"file":"GridLayoutEditor.js","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/GridLayoutEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EACL,UAAU,IAAI,oBAAoB,EAInC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,mBAAmB,EAAE,EAAuD,MAAM,UAAU,CAAC;AACpG,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,cAAc,EAAE,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB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AC,EAAE,MAAM,CACvD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,GAAG,CACjC,CAAC;gCACF,OAAO,CACL,KAAC,cAAc,IAEb,OAAO,EAAE,KAAK,CAAC,GAAG,eACP,eAAe,IAAI,eAAe,CAAC,CAAC,CAAC,EAChD,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,GAAI,CAAC,IAAI,EAAE,EACzC,QAAQ,EAAE,QAAQ,EAClB,qBAAqB,EAAE,qBAAqB,YAE3C,KAAK,IAPD,KAAK,CAAC,GAAG,CAQC,CAClB,CAAC;4BACJ,CAAC,CAAC,EAED,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI;4BACvC,4DAA4D;4BAC5D,oEAAoE;4BACpE,2BAAyB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,IAA7D,IAAI,CAA6D,CAC3E,IACoB,IACtB,CACJ,IACY,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import {\n type FC,\n type ReactElement,\n type Ref,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState\n} from 'react';\nimport {\n Responsive as ResponsiveGridLayout,\n type Layout,\n type Layouts,\n type CoreProps\n} from 'react-grid-layout';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../../Flex';\nimport { useElement, useI18n } from '../../../hooks';\nimport { defaultThemeProp } from '../../../theme';\n\nimport useGridLayoutConfig, { type GridBreakPointWiseValues, type GridLayoutModel } from './config';\nimport EditorBackground from './EditorBackground';\nimport EditorGridItem, { ResizeHandle, resizeHandleClassName } from './EditorGridItem';\nimport {\n checkLayoutForGaps,\n getBreakpointAndCols,\n getRowHeight,\n useGridItemSorter,\n useMonitoredSize,\n type GridLayoutRowsProp\n} from './utils';\nimport ReactResizableStyles from './ReactResizableStyles';\nimport ReactGridLayoutStyles from './ReactGridLayoutStyles';\n\nconst StyledEditor = styled(Flex)(({ theme }) => {\n const {\n base: {\n palette: { interactive }\n }\n } = theme;\n return css`\n position: relative;\n\n /* Needed for the background grid to be visible */\n z-index: 0;\n block-size: 100%;\n overflow-y: auto;\n\n /* To minimize height triggers during dragging due to horizontal scrollbar showing up */\n overflow-x: hidden;\n\n .react-grid-item.react-grid-placeholder {\n background: ${interactive};\n opacity: 0.3;\n }\n `;\n});\nStyledEditor.defaultProps = defaultThemeProp;\n\nexport interface GridLayoutHandleValue {\n /** Used to get layout model with imperative handle. Returns the layout model from all breakpoints. Returns undefined when no children. */\n getLayoutModel: () => GridLayoutModel | undefined;\n\n /**\n * Returns a flag indicating whether there are any gaps in the current layout.\n * Highlights all background cells to indicate the same.\n */\n checkForGaps: () => boolean;\n}\n\n/** Props for GridLayoutEditor component */\nexport interface GridLayoutEditorProps {\n /**\n * Called whenever there's a change in the layoutModel.\n * Change-handler of the CONTROLLED COMPONENT\n */\n onModelChange: (newModel: GridLayoutModel | undefined) => void;\n\n /**\n * Value of the CONTROLLED component\n * Passed when editing a previously saved layout.\n * Can be `undefined` when no children.\n * It should be the same as the one emitted by `getLayoutModel` or `handle`\n */\n layoutModel: GridLayoutModel | undefined;\n\n /**\n * Breakpoints set on the Grid.\n * Needs to be aligned with `rows` and `cols`\n */\n breakpoints: GridBreakPointWiseValues;\n\n /**\n * # of rows to fit into the container height at each breakpoint (unless a fixed rowHeight is preferred)\n * rows should be aligned with `breakpoints` prop\n */\n rows: GridLayoutRowsProp;\n\n /**\n * Breakpoint-wise numColumns on the Grid.\n * cols should be aligned with `breakpoints` prop\n */\n cols: GridBreakPointWiseValues;\n\n /**\n * If parent DOM node of ResponsiveReactGridLayout or ReactGridLayout has \"transform: scale(n)\" css property,\n * we should set scale coefficient to avoid render artifacts while dragging.\n */\n transformScale?: CoreProps['transformScale'];\n\n /** Ref to access the editor state. Used to get the current layout-model when persisting it. */\n handle?: Ref<GridLayoutHandleValue>;\n\n /**\n * Child elements to be rendered as Grid items.\n * Each element should have a unique `key`\n * Memoize children for a better performance: https://github.com/react-grid-layout/react-grid-layout#performance\n * Set up an `itemLabel` prop with the text to call out when the item is focused.\n * If a child needs to be initialized with a specific x/y/w/h,\n * or if you want to specify any special properties like minW, minH, etc.,\n * set up a `data-grid` in layoutModel prop with any subset of properties\n * The prop can be undefined on init when no elements.\n */\n children?: ReactElement[];\n\n /** Item label mapped with item id for a11y */\n itemLabelMap: Record<string, string>;\n}\n\n/**\n * Editor component to create Grid Layouts\n * @component\n */\nconst GridLayoutEditor: FC<GridLayoutEditorProps> = ({\n handle,\n children,\n layoutModel,\n rows,\n onModelChange,\n itemLabelMap,\n ...restProps\n}) => {\n // Track width changes: https://github.com/react-grid-layout/react-grid-layout#providing-grid-width\n const [wrapperEl, setWrapperEl] = useElement<HTMLElement>();\n const size = useMonitoredSize(wrapperEl);\n const width = size?.width;\n const height = size?.height;\n const commonGridConfig = useGridLayoutConfig(true);\n const t = useI18n();\n const { breakpoint, numColumns } = useMemo(\n () => getBreakpointAndCols(width || 0, restProps.breakpoints, restProps.cols),\n [width, restProps.breakpoints, restProps.cols]\n );\n const { rowHeight, numRowsPerPage } = useMemo(\n () => getRowHeight(breakpoint, height || 0, commonGridConfig.margin[0], rows, layoutModel),\n [breakpoint, commonGridConfig.margin, height, rows, layoutModel]\n );\n const currentLayout = useMemo(() => layoutModel?.[breakpoint], [breakpoint, layoutModel]);\n\n const onLayoutChange = useCallback(\n (curLayout: Layout[], allLayouts: Layouts) => {\n onModelChange(!children || children.length === 0 ? undefined : allLayouts);\n },\n [children, onModelChange]\n );\n\n // Callback to sort child DOM nodes to ensure an intuitive tabbing order\n const gridItemSorter = useGridItemSorter(currentLayout, numColumns);\n\n // Set up keyboard accessibility\n const [listEl, setListEl] = useElement<HTMLElement>();\n useEffect(() => {\n if (listEl) {\n listEl.setAttribute('role', 'list');\n listEl.setAttribute('tabindex', '0');\n listEl.setAttribute('aria-label', t('configurable_layout_instructions'));\n }\n }, [listEl, t]);\n\n const moveItem = useCallback(\n (itemKey: ReactElement['key'], deltaX: number, deltaY: number) => {\n // Should be initialized by this point\n if (!currentLayout) return;\n const itemIndex = currentLayout.findIndex(item => item.i === itemKey);\n // Should be present on the currentLayout by this point.\n if (itemIndex === -1) return;\n\n const oldItem = currentLayout[itemIndex];\n const newItem: Layout = {\n ...oldItem,\n // `Math.max` needed to avoid a glitch when moving left beyond the left edge\n x: Math.max(0, oldItem.x + deltaX),\n y: Math.max(0, oldItem.y + deltaY)\n };\n const newLayout = [\n ...currentLayout.slice(0, itemIndex),\n newItem,\n ...currentLayout.slice(itemIndex + 1)\n ];\n const newModel = { ...layoutModel, [breakpoint]: newLayout };\n onModelChange(!children || children.length === 0 ? undefined : newModel);\n },\n [breakpoint, children, currentLayout, layoutModel, onModelChange]\n );\n\n const addOrSubtractItemSize = useCallback(\n (itemKey: ReactElement['key'], deltaW: number, deltaH: number) => {\n // Should be initialized by this point\n if (!currentLayout) return;\n const itemIndex = currentLayout.findIndex(item => item.i === itemKey);\n // Should be present on the currentLayout by this point.\n if (itemIndex === -1) return;\n\n const oldItem = currentLayout[itemIndex];\n const newItem: Layout = {\n ...oldItem,\n // `Math.max` needed to avoid a glitch when moving left beyond the left edge\n w: Math.max(oldItem.minW || 2, oldItem.w + deltaW),\n h: Math.max(oldItem.minH || 2, oldItem.h + deltaH)\n };\n const newLayout = [\n ...currentLayout.slice(0, itemIndex),\n newItem,\n ...currentLayout.slice(itemIndex + 1)\n ];\n const newModel = { ...layoutModel, [breakpoint]: newLayout };\n onModelChange(!children || children.length === 0 ? undefined : newModel);\n },\n [breakpoint, children, currentLayout, layoutModel, onModelChange]\n );\n\n // Provide a way for the parent component to get layout-model on demand\n const [highlightedBG, setHighlightedBG] = useState(false);\n useImperativeHandle(\n handle,\n () => ({\n getLayoutModel: () => {\n // Without this check, we'll end up with the dummy model set up down below for this case\n if (!children || children.length === 0) return undefined;\n return layoutModel;\n },\n\n checkForGaps: () => {\n // On load when no items are added.\n if (!currentLayout) return true;\n const hasGaps = checkLayoutForGaps(currentLayout, numColumns);\n setHighlightedBG(hasGaps);\n return hasGaps;\n }\n }),\n [children, layoutModel, currentLayout, numColumns]\n );\n\n return (\n // Editor is always in LTR. At runtime, the layout is mirrored depending on locale.\n <StyledEditor ref={setWrapperEl} dir='ltr'>\n <ReactResizableStyles />\n <ReactGridLayoutStyles />\n\n {!!width && !!height && (\n <>\n <EditorBackground\n data-testid='editor'\n layout={currentLayout}\n numColumns={numColumns}\n rowHeight={rowHeight}\n rowsPerPage={numRowsPerPage}\n highlighted={highlightedBG}\n />\n\n <ResponsiveGridLayout\n {...commonGridConfig}\n width={width}\n rowHeight={rowHeight}\n onLayoutChange={onLayoutChange}\n resizeHandles={['s', 'e', 'n', 'w', 'sw', 'nw', 'se', 'ne']}\n resizeHandle={<ResizeHandle />}\n // To prevent drag event on the resize handles\n draggableCancel={`.${resizeHandleClassName}`}\n innerRef={setListEl}\n layouts={layoutModel}\n {...restProps}\n >\n {children?.sort(gridItemSorter).map(child => {\n const gridLayoutModel = layoutModel?.[breakpoint]?.filter(\n layout => layout.i === child.key\n );\n return (\n <EditorGridItem\n key={child.key}\n itemKey={child.key}\n data-grid={gridLayoutModel && gridLayoutModel[0]}\n itemLabel={itemLabelMap[child.key!] || ''}\n moveItem={moveItem}\n addOrSubtractItemSize={addOrSubtractItemSize}\n >\n {child}\n </EditorGridItem>\n );\n })}\n\n {(!children || children.length === 0) && (\n // Placeholder when no children. Needed to avoid exceptions:\n // https://github.com/react-grid-layout/react-grid-layout/issues/216\n <div key='--' data-grid={{ x: 0, y: 0, w: 1, h: 1, resizeHandles: [] }} />\n )}\n </ResponsiveGridLayout>\n </>\n )}\n </StyledEditor>\n );\n};\n\nexport default GridLayoutEditor;\n"]}
@@ -33,6 +33,11 @@ export interface GridLayoutViewerProps {
33
33
  * By default, all items will have fixed heights derived from the `layoutModel` prop
34
34
  */
35
35
  autoSizeItemIDs?: string[];
36
+ /**
37
+ * Add container margin to viewer and runtime
38
+ * @default true
39
+ */
40
+ padContent?: boolean;
36
41
  }
37
42
  /**
38
43
  * Viewer component for a Grid created using GridLayoutEditor
@@ -1 +1 @@
1
- {"version":3,"file":"GridLayoutViewer.d.ts","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/GridLayoutViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAc,KAAK,YAAY,EAAqB,MAAM,OAAO,CAAC;AAOlF,OAAO,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE1E,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAwCjB,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,WAAW,EAAE,eAAe,GAAG,SAAS,CAAC;IAEzC;;;OAGG;IACH,WAAW,EAAE,wBAAwB,CAAC;IAEtC;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC;IAEzB;;;OAGG;IACH,IAAI,EAAE,wBAAwB,CAAC;IAE/B,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAE1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;GAGG;AACH,QAAA,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAiF/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"GridLayoutViewer.d.ts","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/GridLayoutViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAc,KAAK,YAAY,EAAqB,MAAM,OAAO,CAAC;AAOlF,OAAO,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE1E,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAwCjB,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,WAAW,EAAE,eAAe,GAAG,SAAS,CAAC;IAEzC;;;OAGG;IACH,WAAW,EAAE,wBAAwB,CAAC;IAEtC;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC;IAEzB;;;OAGG;IACH,IAAI,EAAE,wBAAwB,CAAC;IAE/B,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAE1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,QAAA,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAkF/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -33,13 +33,13 @@ const ViewerGridItem = forwardRef(({ children, autoSize, direction, ...restProps
33
33
  * Viewer component for a Grid created using GridLayoutEditor
34
34
  * @component
35
35
  */
36
- const GridLayoutViewer = ({ children, layoutModel: layoutModelProp, rows, cols, autoSizeItemIDs = [], breakpoints }) => {
36
+ const GridLayoutViewer = ({ children, layoutModel: layoutModelProp, rows, cols, autoSizeItemIDs = [], breakpoints, padContent = true }) => {
37
37
  // Track width changes: https://github.com/react-grid-layout/react-grid-layout#providing-grid-width
38
38
  const [wrapperEl, setWrapperEl] = useElement();
39
39
  const size = useMonitoredSize(wrapperEl);
40
40
  const width = size?.width;
41
41
  const height = size?.height;
42
- const commonGridConfig = useGridLayoutConfig();
42
+ const commonGridConfig = useGridLayoutConfig(padContent);
43
43
  const { breakpoint, numColumns } = useMemo(() => getBreakpointAndCols(width || 0, breakpoints, cols), [width, breakpoints, cols]);
44
44
  const { rowHeight } = useMemo(() => getRowHeight(breakpoint, height || 0, commonGridConfig.margin[0], rows, layoutModelProp), [breakpoint, commonGridConfig.margin, height, rows, layoutModelProp]);
45
45
  // On load, setting layoutModel based on the direction
@@ -1 +1 @@
1
- {"version":3,"file":"GridLayoutViewer.js","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/GridLayoutViewer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAW,UAAU,EAA+B,OAAO,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,mBAAmB,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AACjB,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAE5D,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAEjC,CAAC;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;gBACpB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,OAAO,OAAO;CAC/D,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAwB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9E,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,OAAO,GAAG,CAAA;;;;;;GAMT,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,cAAc,GAAG,UAAU,CAC/B,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAO,EAAE,GAAwB,EAAE,EAAE,C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AC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,YAC/E,KAAK,IADa,KAAK,CAAC,GAAG,CAEb,CAClB,CAAC;oBACJ,CAAC,CAAC,EAED,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI;oBACvC,4DAA4D;oBAC5D,oEAAoE;oBACpE,gBAAS,IAAI,CAAG,CACjB,IACoB,CACxB,EAED,KAAC,iBAAiB,KAAG,IACP,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { type FC, forwardRef, type ReactElement, type Ref, useMemo } from 'react';\nimport { Responsive as ResponsiveGridLayout } from 'react-grid-layout';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../../Flex';\nimport { useDirection, useElement } from '../../../hooks';\n\nimport type { GridBreakPointWiseValues, GridLayoutModel } from './config';\nimport useGridLayoutConfig from './config';\nimport {\n convertLtrToRtl,\n getBreakpointAndCols,\n getLastItemsInLayout,\n getRowHeight,\n useGridItemSorter,\n useMonitoredSize,\n type GridLayoutRowsProp\n} from './utils';\nimport ReactGridLayoutStyles from './ReactGridLayoutStyles';\n\nconst StyledWrapper = styled(Flex)`\n block-size: 100%;\n`;\n\nconst StyledEmptyFooter = styled.div`\n block-size: ${({ theme }) => `calc(${theme.base.spacing} * 2)`};\n`;\n\nconst StyledAutoSizeItem = styled(Flex)<{ autoSize: boolean }>(({ autoSize }) => {\n if (!autoSize) return '';\n return css`\n /* Overriding the inline style added by the RGL plugin. Needed to give the item a free height. */\n height: auto !important;\n\n /* Needed to maintain the extra gap at the bottom, since it's position absolute-ly */\n padding-bottom: 1rem;\n `;\n});\n\n/**\n * Wrapper on top of GridItems to forward ref, etc.\n * https://github.com/react-grid-layout/react-grid-layout#custom-child-components-and-draggable-handles\n */\nconst ViewerGridItem = forwardRef(\n ({ children, autoSize, direction, ...restProps }: any, ref: Ref<HTMLDivElement>) => (\n <StyledAutoSizeItem\n autoSize={autoSize}\n container={{ direction: 'column' }}\n ref={ref}\n {...restProps}\n dir={direction}\n >\n {children}\n </StyledAutoSizeItem>\n )\n);\n\n/** Props for the GridLayoutViewer component */\nexport interface GridLayoutViewerProps {\n /**\n * Layout-model saved previously from a GridLayoutEditor.\n * If undefined, the elements will be rendered in some default layout.\n * NOTE: A remount is needed if this layoutModel needs to be changed from the outside.\n * - The component reads it only once on load and populates layouts for missing breakpoints, assuming `lg` as the baseline\n */\n layoutModel: GridLayoutModel | undefined;\n\n /**\n * Breakpoints set on the Grid.\n * Needs to be aligned with `rows` and `cols`\n */\n breakpoints: GridBreakPointWiseValues;\n\n /**\n * # of rows to fit into the container height at each breakpoint (unless a fixed rowHeight is preferred)\n * rows should be aligned with `breakpoints` prop\n */\n rows: GridLayoutRowsProp;\n\n /**\n * Breakpoint-wise numColumns on the Grid.\n * cols should be aligned with `breakpoints` prop\n */\n cols: GridBreakPointWiseValues;\n\n /** Child elements to be rendered as Grid items. Each element should have a unique `key` */\n children?: ReactElement[];\n\n /**\n * List of items that needs to have free-flowing height.\n * NOTE: This works just for the items which don't have any other content underneath them.\n * By default, all items will have fixed heights derived from the `layoutModel` prop\n */\n autoSizeItemIDs?: string[];\n}\n\n/**\n * Viewer component for a Grid created using GridLayoutEditor\n * @component\n */\nconst GridLayoutViewer: FC<GridLayoutViewerProps> = ({\n children,\n layoutModel: layoutModelProp,\n rows,\n cols,\n autoSizeItemIDs = [],\n breakpoints\n}) => {\n // Track width changes: https://github.com/react-grid-layout/react-grid-layout#providing-grid-width\n const [wrapperEl, setWrapperEl] = useElement<HTMLElement>();\n const size = useMonitoredSize(wrapperEl);\n const width = size?.width;\n const height = size?.height;\n const commonGridConfig = useGridLayoutConfig();\n const { breakpoint, numColumns } = useMemo(\n () => getBreakpointAndCols(width || 0, breakpoints, cols),\n [width, breakpoints, cols]\n );\n const { rowHeight } = useMemo(\n () => getRowHeight(breakpoint, height || 0, commonGridConfig.margin[0], rows, layoutModelProp),\n [breakpoint, commonGridConfig.margin, height, rows, layoutModelProp]\n );\n\n // On load, setting layoutModel based on the direction\n const { rtl } = useDirection();\n const layoutModel = useMemo(() => {\n if (rtl && layoutModelProp) return convertLtrToRtl(layoutModelProp, cols);\n return layoutModelProp;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Callback to sort child DOM nodes to ensure an intuitive tabbing order\n const gridItemSorter = useGridItemSorter(layoutModelProp?.[breakpoint], numColumns);\n\n // Get list of last items in layout\n const lastItemsInLayout = useMemo(\n () => getLastItemsInLayout(layoutModel?.[breakpoint]),\n [breakpoint, layoutModel]\n );\n\n return (\n // Enforcing ltr here due to limitations of the RGL plugin.\n // The layout is mirrored using convertLtrToRtl above,\n // and then the direction is explicitly passed to items below.\n <StyledWrapper ref={setWrapperEl} dir='ltr'>\n <ReactGridLayoutStyles />\n\n {!!width && !!height && (\n <ResponsiveGridLayout\n {...commonGridConfig}\n width={width}\n rowHeight={Math.max(rowHeight, 50)}\n layouts={layoutModel}\n isResizable={false}\n isDraggable={false}\n isDroppable={false}\n cols={cols}\n breakpoints={breakpoints}\n >\n {children?.sort(gridItemSorter).map(child => {\n const autoSize =\n autoSizeItemIDs.includes(child.key!) && lastItemsInLayout.includes(child.key!);\n\n return (\n <ViewerGridItem key={child.key} autoSize={autoSize} direction={rtl ? 'rtl' : 'ltr'}>\n {child}\n </ViewerGridItem>\n );\n })}\n\n {(!children || children.length === 0) && (\n // Placeholder when no children. Needed to avoid exceptions:\n // https://github.com/react-grid-layout/react-grid-layout/issues/216\n <div key='--' />\n )}\n </ResponsiveGridLayout>\n )}\n {/** Removed container padding, hence adding extra space at bottom of grid */}\n <StyledEmptyFooter />\n </StyledWrapper>\n );\n};\n\nexport default GridLayoutViewer;\n"]}
1
+ {"version":3,"file":"GridLayoutViewer.js","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/GridLayoutViewer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAW,UAAU,EAA+B,OAAO,EAA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,KAAK,CAAC,CAAC,IAAI;oBACvC,4DAA4D;oBAC5D,oEAAoE;oBACpE,gBAAS,IAAI,CAAG,CACjB,IACoB,CACxB,EAED,KAAC,iBAAiB,KAAG,IACP,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { type FC, forwardRef, type ReactElement, type Ref, useMemo } from 'react';\nimport { Responsive as ResponsiveGridLayout } from 'react-grid-layout';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../../Flex';\nimport { useDirection, useElement } from '../../../hooks';\n\nimport type { GridBreakPointWiseValues, GridLayoutModel } from './config';\nimport useGridLayoutConfig from './config';\nimport {\n convertLtrToRtl,\n getBreakpointAndCols,\n getLastItemsInLayout,\n getRowHeight,\n useGridItemSorter,\n useMonitoredSize,\n type GridLayoutRowsProp\n} from './utils';\nimport ReactGridLayoutStyles from './ReactGridLayoutStyles';\n\nconst StyledWrapper = styled(Flex)`\n block-size: 100%;\n`;\n\nconst StyledEmptyFooter = styled.div`\n block-size: ${({ theme }) => `calc(${theme.base.spacing} * 2)`};\n`;\n\nconst StyledAutoSizeItem = styled(Flex)<{ autoSize: boolean }>(({ autoSize }) => {\n if (!autoSize) return '';\n return css`\n /* Overriding the inline style added by the RGL plugin. Needed to give the item a free height. */\n height: auto !important;\n\n /* Needed to maintain the extra gap at the bottom, since it's position absolute-ly */\n padding-bottom: 1rem;\n `;\n});\n\n/**\n * Wrapper on top of GridItems to forward ref, etc.\n * https://github.com/react-grid-layout/react-grid-layout#custom-child-components-and-draggable-handles\n */\nconst ViewerGridItem = forwardRef(\n ({ children, autoSize, direction, ...restProps }: any, ref: Ref<HTMLDivElement>) => (\n <StyledAutoSizeItem\n autoSize={autoSize}\n container={{ direction: 'column' }}\n ref={ref}\n {...restProps}\n dir={direction}\n >\n {children}\n </StyledAutoSizeItem>\n )\n);\n\n/** Props for the GridLayoutViewer component */\nexport interface GridLayoutViewerProps {\n /**\n * Layout-model saved previously from a GridLayoutEditor.\n * If undefined, the elements will be rendered in some default layout.\n * NOTE: A remount is needed if this layoutModel needs to be changed from the outside.\n * - The component reads it only once on load and populates layouts for missing breakpoints, assuming `lg` as the baseline\n */\n layoutModel: GridLayoutModel | undefined;\n\n /**\n * Breakpoints set on the Grid.\n * Needs to be aligned with `rows` and `cols`\n */\n breakpoints: GridBreakPointWiseValues;\n\n /**\n * # of rows to fit into the container height at each breakpoint (unless a fixed rowHeight is preferred)\n * rows should be aligned with `breakpoints` prop\n */\n rows: GridLayoutRowsProp;\n\n /**\n * Breakpoint-wise numColumns on the Grid.\n * cols should be aligned with `breakpoints` prop\n */\n cols: GridBreakPointWiseValues;\n\n /** Child elements to be rendered as Grid items. Each element should have a unique `key` */\n children?: ReactElement[];\n\n /**\n * List of items that needs to have free-flowing height.\n * NOTE: This works just for the items which don't have any other content underneath them.\n * By default, all items will have fixed heights derived from the `layoutModel` prop\n */\n autoSizeItemIDs?: string[];\n\n /**\n * Add container margin to viewer and runtime\n * @default true\n */\n padContent?: boolean;\n}\n\n/**\n * Viewer component for a Grid created using GridLayoutEditor\n * @component\n */\nconst GridLayoutViewer: FC<GridLayoutViewerProps> = ({\n children,\n layoutModel: layoutModelProp,\n rows,\n cols,\n autoSizeItemIDs = [],\n breakpoints,\n padContent = true\n}) => {\n // Track width changes: https://github.com/react-grid-layout/react-grid-layout#providing-grid-width\n const [wrapperEl, setWrapperEl] = useElement<HTMLElement>();\n const size = useMonitoredSize(wrapperEl);\n const width = size?.width;\n const height = size?.height;\n const commonGridConfig = useGridLayoutConfig(padContent);\n const { breakpoint, numColumns } = useMemo(\n () => getBreakpointAndCols(width || 0, breakpoints, cols),\n [width, breakpoints, cols]\n );\n const { rowHeight } = useMemo(\n () => getRowHeight(breakpoint, height || 0, commonGridConfig.margin[0], rows, layoutModelProp),\n [breakpoint, commonGridConfig.margin, height, rows, layoutModelProp]\n );\n\n // On load, setting layoutModel based on the direction\n const { rtl } = useDirection();\n const layoutModel = useMemo(() => {\n if (rtl && layoutModelProp) return convertLtrToRtl(layoutModelProp, cols);\n return layoutModelProp;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Callback to sort child DOM nodes to ensure an intuitive tabbing order\n const gridItemSorter = useGridItemSorter(layoutModelProp?.[breakpoint], numColumns);\n\n // Get list of last items in layout\n const lastItemsInLayout = useMemo(\n () => getLastItemsInLayout(layoutModel?.[breakpoint]),\n [breakpoint, layoutModel]\n );\n\n return (\n // Enforcing ltr here due to limitations of the RGL plugin.\n // The layout is mirrored using convertLtrToRtl above,\n // and then the direction is explicitly passed to items below.\n <StyledWrapper ref={setWrapperEl} dir='ltr'>\n <ReactGridLayoutStyles />\n\n {!!width && !!height && (\n <ResponsiveGridLayout\n {...commonGridConfig}\n width={width}\n rowHeight={Math.max(rowHeight, 50)}\n layouts={layoutModel}\n isResizable={false}\n isDraggable={false}\n isDroppable={false}\n cols={cols}\n breakpoints={breakpoints}\n >\n {children?.sort(gridItemSorter).map(child => {\n const autoSize =\n autoSizeItemIDs.includes(child.key!) && lastItemsInLayout.includes(child.key!);\n\n return (\n <ViewerGridItem key={child.key} autoSize={autoSize} direction={rtl ? 'rtl' : 'ltr'}>\n {child}\n </ViewerGridItem>\n );\n })}\n\n {(!children || children.length === 0) && (\n // Placeholder when no children. Needed to avoid exceptions:\n // https://github.com/react-grid-layout/react-grid-layout/issues/216\n <div key='--' />\n )}\n </ResponsiveGridLayout>\n )}\n {/** Removed container padding, hence adding extra space at bottom of grid */}\n <StyledEmptyFooter />\n </StyledWrapper>\n );\n};\n\nexport default GridLayoutViewer;\n"]}
@@ -10,7 +10,7 @@ export type GridBreakPointWiseValues = Partial<Record<GridBreakPoint, number>>;
10
10
  * These properties need to stay consistent between the design-time and run-time layouts.
11
11
  * @returns Default RGL props for the GridLayout editor/viewer
12
12
  */
13
- export default function useGridLayoutConfig(): {
13
+ export default function useGridLayoutConfig(padContent: boolean): {
14
14
  margin: [number, number];
15
15
  containerPadding: [number, number];
16
16
  compactType: "vertical";
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD,uDAAuD;AACvD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAE/D,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAExE,8DAA8D;AAC9D,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB;YAiBf,CAAC,MAAM,EAAE,MAAM,CAAC;sBACR,CAAC,MAAM,EAAE,MAAM,CAAC;;EAInD"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD,uDAAuD;AACvD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAE/D,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAExE,8DAA8D;AAC9D,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,UAAU,EAAE,OAAO;YAiBnC,CAAC,MAAM,EAAE,MAAM,CAAC;sBACS,CAAC,MAAM,EAAE,MAAM,CAAC;;EAIpE"}
@@ -6,7 +6,7 @@ import { useTheme } from '../../../hooks';
6
6
  * These properties need to stay consistent between the design-time and run-time layouts.
7
7
  * @returns Default RGL props for the GridLayout editor/viewer
8
8
  */
9
- export default function useGridLayoutConfig() {
9
+ export default function useGridLayoutConfig(padContent) {
10
10
  const theme = useTheme();
11
11
  return useMemo(() => {
12
12
  // Determine Gap around different grid cells (px)
@@ -24,9 +24,9 @@ export default function useGridLayoutConfig() {
24
24
  }
25
25
  return {
26
26
  margin: [gap, gap],
27
- containerPadding: [gap, 0],
27
+ containerPadding: [padContent ? gap : 0, 0],
28
28
  compactType: 'vertical'
29
29
  };
30
- }, [theme]);
30
+ }, [theme, padContent]);
31
31
  }
32
32
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAW1C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB;IACzC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,iDAAiD;QACjD,IAAI,GAAW,CAAC;QAChB,IAAI,CAAC;YACH,uDAAuD;YACvD,8CAA8C;YAC9C,qEAAqE;YACrE,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,GAAG,GAAG,EAAE,CAAC;QACX,CAAC;QAED,OAAO;YACL,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAqB;YACtC,gBAAgB,EAAE,CAAC,GAAG,EAAE,CAAC,CAAqB;YAC9C,WAAW,EAAE,UAAmB;SACjC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useMemo } from 'react';\nimport type { Layout } from 'react-grid-layout';\n\nimport { useTheme } from '../../../hooks';\n\n/** A breakpoint on the responsive GridLayout editor */\nexport type GridBreakPoint = 'lg' | 'md' | 'sm' | 'xs' | 'xxs';\n\n/** The persisted layout model could contain any subset of breakpoints */\nexport type GridLayoutModel = Partial<Record<GridBreakPoint, Layout[]>>;\n\n/** Numeric configuration per each breakpoint in GridLayout */\nexport type GridBreakPointWiseValues = Partial<Record<GridBreakPoint, number>>;\n\n/**\n * Config common to GridLayoutEditor and GridLayoutViewer.\n * These properties need to stay consistent between the design-time and run-time layouts.\n * @returns Default RGL props for the GridLayout editor/viewer\n */\nexport default function useGridLayoutConfig() {\n const theme = useTheme();\n return useMemo(() => {\n // Determine Gap around different grid cells (px)\n let gap: number;\n try {\n // Just for safety in case the value is not in rem etc.\n // `polished` throws errors in those scenarios\n // Shouldn't normally needed since Cosmos values are always in `rem`s\n gap = 2 * Number(stripUnit(remToPx(theme.base.spacing)));\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(e);\n gap = 16;\n }\n\n return {\n margin: [gap, gap] as [number, number],\n containerPadding: [gap, 0] as [number, number],\n compactType: 'vertical' as const\n };\n }, [theme]);\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/components/PageTemplates/GridLayout/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAW1C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,UAAmB;IAC7D,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,iDAAiD;QACjD,IAAI,GAAW,CAAC;QAChB,IAAI,CAAC;YACH,uDAAuD;YACvD,8CAA8C;YAC9C,qEAAqE;YACrE,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,GAAG,GAAG,EAAE,CAAC;QACX,CAAC;QAED,OAAO;YACL,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAqB;YACtC,gBAAgB,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAqB;YAC/D,WAAW,EAAE,UAAmB;SACjC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useMemo } from 'react';\nimport type { Layout } from 'react-grid-layout';\n\nimport { useTheme } from '../../../hooks';\n\n/** A breakpoint on the responsive GridLayout editor */\nexport type GridBreakPoint = 'lg' | 'md' | 'sm' | 'xs' | 'xxs';\n\n/** The persisted layout model could contain any subset of breakpoints */\nexport type GridLayoutModel = Partial<Record<GridBreakPoint, Layout[]>>;\n\n/** Numeric configuration per each breakpoint in GridLayout */\nexport type GridBreakPointWiseValues = Partial<Record<GridBreakPoint, number>>;\n\n/**\n * Config common to GridLayoutEditor and GridLayoutViewer.\n * These properties need to stay consistent between the design-time and run-time layouts.\n * @returns Default RGL props for the GridLayout editor/viewer\n */\nexport default function useGridLayoutConfig(padContent: boolean) {\n const theme = useTheme();\n return useMemo(() => {\n // Determine Gap around different grid cells (px)\n let gap: number;\n try {\n // Just for safety in case the value is not in rem etc.\n // `polished` throws errors in those scenarios\n // Shouldn't normally needed since Cosmos values are always in `rem`s\n gap = 2 * Number(stripUnit(remToPx(theme.base.spacing)));\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(e);\n gap = 16;\n }\n\n return {\n margin: [gap, gap] as [number, number],\n containerPadding: [padContent ? gap : 0, 0] as [number, number],\n compactType: 'vertical' as const\n };\n }, [theme, padContent]);\n}\n"]}
@@ -2,6 +2,7 @@ export { default as useAbortController } from './useAbortController';
2
2
  export { default as useActiveDescendant, useLazyDescendant } from './useActiveDescendant';
3
3
  export type { UseActiveDescendantConfig } from './useActiveDescendant';
4
4
  export { default as useAfterInitialEffect } from './useAfterInitialEffect';
5
+ export { default as useAnimatedText } from './useAnimatedText';
5
6
  export { default as useArrows } from './useArrows';
6
7
  export { default as useAutoResize } from './useAutoResize';
7
8
  export { default as useBreakpoint } from './useBreakpoint';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC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AO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export { default as useAbortController } from './useAbortController';
2
2
  export { default as useActiveDescendant, useLazyDescendant } from './useActiveDescendant';
3
3
  export { default as useAfterInitialEffect } from './useAfterInitialEffect';
4
+ export { default as useAnimatedText } from './useAnimatedText';
4
5
  export { default as useArrows } from './useArrows';
5
6
  export { default as useAutoResize } from './useAutoResize';
6
7
  export { default as useBreakpoint } from './useBreakpoint';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM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Ac,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { default as useAbortController } from './useAbortController';\nexport { default as useActiveDescendant, useLazyDescendant } from './useActiveDescendant';\nexport type { UseActiveDescendantConfig } from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useChToPxConversionFactor } from './useChToPxConversionFactor';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useEscape } from './useEscape';\nexport { default as useEvent } from './useEvent';\nexport { default as useFocusTrap } from './useFocusTrap';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useInputFormatter } from './useInputFormatter';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLiveLog } from './useLiveLog';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useModalContext } from './useModalContext';\nexport { default as useModalManager } from './useModalManager';\nexport { default as useOS } from './useOS';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as usePopoverMap } from './usePopoverMap';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useRefMap } from './useRefMap';\nexport { default as useSimpleStore, createSimpleStore } from './useSimpleStore';\nexport type { SimpleStore } from './useSimpleStore';\nexport { default as useSimpleStoreInstance } from './useSimpleStoreInstance';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useScrollToggle } from './useScrollToggle';\nexport { default as useShortcut } from './useShortcut';\nexport { default as useShortcutManager } from './useShortcutManager';\nexport { default as useTestIds } from './useTestIds';\nexport { default as useTheme } from './useTheme';\nexport { default as useToaster } from './useToaster';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useElementFocus } from './useElementFocus';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,M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E,MAAM,UAAU,CAAC","sourcesContent":["export { default as useAbortController } from './useAbortController';\nexport { default as useActiveDescendant, useLazyDescendant } from './useActiveDescendant';\nexport type { UseActiveDescendantConfig } from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useAnimatedText } from './useAnimatedText';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useChToPxConversionFactor } from './useChToPxConversionFactor';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useEscape } from './useEscape';\nexport { default as useEvent } from './useEvent';\nexport { default as useFocusTrap } from './useFocusTrap';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useInputFormatter } from './useInputFormatter';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLiveLog } from './useLiveLog';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useModalContext } from './useModalContext';\nexport { default as useModalManager } from './useModalManager';\nexport { default as useOS } from './useOS';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as usePopoverMap } from './usePopoverMap';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useRefMap } from './useRefMap';\nexport { default as useSimpleStore, createSimpleStore } from './useSimpleStore';\nexport type { SimpleStore } from './useSimpleStore';\nexport { default as useSimpleStoreInstance } from './useSimpleStoreInstance';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useScrollToggle } from './useScrollToggle';\nexport { default as useShortcut } from './useShortcut';\nexport { default as useShortcutManager } from './useShortcutManager';\nexport { default as useTestIds } from './useTestIds';\nexport { default as useTheme } from './useTheme';\nexport { default as useToaster } from './useToaster';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useElementFocus } from './useElementFocus';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\n"]}
@@ -0,0 +1,11 @@
1
+ declare const useAnimatedText: ({ text, allContentReceived, enabled, tokenizeMarkdown }: {
2
+ text: string;
3
+ allContentReceived: boolean;
4
+ enabled?: boolean;
5
+ tokenizeMarkdown?: boolean;
6
+ }) => {
7
+ text: string;
8
+ isAnimationDone: boolean;
9
+ };
10
+ export default useAnimatedText;
11
+ //# sourceMappingURL=useAnimatedText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedText.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnimatedText.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,eAAe,GAAI,yDAKtB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;;;CA8GA,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,93 @@
1
+ import { useEffect, useState, useRef } from 'react';
2
+ import tokenizeWithMarkdown from '../utils/markdownTokenizer';
3
+ const useAnimatedText = ({ text, allContentReceived = false, enabled = true, tokenizeMarkdown = false }) => {
4
+ const [cursor, setCursor] = useState(0); // End pointer
5
+ const [startingCursor, setStartingCursor] = useState(0); // animation starting point
6
+ const [prevText, setPrevText] = useState(text);
7
+ const [isAnimationDone, setIsAnimationDone] = useState(false);
8
+ const allContentReceivedRef = useRef(allContentReceived);
9
+ allContentReceivedRef.current = allContentReceived;
10
+ // Tokenize text based on markdown flag
11
+ const getTokens = (inputText) => {
12
+ if (tokenizeMarkdown) {
13
+ return tokenizeWithMarkdown(inputText);
14
+ }
15
+ return inputText.split('');
16
+ };
17
+ // A new chunk has arrived
18
+ if (prevText !== text) {
19
+ setPrevText(text);
20
+ setStartingCursor(text.startsWith(prevText) ? cursor : 0);
21
+ setIsAnimationDone(false);
22
+ }
23
+ useEffect(() => {
24
+ // If streaming is disabled just return the whole chunk back
25
+ if (!enabled) {
26
+ setCursor(getTokens(text).length);
27
+ setIsAnimationDone(true);
28
+ return;
29
+ }
30
+ const tokens = getTokens(text);
31
+ const targetLength = tokens.length;
32
+ const charactersToAnimate = targetLength - startingCursor;
33
+ // If there are no more characters, return
34
+ if (charactersToAnimate <= 0) {
35
+ setCursor(targetLength);
36
+ setIsAnimationDone(true);
37
+ return;
38
+ }
39
+ let intervalId;
40
+ let startTime;
41
+ let isStopped = false;
42
+ let currentSpeed = 50; // Start with normal speed
43
+ let lastCursor = startingCursor;
44
+ const processTextAnimation = () => {
45
+ if (isStopped)
46
+ return;
47
+ const currentTime = performance.now();
48
+ if (!startTime) {
49
+ startTime = currentTime;
50
+ }
51
+ // When we have all content with us, speed up streaming animation
52
+ const targetSpeed = allContentReceivedRef.current ? 150 : 50;
53
+ // Smoothly transition to target speed
54
+ const speedDiff = targetSpeed - currentSpeed;
55
+ currentSpeed += speedDiff * 0.1; // Smooth transition
56
+ const elapsed = currentTime - startTime;
57
+ const timeStep = elapsed / 1000;
58
+ // Calculate how many characters we should have shown by now
59
+ const expectedCursor = Math.min(startingCursor + timeStep * currentSpeed, targetLength);
60
+ const newCursor = Math.min(Math.floor(expectedCursor), targetLength);
61
+ // Skip update if the cursor is at the same token
62
+ if (newCursor !== lastCursor) {
63
+ setCursor(newCursor);
64
+ lastCursor = newCursor;
65
+ }
66
+ // End condition - stop when we reach the target
67
+ if (newCursor >= targetLength && allContentReceivedRef.current) {
68
+ setIsAnimationDone(true);
69
+ return;
70
+ }
71
+ // Continue animation if not done
72
+ if (newCursor < targetLength || !allContentReceivedRef.current) {
73
+ // Use adaptive timing based on content state and visibility
74
+ const interval = allContentReceivedRef.current ? 20 : 50; // Faster when complete
75
+ intervalId = setTimeout(processTextAnimation, interval);
76
+ }
77
+ };
78
+ // Start the animation with initial delay
79
+ intervalId = setTimeout(processTextAnimation, 16);
80
+ return () => {
81
+ isStopped = true;
82
+ if (intervalId) {
83
+ clearTimeout(intervalId);
84
+ }
85
+ };
86
+ }, [startingCursor, text, tokenizeMarkdown]);
87
+ return {
88
+ text: getTokens(text).slice(0, cursor).join(''),
89
+ isAnimationDone
90
+ };
91
+ };
92
+ export default useAnimatedText;
93
+ //# sourceMappingURL=useAnimatedText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedText.js","sourceRoot":"","sources":["../../src/hooks/useAnimatedText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAE9D,MAAM,eAAe,GAAG,CAAC,EACvB,IAAI,EACJ,kBAAkB,GAAG,KAAK,EAC1B,OAAO,GAAG,IAAI,EACd,gBAAgB,GAAG,KAAK,EAMzB,EAAE,EAAE;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc;IACvD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,2BAA2B;IAEpF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,qBAAqB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAEzD,qBAAqB,CAAC,OAAO,GAAG,kBAAkB,CAAC;IAEnD,uCAAuC;IACvC,MAAM,SAAS,GAAG,CAAC,SAAiB,EAAY,EAAE;QAChD,IAAI,gBAAgB,EAAE,CAAC;YACrB,OAAO,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,SAAS,CAAC,KAAK,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EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,UAAU,EAAE,CAAC;gBACf,YAAY,CAAC,UAAU,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE7C,OAAO;QACL,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,eAAe;KAChB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useEffect, useState, useRef } from 'react';\n\nimport tokenizeWithMarkdown from '../utils/markdownTokenizer';\n\nconst useAnimatedText = ({\n text,\n allContentReceived = false,\n enabled = true,\n tokenizeMarkdown = false\n}: {\n text: string;\n allContentReceived: boolean;\n enabled?: boolean;\n tokenizeMarkdown?: boolean;\n}) => {\n const [cursor, setCursor] = useState(0); // End pointer\n const [startingCursor, setStartingCursor] = useState(0); // animation starting point\n\n const [prevText, setPrevText] = useState(text);\n const [isAnimationDone, setIsAnimationDone] = useState(false);\n\n const allContentReceivedRef = useRef(allContentReceived);\n\n allContentReceivedRef.current = allContentReceived;\n\n // Tokenize text based on markdown flag\n const getTokens = (inputText: string): string[] => {\n if (tokenizeMarkdown) {\n return tokenizeWithMarkdown(inputText);\n }\n return inputText.split('');\n };\n\n // A new chunk has arrived\n if (prevText !== text) {\n setPrevText(text);\n setStartingCursor(text.startsWith(prevText) ? cursor : 0);\n setIsAnimationDone(false);\n }\n\n useEffect(() => {\n // If streaming is disabled just return the whole chunk back\n if (!enabled) {\n setCursor(getTokens(text).length);\n setIsAnimationDone(true);\n return;\n }\n\n const tokens = getTokens(text);\n const targetLength = tokens.length;\n const charactersToAnimate = targetLength - startingCursor;\n\n // If there are no more characters, return\n if (charactersToAnimate <= 0) {\n setCursor(targetLength);\n setIsAnimationDone(true);\n return;\n }\n\n let intervalId: ReturnType<typeof setTimeout>;\n let startTime: number;\n let isStopped = false;\n let currentSpeed = 50; // Start with normal speed\n let lastCursor = startingCursor;\n\n const processTextAnimation = () => {\n if (isStopped) return;\n\n const currentTime = performance.now();\n\n if (!startTime) {\n startTime = currentTime;\n }\n\n // When we have all content with us, speed up streaming animation\n const targetSpeed = allContentReceivedRef.current ? 150 : 50;\n\n // Smoothly transition to target speed\n const speedDiff = targetSpeed - currentSpeed;\n currentSpeed += speedDiff * 0.1; // Smooth transition\n\n const elapsed = currentTime - startTime;\n const timeStep = elapsed / 1000;\n\n // Calculate how many characters we should have shown by now\n const expectedCursor = Math.min(startingCursor + timeStep * currentSpeed, targetLength);\n\n const newCursor = Math.min(Math.floor(expectedCursor), targetLength);\n\n // Skip update if the cursor is at the same token\n if (newCursor !== lastCursor) {\n setCursor(newCursor);\n lastCursor = newCursor;\n }\n\n // End condition - stop when we reach the target\n if (newCursor >= targetLength && allContentReceivedRef.current) {\n setIsAnimationDone(true);\n return;\n }\n\n // Continue animation if not done\n if (newCursor < targetLength || !allContentReceivedRef.current) {\n // Use adaptive timing based on content state and visibility\n const interval = allContentReceivedRef.current ? 20 : 50; // Faster when complete\n intervalId = setTimeout(processTextAnimation, interval);\n }\n };\n\n // Start the animation with initial delay\n intervalId = setTimeout(processTextAnimation, 16);\n\n return () => {\n isStopped = true;\n if (intervalId) {\n clearTimeout(intervalId);\n }\n };\n }, [startingCursor, text, tokenizeMarkdown]);\n\n return {\n text: getTokens(text).slice(0, cursor).join(''),\n isAnimationDone\n };\n};\n\nexport default useAnimatedText;\n"]}
@@ -62,6 +62,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
62
62
  duration: string;
63
63
  tokens: string;
64
64
  keyboard_instructions: string;
65
+ today: string;
65
66
  remove: string;
66
67
  follow: string;
67
68
  unfollow: string;
@@ -396,7 +397,11 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
396
397
  start_chat: string;
397
398
  starter_message: string;
398
399
  ask_coach: string;
400
+ thinking: string;
401
+ analyzing_data_sources: string;
399
402
  generating_response: string;
403
+ double_checking_results: string;
404
+ finalizing_response: string;
400
405
  response_generated: string;
401
406
  good_response: string;
402
407
  bad_response: string;
@@ -1461,6 +1466,29 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
1461
1466
  hide_icons_additional_info_first_sentence: string;
1462
1467
  hide_icons_additional_info_second_sentence: string;
1463
1468
  wcag: string;
1469
+ this_year: string;
1470
+ this_quarter: string;
1471
+ this_month: string;
1472
+ this_week: string;
1473
+ this_day: string;
1474
+ this_hour: string;
1475
+ this_minute: string;
1476
+ this_second: string;
1477
+ over_time_period: string;
1478
+ since_time_period: string;
1479
+ in_current_time_period: string;
1480
+ increased_by_value_over_time_period: string;
1481
+ increased_by_value_since_time_period: string;
1482
+ increased_by_value_in_current_time_period: string;
1483
+ increased_by_value_today: string;
1484
+ decreased_by_value_over_time_period: string;
1485
+ decreased_by_value_since_time_period: string;
1486
+ decreased_by_value_in_current_time_period: string;
1487
+ decreased_by_value_today: string;
1488
+ no_change_over_time_period: string;
1489
+ no_change_since_time_period: string;
1490
+ no_change_in_current_time_period: string;
1491
+ no_change_today: string;
1464
1492
  add_to: string;
1465
1493
  namespace: string;
1466
1494
  decision_rule: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -58,6 +58,7 @@ declare const _default: {
58
58
  duration: string;
59
59
  tokens: string;
60
60
  keyboard_instructions: string;
61
+ today: string;
61
62
  remove: string;
62
63
  follow: string;
63
64
  unfollow: string;
@@ -392,7 +393,11 @@ declare const _default: {
392
393
  start_chat: string;
393
394
  starter_message: string;
394
395
  ask_coach: string;
396
+ thinking: string;
397
+ analyzing_data_sources: string;
395
398
  generating_response: string;
399
+ double_checking_results: string;
400
+ finalizing_response: string;
396
401
  response_generated: string;
397
402
  good_response: string;
398
403
  bad_response: string;
@@ -1460,6 +1465,29 @@ declare const _default: {
1460
1465
  hide_icons_additional_info_first_sentence: string;
1461
1466
  hide_icons_additional_info_second_sentence: string;
1462
1467
  wcag: string;
1468
+ this_year: string;
1469
+ this_quarter: string;
1470
+ this_month: string;
1471
+ this_week: string;
1472
+ this_day: string;
1473
+ this_hour: string;
1474
+ this_minute: string;
1475
+ this_second: string;
1476
+ over_time_period: string;
1477
+ since_time_period: string;
1478
+ in_current_time_period: string;
1479
+ increased_by_value_over_time_period: string;
1480
+ increased_by_value_since_time_period: string;
1481
+ increased_by_value_in_current_time_period: string;
1482
+ increased_by_value_today: string;
1483
+ decreased_by_value_over_time_period: string;
1484
+ decreased_by_value_since_time_period: string;
1485
+ decreased_by_value_in_current_time_period: string;
1486
+ decreased_by_value_today: string;
1487
+ no_change_over_time_period: string;
1488
+ no_change_since_time_period: string;
1489
+ no_change_in_current_time_period: string;
1490
+ no_change_today: string;
1463
1491
  add_to: string;
1464
1492
  namespace: string;
1465
1493
  decision_rule: string;
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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