@wordpress/components 29.1.1 → 29.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.
- package/CHANGELOG.md +29 -6
- package/CONTRIBUTING.md +4 -4
- package/README.md +1 -1
- package/build/badge/index.js +26 -22
- package/build/badge/index.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/box-control/index.js +6 -0
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/linked-button.js +7 -11
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +0 -1
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/color-palette/index.js +1 -6
- package/build/color-palette/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +1 -1
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +22 -22
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/menu/checkbox-item.js +6 -6
- package/build/menu/checkbox-item.js.map +1 -1
- package/build/menu/context.js +2 -2
- package/build/menu/context.js.map +1 -1
- package/build/menu/group-label.js +4 -4
- package/build/menu/group-label.js.map +1 -1
- package/build/menu/group.js +4 -4
- package/build/menu/group.js.map +1 -1
- package/build/menu/index.js +87 -14
- package/build/menu/index.js.map +1 -1
- package/build/menu/item-help-text.js +4 -4
- package/build/menu/item-help-text.js.map +1 -1
- package/build/menu/item-label.js +4 -4
- package/build/menu/item-label.js.map +1 -1
- package/build/menu/item.js +6 -6
- package/build/menu/item.js.map +1 -1
- package/build/menu/popover.js +5 -5
- package/build/menu/popover.js.map +1 -1
- package/build/menu/radio-item.js +6 -6
- package/build/menu/radio-item.js.map +1 -1
- package/build/menu/separator.js +4 -4
- package/build/menu/separator.js.map +1 -1
- package/build/menu/styles.js +41 -41
- package/build/menu/styles.js.map +1 -1
- package/build/menu/submenu-trigger-item.js +5 -5
- package/build/menu/submenu-trigger-item.js.map +1 -1
- package/build/menu/trigger-button.js +3 -3
- package/build/menu/trigger-button.js.map +1 -1
- package/build/menu/types.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/notice/types.js.map +1 -1
- package/build/search-control/index.js +1 -1
- package/build/search-control/index.js.map +1 -1
- package/build/text/hook.js +8 -6
- package/build/text/hook.js.map +1 -1
- package/build/text/utils.js +1 -1
- package/build/text/utils.js.map +1 -1
- package/build-module/badge/index.js +28 -22
- package/build-module/badge/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/box-control/index.js +6 -0
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/linked-button.js +7 -11
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +0 -1
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/color-palette/index.js +1 -6
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +1 -1
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +22 -22
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/menu/checkbox-item.js +6 -6
- package/build-module/menu/checkbox-item.js.map +1 -1
- package/build-module/menu/context.js +1 -1
- package/build-module/menu/context.js.map +1 -1
- package/build-module/menu/group-label.js +4 -4
- package/build-module/menu/group-label.js.map +1 -1
- package/build-module/menu/group.js +4 -4
- package/build-module/menu/group.js.map +1 -1
- package/build-module/menu/index.js +99 -26
- package/build-module/menu/index.js.map +1 -1
- package/build-module/menu/item-help-text.js +4 -4
- package/build-module/menu/item-help-text.js.map +1 -1
- package/build-module/menu/item-label.js +4 -4
- package/build-module/menu/item-label.js.map +1 -1
- package/build-module/menu/item.js +6 -6
- package/build-module/menu/item.js.map +1 -1
- package/build-module/menu/popover.js +5 -5
- package/build-module/menu/popover.js.map +1 -1
- package/build-module/menu/radio-item.js +6 -6
- package/build-module/menu/radio-item.js.map +1 -1
- package/build-module/menu/separator.js +4 -4
- package/build-module/menu/separator.js.map +1 -1
- package/build-module/menu/styles.js +40 -40
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/menu/submenu-trigger-item.js +6 -6
- package/build-module/menu/submenu-trigger-item.js.map +1 -1
- package/build-module/menu/trigger-button.js +3 -3
- package/build-module/menu/trigger-button.js.map +1 -1
- package/build-module/menu/types.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/notice/types.js.map +1 -1
- package/build-module/search-control/index.js +1 -1
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/text/hook.js +8 -6
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/utils.js +1 -1
- package/build-module/text/utils.js.map +1 -1
- package/build-style/style-rtl.css +89 -170
- package/build-style/style.css +89 -170
- package/build-types/badge/index.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/linked-button.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts +7 -2331
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +15 -3
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/higher-order/with-focus-return/index.d.ts +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/menu/checkbox-item.d.ts +2 -2
- package/build-types/menu/checkbox-item.d.ts.map +1 -1
- package/build-types/menu/context.d.ts +2 -2
- package/build-types/menu/context.d.ts.map +1 -1
- package/build-types/menu/group-label.d.ts +2 -2
- package/build-types/menu/group-label.d.ts.map +1 -1
- package/build-types/menu/group.d.ts +2 -2
- package/build-types/menu/group.d.ts.map +1 -1
- package/build-types/menu/index.d.ts +84 -12
- package/build-types/menu/index.d.ts.map +1 -1
- package/build-types/menu/item-help-text.d.ts +1 -1
- package/build-types/menu/item-help-text.d.ts.map +1 -1
- package/build-types/menu/item-label.d.ts +1 -1
- package/build-types/menu/item-label.d.ts.map +1 -1
- package/build-types/menu/item.d.ts +2 -2
- package/build-types/menu/item.d.ts.map +1 -1
- package/build-types/menu/popover.d.ts +2 -2
- package/build-types/menu/popover.d.ts.map +1 -1
- package/build-types/menu/radio-item.d.ts +2 -2
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu/separator.d.ts +2 -2
- package/build-types/menu/separator.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +15 -15
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/menu/submenu-trigger-item.d.ts +2 -2
- package/build-types/menu/submenu-trigger-item.d.ts.map +1 -1
- package/build-types/menu/trigger-button.d.ts +2 -2
- package/build-types/menu/trigger-button.d.ts.map +1 -1
- package/build-types/menu/types.d.ts +10 -10
- package/build-types/menu/types.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/notice/types.d.ts +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts +0 -3
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/utils.d.ts +1 -1
- package/package.json +19 -19
- package/src/animate/style.scss +16 -12
- package/src/badge/index.tsx +28 -27
- package/src/border-box-control/border-box-control-linked-button/component.tsx +9 -14
- package/src/border-control/test/index.js +12 -4
- package/src/box-control/index.tsx +9 -0
- package/src/box-control/linked-button.tsx +8 -11
- package/src/box-control/test/index.tsx +9 -2
- package/src/box-control/types.ts +26 -11
- package/src/button/style.scss +15 -12
- package/src/checkbox-control/style.scss +4 -2
- package/src/circular-option-picker/README.md +1 -2
- package/src/circular-option-picker/circular-option-picker-option.tsx +17 -10
- package/src/circular-option-picker/circular-option-picker.tsx +0 -1
- package/src/circular-option-picker/stories/index.story.tsx +0 -1
- package/src/circular-option-picker/style.scss +10 -5
- package/src/color-palette/index.tsx +0 -7
- package/src/color-palette/test/index.tsx +2 -8
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/drop-zone/style.scss +6 -9
- package/src/font-size-picker/index.native.js +1 -1
- package/src/form-toggle/style.scss +17 -10
- package/src/form-token-field/style.scss +9 -4
- package/src/higher-order/navigate-regions/style.scss +2 -2
- package/src/higher-order/with-focus-return/index.tsx +1 -1
- package/src/input-control/styles/input-control-styles.tsx +6 -0
- package/src/menu/README.md +421 -174
- package/src/menu/checkbox-item.tsx +12 -12
- package/src/menu/context.tsx +2 -4
- package/src/menu/docs-manifest.json +62 -0
- package/src/menu/group-label.tsx +7 -7
- package/src/menu/group.tsx +7 -11
- package/src/menu/index.tsx +101 -31
- package/src/menu/item-help-text.tsx +5 -7
- package/src/menu/item-label.tsx +5 -7
- package/src/menu/item.tsx +12 -12
- package/src/menu/popover.tsx +9 -9
- package/src/menu/radio-item.tsx +12 -12
- package/src/menu/separator.tsx +7 -7
- package/src/menu/stories/best-practices.mdx +38 -0
- package/src/menu/stories/index.story.tsx +8 -8
- package/src/menu/styles.ts +24 -24
- package/src/menu/submenu-trigger-item.tsx +9 -9
- package/src/menu/trigger-button.tsx +6 -6
- package/src/menu/types.ts +10 -10
- package/src/menu-group/stories/index.story.tsx +2 -2
- package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/src/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/src/modal/style.scss +4 -2
- package/src/modal/test/index.tsx +5 -4
- package/src/notice/README.md +3 -3
- package/src/notice/types.ts +1 -1
- package/src/palette-edit/test/index.tsx +1 -1
- package/src/panel/style.scss +14 -6
- package/src/placeholder/style.scss +5 -3
- package/src/progress-bar/stories/index.story.tsx +1 -1
- package/src/resizable-box/style.scss +14 -9
- package/src/search-control/index.tsx +1 -1
- package/src/tab-panel/style.scss +6 -4
- package/src/tabs/stories/index.story.tsx +0 -131
- package/src/text/README.md +1 -1
- package/src/text/hook.ts +3 -2
- package/src/text/stories/index.story.tsx +2 -2
- package/src/text/test/index.tsx +1 -1
- package/src/text/utils.ts +1 -1
- package/src/text-highlight/test/index.tsx +3 -3
- package/src/toolbar/toolbar/style.scss +4 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -15,7 +15,6 @@ import { useState } from '@wordpress/element';
|
|
|
15
15
|
*/
|
|
16
16
|
import { Tabs } from '..';
|
|
17
17
|
import { Slot, Fill, Provider as SlotFillProvider } from '../../slot-fill';
|
|
18
|
-
import DropdownMenu from '../../dropdown-menu';
|
|
19
18
|
import Button from '../../button';
|
|
20
19
|
import Tooltip from '../../tooltip';
|
|
21
20
|
import Icon from '../../icon';
|
|
@@ -367,133 +366,3 @@ const CloseButtonTemplate: StoryFn< typeof Tabs > = ( props ) => {
|
|
|
367
366
|
);
|
|
368
367
|
};
|
|
369
368
|
export const InsertCustomElements = CloseButtonTemplate.bind( {} );
|
|
370
|
-
|
|
371
|
-
const ControlledModeTemplate: StoryFn< typeof Tabs > = ( props ) => {
|
|
372
|
-
const [ selectedTabId, setSelectedTabId ] = useState<
|
|
373
|
-
string | undefined | null
|
|
374
|
-
>( props.selectedTabId );
|
|
375
|
-
|
|
376
|
-
return (
|
|
377
|
-
<>
|
|
378
|
-
<Tabs
|
|
379
|
-
{ ...props }
|
|
380
|
-
selectedTabId={ selectedTabId }
|
|
381
|
-
onSelect={ ( selectedId ) => {
|
|
382
|
-
setSelectedTabId( selectedId );
|
|
383
|
-
props.onSelect?.( selectedId );
|
|
384
|
-
} }
|
|
385
|
-
>
|
|
386
|
-
<Tabs.TabList>
|
|
387
|
-
<Tabs.Tab tabId="tab1">Tab 1</Tabs.Tab>
|
|
388
|
-
|
|
389
|
-
<Tabs.Tab tabId="tab2">Tab 2</Tabs.Tab>
|
|
390
|
-
|
|
391
|
-
<Tabs.Tab tabId="tab3">Tab 3</Tabs.Tab>
|
|
392
|
-
</Tabs.TabList>
|
|
393
|
-
<Tabs.TabPanel tabId="tab1">
|
|
394
|
-
<p>Selected tab: Tab 1</p>
|
|
395
|
-
</Tabs.TabPanel>
|
|
396
|
-
<Tabs.TabPanel tabId="tab2">
|
|
397
|
-
<p>Selected tab: Tab 2</p>
|
|
398
|
-
</Tabs.TabPanel>
|
|
399
|
-
<Tabs.TabPanel tabId="tab3">
|
|
400
|
-
<p>Selected tab: Tab 3</p>
|
|
401
|
-
</Tabs.TabPanel>
|
|
402
|
-
</Tabs>
|
|
403
|
-
<div style={ { marginTop: '200px' } }>
|
|
404
|
-
<p>Select a tab:</p>
|
|
405
|
-
<DropdownMenu
|
|
406
|
-
controls={ [
|
|
407
|
-
{
|
|
408
|
-
onClick: () => setSelectedTabId( 'tab1' ),
|
|
409
|
-
title: 'Tab 1',
|
|
410
|
-
isActive: selectedTabId === 'tab1',
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
onClick: () => setSelectedTabId( 'tab2' ),
|
|
414
|
-
title: 'Tab 2',
|
|
415
|
-
isActive: selectedTabId === 'tab2',
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
onClick: () => setSelectedTabId( 'tab3' ),
|
|
419
|
-
title: 'Tab 3',
|
|
420
|
-
isActive: selectedTabId === 'tab3',
|
|
421
|
-
},
|
|
422
|
-
] }
|
|
423
|
-
label="Choose a tab. The power is yours."
|
|
424
|
-
/>
|
|
425
|
-
</div>
|
|
426
|
-
</>
|
|
427
|
-
);
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
export const ControlledMode = ControlledModeTemplate.bind( {} );
|
|
431
|
-
ControlledMode.args = {
|
|
432
|
-
selectedTabId: 'tab3',
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
const TabBecomesDisabledTemplate: StoryFn< typeof Tabs > = ( props ) => {
|
|
436
|
-
const [ disableTab2, setDisableTab2 ] = useState( false );
|
|
437
|
-
|
|
438
|
-
return (
|
|
439
|
-
<>
|
|
440
|
-
<Button
|
|
441
|
-
variant="primary"
|
|
442
|
-
onClick={ () => setDisableTab2( ! disableTab2 ) }
|
|
443
|
-
>
|
|
444
|
-
{ disableTab2 ? 'Enable' : 'Disable' } Tab 2
|
|
445
|
-
</Button>
|
|
446
|
-
<Tabs { ...props }>
|
|
447
|
-
<Tabs.TabList>
|
|
448
|
-
<Tabs.Tab tabId="tab1">Tab 1</Tabs.Tab>
|
|
449
|
-
<Tabs.Tab tabId="tab2" disabled={ disableTab2 }>
|
|
450
|
-
Tab 2
|
|
451
|
-
</Tabs.Tab>
|
|
452
|
-
<Tabs.Tab tabId="tab3">Tab 3</Tabs.Tab>
|
|
453
|
-
</Tabs.TabList>
|
|
454
|
-
<Tabs.TabPanel tabId="tab1">
|
|
455
|
-
<p>Selected tab: Tab 1</p>
|
|
456
|
-
</Tabs.TabPanel>
|
|
457
|
-
<Tabs.TabPanel tabId="tab2">
|
|
458
|
-
<p>Selected tab: Tab 2</p>
|
|
459
|
-
</Tabs.TabPanel>
|
|
460
|
-
<Tabs.TabPanel tabId="tab3">
|
|
461
|
-
<p>Selected tab: Tab 3</p>
|
|
462
|
-
</Tabs.TabPanel>
|
|
463
|
-
</Tabs>
|
|
464
|
-
</>
|
|
465
|
-
);
|
|
466
|
-
};
|
|
467
|
-
export const TabBecomesDisabled = TabBecomesDisabledTemplate.bind( {} );
|
|
468
|
-
|
|
469
|
-
const TabGetsRemovedTemplate: StoryFn< typeof Tabs > = ( props ) => {
|
|
470
|
-
const [ removeTab1, setRemoveTab1 ] = useState( false );
|
|
471
|
-
|
|
472
|
-
return (
|
|
473
|
-
<>
|
|
474
|
-
<Button
|
|
475
|
-
variant="primary"
|
|
476
|
-
onClick={ () => setRemoveTab1( ! removeTab1 ) }
|
|
477
|
-
>
|
|
478
|
-
{ removeTab1 ? 'Restore' : 'Remove' } Tab 1
|
|
479
|
-
</Button>
|
|
480
|
-
<Tabs { ...props }>
|
|
481
|
-
<Tabs.TabList>
|
|
482
|
-
{ ! removeTab1 && <Tabs.Tab tabId="tab1">Tab 1</Tabs.Tab> }
|
|
483
|
-
<Tabs.Tab tabId="tab2">Tab 2</Tabs.Tab>
|
|
484
|
-
<Tabs.Tab tabId="tab3">Tab 3</Tabs.Tab>
|
|
485
|
-
</Tabs.TabList>
|
|
486
|
-
<Tabs.TabPanel tabId="tab1">
|
|
487
|
-
<p>Selected tab: Tab 1</p>
|
|
488
|
-
</Tabs.TabPanel>
|
|
489
|
-
<Tabs.TabPanel tabId="tab2">
|
|
490
|
-
<p>Selected tab: Tab 2</p>
|
|
491
|
-
</Tabs.TabPanel>
|
|
492
|
-
<Tabs.TabPanel tabId="tab3">
|
|
493
|
-
<p>Selected tab: Tab 3</p>
|
|
494
|
-
</Tabs.TabPanel>
|
|
495
|
-
</Tabs>
|
|
496
|
-
</>
|
|
497
|
-
);
|
|
498
|
-
};
|
|
499
|
-
export const TabGetsRemoved = TabGetsRemovedTemplate.bind( {} );
|
package/src/text/README.md
CHANGED
|
@@ -156,7 +156,7 @@ Adjusts all text line-height based on the typography system.
|
|
|
156
156
|
|
|
157
157
|
**Type**: `number`
|
|
158
158
|
|
|
159
|
-
Clamps the text content to the
|
|
159
|
+
Clamps the text content to the specific `numberOfLines`, adding the `ellipsis` at the end.
|
|
160
160
|
|
|
161
161
|
### optimizeReadabilityFor
|
|
162
162
|
|
package/src/text/hook.ts
CHANGED
|
@@ -104,9 +104,10 @@ export default function useText(
|
|
|
104
104
|
const isOptimalTextColorDark =
|
|
105
105
|
getOptimalTextShade( optimizeReadabilityFor ) === 'dark';
|
|
106
106
|
|
|
107
|
+
// Should not use theme colors
|
|
107
108
|
sx.optimalTextColor = isOptimalTextColorDark
|
|
108
|
-
? css( { color: COLORS.
|
|
109
|
-
: css( { color: COLORS.
|
|
109
|
+
? css( { color: COLORS.gray[ 900 ] } )
|
|
110
|
+
: css( { color: COLORS.white } );
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
return cx(
|
|
@@ -49,7 +49,7 @@ Truncate.args = {
|
|
|
49
49
|
facilisis dictum tortor, eu tincidunt justo scelerisque tincidunt.
|
|
50
50
|
Duis semper dui id augue malesuada, ut feugiat nisi aliquam.
|
|
51
51
|
Vestibulum venenatis diam sem, finibus dictum massa semper in. Nulla
|
|
52
|
-
|
|
52
|
+
facilities. Nunc vulputate faucibus diam, in lobortis arcu ornare vel.
|
|
53
53
|
In dignissim nunc sed facilisis finibus. Etiam imperdiet mattis
|
|
54
54
|
arcu, sed rutrum sapien blandit gravida. Aenean sollicitudin neque
|
|
55
55
|
eget enim blandit, sit amet rutrum leo vehicula. Nunc malesuada
|
|
@@ -68,7 +68,7 @@ Highlight.args = {
|
|
|
68
68
|
facilisis dictum tortor, eu tincidunt justo scelerisque tincidunt.
|
|
69
69
|
Duis semper dui id augue malesuada, ut feugiat nisi aliquam.
|
|
70
70
|
Vestibulum venenatis diam sem, finibus dictum massa semper in. Nulla
|
|
71
|
-
|
|
71
|
+
facilities. Nunc vulputate faucibus diam, in lobortis arcu ornare vel.
|
|
72
72
|
In dignissim nunc sed facilisis finibus. Etiam imperdiet mattis
|
|
73
73
|
arcu, sed rutrum sapien blandit gravida. Aenean sollicitudin neque
|
|
74
74
|
eget enim blandit, sit amet rutrum leo vehicula. Nunc malesuada
|
package/src/text/test/index.tsx
CHANGED
package/src/text/utils.ts
CHANGED
|
@@ -27,7 +27,7 @@ import { createElement } from '@wordpress/element';
|
|
|
27
27
|
* @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
|
|
28
28
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
|
|
29
29
|
* @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
|
|
30
|
-
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `
|
|
30
|
+
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `sanitize` function to pass to `highlight-words-core`.
|
|
31
31
|
* @property {string[]} [searchWords=[]] Words to search for and highlight.
|
|
32
32
|
* @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
|
|
33
33
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
|
|
@@ -20,7 +20,7 @@ const defaultText =
|
|
|
20
20
|
describe( 'TextHighlight', () => {
|
|
21
21
|
describe( 'Basic rendering', () => {
|
|
22
22
|
it.each( [ [ 'Gutenberg' ], [ 'media' ] ] )(
|
|
23
|
-
'should highlight the singular
|
|
23
|
+
'should highlight the singular occurrence of the text "%s" in the text if it exists',
|
|
24
24
|
( highlight ) => {
|
|
25
25
|
const { container } = render(
|
|
26
26
|
<TextHighlight
|
|
@@ -39,7 +39,7 @@ describe( 'TextHighlight', () => {
|
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
it( 'should highlight multiple
|
|
42
|
+
it( 'should highlight multiple occurrences of the string every time it exists in the text', () => {
|
|
43
43
|
const highlight = 'edit';
|
|
44
44
|
|
|
45
45
|
const { container } = render(
|
|
@@ -55,7 +55,7 @@ describe( 'TextHighlight', () => {
|
|
|
55
55
|
} );
|
|
56
56
|
} );
|
|
57
57
|
|
|
58
|
-
it( 'should highlight
|
|
58
|
+
it( 'should highlight occurrences of a string regardless of capitalisation', () => {
|
|
59
59
|
// Note that `The` occurs twice in the default text, once in
|
|
60
60
|
// lowercase and once capitalized.
|
|
61
61
|
const highlight = 'The';
|
|
@@ -56,9 +56,10 @@
|
|
|
56
56
|
z-index: -1;
|
|
57
57
|
|
|
58
58
|
// Animate in.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
@media not (prefers-reduced-motion) {
|
|
60
|
+
animation: components-button__appear-animation 0.1s ease;
|
|
61
|
+
animation-fill-mode: forwards;
|
|
62
|
+
}
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
svg {
|