@digital-ai/dot-components 4.7.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -175,7 +175,7 @@ const readOnlyStyles = theme => css`
175
175
  }
176
176
  `;
177
177
 
178
- const rootClassName$1l = 'dot-text-field';
178
+ const rootClassName$1m = 'dot-text-field';
179
179
  const rootSelectClassName = 'dot-select-field';
180
180
  const wrapperClassName$2 = 'dot-label-wrapper';
181
181
  const labelClassName = 'dot-input-label';
@@ -228,7 +228,7 @@ const StyledTextField = styled(TextField)`
228
228
  $maxRows,
229
229
  $minRows
230
230
  }) => css`
231
- &.${rootClassName$1l} {
231
+ &.${rootClassName$1m} {
232
232
  .MuiInputBase-root {
233
233
  margin-bottom: 0;
234
234
 
@@ -312,7 +312,7 @@ const StyledTextField = styled(TextField)`
312
312
  margin-right: ${theme.spacing(2)};
313
313
  }
314
314
 
315
- &.${rootSelectClassName}, &.${rootClassName$1l} {
315
+ &.${rootSelectClassName}, &.${rootClassName$1m} {
316
316
  .${adornmentIconClassName} {
317
317
  color: ${theme.palette.figma.icon.black};
318
318
  p {
@@ -402,12 +402,12 @@ const StyledTextField = styled(TextField)`
402
402
  `}
403
403
  `;
404
404
 
405
- const rootClassName$1k = 'dot-icon';
405
+ const rootClassName$1l = 'dot-icon';
406
406
  const StyledIcon = styled(Icon)`
407
407
  ${({
408
408
  theme
409
409
  }) => css`
410
- &.${rootClassName$1k} {
410
+ &.${rootClassName$1l} {
411
411
  color: ${theme.palette.figma.icon.black};
412
412
  font-size: 20px;
413
413
 
@@ -448,7 +448,7 @@ const DotIcon = ({
448
448
  iconId,
449
449
  tooltip
450
450
  }) => {
451
- const rootClasses = useStylesWithRootClass(rootClassName$1k, className);
451
+ const rootClasses = useStylesWithRootClass(rootClassName$1l, className);
452
452
  return jsx(DotTooltip, {
453
453
  title: tooltip,
454
454
  children: jsx(StyledIcon, {
@@ -509,7 +509,7 @@ const DotTypography = ({
509
509
  });
510
510
  };
511
511
 
512
- const rootClassName$1j = 'dot-accordion';
512
+ const rootClassName$1k = 'dot-accordion';
513
513
  const summaryClassName = 'dot-accordion-summary';
514
514
  const detailClassName = 'dot-accordion-details';
515
515
  const StyledAccordion = styled(Accordion)`
@@ -520,7 +520,7 @@ const StyledAccordion = styled(Accordion)`
520
520
  background: ${theme.palette.figma.background.level1.white};
521
521
  }
522
522
 
523
- &.${rootClassName$1j} .${summaryClassName} {
523
+ &.${rootClassName$1k} .${summaryClassName} {
524
524
  align-items: center;
525
525
  background: ${theme.palette.figma.background.level1.white};
526
526
  color: ${theme.palette.figma.typography.black};
@@ -565,7 +565,7 @@ const DotAccordion = ({
565
565
  ariaLabel,
566
566
  children,
567
567
  className,
568
- 'data-pendoid': dataPendoId = rootClassName$1j,
568
+ 'data-pendoid': dataPendoId = rootClassName$1k,
569
569
  'data-testid': dataTestId = 'dot-accordion',
570
570
  disabled = false,
571
571
  expanded,
@@ -576,7 +576,7 @@ const DotAccordion = ({
576
576
  summary,
577
577
  noWrap = true
578
578
  }) => {
579
- const rootClasses = useStylesWithRootClass(rootClassName$1j, className);
579
+ const rootClasses = useStylesWithRootClass(rootClassName$1k, className);
580
580
  const [elevation, setElevation] = useState();
581
581
  useEffect(() => {
582
582
  if (onChange && expanded === undefined) {
@@ -627,15 +627,15 @@ const DotAccordion = ({
627
627
  });
628
628
  };
629
629
 
630
- const rootClassName$1i = 'dot-action-toolbar';
630
+ const rootClassName$1j = 'dot-action-toolbar';
631
631
  const StyledToolbar = styled(Toolbar)`
632
632
  ${({
633
633
  theme
634
634
  }) => css`
635
- &.${rootClassName$1i} {
635
+ &.${rootClassName$1j} {
636
636
  border-bottom: 1px solid ${theme.palette.figma.border.default};
637
637
 
638
- .${rootClassName$1l} .MuiInputBase-root {
638
+ .${rootClassName$1m} .MuiInputBase-root {
639
639
  margin-bottom: 0;
640
640
  }
641
641
  }
@@ -649,7 +649,7 @@ const DotActionToolbar = ({
649
649
  'data-testid': dataTestId,
650
650
  variant = 'dense'
651
651
  }) => {
652
- const rootClasses = useStylesWithRootClass(rootClassName$1i, className);
652
+ const rootClasses = useStylesWithRootClass(rootClassName$1j, className);
653
653
  return jsx(StyledToolbar, {
654
654
  "aria-label": ariaLabel,
655
655
  className: rootClasses,
@@ -1719,12 +1719,12 @@ const renderNodeOrTypography = (content, typographyVariant = 'body1') => {
1719
1719
  const checkIfArrowUpPressed = event => event.key === 'ArrowUp';
1720
1720
  const checkIfArrowDownPressed = event => event.key === 'ArrowDown';
1721
1721
 
1722
- const rootClassName$1h = 'dot-alert-banner';
1722
+ const rootClassName$1i = 'dot-alert-banner';
1723
1723
  const StyledAlertBanner = styled(Alert)`
1724
1724
  ${({
1725
1725
  theme
1726
1726
  }) => css`
1727
- &.${rootClassName$1h} {
1727
+ &.${rootClassName$1i} {
1728
1728
  align-items: center;
1729
1729
  box-sizing: border-box;
1730
1730
  min-height: 48px;
@@ -1759,7 +1759,7 @@ const DotAlertBanner = ({
1759
1759
  ariaLabel,
1760
1760
  children,
1761
1761
  className,
1762
- 'data-pendoid': dataPendoId = rootClassName$1h,
1762
+ 'data-pendoid': dataPendoId = rootClassName$1i,
1763
1763
  'data-testid': dataTestId,
1764
1764
  onClose,
1765
1765
  roundedCorners = true,
@@ -1767,7 +1767,7 @@ const DotAlertBanner = ({
1767
1767
  textVariant = 'body1',
1768
1768
  width
1769
1769
  }) => {
1770
- const rootClasses = useStylesWithRootClass(rootClassName$1h, severity, className);
1770
+ const rootClasses = useStylesWithRootClass(rootClassName$1i, severity, className);
1771
1771
  /* For simple string use default component, for everything else use 'div' */
1772
1772
  const typographyComponent = isString$2(children) ? undefined : 'div';
1773
1773
  return jsx(StyledAlertBanner, {
@@ -1810,6 +1810,53 @@ const DotAppLogo = ({
1810
1810
  });
1811
1811
  };
1812
1812
 
1813
+ const rootClassName$1h = 'dot-annotation';
1814
+ const StyledAnnotation = styled.kbd`
1815
+ ${({
1816
+ theme
1817
+ }) => css`
1818
+ &.${rootClassName$1h} {
1819
+ font-family: inherit;
1820
+ background-color: ${theme.palette.figma.background.level0.bckgGray};
1821
+ color: ${theme.palette.figma.typography.disabled};
1822
+ padding: ${theme.spacing(0.5)};
1823
+ margin: ${theme.spacing(0, 0.5)};
1824
+ display: inline-flex;
1825
+ justify-content: center;
1826
+ font-weight: bold;
1827
+ border-radius: ${theme.spacing(0.5)};
1828
+ min-width: 18px;
1829
+
1830
+ .dot-icon {
1831
+ color: inherit;
1832
+ }
1833
+
1834
+ &.secondary {
1835
+ background-color: ${theme.palette.figma.typography.disabled};
1836
+ color: ${theme.palette.figma.typography.white};
1837
+ }
1838
+ }
1839
+ `}
1840
+ `;
1841
+
1842
+ const DotAnnotation = ({
1843
+ ariaLabel,
1844
+ 'data-pendoid': dataPendoId = rootClassName$1h,
1845
+ 'data-testid': dataTestId,
1846
+ className,
1847
+ content,
1848
+ type = 'primary'
1849
+ }) => {
1850
+ const rootClasses = useStylesWithRootClass(rootClassName$1h, className, type === 'secondary' ? 'secondary' : '');
1851
+ return jsx(StyledAnnotation, {
1852
+ "aria-label": ariaLabel,
1853
+ className: rootClasses,
1854
+ "data-pendoid": dataPendoId,
1855
+ "data-testid": dataTestId,
1856
+ children: content
1857
+ });
1858
+ };
1859
+
1813
1860
  /******************************************************************************
1814
1861
  Copyright (c) Microsoft Corporation.
1815
1862
 
@@ -4571,7 +4618,7 @@ const DotInputText = ({
4571
4618
  autoFocus,
4572
4619
  className,
4573
4620
  defaultValue,
4574
- 'data-pendoid': dataPendoId = rootClassName$1l,
4621
+ 'data-pendoid': dataPendoId = rootClassName$1m,
4575
4622
  'data-testid': dataTestId,
4576
4623
  disabled = false,
4577
4624
  error = false,
@@ -4619,7 +4666,7 @@ const DotInputText = ({
4619
4666
  const internalInputRef = useRef(null);
4620
4667
  const textFieldInputRef = inputRef || internalInputRef;
4621
4668
  const [inputTextState, setInputTextState] = useState(getInitialState(value));
4622
- const rootStyles = useStylesWithRootClass(rootClassName$1l, hasError, hasWarning, hasSuccess, readOnly && readOnlyClassName$1);
4669
+ const rootStyles = useStylesWithRootClass(rootClassName$1m, hasError, hasWarning, hasSuccess, readOnly && readOnlyClassName$1);
4623
4670
  useEffect(() => {
4624
4671
  if (value !== inputTextState.inputValue) {
4625
4672
  setInputTextState(getInitialState(value, defaultValue));
@@ -6671,7 +6718,7 @@ const isEmptyValue = value => {
6671
6718
  }
6672
6719
  };
6673
6720
  const getRootClassNames = (className, size) => useStylesWithRootClass(rootClassName$X, size === 'medium' && inputMediumClassName, className);
6674
- const getTextFieldRootClassNames = (textFieldWarningClassName, isReadOnly) => useStylesWithRootClass(rootClassName$1l, isReadOnly && readOnlyClassName$1, textFieldWarningClassName);
6721
+ const getTextFieldRootClassNames = (textFieldWarningClassName, isReadOnly) => useStylesWithRootClass(rootClassName$1m, isReadOnly && readOnlyClassName$1, textFieldWarningClassName);
6675
6722
  const getInputRootClassNames = isDense => useStylesWithRootClass(inputRootClassName, !isDense && inputMediumClassName);
6676
6723
  const getDefaultAutoCompleteValue = (hasMultiple, defaultValue) => hasMultiple && isString$2(defaultValue) ? [defaultValue] : defaultValue;
6677
6724
  const getAutoCompleteGroupBy = group => group ? option => option.group : undefined;
@@ -8665,10 +8712,10 @@ const CssGrid = _a => {
8665
8712
  };
8666
8713
  }, [lastElement]);
8667
8714
  // Adds the lastElement ref to the last Element of the grid
8668
- const gridItemsWithLastElement = useMemo(() => [...gridItems.slice(0, -1), jsx("div", {
8715
+ const gridItemsWithLastElement = useMemo(() => loadMoreData ? [...gridItems.slice(0, -1), jsx("div", {
8669
8716
  ref: setLastElement,
8670
8717
  children: gridItems[gridItems.length - 1]
8671
- }, "last-grid-item")], [gridItems]);
8718
+ }, "last-grid-item")] : gridItems, [gridItems]);
8672
8719
  return jsx(StyledGrid, Object.assign({}, gridArgs, {
8673
8720
  isLoading: isLoading,
8674
8721
  children: gridItemsWithLastElement
@@ -10391,7 +10438,7 @@ const StyledSnackbar = styled(Snackbar)`
10391
10438
  .MuiAlert-message {
10392
10439
  word-break: break-word;
10393
10440
  }
10394
- .${rootClassName$1h} {
10441
+ .${rootClassName$1i} {
10395
10442
  align-items: flex-start;
10396
10443
  }
10397
10444
  &.MuiSnackbar-anchorOriginTopLeft,
@@ -12791,6 +12838,12 @@ function DotDashboardHeader({
12791
12838
  }
12792
12839
 
12793
12840
  const rootClassName$C = 'dot-empty-state';
12841
+ const emptyStateImageSizing = {
12842
+ xsmall: 9,
12843
+ dense: 15,
12844
+ normal: 31,
12845
+ large: 49
12846
+ };
12794
12847
  const StyledEmptyState = styled.div`
12795
12848
  ${({
12796
12849
  theme
@@ -12806,8 +12859,10 @@ const StyledEmptyState = styled.div`
12806
12859
  }
12807
12860
 
12808
12861
  .empty-state-image {
12862
+ display: inline-flex;
12863
+ justify-content: center;
12809
12864
  min-height: ${theme.spacing(10)};
12810
- margin-bottom: ${theme.spacing(5)};
12865
+ margin-bottom: ${theme.spacing(3)};
12811
12866
  }
12812
12867
 
12813
12868
  h2 {
@@ -12821,6 +12876,34 @@ const StyledEmptyState = styled.div`
12821
12876
  .dot-button {
12822
12877
  margin-top: ${theme.spacing(4)};
12823
12878
  }
12879
+
12880
+ &.xsmall {
12881
+ .empty-state-image {
12882
+ height: ${theme.spacing(emptyStateImageSizing.xsmall)};
12883
+ width: ${theme.spacing(emptyStateImageSizing.xsmall)};
12884
+ }
12885
+ }
12886
+
12887
+ &.dense {
12888
+ .empty-state-image {
12889
+ height: ${theme.spacing(emptyStateImageSizing.dense)};
12890
+ width: ${theme.spacing(emptyStateImageSizing.dense)};
12891
+ }
12892
+ }
12893
+
12894
+ &.normal {
12895
+ .empty-state-image {
12896
+ height: ${theme.spacing(emptyStateImageSizing.normal)};
12897
+ width: ${theme.spacing(emptyStateImageSizing.normal)};
12898
+ }
12899
+ }
12900
+
12901
+ &.large {
12902
+ .empty-state-image {
12903
+ height: ${theme.spacing(emptyStateImageSizing.large)};
12904
+ width: ${theme.spacing(emptyStateImageSizing.large)};
12905
+ }
12906
+ }
12824
12907
  }
12825
12908
  `}
12826
12909
  `;
@@ -12875,13 +12958,14 @@ const DotEmptyState = ({
12875
12958
  illustrationId,
12876
12959
  imageAltText,
12877
12960
  imageSrc,
12961
+ size = 'normal',
12878
12962
  subtitle,
12879
12963
  title
12880
12964
  }) => {
12881
12965
  const rootClasses = useStylesWithRootClass(rootClassName$C, className);
12882
12966
  return jsxs(StyledEmptyState, {
12883
12967
  "aria-label": ariaLabel,
12884
- className: rootClasses,
12968
+ className: `${rootClasses} ${size}`,
12885
12969
  "data-testid": dataTestId,
12886
12970
  children: [jsxs("div", {
12887
12971
  className: "empty-state-image-container",
@@ -13121,7 +13205,7 @@ const StyledFormContainer = styled.div`
13121
13205
 
13122
13206
  .${rootClassName$N},
13123
13207
  .${rootClassName$P},
13124
- .${rootClassName$1l},
13208
+ .${rootClassName$1m},
13125
13209
  .${rootSelectClassName},
13126
13210
  .${rootClassName$A},
13127
13211
  .${rootClassName$z} {
@@ -13129,7 +13213,7 @@ const StyledFormContainer = styled.div`
13129
13213
  }
13130
13214
 
13131
13215
  .${wrapperClassName$2} {
13132
- + .${rootClassName$1l},
13216
+ + .${rootClassName$1m},
13133
13217
  .${wrapperClassName$2}
13134
13218
  + .${rootSelectClassName},
13135
13219
  .${wrapperClassName$2}
@@ -14362,6 +14446,17 @@ const StyledInlineEdit = styled.div`
14362
14446
  }
14363
14447
  `}
14364
14448
  `;
14449
+ const StyledInlineViewMode = styled.div`
14450
+ ${({
14451
+ theme,
14452
+ maxRows,
14453
+ typography
14454
+ }) => css`
14455
+ white-space: pre-wrap;
14456
+ max-height: ${theme.typography[typography].lineHeight.substring(0, theme.typography[typography].lineHeight.length - 2) * (maxRows + 1)}px;
14457
+ overflow: auto;
14458
+ `}
14459
+ `;
14365
14460
 
14366
14461
  const getCounterAdornment = (currentLength, maxLength, dataTestId) => {
14367
14462
  if (currentLength === undefined || typeof currentLength !== 'number' || !maxLength || typeof maxLength !== 'number') return;
@@ -14436,6 +14531,9 @@ const DotInlineEdit = ({
14436
14531
  name,
14437
14532
  onChange,
14438
14533
  onEditStateChange,
14534
+ maxRows = 4,
14535
+ minRows = 2,
14536
+ multiline = false,
14439
14537
  placeholder,
14440
14538
  readOnly,
14441
14539
  selectTextOnEdit,
@@ -14510,7 +14608,11 @@ const DotInlineEdit = ({
14510
14608
  handleInlineEditClick();
14511
14609
  return;
14512
14610
  }
14513
- // Save only when Enter is pressed within input field
14611
+ // Allow new line when Ctrl is pressed in multiline mode
14612
+ if (multiline && event.shiftKey) {
14613
+ return;
14614
+ }
14615
+ // Save only when shift is pressed within input field
14514
14616
  if (inputRef.current !== event.target) return;
14515
14617
  yield handleSave();
14516
14618
  break;
@@ -14540,7 +14642,9 @@ const DotInlineEdit = ({
14540
14642
  const bindingsValue = bindings ? applyBindings(bindings, inputValue) : null;
14541
14643
  const typographyClasses = useStylesWithRootClass('dot-view-mode-typography', !inputValue && placeholderClassName);
14542
14644
  const viewModeClasses = useStylesWithRootClass(viewModeClassName, readOnly && readOnlyClassName);
14543
- const viewModeChildren = jsxs(Fragment, {
14645
+ const viewModeChildren = jsxs(StyledInlineViewMode, {
14646
+ maxRows: maxRows,
14647
+ typography: typography,
14544
14648
  children: [jsx(DotTypography, {
14545
14649
  className: typographyClasses,
14546
14650
  "data-testid": dataTestId && `${dataTestId}-view-mode-typography`,
@@ -14585,10 +14689,13 @@ const DotInlineEdit = ({
14585
14689
  maxLength: charactersLimit === null || charactersLimit === void 0 ? void 0 : charactersLimit.maxLength
14586
14690
  },
14587
14691
  inputRef: inputRef,
14588
- multiline: false,
14692
+ multiline: multiline,
14693
+ maxRows: multiline ? maxRows : undefined,
14694
+ minRows: multiline ? minRows : undefined,
14589
14695
  name: name,
14590
14696
  onChange: event => setInputValue(event.target.value),
14591
14697
  onFocus: selectTextOnEdit ? event => event.target.select() : undefined,
14698
+ placeholder: placeholder,
14592
14699
  size: "small",
14593
14700
  type: "text",
14594
14701
  value: inputValue,
@@ -15750,6 +15857,36 @@ const StyledPaper = styled(Paper)`
15750
15857
  display: none;
15751
15858
  }
15752
15859
  }
15860
+
15861
+ &.with-multiselect-over-table-header {
15862
+ position: relative;
15863
+
15864
+ .dot-table-multiselect-header {
15865
+ position: absolute;
15866
+ width: 100%;
15867
+
15868
+ .dot-table-selection-toolbar {
15869
+ padding: ${theme.spacing(0, 1)};
15870
+ min-height: unset;
15871
+ height: 56px;
15872
+ }
15873
+ }
15874
+
15875
+ .dot-thead {
15876
+ // hide table header row when multiselect toolbar is shown over it
15877
+ visibility: hidden;
15878
+ }
15879
+
15880
+ &.hidden-multiselect {
15881
+ .dot-table-multiselect-header {
15882
+ display: none;
15883
+ }
15884
+
15885
+ .dot-thead {
15886
+ visibility: unset;
15887
+ }
15888
+ }
15889
+ }
15753
15890
  }
15754
15891
  `}
15755
15892
  `;
@@ -15955,6 +16092,9 @@ const parseCellMaxWidth = width => {
15955
16092
  // if contains 'px' or 'vw' then pass as is
15956
16093
  return width;
15957
16094
  };
16095
+ const checkIsMultiselectOverTableHeaderRow = (multiSelect, hasToolbar) => {
16096
+ return !hasToolbar && !!(multiSelect === null || multiSelect === void 0 ? void 0 : multiSelect.showOverTableHeaderRow);
16097
+ };
15958
16098
 
15959
16099
  const rootClassName$k = 'dot-td';
15960
16100
  const StyledTableCell = styled(TableCell)`
@@ -16156,46 +16296,75 @@ const TABLE_TYPOGRAPHY_VARIANT = 'body1';
16156
16296
  const TABLE_DEFAULT_SKELETON_ROWS = 4;
16157
16297
 
16158
16298
  const rootClassName$i = 'dot-th-checkbox';
16159
- const StyledTableHeaderCheckboxCell = styled(TableCell)`
16160
- ${({
16161
- theme
16162
- }) => css`
16163
- &.${rootClassName$i} {
16164
- background: ${theme.palette.figma.background.level0.componentsBackground};
16165
- padding: ${theme.spacing(0, 1)};
16166
- width: ${theme.spacing(5)};
16299
+ const styledTableHeaderCheckboxElement = (isCell = true) => {
16300
+ return styled(isCell ? TableCell : 'div')`
16301
+ ${({
16302
+ theme
16303
+ }) => css`
16304
+ &.${rootClassName$i} {
16305
+ background: ${theme.palette.figma.background.level0.componentsBackground};
16306
+ padding: ${theme.spacing(0, 1)};
16307
+ width: ${theme.spacing(5)};
16167
16308
 
16168
- .dot-form-control-label {
16169
- margin: 0;
16309
+ &.table-selection-toolbar-checkbox {
16310
+ background: unset;
16311
+ padding: ${theme.spacing(0, 3, 0, 0)};
16312
+ width: ${theme.spacing(4.5)};
16313
+ }
16314
+
16315
+ .dot-form-control-label {
16316
+ margin: 0;
16317
+ }
16170
16318
  }
16171
- }
16172
- `}
16173
- `;
16319
+ `}
16320
+ `;
16321
+ };
16322
+ const StyledTableHeaderCheckboxCell = styledTableHeaderCheckboxElement();
16323
+ const StyledTableHeaderCheckbox = styledTableHeaderCheckboxElement(false);
16174
16324
 
16175
16325
  const DotHeaderCheckboxCell = ({
16176
16326
  ariaLabel,
16177
16327
  className,
16178
16328
  'data-testid': dataTestId,
16179
- multiSelectState,
16180
- onCheckAllChange
16329
+ isFromTableSelectionToolbar,
16330
+ multiSelectHeader
16181
16331
  }) => {
16182
- const rootClasses = useStylesWithRootClass(rootClassName$i, className);
16183
- const [checkboxState, setCheckboxState] = useState('unchecked');
16332
+ const rootClasses = useStylesWithRootClass(rootClassName$i, className, isFromTableSelectionToolbar ? 'table-selection-toolbar-checkbox' : '');
16333
+ const [multiSelectState, setMultiSelectState] = useState('unchecked');
16334
+ const {
16335
+ onCheckAllChange,
16336
+ pageData,
16337
+ selectedTableRowIds
16338
+ } = multiSelectHeader || {};
16184
16339
  useEffect(() => {
16185
- setCheckboxState(multiSelectState);
16186
- }, [multiSelectState]);
16340
+ if (!multiSelectHeader) return;
16341
+ if (selectedTableRowIds && selectedTableRowIds.length > 0 && pageData) {
16342
+ const itemsNumber = pageData.length;
16343
+ const checkedItemsNumber = pageData.filter(row => selectedTableRowIds.includes(row.id)).length;
16344
+ if (itemsNumber === checkedItemsNumber) {
16345
+ setMultiSelectState('checked');
16346
+ return;
16347
+ }
16348
+ if (checkedItemsNumber > 0) {
16349
+ setMultiSelectState('indeterminate');
16350
+ return;
16351
+ }
16352
+ }
16353
+ setMultiSelectState('unchecked');
16354
+ }, [multiSelectHeader]);
16187
16355
  const getNextCheckboxState = currentCheckboxState => {
16188
- if (currentCheckboxState === 'indeterminate' || currentCheckboxState === 'checked') return 'unchecked';
16356
+ if (currentCheckboxState === 'indeterminate' && !isFromTableSelectionToolbar || currentCheckboxState === 'checked') return 'unchecked';
16189
16357
  return 'checked';
16190
16358
  };
16191
- const isIndeterminate = checkboxState === 'indeterminate';
16192
- const isCheckboxChecked = checkboxState === 'checked';
16359
+ const isIndeterminate = multiSelectState === 'indeterminate';
16360
+ const isCheckboxChecked = multiSelectState === 'checked';
16193
16361
  const handleChange = () => {
16194
- const nextState = getNextCheckboxState(checkboxState);
16195
- setCheckboxState(nextState);
16362
+ const nextState = getNextCheckboxState(multiSelectState);
16363
+ setMultiSelectState(nextState);
16196
16364
  onCheckAllChange(nextState === 'checked', []);
16197
16365
  };
16198
- return jsx(StyledTableHeaderCheckboxCell, {
16366
+ const StyledTableHeaderCheckboxElement = isFromTableSelectionToolbar ? StyledTableHeaderCheckbox : StyledTableHeaderCheckboxCell;
16367
+ return jsx(StyledTableHeaderCheckboxElement, {
16199
16368
  align: "left",
16200
16369
  className: rootClasses,
16201
16370
  "data-testid": dataTestId,
@@ -16300,33 +16469,10 @@ const DotHeaderRow = ({
16300
16469
  const createSortHandler = property => _event => {
16301
16470
  onRequestSort(property);
16302
16471
  };
16303
- const [multiSelectState, setMultiSelectState] = useState('unchecked');
16304
- const {
16305
- onCheckAllChange,
16306
- pageData,
16307
- selectedTableRowIds
16308
- } = multiSelectHeader || {};
16309
- useEffect(() => {
16310
- if (!multiSelectHeader) return;
16311
- if (selectedTableRowIds && selectedTableRowIds.length > 0 && pageData) {
16312
- const itemsNumber = pageData.length;
16313
- const checkedItemsNumber = pageData.filter(row => selectedTableRowIds.includes(row.id)).length;
16314
- if (itemsNumber === checkedItemsNumber) {
16315
- setMultiSelectState('checked');
16316
- return;
16317
- }
16318
- if (checkedItemsNumber > 0) {
16319
- setMultiSelectState('indeterminate');
16320
- return;
16321
- }
16322
- }
16323
- setMultiSelectState('unchecked');
16324
- }, [multiSelectHeader]);
16325
16472
  const renderMultiSelectCell = () => {
16326
16473
  return jsx(DotHeaderCheckboxCell, {
16327
16474
  ariaLabel: "Click to select all table page rows",
16328
- multiSelectState: multiSelectState,
16329
- onCheckAllChange: onCheckAllChange
16475
+ multiSelectHeader: multiSelectHeader
16330
16476
  });
16331
16477
  };
16332
16478
  return jsx(TableHead, {
@@ -16780,10 +16926,6 @@ const StyledTableSelectionToolbar = styled(DotActionToolbar)`
16780
16926
  .dot-link {
16781
16927
  color: ${theme.palette.figma.overlay.table.text};
16782
16928
  padding: ${theme.spacing(0.25, 0.25, 0, 0.5)};
16783
-
16784
- &:hover {
16785
- color: ${theme.palette.figma.typography.white};
16786
- }
16787
16929
  }
16788
16930
  }
16789
16931
 
@@ -16815,6 +16957,7 @@ const DotTableSelectionToolbar = ({
16815
16957
  className,
16816
16958
  'data-testid': dataTestId,
16817
16959
  onClearAll,
16960
+ multiSelectHeader,
16818
16961
  selectedRowsNumber
16819
16962
  }) => {
16820
16963
  const rootClasses = useStylesWithRootClass(rootClassName$f, className);
@@ -16825,7 +16968,11 @@ const DotTableSelectionToolbar = ({
16825
16968
  variant: "regular",
16826
16969
  children: [jsxs("div", {
16827
16970
  className: "dot-selected-rows-container",
16828
- children: [jsxs(DotTypography, {
16971
+ children: [multiSelectHeader && jsx(DotHeaderCheckboxCell, {
16972
+ ariaLabel: "Click to select all table page rows",
16973
+ isFromTableSelectionToolbar: true,
16974
+ multiSelectHeader: multiSelectHeader
16975
+ }), jsxs(DotTypography, {
16829
16976
  className: "dot-selected-rows-heading",
16830
16977
  variant: "h3",
16831
16978
  children: [selectedRowsNumber, " selected"]
@@ -16907,11 +17054,13 @@ const DotTable = ({
16907
17054
  const [tableRowsPerPage, setRowsPerPage] = useState(rowsPerPage);
16908
17055
  const [selectedRowIds, setSelectedRowIds] = useState([]);
16909
17056
  const [expandedRowIds, setExpandedRowIds] = useState([]);
17057
+ const selectedRowsNumber = selectedRowIds.length;
17058
+ const showMultiselectOverTableHeaderRow = checkIsMultiselectOverTableHeaderRow(multiSelect, !!toolbar);
16910
17059
  const getSortedData = () => {
16911
17060
  return onUpdateData ? data : stableSort(data, getComparator(order, orderBy));
16912
17061
  };
16913
17062
  const [pageData, setPageData] = useState(getSortedData().slice(0, rowsPerPage ? rowsPerPage : data.length));
16914
- const rootClasses = useStylesWithRootClass(rootClassName$m, className, loading ? 'loading' : '');
17063
+ const rootClasses = useStylesWithRootClass(rootClassName$m, className, loading ? 'loading' : '', showMultiselectOverTableHeaderRow ? 'with-multiselect-over-table-header' : '', showMultiselectOverTableHeaderRow && !selectedRowsNumber ? 'hidden-multiselect' : '');
16915
17064
  const updateData = (newOrder, newOrderBy, newPage, newRowsPerPage) => {
16916
17065
  const newData = stableSort(data, getComparator(newOrder, newOrderBy));
16917
17066
  setPageData(newRowsPerPage ? newData.slice(newPage * newRowsPerPage, newPage * newRowsPerPage + newRowsPerPage) : newData);
@@ -17005,7 +17154,6 @@ const DotTable = ({
17005
17154
  pageData: onUpdateData ? data : pageData,
17006
17155
  selectedTableRowIds: selectedRowIds
17007
17156
  };
17008
- const selectedRowsNumber = selectedRowIds.length;
17009
17157
  const handleRowExpandCollapseTable = (isExpanded, rowId, setLoading) => {
17010
17158
  setExpandedRowIds(prevRowIds => {
17011
17159
  const newIds = getExpandedRowIds(prevRowIds, rowId, isExpanded);
@@ -17019,21 +17167,28 @@ const DotTable = ({
17019
17167
  onRowExpandCollapseTable: handleRowExpandCollapseTable,
17020
17168
  expandedTableRowIds: expandedRowIds
17021
17169
  });
17022
- const renderToolbar = () => {
17170
+ const renderTableSelectionToolbar = () => {
17023
17171
  const {
17024
17172
  bulkActions
17025
17173
  } = multiSelect || {};
17026
- return multiSelect && selectedRowsNumber ? jsx(DotTableSelectionToolbar, {
17174
+ return jsx(DotTableSelectionToolbar, {
17027
17175
  ariaLabel: "Selected table rows with bulk actions",
17028
17176
  onClearAll: (multiSelect === null || multiSelect === void 0 ? void 0 : multiSelect.onClearAllChange) && handleClearAll,
17177
+ multiSelectHeader: showMultiselectOverTableHeaderRow ? multiSelectHeader : undefined,
17029
17178
  selectedRowsNumber: selectedRowsNumber,
17030
17179
  bulkActions: bulkActions
17031
- }) : toolbar;
17180
+ });
17181
+ };
17182
+ const renderToolbar = () => {
17183
+ return multiSelect && selectedRowsNumber ? renderTableSelectionToolbar() : toolbar;
17032
17184
  };
17033
17185
  return jsxs(StyledPaper, {
17034
17186
  className: rootClasses,
17035
17187
  elevation: 0,
17036
- children: [renderToolbar(), jsx(StyledTableContainer, {
17188
+ children: [showMultiselectOverTableHeaderRow ? jsx("div", {
17189
+ className: "dot-table-multiselect-header",
17190
+ children: renderTableSelectionToolbar()
17191
+ }) : renderToolbar(), jsx(StyledTableContainer, {
17037
17192
  className: "dot-table-container",
17038
17193
  "data-testid": dataTestId,
17039
17194
  style: {
@@ -19406,4 +19561,4 @@ const BoardColumnSummary = ({
19406
19561
  });
19407
19562
  };
19408
19563
 
19409
- export { ApiError$1 as ApiError, BoardStatusProvider, Cell, ColumnStatusProvider, CreateUUID, CssCell, CssGrid, CssGridDebug, DashboardAppTypeOptions, DashboardView, DatePickerKeydownContext, Daytime, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppSwitcher, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotAvatarWithDetails, DotBadge, Board as DotBoard, BoardColumn as DotBoardColumn, BoardColumnActionBar as DotBoardColumnActionBar, BoardColumnCollapse as DotBoardColumnCollapse, BoardColumnExpand as DotBoardColumnExpand, BoardColumnHeader as DotBoardColumnHeader, BoardColumnItems as DotBoardColumnItems, BoardColumnSummary as DotBoardColumnSummary, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCarousel, DotCheckbox, DotCheckboxGroup, DotChip, DotChipList, DotClickAwayListener, DotConfirmationDialog, DotCopyButton, DotCoreApiProvider, DotDashboardActions, DotDashboardDetails, DotDashboardDialog, DotDashboardHeader, DotDashboardOptionsMenu, DotDashboardPublishConfirm, DotDashboardStatusPill, DotDatePicker, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyFilterState, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotIllustration, DotImpactDialog, DotInlineEdit, DotInputLabel, DotInputSelect, DotInputText, DotLinearProgress, DotLink, DotList, DotMenu, DotMetadataApiProvider, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotStepper, DotStickyWithBorder, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTimePicker, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, breakpointOptions, checkIfValidDate, darkFigmaColors, lightThemeColors as lightColors, lightFigmaColors, mockScrollIntoView, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useBoardStatus, useColumnStatus, useDotCoreApiContext, useDotMetadataApiContext, useDotSnackbarContext, useEnqueueErrorMessage, useKeyPress };
19564
+ export { ApiError$1 as ApiError, BoardStatusProvider, Cell, ColumnStatusProvider, CreateUUID, CssCell, CssGrid, CssGridDebug, DashboardAppTypeOptions, DashboardView, DatePickerKeydownContext, Daytime, DotAccordion, DotActionToolbar, DotAlertBanner, DotAnnotation, DotAppLogo, DotAppSwitcher, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotAvatarWithDetails, DotBadge, Board as DotBoard, BoardColumn as DotBoardColumn, BoardColumnActionBar as DotBoardColumnActionBar, BoardColumnCollapse as DotBoardColumnCollapse, BoardColumnExpand as DotBoardColumnExpand, BoardColumnHeader as DotBoardColumnHeader, BoardColumnItems as DotBoardColumnItems, BoardColumnSummary as DotBoardColumnSummary, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCarousel, DotCheckbox, DotCheckboxGroup, DotChip, DotChipList, DotClickAwayListener, DotConfirmationDialog, DotCopyButton, DotCoreApiProvider, DotDashboardActions, DotDashboardDetails, DotDashboardDialog, DotDashboardHeader, DotDashboardOptionsMenu, DotDashboardPublishConfirm, DotDashboardStatusPill, DotDatePicker, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyFilterState, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotIllustration, DotImpactDialog, DotInlineEdit, DotInputLabel, DotInputSelect, DotInputText, DotLinearProgress, DotLink, DotList, DotMenu, DotMetadataApiProvider, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotStepper, DotStickyWithBorder, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTimePicker, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, breakpointOptions, checkIfValidDate, darkFigmaColors, lightThemeColors as lightColors, lightFigmaColors, mockScrollIntoView, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useBoardStatus, useColumnStatus, useDotCoreApiContext, useDotMetadataApiContext, useDotSnackbarContext, useEnqueueErrorMessage, useKeyPress };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "4.7.0",
3
+ "version": "4.9.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { CommonProps } from '../CommonProps';
3
+ export type AnnotationType = 'primary' | 'secondary';
4
+ export interface AnnotationProps extends CommonProps {
5
+ /** The content shown in the annotation (e.g. text, icon). The annotation is meant to be used inside text, mainly to highlight the keyboard shortcuts. */
6
+ content: ReactNode;
7
+ /** The type of the annotation. Can be `primary` (default) or `secondary` (styled for using in the tooltip). */
8
+ type?: AnnotationType;
9
+ }
10
+ export declare const DotAnnotation: ({ ariaLabel, "data-pendoid": dataPendoId, "data-testid": dataTestId, className, content, type, }: AnnotationProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare const rootClassName = "dot-annotation";
2
+ export declare const StyledAnnotation: import("styled-components").StyledComponent<"kbd", any, {}, never>;
@@ -1,5 +1,6 @@
1
1
  import { ButtonProps } from '../button';
2
2
  import { CommonProps } from '../CommonProps';
3
+ export type EmptyStateSize = 'xsmall' | 'dense' | 'normal' | 'large';
3
4
  export interface EmptyStateProps extends CommonProps {
4
5
  /** primary button properties */
5
6
  buttonProps?: ButtonProps;
@@ -9,9 +10,11 @@ export interface EmptyStateProps extends CommonProps {
9
10
  imageAltText?: string;
10
11
  /** location of image */
11
12
  imageSrc?: string;
13
+ /** sizing of the empty state (illustration, img) */
14
+ size?: EmptyStateSize;
12
15
  /** subtitle text displayed */
13
16
  subtitle?: string;
14
17
  /** title text displayed */
15
18
  title: string;
16
19
  }
17
- export declare const DotEmptyState: ({ ariaLabel, buttonProps, className, "data-testid": dataTestId, illustrationId, imageAltText, imageSrc, subtitle, title, }: EmptyStateProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const DotEmptyState: ({ ariaLabel, buttonProps, className, "data-testid": dataTestId, illustrationId, imageAltText, imageSrc, size, subtitle, title, }: EmptyStateProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  export * from './CommonProps';
2
2
  export { ApiError } from './core-api/openapi/core/ApiError';
3
+ export type { AnnotationProps, AnnotationType } from './annotation/Annotation';
3
4
  export type { AppToolbarProps } from './app-toolbar/AppToolbar';
4
5
  export type { AutoCompleteOption, AutoCompleteProps, AutoCompleteValue, AutocompleteRenderGroupParams, AutocompleteRenderOptionState, FilterOptionsState, } from './auto-complete';
5
6
  export type { AvatarProps } from './avatar/Avatar';
@@ -50,6 +51,7 @@ export { DotAccordion } from './accordion/Accordion';
50
51
  export { DotActionToolbar } from './action-toolbar/ActionToolbar';
51
52
  export { DotAlertBanner } from './alert-banner/AlertBanner';
52
53
  export { DotAppLogo } from './app-logo/AppLogo';
54
+ export { DotAnnotation } from './annotation/Annotation';
53
55
  export { DotAppSwitcher } from './app-switcher/AppSwitcher';
54
56
  export { DotAppToolbar } from './app-toolbar/AppToolbar';
55
57
  export { DotAutoComplete, parseAutoCompleteValue } from './auto-complete';
@@ -10,6 +10,12 @@ export interface InlineEditProps extends CommonProps {
10
10
  fullWidth?: boolean;
11
11
  /** If true, `Cancel` and `Save` buttons will be hidden */
12
12
  hideActionButtons?: boolean;
13
+ /** if multiline is true will default to 4 */
14
+ maxRows?: number;
15
+ /** if multiline is true will default to 2 */
16
+ minRows?: number;
17
+ /** If true, the input will be multiline */
18
+ multiline?: boolean;
13
19
  /** The name of input element */
14
20
  name: string;
15
21
  /** An async function which should be executed when the value of the input changes */
@@ -36,4 +42,4 @@ export interface InlineEditProps extends CommonProps {
36
42
  /**
37
43
  * @experimental This component is still in development
38
44
  */
39
- export declare const DotInlineEdit: ({ ariaLabel, ariaRole, bindings, charactersLimit, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, fullWidth, hideActionButtons, name, onChange, onEditStateChange, placeholder, readOnly, selectTextOnEdit, startEditable, tabIndex, tooltip, typography, value, }: InlineEditProps) => import("react/jsx-runtime").JSX.Element;
45
+ export declare const DotInlineEdit: ({ ariaLabel, ariaRole, bindings, charactersLimit, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, fullWidth, hideActionButtons, name, onChange, onEditStateChange, maxRows, minRows, multiline, placeholder, readOnly, selectTextOnEdit, startEditable, tabIndex, tooltip, typography, value, }: InlineEditProps) => import("react/jsx-runtime").JSX.Element;
@@ -11,3 +11,8 @@ export interface StyledInlineEditProps {
11
11
  typography?: TypographyVariant;
12
12
  }
13
13
  export declare const StyledInlineEdit: import("styled-components").StyledComponent<"div", any, StyledInlineEditProps, never>;
14
+ export interface StyledInlineViewModeProps {
15
+ maxRows: number;
16
+ typography: TypographyVariant;
17
+ }
18
+ export declare const StyledInlineViewMode: import("styled-components").StyledComponent<"div", any, StyledInlineViewModeProps, never>;
@@ -1,8 +1,8 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { CommonProps } from '../CommonProps';
3
- import { MultiSelectState, TableRowSelectChangeHandler } from './utils/models';
3
+ import { MultiSelectHeader } from './utils/models';
4
4
  export interface DotHeaderCheckboxCellProps extends CommonProps {
5
- multiSelectState: MultiSelectState;
6
- onCheckAllChange: TableRowSelectChangeHandler;
5
+ isFromTableSelectionToolbar?: boolean;
6
+ multiSelectHeader: MultiSelectHeader;
7
7
  }
8
- export declare const DotHeaderCheckboxCell: ({ ariaLabel, className, "data-testid": dataTestId, multiSelectState, onCheckAllChange, }: DotHeaderCheckboxCellProps) => ReactElement;
8
+ export declare const DotHeaderCheckboxCell: ({ ariaLabel, className, "data-testid": dataTestId, isFromTableSelectionToolbar, multiSelectHeader, }: DotHeaderCheckboxCellProps) => ReactElement;
@@ -1,3 +1,4 @@
1
1
  import { TableCell } from '@mui/material';
2
2
  export declare const rootClassName = "dot-th-checkbox";
3
- export declare const StyledTableHeaderCheckboxCell: import("styled-components").StyledComponent<typeof TableCell, any, {}, never>;
3
+ export declare const StyledTableHeaderCheckboxCell: import("styled-components").StyledComponent<"div" | typeof TableCell, any, {}, never>;
4
+ export declare const StyledTableHeaderCheckbox: import("styled-components").StyledComponent<"div" | typeof TableCell, any, {}, never>;
@@ -1,8 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { CommonProps } from '../CommonProps';
3
+ import { MultiSelectHeader } from './utils/models';
3
4
  export interface TableSelectionToolbarProps extends CommonProps {
4
5
  bulkActions?: ReactNode;
6
+ multiSelectHeader?: MultiSelectHeader;
5
7
  onClearAll?: () => void;
6
8
  selectedRowsNumber: number;
7
9
  }
8
- export declare const DotTableSelectionToolbar: ({ ariaLabel, bulkActions, className, "data-testid": dataTestId, onClearAll, selectedRowsNumber, }: TableSelectionToolbarProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const DotTableSelectionToolbar: ({ ariaLabel, bulkActions, className, "data-testid": dataTestId, onClearAll, multiSelectHeader, selectedRowsNumber, }: TableSelectionToolbarProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { TypographyVariant } from '../../typography/Typography';
3
3
  import { TableRowProps } from './interfaces';
4
+ import { MultiSelect } from './models';
4
5
  import { AvatarWithTextCell } from '../TableCell';
5
6
  import { InlineEditProps } from '../../inline-edit';
6
7
  export declare const getFormattedTableCellValue: (value: any, typographyVariant: TypographyVariant) => ReactNode;
@@ -15,3 +16,4 @@ export declare const getSelectedRowIds: (id: string, isChecked: boolean, selecte
15
16
  export declare const getBulkSelectedRowIds: (isChecked: boolean, selectedIds: string[], pageData: TableRowProps[]) => string[];
16
17
  export declare const getExpandedRowIds: (expandedIds: string[], id: string, isExpand: boolean) => string[];
17
18
  export declare const parseCellMaxWidth: (width: string) => string;
19
+ export declare const checkIsMultiselectOverTableHeaderRow: (multiSelect: MultiSelect | undefined, hasToolbar: boolean) => boolean;
@@ -11,6 +11,7 @@ export interface MultiSelect {
11
11
  onCheckAllChange?: TableRowSelectChangeHandler;
12
12
  onCheckRowChange?: TableRowSelectChangeHandler;
13
13
  onClearAllChange?: TableRowSelectChangeHandler;
14
+ showOverTableHeaderRow?: boolean;
14
15
  }
15
16
  interface MultiSelectTableBase {
16
17
  selectedTableRowIds: string[];