@liuk123/insui 0.0.1-alpha.1

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 (40) hide show
  1. package/README.md +63 -0
  2. package/fesm2022/liuk123-insui.mjs +6841 -0
  3. package/fesm2022/liuk123-insui.mjs.map +1 -0
  4. package/index.d.ts +2511 -0
  5. package/package.json +26 -0
  6. package/styles/basic/main.less +48 -0
  7. package/styles/components/appearance.less +39 -0
  8. package/styles/components/avatar.less +108 -0
  9. package/styles/components/button.less +145 -0
  10. package/styles/components/checkbox.less +81 -0
  11. package/styles/components/chip.less +109 -0
  12. package/styles/components/group.less +155 -0
  13. package/styles/components/icon.less +43 -0
  14. package/styles/components/icons.less +38 -0
  15. package/styles/components/label.less +44 -0
  16. package/styles/components/link.less +55 -0
  17. package/styles/components/notification.less +156 -0
  18. package/styles/components/radio.less +58 -0
  19. package/styles/ins-ui-global.css +1109 -0
  20. package/styles/ins-ui-global.less +8 -0
  21. package/styles/markup/ins-list.less +136 -0
  22. package/styles/markup/ins-required.less +13 -0
  23. package/styles/markup/ins-table.less +184 -0
  24. package/styles/mixins/appearance.less +45 -0
  25. package/styles/mixins/mixins.less +172 -0
  26. package/styles/theme/appearance/accent.less +14 -0
  27. package/styles/theme/appearance/action.less +40 -0
  28. package/styles/theme/appearance/flat.less +23 -0
  29. package/styles/theme/appearance/glass.less +17 -0
  30. package/styles/theme/appearance/outline.less +55 -0
  31. package/styles/theme/appearance/primary.less +49 -0
  32. package/styles/theme/appearance/secondary.less +54 -0
  33. package/styles/theme/appearance/status.less +125 -0
  34. package/styles/theme/appearance/textfield.less +48 -0
  35. package/styles/theme/appearance.less +10 -0
  36. package/styles/theme/palette.less +120 -0
  37. package/styles/theme/variables.less +44 -0
  38. package/styles/ui-local.less +4 -0
  39. package/styles/ui-theme.less +6 -0
  40. package/styles/variables/media.less +28 -0
@@ -0,0 +1,43 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Icon
5
+ * @selector ins-icon
6
+ *
7
+ * @description
8
+ * Container for displaying icons colored with CSS (color/background) using mask
9
+ *
10
+ * @vars
11
+ * --t-icon — mask for the icon
12
+ * --t-icon-bg — mask for the background
13
+ *
14
+ * @example
15
+ * <ins-icon style="--t-icon: url('icon.svg')"></ins-icon>
16
+ *
17
+ * @see-also
18
+ * Icons
19
+ */
20
+ ins-icon {
21
+ position: relative;
22
+ display: inline-block;
23
+ inline-size: 1em;
24
+ block-size: 1em;
25
+ font-size: 1.5rem;
26
+ flex-shrink: 0;
27
+ vertical-align: middle;
28
+ box-sizing: border-box;
29
+ mask: var(--t-icon) no-repeat center/contain;
30
+
31
+ @media @ins-mouse {
32
+ &[data-appearance='icon']:hover {
33
+ color: var(--ins-text-secondary);
34
+ }
35
+ }
36
+
37
+ &::after,
38
+ &[insIcons]::after {
39
+ .fullsize();
40
+ content: '';
41
+ background: currentColor;
42
+ }
43
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @name Icons
3
+ * @selector [insIcons]
4
+ *
5
+ * @description
6
+ * Icons directive applies CSS mask to ::before and ::after pseudo elements
7
+ *
8
+ * @vars
9
+ * --t-icon-start — mask for ::before element
10
+ * --t-icon-end — mask for ::after element
11
+ *
12
+ * @example
13
+ * <button insIcons style="--t-icon-start: url('icon.svg')"></button>
14
+ *
15
+ * @see-also
16
+ * Button, Icon, Link
17
+ */
18
+ [insIcons] {
19
+ --t-icon-start: none;
20
+ --t-icon-end: none;
21
+
22
+ &::before,
23
+ &::after {
24
+ content: '';
25
+ display: var(--t-icon-start);
26
+ inline-size: 1em;
27
+ block-size: 1em;
28
+ font-size: 1.5rem;
29
+ flex-shrink: 0;
30
+ background: currentColor;
31
+ mask: var(--t-icon-start) no-repeat center/contain;
32
+ }
33
+
34
+ &::after {
35
+ display: var(--t-icon-end);
36
+ mask: var(--t-icon-end) no-repeat center/contain;
37
+ }
38
+ }
@@ -0,0 +1,44 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Label
5
+ * @selector [insLabel]
6
+ *
7
+ * @description
8
+ * Easy to use label ready for horizontal orientation for checkbox/radio/switch
9
+ * and vertical for input, select and textarea
10
+ *
11
+ * @example
12
+ * <label insLabel><input type="checkbox" /> Click me</ins-icon>
13
+ *
14
+ * @see-also
15
+ * Checkbox, Radio, Title
16
+ */
17
+ [insLabel] {
18
+ display: flex;
19
+ gap: 0.25rem;
20
+ flex-direction: column;
21
+ // font: var(--ins-font-text-m);
22
+ // color: var(--ins-text-primary);
23
+
24
+ &:not([data-orientation='vertical']) {
25
+ flex-direction: row;
26
+ align-items: center;
27
+ // inline-size: fit-content;
28
+ // font: var(--ins-font-text-m);
29
+ }
30
+
31
+ small {
32
+ font: var(--ins-font-text-s);
33
+ }
34
+
35
+ input[type='checkbox'],
36
+ input[type='radio'] {
37
+ margin-inline-end: 0.5rem;
38
+
39
+ &[data-size='s'] {
40
+ margin-inline-end: 0.25rem;
41
+ margin-block-start: 0.125rem;
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,55 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Link
5
+ * @selector [insLink]
6
+ *
7
+ * @description
8
+ * Plain link design, applicable to both links and buttons
9
+ *
10
+ * @example
11
+ * <a insLink>Click me</a>
12
+ *
13
+ * @see-also
14
+ * Icons, Appearance, Button
15
+ */
16
+ [insLink] {
17
+
18
+ padding: 0;
19
+ background: transparent;
20
+ border: none;
21
+ cursor: pointer;
22
+ font: inherit;
23
+ color: inherit;
24
+ text-decoration: none dashed currentColor;
25
+ text-underline-offset: 0.2em;
26
+ text-decoration-thickness: 0.7px;
27
+ text-decoration-color: color-mix(in lch, currentColor, transparent);
28
+
29
+ &:hover {
30
+ --ins-text-secondary: var(--ins-text-primary);
31
+ }
32
+
33
+ &::before {
34
+ margin-inline-end: 0.25rem;
35
+ }
36
+
37
+ &::after {
38
+ margin-inline-start: 0.25rem;
39
+ }
40
+
41
+ &[insIcons]::before,
42
+ &[insIcons]::after {
43
+ content: '\2060';
44
+ padding: calc(var(--ins-icon-size, 1rem) / 2);
45
+ vertical-align: super;
46
+ font-size: 0;
47
+ line-height: 0;
48
+ box-sizing: border-box;
49
+ }
50
+
51
+ .appearance-focus({
52
+ outline: none;
53
+ background: color-mix(in lch, currentColor 12%, transparent);
54
+ });
55
+ }
@@ -0,0 +1,156 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Notification
5
+ * @selector ins-notification, [insNotification]
6
+ *
7
+ * @description
8
+ * A colored rounded block of information with optional icon, title, subtitle and actions
9
+ *
10
+ * @attributes
11
+ * data-size — size (default: 'l') ('s' | 'm' | 'l')
12
+ *
13
+ * @example
14
+ * <ins-notification insAppearance data-appearance="negative">
15
+ * <div insTitle>
16
+ * Error
17
+ * <span insSubtitle>Something went wrong</span>
18
+ * </div>
19
+
20
+ * </ins-notification>
21
+ *
22
+ * @see-also
23
+ * Icons, Appearance
24
+ */
25
+ ins-notification,
26
+ [insNotification] {
27
+ .button-clear();
28
+
29
+ position: relative;
30
+ display: block;
31
+ max-block-size: 100%;
32
+ color: var(--ins-text-primary);
33
+
34
+ padding: 0.75rem;
35
+ font: var(--ins-font-text-m);
36
+ line-height: 1.25rem;
37
+ border-radius: var(--ins-radius-m);
38
+ box-sizing: border-box;
39
+ text-align: start;
40
+ text-decoration: none;
41
+ border-inline-start: var(--t-left) solid transparent;
42
+ border-inline-end: var(--t-right) solid transparent;
43
+
44
+ --t-left: 0;
45
+ --t-right: 0;
46
+
47
+ &[style*='--t-icon-start:'] {
48
+ --t-left: 1.625rem;
49
+ }
50
+
51
+ &[style*='--t-icon-end:'] {
52
+ --t-right: 1.5rem;
53
+ }
54
+
55
+ &::before {
56
+ position: absolute;
57
+ left: -0.975rem;
58
+ top: 0.875rem;
59
+ }
60
+ &::after {
61
+ .center-top();
62
+
63
+ right: -0.5rem;
64
+ font-size: 1rem;
65
+ margin: 0 -0.25rem 0 auto;
66
+ color: var(--ins-text-tertiary) !important;
67
+ }
68
+
69
+ &[data-size='s'] {
70
+ padding: 0.375rem 0.625rem;
71
+ font: var(--ins-font-text-s);
72
+ line-height: 1rem;
73
+ border-radius: var(--ins-radius-s);
74
+
75
+ &[style*='--t-icon-start:'] {
76
+ --t-left: 1.5rem;
77
+ }
78
+
79
+ &::before {
80
+ top: 0.5rem;
81
+ left: -0.875rem;
82
+ font-size: 1rem;
83
+ }
84
+
85
+ &::after {
86
+ right: -0.875rem;
87
+ }
88
+ ins-icon {
89
+ font-size: 1rem;
90
+ }
91
+
92
+ > [insIconButton] {
93
+ top: 0;
94
+ right: 0;
95
+ }
96
+ }
97
+
98
+ &[data-size='l'] {
99
+ padding: 1rem;
100
+ font: var(--ins-font-text-l);
101
+ line-height: 1.5rem;
102
+ border-radius: var(--ins-radius-l);
103
+
104
+ &[style*='--t-icon-start:'] {
105
+ --t-left: 2rem;
106
+ }
107
+
108
+ &::before {
109
+ left: -1rem;
110
+ font-size: 1.5rem;
111
+ }
112
+
113
+ &::after {
114
+ right: -0.75rem;
115
+ }
116
+ ins-icon {
117
+ font-size: 1.25rem;
118
+ }
119
+
120
+
121
+ > [insIconButton] {
122
+ top: 0.375rem;
123
+ right: 0.5rem;
124
+ }
125
+ }
126
+
127
+ // .notification-title {
128
+ // gap: 0.125rem;
129
+ // font: var(--ins-font-text-l);
130
+ // font-weight: bold;
131
+ // }
132
+
133
+ // .notification-content {
134
+ // font: var(--ins-font-text-m);
135
+
136
+ // // + * {
137
+ // // display: flex;
138
+ // // align-items: center;
139
+ // // gap: 1.25rem;
140
+ // // margin-top: 0.625rem;
141
+ // // font: var(--ins-font-text-s);
142
+ // // }
143
+ // }
144
+
145
+ > [insIconButton] {
146
+ position: absolute;
147
+ top: 0.75rem;
148
+ right: 0.75rem;
149
+ box-shadow: none !important;
150
+ background: transparent !important;
151
+ }
152
+ }
153
+
154
+ [insNotification] {
155
+ cursor: pointer;
156
+ }
@@ -0,0 +1,58 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Radio
5
+ * @selector [insRadio]
6
+ *
7
+ * @description
8
+ * A stylized input type="radio"
9
+ *
10
+ * @attributes
11
+ * data-size — size (default: 'm') ('s' | 'm')
12
+ *
13
+ * @example
14
+ * <input type="radio" insRadio />
15
+ *
16
+ * @see-also
17
+ * Checkbox, Switch, Appearance
18
+ */
19
+ [insRadio] {
20
+ --t-size: 1.5rem;
21
+
22
+ .transition(~'background, box-shadow');
23
+
24
+ inline-size: var(--t-size);
25
+ block-size: var(--t-size);
26
+ cursor: pointer;
27
+ margin: 0;
28
+ flex-shrink: 0;
29
+ border-radius: 100%;
30
+ color: var(--ins-text-primary-on-accent);
31
+
32
+ &:disabled._readonly {
33
+ opacity: 1;
34
+ }
35
+
36
+ &::before {
37
+ .fullsize(absolute);
38
+ .transition(transform);
39
+
40
+ content: '';
41
+ border-radius: 100%;
42
+ background: currentColor;
43
+ transform: scale(0);
44
+ }
45
+
46
+ &:checked::before {
47
+ transform: scale(0.5);
48
+ }
49
+
50
+ &[data-size='s'] {
51
+ --t-size: 1rem;
52
+ }
53
+
54
+ &:invalid:not([data-mode]),
55
+ &[data-mode~='invalid'] {
56
+ color: #fff;
57
+ }
58
+ }