@wordpress/components 27.2.0 → 27.3.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.
Files changed (117) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +13 -0
  3. package/build/button/index.js +1 -1
  4. package/build/button/index.js.map +1 -1
  5. package/build/color-picker/component.js +2 -12
  6. package/build/color-picker/component.js.map +1 -1
  7. package/build/color-picker/picker.js +18 -77
  8. package/build/color-picker/picker.js.map +1 -1
  9. package/build/color-picker/types.js.map +1 -1
  10. package/build/custom-select-control-v2/default-component/index.js +4 -2
  11. package/build/custom-select-control-v2/default-component/index.js.map +1 -1
  12. package/build/custom-select-control-v2/index.js +1 -8
  13. package/build/custom-select-control-v2/index.js.map +1 -1
  14. package/build/custom-select-control-v2/{custom-select-item.js → item.js} +2 -1
  15. package/build/custom-select-control-v2/{custom-select-item.js.map → item.js.map} +1 -1
  16. package/build/custom-select-control-v2/legacy-component/index.js +5 -5
  17. package/build/custom-select-control-v2/legacy-component/index.js.map +1 -1
  18. package/build/input-control/input-field.js +2 -1
  19. package/build/input-control/input-field.js.map +1 -1
  20. package/build/mobile/color-settings/palette.screen.native.js +1 -0
  21. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  22. package/build/navigable-container/container.js.map +1 -1
  23. package/build/navigator/navigator-provider/component.js +162 -120
  24. package/build/navigator/navigator-provider/component.js.map +1 -1
  25. package/build/navigator/navigator-screen/component.js +2 -2
  26. package/build/navigator/navigator-screen/component.js.map +1 -1
  27. package/build/popover/index.js +7 -34
  28. package/build/popover/index.js.map +1 -1
  29. package/build/range-control/styles/range-control-styles.js +29 -29
  30. package/build/range-control/styles/range-control-styles.js.map +1 -1
  31. package/build/toggle-group-control/toggle-group-control-option-base/component.js +1 -1
  32. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  33. package/build-module/button/index.js +1 -1
  34. package/build-module/button/index.js.map +1 -1
  35. package/build-module/color-picker/component.js +3 -13
  36. package/build-module/color-picker/component.js.map +1 -1
  37. package/build-module/color-picker/picker.js +19 -78
  38. package/build-module/color-picker/picker.js.map +1 -1
  39. package/build-module/color-picker/types.js.map +1 -1
  40. package/build-module/custom-select-control-v2/default-component/index.js +4 -2
  41. package/build-module/custom-select-control-v2/default-component/index.js.map +1 -1
  42. package/build-module/custom-select-control-v2/index.js +1 -2
  43. package/build-module/custom-select-control-v2/index.js.map +1 -1
  44. package/build-module/custom-select-control-v2/{custom-select-item.js → item.js} +2 -1
  45. package/build-module/custom-select-control-v2/{custom-select-item.js.map → item.js.map} +1 -1
  46. package/build-module/custom-select-control-v2/legacy-component/index.js +4 -4
  47. package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -1
  48. package/build-module/input-control/input-field.js +2 -1
  49. package/build-module/input-control/input-field.js.map +1 -1
  50. package/build-module/mobile/color-settings/palette.screen.native.js +1 -0
  51. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  52. package/build-module/navigable-container/container.js.map +1 -1
  53. package/build-module/navigator/navigator-provider/component.js +163 -121
  54. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  55. package/build-module/navigator/navigator-screen/component.js +2 -2
  56. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  57. package/build-module/popover/index.js +9 -36
  58. package/build-module/popover/index.js.map +1 -1
  59. package/build-module/range-control/styles/range-control-styles.js +29 -29
  60. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  61. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +2 -2
  62. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  63. package/build-style/style-rtl.css +2 -8
  64. package/build-style/style.css +2 -8
  65. package/build-types/color-picker/component.d.ts.map +1 -1
  66. package/build-types/color-picker/picker.d.ts +1 -1
  67. package/build-types/color-picker/picker.d.ts.map +1 -1
  68. package/build-types/color-picker/types.d.ts +0 -3
  69. package/build-types/color-picker/types.d.ts.map +1 -1
  70. package/build-types/custom-select-control/stories/index.story.d.ts +35 -0
  71. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -0
  72. package/build-types/custom-select-control-v2/default-component/index.d.ts +5 -2
  73. package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -1
  74. package/build-types/custom-select-control-v2/index.d.ts +1 -2
  75. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  76. package/build-types/custom-select-control-v2/{custom-select-item.d.ts → item.d.ts} +4 -1
  77. package/build-types/custom-select-control-v2/item.d.ts.map +1 -0
  78. package/build-types/custom-select-control-v2/legacy-component/index.d.ts +2 -2
  79. package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -1
  80. package/build-types/custom-select-control-v2/stories/default.story.d.ts +2 -2
  81. package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -1
  82. package/build-types/custom-select-control-v2/stories/legacy.story.d.ts +4 -2
  83. package/build-types/custom-select-control-v2/stories/legacy.story.d.ts.map +1 -1
  84. package/build-types/input-control/input-field.d.ts.map +1 -1
  85. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  86. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  87. package/build-types/popover/index.d.ts.map +1 -1
  88. package/package.json +21 -21
  89. package/src/button/index.tsx +1 -1
  90. package/src/color-picker/component.tsx +3 -25
  91. package/src/color-picker/picker.tsx +12 -96
  92. package/src/color-picker/types.ts +0 -3
  93. package/src/custom-select-control/stories/{index.story.js → index.story.tsx} +8 -3
  94. package/src/custom-select-control/test/index.js +24 -0
  95. package/src/custom-select-control-v2/README.md +27 -27
  96. package/src/custom-select-control-v2/default-component/index.tsx +5 -2
  97. package/src/custom-select-control-v2/index.tsx +1 -2
  98. package/src/custom-select-control-v2/{custom-select-item.tsx → item.tsx} +2 -0
  99. package/src/custom-select-control-v2/legacy-component/index.tsx +4 -6
  100. package/src/custom-select-control-v2/legacy-component/test/index.tsx +13 -10
  101. package/src/custom-select-control-v2/stories/default.story.tsx +16 -17
  102. package/src/custom-select-control-v2/stories/legacy.story.tsx +20 -35
  103. package/src/custom-select-control-v2/test/index.tsx +26 -16
  104. package/src/dropdown/style.scss +3 -3
  105. package/src/input-control/input-field.tsx +2 -1
  106. package/src/mobile/color-settings/palette.screen.native.js +5 -1
  107. package/src/navigable-container/container.tsx +1 -1
  108. package/src/navigator/navigator-provider/component.tsx +187 -188
  109. package/src/navigator/navigator-screen/component.tsx +2 -4
  110. package/src/popover/index.tsx +59 -99
  111. package/src/popover/style.scss +0 -9
  112. package/src/range-control/styles/range-control-styles.ts +1 -1
  113. package/src/text-control/style.scss +2 -0
  114. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +2 -2
  115. package/src/toolbar/toolbar/style.scss +1 -1
  116. package/tsconfig.tsbuildinfo +1 -1
  117. package/build-types/custom-select-control-v2/custom-select-item.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 27.3.0 (2024-04-03)
6
+
7
+ ### Bug Fix
8
+
9
+ - `Dropdown`: Fix bug with separator styling. ([#60336](https://github.com/WordPress/gutenberg/pull/60336)).
10
+ - `InputControl`: Ignore IME events when `isPressEnterToChange` is enabled ([#60090](https://github.com/WordPress/gutenberg/pull/60090)).
11
+ - `TextControl`: Apply zero margin to input element ([#60282](https://github.com/WordPress/gutenberg/pull/60282)).
12
+
13
+ ### Experimental
14
+
15
+ - `CustomSelectControlV2`: Rename for consistency ([#60178](https://github.com/WordPress/gutenberg/pull/60178)).
16
+
17
+ ### Internal
18
+
19
+ - `Popover`, `ColorPicker`: Obviate pointer event trap #59449 ([#59449](https://github.com/WordPress/gutenberg/pull/59449)).
20
+ - `Popover`, `ToggleGroupControl`: Use `useReducedMotion()` ([#60168](https://github.com/WordPress/gutenberg/pull/60168)).
21
+ - `NavigatorProvider`: Simplify the router state logic ([#60190](https://github.com/WordPress/gutenberg/pull/60190)).
22
+ - Update `date-fns` to version `3.6.0` ([#60163](https://github.com/WordPress/gutenberg/pull/60163)).
23
+ - Update `use-lilius` to version `2.0.5` ([#60163](https://github.com/WordPress/gutenberg/pull/60163)).
24
+
25
+ ### Experimental
26
+
27
+ - `CustomSelectControlV2`: Fix hint behavior in legacy ([#60183](https://github.com/WordPress/gutenberg/pull/60183)).
28
+
5
29
  ## 27.2.0 (2024-03-21)
6
30
 
7
31
  - `Dropdown` : Add styling support for `MenuGroup` ([#59723](https://github.com/WordPress/gutenberg/pull/59723)).
package/README.md CHANGED
@@ -57,6 +57,19 @@ const Example = () => {
57
57
  };
58
58
  ```
59
59
 
60
+ ### TypeScript
61
+
62
+ This package exposes its own types for the components it exports, however it doesn't export its own types for component props. If you need to extract the props type, please use `React.ComponentProps` to get the types from the element.
63
+
64
+ ```tsx
65
+ import type { ComponentProps } from 'react';
66
+ import { Button } from '@wordpress/components';
67
+
68
+ export default function MyButton( props: ComponentProps< typeof Button > ) {
69
+ return <Button { ...props }>Click Me!</Button>;
70
+ }
71
+ ```
72
+
60
73
  ## Docs & examples
61
74
 
62
75
  You can browse the components docs and examples at [https://wordpress.github.io/gutenberg/](https://wordpress.github.io/gutenberg/)
@@ -44,7 +44,7 @@ function useDeprecatedProps({
44
44
  let computedSize = size;
45
45
  let computedVariant = variant;
46
46
  const newProps = {
47
- // @TODO Mark `isPressed` as deprecated
47
+ // @todo Mark `isPressed` as deprecated
48
48
  'aria-pressed': isPressed
49
49
  };
50
50
  if (isSmall) {
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_deprecated","_element","_compose","_tooltip","_icon","_visuallyHidden","_utils","disabledEventsOnDisabledButton","useDeprecatedProps","isDefault","isPrimary","isSecondary","isTertiary","isLink","isPressed","isSmall","size","variant","otherProps","computedSize","computedVariant","newProps","_computedSize","_computedVariant","_computedVariant2","_computedVariant3","_computedVariant4","deprecated","since","alternative","_computedVariant5","UnforwardedButton","props","ref","__next40pxDefaultSize","isBusy","isDestructive","className","disabled","icon","iconPosition","iconSize","showTooltip","tooltipPosition","shortcut","label","children","text","__experimentalIsFocusable","isFocusable","describedBy","buttonOrAnchorProps","href","target","ariaChecked","ariaPressed","ariaSelected","additionalProps","undefined","instanceId","useInstanceId","Button","hasChildren","Array","isArray","truthyAriaPressedValues","classes","classnames","includes","trulyDisabled","Tag","buttonProps","type","anchorProps","disabledEvent","event","stopPropagation","preventDefault","shouldShowTooltip","length","descriptionId","describedById","commonProps","elementChildren","_react","createElement","Fragment","default","element","tooltipProps","placement","positionToPlacement","VisuallyHidden","id","exports","forwardRef","_default"],"sources":["@wordpress/components/src/button/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type {\n\tComponentPropsWithoutRef,\n\tForwardedRef,\n\tHTMLAttributes,\n\tMouseEvent,\n\tReactElement,\n} from 'react';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\nimport Icon from '../icon';\nimport { VisuallyHidden } from '../visually-hidden';\nimport type { ButtonProps, DeprecatedButtonProps } from './types';\nimport { positionToPlacement } from '../popover/utils';\n\nconst disabledEventsOnDisabledButton = [ 'onMouseDown', 'onClick' ] as const;\n\nfunction useDeprecatedProps( {\n\tisDefault,\n\tisPrimary,\n\tisSecondary,\n\tisTertiary,\n\tisLink,\n\tisPressed,\n\tisSmall,\n\tsize,\n\tvariant,\n\t...otherProps\n}: ButtonProps & DeprecatedButtonProps ): ButtonProps {\n\tlet computedSize = size;\n\tlet computedVariant = variant;\n\n\tconst newProps: { 'aria-pressed'?: boolean } = {\n\t\t// @TODO Mark `isPressed` as deprecated\n\t\t'aria-pressed': isPressed,\n\t};\n\n\tif ( isSmall ) {\n\t\tcomputedSize ??= 'small';\n\t}\n\n\tif ( isPrimary ) {\n\t\tcomputedVariant ??= 'primary';\n\t}\n\n\tif ( isTertiary ) {\n\t\tcomputedVariant ??= 'tertiary';\n\t}\n\n\tif ( isSecondary ) {\n\t\tcomputedVariant ??= 'secondary';\n\t}\n\n\tif ( isDefault ) {\n\t\tdeprecated( 'wp.components.Button `isDefault` prop', {\n\t\t\tsince: '5.4',\n\t\t\talternative: 'variant=\"secondary\"',\n\t\t} );\n\n\t\tcomputedVariant ??= 'secondary';\n\t}\n\n\tif ( isLink ) {\n\t\tcomputedVariant ??= 'link';\n\t}\n\n\treturn {\n\t\t...newProps,\n\t\t...otherProps,\n\t\tsize: computedSize,\n\t\tvariant: computedVariant,\n\t};\n}\n\nexport function UnforwardedButton(\n\tprops: ButtonProps & DeprecatedButtonProps,\n\tref: ForwardedRef< any >\n) {\n\tconst {\n\t\t__next40pxDefaultSize,\n\t\tisBusy,\n\t\tisDestructive,\n\t\tclassName,\n\t\tdisabled,\n\t\ticon,\n\t\ticonPosition = 'left',\n\t\ticonSize,\n\t\tshowTooltip,\n\t\ttooltipPosition,\n\t\tshortcut,\n\t\tlabel,\n\t\tchildren,\n\t\tsize = 'default',\n\t\ttext,\n\t\tvariant,\n\t\t__experimentalIsFocusable: isFocusable,\n\t\tdescribedBy,\n\t\t...buttonOrAnchorProps\n\t} = useDeprecatedProps( props );\n\n\tconst {\n\t\thref,\n\t\ttarget,\n\t\t'aria-checked': ariaChecked,\n\t\t'aria-pressed': ariaPressed,\n\t\t'aria-selected': ariaSelected,\n\t\t...additionalProps\n\t} = 'href' in buttonOrAnchorProps\n\t\t? buttonOrAnchorProps\n\t\t: { href: undefined, target: undefined, ...buttonOrAnchorProps };\n\n\tconst instanceId = useInstanceId(\n\t\tButton,\n\t\t'components-button__description'\n\t);\n\n\tconst hasChildren =\n\t\t( 'string' === typeof children && !! children ) ||\n\t\t( Array.isArray( children ) &&\n\t\t\tchildren?.[ 0 ] &&\n\t\t\tchildren[ 0 ] !== null &&\n\t\t\t// Tooltip should not considered as a child\n\t\t\tchildren?.[ 0 ]?.props?.className !== 'components-tooltip' );\n\n\tconst truthyAriaPressedValues: ( typeof ariaPressed )[] = [\n\t\ttrue,\n\t\t'true',\n\t\t'mixed',\n\t];\n\n\tconst classes = classnames( 'components-button', className, {\n\t\t'is-next-40px-default-size': __next40pxDefaultSize,\n\t\t'is-secondary': variant === 'secondary',\n\t\t'is-primary': variant === 'primary',\n\t\t'is-small': size === 'small',\n\t\t'is-compact': size === 'compact',\n\t\t'is-tertiary': variant === 'tertiary',\n\n\t\t'is-pressed': truthyAriaPressedValues.includes( ariaPressed ),\n\t\t'is-pressed-mixed': ariaPressed === 'mixed',\n\n\t\t'is-busy': isBusy,\n\t\t'is-link': variant === 'link',\n\t\t'is-destructive': isDestructive,\n\t\t'has-text': !! icon && ( hasChildren || text ),\n\t\t'has-icon': !! icon,\n\t} );\n\n\tconst trulyDisabled = disabled && ! isFocusable;\n\tconst Tag = href !== undefined && ! trulyDisabled ? 'a' : 'button';\n\tconst buttonProps: ComponentPropsWithoutRef< 'button' > =\n\t\tTag === 'button'\n\t\t\t? {\n\t\t\t\t\ttype: 'button',\n\t\t\t\t\tdisabled: trulyDisabled,\n\t\t\t\t\t'aria-checked': ariaChecked,\n\t\t\t\t\t'aria-pressed': ariaPressed,\n\t\t\t\t\t'aria-selected': ariaSelected,\n\t\t\t }\n\t\t\t: {};\n\tconst anchorProps: ComponentPropsWithoutRef< 'a' > =\n\t\tTag === 'a' ? { href, target } : {};\n\n\tif ( disabled && isFocusable ) {\n\t\t// In this case, the button will be disabled, but still focusable and\n\t\t// perceivable by screen reader users.\n\t\tbuttonProps[ 'aria-disabled' ] = true;\n\t\tanchorProps[ 'aria-disabled' ] = true;\n\n\t\tfor ( const disabledEvent of disabledEventsOnDisabledButton ) {\n\t\t\tadditionalProps[ disabledEvent ] = ( event: MouseEvent ) => {\n\t\t\t\tif ( event ) {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\t// Should show the tooltip if...\n\tconst shouldShowTooltip =\n\t\t! trulyDisabled &&\n\t\t// An explicit tooltip is passed or...\n\t\t( ( showTooltip && !! label ) ||\n\t\t\t// There's a shortcut or...\n\t\t\t!! shortcut ||\n\t\t\t// There's a label and...\n\t\t\t( !! label &&\n\t\t\t\t// The children are empty and...\n\t\t\t\t! ( children as string | ReactElement[] )?.length &&\n\t\t\t\t// The tooltip is not explicitly disabled.\n\t\t\t\tfalse !== showTooltip ) );\n\n\tconst descriptionId = describedBy ? instanceId : undefined;\n\n\tconst describedById =\n\t\tadditionalProps[ 'aria-describedby' ] || descriptionId;\n\n\tconst commonProps = {\n\t\tclassName: classes,\n\t\t'aria-label': additionalProps[ 'aria-label' ] || label,\n\t\t'aria-describedby': describedById,\n\t\tref,\n\t};\n\n\tconst elementChildren = (\n\t\t<>\n\t\t\t{ icon && iconPosition === 'left' && (\n\t\t\t\t<Icon icon={ icon } size={ iconSize } />\n\t\t\t) }\n\t\t\t{ text && <>{ text }</> }\n\t\t\t{ children }\n\t\t\t{ icon && iconPosition === 'right' && (\n\t\t\t\t<Icon icon={ icon } size={ iconSize } />\n\t\t\t) }\n\t\t</>\n\t);\n\n\tconst element =\n\t\tTag === 'a' ? (\n\t\t\t<a\n\t\t\t\t{ ...anchorProps }\n\t\t\t\t{ ...( additionalProps as HTMLAttributes< HTMLAnchorElement > ) }\n\t\t\t\t{ ...commonProps }\n\t\t\t>\n\t\t\t\t{ elementChildren }\n\t\t\t</a>\n\t\t) : (\n\t\t\t<button\n\t\t\t\t{ ...buttonProps }\n\t\t\t\t{ ...( additionalProps as HTMLAttributes< HTMLButtonElement > ) }\n\t\t\t\t{ ...commonProps }\n\t\t\t>\n\t\t\t\t{ elementChildren }\n\t\t\t</button>\n\t\t);\n\n\t// In order to avoid some React reconciliation issues, we are always rendering\n\t// the `Tooltip` component even when `shouldShowTooltip` is `false`.\n\t// In order to make sure that the tooltip doesn't show when it shouldn't,\n\t// we don't pass the props to the `Tooltip` component.\n\tconst tooltipProps = shouldShowTooltip\n\t\t? {\n\t\t\t\ttext:\n\t\t\t\t\t( children as string | ReactElement[] )?.length &&\n\t\t\t\t\tdescribedBy\n\t\t\t\t\t\t? describedBy\n\t\t\t\t\t\t: label,\n\t\t\t\tshortcut,\n\t\t\t\tplacement:\n\t\t\t\t\ttooltipPosition &&\n\t\t\t\t\t// Convert legacy `position` values to be used with the new `placement` prop\n\t\t\t\t\tpositionToPlacement( tooltipPosition ),\n\t\t }\n\t\t: {};\n\n\treturn (\n\t\t<>\n\t\t\t<Tooltip { ...tooltipProps }>{ element }</Tooltip>\n\t\t\t{ describedBy && (\n\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t<span id={ descriptionId }>{ describedBy }</span>\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Lets users take actions and make choices with a single click or tap.\n *\n * ```jsx\n * import { Button } from '@wordpress/components';\n * const Mybutton = () => (\n * <Button\n * variant=\"primary\"\n * onClick={ handleClick }\n * >\n * Click here\n * </Button>\n * );\n * ```\n */\nexport const Button = forwardRef( UnforwardedButton );\nexport default Button;\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAYA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AA1BA;AACA;AACA;;AAUA;AACA;AACA;;AAKA;AACA;AACA;;AAOA,MAAMQ,8BAA8B,GAAG,CAAE,aAAa,EAAE,SAAS,CAAW;AAE5E,SAASC,kBAAkBA,CAAE;EAC5BC,SAAS;EACTC,SAAS;EACTC,WAAW;EACXC,UAAU;EACVC,MAAM;EACNC,SAAS;EACTC,OAAO;EACP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ACjByB;EAAW,GAEdC,eACA,CAAC,GAEJ,IAAAC,MAAA,CAAAC,aAAA;IAAA,GACMd,WAAW;IAAA,GACTd,eAAe;IAAA,GACjByB;EAAW,GAEdC,eACK,CACR;;EAEF;EACA;EACA;EACA;EACA,MAAMM,YAAY,GAAGX,iBAAiB,GACnC;IACA/B,IAAI,EACDD,QAAQ,EAA+BiC,MAAM,IAC/C7B,WAAW,GACRA,WAAW,GACXL,KAAK;IACTD,QAAQ;IACR8C,SAAS,EACR/C,eAAe;IACf;IACA,IAAAgD,0BAAmB,EAAEhD,eAAgB;EACtC,CAAC,GACD,CAAC,CAAC;EAEL,OACC,IAAAyC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAClF,QAAA,CAAAoF,OAAO;IAAA,GAAME;EAAY,GAAKD,OAAkB,CAAC,EAChDtC,WAAW,IACZ,IAAAkC,MAAA,CAAAC,aAAA,EAAChF,eAAA,CAAAuF,cAAc,QACd,IAAAR,MAAA,CAAAC,aAAA;IAAMQ,EAAE,EAAGb;EAAe,GAAG9B,WAAmB,CACjC,CAEhB,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,MAAM,GAAAiC,OAAA,CAAAjC,MAAA,GAAG,IAAAkC,mBAAU,EAAEhE,iBAAkB,CAAC;AAAC,IAAAiE,QAAA,GAAAF,OAAA,CAAAP,OAAA,GACvC1B,MAAM"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_deprecated","_element","_compose","_tooltip","_icon","_visuallyHidden","_utils","disabledEventsOnDisabledButton","useDeprecatedProps","isDefault","isPrimary","isSecondary","isTertiary","isLink","isPressed","isSmall","size","variant","otherProps","computedSize","computedVariant","newProps","_computedSize","_computedVariant","_computedVariant2","_computedVariant3","_computedVariant4","deprecated","since","alternative","_computedVariant5","UnforwardedButton","props","ref","__next40pxDefaultSize","isBusy","isDestructive","className","disabled","icon","iconPosition","iconSize","showTooltip","tooltipPosition","shortcut","label","children","text","__experimentalIsFocusable","isFocusable","describedBy","buttonOrAnchorProps","href","target","ariaChecked","ariaPressed","ariaSelected","additionalProps","undefined","instanceId","useInstanceId","Button","hasChildren","Array","isArray","truthyAriaPressedValues","classes","classnames","includes","trulyDisabled","Tag","buttonProps","type","anchorProps","disabledEvent","event","stopPropagation","preventDefault","shouldShowTooltip","length","descriptionId","describedById","commonProps","elementChildren","_react","createElement","Fragment","default","element","tooltipProps","placement","positionToPlacement","VisuallyHidden","id","exports","forwardRef","_default"],"sources":["@wordpress/components/src/button/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type {\n\tComponentPropsWithoutRef,\n\tForwardedRef,\n\tHTMLAttributes,\n\tMouseEvent,\n\tReactElement,\n} from 'react';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\nimport Icon from '../icon';\nimport { VisuallyHidden } from '../visually-hidden';\nimport type { ButtonProps, DeprecatedButtonProps } from './types';\nimport { positionToPlacement } from '../popover/utils';\n\nconst disabledEventsOnDisabledButton = [ 'onMouseDown', 'onClick' ] as const;\n\nfunction useDeprecatedProps( {\n\tisDefault,\n\tisPrimary,\n\tisSecondary,\n\tisTertiary,\n\tisLink,\n\tisPressed,\n\tisSmall,\n\tsize,\n\tvariant,\n\t...otherProps\n}: ButtonProps & DeprecatedButtonProps ): ButtonProps {\n\tlet computedSize = size;\n\tlet computedVariant = variant;\n\n\tconst newProps: { 'aria-pressed'?: boolean } = {\n\t\t// @todo Mark `isPressed` as deprecated\n\t\t'aria-pressed': isPressed,\n\t};\n\n\tif ( isSmall ) {\n\t\tcomputedSize ??= 'small';\n\t}\n\n\tif ( isPrimary ) {\n\t\tcomputedVariant ??= 'primary';\n\t}\n\n\tif ( isTertiary ) {\n\t\tcomputedVariant ??= 'tertiary';\n\t}\n\n\tif ( isSecondary ) {\n\t\tcomputedVariant ??= 'secondary';\n\t}\n\n\tif ( isDefault ) {\n\t\tdeprecated( 'wp.components.Button `isDefault` prop', {\n\t\t\tsince: '5.4',\n\t\t\talternative: 'variant=\"secondary\"',\n\t\t} );\n\n\t\tcomputedVariant ??= 'secondary';\n\t}\n\n\tif ( isLink ) {\n\t\tcomputedVariant ??= 'link';\n\t}\n\n\treturn {\n\t\t...newProps,\n\t\t...otherProps,\n\t\tsize: computedSize,\n\t\tvariant: computedVariant,\n\t};\n}\n\nexport function UnforwardedButton(\n\tprops: ButtonProps & DeprecatedButtonProps,\n\tref: ForwardedRef< any >\n) {\n\tconst {\n\t\t__next40pxDefaultSize,\n\t\tisBusy,\n\t\tisDestructive,\n\t\tclassName,\n\t\tdisabled,\n\t\ticon,\n\t\ticonPosition = 'left',\n\t\ticonSize,\n\t\tshowTooltip,\n\t\ttooltipPosition,\n\t\tshortcut,\n\t\tlabel,\n\t\tchildren,\n\t\tsize = 'default',\n\t\ttext,\n\t\tvariant,\n\t\t__experimentalIsFocusable: isFocusable,\n\t\tdescribedBy,\n\t\t...buttonOrAnchorProps\n\t} = useDeprecatedProps( props );\n\n\tconst {\n\t\thref,\n\t\ttarget,\n\t\t'aria-checked': ariaChecked,\n\t\t'aria-pressed': ariaPressed,\n\t\t'aria-selected': ariaSelected,\n\t\t...additionalProps\n\t} = 'href' in buttonOrAnchorProps\n\t\t? buttonOrAnchorProps\n\t\t: { href: undefined, target: undefined, ...buttonOrAnchorProps };\n\n\tconst instanceId = useInstanceId(\n\t\tButton,\n\t\t'components-button__description'\n\t);\n\n\tconst hasChildren =\n\t\t( 'string' === typeof children && !! children ) ||\n\t\t( Array.isArray( children ) &&\n\t\t\tchildren?.[ 0 ] &&\n\t\t\tchildren[ 0 ] !== null &&\n\t\t\t// Tooltip should not considered as a child\n\t\t\tchildren?.[ 0 ]?.props?.className !== 'components-tooltip' );\n\n\tconst truthyAriaPressedValues: ( typeof ariaPressed )[] = [\n\t\ttrue,\n\t\t'true',\n\t\t'mixed',\n\t];\n\n\tconst classes = classnames( 'components-button', className, {\n\t\t'is-next-40px-default-size': __next40pxDefaultSize,\n\t\t'is-secondary': variant === 'secondary',\n\t\t'is-primary': variant === 'primary',\n\t\t'is-small': size === 'small',\n\t\t'is-compact': size === 'compact',\n\t\t'is-tertiary': variant === 'tertiary',\n\n\t\t'is-pressed': truthyAriaPressedValues.includes( ariaPressed ),\n\t\t'is-pressed-mixed': ariaPressed === 'mixed',\n\n\t\t'is-busy': isBusy,\n\t\t'is-link': variant === 'link',\n\t\t'is-destructive': isDestructive,\n\t\t'has-text': !! icon && ( hasChildren || text ),\n\t\t'has-icon': !! icon,\n\t} );\n\n\tconst trulyDisabled = disabled && ! isFocusable;\n\tconst Tag = href !== undefined && ! trulyDisabled ? 'a' : 'button';\n\tconst buttonProps: ComponentPropsWithoutRef< 'button' > =\n\t\tTag === 'button'\n\t\t\t? {\n\t\t\t\t\ttype: 'button',\n\t\t\t\t\tdisabled: trulyDisabled,\n\t\t\t\t\t'aria-checked': ariaChecked,\n\t\t\t\t\t'aria-pressed': ariaPressed,\n\t\t\t\t\t'aria-selected': ariaSelected,\n\t\t\t }\n\t\t\t: {};\n\tconst anchorProps: ComponentPropsWithoutRef< 'a' > =\n\t\tTag === 'a' ? { href, target } : {};\n\n\tif ( disabled && isFocusable ) {\n\t\t// In this case, the button will be disabled, but still focusable and\n\t\t// perceivable by screen reader users.\n\t\tbuttonProps[ 'aria-disabled' ] = true;\n\t\tanchorProps[ 'aria-disabled' ] = true;\n\n\t\tfor ( const disabledEvent of disabledEventsOnDisabledButton ) {\n\t\t\tadditionalProps[ disabledEvent ] = ( event: MouseEvent ) => {\n\t\t\t\tif ( event ) {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\t// Should show the tooltip if...\n\tconst shouldShowTooltip =\n\t\t! trulyDisabled &&\n\t\t// An explicit tooltip is passed or...\n\t\t( ( showTooltip && !! label ) ||\n\t\t\t// There's a shortcut or...\n\t\t\t!! shortcut ||\n\t\t\t// There's a label and...\n\t\t\t( !! label &&\n\t\t\t\t// The children are empty and...\n\t\t\t\t! ( children as string | ReactElement[] )?.length &&\n\t\t\t\t// The tooltip is not explicitly disabled.\n\t\t\t\tfalse !== showTooltip ) );\n\n\tconst descriptionId = describedBy ? instanceId : undefined;\n\n\tconst describedById =\n\t\tadditionalProps[ 'aria-describedby' ] || descriptionId;\n\n\tconst commonProps = {\n\t\tclassName: classes,\n\t\t'aria-label': additionalProps[ 'aria-label' ] || label,\n\t\t'aria-describedby': describedById,\n\t\tref,\n\t};\n\n\tconst elementChildren = (\n\t\t<>\n\t\t\t{ icon && iconPosition === 'left' && (\n\t\t\t\t<Icon icon={ icon } size={ iconSize } />\n\t\t\t) }\n\t\t\t{ text && <>{ text }</> }\n\t\t\t{ children }\n\t\t\t{ icon && iconPosition === 'right' && (\n\t\t\t\t<Icon icon={ icon } size={ iconSize } />\n\t\t\t) }\n\t\t</>\n\t);\n\n\tconst element =\n\t\tTag === 'a' ? (\n\t\t\t<a\n\t\t\t\t{ ...anchorProps }\n\t\t\t\t{ ...( additionalProps as HTMLAttributes< HTMLAnchorElement > ) }\n\t\t\t\t{ ...commonProps }\n\t\t\t>\n\t\t\t\t{ elementChildren }\n\t\t\t</a>\n\t\t) : (\n\t\t\t<button\n\t\t\t\t{ ...buttonProps }\n\t\t\t\t{ ...( additionalProps as HTMLAttributes< HTMLButtonElement > ) }\n\t\t\t\t{ ...commonProps }\n\t\t\t>\n\t\t\t\t{ elementChildren }\n\t\t\t</button>\n\t\t);\n\n\t// In order to avoid some React reconciliation issues, we are always rendering\n\t// the `Tooltip` component even when `shouldShowTooltip` is `false`.\n\t// In order to make sure that the tooltip doesn't show when it shouldn't,\n\t// we don't pass the props to the `Tooltip` component.\n\tconst tooltipProps = shouldShowTooltip\n\t\t? {\n\t\t\t\ttext:\n\t\t\t\t\t( children as string | ReactElement[] )?.length &&\n\t\t\t\t\tdescribedBy\n\t\t\t\t\t\t? describedBy\n\t\t\t\t\t\t: label,\n\t\t\t\tshortcut,\n\t\t\t\tplacement:\n\t\t\t\t\ttooltipPosition &&\n\t\t\t\t\t// Convert legacy `position` values to be used with the new `placement` prop\n\t\t\t\t\tpositionToPlacement( tooltipPosition ),\n\t\t }\n\t\t: {};\n\n\treturn (\n\t\t<>\n\t\t\t<Tooltip { ...tooltipProps }>{ element }</Tooltip>\n\t\t\t{ describedBy && (\n\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t<span id={ descriptionId }>{ describedBy }</span>\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Lets users take actions and make choices with a single click or tap.\n *\n * ```jsx\n * import { Button } from '@wordpress/components';\n * const Mybutton = () => (\n * <Button\n * variant=\"primary\"\n * onClick={ handleClick }\n * >\n * Click here\n * </Button>\n * );\n * ```\n */\nexport const Button = forwardRef( UnforwardedButton );\nexport default Button;\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAYA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AA1BA;AACA;AACA;;AAUA;AACA;AACA;;AAKA;AACA;AACA;;AAOA,MAAMQ,8BAA8B,GAAG,CAAE,aAAa,EAAE,SAAS,CAAW;AAE5E,SAASC,kBAAkBA,CAAE;EAC5BC,SAAS;EACTC,SAAS;EACTC,WAA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AC,aAAA;IAAA,GACMZ,WAAW;IAAA,GACThB,eAAe;IAAA,GACjByB;EAAW,GAEdC,eACA,CAAC,GAEJ,IAAAC,MAAA,CAAAC,aAAA;IAAA,GACMd,WAAW;IAAA,GACTd,eAAe;IAAA,GACjByB;EAAW,GAEdC,eACK,CACR;;EAEF;EACA;EACA;EACA;EACA,MAAMM,YAAY,GAAGX,iBAAiB,GACnC;IACA/B,IAAI,EACDD,QAAQ,EAA+BiC,MAAM,IAC/C7B,WAAW,GACRA,WAAW,GACXL,KAAK;IACTD,QAAQ;IACR8C,SAAS,EACR/C,eAAe;IACf;IACA,IAAAgD,0BAAmB,EAAEhD,eAAgB;EACtC,CAAC,GACD,CAAC,CAAC;EAEL,OACC,IAAAyC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAClF,QAAA,CAAAoF,OAAO;IAAA,GAAME;EAAY,GAAKD,OAAkB,CAAC,EAChDtC,WAAW,IACZ,IAAAkC,MAAA,CAAAC,aAAA,EAAChF,eAAA,CAAAuF,cAAc,QACd,IAAAR,MAAA,CAAAC,aAAA;IAAMQ,EAAE,EAAGb;EAAe,GAAG9B,WAAmB,CACjC,CAEhB,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,MAAM,GAAAiC,OAAA,CAAAjC,MAAA,GAAG,IAAAkC,mBAAU,EAAEhE,iBAAkB,CAAC;AAAC,IAAAiE,QAAA,GAAAF,OAAA,CAAAP,OAAA,GACvC1B,MAAM"}
@@ -54,15 +54,8 @@ const UnconnectedColorPicker = (props, forwardedRef) => {
54
54
  onChange,
55
55
  defaultValue = '#fff',
56
56
  copyFormat,
57
- // Context
58
- onPickerDragStart,
59
- onPickerDragEnd,
60
57
  ...divProps
61
58
  } = (0, _context.useContextSystem)(props, 'ColorPicker');
62
- const [containerEl, setContainerEl] = (0, _element.useState)(null);
63
- const containerRef = node => {
64
- setContainerEl(node);
65
- };
66
59
 
67
60
  // Use a safe default value for the color and remove the possibility of `undefined`.
68
61
  const [color, setColor] = (0, _hooks.useControlledValue)({
@@ -79,15 +72,12 @@ const UnconnectedColorPicker = (props, forwardedRef) => {
79
72
  }, [debouncedSetColor]);
80
73
  const [colorType, setColorType] = (0, _element.useState)(copyFormat || 'hex');
81
74
  return (0, _react.createElement)(_styles.ColorfulWrapper, {
82
- ref: (0, _compose.useMergeRefs)([containerRef, forwardedRef]),
75
+ ref: forwardedRef,
83
76
  ...divProps
84
77
  }, (0, _react.createElement)(_picker.Picker, {
85
- containerEl: containerEl,
86
78
  onChange: handleChange,
87
79
  color: safeColordColor,
88
- enableAlpha: enableAlpha,
89
- onDragStart: onPickerDragStart,
90
- onDragEnd: onPickerDragEnd
80
+ enableAlpha: enableAlpha
91
81
  }), (0, _react.createElement)(_styles.AuxiliaryColorArtefactWrapper, null, (0, _react.createElement)(_styles.AuxiliaryColorArtefactHStackHeader, {
92
82
  justify: "space-between"
93
83
  }, (0, _react.createElement)(_context.ContextSystemProvider, {
@@ -1 +1 @@
1
- {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_element","_compose","_i18n","_context","_styles","_colorCopyButton","_colorInput","_picker","_hooks","extend","namesPlugin","options","label","value","BORDERLESS_SELECT_CONTROL_CONTEXT","InputBase","isBorderless","UnconnectedColorPicker","props","forwardedRef","enableAlpha","color","colorProp","onChange","defaultValue","copyFormat","onPickerDragStart","onPickerDragEnd","divProps","useContextSystem","containerEl","setContainerEl","useState","containerRef","node","setColor","useControlledValue","safeColordColor","useMemo","colord","debouncedSetColor","useDebounce","handleChange","useCallback","nextValue","toHex","colorType","setColorType","_react","createElement","ColorfulWrapper","ref","useMergeRefs","Picker","onDragStart","onDragEnd","AuxiliaryColorArtefactWrapper","AuxiliaryColorArtefactHStackHeader","justify","ContextSystemProvider","SelectControl","__nextHasNoMarginBottom","nextColorType","__","hideLabelFromVision","ColorCopyButton","ColorInputWrapper","direction","gap","ColorInput","ColorPicker","exports","contextConnect","_default","default"],"sources":["@wordpress/components/src/color-picker/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport type { Colord } from 'colord';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useState, useMemo } from '@wordpress/element';\nimport { useDebounce, useMergeRefs } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tContextSystemProvider,\n} from '../context';\nimport {\n\tColorfulWrapper,\n\tSelectControl,\n\tAuxiliaryColorArtefactWrapper,\n\tAuxiliaryColorArtefactHStackHeader,\n\tColorInputWrapper,\n} from './styles';\nimport { ColorCopyButton } from './color-copy-button';\nimport { ColorInput } from './color-input';\nimport { Picker } from './picker';\nimport { useControlledValue } from '../utils/hooks';\n\nimport type { ColorPickerProps, ColorType } from './types';\n\nextend( [ namesPlugin ] );\n\nconst options = [\n\t{ label: 'RGB', value: 'rgb' as const },\n\t{ label: 'HSL', value: 'hsl' as const },\n\t{ label: 'Hex', value: 'hex' as const },\n];\n\n// `isBorderless` is still experimental and not a public prop for InputControl yet.\nconst BORDERLESS_SELECT_CONTROL_CONTEXT = { InputBase: { isBorderless: true } };\n\nconst UnconnectedColorPicker = (\n\tprops: ColorPickerProps,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tenableAlpha = false,\n\t\tcolor: colorProp,\n\t\tonChange,\n\t\tdefaultValue = '#fff',\n\t\tcopyFormat,\n\n\t\t// Context\n\t\tonPickerDragStart,\n\t\tonPickerDragEnd,\n\t\t...divProps\n\t} = useContextSystem<\n\t\tColorPickerProps & {\n\t\t\tonPickerDragStart?: ( event: MouseEvent ) => void;\n\t\t\tonPickerDragEnd?: ( event: MouseEvent ) => void;\n\t\t}\n\t>( props, 'ColorPicker' );\n\n\tconst [ containerEl, setContainerEl ] = useState< HTMLElement | null >(\n\t\tnull\n\t);\n\tconst containerRef = ( node: HTMLElement | null ) => {\n\t\tsetContainerEl( node );\n\t};\n\n\t// Use a safe default value for the color and remove the possibility of `undefined`.\n\tconst [ color, setColor ] = useControlledValue( {\n\t\tonChange,\n\t\tvalue: colorProp,\n\t\tdefaultValue,\n\t} );\n\n\tconst safeColordColor = useMemo( () => {\n\t\treturn colord( color || '' );\n\t}, [ color ] );\n\n\tconst debouncedSetColor = useDebounce( setColor );\n\n\tconst handleChange = useCallback(\n\t\t( nextValue: Colord ) => {\n\t\t\tdebouncedSetColor( nextValue.toHex() );\n\t\t},\n\t\t[ debouncedSetColor ]\n\t);\n\n\tconst [ colorType, setColorType ] = useState< ColorType >(\n\t\tcopyFormat || 'hex'\n\t);\n\n\treturn (\n\t\t<ColorfulWrapper\n\t\t\tref={ useMergeRefs( [ containerRef, forwardedRef ] ) }\n\t\t\t{ ...divProps }\n\t\t>\n\t\t\t<Picker\n\t\t\t\tcontainerEl={ containerEl }\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tcolor={ safeColordColor }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\tonDragStart={ onPickerDragStart }\n\t\t\t\tonDragEnd={ onPickerDragEnd }\n\t\t\t/>\n\t\t\t<AuxiliaryColorArtefactWrapper>\n\t\t\t\t<AuxiliaryColorArtefactHStackHeader justify=\"space-between\">\n\t\t\t\t\t<ContextSystemProvider\n\t\t\t\t\t\tvalue={ BORDERLESS_SELECT_CONTROL_CONTEXT }\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ colorType }\n\t\t\t\t\t\t\tonChange={ ( nextColorType ) =>\n\t\t\t\t\t\t\t\tsetColorType( nextColorType as ColorType )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Color format' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ContextSystemProvider>\n\t\t\t\t\t<ColorCopyButton\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tcolorType={ copyFormat || colorType }\n\t\t\t\t\t/>\n\t\t\t\t</AuxiliaryColorArtefactHStackHeader>\n\t\t\t\t<ColorInputWrapper direction=\"column\" gap={ 2 }>\n\t\t\t\t\t<ColorInput\n\t\t\t\t\t\tcolorType={ colorType }\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t</ColorInputWrapper>\n\t\t\t</AuxiliaryColorArtefactWrapper>\n\t\t</ColorfulWrapper>\n\t);\n};\n\nexport const ColorPicker = contextConnect(\n\tUnconnectedColorPicker,\n\t'ColorPicker'\n);\n\nexport default ColorPicker;\n"],"mappings":";;;;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAP,OAAA;AAOA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAjCA;AACA;AACA;;AAMA;AACA;AACA;;AAKA;AACA;AACA;;AAoBA,IAAAY,cAAM,EAAE,CAAEC,cAAW,CAAG,CAAC;AAEzB,MAAMC,OAAO,GAAG,CACf;EAAEC,KAAK,EAAE,KAAK;EAAEC,KAAK,EAAE;AAAe,CAAC,EACvC;EAAED,KAAK,EAAE,KAAK;EAAEC,KAAK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AG,EAAG;EAAG,GAC9C,IAAApB,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAA+D,UAAU;IACVvB,SAAS,EAAGA,SAAW;IACvBzB,KAAK,EAAGgB,eAAiB;IACzBd,QAAQ,EAAGmB,YAAc;IACzBtB,WAAW,EAAGA;EAAa,CAC3B,CACiB,CACW,CACf,CAAC;AAEpB,CAAC;AAEM,MAAMkD,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAAE,uBAAc,EACxCvD,sBAAsB,EACtB,aACD,CAAC;AAAC,IAAAwD,QAAA,GAAAF,OAAA,CAAAG,OAAA,GAEaJ,WAAW"}
1
+ {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_element","_compose","_i18n","_context","_styles","_colorCopyButton","_colorInput","_picker","_hooks","extend","namesPlugin","options","label","value","BORDERLESS_SELECT_CONTROL_CONTEXT","InputBase","isBorderless","UnconnectedColorPicker","props","forwardedRef","enableAlpha","color","colorProp","onChange","defaultValue","copyFormat","divProps","useContextSystem","setColor","useControlledValue","safeColordColor","useMemo","colord","debouncedSetColor","useDebounce","handleChange","useCallback","nextValue","toHex","colorType","setColorType","useState","_react","createElement","ColorfulWrapper","ref","Picker","AuxiliaryColorArtefactWrapper","AuxiliaryColorArtefactHStackHeader","justify","ContextSystemProvider","SelectControl","__nextHasNoMarginBottom","nextColorType","__","hideLabelFromVision","ColorCopyButton","ColorInputWrapper","direction","gap","ColorInput","ColorPicker","exports","contextConnect","_default","default"],"sources":["@wordpress/components/src/color-picker/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport type { Colord } from 'colord';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useState, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tContextSystemProvider,\n} from '../context';\nimport {\n\tColorfulWrapper,\n\tSelectControl,\n\tAuxiliaryColorArtefactWrapper,\n\tAuxiliaryColorArtefactHStackHeader,\n\tColorInputWrapper,\n} from './styles';\nimport { ColorCopyButton } from './color-copy-button';\nimport { ColorInput } from './color-input';\nimport { Picker } from './picker';\nimport { useControlledValue } from '../utils/hooks';\n\nimport type { ColorPickerProps, ColorType } from './types';\n\nextend( [ namesPlugin ] );\n\nconst options = [\n\t{ label: 'RGB', value: 'rgb' as const },\n\t{ label: 'HSL', value: 'hsl' as const },\n\t{ label: 'Hex', value: 'hex' as const },\n];\n\n// `isBorderless` is still experimental and not a public prop for InputControl yet.\nconst BORDERLESS_SELECT_CONTROL_CONTEXT = { InputBase: { isBorderless: true } };\n\nconst UnconnectedColorPicker = (\n\tprops: ColorPickerProps,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tenableAlpha = false,\n\t\tcolor: colorProp,\n\t\tonChange,\n\t\tdefaultValue = '#fff',\n\t\tcopyFormat,\n\t\t...divProps\n\t} = useContextSystem( props, 'ColorPicker' );\n\n\t// Use a safe default value for the color and remove the possibility of `undefined`.\n\tconst [ color, setColor ] = useControlledValue( {\n\t\tonChange,\n\t\tvalue: colorProp,\n\t\tdefaultValue,\n\t} );\n\n\tconst safeColordColor = useMemo( () => {\n\t\treturn colord( color || '' );\n\t}, [ color ] );\n\n\tconst debouncedSetColor = useDebounce( setColor );\n\n\tconst handleChange = useCallback(\n\t\t( nextValue: Colord ) => {\n\t\t\tdebouncedSetColor( nextValue.toHex() );\n\t\t},\n\t\t[ debouncedSetColor ]\n\t);\n\n\tconst [ colorType, setColorType ] = useState< ColorType >(\n\t\tcopyFormat || 'hex'\n\t);\n\n\treturn (\n\t\t<ColorfulWrapper ref={ forwardedRef } { ...divProps }>\n\t\t\t<Picker\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tcolor={ safeColordColor }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t\t<AuxiliaryColorArtefactWrapper>\n\t\t\t\t<AuxiliaryColorArtefactHStackHeader justify=\"space-between\">\n\t\t\t\t\t<ContextSystemProvider\n\t\t\t\t\t\tvalue={ BORDERLESS_SELECT_CONTROL_CONTEXT }\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ colorType }\n\t\t\t\t\t\t\tonChange={ ( nextColorType ) =>\n\t\t\t\t\t\t\t\tsetColorType( nextColorType as ColorType )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Color format' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ContextSystemProvider>\n\t\t\t\t\t<ColorCopyButton\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tcolorType={ copyFormat || colorType }\n\t\t\t\t\t/>\n\t\t\t\t</AuxiliaryColorArtefactHStackHeader>\n\t\t\t\t<ColorInputWrapper direction=\"column\" gap={ 2 }>\n\t\t\t\t\t<ColorInput\n\t\t\t\t\t\tcolorType={ colorType }\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t</ColorInputWrapper>\n\t\t\t</AuxiliaryColorArtefactWrapper>\n\t\t</ColorfulWrapper>\n\t);\n};\n\nexport const ColorPicker = contextConnect(\n\tUnconnectedColorPicker,\n\t'ColorPicker'\n);\n\nexport default ColorPicker;\n"],"mappings":";;;;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,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OAAA,CAAAqD,iBAAiB;IAACC,SAAS,EAAC,QAAQ;IAACC,GAAG,EAAG;EAAG,GAC9C,IAAAjB,MAAA,CAAAC,aAAA,EAACrC,WAAA,CAAAsD,UAAU;IACVrB,SAAS,EAAGA,SAAW;IACvBlB,KAAK,EAAGS,eAAiB;IACzBP,QAAQ,EAAGY,YAAc;IACzBf,WAAW,EAAGA;EAAa,CAC3B,CACiB,CACW,CACf,CAAC;AAEpB,CAAC;AAEM,MAAMyC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAAE,uBAAc,EACxC9C,sBAAsB,EACtB,aACD,CAAC;AAAC,IAAA+C,QAAA,GAAAF,OAAA,CAAAG,OAAA,GAEaJ,WAAW"}
@@ -16,94 +16,35 @@ var _element = require("@wordpress/element");
16
16
  * WordPress dependencies
17
17
  */
18
18
 
19
- /**
20
- * Track the start and the end of drag pointer events related to controlling
21
- * the picker's saturation / hue / alpha, and fire the corresponding callbacks.
22
- * This is particularly useful to implement synergies like the one with the
23
- * `Popover` component, where a pointer events "trap" is rendered while
24
- * the user is dragging the pointer to avoid potential interference with iframe
25
- * elements.
26
- *
27
- * @param props
28
- * @param props.containerEl
29
- * @param props.onDragStart
30
- * @param props.onDragEnd
31
- */
32
- const useOnPickerDrag = ({
33
- containerEl,
34
- onDragStart,
35
- onDragEnd
36
- }) => {
37
- const isDragging = (0, _element.useRef)(false);
38
- const leftWhileDragging = (0, _element.useRef)(false);
39
- (0, _element.useEffect)(() => {
40
- if (!containerEl || !onDragStart && !onDragEnd) {
41
- return;
42
- }
43
- const interactiveElements = [containerEl.querySelector('.react-colorful__saturation'), containerEl.querySelector('.react-colorful__hue'), containerEl.querySelector('.react-colorful__alpha')].filter(el => !!el);
44
- if (interactiveElements.length === 0) {
45
- return;
46
- }
47
- const doc = containerEl.ownerDocument;
48
- const onPointerUp = event => {
49
- isDragging.current = false;
50
- leftWhileDragging.current = false;
51
- onDragEnd?.(event);
52
- };
53
- const onPointerDown = event => {
54
- isDragging.current = true;
55
- onDragStart?.(event);
56
- };
57
- const onPointerLeave = () => {
58
- leftWhileDragging.current = isDragging.current;
59
- };
60
-
61
- // Try to detect if the user released the pointer while away from the
62
- // current window. If the check is successfull, the dragEnd callback will
63
- // called as soon as the pointer re-enters the window (better late than never)
64
- const onPointerEnter = event => {
65
- const noPointerButtonsArePressed = event.buttons === 0;
66
- if (leftWhileDragging.current && noPointerButtonsArePressed) {
67
- onPointerUp(event);
68
- }
69
- };
70
-
71
- // The pointerdown event is added on the interactive elements,
72
- // while the remaining events are added on the document object since
73
- // the pointer wouldn't necessarily be hovering the initial interactive
74
- // element at that point.
75
- interactiveElements.forEach(el => el.addEventListener('pointerdown', onPointerDown));
76
- doc.addEventListener('pointerup', onPointerUp);
77
- doc.addEventListener('pointerenter', onPointerEnter);
78
- doc.addEventListener('pointerleave', onPointerLeave);
79
- return () => {
80
- interactiveElements.forEach(el => el.removeEventListener('pointerdown', onPointerDown));
81
- doc.removeEventListener('pointerup', onPointerUp);
82
- doc.removeEventListener('pointerenter', onPointerEnter);
83
- doc.removeEventListener('pointerleave', onPointerUp);
84
- };
85
- }, [onDragStart, onDragEnd, containerEl]);
86
- };
87
19
  const Picker = ({
88
20
  color,
89
21
  enableAlpha,
90
- onChange,
91
- onDragStart,
92
- onDragEnd,
93
- containerEl
22
+ onChange
94
23
  }) => {
95
24
  const Component = enableAlpha ? _reactColorful.RgbaStringColorPicker : _reactColorful.RgbStringColorPicker;
96
25
  const rgbColor = (0, _element.useMemo)(() => color.toRgbString(), [color]);
97
- useOnPickerDrag({
98
- containerEl,
99
- onDragStart,
100
- onDragEnd
101
- });
102
26
  return (0, _react.createElement)(Component, {
103
27
  color: rgbColor,
104
28
  onChange: nextColor => {
105
29
  onChange((0, _colord.colord)(nextColor));
106
30
  }
31
+ // Pointer capture fortifies drag gestures so that they continue to
32
+ // work while dragging outside the component over objects like
33
+ // iframes. If a newer version of react-colorful begins to employ
34
+ // pointer capture this will be redundant and should be removed.
35
+ ,
36
+ onPointerDown: ({
37
+ currentTarget,
38
+ pointerId
39
+ }) => {
40
+ currentTarget.setPointerCapture(pointerId);
41
+ },
42
+ onPointerUp: ({
43
+ currentTarget,
44
+ pointerId
45
+ }) => {
46
+ currentTarget.releasePointerCapture(pointerId);
47
+ }
107
48
  });
108
49
  };
109
50
  exports.Picker = Picker;
@@ -1 +1 @@
1
- {"version":3,"names":["_reactColorful","require","_colord","_element","useOnPickerDrag","containerEl","onDragStart","onDragEnd","isDragging","useRef","leftWhileDragging","useEffect","interactiveElements","querySelector","filter","el","length","doc","ownerDocument","onPointerUp","event","current","onPointerDown","onPointerLeave","onPointerEnter","noPointerButtonsArePressed","buttons","forEach","addEventListener","removeEventListener","Picker","color","enableAlpha","onChange","Component","RgbaStringColorPicker","RgbStringColorPicker","rgbColor","useMemo","toRgbString","_react","createElement","nextColor","colord","exports"],"sources":["@wordpress/components/src/color-picker/picker.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { RgbStringColorPicker, RgbaStringColorPicker } from 'react-colorful';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect, useRef } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport type { PickerProps } from './types';\n\n/**\n * Track the start and the end of drag pointer events related to controlling\n * the picker's saturation / hue / alpha, and fire the corresponding callbacks.\n * This is particularly useful to implement synergies like the one with the\n * `Popover` component, where a pointer events \"trap\" is rendered while\n * the user is dragging the pointer to avoid potential interference with iframe\n * elements.\n *\n * @param props\n * @param props.containerEl\n * @param props.onDragStart\n * @param props.onDragEnd\n */\nconst useOnPickerDrag = ( {\n\tcontainerEl,\n\tonDragStart,\n\tonDragEnd,\n}: Pick< PickerProps, 'containerEl' | 'onDragStart' | 'onDragEnd' > ) => {\n\tconst isDragging = useRef( false );\n\tconst leftWhileDragging = useRef( false );\n\tuseEffect( () => {\n\t\tif ( ! containerEl || ( ! onDragStart && ! onDragEnd ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst interactiveElements = [\n\t\t\tcontainerEl.querySelector( '.react-colorful__saturation' ),\n\t\t\tcontainerEl.querySelector( '.react-colorful__hue' ),\n\t\t\tcontainerEl.querySelector( '.react-colorful__alpha' ),\n\t\t].filter( ( el ) => !! el ) as Element[];\n\n\t\tif ( interactiveElements.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst doc = containerEl.ownerDocument;\n\n\t\tconst onPointerUp: EventListener = ( event ) => {\n\t\t\tisDragging.current = false;\n\t\t\tleftWhileDragging.current = false;\n\t\t\tonDragEnd?.( event as MouseEvent );\n\t\t};\n\n\t\tconst onPointerDown: EventListener = ( event ) => {\n\t\t\tisDragging.current = true;\n\t\t\tonDragStart?.( event as MouseEvent );\n\t\t};\n\n\t\tconst onPointerLeave: EventListener = () => {\n\t\t\tleftWhileDragging.current = isDragging.current;\n\t\t};\n\n\t\t// Try to detect if the user released the pointer while away from the\n\t\t// current window. If the check is successfull, the dragEnd callback will\n\t\t// called as soon as the pointer re-enters the window (better late than never)\n\t\tconst onPointerEnter: EventListener = ( event ) => {\n\t\t\tconst noPointerButtonsArePressed =\n\t\t\t\t( event as PointerEvent ).buttons === 0;\n\n\t\t\tif ( leftWhileDragging.current && noPointerButtonsArePressed ) {\n\t\t\t\tonPointerUp( event );\n\t\t\t}\n\t\t};\n\n\t\t// The pointerdown event is added on the interactive elements,\n\t\t// while the remaining events are added on the document object since\n\t\t// the pointer wouldn't necessarily be hovering the initial interactive\n\t\t// element at that point.\n\t\tinteractiveElements.forEach( ( el ) =>\n\t\t\tel.addEventListener( 'pointerdown', onPointerDown )\n\t\t);\n\t\tdoc.addEventListener( 'pointerup', onPointerUp );\n\t\tdoc.addEventListener( 'pointerenter', onPointerEnter );\n\t\tdoc.addEventListener( 'pointerleave', onPointerLeave );\n\n\t\treturn () => {\n\t\t\tinteractiveElements.forEach( ( el ) =>\n\t\t\t\tel.removeEventListener( 'pointerdown', onPointerDown )\n\t\t\t);\n\t\t\tdoc.removeEventListener( 'pointerup', onPointerUp );\n\t\t\tdoc.removeEventListener( 'pointerenter', onPointerEnter );\n\t\t\tdoc.removeEventListener( 'pointerleave', onPointerUp );\n\t\t};\n\t}, [ onDragStart, onDragEnd, containerEl ] );\n};\n\nexport const Picker = ( {\n\tcolor,\n\tenableAlpha,\n\tonChange,\n\tonDragStart,\n\tonDragEnd,\n\tcontainerEl,\n}: PickerProps ) => {\n\tconst Component = enableAlpha\n\t\t? RgbaStringColorPicker\n\t\t: RgbStringColorPicker;\n\tconst rgbColor = useMemo( () => color.toRgbString(), [ color ] );\n\n\tuseOnPickerDrag( { containerEl, onDragStart, onDragEnd } );\n\n\treturn (\n\t\t<Component\n\t\t\tcolor={ rgbColor }\n\t\t\tonChange={ ( nextColor ) => {\n\t\t\t\tonChange( colord( nextColor ) );\n\t\t\t} }\n\t\t/>\n\t);\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,eAAe,GAAGA,CAAE;EACzBC,WAAW;EACXC,WAAW;EACXC;AACiE,CAAC,KAAM;EACxE,MAAMC,UAAU,GAAG,IAAAC,eAAM,EAAE,KAAM,CAAC;EAClC,MAAMC,iBAAiB,GAAG,IAAAD,eAAM,EAAE,KAAM,CAAC;EACzC,IAAAE,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEN,WAAW,IAAM,CAAEC,WAAW,IAAI,CAAEC,SAAW,EAAG;MACxD;IACD;IACA,MAAMK,mBAAmB,GAAG,CAC3BP,WAAW,CAACQ,aAAa,CAAE,6BAA8B,CAAC,EAC1DR,WAAW,CAACQ,aAAa,CAAE,sBAAuB,CAAC,EACnDR,WAAW,CAACQ,aAAa,CAAE,wBAAyB,CAAC,CACrD,CAACC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CAAE,WAAW,EAAEV,WAAY,CAAC;MACnDF,GAAG,CAACY,mBAAmB,CAAE,cAAc,EAAEL,cAAe,CAAC;MACzDP,GAAG,CAACY,mBAAmB,CAAE,cAAc,EAAEV,WAAY,CAAC;IACvD,CAAC;EACF,CAAC,EAAE,CAAEb,WAAW,EAAEC,SAAS,EAAEF,WAAW,CAAG,CAAC;AAC7C,CAAC;AAEM,MAAMyB,MAAM,GAAGA,CAAE;EACvBC,KAAK;EACLC,WAAW;EACXC,QAAQ;EACR3B,WAAW;EACXC,SAAS;EACTF;AACY,CAAC,KAAM;EACnB,MAAM6B,SAAS,GAAGF,WAAW,GAC1BG,oCAAqB,GACrBC,mCAAoB;EACvB,MAAMC,QAAQ,GAAG,IAAAC,gBAAO,EAAE,MAAMP,KAAK,CAACQ,WAAW,CAAC,CAAC,EAAE,CAAER,KAAK,CAAG,CAAC;EAEhE3B,eAAe,CAAE;IAAEC,WAAW;IAAEC,WAAW;IAAEC;EAAU,CAAE,CAAC;EAE1D,OACC,IAAAiC,MAAA,CAAAC,aAAA,EAACP,SAAS;IACTH,KAAK,EAAGM,QAAU;IAClBJ,QAAQ,EAAKS,SAAS,IAAM;MAC3BT,QAAQ,CAAE,IAAAU,cAAM,EAAED,SAAU,CAAE,CAAC;IAChC;EAAG,CACH,CAAC;AAEJ,CAAC;AAACE,OAAA,CAAAd,MAAA,GAAAA,MAAA"}
1
+ {"version":3,"names":["_reactColorful","require","_colord","_element","Picker","color","enableAlpha","onChange","Component","RgbaStringColorPicker","RgbStringColorPicker","rgbColor","useMemo","toRgbString","_react","createElement","nextColor","colord","onPointerDown","currentTarget","pointerId","setPointerCapture","onPointerUp","releasePointerCapture","exports"],"sources":["@wordpress/components/src/color-picker/picker.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { RgbStringColorPicker, RgbaStringColorPicker } from 'react-colorful';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport type { PickerProps } from './types';\n\nexport const Picker = ( { color, enableAlpha, onChange }: PickerProps ) => {\n\tconst Component = enableAlpha\n\t\t? RgbaStringColorPicker\n\t\t: RgbStringColorPicker;\n\tconst rgbColor = useMemo( () => color.toRgbString(), [ color ] );\n\n\treturn (\n\t\t<Component\n\t\t\tcolor={ rgbColor }\n\t\t\tonChange={ ( nextColor ) => {\n\t\t\t\tonChange( colord( nextColor ) );\n\t\t\t} }\n\t\t\t// Pointer capture fortifies drag gestures so that they continue to\n\t\t\t// work while dragging outside the component over objects like\n\t\t\t// iframes. If a newer version of react-colorful begins to employ\n\t\t\t// pointer capture this will be redundant and should be removed.\n\t\t\tonPointerDown={ ( { currentTarget, pointerId } ) => {\n\t\t\t\tcurrentTarget.setPointerCapture( pointerId );\n\t\t\t} }\n\t\t\tonPointerUp={ ( { currentTarget, pointerId } ) => {\n\t\t\t\tcurrentTarget.releasePointerCapture( pointerId );\n\t\t\t} }\n\t\t/>\n\t);\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAOO,MAAMG,MAAM,GAAGA,CAAE;EAAEC,KAAK;EAAEC,WAAW;EAAEC;AAAsB,CAAC,KAAM;EAC1E,MAAMC,SAAS,GAAGF,WAAW,GAC1BG,oCAAqB,GACrBC,mCAAoB;EACvB,MAAMC,QAAQ,GAAG,IAAAC,gBAAO,EAAE,MAAMP,KAAK,CAACQ,WAAW,CAAC,CAAC,EAAE,CAAER,KAAK,CAAG,CAAC;EAEhE,OACC,IAAAS,MAAA,CAAAC,aAAA,EAACP,SAAS;IACTH,KAAK,EAAGM,QAAU;IAClBJ,QAAQ,EAAKS,SAAS,IAAM;MAC3BT,QAAQ,CAAE,IAAAU,cAAM,EAAED,SAAU,CAAE,CAAC;IAChC;IACA;IACA;IACA;IACA;IAAA;IACAE,aAAa,EAAGA,CAAE;MAAEC,aAAa;MAAEC;IAAU,CAAC,KAAM;MACnDD,aAAa,CAACE,iBAAiB,CAAED,SAAU,CAAC;IAC7C,CAAG;IACHE,WAAW,EAAGA,CAAE;MAAEH,aAAa;MAAEC;IAAU,CAAC,KAAM;MACjDD,aAAa,CAACI,qBAAqB,CAAEH,SAAU,CAAC;IACjD;EAAG,CACH,CAAC;AAEJ,CAAC;AAACI,OAAA,CAAApB,MAAA,GAAAA,MAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/color-picker/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tColord,\n\tHslColor,\n\tHsvaColor,\n\tHsvColor,\n\tRgbaColor,\n\tRgbColor,\n} from 'colord';\nimport type { HslaColor } from 'react-colorful';\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport type { useDeprecatedProps } from './use-deprecated-props';\n\nexport type ColorType = 'rgb' | 'hsl' | 'hex';\nexport type ColorCopyButtonProps = {\n\tcolor: Colord;\n\tcolorType: ColorType;\n};\n\nexport type LegacyAdapterProps = Parameters< typeof useDeprecatedProps >[ 0 ];\n\nexport type ColorPickerProps = WordPressComponentProps<\n\t{\n\t\t/**\n\t\t * When `true` the color picker will display the alpha channel both in\n\t\t * the bottom inputs as well as in the color picker itself.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tenableAlpha?: boolean;\n\t\t/**\n\t\t * The current color value to display in the picker.\n\t\t * Must be a hex or hex8 string.\n\t\t */\n\t\tcolor?: string;\n\t\t/**\n\t\t * Fired when the color changes. Always passes a hex or hex8 color string.\n\t\t */\n\t\tonChange?: ( color: string ) => void;\n\t\t/**\n\t\t * An optional default value to use for the color picker.\n\t\t */\n\t\tdefaultValue?: string;\n\t\t/**\n\t\t * The format to copy when clicking the displayed color format.\n\t\t */\n\t\tcopyFormat?: ColorType;\n\t},\n\t'div',\n\tfalse\n>;\n\nexport interface PickerProps {\n\tcolor: Colord;\n\tenableAlpha: boolean;\n\tonChange: ( nextColor: Colord ) => void;\n\tcontainerEl: HTMLElement | null;\n\tonDragStart?: ( event: MouseEvent ) => void;\n\tonDragEnd?: ( event: MouseEvent ) => void;\n}\n\nexport interface ColorInputProps {\n\tcolorType: 'hsl' | 'hex' | 'rgb';\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\nexport interface InputWithSliderProps {\n\tmin: number;\n\tmax: number;\n\tvalue: number;\n\tlabel: string;\n\tabbreviation: string;\n\tonChange: ( value: number ) => void;\n}\n\nexport interface HexInputProps {\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\nexport interface HslInputProps {\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\nexport interface RgbInputProps {\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\n/**\n * @deprecated\n */\nexport type LegacyColor =\n\t| string\n\t| {\n\t\t\thex: string;\n\t\t\thsl: HslColor | HslaColor;\n\t\t\thsv: HsvColor | HsvaColor;\n\t\t\trgb: RgbColor | RgbaColor;\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t */\n\t\t\toldHue: number;\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t */\n\t\t\tsource: 'hex';\n\t };\n\n/**\n * @deprecated\n */\nexport interface LegacyProps {\n\tcolor?: LegacyColor;\n\t/**\n\t * @deprecated\n\t */\n\tonChangeComplete: ( colors: LegacyColor ) => void;\n\t/**\n\t * @deprecated\n\t */\n\toldHue: string;\n\tclassName: string;\n\t/**\n\t * @deprecated\n\t */\n\tdisableAlpha: boolean;\n\tonChange?: never;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/color-picker/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tColord,\n\tHslColor,\n\tHsvaColor,\n\tHsvColor,\n\tRgbaColor,\n\tRgbColor,\n} from 'colord';\nimport type { HslaColor } from 'react-colorful';\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport type { useDeprecatedProps } from './use-deprecated-props';\n\nexport type ColorType = 'rgb' | 'hsl' | 'hex';\nexport type ColorCopyButtonProps = {\n\tcolor: Colord;\n\tcolorType: ColorType;\n};\n\nexport type LegacyAdapterProps = Parameters< typeof useDeprecatedProps >[ 0 ];\n\nexport type ColorPickerProps = WordPressComponentProps<\n\t{\n\t\t/**\n\t\t * When `true` the color picker will display the alpha channel both in\n\t\t * the bottom inputs as well as in the color picker itself.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tenableAlpha?: boolean;\n\t\t/**\n\t\t * The current color value to display in the picker.\n\t\t * Must be a hex or hex8 string.\n\t\t */\n\t\tcolor?: string;\n\t\t/**\n\t\t * Fired when the color changes. Always passes a hex or hex8 color string.\n\t\t */\n\t\tonChange?: ( color: string ) => void;\n\t\t/**\n\t\t * An optional default value to use for the color picker.\n\t\t */\n\t\tdefaultValue?: string;\n\t\t/**\n\t\t * The format to copy when clicking the displayed color format.\n\t\t */\n\t\tcopyFormat?: ColorType;\n\t},\n\t'div',\n\tfalse\n>;\n\nexport interface PickerProps {\n\tcolor: Colord;\n\tenableAlpha: boolean;\n\tonChange: ( nextColor: Colord ) => void;\n}\n\nexport interface ColorInputProps {\n\tcolorType: 'hsl' | 'hex' | 'rgb';\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\nexport interface InputWithSliderProps {\n\tmin: number;\n\tmax: number;\n\tvalue: number;\n\tlabel: string;\n\tabbreviation: string;\n\tonChange: ( value: number ) => void;\n}\n\nexport interface HexInputProps {\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\nexport interface HslInputProps {\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\nexport interface RgbInputProps {\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\n/**\n * @deprecated\n */\nexport type LegacyColor =\n\t| string\n\t| {\n\t\t\thex: string;\n\t\t\thsl: HslColor | HslaColor;\n\t\t\thsv: HsvColor | HsvaColor;\n\t\t\trgb: RgbColor | RgbaColor;\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t */\n\t\t\toldHue: number;\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t */\n\t\t\tsource: 'hex';\n\t };\n\n/**\n * @deprecated\n */\nexport interface LegacyProps {\n\tcolor?: LegacyColor;\n\t/**\n\t * @deprecated\n\t */\n\tonChangeComplete: ( colors: LegacyColor ) => void;\n\t/**\n\t * @deprecated\n\t */\n\toldHue: string;\n\tclassName: string;\n\t/**\n\t * @deprecated\n\t */\n\tdisableAlpha: boolean;\n\tonChange?: never;\n}\n"],"mappings":""}
@@ -8,6 +8,7 @@ exports.default = void 0;
8
8
  var _react = require("react");
9
9
  var Ariakit = _interopRequireWildcard(require("@ariakit/react"));
10
10
  var _customSelect = _interopRequireDefault(require("../custom-select"));
11
+ var _item = _interopRequireDefault(require("../item"));
11
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
14
  /**
@@ -19,7 +20,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
19
20
  * Internal dependencies
20
21
  */
21
22
 
22
- function CustomSelect(props) {
23
+ function CustomSelectControlV2(props) {
23
24
  const {
24
25
  defaultValue,
25
26
  onChange,
@@ -37,5 +38,6 @@ function CustomSelect(props) {
37
38
  store: store
38
39
  });
39
40
  }
40
- var _default = exports.default = CustomSelect;
41
+ CustomSelectControlV2.Item = _item.default;
42
+ var _default = exports.default = CustomSelectControlV2;
41
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_customSelect","_interopRequireDefault","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","CustomSelect","props","defaultValue","onChange","value","restProps","store","useSelectStore","setValue","nextValue","_react","createElement","_default","exports"],"sources":["@wordpress/components/src/custom-select-control-v2/default-component/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport * as Ariakit from '@ariakit/react';\n/**\n * Internal dependencies\n */\nimport _CustomSelect from '../custom-select';\nimport type { CustomSelectProps } from '../types';\nimport type { WordPressComponentProps } from '../../context';\n\nfunction CustomSelect(\n\tprops: WordPressComponentProps< CustomSelectProps, 'button', false >\n) {\n\tconst { defaultValue, onChange, value, ...restProps } = props;\n\t// Forward props + store from v2 implementation\n\tconst store = Ariakit.useSelectStore( {\n\t\tsetValue: ( nextValue ) => onChange?.( nextValue ),\n\t\tdefaultValue,\n\t\tvalue,\n\t} );\n\n\treturn <_CustomSelect { ...restProps } store={ store } />;\n}\n\nexport default CustomSelect;\n"],"mappings":";;;;;;;;AAIA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA6C,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,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A,MAAMK,KAAK,GAAGhC,OAAO,CAACiC,cAAc,CAAE;IACrCC,QAAQ,EAAIC,SAAS,IAAMN,QAAQ,GAAIM,SAAU,CAAC;IAClDP,YAAY;IACZE;EACD,CAAE,CAAC;EAEH,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAAClC,aAAA,CAAAQ,OAAa;IAAA,GAAMoB,SAAS;IAAGC,KAAK,EAAGA;EAAO,CAAE,CAAC;AAC1D;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAA5B,OAAA,GAEce,YAAY"}
1
+ {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_customSelect","_interopRequireDefault","_item","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","CustomSelectControlV2","props","defaultValue","onChange","value","restProps","store","useSelectStore","setValue","nextValue","_react","createElement","Item","_default","exports"],"sources":["@wordpress/components/src/custom-select-control-v2/default-component/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport * as Ariakit from '@ariakit/react';\n/**\n * Internal dependencies\n */\nimport _CustomSelect from '../custom-select';\nimport type { CustomSelectProps } from '../types';\nimport type { WordPressComponentProps } from '../../context';\nimport Item from '../item';\n\nfunction CustomSelectControlV2(\n\tprops: WordPressComponentProps< CustomSelectProps, 'button', false >\n) {\n\tconst { defaultValue, onChange, value, ...restProps } = props;\n\t// Forward props + store from v2 implementation\n\tconst store = Ariakit.useSelectStore( {\n\t\tsetValue: ( nextValue ) => onChange?.( nextValue ),\n\t\tdefaultValue,\n\t\tvalue,\n\t} );\n\n\treturn <_CustomSelect { ...restProps } store={ store } />;\n}\n\nCustomSelectControlV2.Item = Item;\n\nexport default CustomSelectControlV2;\n"],"mappings":";;;;;;;;AAIA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAA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nE;EACD,MAAM;IAAEC,YAAY;IAAEC,QAAQ;IAAEC,KAAK;IAAE,GAAGC;EAAU,CAAC,GAAGJ,KAAK;EAC7D;EACA,MAAMK,KAAK,GAAGjC,OAAO,CAACkC,cAAc,CAAE;IACrCC,QAAQ,EAAIC,SAAS,IAAMN,QAAQ,GAAIM,SAAU,CAAC;IAClDP,YAAY;IACZE;EACD,CAAE,CAAC;EAEH,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAACnC,aAAA,CAAAS,OAAa;IAAA,GAAMoB,SAAS;IAAGC,KAAK,EAAGA;EAAO,CAAE,CAAC;AAC1D;AAEAN,qBAAqB,CAACY,IAAI,GAAGA,aAAI;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7B,OAAA,GAEnBe,qBAAqB"}
@@ -4,18 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- Object.defineProperty(exports, "CustomSelect", {
7
+ Object.defineProperty(exports, "default", {
8
8
  enumerable: true,
9
9
  get: function () {
10
10
  return _defaultComponent.default;
11
11
  }
12
12
  });
13
- Object.defineProperty(exports, "CustomSelectItem", {
14
- enumerable: true,
15
- get: function () {
16
- return _customSelectItem.default;
17
- }
18
- });
19
13
  var _defaultComponent = _interopRequireDefault(require("./default-component"));
20
- var _customSelectItem = _interopRequireDefault(require("./custom-select-item"));
21
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_defaultComponent","_interopRequireDefault","require","_customSelectItem"],"sources":["@wordpress/components/src/custom-select-control-v2/index.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nexport { default as CustomSelect } from './default-component';\nexport { default as CustomSelectItem } from './custom-select-item';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA"}
1
+ {"version":3,"names":["_defaultComponent","_interopRequireDefault","require"],"sources":["@wordpress/components/src/custom-select-control-v2/index.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nexport { default } from './default-component';\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA"}
@@ -28,5 +28,6 @@ function CustomSelectItem({
28
28
  icon: _icons.check
29
29
  })));
30
30
  }
31
+ CustomSelectItem.displayName = 'CustomSelectControlV2.Item';
31
32
  var _default = exports.default = CustomSelectItem;
32
- //# sourceMappingURL=custom-select-item.js.map
33
+ //# sourceMappingURL=item.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_icons","Styled","_interopRequireWildcard","_customSelect","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","CustomSelectItem","children","props","customSelectContext","useContext","CustomSelectContext","_react","createElement","SelectItem","store","value","SelectedItemCheck","Icon","icon","check","_default","exports"],"sources":["@wordpress/components/src/custom-select-control-v2/custom-select-item.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { Icon, check } from '@wordpress/icons';\n/**\n * Internal dependencies\n */\nimport type { CustomSelectItemProps } from './types';\nimport type { WordPressComponentProps } from '../context';\nimport * as Styled from './styles';\nimport { CustomSelectContext } from './custom-select';\n\nexport function CustomSelectItem( {\n\tchildren,\n\t...props\n}: WordPressComponentProps< CustomSelectItemProps, 'div', false > ) {\n\tconst customSelectContext = useContext( CustomSelectContext );\n\treturn (\n\t\t<Styled.SelectItem store={ customSelectContext?.store } { ...props }>\n\t\t\t{ children ?? props.value }\n\t\t\t<Styled.SelectedItemCheck>\n\t\t\t\t<Icon icon={ check } />\n\t\t\t</Styled.SelectedItemCheck>\n\t\t</Styled.SelectItem>\n\t);\n}\n\nexport default CustomSelectItem;\n"],"mappings":";;;;;;;;AAGA,I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,CAAA;AAXtD;AACA;AACA;;AAWO,SAASY,gBAAgBA,CAAE;EACjCC,QAAQ;EACR,GAAGC;AAC4D,CAAC,EAAG;EACnE,MAAMC,mBAAmB,GAAG,IAAAC,mBAAU,EAAEC,iCAAoB,CAAC;EAC7D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAC/B,MAAM,CAACgC,UAAU;IAACC,KAAK,EAAGN,mBAAmB,EAAEM,KAAO;IAAA,GAAMP;EAAK,GAC/DD,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIC,KAAK,CAACQ,KAAK,EACzB,IAAAJ,MAAA,CAAAC,aAAA,EAAC/B,MAAM,CAACmC,iBAAiB,QACxB,IAAAL,MAAA,CAAAC,aAAA,EAAChC,MAAA,CAAAqC,IAAI;IAACC,IAAI,EAAGC;EAAO,CAAE,CACG,CACR,CAAC;AAEtB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA/B,OAAA,GAEce,gBAAgB"}
1
+ {"version":3,"names":["_element","require","_icons","Styled","_interopRequireWildcard","_customSelect","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","CustomSelectItem","children","props","customSelectContext","useContext","CustomSelectContext","_react","createElement","SelectItem","store","value","SelectedItemCheck","Icon","icon","check","displayName","_default","exports"],"sources":["@wordpress/components/src/custom-select-control-v2/item.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { Icon, check } from '@wordpress/icons';\n/**\n * Internal dependencies\n */\nimport type { CustomSelectItemProps } from './types';\nimport type { WordPressComponentProps } from '../context';\nimport * as Styled from './styles';\nimport { CustomSelectContext } from './custom-select';\n\nexport function CustomSelectItem( {\n\tchildren,\n\t...props\n}: WordPressComponentProps< CustomSelectItemProps, 'div', false > ) {\n\tconst customSelectContext = useContext( CustomSelectContext );\n\treturn (\n\t\t<Styled.SelectItem store={ customSelectContext?.store } { ...props }>\n\t\t\t{ children ?? props.value }\n\t\t\t<Styled.SelectedItemCheck>\n\t\t\t\t<Icon icon={ check } />\n\t\t\t</Styled.SelectedItemCheck>\n\t\t</Styled.SelectItem>\n\t);\n}\n\nCustomSelectItem.displayName = 'CustomSelectControlV2.Item';\n\nexport default CustomSelectItem;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAMA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAsD,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAXtD;AACA;AACA;;AAWO,SAASY,gBAAgBA,CAAE;EACjCC,QAAQ;EACR,GAAGC;AAC4D,CAAC,EAAG;EACnE,MAAMC,mBAAmB,GAAG,IAAAC,mBAAU,EAAEC,iCAAoB,CAAC;EAC7D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAC/B,MAAM,CAACgC,UAAU;IAACC,KAAK,EAAGN,mBAAmB,EAAEM,KAAO;IAAA,GAAMP;EAAK,GAC/DD,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIC,KAAK,CAACQ,KAAK,EACzB,IAAAJ,MAAA,CAAAC,aAAA,EAAC/B,MAAM,CAACmC,iBAAiB,QACxB,IAAAL,MAAA,CAAAC,aAAA,EAAChC,MAAA,CAAAqC,IAAI;IAACC,IAAI,EAAGC;EAAO,CAAE,CACG,CACR,CAAC;AAEtB;AAEAd,gBAAgB,CAACe,WAAW,GAAG,4BAA4B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhC,OAAA,GAE7Ce,gBAAgB"}
@@ -9,7 +9,7 @@ var _react = require("react");
9
9
  var Ariakit = _interopRequireWildcard(require("@ariakit/react"));
10
10
  var _element = require("@wordpress/element");
11
11
  var _customSelect = _interopRequireDefault(require("../custom-select"));
12
- var _ = require("..");
12
+ var _item = _interopRequireDefault(require("../item"));
13
13
  var Styled = _interopRequireWildcard(require("../styles"));
14
14
  var _context = require("../../context");
15
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -27,7 +27,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
27
27
  * Internal dependencies
28
28
  */
29
29
 
30
- function CustomSelect(props) {
30
+ function CustomSelectControl(props) {
31
31
  const {
32
32
  __experimentalShowSelectedHint,
33
33
  __next40pxDefaultSize = false,
@@ -69,10 +69,10 @@ function CustomSelect(props) {
69
69
  const withHint = (0, _react.createElement)(Styled.WithHintWrapper, null, (0, _react.createElement)("span", null, name), (0, _react.createElement)(Styled.ExperimentalHintItem, {
70
70
  className: "components-custom-select-control__item-hint"
71
71
  }, __experimentalHint));
72
- return (0, _react.createElement)(_.CustomSelectItem, {
72
+ return (0, _react.createElement)(_item.default, {
73
73
  key: key,
74
74
  value: name,
75
- children: __experimentalShowSelectedHint ? withHint : name,
75
+ children: __experimentalHint ? withHint : name,
76
76
  ...rest
77
77
  });
78
78
  });
@@ -119,5 +119,5 @@ function CustomSelect(props) {
119
119
  store: store
120
120
  }));
121
121
  }
122
- var _default = exports.default = CustomSelect;
122
+ var _default = exports.default = CustomSelectControl;
123
123
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_element","_customSelect","_interopRequireDefault","_","Styled","_context","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","CustomSelect","props","__experimentalShowSelectedHint","__next40pxDefaultSize","options","onChange","size","value","restProps","store","useSelectStore","setValue","nextValue","Promise","resolve","state","getState","changeObject","highlightedIndex","renderedItems","findIndex","item","inputValue","isOpen","open","selectedItem","name","key","type","children","map","__experimentalHint","rest","withHint","_react","createElement","WithHintWrapper","ExperimentalHintItem","className","CustomSelectItem","renderSelectedValueHint","currentValue","currentHint","find","Fragment","SelectedExperimentalHintItem","contextSystemValue","useMemo","selectedSize","CustomSelectControlButton","_overrides","translatedProps","describedBy","renderSelectedValue","undefined","ContextSystemProvider","_default","exports"],"sources":["@wordpress/components/src/custom-select-control-v2/legacy-component/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport * as Ariakit from '@ariakit/react';\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport _CustomSelect from '../custom-select';\nimport type { LegacyCustomSelectProps } from '../types';\nimport { CustomSelectItem } from '..';\nimport * as Styled from '../styles';\nimport { ContextSystemProvider } from '../../context';\n\nfunction CustomSelect( props: LegacyCustomSelectProps ) {\n\tconst {\n\t\t__experimentalShowSelectedHint,\n\t\t__next40pxDefaultSize = false,\n\t\toptions,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tvalue,\n\t\t...restProps\n\t} = props;\n\n\t// Forward props + store from v2 implementation\n\tconst store = Ariakit.useSelectStore( {\n\t\tasync setValue( nextValue ) {\n\t\t\tif ( ! onChange ) return;\n\n\t\t\t// Executes the logic in a microtask after the popup is closed.\n\t\t\t// This is simply to ensure the isOpen state matches that in Downshift.\n\t\t\tawait Promise.resolve();\n\t\t\tconst state = store.getState();\n\n\t\t\tconst changeObject = {\n\t\t\t\thighlightedIndex: state.renderedItems.findIndex(\n\t\t\t\t\t( item ) => item.value === nextValue\n\t\t\t\t),\n\t\t\t\tinputValue: '',\n\t\t\t\tisOpen: state.open,\n\t\t\t\tselectedItem: {\n\t\t\t\t\tname: nextValue as string,\n\t\t\t\t\tkey: nextValue as string,\n\t\t\t\t},\n\t\t\t\ttype: '',\n\t\t\t};\n\t\t\tonChange( changeObject );\n\t\t},\n\t} );\n\n\tconst children = options.map(\n\t\t( { name, key, __experimentalHint, ...rest } ) => {\n\t\t\tconst withHint = (\n\t\t\t\t<Styled.WithHintWrapper>\n\t\t\t\t\t<span>{ name }</span>\n\t\t\t\t\t<Styled.ExperimentalHintItem className=\"components-custom-select-control__item-hint\">\n\t\t\t\t\t\t{ __experimentalHint }\n\t\t\t\t\t</Styled.ExperimentalHintItem>\n\t\t\t\t</Styled.WithHintWrapper>\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<CustomSelectItem\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvalue={ name }\n\t\t\t\t\tchildren={\n\t\t\t\t\t\t__experimentalShowSelectedHint ? withHint : name\n\t\t\t\t\t}\n\t\t\t\t\t{ ...rest }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n\n\tconst renderSelectedValueHint = () => {\n\t\tconst { value: currentValue } = store.getState();\n\n\t\tconst currentHint = options?.find(\n\t\t\t( { name } ) => currentValue === name\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ currentValue }\n\t\t\t\t<Styled.SelectedExperimentalHintItem className=\"components-custom-select-control__hint\">\n\t\t\t\t\t{ currentHint?.__experimentalHint }\n\t\t\t\t</Styled.SelectedExperimentalHintItem>\n\t\t\t</>\n\t\t);\n\t};\n\n\t// translate legacy button sizing\n\tconst contextSystemValue = useMemo( () => {\n\t\tlet selectedSize;\n\n\t\tif (\n\t\t\t( __next40pxDefaultSize && size === 'default' ) ||\n\t\t\tsize === '__unstable-large'\n\t\t) {\n\t\t\tselectedSize = 'default';\n\t\t} else if ( ! __next40pxDefaultSize && size === 'default' ) {\n\t\t\tselectedSize = 'compact';\n\t\t} else {\n\t\t\tselectedSize = size;\n\t\t}\n\n\t\treturn {\n\t\t\tCustomSelectControlButton: { _overrides: { size: selectedSize } },\n\t\t};\n\t}, [ __next40pxDefaultSize, size ] );\n\n\tconst translatedProps = {\n\t\t'aria-describedby': props.describedBy,\n\t\tchildren,\n\t\trenderSelectedValue: __experimentalShowSelectedHint\n\t\t\t? renderSelectedValueHint\n\t\t\t: undefined,\n\t\t...restProps,\n\t};\n\n\treturn (\n\t\t<ContextSystemProvider value={ contextSystemValue }>\n\t\t\t<_CustomSelect { ...translatedProps } store={ store } />\n\t\t</ContextSystemProvider>\n\t);\n}\n\nexport default CustomSelect;\n"],"mappings":";;;;;;;;AAIA,IAAAA,O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AAC;EACF,CAAC,EAAE,CAAE7C,qBAAqB,EAAEG,IAAI,CAAG,CAAC;EAEpC,MAAM6C,eAAe,GAAG;IACvB,kBAAkB,EAAElD,KAAK,CAACmD,WAAW;IACrCvB,QAAQ;IACRwB,mBAAmB,EAAEnD,8BAA8B,GAChDsC,uBAAuB,GACvBc,SAAS;IACZ,GAAG9C;EACJ,CAAC;EAED,OACC,IAAA0B,MAAA,CAAAC,aAAA,EAACzD,QAAA,CAAA6E,qBAAqB;IAAChD,KAAK,EAAGuC;EAAoB,GAClD,IAAAZ,MAAA,CAAAC,aAAA,EAAC7D,aAAA,CAAAW,OAAa;IAAA,GAAMkE,eAAe;IAAG1C,KAAK,EAAGA;EAAO,CAAE,CACjC,CAAC;AAE1B;AAAC,IAAA+C,QAAA,GAAAC,OAAA,CAAAxE,OAAA,GAEce,YAAY"}
1
+ {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_element","_customSelect","_interopRequireDefault","_item","Styled","_context","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","CustomSelectControl","props","__experimentalShowSelectedHint","__next40pxDefaultSize","options","onChange","size","value","restProps","store","useSelectStore","setValue","nextValue","Promise","resolve","state","getState","changeObject","highlightedIndex","renderedItems","findIndex","item","inputValue","isOpen","open","selectedItem","name","key","type","children","map","__experimentalHint","rest","withHint","_react","createElement","WithHintWrapper","ExperimentalHintItem","className","renderSelectedValueHint","currentValue","currentHint","find","Fragment","SelectedExperimentalHintItem","contextSystemValue","useMemo","selectedSize","CustomSelectControlButton","_overrides","translatedProps","describedBy","renderSelectedValue","undefined","ContextSystemProvider","_default","exports"],"sources":["@wordpress/components/src/custom-select-control-v2/legacy-component/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport * as Ariakit from '@ariakit/react';\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport _CustomSelect from '../custom-select';\nimport CustomSelectItem from '../item';\nimport type { LegacyCustomSelectProps } from '../types';\nimport * as Styled from '../styles';\nimport { ContextSystemProvider } from '../../context';\n\nfunction CustomSelectControl( props: LegacyCustomSelectProps ) {\n\tconst {\n\t\t__experimentalShowSelectedHint,\n\t\t__next40pxDefaultSize = false,\n\t\toptions,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tvalue,\n\t\t...restProps\n\t} = props;\n\n\t// Forward props + store from v2 implementation\n\tconst store = Ariakit.useSelectStore( {\n\t\tasync setValue( nextValue ) {\n\t\t\tif ( ! onChange ) return;\n\n\t\t\t// Executes the logic in a microtask after the popup is closed.\n\t\t\t// This is simply to ensure the isOpen state matches that in Downshift.\n\t\t\tawait Promise.resolve();\n\t\t\tconst state = store.getState();\n\n\t\t\tconst changeObject = {\n\t\t\t\thighlightedIndex: state.renderedItems.findIndex(\n\t\t\t\t\t( item ) => item.value === nextValue\n\t\t\t\t),\n\t\t\t\tinputValue: '',\n\t\t\t\tisOpen: state.open,\n\t\t\t\tselectedItem: {\n\t\t\t\t\tname: nextValue as string,\n\t\t\t\t\tkey: nextValue as string,\n\t\t\t\t},\n\t\t\t\ttype: '',\n\t\t\t};\n\t\t\tonChange( changeObject );\n\t\t},\n\t} );\n\n\tconst children = options.map(\n\t\t( { name, key, __experimentalHint, ...rest } ) => {\n\t\t\tconst withHint = (\n\t\t\t\t<Styled.WithHintWrapper>\n\t\t\t\t\t<span>{ name }</span>\n\t\t\t\t\t<Styled.ExperimentalHintItem className=\"components-custom-select-control__item-hint\">\n\t\t\t\t\t\t{ __experimentalHint }\n\t\t\t\t\t</Styled.ExperimentalHintItem>\n\t\t\t\t</Styled.WithHintWrapper>\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<CustomSelectItem\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvalue={ name }\n\t\t\t\t\tchildren={ __experimentalHint ? withHint : name }\n\t\t\t\t\t{ ...rest }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n\n\tconst renderSelectedValueHint = () => {\n\t\tconst { value: currentValue } = store.getState();\n\n\t\tconst currentHint = options?.find(\n\t\t\t( { name } ) => currentValue === name\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ currentValue }\n\t\t\t\t<Styled.SelectedExperimentalHintItem className=\"components-custom-select-control__hint\">\n\t\t\t\t\t{ currentHint?.__experimentalHint }\n\t\t\t\t</Styled.SelectedExperimentalHintItem>\n\t\t\t</>\n\t\t);\n\t};\n\n\t// translate legacy button sizing\n\tconst contextSystemValue = useMemo( () => {\n\t\tlet selectedSize;\n\n\t\tif (\n\t\t\t( __next40pxDefaultSize && size === 'default' ) ||\n\t\t\tsize === '__unstable-large'\n\t\t) {\n\t\t\tselectedSize = 'default';\n\t\t} else if ( ! __next40pxDefaultSize && size === 'default' ) {\n\t\t\tselectedSize = 'compact';\n\t\t} else {\n\t\t\tselectedSize = size;\n\t\t}\n\n\t\treturn {\n\t\t\tCustomSelectControlButton: { _overrides: { size: selectedSize } },\n\t\t};\n\t}, [ __next40pxDefaultSize, size ] );\n\n\tconst translatedProps = {\n\t\t'aria-describedby': props.describedBy,\n\t\tchildren,\n\t\trenderSelectedValue: __experimentalShowSelectedHint\n\t\t\t? renderSelectedValueHint\n\t\t\t: undefined,\n\t\t...restProps,\n\t};\n\n\treturn (\n\t\t<ContextSystemProvider value={ contextSystemValue }>\n\t\t\t<_CustomSelect { ...translatedProps } store={ store } />\n\t\t</ContextSystemProvider>\n\t);\n}\n\nexport default CustomSelectControl;\n"],"mappings":";;;;;;;;AAIA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AAIA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,MAAA,GAAAN,uBAAA,CAAAC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DqC,uBAAuB,GACvBc,SAAS;IACZ,GAAG7C;EACJ,CAAC;EAED,OACC,IAAA0B,MAAA,CAAAC,aAAA,EAACzD,QAAA,CAAA4E,qBAAqB;IAAC/C,KAAK,EAAGsC;EAAoB,GAClD,IAAAX,MAAA,CAAAC,aAAA,EAAC7D,aAAA,CAAAW,OAAa;IAAA,GAAMiE,eAAe;IAAGzC,KAAK,EAAGA;EAAO,CAAE,CACjC,CAAC;AAE1B;AAAC,IAAA8C,QAAA,GAAAC,OAAA,CAAAvE,OAAA,GAEce,mBAAmB"}
@@ -10,6 +10,7 @@ var _element = require("@wordpress/element");
10
10
  var _utils = require("./utils");
11
11
  var _inputControlStyles = require("./styles/input-control-styles");
12
12
  var _reducer = require("./reducer/reducer");
13
+ var _withIgnoreImeEvents = require("../utils/with-ignore-ime-events");
13
14
  /**
14
15
  * External dependencies
15
16
  */
@@ -194,7 +195,7 @@ function InputField({
194
195
  onBlur: handleOnBlur,
195
196
  onChange: handleOnChange,
196
197
  onFocus: handleOnFocus,
197
- onKeyDown: handleOnKeyDown,
198
+ onKeyDown: (0, _withIgnoreImeEvents.withIgnoreIMEEvents)(handleOnKeyDown),
198
199
  onMouseDown: handleOnMouseDown,
199
200
  ref: ref,
200
201
  inputSize: size