@geotab/zenith 3.6.3 → 3.7.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/README.md +15 -0
- package/dist/absolute/absolute.d.ts +3 -1
- package/dist/absolute/absolute.js +4 -4
- package/dist/checkbox/checkbox.d.ts +3 -1
- package/dist/checkbox/checkbox.js +5 -8
- package/dist/checkboxListWithAction/checkboxListWithAction.d.ts +3 -1
- package/dist/checkboxListWithAction/checkboxListWithAction.js +185 -3
- package/dist/controlledPopup/controlledPopup.d.ts +3 -1
- package/dist/controlledPopup/controlledPopup.js +2 -2
- package/dist/dropdown/dropdownPopup.d.ts +1 -1
- package/dist/dropdown/dropdownTrigger.d.ts +1 -1
- package/dist/dropdownRaw/dropdownList.d.ts +2 -1
- package/dist/dropdownRaw/dropdownList.js +15 -4
- package/dist/dropdownRaw/dropdownPopup.d.ts +3 -1
- package/dist/dropdownRaw/dropdownPopup.js +35 -5
- package/dist/dropdownRaw/dropdownRaw.js +82 -7
- package/dist/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownSearchableTrigger.js +7 -2
- package/dist/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownTrigger.js +3 -5
- package/dist/footerButtons/footerButtons.d.ts +6 -4
- package/dist/footerButtons/footerButtons.js +3 -8
- package/dist/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +8 -2
- package/dist/groupsFilterRaw/groupsFilterInitialState.js +16 -0
- package/dist/groupsFilterRaw/groupsFilterRaw.js +43 -9
- package/dist/groupsFilterRaw/groupsFilterTrigger.d.ts +2 -1
- package/dist/groupsFilterRaw/groupsFilterTrigger.js +13 -2
- package/dist/index.css +222 -18
- package/dist/index.d.ts +1 -1
- package/dist/list/hooks/useDragAndDrop.d.ts +3 -1
- package/dist/list/hooks/useDragAndDrop.js +11 -4
- package/dist/menu/components/menuItem.js +12 -2
- package/dist/menu/contexts/pathContext.d.ts +3 -1
- package/dist/menu/contexts/pathProvider.d.ts +1 -1
- package/dist/menu/contexts/pathProvider.js +1 -1
- package/dist/menu/controlledMenu.js +97 -29
- package/dist/nav/nav.d.ts +2 -1
- package/dist/nav/nav.js +3 -2
- package/dist/nav/navEditList/navEditList.js +2 -1
- package/dist/nav/navItem/navItem.d.ts +1 -0
- package/dist/nav/navItem/navItem.js +4 -1
- package/dist/pillExpandable/pillContent.d.ts +2 -1
- package/dist/pillExpandable/pillContent.js +8 -3
- package/dist/pillExpandable/pillExpandable.d.ts +27 -4
- package/dist/pillExpandable/pillExpandable.js +426 -196
- package/dist/pillExpandable/pillExpandablePopoverContent.d.ts +19 -0
- package/dist/pillExpandable/pillExpandablePopoverContent.js +7 -0
- package/dist/pillExpandable/pillExpandableSimple.d.ts +5 -3
- package/dist/pillExpandable/pillExpandableSimple.js +12 -5
- package/dist/summary/summary.js +29 -1
- package/dist/summaryTile/summaryTile.d.ts +2 -1
- package/dist/summaryTile/summaryTile.js +175 -65
- package/dist/summaryTile/summaryTileTrigger.d.ts +1 -1
- package/dist/summaryTile/summaryTileTrigger.js +1 -1
- package/dist/toggleButtonRaw/toggleButtonRaw.js +2 -1
- package/dist/utils/localization/getSupportedLanguage.d.ts +2 -2
- package/dist/utils/localization/getSupportedLanguage.js +28 -8
- package/dist/utils/localization/languageContext.d.ts +1 -1
- package/dist/utils/localization/translations/cs.json +2 -1
- package/dist/utils/localization/translations/de.json +2 -1
- package/dist/utils/localization/translations/en.json +2 -1
- package/dist/utils/localization/translations/es.json +2 -1
- package/dist/utils/localization/translations/fr-FR.json +2 -1
- package/dist/utils/localization/translations/fr.json +2 -1
- package/dist/utils/localization/translations/id.json +2 -1
- package/dist/utils/localization/translations/it.json +2 -1
- package/dist/utils/localization/translations/ja.json +2 -1
- package/dist/utils/localization/translations/ms.json +2 -1
- package/dist/utils/localization/translations/nl.json +2 -1
- package/dist/utils/localization/translations/pl.json +2 -1
- package/dist/utils/localization/translations/pt-BR.json +2 -1
- package/dist/utils/localization/translations/sv.json +2 -1
- package/dist/utils/localization/translations/th.json +2 -1
- package/dist/utils/localization/translations/tr.json +2 -1
- package/dist/utils/localization/translations/zh-Hans.json +2 -1
- package/esm/absolute/absolute.d.ts +3 -1
- package/esm/absolute/absolute.js +4 -4
- package/esm/checkbox/checkbox.d.ts +3 -1
- package/esm/checkbox/checkbox.js +5 -8
- package/esm/checkboxListWithAction/checkboxListWithAction.d.ts +3 -1
- package/esm/checkboxListWithAction/checkboxListWithAction.js +186 -4
- package/esm/controlledPopup/controlledPopup.d.ts +3 -1
- package/esm/controlledPopup/controlledPopup.js +2 -2
- package/esm/dropdown/dropdownPopup.d.ts +1 -1
- package/esm/dropdown/dropdownTrigger.d.ts +1 -1
- package/esm/dropdownRaw/dropdownList.d.ts +2 -1
- package/esm/dropdownRaw/dropdownList.js +16 -5
- package/esm/dropdownRaw/dropdownPopup.d.ts +3 -1
- package/esm/dropdownRaw/dropdownPopup.js +37 -7
- package/esm/dropdownRaw/dropdownRaw.js +82 -7
- package/esm/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownSearchableTrigger.js +7 -2
- package/esm/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownTrigger.js +3 -5
- package/esm/footerButtons/footerButtons.d.ts +6 -4
- package/esm/footerButtons/footerButtons.js +3 -8
- package/esm/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +9 -3
- package/esm/groupsFilterRaw/groupsFilterInitialState.js +16 -0
- package/esm/groupsFilterRaw/groupsFilterRaw.js +43 -9
- package/esm/groupsFilterRaw/groupsFilterTrigger.d.ts +2 -1
- package/esm/groupsFilterRaw/groupsFilterTrigger.js +13 -2
- package/esm/index.d.ts +1 -1
- package/esm/list/hooks/useDragAndDrop.d.ts +3 -1
- package/esm/list/hooks/useDragAndDrop.js +11 -4
- package/esm/menu/components/menuItem.js +12 -2
- package/esm/menu/contexts/pathContext.d.ts +3 -1
- package/esm/menu/contexts/pathProvider.d.ts +1 -1
- package/esm/menu/contexts/pathProvider.js +1 -1
- package/esm/menu/controlledMenu.js +98 -30
- package/esm/nav/nav.d.ts +2 -1
- package/esm/nav/nav.js +3 -2
- package/esm/nav/navEditList/navEditList.js +2 -1
- package/esm/nav/navItem/navItem.d.ts +1 -0
- package/esm/nav/navItem/navItem.js +5 -2
- package/esm/pillExpandable/pillContent.d.ts +2 -1
- package/esm/pillExpandable/pillContent.js +8 -3
- package/esm/pillExpandable/pillExpandable.d.ts +27 -4
- package/esm/pillExpandable/pillExpandable.js +427 -197
- package/esm/pillExpandable/pillExpandablePopoverContent.d.ts +19 -0
- package/esm/pillExpandable/pillExpandablePopoverContent.js +3 -0
- package/esm/pillExpandable/pillExpandableSimple.d.ts +5 -3
- package/esm/pillExpandable/pillExpandableSimple.js +12 -5
- package/esm/summary/summary.js +29 -1
- package/esm/summaryTile/summaryTile.d.ts +2 -1
- package/esm/summaryTile/summaryTile.js +140 -43
- package/esm/summaryTile/summaryTileTrigger.d.ts +1 -1
- package/esm/summaryTile/summaryTileTrigger.js +1 -1
- package/esm/toggleButtonRaw/toggleButtonRaw.js +2 -1
- package/esm/utils/localization/getSupportedLanguage.d.ts +2 -2
- package/esm/utils/localization/getSupportedLanguage.js +28 -8
- package/esm/utils/localization/languageContext.d.ts +1 -1
- package/esm/utils/localization/translations/cs.json +2 -1
- package/esm/utils/localization/translations/de.json +2 -1
- package/esm/utils/localization/translations/en.json +2 -1
- package/esm/utils/localization/translations/es.json +2 -1
- package/esm/utils/localization/translations/fr-FR.json +2 -1
- package/esm/utils/localization/translations/fr.json +2 -1
- package/esm/utils/localization/translations/id.json +2 -1
- package/esm/utils/localization/translations/it.json +2 -1
- package/esm/utils/localization/translations/ja.json +2 -1
- package/esm/utils/localization/translations/ms.json +2 -1
- package/esm/utils/localization/translations/nl.json +2 -1
- package/esm/utils/localization/translations/pl.json +2 -1
- package/esm/utils/localization/translations/pt-BR.json +2 -1
- package/esm/utils/localization/translations/sv.json +2 -1
- package/esm/utils/localization/translations/th.json +2 -1
- package/esm/utils/localization/translations/tr.json +2 -1
- package/esm/utils/localization/translations/zh-Hans.json +2 -1
- package/package.json +4 -7
package/dist/index.css
CHANGED
|
@@ -1653,6 +1653,7 @@
|
|
|
1653
1653
|
position: absolute;
|
|
1654
1654
|
z-index: 11000;
|
|
1655
1655
|
overflow-y: auto;
|
|
1656
|
+
outline: none;
|
|
1656
1657
|
}
|
|
1657
1658
|
.zen-absolute * {
|
|
1658
1659
|
box-sizing: border-box;
|
|
@@ -2813,7 +2814,7 @@
|
|
|
2813
2814
|
padding: 12px 8px 12px 16px;
|
|
2814
2815
|
}
|
|
2815
2816
|
.zen-menu-button__action:focus,
|
|
2816
|
-
.zen-menu-button__action:focus-
|
|
2817
|
+
.zen-menu-button__action:focus-visible,
|
|
2817
2818
|
.zen-menu-button__action:hover:not(.zen-menu-button__action--disabled):not(.zen-menu-button__action--selected):not(.zen-menu-button__action--active) {
|
|
2818
2819
|
color: var(--text-primary);
|
|
2819
2820
|
fill: var(--text-secondary);
|
|
@@ -3534,6 +3535,9 @@
|
|
|
3534
3535
|
left: 0;
|
|
3535
3536
|
}
|
|
3536
3537
|
}
|
|
3538
|
+
.zen-action-list {
|
|
3539
|
+
outline: none;
|
|
3540
|
+
}
|
|
3537
3541
|
.zen-controlled-menu {
|
|
3538
3542
|
z-index: 11002;
|
|
3539
3543
|
}
|
|
@@ -5316,12 +5320,59 @@
|
|
|
5316
5320
|
}
|
|
5317
5321
|
.zen-summary-tile__trigger {
|
|
5318
5322
|
cursor: pointer;
|
|
5323
|
+
background: none;
|
|
5324
|
+
border: none;
|
|
5325
|
+
padding: 0;
|
|
5326
|
+
line-height: 0;
|
|
5327
|
+
position: relative;
|
|
5328
|
+
}
|
|
5329
|
+
.zen-summary-tile__trigger::before {
|
|
5330
|
+
content: "";
|
|
5331
|
+
position: absolute;
|
|
5332
|
+
top: 50%;
|
|
5333
|
+
left: 50%;
|
|
5334
|
+
transform: translate(-50%, -50%);
|
|
5335
|
+
width: 24px;
|
|
5336
|
+
height: 24px;
|
|
5337
|
+
}
|
|
5338
|
+
.zen-summary-tile__trigger:focus-visible {
|
|
5339
|
+
outline: 2px solid var(--borders-form-field--active);
|
|
5340
|
+
outline-offset: 2px;
|
|
5341
|
+
border-radius: 2px;
|
|
5342
|
+
}
|
|
5343
|
+
.zen-summary-tile--action > .zen-summary-tile__trigger {
|
|
5344
|
+
position: absolute;
|
|
5345
|
+
top: 12px;
|
|
5346
|
+
right: 12px;
|
|
5319
5347
|
}
|
|
5320
5348
|
.zen-summary-tile--action {
|
|
5321
5349
|
cursor: pointer;
|
|
5322
5350
|
display: flex;
|
|
5323
5351
|
flex-direction: column;
|
|
5324
5352
|
text-align: start;
|
|
5353
|
+
position: relative;
|
|
5354
|
+
}
|
|
5355
|
+
.zen-summary-tile__clickable-area {
|
|
5356
|
+
background: none;
|
|
5357
|
+
border: none;
|
|
5358
|
+
padding: 0;
|
|
5359
|
+
cursor: pointer;
|
|
5360
|
+
display: flex;
|
|
5361
|
+
flex-direction: column;
|
|
5362
|
+
text-align: start;
|
|
5363
|
+
width: 100%;
|
|
5364
|
+
height: 100%;
|
|
5365
|
+
color: inherit;
|
|
5366
|
+
fill: inherit;
|
|
5367
|
+
font: inherit;
|
|
5368
|
+
border-radius: inherit;
|
|
5369
|
+
}
|
|
5370
|
+
.zen-summary-tile__clickable-area:focus-visible {
|
|
5371
|
+
outline: none;
|
|
5372
|
+
}
|
|
5373
|
+
.zen-summary-tile--action:has(.zen-summary-tile__clickable-area:focus-visible) {
|
|
5374
|
+
outline: 2px solid var(--borders-form-field--active);
|
|
5375
|
+
outline-offset: -1px;
|
|
5325
5376
|
}
|
|
5326
5377
|
.zen-summary-tile__title-block {
|
|
5327
5378
|
height: 16px;
|
|
@@ -6670,6 +6721,13 @@
|
|
|
6670
6721
|
.zen-checkbox-list-with-action__color-info--hidden {
|
|
6671
6722
|
display: none;
|
|
6672
6723
|
}
|
|
6724
|
+
.zen-checkbox-list-with-action__sr-only {
|
|
6725
|
+
position: absolute;
|
|
6726
|
+
left: -9999px;
|
|
6727
|
+
width: 1px;
|
|
6728
|
+
height: 1px;
|
|
6729
|
+
opacity: 0;
|
|
6730
|
+
}
|
|
6673
6731
|
.zen-checkbox-list-with-action.zen-checkbox-list-with-action--drive .zen-checkbox-list-with-action__action-checkbox,
|
|
6674
6732
|
.zen-checkbox-list-with-action.zen-checkbox-list-with-action--drive-tablet .zen-checkbox-list-with-action__action-checkbox {
|
|
6675
6733
|
height: 60px;
|
|
@@ -6809,6 +6867,13 @@
|
|
|
6809
6867
|
.zen-dropdown-list__item--end {
|
|
6810
6868
|
justify-content: flex-end;
|
|
6811
6869
|
}
|
|
6870
|
+
.zen-dropdown-list__sentinel-item {
|
|
6871
|
+
position: "absolute";
|
|
6872
|
+
left: "-9999px";
|
|
6873
|
+
width: "1px";
|
|
6874
|
+
height: "1px";
|
|
6875
|
+
opacity: 0;
|
|
6876
|
+
}
|
|
6812
6877
|
.zen-dropdown-list__action-label {
|
|
6813
6878
|
font-family: var(--main-font);
|
|
6814
6879
|
font-size: 14px;
|
|
@@ -8481,7 +8546,7 @@
|
|
|
8481
8546
|
.zen-status-pill__pill-container {
|
|
8482
8547
|
display: flex;
|
|
8483
8548
|
align-items: center;
|
|
8484
|
-
gap:
|
|
8549
|
+
gap: 4px;
|
|
8485
8550
|
position: relative;
|
|
8486
8551
|
cursor: pointer;
|
|
8487
8552
|
}
|
|
@@ -8500,6 +8565,9 @@
|
|
|
8500
8565
|
.zen-status-pill__pill-container:hover .zen-status-pill__container--error {
|
|
8501
8566
|
border-color: var(--accents-error--detail);
|
|
8502
8567
|
}
|
|
8568
|
+
.zen-status-pill__pill-container:hover .zen-status-pill__container--upsell {
|
|
8569
|
+
border-color: var(--action-secondary--hover);
|
|
8570
|
+
}
|
|
8503
8571
|
.zen-status-pill__container {
|
|
8504
8572
|
font-family: var(--main-font);
|
|
8505
8573
|
font-size: 12px;
|
|
@@ -8583,8 +8651,15 @@
|
|
|
8583
8651
|
.zen-status-pill__container--error:hover {
|
|
8584
8652
|
border-color: var(--accents-error--detail);
|
|
8585
8653
|
}
|
|
8586
|
-
.zen-status-pill__container
|
|
8587
|
-
|
|
8654
|
+
.zen-status-pill__container--upsell {
|
|
8655
|
+
background-color: var(--action-secondary--default);
|
|
8656
|
+
fill: var(--text-reverse-primary);
|
|
8657
|
+
color: var(--text-reverse-primary);
|
|
8658
|
+
}
|
|
8659
|
+
.zen-status-pill__container--upsell:hover {
|
|
8660
|
+
border-color: var(--action-secondary--hover);
|
|
8661
|
+
}
|
|
8662
|
+
.zen-status-pill__container:focus-visible {
|
|
8588
8663
|
outline: none;
|
|
8589
8664
|
border-color: var(--borders-form-field--active);
|
|
8590
8665
|
}
|
|
@@ -8609,6 +8684,12 @@
|
|
|
8609
8684
|
.zen-status-pill__text--error {
|
|
8610
8685
|
color: var(--accents-error--detail);
|
|
8611
8686
|
}
|
|
8687
|
+
.zen-status-pill__text--upsell {
|
|
8688
|
+
color: var(--text-reverse-primary);
|
|
8689
|
+
}
|
|
8690
|
+
.zen-status-pill__text--centered {
|
|
8691
|
+
margin-right: 0;
|
|
8692
|
+
}
|
|
8612
8693
|
.zen-status-pill__expand-button {
|
|
8613
8694
|
padding: 0;
|
|
8614
8695
|
margin-left: auto;
|
|
@@ -8634,13 +8715,20 @@
|
|
|
8634
8715
|
fill: var(--accents-error--detail);
|
|
8635
8716
|
color: var(--accents-error--detail);
|
|
8636
8717
|
}
|
|
8718
|
+
.zen-status-pill__expand-button--upsell {
|
|
8719
|
+
fill: var(--text-reverse-primary);
|
|
8720
|
+
color: var(--text-reverse-primary);
|
|
8721
|
+
}
|
|
8637
8722
|
.zen-status-pill__icon {
|
|
8638
8723
|
display: flex;
|
|
8639
8724
|
align-items: center;
|
|
8640
|
-
height:
|
|
8725
|
+
height: 12px;
|
|
8641
8726
|
margin-right: 4px;
|
|
8642
8727
|
flex-shrink: 0;
|
|
8643
8728
|
}
|
|
8729
|
+
.zen-status-pill__icon--large {
|
|
8730
|
+
height: 16px;
|
|
8731
|
+
}
|
|
8644
8732
|
.zen-status-pill__icon--default {
|
|
8645
8733
|
fill: var(--action-secondary--default);
|
|
8646
8734
|
color: var(--action-secondary--default);
|
|
@@ -8661,25 +8749,71 @@
|
|
|
8661
8749
|
fill: var(--accents-error--detail);
|
|
8662
8750
|
color: var(--accents-error--detail);
|
|
8663
8751
|
}
|
|
8752
|
+
.zen-status-pill__icon--upsell {
|
|
8753
|
+
fill: var(--text-reverse-primary);
|
|
8754
|
+
color: var(--text-reverse-primary);
|
|
8755
|
+
}
|
|
8664
8756
|
.zen-status-pill__icon--standalone {
|
|
8665
8757
|
margin-right: 0;
|
|
8666
8758
|
}
|
|
8667
|
-
.zen-status-pill-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8759
|
+
.zen-absolute:has(.zen-status-pill-popup) {
|
|
8760
|
+
overflow: visible;
|
|
8761
|
+
}
|
|
8762
|
+
.zen-status-pill-popup {
|
|
8763
|
+
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.2);
|
|
8764
|
+
border-radius: 4px;
|
|
8765
|
+
background-color: white;
|
|
8766
|
+
max-height: 560px;
|
|
8767
|
+
overflow: hidden;
|
|
8768
|
+
outline: none;
|
|
8671
8769
|
}
|
|
8672
8770
|
.zen-status-pill-popup__container {
|
|
8673
|
-
box-shadow: 0px 0px 8px 2px rgba(0, 0, 0, 0.2);
|
|
8674
8771
|
display: flex;
|
|
8675
8772
|
flex-direction: column;
|
|
8676
|
-
|
|
8677
|
-
padding: 16px 16px 16px 16px;
|
|
8773
|
+
padding: 12px 8px;
|
|
8678
8774
|
gap: 16px;
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8775
|
+
overflow-y: auto;
|
|
8776
|
+
max-height: 480px;
|
|
8777
|
+
}
|
|
8778
|
+
.zen-status-pill-popup__container--small {
|
|
8779
|
+
width: 220px;
|
|
8780
|
+
}
|
|
8781
|
+
.zen-status-pill-popup__container--medium {
|
|
8782
|
+
width: 320px;
|
|
8783
|
+
}
|
|
8784
|
+
.zen-status-pill-popup__container--large {
|
|
8785
|
+
width: 420px;
|
|
8786
|
+
}
|
|
8787
|
+
.zen-status-pill-popup__title-item {
|
|
8788
|
+
display: flex;
|
|
8789
|
+
align-items: center;
|
|
8790
|
+
padding: 12px 8px;
|
|
8791
|
+
gap: 16px;
|
|
8792
|
+
border-bottom: 1px solid var(--borders-general);
|
|
8793
|
+
}
|
|
8794
|
+
.zen-status-pill-popup__title-item-text {
|
|
8795
|
+
flex: 1;
|
|
8796
|
+
min-width: 0;
|
|
8797
|
+
overflow: hidden;
|
|
8798
|
+
text-overflow: ellipsis;
|
|
8799
|
+
white-space: nowrap;
|
|
8800
|
+
color: var(--text-secondary);
|
|
8801
|
+
font-feature-settings: 'liga' off, 'clig' off;
|
|
8802
|
+
font-family: Roboto, sans-serif;
|
|
8803
|
+
font-size: 14px;
|
|
8804
|
+
font-style: normal;
|
|
8805
|
+
font-weight: 500;
|
|
8806
|
+
line-height: 16px;
|
|
8807
|
+
letter-spacing: 0.16px;
|
|
8808
|
+
}
|
|
8809
|
+
.zen-status-pill-popup__footer {
|
|
8810
|
+
display: flex;
|
|
8811
|
+
flex-direction: column;
|
|
8812
|
+
}
|
|
8813
|
+
.zen-status-pill-popup__children {
|
|
8814
|
+
display: flex;
|
|
8815
|
+
flex-direction: column;
|
|
8816
|
+
gap: 8px;
|
|
8683
8817
|
}
|
|
8684
8818
|
.zen-status-pill-popup__content-header {
|
|
8685
8819
|
display: flex;
|
|
@@ -8749,10 +8883,61 @@
|
|
|
8749
8883
|
.zen-status-pill-popup__actions {
|
|
8750
8884
|
display: flex;
|
|
8751
8885
|
flex-direction: column;
|
|
8752
|
-
gap:
|
|
8886
|
+
gap: 4px;
|
|
8753
8887
|
}
|
|
8754
8888
|
.zen-status-pill-popup__divider.zen-divider {
|
|
8755
|
-
background-color: var(--borders-
|
|
8889
|
+
background-color: var(--borders-general);
|
|
8890
|
+
}
|
|
8891
|
+
.zen-status-pill-popup--mobile .zen-mobile-sheet__title {
|
|
8892
|
+
border-bottom: 1px solid var(--borders-general);
|
|
8893
|
+
}
|
|
8894
|
+
.zen-status-pill-popup--mobile .zen-mobile-sheet__content {
|
|
8895
|
+
padding: 16px;
|
|
8896
|
+
max-height: 90vh;
|
|
8897
|
+
overflow-y: auto;
|
|
8898
|
+
}
|
|
8899
|
+
.zen-status-pill-popup__mobile-title {
|
|
8900
|
+
font-family: var(--main-font);
|
|
8901
|
+
font-size: 16px;
|
|
8902
|
+
font-style: normal;
|
|
8903
|
+
font-weight: 500;
|
|
8904
|
+
letter-spacing: 0;
|
|
8905
|
+
line-height: 24px;
|
|
8906
|
+
text-transform: none;
|
|
8907
|
+
color: var(--text-primary);
|
|
8908
|
+
}
|
|
8909
|
+
.zen-status-pill-popup__mobile-content {
|
|
8910
|
+
display: flex;
|
|
8911
|
+
flex-direction: column;
|
|
8912
|
+
gap: 16px;
|
|
8913
|
+
}
|
|
8914
|
+
.zen-status-pill-popup__view-more-button {
|
|
8915
|
+
display: flex;
|
|
8916
|
+
align-items: center;
|
|
8917
|
+
justify-content: center;
|
|
8918
|
+
gap: 8px;
|
|
8919
|
+
margin: 16px 8px 8px;
|
|
8920
|
+
}
|
|
8921
|
+
.zen-status-pill-popup__view-more-badge {
|
|
8922
|
+
font-family: var(--main-font);
|
|
8923
|
+
font-size: 12px;
|
|
8924
|
+
font-style: normal;
|
|
8925
|
+
font-weight: 400;
|
|
8926
|
+
letter-spacing: 0.32px;
|
|
8927
|
+
line-height: 16px;
|
|
8928
|
+
text-transform: none;
|
|
8929
|
+
display: inline-flex;
|
|
8930
|
+
align-items: center;
|
|
8931
|
+
justify-content: center;
|
|
8932
|
+
min-width: 22px;
|
|
8933
|
+
height: 22px;
|
|
8934
|
+
padding: 0 6px;
|
|
8935
|
+
border-radius: 999px;
|
|
8936
|
+
background-color: var(--action-primary--default);
|
|
8937
|
+
color: var(--text-reverse-primary);
|
|
8938
|
+
line-height: 1;
|
|
8939
|
+
text-align: center;
|
|
8940
|
+
box-sizing: border-box;
|
|
8756
8941
|
}
|
|
8757
8942
|
.zen-beta-pill--mobile {
|
|
8758
8943
|
min-width: unset;
|
|
@@ -9400,6 +9585,25 @@ button.zen-summary__clickable {
|
|
|
9400
9585
|
display: flex;
|
|
9401
9586
|
fill: var(--text-secondary);
|
|
9402
9587
|
justify-content: center;
|
|
9588
|
+
background: none;
|
|
9589
|
+
border: none;
|
|
9590
|
+
padding: 0;
|
|
9591
|
+
line-height: 0;
|
|
9592
|
+
position: relative;
|
|
9593
|
+
}
|
|
9594
|
+
.zen-summary__trigger::before {
|
|
9595
|
+
content: "";
|
|
9596
|
+
position: absolute;
|
|
9597
|
+
top: 50%;
|
|
9598
|
+
left: 50%;
|
|
9599
|
+
transform: translate(-50%, -50%);
|
|
9600
|
+
width: 24px;
|
|
9601
|
+
height: 24px;
|
|
9602
|
+
}
|
|
9603
|
+
.zen-summary__trigger:focus-visible {
|
|
9604
|
+
outline: 2px solid var(--borders-form-field--active);
|
|
9605
|
+
outline-offset: 2px;
|
|
9606
|
+
border-radius: 2px;
|
|
9403
9607
|
}
|
|
9404
9608
|
.zen-summary__data {
|
|
9405
9609
|
align-items: center;
|
package/dist/index.d.ts
CHANGED
|
@@ -720,7 +720,7 @@ export { PageLayout } from "./pageLayout/pageLayout";
|
|
|
720
720
|
export { type IPagination, Pagination } from "./pagination/pagination";
|
|
721
721
|
export { PaginationType } from "./pagination/paginationType";
|
|
722
722
|
export { Pill } from "./pill/pill";
|
|
723
|
-
export { type IPillExpandableAction, type IBaseData, type IPromisedBaseData, type IPillExpandable, PillExpandable } from "./pillExpandable/pillExpandable";
|
|
723
|
+
export { type IPillExpandableAction, type IBaseData, type IPromisedBaseData, type TPopoverSize, type IPillExpandable, PillExpandable } from "./pillExpandable/pillExpandable";
|
|
724
724
|
export { type IPopup, Popup } from "./popup/popup";
|
|
725
725
|
export { type IPrimaryIcon, PrimaryIcon } from "./primaryIcon/primaryIcon";
|
|
726
726
|
export { ProgressBarType, ProgreesBarSize, type TProgressBarSize, ProgressBar } from "./progressBar/progressBar";
|
|
@@ -14,9 +14,11 @@ interface IMarkerClasses {
|
|
|
14
14
|
* If not provided, defaults to 'zen-list-item' based classes
|
|
15
15
|
* @param onBeforeDragOver - Optional callback function called before placing the placeholder at a new position.
|
|
16
16
|
* Receives the target position and should return false to prevent the drag operation.
|
|
17
|
+
* @param itemsGap - Optional gap size in pixels between list items. Used to adjust placeholder positioning
|
|
18
|
+
* calculations during drag operations. Defaults to 0.
|
|
17
19
|
* @returns An object containing the `onDragStart` event handler to be attached to draggable elements
|
|
18
20
|
*/
|
|
19
|
-
export declare const useDragAndDrop: (containerRef: RefObject<HTMLElement | null>, onChangeOrder: (startPosition: number, endPosition: number) => void, marksClassNames?: IMarkerClasses, onBeforeDragOver?: (endPosition: number) => boolean) => {
|
|
21
|
+
export declare const useDragAndDrop: (containerRef: RefObject<HTMLElement | null>, onChangeOrder: (startPosition: number, endPosition: number) => void, marksClassNames?: IMarkerClasses, onBeforeDragOver?: (endPosition: number) => boolean, itemsGap?: number) => {
|
|
20
22
|
onDragStart: (e: React.PointerEvent<HTMLElement>) => void;
|
|
21
23
|
};
|
|
22
24
|
export {};
|
|
@@ -17,9 +17,11 @@ const zen_1 = require("../../utils/zen");
|
|
|
17
17
|
* If not provided, defaults to 'zen-list-item' based classes
|
|
18
18
|
* @param onBeforeDragOver - Optional callback function called before placing the placeholder at a new position.
|
|
19
19
|
* Receives the target position and should return false to prevent the drag operation.
|
|
20
|
+
* @param itemsGap - Optional gap size in pixels between list items. Used to adjust placeholder positioning
|
|
21
|
+
* calculations during drag operations. Defaults to 0.
|
|
20
22
|
* @returns An object containing the `onDragStart` event handler to be attached to draggable elements
|
|
21
23
|
*/
|
|
22
|
-
const useDragAndDrop = (containerRef, onChangeOrder, marksClassNames, onBeforeDragOver) => {
|
|
24
|
+
const useDragAndDrop = (containerRef, onChangeOrder, marksClassNames, onBeforeDragOver, itemsGap = 0) => {
|
|
23
25
|
const dragImageRef = (0, react_1.useRef)(null);
|
|
24
26
|
const dragMoveRef = (0, react_1.useRef)(undefined);
|
|
25
27
|
const { moveScroll, cancelMoveScroll } = (0, useContainerScroll_1.useContainerScroll)();
|
|
@@ -50,8 +52,12 @@ const useDragAndDrop = (containerRef, onChangeOrder, marksClassNames, onBeforeDr
|
|
|
50
52
|
if (!containerRef.current) {
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
|
-
const items = containerRef.current.querySelectorAll(`.${cssMarks.general}`);
|
|
54
55
|
const rect = element.getBoundingClientRect();
|
|
56
|
+
// preventing placeholder alignment when dragged element is not properly positioned yet
|
|
57
|
+
if (rect.top < 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const items = containerRef.current.querySelectorAll(`.${cssMarks.general}`);
|
|
55
61
|
const listRect = containerRef.current.getBoundingClientRect();
|
|
56
62
|
if (rect.top < listRect.top) {
|
|
57
63
|
if (onBeforeDragOver && !onBeforeDragOver(0)) {
|
|
@@ -79,13 +85,14 @@ const useDragAndDrop = (containerRef, onChangeOrder, marksClassNames, onBeforeDr
|
|
|
79
85
|
return;
|
|
80
86
|
}
|
|
81
87
|
const dragItemTopOffset = 4;
|
|
88
|
+
const halfGap = itemsGap / 2;
|
|
82
89
|
for (let i = 0; i < items.length; i++) {
|
|
83
90
|
const item = items[i];
|
|
84
91
|
if (item.classList.contains(cssMarks.placeholder) || item.classList.contains(cssMarks.dragging)) {
|
|
85
92
|
continue;
|
|
86
93
|
}
|
|
87
94
|
const itemRect = item.getBoundingClientRect();
|
|
88
|
-
if (item !== element && rect.top > itemRect.top + dragItemTopOffset && rect.top <= itemRect.bottom) {
|
|
95
|
+
if (item !== element && rect.top > itemRect.top + dragItemTopOffset - halfGap && rect.top <= itemRect.bottom + halfGap) {
|
|
89
96
|
if (onBeforeDragOver && !onBeforeDragOver(i + 1)) {
|
|
90
97
|
return;
|
|
91
98
|
}
|
|
@@ -101,7 +108,7 @@ const useDragAndDrop = (containerRef, onChangeOrder, marksClassNames, onBeforeDr
|
|
|
101
108
|
return;
|
|
102
109
|
}
|
|
103
110
|
}
|
|
104
|
-
}, [containerRef, getPlaceholder, removePlaceholders, onBeforeDragOver, cssMarks.general, cssMarks.placeholder, cssMarks.dragging]);
|
|
111
|
+
}, [containerRef, getPlaceholder, removePlaceholders, onBeforeDragOver, cssMarks.general, cssMarks.placeholder, cssMarks.dragging, itemsGap]);
|
|
105
112
|
const onDragStart = (0, react_1.useCallback)((e) => {
|
|
106
113
|
var _a, _b, _c, _d, _e;
|
|
107
114
|
e.preventDefault();
|
|
@@ -28,7 +28,7 @@ exports.isMenuItem = isMenuItem;
|
|
|
28
28
|
const MenuItem = ({ id, children, name, icon, disabled, onClick, link, target, rel, isMobile = false, setIsOpen, trigger, className, active, alignment }) => {
|
|
29
29
|
const aligmentContext = (0, react_1.useContext)(headerContext_1.MenuAlignmentContext);
|
|
30
30
|
const contentAlignment = alignment || aligmentContext.alignment || "right-top";
|
|
31
|
-
const { path, onOpenBranch, closeBranch } = (0, react_1.useContext)(pathContext_1.PathContext);
|
|
31
|
+
const { path, onOpenBranch, closeBranch, navigatedViaKeyboardRef } = (0, react_1.useContext)(pathContext_1.PathContext);
|
|
32
32
|
const memoizedDesktopActionOnClick = (0, react_1.useCallback)((itemId, e) => {
|
|
33
33
|
setIsOpen === null || setIsOpen === void 0 ? void 0 : setIsOpen(false);
|
|
34
34
|
onClick === null || onClick === void 0 ? void 0 : onClick(itemId, e);
|
|
@@ -87,6 +87,16 @@ const MenuItem = ({ id, children, name, icon, disabled, onClick, link, target, r
|
|
|
87
87
|
return cont;
|
|
88
88
|
}, [children, isMobile, setIsOpen, className]);
|
|
89
89
|
const isOpen = (0, react_1.useMemo)(() => path.includes(id), [path, id]);
|
|
90
|
+
// Track previous isOpen state to detect when submenu opens
|
|
91
|
+
const wasOpenRef = (0, react_1.useRef)(false);
|
|
92
|
+
const localOpenedViaKeyboardRef = (0, react_1.useRef)(false);
|
|
93
|
+
// Capture keyboard navigation state synchronously when isOpen transitions to true
|
|
94
|
+
if (isOpen && !wasOpenRef.current && navigatedViaKeyboardRef) {
|
|
95
|
+
localOpenedViaKeyboardRef.current = navigatedViaKeyboardRef.current;
|
|
96
|
+
navigatedViaKeyboardRef.current = false; // Reset for next navigation
|
|
97
|
+
}
|
|
98
|
+
wasOpenRef.current = isOpen;
|
|
99
|
+
const openedViaKeyboard = localOpenedViaKeyboardRef.current;
|
|
90
100
|
if (content.length === 0) {
|
|
91
101
|
return (0, jsx_runtime_1.jsx)(menuButton_1.MenuButton, { id: id, name: name, icon: icon, disabled: disabled, link: link, target: target, rel: rel, onClick: memoizedDesktopActionOnClick, className: className, active: active, hasChildren: false }, id);
|
|
92
102
|
}
|
|
@@ -103,7 +113,7 @@ const MenuItem = ({ id, children, name, icon, disabled, onClick, link, target, r
|
|
|
103
113
|
else {
|
|
104
114
|
popupTrigger = (0, jsx_runtime_1.jsx)(menuButton_1.MenuButton, { id: id, ref: ref, name: name, icon: icon, disabled: disabled, hasChildren: true, onClick: memoizedTriggerOnClick, active: active }, id);
|
|
105
115
|
}
|
|
106
|
-
return (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [popupTrigger, (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { className: (0, classNames_1.classNames)([`zen-controlled-menu-submenu--${path.length}`]), useTrapFocusWithTrigger: "on", alignment: contentAlignment, triggerRef: ref, isOpen: isOpen, onOpenChange: memoizedOnOpenChange, ariaLabel: popupTrigger.props.name, recalculateOnScroll: true, children: (0, jsx_runtime_1.jsx)("ul", { role: "menu", className: "zen-menu-item", children: content }) })] }, id);
|
|
116
|
+
return (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [popupTrigger, (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { className: (0, classNames_1.classNames)([`zen-controlled-menu-submenu--${path.length}`]), useTrapFocusWithTrigger: openedViaKeyboard ? "on" : "withTrigger", alignment: contentAlignment, triggerRef: ref, isOpen: isOpen, onOpenChange: memoizedOnOpenChange, ariaLabel: popupTrigger.props.name, recalculateOnScroll: true, children: (0, jsx_runtime_1.jsx)("ul", { role: "menu", className: "zen-menu-item", children: content }) })] }, id);
|
|
107
117
|
};
|
|
108
118
|
exports.MenuItem = MenuItem;
|
|
109
119
|
exports.MenuItem.displayName = "MenuItem";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { RefObject } from "react";
|
|
2
2
|
export interface IPathContext {
|
|
3
3
|
path: string[];
|
|
4
4
|
onOpenBranch: (id: string) => void;
|
|
5
5
|
closeBranch: () => void;
|
|
6
|
+
navigatedViaKeyboardRef?: RefObject<boolean>;
|
|
7
|
+
keyboardActiveRef?: RefObject<boolean>;
|
|
6
8
|
}
|
|
7
9
|
export declare const PathContext: import("react").Context<IPathContext>;
|
|
@@ -2,5 +2,5 @@ import { PropsWithChildren } from "react";
|
|
|
2
2
|
import { IPathContext } from "./pathContext";
|
|
3
3
|
interface IPathProvider extends IPathContext, PropsWithChildren {
|
|
4
4
|
}
|
|
5
|
-
export declare const PathProvider: ({ children, path, onOpenBranch, closeBranch }: IPathProvider) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const PathProvider: ({ children, path, onOpenBranch, closeBranch, navigatedViaKeyboardRef, keyboardActiveRef }: IPathProvider) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PathProvider = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const pathContext_1 = require("./pathContext");
|
|
6
|
-
const PathProvider = ({ children, path, onOpenBranch, closeBranch }) => ((0, jsx_runtime_1.jsx)(pathContext_1.PathContext.Provider, { value: { path, onOpenBranch, closeBranch }, children: children }));
|
|
6
|
+
const PathProvider = ({ children, path, onOpenBranch, closeBranch, navigatedViaKeyboardRef, keyboardActiveRef }) => ((0, jsx_runtime_1.jsx)(pathContext_1.PathContext.Provider, { value: { path, onOpenBranch, closeBranch, navigatedViaKeyboardRef, keyboardActiveRef }, children: children }));
|
|
7
7
|
exports.PathProvider = PathProvider;
|
|
@@ -22,17 +22,57 @@ const useDeviceType_1 = require("../commonHelpers/hooks/useDeviceType");
|
|
|
22
22
|
const utils_1 = require("../commonHelpers/utils");
|
|
23
23
|
const pathProvider_1 = require("./contexts/pathProvider");
|
|
24
24
|
const menuSeparator_1 = require("./components/menuSeparator");
|
|
25
|
+
const focusableSelector_1 = require("../utils/focusableSelector");
|
|
25
26
|
const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ariaLabelledby, id, title, className = "", listClassName = "", paddingX = 0, paddingY = 0, alignment }) => {
|
|
26
27
|
const [deviceType, setDeviceType] = (0, react_1.useState)(deviceType_1.DeviceType.Desktop);
|
|
27
28
|
const isMobile = deviceType === deviceType_1.DeviceType.Mobile;
|
|
28
29
|
const memoizedOnChange = (0, react_1.useCallback)(setIsOpen, [setIsOpen]);
|
|
29
30
|
(0, useDeviceType_1.useDeviceType)(setDeviceType);
|
|
31
|
+
const menuListRef = (0, react_1.useRef)(null);
|
|
30
32
|
const [path, setPath] = (0, react_1.useState)([]);
|
|
33
|
+
// Track if the trigger was activated via keyboard
|
|
34
|
+
const openedViaKeyboardRef = (0, react_1.useRef)(false);
|
|
35
|
+
// Track if submenu was navigated via keyboard (ArrowRight)
|
|
36
|
+
const navigatedViaKeyboardRef = (0, react_1.useRef)(false);
|
|
37
|
+
// Track if keyboard is actively being used for navigation (vs mouse/touch)
|
|
38
|
+
const keyboardActiveRef = (0, react_1.useRef)(false);
|
|
39
|
+
// Listen for keyboard activation on trigger
|
|
40
|
+
(0, react_1.useEffect)(() => {
|
|
41
|
+
const trigger = triggerRef.current;
|
|
42
|
+
if (!trigger)
|
|
43
|
+
return undefined;
|
|
44
|
+
const handleKeyDown = (e) => {
|
|
45
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
46
|
+
openedViaKeyboardRef.current = true;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const handleMouseDown = () => {
|
|
50
|
+
openedViaKeyboardRef.current = false;
|
|
51
|
+
};
|
|
52
|
+
trigger.addEventListener("keydown", handleKeyDown);
|
|
53
|
+
trigger.addEventListener("mousedown", handleMouseDown);
|
|
54
|
+
return () => {
|
|
55
|
+
trigger.removeEventListener("keydown", handleKeyDown);
|
|
56
|
+
trigger.removeEventListener("mousedown", handleMouseDown);
|
|
57
|
+
};
|
|
58
|
+
}, [triggerRef]);
|
|
31
59
|
(0, react_1.useEffect)(() => {
|
|
32
60
|
if (path.length && !isOpen) {
|
|
33
61
|
setPath([]);
|
|
34
62
|
}
|
|
35
63
|
}, [isOpen, path, setPath]);
|
|
64
|
+
// Focus the menu list container or first item when menu opens (for keyboard navigation)
|
|
65
|
+
(0, react_1.useEffect)(() => {
|
|
66
|
+
var _a;
|
|
67
|
+
if (isOpen && !isMobile && menuListRef.current) {
|
|
68
|
+
if (openedViaKeyboardRef.current) {
|
|
69
|
+
(_a = menuListRef.current.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
menuListRef.current.focus();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, [isOpen, isMobile]);
|
|
36
76
|
const onOpenBranch = (0, react_1.useCallback)((branchId) => {
|
|
37
77
|
if (!branchId) {
|
|
38
78
|
return;
|
|
@@ -110,48 +150,76 @@ const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ar
|
|
|
110
150
|
});
|
|
111
151
|
return [cont, par];
|
|
112
152
|
}, [children, isMobile, path, setIsOpen]);
|
|
153
|
+
// Handle keyboard navigation when no menu item is focused (e.g., when menu just opened)
|
|
154
|
+
const handleUnfocusedKeyDown = (e, menuList) => {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
if (e.key === "ArrowDown" || e.key === "Home") {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
(_a = (0, findFirstFocusable_1.findFirstFocusable)(menuList)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
if (e.key === "ArrowUp" || e.key === "End") {
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
(_b = (0, findLastFocusable_1.findLastFocusable)(menuList)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
};
|
|
168
|
+
const onMouseDown = () => {
|
|
169
|
+
keyboardActiveRef.current = false;
|
|
170
|
+
};
|
|
113
171
|
const onKeyDown = (e) => {
|
|
114
172
|
var _a, _b, _c, _d;
|
|
173
|
+
keyboardActiveRef.current = true;
|
|
115
174
|
const target = e.target;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
e.preventDefault();
|
|
124
|
-
(_b = (0, findPrevFocusable_1.findPrevFocusable)(target)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (e.key === "Home") {
|
|
128
|
-
e.preventDefault();
|
|
129
|
-
(_c = (0, findFirstFocusable_1.findFirstFocusable)(target)) === null || _c === void 0 ? void 0 : _c.focus();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (e.key === "End") {
|
|
133
|
-
e.preventDefault();
|
|
134
|
-
(_d = (0, findLastFocusable_1.findLastFocusable)(target)) === null || _d === void 0 ? void 0 : _d.focus();
|
|
135
|
-
return;
|
|
175
|
+
const currentTarget = e.currentTarget;
|
|
176
|
+
if (!(0, isButton_1.isButton)(target) && !(0, isLink_1.isLink)(target)) {
|
|
177
|
+
if (target === currentTarget) {
|
|
178
|
+
const menuList = currentTarget.querySelector("ul");
|
|
179
|
+
if (menuList) {
|
|
180
|
+
handleUnfocusedKeyDown(e, menuList);
|
|
181
|
+
}
|
|
136
182
|
}
|
|
183
|
+
return;
|
|
137
184
|
}
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
185
|
+
if (e.key === "ArrowDown") {
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
(_a = (0, findNextFocusable_1.findNextFocusable)(target)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (e.key === "ArrowUp") {
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
(_b = (0, findPrevFocusable_1.findPrevFocusable)(target)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (e.key === "Home") {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
(_c = (0, findFirstFocusable_1.findFirstFocusable)(target)) === null || _c === void 0 ? void 0 : _c.focus();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (e.key === "End") {
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
(_d = (0, findLastFocusable_1.findLastFocusable)(target)) === null || _d === void 0 ? void 0 : _d.focus();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if ((0, isButton_1.isButton)(target) && (e.key === "ArrowRight" || e.key === "Enter" || e.key === " ") && target.classList.contains("zen-menu-button__action--has-children")) {
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
navigatedViaKeyboardRef.current = true;
|
|
208
|
+
target.click();
|
|
144
209
|
}
|
|
145
210
|
};
|
|
146
|
-
const renderMenuList = () => (0, jsx_runtime_1.jsx)("div", { onKeyDown: onKeyDown, className: (0, classNames_1.classNames)(["zen-action-list", className]), children: (0, jsx_runtime_1.jsxs)("ul", { role: "menu", className: (0, classNames_1.classNames)(["zen-menu-item", className, listClassName]), children: [parent ? (0, jsx_runtime_1.jsx)(menuButton_1.MenuButton, { id: "root", name: parent.props.name || "", icon: iconArrowLeft_1.IconArrowLeft, onClick: closeBranch, hasChildren: false, disabled: false }, "root") : null, content] }) });
|
|
211
|
+
const renderMenuList = () => (0, jsx_runtime_1.jsx)("div", { ref: menuListRef, tabIndex: -1, onKeyDown: onKeyDown, onMouseDown: onMouseDown, className: (0, classNames_1.classNames)(["zen-action-list", className]), children: (0, jsx_runtime_1.jsxs)("ul", { role: "menu", className: (0, classNames_1.classNames)(["zen-menu-item", className, listClassName]), children: [parent ? (0, jsx_runtime_1.jsx)(menuButton_1.MenuButton, { id: "root", name: parent.props.name || "", icon: iconArrowLeft_1.IconArrowLeft, onClick: closeBranch, hasChildren: false, disabled: false }, "root") : null, content] }) });
|
|
147
212
|
const hideMenu = (0, react_1.useCallback)(() => {
|
|
148
213
|
closeBranch();
|
|
149
214
|
setIsOpen(false);
|
|
150
215
|
}, [closeBranch, setIsOpen]);
|
|
151
216
|
if (isMobile) {
|
|
152
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, children: (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { label: title, isOpen: isOpen, triggerRef: triggerRef, onHidePanel: hideMenu, onCloseClick: hideMenu, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: renderMenuList() })] }) }) });
|
|
217
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { label: title, isOpen: isOpen, triggerRef: triggerRef, onHidePanel: hideMenu, onCloseClick: hideMenu, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: renderMenuList() })] }) }) });
|
|
153
218
|
}
|
|
154
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, children: (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { id: id, useTrapFocusWithTrigger: "on", className: (0, classNames_1.classNames)(["zen-controlled-menu", className]), onOpenChange: memoizedOnChange, isOpen: isOpen, triggerRef: triggerRef, paddingX: paddingX, paddingY: paddingY, alignment: alignment, ariaLabelledby: ariaLabelledby, ariaLabel: ariaLabel || title, recalculateOnScroll: true,
|
|
219
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { id: id, useTrapFocusWithTrigger: "on", className: (0, classNames_1.classNames)(["zen-controlled-menu", className]), onOpenChange: memoizedOnChange, isOpen: isOpen, triggerRef: triggerRef, paddingX: paddingX, paddingY: paddingY, alignment: alignment, ariaLabelledby: ariaLabelledby, ariaLabel: ariaLabel || title, recalculateOnScroll: true,
|
|
220
|
+
// focusOnOpen is false - ControlledMenu handles focus based on input method
|
|
221
|
+
// (keyboard vs mouse) in its own useEffect
|
|
222
|
+
focusOnOpen: false, children: renderMenuList() }) }) });
|
|
155
223
|
};
|
|
156
224
|
exports.ControlledMenu = ControlledMenu;
|
|
157
225
|
exports.ControlledMenu.Item = menuItem_1.MenuItem;
|
package/dist/nav/nav.d.ts
CHANGED
|
@@ -7,8 +7,9 @@ export interface INav extends IZenComponentProps {
|
|
|
7
7
|
onMenuVisibilityToggle?: (isOpen: boolean) => void;
|
|
8
8
|
isMobileMenuOpen?: boolean;
|
|
9
9
|
onIsMobileMenuOpenToggle?: (isOpen: boolean) => void;
|
|
10
|
+
onEditModeToggle?: (isEdit: boolean) => void;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* @beta This component is not fully ready yet and may change in future releases.
|
|
13
14
|
*/
|
|
14
|
-
export declare const Nav: ({ children, className, collapsed, onCollapseToggle, onMenuVisibilityToggle, mobileBarContainer, isMobileMenuOpen, onIsMobileMenuOpenToggle }: INav) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const Nav: ({ children, className, collapsed, onCollapseToggle, onMenuVisibilityToggle, mobileBarContainer, isMobileMenuOpen, onIsMobileMenuOpenToggle, onEditModeToggle }: INav) => import("react/jsx-runtime").JSX.Element;
|