yuyeon 0.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 (77) hide show
  1. package/package.json +38 -0
  2. package/src/components/button/index.ts +3 -0
  3. package/src/components/button/y-btn.scss +79 -0
  4. package/src/components/button/y-btn.ts +104 -0
  5. package/src/components/card/index.ts +6 -0
  6. package/src/components/card/y-card-body.ts +8 -0
  7. package/src/components/card/y-card-footer.ts +8 -0
  8. package/src/components/card/y-card-header.ts +8 -0
  9. package/src/components/card/y-card.scss +30 -0
  10. package/src/components/card/y-card.ts +16 -0
  11. package/src/components/checkbox/IconCheckbox.vue +24 -0
  12. package/src/components/checkbox/YCheckbox.vue +113 -0
  13. package/src/components/checkbox/YInputCheckbox.vue +108 -0
  14. package/src/components/checkbox/index.ts +8 -0
  15. package/src/components/checkbox/y-checkbox.scss +48 -0
  16. package/src/components/checkbox/y-input-checkbox.scss +86 -0
  17. package/src/components/chip/index.ts +3 -0
  18. package/src/components/chip/y-chip.scss +28 -0
  19. package/src/components/chip/y-chip.vue +69 -0
  20. package/src/components/dialog/index.ts +3 -0
  21. package/src/components/dialog/y-dialog.scss +5 -0
  22. package/src/components/dialog/y-dialog.vue +46 -0
  23. package/src/components/field-input/index.scss +5 -0
  24. package/src/components/field-input/index.ts +11 -0
  25. package/src/components/field-input/y-field-input.scss +65 -0
  26. package/src/components/field-input/y-field-input.ts +214 -0
  27. package/src/components/form/index.ts +9 -0
  28. package/src/components/form/y-form.ts +93 -0
  29. package/src/components/icons/icon-clearable.ts +6 -0
  30. package/src/components/index.ts +17 -0
  31. package/src/components/input/index.scss +5 -0
  32. package/src/components/input/index.ts +9 -0
  33. package/src/components/input/y-input.scss +209 -0
  34. package/src/components/input/y-input.ts +368 -0
  35. package/src/components/layer/index.ts +3 -0
  36. package/src/components/layer/y-layer.scss +32 -0
  37. package/src/components/layer/y-layer.vue +146 -0
  38. package/src/components/lottie-player.ts +41 -0
  39. package/src/components/progress-bar/index.ts +3 -0
  40. package/src/components/progress-bar/y-progress-bar.vue +144 -0
  41. package/src/components/ring-spinner/y-ring-spinner.scss +25 -0
  42. package/src/components/ring-spinner/y-ring-spinner.vue +31 -0
  43. package/src/components/switch/YSwitch.vue +217 -0
  44. package/src/components/switch/index.scss +5 -0
  45. package/src/components/switch/index.ts +11 -0
  46. package/src/components/switch/y-switch.scss +206 -0
  47. package/src/components/text-highlighter/index.scss +5 -0
  48. package/src/components/text-highlighter/index.ts +3 -0
  49. package/src/components/text-highlighter/y-text-highlighter.scss +7 -0
  50. package/src/components/text-highlighter/y-text-highlighter.ts +89 -0
  51. package/src/composables/layer-group.ts +31 -0
  52. package/src/composables/lazy.ts +30 -0
  53. package/src/composables/progress.ts +19 -0
  54. package/src/composables/theme.ts +25 -0
  55. package/src/directives/complement-click/index.ts +123 -0
  56. package/src/directives/plate-wave/index.ts +114 -0
  57. package/src/directives/plate-wave/plate-wave.scss +33 -0
  58. package/src/directives/theme-class.ts +14 -0
  59. package/src/file-extension.d.ts +14 -0
  60. package/src/index.ts +21 -0
  61. package/src/mixins/di.ts +23 -0
  62. package/src/mixins/rebind-attrs.ts +36 -0
  63. package/src/styles/base.scss +28 -0
  64. package/src/styles/palette.scss +94 -0
  65. package/src/styles/theme/dark.scss +35 -0
  66. package/src/styles/theme/index.scss +8 -0
  67. package/src/styles/theme/light.scss +32 -0
  68. package/src/styles/util/helper.scss +6 -0
  69. package/src/styles/util/theme.scss +16 -0
  70. package/src/styles/variables.scss +1 -0
  71. package/src/util/common.ts +59 -0
  72. package/src/util/date-time.ts +41 -0
  73. package/src/util/dom.ts +6 -0
  74. package/src/util/string.ts +9 -0
  75. package/src/util/ui.ts +39 -0
  76. package/src/util/validation.ts +9 -0
  77. package/src/util/vue-component.ts +18 -0
@@ -0,0 +1,14 @@
1
+ declare module '*.svg' {
2
+ const content: string;
3
+ export default content;
4
+ }
5
+
6
+ declare module '*.png' {
7
+ const value: string;
8
+ export default value;
9
+ }
10
+
11
+ declare module '*.json' {
12
+ const value: any;
13
+ export default value;
14
+ }
package/src/index.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { App } from 'vue';
2
+ import * as components from '@/components';
3
+ import { bindTheme } from '@/composables/theme';
4
+
5
+ export function init(options: any) {
6
+ const themeModule = bindTheme(options?.theme);
7
+
8
+ const install = (app: App) => {
9
+ themeModule.install(app);
10
+
11
+ Object.keys(components).forEach((componentName) => {
12
+ const comp = components[componentName as keyof typeof components];
13
+ app.component(componentName, comp);
14
+ });
15
+ };
16
+
17
+ return {
18
+ install,
19
+ theme: themeModule,
20
+ };
21
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Created by yuyeon-ui 2022.
3
+ */
4
+
5
+ import { defineComponent } from 'vue';
6
+
7
+ export default defineComponent({
8
+ name: 'DiMixin',
9
+ inject: {
10
+ theme: {
11
+ from: 'theme',
12
+ },
13
+ form$: {
14
+ default: null,
15
+ },
16
+ },
17
+ mounted() {
18
+ ((this as any).form$ as any)?.register(this);
19
+ },
20
+ beforeUnmount() {
21
+ ((this as any).form$ as any)?.unregister(this);
22
+ },
23
+ });
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Created by yuyeon-ui 2022.
3
+ */
4
+
5
+ import { defineComponent } from 'vue';
6
+
7
+ export default defineComponent({
8
+ data: () => ({
9
+ attrs_$: {} as any,
10
+ listeners_$: {} as any,
11
+ }),
12
+ watch: {
13
+ // Work around unwanted re-renders: https://github.com/vuejs/vue/issues/10115
14
+ // Make sure to use `v-bind="$data.$_attrs"` instead of `v-bind="$attrs"`
15
+ $attrs: {
16
+ handler(val) {
17
+ // eslint-disable-next-line guard-for-in,no-restricted-syntax
18
+ for (const attr in val) {
19
+ this.$data.attrs_$[attr] = val[attr];
20
+ // this.$set(this.$data.$_attrs, attr, val[attr]);
21
+ }
22
+ },
23
+ immediate: true,
24
+ },
25
+ $listeners: {
26
+ handler(val) {
27
+ // eslint-disable-next-line guard-for-in,no-restricted-syntax
28
+ for (const listener in val) {
29
+ this.$data.listeners_$[listener] = val[listener];
30
+ // this.$set(this.$data.$_listeners, listener, val[listener]);
31
+ }
32
+ },
33
+ immediate: true,
34
+ },
35
+ },
36
+ });
@@ -0,0 +1,28 @@
1
+ :root {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ .fade {
6
+ &-enter-active, &-leave-cative {
7
+ transition: opacity 240ms cubic-bezier(.2,.28,.21,1);
8
+ }
9
+
10
+ &-fade-enter-from, &-leave-to {
11
+ opacity: 0;
12
+ }
13
+ }
14
+
15
+ .slide-fade-enter-active, .slide-fade-leave-active {
16
+ transition: transform 240ms cubic-bezier(.23,.3,.07,.97), opacity 240ms linear;
17
+ }
18
+
19
+ .slide-fade-enter-from,
20
+ .slide-fade-leave-to {
21
+ transform: translateY(20px) rotate3d(1, 0, 0, -30deg);
22
+ opacity: 0;
23
+ }
24
+
25
+ .title {
26
+ font-size: 20px;
27
+ font-weight: bold;
28
+ }
@@ -0,0 +1,94 @@
1
+ // red
2
+ $basic-red-900: #a60000;
3
+ $basic-red-800: #cc1f1f;
4
+ $basic-red-700: #ff4040;
5
+ $basic-red-600: #ff5959;
6
+ $basic-red-500: #ff7272;
7
+ $basic-red-400: #ff8d8d;
8
+ $basic-red-300: #ffa2a2;
9
+ $basic-red-200: #ffbfbf;
10
+ $basic-red-100: #ffd9d9;
11
+ $basic-red-50: #fff6f6;
12
+
13
+ // orange
14
+ $basic-orange-900: #f16a24;
15
+ $basic-orange-800: #f17738;
16
+ $basic-orange-700: #ff9639;
17
+ $basic-orange-600: #ffa75a;
18
+ $basic-orange-500: #f3ae71;
19
+ $basic-orange-400: #f3bd71;
20
+ $basic-orange-300: #ffd00f;
21
+ $basic-orange-200: #ffe8ba;
22
+ $basic-orange-100: #fff1c7;
23
+ $basic-orange-50: #fffaec;
24
+
25
+ // green
26
+ $basic-green-900: #056653;
27
+ $basic-green-800: #0d8069;
28
+ $basic-green-700: #1f927c;
29
+ $basic-green-600: #4ba694;
30
+ $basic-green-500: #5bb2a1;
31
+ $basic-green-400: #68ccb9;
32
+ $basic-green-300: #77d9c6;
33
+ $basic-green-200: #8ae6d4;
34
+ $basic-green-100: #ace6da;
35
+ $basic-green-50: #f2fffd;
36
+
37
+ // blue
38
+ $basic-blue-900: #003a9f;
39
+ $basic-blue-800: #0c5db9;
40
+ $basic-blue-700: #236dc1;
41
+ $basic-blue-600: #407fc6;
42
+ $basic-blue-500: #4091c6;
43
+ $basic-blue-400: #79c2f2;
44
+ $basic-blue-300: #a6dcff;
45
+ $basic-blue-200: #ccebff;
46
+ $basic-blue-100: #f2faff;
47
+ $basic-blue-50: #f6fcff;
48
+
49
+ // violet
50
+ $basic-violet-900: #460d80;
51
+ $basic-violet-800: #581799;
52
+ $basic-violet-700: #6b24b3;
53
+ $basic-violet-600: #7436b3;
54
+ $basic-violet-500: #7d47b3;
55
+ $basic-violet-400: #9857d9;
56
+ $basic-violet-300: #c89df2;
57
+ $basic-violet-250: #e9dfff;
58
+ $basic-violet-200: #f2e6ff;
59
+ $basic-violet-100: #f9f2ff;
60
+ $basic-violet-50: #faf8ff;
61
+
62
+ // gray
63
+ $basic-gray-900: #323232;
64
+ $basic-gray-800: #505050;
65
+ $basic-gray-700: #707070;
66
+ $basic-gray-600: #939194;
67
+ $basic-gray-500: #b4b4b4;
68
+ $basic-gray-400: #c8c8c8;
69
+ $basic-gray-300: #dcdcdc;
70
+ $basic-gray-200: #f0f0f0;
71
+ $basic-gray-100: #f5f5f5;
72
+ $basic-gray-50: #fafafa;
73
+
74
+ //
75
+ $basic-disable: #c8bab4;
76
+ $basic-black: #141414;
77
+ $content-gray: #666666;
78
+ $background-color: #f5f5ff;
79
+
80
+ // Text
81
+ $text-black: $basic-black;
82
+ $text-white: #ffffff;
83
+
84
+ // Alert
85
+ $alert-positive: #47b267;
86
+ $alert-negative: #ff4d4d;
87
+ $alert-warning: #ffc70e;
88
+ $alert-link: #4781cc;
89
+
90
+ $primary: #4f97dc !default;
91
+
92
+ :root {
93
+ --y-palette--primary: #{$primary};
94
+ }
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Created by yeonyu 2022.
3
+ */
4
+ @use 'sass:map';
5
+ @use '../palette';
6
+ @use '../util/helper';
7
+
8
+ // yui/app theme
9
+ $theme--dark: () !default;
10
+ $theme--dark: map.deep-merge(
11
+ map.deep-merge(
12
+ (
13
+ 'input': (
14
+ 'fill': palette.$basic-gray-200,
15
+ ),
16
+ 'fieldInput': (
17
+ 'clear': palette.$basic-gray-400,
18
+ ),
19
+ 'select': (
20
+ 'selected': palette.$basic-black,
21
+ 'selected-background': palette.$basic-gray-700,
22
+ ),
23
+ ),
24
+ //app
25
+ (
26
+ 'simpleSearch': (
27
+ 'placeholder': palette.$basic-gray-400,
28
+ 'prepend': palette.$basic-gray-700,
29
+ 'border': palette.$basic-gray-700,
30
+ 'hasValueBorder': palette.$basic-gray-400,
31
+ ),
32
+ )
33
+ ),
34
+ $theme--dark
35
+ );
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Created by yeonyu 2022.
3
+ */
4
+
5
+ @forward 'light';
6
+ @forward 'dark';
7
+
8
+ $basic-themes: 'light', 'dark' !default;
@@ -0,0 +1,32 @@
1
+ @use 'sass:map';
2
+ @use '../palette';
3
+ @use '../util/helper';
4
+
5
+ // yui theme
6
+ $theme--light: () !default;
7
+ $theme--light: map.deep-merge(
8
+ map.deep-merge(
9
+ (
10
+ 'input': (
11
+ 'fill': palette.$basic-gray-200,
12
+ ),
13
+ 'fieldInput': (
14
+ 'clear': palette.$basic-gray-400,
15
+ ),
16
+ 'select': (
17
+ 'selected': palette.$basic-black,
18
+ 'selected-background': palette.$basic-gray-700,
19
+ ),
20
+ ),
21
+ //app
22
+ (
23
+ 'simpleSearch': (
24
+ 'placeholder': palette.$basic-gray-400,
25
+ 'prepend': palette.$basic-gray-700,
26
+ 'border': palette.$basic-gray-700,
27
+ 'hasValueBorder': palette.$basic-gray-400,
28
+ ),
29
+ )
30
+ ),
31
+ $theme--light
32
+ );
@@ -0,0 +1,6 @@
1
+ @function deepGet($map, $keys...) {
2
+ @each $key in $keys {
3
+ $map: map-get($map, $key);
4
+ }
5
+ @return $map;
6
+ }
@@ -0,0 +1,16 @@
1
+ @use 'sass:meta';
2
+ @use 'sass:map';
3
+ //
4
+ @use '../theme';
5
+
6
+ @mixin basicTheme($component) {
7
+ @each $theme in theme.$basic-themes {
8
+ $class: 'theme--#{$theme}';
9
+ @if map.has-key(meta.module-variables('theme'), $class) {
10
+ .theme--#{$theme}.#{$component} {
11
+ $themeMap: map.get(meta.module-variables('theme'), $class);
12
+ @content ($themeMap, $class);
13
+ }
14
+ }
15
+ }
16
+ }
@@ -0,0 +1 @@
1
+ $border-radius-root: 10px !default;
@@ -0,0 +1,59 @@
1
+ export function hasOwnProperty(object: any, property: string) {
2
+ if (object) {
3
+ return Object.prototype.hasOwnProperty.call(object, property);
4
+ }
5
+ return false;
6
+ }
7
+
8
+ export function getNestedValue(
9
+ obj: any,
10
+ path: (string | number)[],
11
+ fallback?: any,
12
+ ): any {
13
+ const last = path.length - 1;
14
+ let traversObj = obj;
15
+
16
+ if (last < 0) return traversObj === undefined ? fallback : traversObj;
17
+
18
+ for (let i = 0; i < last; i += 1) {
19
+ if (traversObj == null) {
20
+ return fallback;
21
+ }
22
+ traversObj = traversObj[path[i]];
23
+ }
24
+
25
+ if (traversObj == null) return fallback;
26
+
27
+ return traversObj[path[last]] === undefined
28
+ ? fallback
29
+ : traversObj[path[last]];
30
+ }
31
+
32
+ export function getObjectValueByPath(
33
+ obj: any,
34
+ path: string,
35
+ fallback?: any,
36
+ ): any {
37
+ // credit: http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key#comment55278413_6491621
38
+ let traversPath = path;
39
+ if (obj == null || !traversPath || typeof traversPath !== 'string') {
40
+ return fallback;
41
+ }
42
+ if (obj[traversPath] !== undefined) return obj[traversPath];
43
+ traversPath = traversPath.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
44
+ traversPath = traversPath.replace(/^\./, ''); // strip a leading dot
45
+ return getNestedValue(obj, traversPath.split('.'), fallback);
46
+ }
47
+
48
+ export function randomCharOne(str: string) {
49
+ if (str) {
50
+ return str.charAt(Math.floor(Math.random() * str.length));
51
+ }
52
+ return '';
53
+ }
54
+
55
+ export default {
56
+ hasOwnProperty,
57
+ getNestedValue,
58
+ getObjectValueByPath,
59
+ };
@@ -0,0 +1,41 @@
1
+ import { DateTime } from 'luxon';
2
+ import yeonyuUtils from 'yeonyu-utils';
3
+
4
+ const { dateFromObjectId } = yeonyuUtils.parser;
5
+
6
+ export const MILLISECOND_OF_DAY = 86400000;
7
+ export const MILLISECOND_OF_HOUR = 3600000;
8
+ export const MILLISECOND_OF_MINUTE = 60000;
9
+
10
+ export function getDate(timestamp: number): string {
11
+ return DateTime.fromMillis(timestamp).toFormat('yyyy-MM-dd');
12
+ }
13
+
14
+ export function getTime(timestamp: number): string {
15
+ return DateTime.fromMillis(timestamp).toFormat('HH:mm:ss');
16
+ }
17
+
18
+ export function getTimeWithNoon(timestamp: number): string {
19
+ return DateTime.fromMillis(timestamp).toFormat('h:mm a');
20
+ }
21
+
22
+ export function getDateTime(timestamp: number): string {
23
+ return DateTime.fromMillis(timestamp).toFormat('yyyy-MM-dd HH:mm:ss');
24
+ }
25
+
26
+ export function getTimezone(): number {
27
+ return new Date().getTimezoneOffset() / -60;
28
+ }
29
+
30
+ export function convertObjectIdToTimestamp(objectId: string): number {
31
+ return dateFromObjectId(objectId).getTime();
32
+ }
33
+
34
+ export function getStartTime(date: string): number {
35
+ return DateTime.fromISO(`${date}T00:00:00`).toMillis();
36
+ }
37
+
38
+ export default {
39
+ getDate,
40
+ getTime,
41
+ };
@@ -0,0 +1,6 @@
1
+ export function documentRoot(domNode: Node): null | HTMLDocument | ShadowRoot {
2
+ const root = domNode.getRootNode();
3
+ if (root !== document && root.getRootNode({ composed: true }) !== document)
4
+ return null;
5
+ return root as HTMLDocument | ShadowRoot;
6
+ }
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Created by yeonyu 2022.
3
+ */
4
+
5
+ export function camelToPascal(str: string) {
6
+ return str.charAt(0).toUpperCase() + str.slice(1);
7
+ }
8
+
9
+ export default {};
package/src/util/ui.ts ADDED
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Created by yeonyu 2022.
3
+ */
4
+
5
+ export function isOverflow(e: HTMLElement): boolean {
6
+ return e.offsetWidth < e.scrollWidth;
7
+ }
8
+
9
+ export function colorHexToRgb(color: string): number[] | undefined {
10
+ if (color && color[0] === '#') {
11
+ const hexCodeStr = color.substring(1, color.length);
12
+ const hexCodeLength = hexCodeStr.length;
13
+ const rgbValues = [];
14
+ if (hexCodeLength === 3 || hexCodeLength === 6) {
15
+ const multiple = hexCodeLength === 6 ? 2 : 1;
16
+ for (let i = 0; i < 3; i += 1) {
17
+ const hexCode = hexCodeStr.substring(
18
+ i * multiple,
19
+ i * multiple + multiple,
20
+ );
21
+ rgbValues.push(Number.parseInt(hexCode, 16));
22
+ }
23
+ return rgbValues;
24
+ }
25
+ }
26
+ return undefined;
27
+ }
28
+
29
+ export function textColorIsLight(r: number, g: number, b: number): boolean {
30
+ const luminance = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255;
31
+ return luminance < 0.5;
32
+ }
33
+
34
+ export const RGBA_REGEX = /rgb(a?)\((?<v>.*)\)/;
35
+ export const HEX_COLOR_REGEX = /#([0-9a-fA-F]{3,6,8})/;
36
+
37
+ export function isColorValue(value: string): boolean {
38
+ return RGBA_REGEX.test(value) || HEX_COLOR_REGEX.test(value);
39
+ }
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Created by yeonyu 2022.
3
+ */
4
+
5
+ export function REQUIRE_RULE(value: any): boolean {
6
+ return !!value;
7
+ }
8
+
9
+ export default {};
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Created by yeonyu 2022.
3
+ */
4
+
5
+ import { VNode, ComponentPublicInstance } from 'vue';
6
+
7
+ export function getSlot(
8
+ vm: ComponentPublicInstance | any,
9
+ // eslint-disable-next-line default-param-last
10
+ name = 'default',
11
+ data?: any | (() => any),
12
+ optional = false,
13
+ ): VNode[] | undefined {
14
+ if (vm.$slots?.[name]) {
15
+ return vm.$slots[name]!(data instanceof Function ? data() : data);
16
+ }
17
+ return undefined;
18
+ }