@salesforce/design-system-react 0.10.45 → 0.10.48

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 (57) hide show
  1. package/components/combobox/combobox.d.ts +3 -0
  2. package/components/combobox/combobox.jsx +4 -1
  3. package/components/component-docs.json +6 -3
  4. package/components/data-table/index.jsx +6 -2
  5. package/components/modal/__tests__/modal.browser-test.jsx +5 -0
  6. package/components/modal/index.jsx +2 -2
  7. package/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
  8. package/components/pill-container/private/selected-listbox.jsx +1 -0
  9. package/components/popover/__tests__/popover.browser-test.jsx +28 -0
  10. package/components/progress-indicator.d.ts +29 -8
  11. package/components/slider.d.ts +10 -4
  12. package/design-system-react-components.js +62406 -0
  13. package/design-system-react-components.js.map +1 -0
  14. package/design-system-react-components.min.js +3 -0
  15. package/design-system-react-components.min.js.LICENSE.txt +83 -0
  16. package/design-system-react-components.min.js.map +1 -0
  17. package/design-system-react.js +73800 -0
  18. package/design-system-react.js.map +1 -0
  19. package/design-system-react.min.js +3 -0
  20. package/design-system-react.min.js.LICENSE.txt +83 -0
  21. package/design-system-react.min.js.map +1 -0
  22. package/lib/components/combobox/combobox.d.ts +3 -0
  23. package/lib/components/combobox/combobox.js +4 -1
  24. package/lib/components/component-docs.json +6 -3
  25. package/lib/components/data-table/index.js +7 -3
  26. package/lib/components/modal/__tests__/modal.browser-test.jsx +5 -0
  27. package/lib/components/modal/index.js +1 -1
  28. package/lib/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
  29. package/lib/components/pill-container/private/selected-listbox.js +3 -0
  30. package/lib/components/popover/__tests__/popover.browser-test.jsx +28 -0
  31. package/lib/components/progress-indicator.d.ts +29 -8
  32. package/lib/components/slider.d.ts +10 -4
  33. package/lib/design-system-react-components.min.js.LICENSE.txt +83 -0
  34. package/lib/design-system-react.min.js.LICENSE.txt +83 -0
  35. package/lib/package.json +2 -2
  36. package/lib/utilities/keyboard-navigable-dialog.js +6 -1
  37. package/module/components/combobox/combobox.d.ts +3 -0
  38. package/module/components/combobox/combobox.js +4 -1
  39. package/module/components/combobox/combobox.js.map +1 -1
  40. package/module/components/component-docs.json +6 -3
  41. package/module/components/data-table/index.js +7 -3
  42. package/module/components/data-table/index.js.map +1 -1
  43. package/module/components/modal/__tests__/modal.browser-test.js +4 -0
  44. package/module/components/modal/__tests__/modal.browser-test.js.map +1 -1
  45. package/module/components/modal/index.js +1 -1
  46. package/module/components/modal/index.js.map +1 -1
  47. package/module/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
  48. package/module/components/pill-container/private/selected-listbox.js +3 -0
  49. package/module/components/pill-container/private/selected-listbox.js.map +1 -1
  50. package/module/components/popover/__tests__/popover.browser-test.js +25 -0
  51. package/module/components/popover/__tests__/popover.browser-test.js.map +1 -1
  52. package/module/components/progress-indicator.d.ts +29 -8
  53. package/module/components/slider.d.ts +10 -4
  54. package/module/utilities/keyboard-navigable-dialog.js +4 -1
  55. package/module/utilities/keyboard-navigable-dialog.js.map +1 -1
  56. package/package.json +2 -2
  57. package/utilities/keyboard-navigable-dialog.js +3 -0
@@ -162,6 +162,7 @@ declare module '@salesforce/design-system-react/components/combobox/combobox' {
162
162
  * * `id`: A unique identifier string.
163
163
  * * `label`: A primary string of text for a menu item or group separator.
164
164
  * * `subTitle`: A secondary string of text added for clarity. (optional)
165
+ * * `title`: A string of text shown as the title of the selected item (optional)
165
166
  * * `type`: 'separator' is the only type currently used
166
167
  * * `disabled`: Set to true to disable this menu item.
167
168
  * * `tooltipContent`: Content that is displayed in tooltip when item is disabled
@@ -170,6 +171,7 @@ declare module '@salesforce/design-system-react/components/combobox/combobox' {
170
171
  * id: '2',
171
172
  * label: 'Salesforce.com, Inc.',
172
173
  * subTitle: 'Account • San Francisco',
174
+ * title: 'Salesforce',
173
175
  * type: 'account',
174
176
  * disabled: true,
175
177
  * tooltipContent: "You don't have permission to select this item."
@@ -182,6 +184,7 @@ declare module '@salesforce/design-system-react/components/combobox/combobox' {
182
184
  icon?: React.ReactNode;
183
185
  label?: string;
184
186
  subTitle?: string;
187
+ title?: string;
185
188
  type?: string;
186
189
  disabled?: boolean;
187
190
  tooltipContent?: React.ReactNode;
@@ -235,6 +235,7 @@ const propTypes = {
235
235
  * * `id`: A unique identifier string.
236
236
  * * `label`: A primary string of text for a menu item or group separator.
237
237
  * * `subTitle`: A secondary string of text added for clarity. (optional)
238
+ * * `title`: A string of text shown as the title of the selected item (optional)
238
239
  * * `type`: 'separator' is the only type currently used
239
240
  * * `disabled`: Set to true to disable this menu item.
240
241
  * * `tooltipContent`: Content that is displayed in tooltip when item is disabled
@@ -243,6 +244,7 @@ const propTypes = {
243
244
  * id: '2',
244
245
  * label: 'Salesforce.com, Inc.',
245
246
  * subTitle: 'Account • San Francisco',
247
+ * title: 'Salesforce',
246
248
  * type: 'account',
247
249
  * disabled: true,
248
250
  * tooltipContent: "You don't have permission to select this item."
@@ -256,8 +258,9 @@ const propTypes = {
256
258
  icon: PropTypes.node,
257
259
  label: PropTypes.string,
258
260
  subTitle: PropTypes.string,
261
+ title: PropTypes.string,
259
262
  type: PropTypes.string,
260
- disabled: PropTypes.boolean,
263
+ disabled: PropTypes.bool,
261
264
  tooltipContent: PropTypes.node,
262
265
  })
263
266
  ),
@@ -4958,13 +4958,16 @@
4958
4958
  "name": "string",
4959
4959
  "required": false
4960
4960
  },
4961
+ "title": {
4962
+ "name": "string",
4963
+ "required": false
4964
+ },
4961
4965
  "type": {
4962
4966
  "name": "string",
4963
4967
  "required": false
4964
4968
  },
4965
4969
  "disabled": {
4966
- "name": "custom",
4967
- "raw": "PropTypes.boolean",
4970
+ "name": "bool",
4968
4971
  "required": false
4969
4972
  },
4970
4973
  "tooltipContent": {
@@ -4975,7 +4978,7 @@
4975
4978
  }
4976
4979
  },
4977
4980
  "required": false,
4978
- "description": "**Array of item objects in the dropdown menu.**\nEach object can contain:\n* `icon`: An `Icon` component. (not used in read-only variant)\n* `id`: A unique identifier string.\n* `label`: A primary string of text for a menu item or group separator.\n* `subTitle`: A secondary string of text added for clarity. (optional)\n* `type`: 'separator' is the only type currently used\n* `disabled`: Set to true to disable this menu item.\n* `tooltipContent`: Content that is displayed in tooltip when item is disabled\n```\n{\n\tid: '2',\n\tlabel: 'Salesforce.com, Inc.',\n\tsubTitle: 'Account • San Francisco',\n\ttype: 'account',\n disabled: true,\n tooltipContent: \"You don't have permission to select this item.\"\n},\n```\nNote: At the moment, Combobox does not support two consecutive separators. _Tested with snapshot testing._"
4981
+ "description": "**Array of item objects in the dropdown menu.**\nEach object can contain:\n* `icon`: An `Icon` component. (not used in read-only variant)\n* `id`: A unique identifier string.\n* `label`: A primary string of text for a menu item or group separator.\n* `subTitle`: A secondary string of text added for clarity. (optional)\n* `title`: A string of text shown as the title of the selected item (optional)\n* `type`: 'separator' is the only type currently used\n* `disabled`: Set to true to disable this menu item.\n* `tooltipContent`: Content that is displayed in tooltip when item is disabled\n```\n{\n\tid: '2',\n\tlabel: 'Salesforce.com, Inc.',\n\tsubTitle: 'Account • San Francisco',\n\ttitle: 'Salesforce',\n\ttype: 'account',\n disabled: true,\n tooltipContent: \"You don't have permission to select this item.\"\n},\n```\nNote: At the moment, Combobox does not support two consecutive separators. _Tested with snapshot testing._"
4979
4982
  },
4980
4983
  "menuItemVisibleLength": {
4981
4984
  "type": {
@@ -113,14 +113,17 @@ const getAssistiveText = memoize(
113
113
  );
114
114
 
115
115
  const getColumnsAndRowActions = memoize(
116
- (children, id, fixedHeader, fixedLayout, search) => {
116
+ (children, id, fixedHeader, fixedLayout, items, search) => {
117
117
  const columns = [];
118
118
  let RowActions = null;
119
119
 
120
120
  React.Children.forEach(children, (child) => {
121
121
  if (child && child.type.displayName === DataTableColumn.displayName) {
122
122
  const { children: columnChildren, ...columnProps } = child.props;
123
- const props = { fixedLayout, search, id, ...columnProps };
123
+ const props = { fixedLayout, search, items, ...columnProps };
124
+ if (id) {
125
+ props.id = id;
126
+ }
124
127
 
125
128
  let Cell;
126
129
  if (
@@ -1102,6 +1105,7 @@ class DataTable extends React.Component {
1102
1105
  this.props.id,
1103
1106
  this.getFixedHeader(),
1104
1107
  this.props.fixedLayout,
1108
+ this.props.items,
1105
1109
  this.props.search
1106
1110
  );
1107
1111
 
@@ -234,6 +234,11 @@ describe('SLDSModal: ', function () {
234
234
  modal = getModalNode(document.body);
235
235
  });
236
236
 
237
+ it('adds the default h1 heading element', () => {
238
+ const header = modal.querySelector('section .slds-modal__header h1');
239
+ expect(header).to.not.be.null;
240
+ });
241
+
237
242
  it('adds the footer', () => {
238
243
  const footer = modal.querySelector('.slds-modal__footer');
239
244
  expect(footer.className).to.include('slds-theme_default');
@@ -449,7 +449,7 @@ class Modal extends React.Component {
449
449
  headerContent = (
450
450
  <div>
451
451
  {this.props.toast}
452
- <h2
452
+ <h1
453
453
  className={classNames({
454
454
  'slds-text-heading_small': this.isPrompt(),
455
455
  'slds-text-heading_medium': !this.isPrompt(),
@@ -457,7 +457,7 @@ class Modal extends React.Component {
457
457
  id={`${this.getId()}-heading`}
458
458
  >
459
459
  {this.props.heading ? this.props.heading : this.props.title}
460
- </h2>
460
+ </h1>
461
461
  {this.props.tagline ? (
462
462
  <p className="slds-m-top_x-small">{this.props.tagline}</p>
463
463
  ) : null}
@@ -43,7 +43,7 @@ exports[`DOM snapshots SLDSPillContainer Bare Pill Container 1`] = `
43
43
  >
44
44
  <span
45
45
  className="slds-pill__label"
46
- title="Pill Label 1"
46
+ title="Full pill label verbiage mirrored here"
47
47
  >
48
48
  Pill Label 1
49
49
  </span>
@@ -89,7 +89,7 @@ exports[`DOM snapshots SLDSPillContainer Bare Pill Container 1`] = `
89
89
  >
90
90
  <span
91
91
  className="slds-pill__label"
92
- title="Pill Label 2"
92
+ title="Full pill label verbiage mirrored here"
93
93
  >
94
94
  Pill Label 2
95
95
  </span>
@@ -169,7 +169,7 @@ exports[`DOM snapshots SLDSPillContainer Base Pill Container 1`] = `
169
169
  >
170
170
  <span
171
171
  className="slds-pill__label"
172
- title="Pill Label 1"
172
+ title="Full pill label verbiage mirrored here"
173
173
  >
174
174
  Pill Label 1
175
175
  </span>
@@ -215,7 +215,7 @@ exports[`DOM snapshots SLDSPillContainer Base Pill Container 1`] = `
215
215
  >
216
216
  <span
217
217
  className="slds-pill__label"
218
- title="Pill Label 2"
218
+ title="Full pill label verbiage mirrored here"
219
219
  >
220
220
  Pill Label 2
221
221
  </span>
@@ -311,7 +311,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Avatars 1`] = `
311
311
  </span>
312
312
  <span
313
313
  className="slds-pill__label"
314
- title="Pill Label 1"
314
+ title="Full pill label verbiage mirrored here"
315
315
  >
316
316
  Pill Label 1
317
317
  </span>
@@ -373,7 +373,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Avatars 1`] = `
373
373
  </span>
374
374
  <span
375
375
  className="slds-pill__label"
376
- title="Pill Label 2"
376
+ title="Full pill label verbiage mirrored here"
377
377
  >
378
378
  Pill Label 2
379
379
  </span>
@@ -471,7 +471,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
471
471
  </span>
472
472
  <span
473
473
  className="slds-pill__label"
474
- title="Pill Label 1"
474
+ title="Full pill label verbiage mirrored here"
475
475
  >
476
476
  Pill Label 1
477
477
  </span>
@@ -535,7 +535,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
535
535
  </span>
536
536
  <span
537
537
  className="slds-pill__label"
538
- title="Pill Label 2"
538
+ title="Full pill label verbiage mirrored here"
539
539
  >
540
540
  Pill Label 2
541
541
  </span>
@@ -598,7 +598,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
598
598
  </span>
599
599
  <span
600
600
  className="slds-pill__label"
601
- title="Pill Label 3"
601
+ title="Full pill label verbiage mirrored here"
602
602
  >
603
603
  Pill Label 3
604
604
  </span>
@@ -662,7 +662,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
662
662
  </span>
663
663
  <span
664
664
  className="slds-pill__label"
665
- title="Pill Label 4"
665
+ title="Full pill label verbiage mirrored here"
666
666
  >
667
667
  Pill Label 4
668
668
  </span>
@@ -726,7 +726,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
726
726
  </span>
727
727
  <span
728
728
  className="slds-pill__label"
729
- title="Pill Label 5"
729
+ title="Full pill label verbiage mirrored here"
730
730
  >
731
731
  Pill Label 5
732
732
  </span>
@@ -790,7 +790,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
790
790
  </span>
791
791
  <span
792
792
  className="slds-pill__label"
793
- title="Pill Label 6"
793
+ title="Full pill label verbiage mirrored here"
794
794
  >
795
795
  Pill Label 6
796
796
  </span>
@@ -854,7 +854,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
854
854
  </span>
855
855
  <span
856
856
  className="slds-pill__label"
857
- title="Pill Label 7"
857
+ title="Full pill label verbiage mirrored here"
858
858
  >
859
859
  Pill Label 7
860
860
  </span>
@@ -918,7 +918,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
918
918
  </span>
919
919
  <span
920
920
  className="slds-pill__label"
921
- title="Pill Label 8"
921
+ title="Full pill label verbiage mirrored here"
922
922
  >
923
923
  Pill Label 8
924
924
  </span>
@@ -982,7 +982,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
982
982
  </span>
983
983
  <span
984
984
  className="slds-pill__label"
985
- title="Pill Label 9"
985
+ title="Full pill label verbiage mirrored here"
986
986
  >
987
987
  Pill Label 9
988
988
  </span>
@@ -251,6 +251,7 @@ const SelectedListBox = (props) =>
251
251
  icon={icon}
252
252
  labels={{
253
253
  label: option.label,
254
+ title: option.title ?? option.label,
254
255
  removeTitle: props.labels.removePillTitle,
255
256
  }}
256
257
  requestFocus={props.listboxHasFocus}
@@ -238,6 +238,34 @@ describe('SLDSPopover', function () {
238
238
  const trigger = wrapper.find(defaultIds.trigger);
239
239
  trigger.simulate('click');
240
240
  });
241
+
242
+ it('stops event propagation after closing on ESC', function (done) {
243
+ const mockEvent = {
244
+ key: 'Esc',
245
+ keyCode: 27,
246
+ which: 27,
247
+ stopPropagation: sinon.spy(),
248
+ };
249
+ wrapper = mount(
250
+ <DemoComponent
251
+ onOpen={() => {
252
+ wrapper.update();
253
+ const popover = wrapper.find(`#${defaultIds.popover}`);
254
+ popover.simulate('keyDown', mockEvent);
255
+ }}
256
+ onKeyDown={() => {
257
+ setTimeout(() => {
258
+ expect(mockEvent.stopPropagation.callCount).to.equal(1);
259
+ done();
260
+ }, 0);
261
+ }}
262
+ />,
263
+ { attachTo: mountNode }
264
+ );
265
+
266
+ const trigger = wrapper.find(defaultIds.trigger);
267
+ trigger.simulate('click');
268
+ });
241
269
  });
242
270
  });
243
271
 
@@ -1,5 +1,20 @@
1
1
  declare module '@salesforce/design-system-react/components/progress-indicator' {
2
2
  import React from 'react';
3
+
4
+ type Step = {
5
+ id: string | number;
6
+ label: string | JSX.Element;
7
+ assistiveText?: string;
8
+ };
9
+
10
+ type StepState = {
11
+ isCompleted: boolean;
12
+ isDisabled: boolean;
13
+ isError: boolean;
14
+ isSelected: boolean;
15
+ step: Step;
16
+ };
17
+
3
18
  type Props = {
4
19
  /**
5
20
  * **Assistive text for accessibility**
@@ -23,16 +38,16 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
23
38
  /**
24
39
  * Stores all completed steps. It is an array of step objects.
25
40
  */
26
- completedSteps?: any[];
41
+ completedSteps?: Step[];
27
42
  /**
28
43
  * Stores all disabled steps. It is an array of step objects. Steps are still clickable/focusable,
29
44
  * this only disables cursor change and removes onClick and onFocus event callbacks.
30
45
  */
31
- disabledSteps?: any[];
46
+ disabledSteps?: Step[];
32
47
  /**
33
48
  * Stores all error steps. It is an array of step objects and usually there is only one error step, the current step. If an error occurs a second error icon should be placed to the left of related confirmation buttons (e.g. Cancel, Save) and an Error Popover should appear indicating there are errors. These additional items are NOT part of this component. This note was included for visibility purposes. Please refer to [SLDS website](https://www.lightningdesignsystem.com/components/progress-indicator/) for full details **
34
49
  */
35
- errorSteps?: any[];
50
+ errorSteps?: Step[];
36
51
  /**
37
52
  * HTML id for component.
38
53
  */
@@ -48,7 +63,10 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
48
63
  * <ProgressIndicator onStepClick={handleStepClick} />
49
64
  * ```
50
65
  */
51
- onStepClick?: (v: any) => any;
66
+ onStepClick?: (
67
+ event: React.ChangeEvent<HTMLInputElement>,
68
+ data: StepState
69
+ ) => void;
52
70
  /**
53
71
  * Triggered when an individual step is focused. By default, it receives an event and returns step state and the step object clicked: `{ isCompleted, isDisabled, isError, isSelected, step }`. Users are able to pass a callback handleClick function in forms of: <function name>(event, data) where data is the callback result.
54
72
  * ```
@@ -56,11 +74,14 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
56
74
  * <ProgressIndicator onStepFocus={handleStepFocus} />
57
75
  * ```
58
76
  */
59
- onStepFocus?: (v: any) => any;
77
+ onStepFocus?: (
78
+ event: React.ChangeEvent<HTMLInputElement>,
79
+ data: StepState
80
+ ) => void;
60
81
  /**
61
82
  * Represents the currently selected or active step. It is a step object.
62
83
  */
63
- selectedStep: Record<string, any> /*.isRequired*/;
84
+ selectedStep: Step /* .isRequired */;
64
85
  /**
65
86
  * It is an array of step objects in the following form:
66
87
  * ```
@@ -71,11 +92,11 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
71
92
  * }],
72
93
  * ```
73
94
  */
74
- steps: any[] /*.isRequired*/;
95
+ steps: Step[] /* .isRequired */;
75
96
  /**
76
97
  * Stores all steps with opened tooltips. This property is mainly for development purposes. The tooltip should only show on hover for the user.
77
98
  */
78
- tooltipIsOpenSteps?: any[];
99
+ tooltipIsOpenSteps?: Step[];
79
100
  /**
80
101
  * Determines component style.
81
102
  */
@@ -55,13 +55,19 @@ declare module '@salesforce/design-system-react/components/slider' {
55
55
  */
56
56
  name?: string;
57
57
  /**
58
- * This event fires whenever the user has modified the data of the control. This callback recieves the following parameters `event, { value: [string] }`.
58
+ * This event fires whenever the user has modified the data of the control. This callback recieves the following parameters `event, { value: number }`.
59
59
  */
60
- onChange?: (v: any) => any;
60
+ onChange?: (
61
+ event: React.ChangeEvent<HTMLInputElement>,
62
+ { value: number }
63
+ ) => void;
61
64
  /**
62
- * This event fires when the value is committed. This callback recieves the following parameters `event, { value: [string] }`.
65
+ * This event fires when the value is committed. This callback recieves the following parameters `event, { value: number }`.
63
66
  */
64
- onInput?: (v: any) => any;
67
+ onInput?: (
68
+ event: React.ChangeEvent<HTMLInputElement>,
69
+ { value: number }
70
+ ) => void;
65
71
  /**
66
72
  * Size of the slider.
67
73
  */