@khanacademy/wonder-blocks-popover 5.1.1 → 5.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @khanacademy/wonder-blocks-popover
2
2
 
3
+ ## 5.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a42d9f3: PopoverContent: Add `iconAlt` prop so alt text can be set on the icon
8
+
9
+ ### Patch Changes
10
+
11
+ - fff5da0: Migrate to semanticColor tokens
12
+ - Updated dependencies [ed26d66]
13
+ - Updated dependencies [5655b9f]
14
+ - Updated dependencies [5655b9f]
15
+ - Updated dependencies [8f53293]
16
+ - Updated dependencies [fff5da0]
17
+ - Updated dependencies [6d37702]
18
+ - Updated dependencies [051f0f8]
19
+ - Updated dependencies [e1b78db]
20
+ - Updated dependencies [8f53293]
21
+ - Updated dependencies [051f0f8]
22
+ - @khanacademy/wonder-blocks-core@12.2.0
23
+ - @khanacademy/wonder-blocks-tokens@5.0.0
24
+ - @khanacademy/wonder-blocks-icon-button@6.1.2
25
+ - @khanacademy/wonder-blocks-modal@7.1.2
26
+ - @khanacademy/wonder-blocks-tooltip@4.1.2
27
+ - @khanacademy/wonder-blocks-typography@3.1.2
28
+
3
29
  ## 5.1.1
4
30
 
5
31
  ### Patch Changes
@@ -50,6 +50,11 @@ type Props = (CommonProps & {
50
50
  * same time with image.
51
51
  */
52
52
  icon?: string | React.ReactElement<React.ComponentProps<"img">> | React.ReactElement<React.ComponentProps<"svg">>;
53
+ /**
54
+ * Alt text for the icon. This prop is only used if the `icon` prop
55
+ * is passed a url (instead of a svg or img element).
56
+ */
57
+ iconAlt?: string;
53
58
  /**
54
59
  * Decorate the popover with a full-bleed illustration. It cannot be used at
55
60
  * the same time with icon.
@@ -64,6 +69,7 @@ type Props = (CommonProps & {
64
69
  */
65
70
  emphasized?: boolean;
66
71
  icon?: never;
72
+ iconAlt?: never;
67
73
  image?: never;
68
74
  });
69
75
  type DefaultProps = {
package/dist/es/index.js CHANGED
@@ -5,7 +5,7 @@ import { View, Id, addStyle } from '@khanacademy/wonder-blocks-core';
5
5
  import { TooltipTail, TooltipPopper } from '@khanacademy/wonder-blocks-tooltip';
6
6
  import { maybeGetPortalMountedModalHostElement } from '@khanacademy/wonder-blocks-modal';
7
7
  import { StyleSheet } from 'aphrodite';
8
- import { spacing, color } from '@khanacademy/wonder-blocks-tokens';
8
+ import { spacing, semanticColor, color } from '@khanacademy/wonder-blocks-tokens';
9
9
  import { HeadingSmall, Body } from '@khanacademy/wonder-blocks-typography';
10
10
  import xIcon from '@phosphor-icons/core/regular/x.svg';
11
11
  import IconButton from '@khanacademy/wonder-blocks-icon-button';
@@ -355,20 +355,21 @@ class FocusManager extends React.Component {
355
355
  const {
356
356
  children
357
357
  } = this.props;
358
- return React.createElement("div", {
359
- ref: this.getComponentRootNode,
360
- onClick: () => {
361
- this.changeFocusabilityInsidePopover(true);
362
- },
363
- onFocus: () => {
364
- this.changeFocusabilityInsidePopover(true);
365
- },
366
- onBlur: () => {
367
- this.changeFocusabilityInsidePopover(false);
368
- }
369
- }, React.createElement(InitialFocus, {
370
- initialFocusId: this.props.initialFocusId
371
- }, children));
358
+ return (React.createElement("div", {
359
+ ref: this.getComponentRootNode,
360
+ onClick: () => {
361
+ this.changeFocusabilityInsidePopover(true);
362
+ },
363
+ onFocus: () => {
364
+ this.changeFocusabilityInsidePopover(true);
365
+ },
366
+ onBlur: () => {
367
+ this.changeFocusabilityInsidePopover(false);
368
+ }
369
+ }, React.createElement(InitialFocus, {
370
+ initialFocusId: this.props.initialFocusId
371
+ }, children))
372
+ );
372
373
  }
373
374
  }
374
375
 
@@ -596,8 +597,8 @@ PopoverContentCore.defaultProps = {
596
597
  const styles$1 = StyleSheet.create({
597
598
  content: {
598
599
  borderRadius: spacing.xxxSmall_4,
599
- border: `solid 1px ${color.offBlack16}`,
600
- backgroundColor: color.white,
600
+ border: `solid 1px ${semanticColor.border.primary}`,
601
+ backgroundColor: semanticColor.surface.primary,
601
602
  boxShadow: `0 ${spacing.xSmall_8}px ${spacing.xSmall_8}px 0 ${color.offBlack8}`,
602
603
  margin: 0,
603
604
  maxWidth: spacing.medium_16 * 18,
@@ -606,12 +607,12 @@ const styles$1 = StyleSheet.create({
606
607
  justifyContent: "center"
607
608
  },
608
609
  blue: {
609
- backgroundColor: color.blue,
610
- color: color.white
610
+ backgroundColor: semanticColor.surface.emphasis,
611
+ color: semanticColor.text.inverse
611
612
  },
612
613
  darkBlue: {
613
- backgroundColor: color.darkBlue,
614
- color: color.white
614
+ backgroundColor: semanticColor.surface.inverse,
615
+ color: semanticColor.text.inverse
615
616
  },
616
617
  closeButton: {
617
618
  margin: 0,
@@ -641,7 +642,8 @@ class PopoverContent extends React.Component {
641
642
  };
642
643
  this.maybeRenderIcon = () => {
643
644
  const {
644
- icon
645
+ icon,
646
+ iconAlt
645
647
  } = this.props;
646
648
  if (!icon) {
647
649
  return null;
@@ -650,7 +652,8 @@ class PopoverContent extends React.Component {
650
652
  style: styles.iconContainer
651
653
  }, typeof icon !== "string" ? icon : React.createElement(StyledImg, {
652
654
  src: icon,
653
- style: styles.icon
655
+ style: styles.icon,
656
+ alt: iconAlt || ""
654
657
  }));
655
658
  };
656
659
  this.maybeRenderActions = close => {
package/dist/index.js CHANGED
@@ -385,20 +385,21 @@ class FocusManager extends React__namespace.Component {
385
385
  const {
386
386
  children
387
387
  } = this.props;
388
- return React__namespace.createElement("div", {
389
- ref: this.getComponentRootNode,
390
- onClick: () => {
391
- this.changeFocusabilityInsidePopover(true);
392
- },
393
- onFocus: () => {
394
- this.changeFocusabilityInsidePopover(true);
395
- },
396
- onBlur: () => {
397
- this.changeFocusabilityInsidePopover(false);
398
- }
399
- }, React__namespace.createElement(InitialFocus, {
400
- initialFocusId: this.props.initialFocusId
401
- }, children));
388
+ return (React__namespace.createElement("div", {
389
+ ref: this.getComponentRootNode,
390
+ onClick: () => {
391
+ this.changeFocusabilityInsidePopover(true);
392
+ },
393
+ onFocus: () => {
394
+ this.changeFocusabilityInsidePopover(true);
395
+ },
396
+ onBlur: () => {
397
+ this.changeFocusabilityInsidePopover(false);
398
+ }
399
+ }, React__namespace.createElement(InitialFocus, {
400
+ initialFocusId: this.props.initialFocusId
401
+ }, children))
402
+ );
402
403
  }
403
404
  }
404
405
 
@@ -626,8 +627,8 @@ PopoverContentCore.defaultProps = {
626
627
  const styles$1 = aphrodite.StyleSheet.create({
627
628
  content: {
628
629
  borderRadius: wonderBlocksTokens.spacing.xxxSmall_4,
629
- border: `solid 1px ${wonderBlocksTokens.color.offBlack16}`,
630
- backgroundColor: wonderBlocksTokens.color.white,
630
+ border: `solid 1px ${wonderBlocksTokens.semanticColor.border.primary}`,
631
+ backgroundColor: wonderBlocksTokens.semanticColor.surface.primary,
631
632
  boxShadow: `0 ${wonderBlocksTokens.spacing.xSmall_8}px ${wonderBlocksTokens.spacing.xSmall_8}px 0 ${wonderBlocksTokens.color.offBlack8}`,
632
633
  margin: 0,
633
634
  maxWidth: wonderBlocksTokens.spacing.medium_16 * 18,
@@ -636,12 +637,12 @@ const styles$1 = aphrodite.StyleSheet.create({
636
637
  justifyContent: "center"
637
638
  },
638
639
  blue: {
639
- backgroundColor: wonderBlocksTokens.color.blue,
640
- color: wonderBlocksTokens.color.white
640
+ backgroundColor: wonderBlocksTokens.semanticColor.surface.emphasis,
641
+ color: wonderBlocksTokens.semanticColor.text.inverse
641
642
  },
642
643
  darkBlue: {
643
- backgroundColor: wonderBlocksTokens.color.darkBlue,
644
- color: wonderBlocksTokens.color.white
644
+ backgroundColor: wonderBlocksTokens.semanticColor.surface.inverse,
645
+ color: wonderBlocksTokens.semanticColor.text.inverse
645
646
  },
646
647
  closeButton: {
647
648
  margin: 0,
@@ -671,7 +672,8 @@ class PopoverContent extends React__namespace.Component {
671
672
  };
672
673
  this.maybeRenderIcon = () => {
673
674
  const {
674
- icon
675
+ icon,
676
+ iconAlt
675
677
  } = this.props;
676
678
  if (!icon) {
677
679
  return null;
@@ -680,7 +682,8 @@ class PopoverContent extends React__namespace.Component {
680
682
  style: styles.iconContainer
681
683
  }, typeof icon !== "string" ? icon : React__namespace.createElement(StyledImg, {
682
684
  src: icon,
683
- style: styles.icon
685
+ style: styles.icon,
686
+ alt: iconAlt || ""
684
687
  }));
685
688
  };
686
689
  this.maybeRenderActions = close => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-popover",
3
- "version": "5.1.1",
3
+ "version": "5.2.0",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,12 +13,12 @@
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
15
  "@babel/runtime": "^7.24.5",
16
- "@khanacademy/wonder-blocks-core": "12.1.1",
17
- "@khanacademy/wonder-blocks-icon-button": "6.1.1",
18
- "@khanacademy/wonder-blocks-modal": "7.1.1",
19
- "@khanacademy/wonder-blocks-tokens": "4.2.1",
20
- "@khanacademy/wonder-blocks-tooltip": "4.1.1",
21
- "@khanacademy/wonder-blocks-typography": "3.1.1"
16
+ "@khanacademy/wonder-blocks-core": "12.2.0",
17
+ "@khanacademy/wonder-blocks-icon-button": "6.1.2",
18
+ "@khanacademy/wonder-blocks-modal": "7.1.2",
19
+ "@khanacademy/wonder-blocks-tokens": "5.0.0",
20
+ "@khanacademy/wonder-blocks-tooltip": "4.1.2",
21
+ "@khanacademy/wonder-blocks-typography": "3.1.2"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@phosphor-icons/core": "^2.0.2",