@weni/unnnic-system 3.25.7 → 3.26.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 (67) hide show
  1. package/dist/{es-Cez02syJ.mjs → es-Dhz_Vb5J.mjs} +1 -1
  2. package/dist/{index-B-NJIYYT.mjs → index-CyIfw1Zx.mjs} +7464 -7435
  3. package/dist/index.d.ts +12 -0
  4. package/dist/{pt-br-u8UEMjaT.mjs → pt-br-LgmWO25q.mjs} +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/tokens/colors.d.ts +2 -0
  7. package/dist/tokens/colors.mjs +2 -0
  8. package/dist/unnnic.mjs +18 -17
  9. package/dist/unnnic.umd.js +29 -29
  10. package/package.json +2 -1
  11. package/src/assets/scss/colors-hsl.scss +2 -0
  12. package/src/assets/scss/colors.scss +0 -43
  13. package/src/assets/scss/deprecated/colors.scss +1 -0
  14. package/src/assets/scss/scheme-colors.scss +3 -0
  15. package/src/assets/scss/semantic-colors.scss +48 -0
  16. package/src/assets/scss/semantic-text-utilities.scss +9 -0
  17. package/src/assets/scss/tailwind.scss +1 -1
  18. package/src/assets/scss/theme.scss +98 -0
  19. package/src/assets/scss/unnnic.scss +2 -0
  20. package/src/assets/tokens/colors-primitives.json +155 -0
  21. package/src/assets/tokens/colors-semantic-dark.json +55 -0
  22. package/src/assets/tokens/colors-semantic.json +55 -0
  23. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
  24. package/src/components/AudioRecorder/AudioTranscriptionButton.vue +3 -1
  25. package/src/components/Button/Button.vue +17 -18
  26. package/src/components/Card/CardCompany.vue +1 -1
  27. package/src/components/CardNumber/CardNumber.vue +1 -1
  28. package/src/components/CardProject/CardProject.vue +4 -4
  29. package/src/components/Carousel/TagCarousel.vue +2 -2
  30. package/src/components/ChartRainbow/ChartRainbow.vue +2 -2
  31. package/src/components/ChatsContact/ChatsContact.vue +12 -10
  32. package/src/components/ChatsContact/__tests__/__snapshots__/ChatsContact.spec.js.snap +1 -1
  33. package/src/components/ChatsMessage/ChatsMessage.vue +6 -7
  34. package/src/components/ChatsMessage/ChatsMessageStatusBackdrop.vue +1 -1
  35. package/src/components/ChatsMessage/ReplyMessage.vue +4 -4
  36. package/src/components/ChatsNavbar/ChatsNavbar.vue +1 -1
  37. package/src/components/ChatsUserAvatar/ChatsUserAvatar.vue +3 -3
  38. package/src/components/Chip/Chip.vue +20 -26
  39. package/src/components/Chip/__tests__/Chip.spec.js +3 -3
  40. package/src/components/DataTable/index.vue +2 -2
  41. package/src/components/DatePicker/DatePicker.vue +4 -4
  42. package/src/components/EmojiPicker/EmojiPicker.vue +40 -4
  43. package/src/components/EmojiPicker/__tests__/EmojiPicker.spec.js +1 -1
  44. package/src/components/FormElement/FormElement.vue +1 -1
  45. package/src/components/Input/Input.scss +2 -2
  46. package/src/components/Input/TextInput.vue +1 -1
  47. package/src/components/SelectTime/index.vue +1 -1
  48. package/src/components/Sidebar/index.vue +1 -1
  49. package/src/components/SkeletonLoading/skeletonTheme.vue +2 -4
  50. package/src/components/Table/Table.vue +1 -1
  51. package/src/components/Tag/DefaultTag.vue +9 -11
  52. package/src/components/TemplatePreview/TemplatePreview.vue +1 -1
  53. package/src/components/Toast/Toast.vue +4 -4
  54. package/src/components/Toast/__tests__/Toast.spec.js +5 -5
  55. package/src/components/ToolTip/ToolTip.vue +1 -1
  56. package/src/components/Tour/TourMask.vue +1 -1
  57. package/src/components/ui/dialog/DialogContent.vue +1 -1
  58. package/src/components/ui/popover/PopoverContent.vue +1 -1
  59. package/src/components/ui/popover/PopoverOption.vue +2 -2
  60. package/src/components/ui/tooltip/TooltipContent.vue +5 -4
  61. package/src/composables/useTheme.ts +67 -0
  62. package/src/index.ts +2 -0
  63. package/src/stories/Colors.stories.js +6 -1
  64. package/src/stories/Icon.stories.js +1 -0
  65. package/src/stories/IconLoading.stories.js +1 -0
  66. package/src/types/scheme-colors.d.ts +2 -0
  67. package/src/assets/tokens/colors.json +0 -552
@@ -1,7 +1,7 @@
1
1
  @use '@/assets/scss/unnnic' as *;
2
2
 
3
3
  @mixin input-base {
4
- background: $unnnic-color-white;
4
+ background: $unnnic-color-bg-base;
5
5
  border: 1px solid $unnnic-color-border-base;
6
6
  outline: none;
7
7
  border-radius: $unnnic-radius-2;
@@ -13,7 +13,7 @@
13
13
 
14
14
  &:focus:not(.use-focus-prop),
15
15
  &.focus {
16
- border-color: $unnnic-color-border-active;
16
+ border-color: $unnnic-color-border-accent-strong;
17
17
  }
18
18
 
19
19
  &::placeholder {
@@ -33,7 +33,7 @@
33
33
  <UnnnicIcon
34
34
  v-if="showClear"
35
35
  class="icon-clear"
36
- scheme="gray-7"
36
+ scheme="fg-base"
37
37
  icon="close"
38
38
  size="ant"
39
39
  clickable
@@ -207,7 +207,7 @@ export default {
207
207
  }
208
208
 
209
209
  &::-webkit-scrollbar-thumb {
210
- background: $unnnic-color-gray-7;
210
+ background: $unnnic-color-border-emphasized;
211
211
  border-radius: $unnnic-border-radius-pill;
212
212
  }
213
213
 
@@ -113,7 +113,7 @@ const handleNavigate = ({ item, child }) => {
113
113
  }
114
114
 
115
115
  &::-webkit-scrollbar-thumb {
116
- background: $unnnic-color-gray-7;
116
+ background: $unnnic-color-border-emphasized;
117
117
  border-radius: $unnnic-border-radius-pill;
118
118
  }
119
119
 
@@ -12,11 +12,9 @@
12
12
 
13
13
  <script>
14
14
  import { ref, provide } from 'vue';
15
- import colorsTokens from '@/assets/tokens/colors.json';
16
15
 
17
- const { gray } = colorsTokens.color;
18
- export const DEFAULT_BACKGROUND = gray[3].value;
19
- export const DEFAULT_HIGHLIGHT = gray[1].value;
16
+ export const DEFAULT_BACKGROUND = 'var(--unnnic-color-bg-muted)';
17
+ export const DEFAULT_HIGHLIGHT = 'var(--unnnic-color-bg-base-soft)';
20
18
  export const SkeletonStyle = {
21
19
  '--skeleton-bg': DEFAULT_BACKGROUND,
22
20
  '--skeleton-highlight': DEFAULT_HIGHLIGHT,
@@ -65,7 +65,7 @@ $scroll-size: 4px;
65
65
  }
66
66
 
67
67
  &::-webkit-scrollbar-thumb {
68
- background: $unnnic-color-gray-7;
68
+ background: $unnnic-color-border-emphasized;
69
69
  border-radius: $unnnic-border-radius-pill;
70
70
  }
71
71
 
@@ -17,8 +17,6 @@
17
17
  <script setup lang="ts">
18
18
  import { computed } from 'vue';
19
19
 
20
- import { color as colors } from '@/assets/tokens/colors.json';
21
-
22
20
  import UnnnicIcon from '../Icon.vue';
23
21
 
24
22
  import type { DefaultTagProps } from './types';
@@ -31,14 +29,14 @@ const props = withDefaults(defineProps<DefaultTagProps>(), {
31
29
  });
32
30
 
33
31
  const COLOR_MAPPING = [
34
- { keywords: ['green'], color: colors.green['2'].value },
35
- { keywords: ['blue'], color: colors.blue['2'].value },
36
- { keywords: ['purple'], color: colors.purple['3'].value },
37
- { keywords: ['red', 'pink'], color: colors.red['3'].value },
38
- { keywords: ['orange'], color: colors.orange['3'].value },
39
- { keywords: ['yellow'], color: colors.yellow['2'].value },
40
- { keywords: ['gray'], color: colors.gray['2'].value },
41
- { keywords: ['teal', 'weni'], color: colors.teal['2'].value },
32
+ { keywords: ['green'], color: 'var(--unnnic-color-bg-green-plain)' },
33
+ { keywords: ['blue'], color: 'var(--unnnic-color-bg-blue-plain)' },
34
+ { keywords: ['purple'], color: 'var(--unnnic-color-bg-purple-plain)' },
35
+ { keywords: ['red', 'pink'], color: 'var(--unnnic-color-bg-red-plain)' },
36
+ { keywords: ['orange'], color: 'var(--unnnic-color-bg-orange-plain)' },
37
+ { keywords: ['yellow'], color: 'var(--unnnic-color-bg-yellow-plain)' },
38
+ { keywords: ['gray'], color: 'var(--unnnic-color-bg-muted)' },
39
+ { keywords: ['teal', 'weni'], color: 'var(--unnnic-color-bg-teal-plain)' },
42
40
  ];
43
41
 
44
42
  const color = computed(() => {
@@ -48,7 +46,7 @@ const color = computed(() => {
48
46
  keywords.some((keyword) => scheme.includes(keyword)),
49
47
  );
50
48
 
51
- return match?.color ?? colors.gray['2'].value;
49
+ return match?.color ?? 'var(--unnnic-color-bg-muted)';
52
50
  });
53
51
  </script>
54
52
 
@@ -87,7 +87,7 @@
87
87
  <UnnnicIcon
88
88
  class="unnnic-template-preview__buttons__button__icon"
89
89
  :icon="getButtonIcon(button.type)"
90
- scheme="aux-blue-500"
90
+ scheme="fg-info"
91
91
  size="ant"
92
92
  />
93
93
  <p class="unnnic-template-preview__buttons__button__text">
@@ -99,10 +99,10 @@ let timeoutId: number | null = null;
99
99
 
100
100
  const typeConfig = computed(() => {
101
101
  const configMap = {
102
- informational: { icon: 'info', scheme: 'blue-500' },
103
- attention: { icon: 'error', scheme: 'yellow-500' },
104
- success: { icon: 'check_circle', scheme: 'green-500' },
105
- error: { icon: 'cancel', scheme: 'red-500' },
102
+ informational: { icon: 'info', scheme: 'fg-info' },
103
+ attention: { icon: 'error', scheme: 'fg-warning' },
104
+ success: { icon: 'check_circle', scheme: 'fg-success' },
105
+ error: { icon: 'cancel', scheme: 'fg-critical' },
106
106
  };
107
107
 
108
108
  return configMap[props.type || 'informational'] as {
@@ -53,7 +53,7 @@ describe('UnnnicToast', () => {
53
53
 
54
54
  expect(typeIcon().exists()).toBe(true);
55
55
  expect(typeIcon().props('icon')).toBe('info');
56
- expect(typeIcon().props('scheme')).toBe('blue-500');
56
+ expect(typeIcon().props('scheme')).toBe('fg-info');
57
57
  expect(typeIcon().props('size')).toBe('ant');
58
58
 
59
59
  expect(title().exists()).toBe(true);
@@ -120,10 +120,10 @@ describe('UnnnicToast', () => {
120
120
 
121
121
  test('displays correct scheme color for each type', async () => {
122
122
  const typeConfigs = [
123
- { type: 'informational', expectedScheme: 'blue-500' },
124
- { type: 'attention', expectedScheme: 'yellow-500' },
125
- { type: 'success', expectedScheme: 'green-500' },
126
- { type: 'error', expectedScheme: 'red-500' },
123
+ { type: 'informational', expectedScheme: 'fg-info' },
124
+ { type: 'attention', expectedScheme: 'fg-warning' },
125
+ { type: 'success', expectedScheme: 'fg-success' },
126
+ { type: 'error', expectedScheme: 'fg-critical' },
127
127
  ];
128
128
 
129
129
  for (const { type, expectedScheme } of typeConfigs) {
@@ -44,7 +44,7 @@
44
44
  size="sm"
45
45
  clickable
46
46
  filled
47
- scheme="white"
47
+ scheme="fg-inverted"
48
48
  @click="$emit('click:close')"
49
49
  />
50
50
  </TooltipContent>
@@ -129,7 +129,7 @@ export default {
129
129
  }
130
130
 
131
131
  &__overlay {
132
- fill: rgba($unnnic-color-gray-12, $unnnic-opacity-level-overlay);
132
+ fill: rgba($unnnic-color-bg-inverted, $unnnic-opacity-level-overlay);
133
133
  }
134
134
  }
135
135
  </style>
@@ -128,7 +128,7 @@ const ConditionalWrapper: Component = (_, { slots }) => {
128
128
  }
129
129
 
130
130
  &::-webkit-scrollbar-thumb {
131
- background: $unnnic-color-gray-7;
131
+ background: $unnnic-color-border-emphasized;
132
132
  border-radius: $unnnic-border-radius-pill;
133
133
  }
134
134
 
@@ -119,7 +119,7 @@ $popover-space: $unnnic-space-4;
119
119
  }
120
120
 
121
121
  &::-webkit-scrollbar-thumb {
122
- background: $unnnic-color-gray-7;
122
+ background: $unnnic-color-border-emphasized;
123
123
  border-radius: $unnnic-border-radius-pill;
124
124
  }
125
125
 
@@ -56,7 +56,7 @@ const props = withDefaults(defineProps<PopoverOptionProps>(), {
56
56
 
57
57
  const schemeColor = computed(() => {
58
58
  if (props.active) {
59
- return 'fg-inverted';
59
+ return 'fg-on-primary';
60
60
  }
61
61
  if (props.disabled) {
62
62
  return 'fg-muted';
@@ -113,7 +113,7 @@ const schemeColor = computed(() => {
113
113
  }
114
114
 
115
115
  &--active {
116
- color: $unnnic-color-fg-inverted;
116
+ color: $unnnic-color-fg-on-primary;
117
117
  }
118
118
  }
119
119
  }
@@ -58,8 +58,8 @@ const portalTarget = useTeleportTarget();
58
58
 
59
59
  .tooltip__content {
60
60
  display: flex;
61
- background-color: $unnnic-color-gray-900;
62
- color: $unnnic-color-white;
61
+ background-color: $unnnic-color-bg-inverted;
62
+ color: $unnnic-color-fg-inverted;
63
63
  border-radius: $unnnic-radius-1;
64
64
  padding: $unnnic-space-2;
65
65
  box-shadow: $unnnic-shadow-1;
@@ -76,8 +76,9 @@ const portalTarget = useTeleportTarget();
76
76
  .tooltip__arrow {
77
77
  width: 10px;
78
78
  height: 10px;
79
- background-color: $unnnic-color-gray-900;
80
- fill: $unnnic-color-gray-900;
79
+ background-color: $unnnic-color-bg-inverted;
80
+ fill: $unnnic-color-bg-inverted;
81
+ border-radius: calc($unnnic-radius-1 / 2);
81
82
  transform: rotate(45deg) translate(-50%, -50%);
82
83
  }
83
84
  </style>
@@ -0,0 +1,67 @@
1
+ import { computed, ref, watch, type Ref } from 'vue';
2
+ import { usePreferredColorScheme } from '@vueuse/core';
3
+
4
+ export type Theme = 'light' | 'dark';
5
+ export type ThemePreference = Theme | 'system';
6
+
7
+ const STORAGE_KEY = 'unnnic-theme';
8
+ const DARK_CLASS = 'dark';
9
+
10
+ function readStoredPreference(): ThemePreference {
11
+ try {
12
+ const stored = localStorage.getItem(STORAGE_KEY);
13
+ if (stored === 'light' || stored === 'dark' || stored === 'system') {
14
+ return stored;
15
+ }
16
+ } catch {
17
+ /* localStorage may be unavailable (SSR / iframe sandbox) */
18
+ }
19
+ return 'system';
20
+ }
21
+
22
+ function persistPreference(preference: ThemePreference): void {
23
+ try {
24
+ localStorage.setItem(STORAGE_KEY, preference);
25
+ } catch {
26
+ /* silent fail */
27
+ }
28
+ }
29
+
30
+ function applyTheme(theme: Theme): void {
31
+ document.documentElement.classList.toggle(DARK_CLASS, theme === 'dark');
32
+ }
33
+
34
+ const preference: Ref<ThemePreference> = ref(readStoredPreference());
35
+
36
+ export function useTheme() {
37
+ const osScheme = usePreferredColorScheme();
38
+
39
+ const resolvedTheme = computed<Theme>(() => {
40
+ if (preference.value !== 'system') return preference.value;
41
+ return osScheme.value === 'dark' ? 'dark' : 'light';
42
+ });
43
+
44
+ watch(
45
+ resolvedTheme,
46
+ (theme) => {
47
+ applyTheme(theme);
48
+ },
49
+ { immediate: true },
50
+ );
51
+
52
+ function setTheme(value: ThemePreference): void {
53
+ preference.value = value;
54
+ persistPreference(value);
55
+ }
56
+
57
+ function toggleTheme(): void {
58
+ setTheme(resolvedTheme.value === 'dark' ? 'light' : 'dark');
59
+ }
60
+
61
+ return {
62
+ preference,
63
+ resolvedTheme,
64
+ setTheme,
65
+ toggleTheme,
66
+ };
67
+ }
package/src/index.ts CHANGED
@@ -25,3 +25,5 @@ const Unnnic: UnnnicPlugin = {
25
25
 
26
26
  export default Unnnic;
27
27
  export * from '@/components';
28
+ export { useTheme } from '@/composables/useTheme';
29
+ export type { Theme, ThemePreference } from '@/composables/useTheme';
@@ -2,7 +2,12 @@
2
2
  * Colors stories. use tags: ['!dev']
3
3
  * so they only appear in Colors.mdx via <Story of={...} />, not in the sidebar.
4
4
  */
5
- import colors from '@/assets/tokens/colors.json';
5
+ import primitives from '@/assets/tokens/colors-primitives.json';
6
+ import semantic from '@/assets/tokens/colors-semantic.json';
7
+
8
+ const colors = {
9
+ color: { ...primitives.color, ...semantic.color },
10
+ };
6
11
 
7
12
  function resolveReference(ref, root) {
8
13
  const path = ref.replace(/^\{|\}$/g, '').split('.');
@@ -18,6 +18,7 @@ const schemes = [
18
18
  'fg-emphasized',
19
19
  'fg-muted',
20
20
  'fg-inverted',
21
+ 'fg-on-primary',
21
22
  'fg-info',
22
23
  'fg-success',
23
24
  'fg-warning',
@@ -15,6 +15,7 @@ export default {
15
15
  'fg-muted',
16
16
  'fg-emphasized',
17
17
  'fg-inverted',
18
+ 'fg-on-primary',
18
19
  'fg-active',
19
20
  'fg-info',
20
21
  'fg-success',
@@ -97,10 +97,12 @@ export type SchemeColor =
97
97
  | 'bg-success'
98
98
  | 'bg-warning'
99
99
  | 'bg-critical'
100
+ | 'bg-inverted'
100
101
  | 'fg-base'
101
102
  | 'fg-muted'
102
103
  | 'fg-emphasized'
103
104
  | 'fg-inverted'
105
+ | 'fg-on-primary'
104
106
  | 'fg-active'
105
107
  | 'fg-info'
106
108
  | 'fg-success'