@apptegy/nuxt-navigation 1.0.0-alpha.0 → 1.0.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 (71) hide show
  1. package/README.md +70 -5
  2. package/dist/module.cjs +5 -0
  3. package/dist/module.d.mts +2 -3
  4. package/dist/module.d.ts +7 -0
  5. package/dist/module.json +2 -5
  6. package/dist/module.mjs +3 -7
  7. package/dist/runtime/assets/icons/24/Minus.svg +5 -0
  8. package/dist/runtime/assets/icons/24/Plus.svg +5 -0
  9. package/dist/runtime/assets/thrillshare-logo-white.svg +1 -22
  10. package/dist/runtime/components/Nav/Avatar.vue +23 -46
  11. package/dist/runtime/components/Nav/Header.vue +159 -161
  12. package/dist/runtime/components/Nav/HelpArticles.vue +61 -119
  13. package/dist/runtime/components/Nav/ImpersonateInfoPanel.vue +32 -45
  14. package/dist/runtime/components/Nav/OrgSelect.vue +117 -162
  15. package/dist/runtime/components/Nav/Sidebar.vue +109 -216
  16. package/dist/runtime/components/Nav/SidebarItem.vue +17 -44
  17. package/dist/runtime/components/Nav/SidebarSection.vue +38 -88
  18. package/dist/runtime/components/Nav/SubMenu.vue +4 -0
  19. package/dist/runtime/components/Nav/SubMenuItem.vue +7 -6
  20. package/dist/runtime/composables/accessibleActions.d.ts +33 -0
  21. package/dist/runtime/composables/accessibleActions.js +195 -0
  22. package/dist/types.d.mts +1 -3
  23. package/dist/types.d.ts +1 -0
  24. package/package.json +27 -26
  25. package/dist/runtime/api/brand.d.ts +0 -3
  26. package/dist/runtime/api/brand.js +0 -8
  27. package/dist/runtime/assets/checkmark.svg +0 -3
  28. package/dist/runtime/assets/hamburger.svg +0 -3
  29. package/dist/runtime/assets/iconPaths.json +0 -13
  30. package/dist/runtime/assets/icons/24/Metadata.svg +0 -4
  31. package/dist/runtime/assets/impersonation.svg +0 -6
  32. package/dist/runtime/assets/poweredby-icon.svg +0 -3
  33. package/dist/runtime/assets/poweredby.svg +0 -19
  34. package/dist/runtime/components/Nav/Avatar.vue.d.ts +0 -16
  35. package/dist/runtime/components/Nav/Breadcrumb.vue.d.ts +0 -12
  36. package/dist/runtime/components/Nav/Header.vue.d.ts +0 -39
  37. package/dist/runtime/components/Nav/HelpArticles.vue.d.ts +0 -14
  38. package/dist/runtime/components/Nav/Icons/ApptegyLogo.vue +0 -30
  39. package/dist/runtime/components/Nav/Icons/ApptegyLogo.vue.d.ts +0 -14
  40. package/dist/runtime/components/Nav/Icons/Pinned.vue +0 -9
  41. package/dist/runtime/components/Nav/Icons/Pinned.vue.d.ts +0 -2
  42. package/dist/runtime/components/Nav/Icons/SidebarToggle.vue +0 -15
  43. package/dist/runtime/components/Nav/Icons/SidebarToggle.vue.d.ts +0 -2
  44. package/dist/runtime/components/Nav/Icons/ThrillshareLogo.vue +0 -25
  45. package/dist/runtime/components/Nav/Icons/ThrillshareLogo.vue.d.ts +0 -2
  46. package/dist/runtime/components/Nav/Icons/Unpinned.vue +0 -9
  47. package/dist/runtime/components/Nav/Icons/Unpinned.vue.d.ts +0 -2
  48. package/dist/runtime/components/Nav/Icons/UserDropdownMenu.vue +0 -5
  49. package/dist/runtime/components/Nav/Icons/UserDropdownMenu.vue.d.ts +0 -2
  50. package/dist/runtime/components/Nav/ImpersonateInfoPanel.vue.d.ts +0 -12
  51. package/dist/runtime/components/Nav/OrgSelect.vue.d.ts +0 -16
  52. package/dist/runtime/components/Nav/Sidebar.vue.d.ts +0 -53
  53. package/dist/runtime/components/Nav/SidebarItem.vue.d.ts +0 -20
  54. package/dist/runtime/components/Nav/SidebarSection.vue.d.ts +0 -18
  55. package/dist/runtime/components/Nav/SidebarToggle.vue +0 -28
  56. package/dist/runtime/components/Nav/SidebarToggle.vue.d.ts +0 -2
  57. package/dist/runtime/components/Nav/SubMenu.vue.d.ts +0 -12
  58. package/dist/runtime/components/Nav/SubMenuItem.vue.d.ts +0 -22
  59. package/dist/runtime/components/Nav/UserDropdown.vue +0 -178
  60. package/dist/runtime/components/Nav/UserDropdown.vue.d.ts +0 -19
  61. package/dist/runtime/composables/useBranding.d.ts +0 -22
  62. package/dist/runtime/composables/useBranding.js +0 -35
  63. package/dist/runtime/composables/useDropdown.d.ts +0 -19
  64. package/dist/runtime/composables/useDropdown.js +0 -236
  65. package/dist/runtime/composables/useSidebar.d.ts +0 -5
  66. package/dist/runtime/composables/useSidebar.js +0 -13
  67. package/dist/runtime/types/index.d.ts +0 -13
  68. package/dist/runtime/types/index.js +0 -0
  69. package/locale/en.json +0 -20
  70. package/locale/index.js +0 -7
  71. /package/dist/runtime/assets/{icon.svg → thrillshare-icon-white.svg} +0 -0
@@ -1,53 +1,47 @@
1
1
  <template>
2
- <div id="impersonate-info" class="a-nav-section animated">
3
- <button class="a-nav-section--title" @click="expanded = !expanded">
2
+ <div class="a-nav-section animated" id="impersonate-info">
3
+ <button v-if="navbarExpanded" class="a-nav-section--title" @click="expanded = !expanded">
4
4
  <div class="a-nav-section-title-wrapper">
5
5
  <div class="user-grid">
6
- <svg class="user-icon" width="32" height="32" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
7
- <path fill-rule="evenodd" clip-rule="evenodd" d="M9.51621 5.46934C10.1369 4.84868 10.9787 4.5 11.8564 4.5C12.291 4.5 12.7214 4.5856 13.1229 4.75192C13.5244 4.91824 13.8893 5.16202 14.1966 5.46934C14.5039 5.77665 14.7477 6.14149 14.914 6.54302C15.0803 6.94455 15.1659 7.37491 15.1659 7.80952V8.57143C15.1659 9.49888 14.7851 10.5353 14.1564 11.3376C13.5263 12.1419 12.7049 12.6429 11.8564 12.6429C11.0079 12.6429 10.1865 12.1419 9.55636 11.3376C8.92771 10.5353 8.54688 9.49888 8.54688 8.57143V7.80952C8.54688 6.93178 8.89556 6.08999 9.51621 5.46934ZM11.8564 3.5C10.7134 3.5 9.6173 3.95404 8.80911 4.76223C8.00091 5.57042 7.54688 6.66657 7.54688 7.80952V8.57143C7.54688 9.7476 8.01899 10.9969 8.7692 11.9544C9.01711 12.2708 9.3017 12.5628 9.61708 12.8118C8.52026 12.9611 7.43611 13.2184 6.38137 13.5787L6.38124 13.5787C6.3509 13.5891 6.31976 13.5995 6.28797 13.6102C5.881 13.7463 5.36524 13.9189 5.0108 14.4575C4.65147 15.0035 4.5 15.85 4.5 17.2149V18.2382C4.5 19.0666 5.17157 19.7382 6 19.7382H13.381C13.6571 19.7382 13.881 19.5143 13.881 19.2382C13.881 18.962 13.6571 18.7382 13.381 18.7382H6C5.72386 18.7382 5.5 18.5143 5.5 18.2382V17.2149C5.5 15.8649 5.66268 15.286 5.84614 15.0072C6.00676 14.7632 6.20845 14.6943 6.70434 14.5251L6.70448 14.5251C9.55741 13.5506 12.6282 13.3783 15.5451 14.1095C15.8129 14.1766 16.0845 14.0139 16.1517 13.746C16.2188 13.4782 16.0561 13.2066 15.7882 13.1395C15.2284 12.9991 14.6636 12.8901 14.0961 12.8115C14.4113 12.5625 14.6958 12.2707 14.9436 11.9544C15.6938 10.9969 16.1659 9.7476 16.1659 8.57143V7.80952C16.1659 7.24359 16.0545 6.6832 15.8379 6.16034C15.6213 5.63748 15.3039 5.16241 14.9037 4.76223C14.5035 4.36205 14.0284 4.04462 13.5056 3.82804C12.9827 3.61147 12.4223 3.5 11.8564 3.5ZM19.0684 15.0752C18.8731 14.8799 18.5566 14.8799 18.3613 15.0752C18.166 15.2704 18.166 15.587 18.3613 15.7823L19.7929 17.2139H14.8018C14.5256 17.2139 14.3018 17.4377 14.3018 17.7139C14.3018 17.99 14.5256 18.2139 14.8018 18.2139H19.794L18.3613 19.6466C18.166 19.8418 18.166 20.1584 18.3613 20.3537C18.5566 20.549 18.8731 20.549 19.0684 20.3537L20.647 18.7751C21.2328 18.1893 21.2328 17.2396 20.647 16.6538L19.0684 15.0752Z" fill="currentColor"/>
8
- </svg>
9
- <template v-if="sidebarExpanded">
10
- <p class="info">{{ impersonatedUser.client }}</p>
11
- <p class="info email">{{ impersonatedUser.email }}</p>
12
- <svg class="panel-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
13
- <path v-if="expanded" d="M12 5V12M12 12L12 19M12 12L19 12M12 12H5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
14
- <path v-else d="M19 12L12 12H5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
15
- </svg>
16
- </template>
6
+ <img src="../../assets/img/impersonate-user.svg" alt="" class="user-icon" />
7
+ <p class="info">{{ impersonatedUser.client }}</p>
8
+ <p class="info email">{{ impersonatedUser.email }}</p>
9
+ <img v-if="!expanded " class="panel-icon" src="../../assets/icons/24/plus.svg" alt="" />
10
+ <img v-else class="panel-icon" src="../../assets/icons/24/minus.svg" alt="" />
17
11
  </div>
18
12
  <div
19
13
  ref="dropdownWrapper"
20
- :style="{ 'max-height': `${expanded && sidebarExpanded ? dropdownScrollHeight : 0}px` }"
14
+ :style="{ 'max-height': `${expanded && navbarExpanded ? dropdownScrollHeight : 0}px` }"
21
15
  class="a-nav-section-title-dropdown-wrapper"
22
16
  >
23
17
  <div class="user-grid">
24
- <svg class="user-icon" width="32" height="32" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
25
- <path d="M8 8C8 5.79086 9.79087 4 12 4C14.2091 4 16 5.79086 16 8C16 10.2091 14.2091 12 12 12C9.79087 12 8 10.2091 8 8Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
26
- <path d="M12 14C10.5245 14 9.0395 13.451 8.36915 13.1665C8.12951 13.0649 7.85796 13.0374 7.6242 13.152C5.4795 14.2028 4.10839 18.0542 6 19C8 20 12 20 12 20C12 20 16 20 18 19C19.8916 18.0542 18.5205 14.2028 16.3758 13.152C16.142 13.0374 15.8705 13.0649 15.6309 13.1665C14.9605 13.451 13.4755 14 12 14Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
27
- </svg>
28
- <template v-if="sidebarExpanded">
29
- <p class="info">{{ impersonatedUser.client }}</p>
30
- <p class="info email">{{ impersonatedUser.admin_email }}</p>
31
- </template>
18
+ <img src="../../assets/img/user.svg" alt="" class="user-icon" />
19
+ <p class="info">{{ impersonatedUser.client }}</p>
20
+ <p class="info">{{ impersonatedUser.admin_email }}</p>
32
21
  </div>
33
22
  </div>
34
23
  </div>
24
+ <!-- add plus icon -->
35
25
  </button>
26
+ <!-- <img v-else src="../../assets/img/impersonate-user.svg" alt="" class="user-icon" /> -->
36
27
  </div>
37
28
  </template>
38
29
 
39
- <script setup>
40
- import { ref, onMounted, useSidebar } from "#imports";
41
- defineProps({
42
- impersonatedUser: { type: Object, required: true }
43
- });
44
- const { state: sidebarExpanded } = useSidebar();
30
+ <script setup lang="ts">
31
+ const props = defineProps<{
32
+ navbarExpanded: boolean;
33
+ impersonatedUser: {};
34
+ }>();
35
+
45
36
  const expanded = ref(false);
37
+
46
38
  const dropdownScrollHeight = ref(0);
47
39
  const dropdownWrapper = ref();
40
+
48
41
  onMounted(() => {
49
- dropdownScrollHeight.value = dropdownWrapper.value?.scrollHeight;
50
- });
42
+ dropdownScrollHeight.value = dropdownWrapper.value?.scrollHeight
43
+ })
44
+
51
45
  </script>
52
46
 
53
47
  <style scoped>
@@ -55,18 +49,18 @@ onMounted(() => {
55
49
  cursor: pointer;
56
50
  height: fit-content;
57
51
  overflow: hidden;
58
- background-color: var(--nav-background-color, #FFF);
52
+ background-color: var(--dscl-nav-background-color, var(--purple-70));
59
53
  }
60
54
  .a-nav-section.animated {
61
55
  transition: overflow 0.5s ease-in-out;
62
56
  }
63
57
  .a-nav-section--title {
64
- color: var(--nav-text-color, #222222);
58
+ color: var(--dscl-nav-font-color, var(--dscl-light-font, var(--primary-white)));
65
59
  display: flex;
66
60
  justify-content: space-between;
67
61
  background: none;
68
62
  border: none;
69
- border-top: 1px var(--nav-border-colors, #DFDFDF) solid;
63
+ border-top: 1px var(--dscl-nav-section-border-bottom-color, var(--purple-65)) solid;
70
64
  padding: 0;
71
65
  width: 100%;
72
66
  cursor: pointer;
@@ -91,41 +85,34 @@ onMounted(() => {
91
85
  padding: 12px 0;
92
86
  }
93
87
  .a-nav-section--title .a-nav-section-title-wrapper .user-grid .user-icon {
94
- color: var(--nav-icon-color, #222222);
95
88
  grid-row: 1/span 2;
96
- background: var(--nav-icon-background, #FFF);
89
+ background: #504764;
97
90
  border-radius: 4px;
98
91
  padding: 4px;
99
92
  margin-right: auto;
100
93
  margin-left: 16px;
101
94
  }
102
95
  .a-nav-section--title .a-nav-section-title-wrapper .user-grid .info {
103
- color: var(--nav-text-color, #222222);
96
+ color: var(--primary-white);
104
97
  margin: 0;
105
98
  grid-row: 1;
106
99
  grid-column: 2;
107
100
  font-size: 12px;
108
101
  font-style: normal;
109
- font-weight: 400;
102
+ font-weight: 450;
110
103
  line-height: 16px;
111
104
  letter-spacing: 0.4px;
112
- max-width: 165px;
113
- overflow: hidden;
114
- text-overflow: ellipsis;
115
105
  }
116
106
  .a-nav-section--title .a-nav-section-title-wrapper .user-grid .email {
117
107
  grid-column: 2;
118
108
  grid-row: 2;
119
109
  margin-top: 4px;
120
- color: var(--nav-text-color, #222222);
110
+ color: #CAC2D0;
121
111
  font-size: 11px;
122
112
  font-style: normal;
123
- font-weight: 400;
113
+ font-weight: 450;
124
114
  line-height: 12px;
125
115
  letter-spacing: 0.4px;
126
- max-width: 165px;
127
- overflow: hidden;
128
- text-overflow: ellipsis;
129
116
  }
130
117
  .a-nav-section--title .a-nav-section-title-wrapper .user-grid .panel-icon {
131
118
  transition: transform 0.2s ease-in-out;
@@ -1,85 +1,7 @@
1
- <script setup>
2
- import { useDropdown, useNuxtApp, useAppConfig, computed, ref, watch, onBeforeUpdate } from "#imports";
3
- import { vOnClickOutside } from "@vueuse/components";
4
- const { $t } = useNuxtApp();
5
- const appConfig = useAppConfig();
6
- const zIndex = computed(() => appConfig?.navigation?.zIndex || 100);
7
- const emit = defineEmits(["update:model-value"]);
8
- const dropdownTriggerRef = ref();
9
- const inputRef = ref();
10
- const optionRefs = ref([]);
11
- const props = defineProps({
12
- orgs: { type: Array, required: true },
13
- modelValue: { type: Number, required: true }
14
- });
15
- const localSelectedOrgId = ref(props.modelValue);
16
- watch(() => props.modelValue, (newValue) => {
17
- localSelectedOrgId.value = newValue;
18
- });
19
- const selectedOrg = computed(() => {
20
- return props.orgs.find(({ id }) => id == localSelectedOrgId.value);
21
- });
22
- const {
23
- active,
24
- searchQuery,
25
- highlightedIndex,
26
- toggleDropdown,
27
- closeDropdown,
28
- onClickOutsideHandler,
29
- keydownActionsOnTrigger,
30
- handleKeydown,
31
- handleDropdownSearch
32
- } = useDropdown(props.orgs, optionRefs, inputRef, {
33
- searchable: true,
34
- trackBy: "name"
35
- });
36
- const sortedOrgs = computed(() => {
37
- return [...props.orgs].sort((a, b) => {
38
- if (a.pinned && !b.pinned) {
39
- return -1;
40
- } else if (!a.pinned && b.pinned) {
41
- return 1;
42
- } else {
43
- return 0;
44
- }
45
- });
46
- });
47
- const highlightedOrg = computed(() => {
48
- if (highlightedIndex.value >= 0 && highlightedIndex.value < props.orgs.length) {
49
- return props.orgs[highlightedIndex.value];
50
- }
51
- return null;
52
- });
53
- onBeforeUpdate(() => {
54
- optionRefs.value = [];
55
- });
56
- function setOptionRef(el, option) {
57
- if (el) {
58
- const index = props.orgs.findIndex((org) => org.id === option.id);
59
- optionRefs.value[index] = el;
60
- }
61
- }
62
- function handleSelectedOrg($event, orgId) {
63
- const orgIndex = props.orgs.findIndex((org) => org.id === orgId);
64
- if ($event.type == "click") {
65
- localSelectedOrgId.value = orgId;
66
- emit("update:model-value", orgId);
67
- closeDropdown();
68
- } else if ($event.type == "keydown") {
69
- const keyEvent = $event;
70
- if (keyEvent.key === "Enter" || keyEvent.key === " ") {
71
- localSelectedOrgId.value = orgId;
72
- emit("update:model-value", orgId);
73
- }
74
- handleKeydown(keyEvent, orgIndex);
75
- }
76
- }
77
- </script>
78
-
79
1
  <template>
80
2
  <div class="org-selection">
81
3
  <label id="org-dropdown-label" class="sr-only">
82
- {{ $t("navigation.orgDropdown") }}
4
+ {{ orgDropdownLabel }}
83
5
  </label>
84
6
  <div
85
7
  ref="dropdownTriggerRef"
@@ -89,55 +11,51 @@ function handleSelectedOrg($event, orgId) {
89
11
  aria-haspopup="listbox"
90
12
  role="combobox"
91
13
  class="dropdown-trigger"
92
- >
14
+ >
93
15
  <input
94
16
  ref="inputRef"
95
- type="text"
17
+ is="input"
96
18
  class="org-title"
97
- :placeholder="$t('navigation.orgPlaceholder')"
98
- :value="active ? searchQuery : selectedOrg?.name"
99
- @keydown="keydownActionsOnTrigger"
100
- @click.prevent="toggleDropdown"
101
- @input="handleDropdownSearch"
102
- >
103
- <span v-if="selectedOrg?.intranet" class="badge selected">
104
- <Icon name="lucide:lock" size="12" />
105
- {{ $t("navigation.orgBadge") }}
106
- </span>
107
- <Icon
108
- :name="active ? 'lucide:chevron-up' : 'lucide:chevron-down'"
109
- size="16"
110
- @keydown="keydownActionsOnTrigger"
111
- @click.prevent="toggleDropdown"
19
+ type="text"
20
+ placeholder="Start typing to search"
21
+ :value="active? newQuery : selectedOrg.name"
22
+ @keydown="keydownActionsOnTrigger($event, orgs, optionRef, dropdownTriggerRef, true, inputRef)"
23
+ @click.prevent="toggleDropdown($event, optionRef)"
24
+ @input="handleDropdownSearch($event, sortedOrgs, optionRef)"
112
25
  />
26
+ <span v-if="selectedOrg.intranet" class="intranet selected">
27
+ <a-icon icon="16:lock-locked" ></a-icon>
28
+ {{ $t('dscl.navigation.intranet') }}
29
+ </span>
30
+ <!-- <Icon
31
+ style="margin-bottom: 2px"
32
+ :name-or-path="`dropdown${active ? '-up' : ''}`"
33
+ size="tiny"
34
+ reduced
35
+ variant="info"
36
+ /> -->
113
37
  </div>
114
- <div
115
- v-show="active"
116
- id="organizations-options-list"
117
- class="dropdown"
118
- role="listbox"
119
- >
38
+ <div v-show="active" id="organizations-options-list" class="dropdown" role="listbox">
120
39
  <div
121
- v-for="option in sortedOrgs"
122
- :key="option.id"
123
- :ref="(el) => setOptionRef(el, option)"
40
+ v-for="(option, idx) in sortedOrgs"
124
41
  v-on-click-outside="onClickOutsideHandler"
42
+ ref="optionRef"
43
+ :key="option.name"
125
44
  role="option"
126
45
  class="org-option"
127
- :class="{
128
- selected: option.id === localSelectedOrgId,
129
- highlighted: highlightedOrg && option.id === highlightedOrg.id
130
- }"
131
- :aria-selected="option.id === localSelectedOrgId"
132
- tabindex="0"
133
- @keydown="handleSelectedOrg($event, option.id)"
134
- @click="handleSelectedOrg($event, option.id)"
46
+ :class="{ selected: option === selectedOrg }"
47
+ :aria-selected="!!String(option === selectedOrg)"
48
+ tabindex="-1"
49
+ @keydown="handleKeydownAction(orgs, idx, $event, optionRef, dropdownTriggerRef)"
50
+ @click="handleSelectedClick(idx)"
135
51
  >
136
- <span :class="{ pinned: option.pinned, 'item-flex': true }"
137
- >{{ option.name }}
138
- <span v-if="option.intranet" class="badge selected">
139
- <Icon name="lucide:lock" size="12" />
140
- {{ $t("navigation.orgBadge") }}
52
+ <div class="selected-space">
53
+ <!-- <Icon v-if="option === selectedOrg" name-or-path="success" size="tiny" /> -->
54
+ </div>
55
+ <span :class="{ pinned: option.pinned, 'item-flex': true }">{{ option?.name || option.label }}
56
+ <span v-if="option.intranet" class="intranet selected">
57
+ <a-icon icon="16:lock-locked"></a-icon>
58
+ {{ $t('dscl.navigation.intranet') }}
141
59
  </span>
142
60
  </span>
143
61
  </div>
@@ -145,57 +63,104 @@ function handleSelectedOrg($event, orgId) {
145
63
  </div>
146
64
  </template>
147
65
 
66
+ <script setup lang="ts">
67
+ import { useDropdown } from '../../composables/accessibleActions.js';
68
+ import { vOnClickOutside } from '@vueuse/components';
69
+ import { ref, computed } from 'vue'
70
+ const { $t } = useNuxtApp();
71
+
72
+ const emit = defineEmits(['selected']);
73
+
74
+ const {
75
+ active,
76
+ newQuery,
77
+ toggleDropdown,
78
+ closeDropdown,
79
+ onClickOutsideHandler,
80
+ keydownActionsOnTrigger,
81
+ handleKeydown,
82
+ handleDropdownSearch,
83
+ // focusDropdownItem,
84
+ } = useDropdown();
85
+
86
+ interface IOrgSelectProps {
87
+ orgs: Array<any>;
88
+ selectedOrg: {};
89
+ };
90
+
91
+ const dropdownTriggerRef = ref();
92
+ const optionRef = ref();
93
+
94
+ const props = defineProps<IOrgSelectProps>();
95
+
96
+ const sortedOrgs = computed(() => {
97
+ return [...props.orgs].sort((a, b) => {
98
+ if (a.pinned && !b.pinned) {
99
+ return -1;
100
+ } else if (!a.pinned && b.pinned) {
101
+ return 1;
102
+ } else {
103
+ return 0;
104
+ }
105
+ });
106
+ });
107
+ const orgDropdownLabel = computed(() => {
108
+ return useNuxtApp().$t('navigation.orgDropdown') || 'Select Organization'
109
+ })
110
+
111
+ function handleSelectedClick(index: number) {
112
+ emit('selected', index);
113
+ closeDropdown();
114
+ }
115
+
116
+ function handleKeydownAction(orgs: string | any[], idx: number, $event: { key: string | boolean; }, optionRef: { focus: () => void; }[], dropdownTriggerRef: { focus: () => void; }) {
117
+ emit('selected', idx);
118
+ handleKeydown(orgs, idx, $event, optionRef, dropdownTriggerRef);
119
+ }
120
+ </script>
121
+
148
122
  <style scoped>
149
123
  #organizations-options-list {
150
124
  position: absolute;
151
125
  width: 300px;
152
126
  max-height: 300px;
153
127
  overflow-y: auto;
154
- background-color: var(--primary-white);
155
- z-index: v-bind(zIndex);
128
+ background-color: white;
129
+ z-index: 50;
156
130
  }
157
131
 
158
132
  .org-selection {
159
- border-radius: 4px 4px 0 0;
160
- }
161
- .org-selection:focus-within {
162
- outline: 2px var(--purple) solid;
163
- }
164
- .org-selection .dropdown-trigger {
165
133
  width: 300px;
166
- padding: 0 8px;
167
- display: flex;
168
- align-items: center;
169
- gap: 8px;
170
- justify-content: space-between;
171
- border-radius: 4px 4px 0 0;
172
- border: 0;
173
- border-bottom: 1px solid var(--dscl-forms-underline, var(--grey-50));
174
- background: var(--dscl-forms-bg, var(--grey-10));
134
+ margin-right: 25px;
135
+ }
136
+ .org-selection .dropdown-trigger:focus-visible {
137
+ outline: 2px #000FFF solid;
175
138
  }
176
139
  .org-selection .dropdown-trigger .org-title {
177
140
  line-height: 16px;
178
- width: 100%;
141
+ width: 300px;
179
142
  padding: 12px;
180
143
  letter-spacing: 0.4px;
181
144
  touch-action: manipulation;
182
- color: var(--primary-dark);
145
+ color: #333;
183
146
  height: 40px;
184
- border: 0;
147
+ display: flex;
148
+ justify-content: space-between;
149
+ align-items: center;
185
150
  padding: 8px;
186
- background: var(--dscl-forms-bg, var(--grey-10));
151
+ border-radius: 4px 4px 0 0;
152
+ border: 0;
153
+ border-bottom: 1px solid var(--dscl-forms-underline, #747474);
154
+ background: var(--dscl-forms-bg, #fbfbfb);
187
155
  white-space: nowrap;
188
156
  cursor: pointer;
189
157
  }
190
- .org-selection .dropdown-trigger .org-title:focus-visible {
191
- outline: none;
192
- }
193
- .org-selection .dropdown {
194
- border-radius: 0 0 4px 4px;
195
- box-shadow: 0px 6px 20px 0px rgba(0, 0, 0, 0.06);
158
+ .org-selection .intranet {
159
+ background-color: var(--purple-50);
196
160
  }
197
161
  .org-selection .dropdown .org-option {
198
- padding: 12px 12px 12px 36px;
162
+ display: block;
163
+ padding: 12px;
199
164
  min-height: 40px;
200
165
  line-height: 16px;
201
166
  text-decoration: none;
@@ -203,41 +168,31 @@ function handleSelectedOrg($event, orgId) {
203
168
  position: relative;
204
169
  cursor: pointer;
205
170
  }
206
- .org-selection .dropdown .org-option.selected {
207
- background-image: url("../../assets/checkmark.svg");
208
- background-repeat: no-repeat;
209
- background-position: center left 15px;
210
- color: var(--purple);
211
- }
212
- .org-selection .dropdown .org-option.highlighted {
213
- background-color: #f8f6fc;
214
- }
215
171
  .org-selection .dropdown .org-option:focus-visible, .org-selection .dropdown .org-option:hover {
216
- background-color: #f8f6fc;
172
+ background-color: #F8F6FC;
217
173
  }
218
174
  .org-selection .custom-search {
219
175
  margin: 8px 16px;
220
176
  }
221
177
  .org-selection .item-flex {
222
178
  display: flex;
223
- gap: 8px;
179
+ gap: 10px;
224
180
  align-items: center;
225
181
  width: 100%;
226
182
  justify-content: space-between;
227
183
  }
228
- .org-selection .badge {
184
+ .org-selection .intranet {
229
185
  display: inline-flex;
230
186
  align-items: center;
231
187
  background-color: var(--purple-50);
232
188
  padding: 2px 4px;
233
189
  color: white;
234
- border-radius: 2px;
235
- text-transform: uppercase;
190
+ border-radius: 4px;
236
191
  }
237
- .org-selection .badge svg {
192
+ .org-selection .intranet svg {
238
193
  margin-right: 4px;
239
194
  }
240
- .org-selection .badge.selected {
195
+ .org-selection .intranet.selected {
241
196
  background-color: var(--grey-50);
242
197
  }
243
198
  </style>