@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.
- package/dist/{es-Cez02syJ.mjs → es-Dhz_Vb5J.mjs} +1 -1
- package/dist/{index-B-NJIYYT.mjs → index-CyIfw1Zx.mjs} +7464 -7435
- package/dist/index.d.ts +12 -0
- package/dist/{pt-br-u8UEMjaT.mjs → pt-br-LgmWO25q.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/tokens/colors.d.ts +2 -0
- package/dist/tokens/colors.mjs +2 -0
- package/dist/unnnic.mjs +18 -17
- package/dist/unnnic.umd.js +29 -29
- package/package.json +2 -1
- package/src/assets/scss/colors-hsl.scss +2 -0
- package/src/assets/scss/colors.scss +0 -43
- package/src/assets/scss/deprecated/colors.scss +1 -0
- package/src/assets/scss/scheme-colors.scss +3 -0
- package/src/assets/scss/semantic-colors.scss +48 -0
- package/src/assets/scss/semantic-text-utilities.scss +9 -0
- package/src/assets/scss/tailwind.scss +1 -1
- package/src/assets/scss/theme.scss +98 -0
- package/src/assets/scss/unnnic.scss +2 -0
- package/src/assets/tokens/colors-primitives.json +155 -0
- package/src/assets/tokens/colors-semantic-dark.json +55 -0
- package/src/assets/tokens/colors-semantic.json +55 -0
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
- package/src/components/AudioRecorder/AudioTranscriptionButton.vue +3 -1
- package/src/components/Button/Button.vue +17 -18
- package/src/components/Card/CardCompany.vue +1 -1
- package/src/components/CardNumber/CardNumber.vue +1 -1
- package/src/components/CardProject/CardProject.vue +4 -4
- package/src/components/Carousel/TagCarousel.vue +2 -2
- package/src/components/ChartRainbow/ChartRainbow.vue +2 -2
- package/src/components/ChatsContact/ChatsContact.vue +12 -10
- package/src/components/ChatsContact/__tests__/__snapshots__/ChatsContact.spec.js.snap +1 -1
- package/src/components/ChatsMessage/ChatsMessage.vue +6 -7
- package/src/components/ChatsMessage/ChatsMessageStatusBackdrop.vue +1 -1
- package/src/components/ChatsMessage/ReplyMessage.vue +4 -4
- package/src/components/ChatsNavbar/ChatsNavbar.vue +1 -1
- package/src/components/ChatsUserAvatar/ChatsUserAvatar.vue +3 -3
- package/src/components/Chip/Chip.vue +20 -26
- package/src/components/Chip/__tests__/Chip.spec.js +3 -3
- package/src/components/DataTable/index.vue +2 -2
- package/src/components/DatePicker/DatePicker.vue +4 -4
- package/src/components/EmojiPicker/EmojiPicker.vue +40 -4
- package/src/components/EmojiPicker/__tests__/EmojiPicker.spec.js +1 -1
- package/src/components/FormElement/FormElement.vue +1 -1
- package/src/components/Input/Input.scss +2 -2
- package/src/components/Input/TextInput.vue +1 -1
- package/src/components/SelectTime/index.vue +1 -1
- package/src/components/Sidebar/index.vue +1 -1
- package/src/components/SkeletonLoading/skeletonTheme.vue +2 -4
- package/src/components/Table/Table.vue +1 -1
- package/src/components/Tag/DefaultTag.vue +9 -11
- package/src/components/TemplatePreview/TemplatePreview.vue +1 -1
- package/src/components/Toast/Toast.vue +4 -4
- package/src/components/Toast/__tests__/Toast.spec.js +5 -5
- package/src/components/ToolTip/ToolTip.vue +1 -1
- package/src/components/Tour/TourMask.vue +1 -1
- package/src/components/ui/dialog/DialogContent.vue +1 -1
- package/src/components/ui/popover/PopoverContent.vue +1 -1
- package/src/components/ui/popover/PopoverOption.vue +2 -2
- package/src/components/ui/tooltip/TooltipContent.vue +5 -4
- package/src/composables/useTheme.ts +67 -0
- package/src/index.ts +2 -0
- package/src/stories/Colors.stories.js +6 -1
- package/src/stories/Icon.stories.js +1 -0
- package/src/stories/IconLoading.stories.js +1 -0
- package/src/types/scheme-colors.d.ts +2 -0
- 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-
|
|
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-
|
|
16
|
+
border-color: $unnnic-color-border-accent-strong;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
&::placeholder {
|
|
@@ -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
|
|
18
|
-
export const
|
|
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,
|
|
@@ -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:
|
|
35
|
-
{ keywords: ['blue'], color:
|
|
36
|
-
{ keywords: ['purple'], color:
|
|
37
|
-
{ keywords: ['red', 'pink'], color:
|
|
38
|
-
{ keywords: ['orange'], color:
|
|
39
|
-
{ keywords: ['yellow'], color:
|
|
40
|
-
{ keywords: ['gray'], color:
|
|
41
|
-
{ keywords: ['teal', 'weni'], color:
|
|
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 ??
|
|
49
|
+
return match?.color ?? 'var(--unnnic-color-bg-muted)';
|
|
52
50
|
});
|
|
53
51
|
</script>
|
|
54
52
|
|
|
@@ -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: '
|
|
103
|
-
attention: { icon: 'error', scheme: '
|
|
104
|
-
success: { icon: 'check_circle', scheme: '
|
|
105
|
-
error: { icon: 'cancel', scheme: '
|
|
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('
|
|
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: '
|
|
124
|
-
{ type: 'attention', expectedScheme: '
|
|
125
|
-
{ type: 'success', expectedScheme: '
|
|
126
|
-
{ type: 'error', expectedScheme: '
|
|
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) {
|
|
@@ -56,7 +56,7 @@ const props = withDefaults(defineProps<PopoverOptionProps>(), {
|
|
|
56
56
|
|
|
57
57
|
const schemeColor = computed(() => {
|
|
58
58
|
if (props.active) {
|
|
59
|
-
return 'fg-
|
|
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-
|
|
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-
|
|
62
|
-
color: $unnnic-color-
|
|
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-
|
|
80
|
-
fill: $unnnic-color-
|
|
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
|
@@ -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
|
|
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('.');
|
|
@@ -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'
|