design-system-next 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,7 @@
46
46
  }"
47
47
  @click="isQuckActionMenuVisible = !isQuckActionMenuVisible"
48
48
  >
49
- <IconPlusCircleFill class="w-full" />
49
+ <Icon icon="ph:plus-circle-fill" class="w-full" />
50
50
  </div>
51
51
 
52
52
  <template #popper>
@@ -57,7 +57,8 @@
57
57
  ]"
58
58
  >
59
59
  <h3 class="body-sm-regular-medium m-0">Quick Actions</h3>
60
- <IconX
60
+ <Icon
61
+ icon="ph:x"
61
62
  :class="[
62
63
  'text-color-weak h-[20px] w-[20px] cursor-pointer',
63
64
  'transition duration-150 ease-in-out',
@@ -99,7 +100,7 @@
99
100
  menuLinkItem.iconBgColor === 'purple',
100
101
  }"
101
102
  >
102
- <component :is="menuLinkItem.icon" v-if="menuLinkItem.icon" class="h-[1em] w-[1em] text-[20px]" />
103
+ <Icon v-if="menuLinkItem.icon" :icon="menuLinkItem.icon" class="h-[1em] w-[1em] text-[20px]" />
103
104
  </div>
104
105
  <div class="grid justify-between">
105
106
  <h5 class="body-sm-regular-medium text-color-strong m-0 truncate">
@@ -126,7 +127,7 @@
126
127
  ]"
127
128
  @click="emit('search', 'search-triggered')"
128
129
  >
129
- <IconMagnifyingGlass />
130
+ <Icon icon="ph:magnifying-glass" />
130
131
  </div>
131
132
 
132
133
  <!-- Grouped Nav Links -->
@@ -150,8 +151,8 @@
150
151
  'active:background-color-single-active active:scale-90': true,
151
152
  }"
152
153
  >
153
- <component :is="parentLink.icon" v-if="parentLink.icon" class="h-[1.25em] w-[1.25em]" />
154
- <IconGlobe v-else />
154
+ <Icon v-if="parentLink.icon" :icon="parentLink.icon" class="h-[1.25em] w-[1.25em]" />
155
+ <Icon v-else icon="ph:globe" />
155
156
  </div>
156
157
 
157
158
  <template #popper>
@@ -195,7 +196,8 @@
195
196
  class="background-color-brand-base absolute left-0 top-0 h-full w-[2px]"
196
197
  ></div>
197
198
  <span>{{ menuLinkItem.title }}</span>
198
- <IconCaretRight
199
+ <Icon
200
+ icon="ph:caret-right"
199
201
  class="h-[16px] w-[16px] transform font-normal transition-transform duration-300"
200
202
  />
201
203
  </div>
@@ -293,8 +295,8 @@
293
295
  }"
294
296
  @click="handleRedirect(parentLink, parentLink.title, '', '')"
295
297
  >
296
- <component :is="parentLink.icon" v-if="parentLink.icon" class="h-[1.25em] w-[1.25em]" />
297
- <IconGlobe v-else />
298
+ <Icon v-if="parentLink.icon" class="h-[1.25em] w-[1.25em]" :icon="parentLink.icon" />
299
+ <Icon v-else icon="ph:globe" />
298
300
  </div>
299
301
  </Tooltip>
300
302
  </template>
@@ -332,8 +334,8 @@
332
334
  'active:background-color-single-active active:scale-90': true,
333
335
  }"
334
336
  >
335
- <component :is="parentLink.icon" v-if="parentLink.icon" class="h-[1.25em] w-[1.25em]" />
336
- <IconGlobe v-else />
337
+ <Icon v-if="parentLink.icon" :icon="parentLink.icon" class="h-[1.25em] w-[1.25em]" />
338
+ <Icon v-else icon="ph:globe" />
337
339
  </div>
338
340
 
339
341
  <template #popper>
@@ -377,7 +379,8 @@
377
379
  class="background-color-brand-base absolute left-0 top-0 h-full w-[2px]"
378
380
  ></div>
379
381
  <span>{{ menuLinkItem.title }}</span>
380
- <IconCaretRight
382
+ <Icon
383
+ icon="ph:caret-right"
381
384
  class="h-[16px] w-[16px] transform font-normal transition-transform duration-300"
382
385
  />
383
386
  </div>
@@ -475,8 +478,8 @@
475
478
  }"
476
479
  @click="handleRedirect(parentLink, parentLink.title, '', '')"
477
480
  >
478
- <component :is="parentLink.icon" v-if="parentLink.icon" class="h-[1.25em] w-[1.25em]" />
479
- <IconGlobe v-else />
481
+ <Icon v-if="parentLink.icon" :icon="parentLink.icon" class="h-[1.25em] w-[1.25em]" />
482
+ <Icon v-else icon="ph:globe" />
480
483
  </div>
481
484
  </Tooltip>
482
485
  </template>
@@ -500,7 +503,7 @@
500
503
  ]"
501
504
  @click="emit('notifications', 'notifications-triggered')"
502
505
  >
503
- <IconBell class="h-[1.25em] w-[1.25em]" />
506
+ <Icon icon="ph:bell" class="h-[1.25em] w-[1.25em]" />
504
507
  <badge
505
508
  class="absolute -top-0.5 right-2.5"
506
509
  :text="String(props.notificationCount)"
@@ -519,7 +522,7 @@
519
522
  ]"
520
523
  @click="emit('requests', 'requests-triggered')"
521
524
  >
522
- <IconCheckSquare class="h-[1.25em] w-[1.25em]" />
525
+ <Icon icon="ph:check-square" class="h-[1.25em] w-[1.25em]" />
523
526
  <badge class="absolute -top-0.5 right-2.5" :text="String(props.requestCount)" variant="danger" size="small" />
524
527
  </div>
525
528
  </div>
@@ -600,7 +603,7 @@
600
603
  ]"
601
604
  @click="handleRedirect(userMenuItem, '', '', '')"
602
605
  >
603
- <component :is="userMenuItem.icon" v-if="userMenuItem.icon" class="h-[1em] w-[1em] text-[20px]" />
606
+ <Icon v-if="userMenuItem.icon" :icon="userMenuItem.icon" class="h-[1em] w-[1em] text-[20px]" />
604
607
  <h5 class="body-sm-regular text-color-strong m-0 truncate">
605
608
  {{ userMenuItem.title }}
606
609
  </h5>
@@ -618,17 +621,10 @@ import { sidenavPropTypes, sidenavEmitTypes } from './sidenav';
618
621
  import { useSidenav } from './use-sidenav';
619
622
 
620
623
  import { Menu, Tooltip } from 'floating-vue';
624
+ import { Icon } from '@iconify/vue';
621
625
 
622
626
  import badge from '../badge/badge.vue';
623
627
 
624
- import IconPlusCircleFill from '~icons/ph/plus-circle-fill';
625
- import IconMagnifyingGlass from '~icons/ph/magnifying-glass';
626
- import IconGlobe from '~icons/ph/globe';
627
- import IconCaretRight from '~icons/ph/caret-right';
628
- import IconX from '~icons/ph/x';
629
- import IconBell from '~icons/ph/bell';
630
- import IconCheckSquare from '~icons/ph/check-square';
631
-
632
628
  import 'floating-vue/dist/style.css';
633
629
 
634
630
  const props = defineProps(sidenavPropTypes);
@@ -1,22 +1,25 @@
1
1
  <template>
2
- <div v-bind="switchProps" :class="['switch', switchTextClass]">
3
- <label class="switch_text switch_left-text">
2
+ <div v-bind="switchProps" :class="['flex items-center gap-2', switchTextClass]">
3
+ <label>
4
4
  <slot name="leftText">
5
5
  <slot></slot>
6
6
  </slot>
7
7
  </label>
8
- <div ref="switchWrapperRef" class="switch_wrapper">
8
+ <div
9
+ ref="switchWrapperRef"
10
+ :class="['relative flex items-center', 'transition duration-300 ease-in-out', 'active:scale-90']"
11
+ >
9
12
  <input
10
13
  ref="switchRef"
11
14
  v-model="proxyValue"
12
15
  type="checkbox"
13
16
  name="checkbox"
14
- :class="['switch_input', switchInputClass]"
17
+ :class="['input absolute left-0 top-0 z-10 m-0 h-6 w-12 opacity-0', switchInputClass]"
15
18
  :disabled="props.disabled"
16
19
  />
17
- <span :class="['switch_mark', switchMarkClass]"></span>
20
+ <span :class="['mark relative box-border inline-block h-6 w-12 rounded-[40px] p-1', switchMarkClass]"></span>
18
21
  </div>
19
- <label class="switch_text switch_right-text">
22
+ <label>
20
23
  <slot name="rightText"></slot>
21
24
  </label>
22
25
  </div>
@@ -37,64 +40,21 @@ const { switchWrapperRef, switchRef, switchProps, switchMarkClass, switchTextCla
37
40
  </script>
38
41
 
39
42
  <style lang="scss" scoped>
40
- .switch {
41
- display: flex;
42
- align-items: center;
43
- width: fit-content;
44
-
45
- &_left-text {
46
- margin-right: 8px;
47
- }
48
-
49
- &_right-text {
50
- margin-left: 8px;
51
- }
52
-
53
- &_wrapper {
54
- position: relative;
55
- display: inline;
56
- height: 24px;
43
+ .input {
44
+ &:checked ~ .mark:before {
45
+ @apply left-[1.7rem];
57
46
  }
47
+ }
58
48
 
59
- &_input {
60
- position: absolute;
61
- top: 0;
62
- left: 0;
63
- opacity: 0;
64
- z-index: 1;
65
- width: 48px;
66
- height: 24px;
67
- margin: 0;
68
-
69
- &:checked ~ .switch_mark:before {
70
- left: 28px;
71
- }
49
+ .mark {
50
+ &:before,
51
+ &:after {
52
+ @apply absolute;
53
+ content: '';
72
54
  }
73
55
 
74
- &_mark {
75
- display: inline-block;
76
- position: relative;
77
- box-sizing: border-box;
78
- border-radius: 40px;
79
- width: 48px;
80
- height: 24px;
81
- padding: 4px;
82
-
83
- &:before,
84
- &:after {
85
- content: '';
86
- position: absolute;
87
- }
88
-
89
- &:before {
90
- @apply bg-white-50;
91
-
92
- top: 4px;
93
- left: 4px;
94
- width: 16px;
95
- height: 16px;
96
- border-radius: 50%;
97
- }
56
+ &:before {
57
+ @apply left-1 top-1 h-4 w-4 rounded-[50%] bg-white-50;
98
58
  }
99
59
  }
100
60
  </style>
@@ -24,9 +24,11 @@ export const useSwitch = (props: SwitchPropTypes) => {
24
24
  if (props.disabled) {
25
25
  return getDisabledBackground();
26
26
  }
27
+
27
28
  if (pressed.value) {
28
29
  return getPressedBackground();
29
30
  }
31
+
30
32
  if (isHovered.value) {
31
33
  return getHoveredBackground();
32
34
  }
@@ -4,7 +4,7 @@ export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<
4
4
 
5
5
  type List = {
6
6
  label: string;
7
- icon?: Component;
7
+ icon?: string;
8
8
  iconFill?: Component;
9
9
  disabled?: boolean;
10
10
  };
@@ -32,4 +32,5 @@ export const tabsEmitTypes = {
32
32
  };
33
33
 
34
34
  export type TabsPropTypes = ExtractPropTypes<typeof tabsPropTypes>;
35
+
35
36
  export type TabsEmitTypes = typeof tabsEmitTypes;
@@ -7,14 +7,29 @@
7
7
  tabsClasses,
8
8
  'body-sm-regular text-color-strong cursor-pointer border-solid',
9
9
  {
10
+ // Active tab without underline
10
11
  'background-color-single-active border': !underlined && selectedTabIndex === index,
12
+
13
+ // Inactive tab without underline
11
14
  'border-color-weak hover:background-color-hover border-x-[0.5px] border-y':
12
15
  !underlined && selectedTabIndex !== index,
16
+
17
+ // Underlined tab that is not selected
13
18
  'border-color-base border-b': underlined && selectedTabIndex !== index,
19
+
20
+ // Underlined and selected tab
14
21
  'border-b-2': underlined && selectedTabIndex === index,
22
+
23
+ // Disabled tab with underline
15
24
  'border-color-disabled text-color-disabled !cursor-not-allowed border-b': underlined && tab.disabled,
25
+
26
+ // Regular text for non-selected tabs
16
27
  'body-sm-regular': selectedTabIndex !== index,
28
+
29
+ // Active tab with custom text and border styles
17
30
  'body-sm-regular text-color-brand-base border-color-success-base': selectedTabIndex === index,
31
+
32
+ // Border adjustments for previous and next tab
18
33
  'border-l-0': selectedTabIndex - index === -1,
19
34
  'border-r-0': selectedTabIndex - index === 1,
20
35
  },
@@ -23,8 +38,8 @@
23
38
  >
24
39
  <div class="flex items-center gap-size-spacing-5xs leading-none">
25
40
  <div v-if="!!tab.icon">
26
- <component
27
- :is="selectedTabIndex === index && !!tab.iconFill ? tab.iconFill : tab.icon"
41
+ <Icon
42
+ :icon="selectedTabIndex === index && !!tab.iconFill ? tab.iconFill : tab.icon"
28
43
  class="body-sm-regular"
29
44
  />
30
45
  </div>
@@ -40,7 +55,10 @@
40
55
  import { tabsPropTypes, tabsEmitTypes } from './tabs';
41
56
  import { useTabs } from './use-tabs';
42
57
 
58
+ import { Icon } from '@iconify/vue';
59
+
43
60
  const emit = defineEmits(tabsEmitTypes);
44
61
  const props = defineProps(tabsPropTypes);
62
+
45
63
  const { updateSelectedTabIndex, selectedTabIndex, tabsClasses } = useTabs(props, emit);
46
64
  </script>
@@ -9,7 +9,9 @@ export const useTabs = (props: TabsPropTypes, emit: SetupContext<TabsEmitTypes>[
9
9
 
10
10
  function updateSelectedTabIndex(index: number, disabled = false) {
11
11
  if (disabled) return;
12
+
12
13
  if (selectedTabIndex.value === index) return;
14
+
13
15
  selectedTabIndex.value = index;
14
16
 
15
17
  emit('tabIndex', index);
@@ -21,7 +21,7 @@
21
21
  />
22
22
 
23
23
  <div :class="iconClasses">
24
- <IconClock />
24
+ <Icon icon="ph:clock" />
25
25
  </div>
26
26
  </div>
27
27
 
@@ -45,9 +45,9 @@
45
45
  >
46
46
  {{ option }}
47
47
 
48
- <span v-if="option.toUpperCase() === selectedValue.toUpperCase()" class="text-color-brand-base font-bold"
49
- ><IconCheck
50
- /></span>
48
+ <span v-if="option.toUpperCase() === selectedValue.toUpperCase()" class="text-color-brand-base font-bold">
49
+ <Icon icon="ph:check" />
50
+ </span>
51
51
  </div>
52
52
  </div>
53
53
  <div v-else class="px-3 py-2 text-gray-500">No matching options found</div>
@@ -56,12 +56,10 @@
56
56
  </template>
57
57
 
58
58
  <script setup lang="ts">
59
- import { defineProps } from 'vue';
59
+ import { Icon } from '@iconify/vue';
60
60
 
61
61
  import { timePickerPropTypes, timePickerEmitTypes } from './timePicker';
62
62
  import { useTimePicker } from './use-timePicker';
63
- import IconCheck from '~icons/ph/check';
64
- import IconClock from '~icons/ph/clock';
65
63
 
66
64
  const props = defineProps(timePickerPropTypes);
67
65
  const emit = defineEmits(timePickerEmitTypes);
package/src/main.ts CHANGED
@@ -4,10 +4,6 @@ import App from '@/App.vue';
4
4
 
5
5
  import '@/assets/styles/tailwind.css';
6
6
 
7
- import FloatingVue from 'floating-vue';
8
-
9
7
  const app = createApp(App);
10
8
 
11
- app.use(FloatingVue);
12
-
13
9
  app.mount('#app');