@splunk/react-ui 5.0.0-beta.5 → 5.0.0-rc.2

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 (52) hide show
  1. package/ButtonSimple.js +92 -168
  2. package/{CHANGELOG.v5.mdx → CHANGELOG.v5.md} +43 -0
  3. package/Calendar.js +148 -151
  4. package/Card.js +139 -139
  5. package/Code.js +197 -167
  6. package/CollapsiblePanel.js +172 -164
  7. package/Color.js +584 -506
  8. package/ComboBox.js +51 -51
  9. package/ControlGroup.js +132 -127
  10. package/Date.js +137 -150
  11. package/Dropdown.js +97 -96
  12. package/DualListbox.js +468 -469
  13. package/FetchOptions.d.ts +2 -2
  14. package/FormRows.js +158 -157
  15. package/JSONTree.js +354 -360
  16. package/{MIGRATION.mdx → MIGRATION.md} +13 -43
  17. package/{MIGRATION.v5.mdx → MIGRATION.v5.md} +67 -1
  18. package/Markdown.js +3 -4
  19. package/Menu.js +194 -195
  20. package/Modal.js +18 -18
  21. package/ModalLayer.js +171 -217
  22. package/Multiselect.js +785 -778
  23. package/Number.js +103 -102
  24. package/Popover.js +48 -46
  25. package/RadioBar.js +144 -146
  26. package/Resize.js +149 -151
  27. package/ResultsMenu.js +112 -114
  28. package/Search.js +49 -49
  29. package/Select.js +455 -457
  30. package/Slider.js +328 -331
  31. package/Switch.js +251 -178
  32. package/TabBar.js +277 -280
  33. package/Table.js +1212 -1178
  34. package/Text.js +45 -46
  35. package/Tooltip.js +192 -189
  36. package/Tree.js +177 -188
  37. package/package.json +10 -9
  38. package/types/src/Code/Code.d.ts +1 -1
  39. package/types/src/Color/Color.d.ts +2 -2
  40. package/types/src/ControlGroup/ControlGroup.d.ts +1 -2
  41. package/types/src/Dropdown/Dropdown.d.ts +5 -2
  42. package/types/src/Layer/Layer.d.ts +2 -1
  43. package/types/src/Layer/index.d.ts +1 -0
  44. package/types/src/ModalLayer/ModalLayer.d.ts +16 -21
  45. package/types/src/Number/Number.d.ts +1 -1
  46. package/types/src/Popover/Popover.d.ts +5 -2
  47. package/types/src/Table/HeadCell.d.ts +6 -1
  48. package/types/src/Table/HeadInner.d.ts +3 -1
  49. package/types/src/Tooltip/Tooltip.d.ts +7 -7
  50. package/types/src/fixtures/useFetchOptions.d.ts +33 -0
  51. package/useRovingFocus.js +20 -23
  52. package/types/src/fixtures/FetchOptions.d.ts +0 -76
@@ -1,11 +1,8 @@
1
- import Link from '@splunk/react-ui/Link';
2
- import Table from '@splunk/react-ui/Table';
3
-
4
1
  # Migration
5
2
 
6
3
  This document lists migration guidance for new features and breaking changes.
7
4
 
8
- ## 4.44.0
5
+ ## 4.44.0
9
6
 
10
7
  ### `ButtonGroup` role changed to `group`
11
8
 
@@ -21,7 +18,7 @@ This created an unexpected user experience for keyboard and screen reader users.
21
18
 
22
19
  #### Migration steps
23
20
 
24
- If `role="group"` is not desired:
21
+ If `role="group"` is not desired:
25
22
  * consider using `RadioBar` which supports `role="menubar"`
26
23
  * implement either the [Menubar](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/) or [Toolbar](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/) pattern according to WCAG guidelines using `ButtonGroup`
27
24
  * contact the Design System team to make a feature request based on your use case.
@@ -576,44 +573,17 @@ Themes has new variables in version 4.17.0 that support all of the weight values
576
573
  This aligns with the existing API for `variant` in this component.
577
574
 
578
575
  #### Migration steps
579
- Convert any usage of a number to the keyword value using the following table based on <Link to="https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping" openInNewContext>MDN</Link>:
580
-
581
- <Table>
582
- <Table.Head>
583
- <Table.HeadCell>Number</Table.HeadCell>
584
- <Table.HeadCell>Keyword</Table.HeadCell>
585
- </Table.Head>
586
- <Table.Body>
587
- <Table.Row key={300}>
588
- <Table.Cell>{300}</Table.Cell>
589
- <Table.Cell>light</Table.Cell>
590
- </Table.Row>
591
- <Table.Row key={400}>
592
- <Table.Cell>{400}</Table.Cell>
593
- <Table.Cell>normal</Table.Cell>
594
- </Table.Row>
595
- <Table.Row key={500}>
596
- <Table.Cell>{500}</Table.Cell>
597
- <Table.Cell>semiBold</Table.Cell>
598
- </Table.Row>
599
- <Table.Row key={600}>
600
- <Table.Cell>{600}</Table.Cell>
601
- <Table.Cell>semiBold</Table.Cell>
602
- </Table.Row>
603
- <Table.Row key={700}>
604
- <Table.Cell>{700}</Table.Cell>
605
- <Table.Cell>bold</Table.Cell>
606
- </Table.Row>
607
- <Table.Row key={800}>
608
- <Table.Cell>{800}</Table.Cell>
609
- <Table.Cell>extraBold</Table.Cell>
610
- </Table.Row>
611
- <Table.Row key={900}>
612
- <Table.Cell>{900}</Table.Cell>
613
- <Table.Cell>heavy</Table.Cell>
614
- </Table.Row>
615
- </Table.Body>
616
- </Table>
576
+ Convert any usage of a number to the keyword value using the following table based on [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS):
577
+
578
+ | Number | Keyword |
579
+ | ------ | --------- |
580
+ | 300 | light |
581
+ | 400 | normal |
582
+ | 500 | semiBold |
583
+ | 600 | semiBold |
584
+ | 700 | bold |
585
+ | 800 | extraBold |
586
+ | 900 | heavy |
617
587
 
618
588
  For example, convert `<Typography as="p" weight={700} />` to `<Typography as="p" weight='bold' />`.
619
589
 
@@ -483,4 +483,70 @@ we have deprecated the `anchor` prop.
483
483
  Replace all usage of the `anchor` prop with passing in the `Anchor` component to the `title` prop:
484
484
  ```jsx
485
485
  <Card.Header title={<Anchor name="Title">Title</Anchor>} />
486
- ```
486
+ ```
487
+
488
+ ## Deprecated `Popover`'s `"inverted"` value of the `appearance` prop
489
+
490
+ ### Change
491
+
492
+ `Popover`'s `"inverted"` value of the `appearance` prop has been deprecated and will be removed in the next major version.
493
+
494
+ ### Context
495
+
496
+ The inverted appearance was deprecated to ensure the Popover background aligns with the color scheme, i.e. Popover should be light in light mode and dark in dark mode.
497
+
498
+ ### Migration steps
499
+ Replace all usage of Popover's `appearance="inverted"` with `appearance="normal"` (default).
500
+ If teams need to keep inverted Popovers they can use `backgroundColorFloating` and `contentColorInverted`. Otherwise Popover uses `backgroundColorPopup`.
501
+ ```jsx
502
+ const StyledContent = styled.div`
503
+ background-color: ${variables.backgroundColorFloating};
504
+ color: ${variables.contentColorInverted};
505
+ `;
506
+
507
+ return (
508
+ <Popover>
509
+ <StyledContent>Popover content</StyledContent>
510
+ </Popover>
511
+ )
512
+ ```
513
+
514
+ ## `Button`'s `label` prop no longer sets `label` attribute
515
+
516
+ ### Change
517
+ `Button`'s `label` prop no longer sets HTML attribute `label` on the underlying button element.
518
+
519
+ ### Context
520
+ In previous versions, the `label` prop, which sets the text on the Button, was also passed as a `label` HTML attribute which is invalid HTML for a `<button>`. This has been removed.
521
+
522
+ ### Migration steps
523
+ Replace usages of `label` selector in tests with a different suitable query e.g. replace `querySelector('[label="Save"]')` with `getByText('Save')`.
524
+
525
+ ## `Color`'s test hook `[data-test="color"]` moved to root and `[data-test="toggle-swatch"]` added to toggle swatch
526
+
527
+ ### Change
528
+
529
+ `Color`'s test hook `[data-test="color"]` has been moved to the root `div` element and a new test hook `[data-test="toggle-swatch"]` has been added to the toggle swatch.
530
+
531
+ ### Context
532
+
533
+ `Color`'s test hook `[data-test="color"]` was incorrectly documented as the root of the component but was actually set on the toggle swatch.
534
+
535
+ ### Migration steps
536
+ If the test hook needs to be on the root element of `Color`, use `[data-test="color"]`.
537
+ If the test hook was being used to interact with the toggle swatch, replace usage of `[data-test="color"]` with `[data-test="toggle-swatch"]`.
538
+
539
+ ## All components that previously used `KeyboardEvent`'s deprecated `keyCode` property now use `KeyboardEvent`'s `key` property.
540
+
541
+ ### Change
542
+
543
+ Switched all components that previously used `KeyboardEvent`'s deprecated `keyCode` property to use its `key` property instead.
544
+
545
+ ### Context
546
+
547
+ Since current testing library tooling (such as `userEvent`) no longer provides a keyCode along with synthetic keyboard events,
548
+ upgrading testing libaries could cause tests to break. By removing the usage of `keyCode` in our codebase, this enables testing libary upgrades.
549
+
550
+ ### Migration steps
551
+
552
+ Use `KeyboardEvent`'s `key` property instead `keyCode` property to identify key presses.
package/Markdown.js CHANGED
@@ -756,12 +756,11 @@
756
756
  // Languages are passed from `react-markdown` via `classname`
757
757
  // Follows react-markdown's README recommendation for handling syntax highlighting
758
758
  // https://github.com/remarkjs/react-markdown?tab=readme-ov-file#use-custom-components-syntax-highlight
759
- var d = /language-(\w+)/.exec(a);
760
- var p = d && d[1] || undefined;
759
+ var d = (a === null || a === void 0 ? void 0 : a.replace("language-", "")) || undefined;
761
760
  return l ? l(Ne({
762
- language: p
761
+ language: d
763
762
  }, e)) : t().createElement(F, Ue({
764
- language: p
763
+ language: d
765
764
  }, e));
766
765
  }), [ l, o ]);
767
766
  var O = (0, n.useMemo)((function() {