@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,8 @@
1
+
2
+ @import 'ui-theme.less';
3
+
4
+
5
+ @import 'basic/main.less';
6
+ @import 'markup/ins-list.less';
7
+ @import 'markup/ins-table.less';
8
+ @import 'markup/ins-required.less';
@@ -0,0 +1,136 @@
1
+ .ins-list {
2
+ font: var(--ins-font-text-m);
3
+ line-height: 1.5rem;
4
+ list-style-type: none;
5
+ color: var(--ins-text-primary);
6
+
7
+ &_large {
8
+ font: var(--ins-font-text-l);
9
+ line-height: 1.75rem;
10
+ }
11
+
12
+ &_small,
13
+ &_extra-small {
14
+ font: var(--ins-font-text-s);
15
+ line-height: 1.25rem;
16
+ }
17
+
18
+ &_nested {
19
+ margin: 0.75rem 0 0.75rem 1.25rem;
20
+ color: var(--ins-text-secondary);
21
+
22
+ .ins-list_large & {
23
+ margin-inline-start: 0.75rem;
24
+ }
25
+
26
+ .ins-list_small & {
27
+ margin-block-start: 0.5rem;
28
+ margin-block-end: 0.5rem;
29
+ }
30
+ }
31
+
32
+ &_ordered {
33
+ counter-reset: counter;
34
+ }
35
+
36
+ &__item {
37
+ position: relative;
38
+ padding-inline-start: 1.5rem;
39
+ overflow-wrap: break-word;
40
+ margin-block-start: 0.75rem;
41
+
42
+ &:first-child {
43
+ margin-block-start: 0;
44
+ }
45
+
46
+ &::before {
47
+ content: '';
48
+ position: absolute;
49
+ left: 0;
50
+ top: 0.5rem;
51
+ inline-size: 0.5rem;
52
+ block-size: 0.5rem;
53
+ border-radius: 100%;
54
+ background-color: var(--ins-background-accent-1);
55
+
56
+ .ins-list_large > & {
57
+ top: 0.625rem;
58
+ }
59
+
60
+ .ins-list_small > & {
61
+ top: 0.375rem;
62
+ }
63
+ }
64
+
65
+ .ins-list_extra-small > & {
66
+ margin-block-start: 0.5rem;
67
+ }
68
+
69
+ .ins-list_linear & {
70
+ padding-inline-start: 1.75rem;
71
+
72
+ &::before {
73
+ content: '\2014';
74
+ left: 0;
75
+ top: auto;
76
+ inline-size: auto;
77
+ block-size: auto;
78
+ background-color: transparent;
79
+ }
80
+ }
81
+
82
+ .ins-list_ordered & {
83
+ padding-inline-start: 1.25rem;
84
+
85
+ &::before {
86
+ content: counter(counter) '.';
87
+ left: 0;
88
+ top: auto;
89
+ counter-increment: counter;
90
+ inline-size: auto;
91
+ block-size: auto;
92
+ color: var(--ins-text-tertiary);
93
+ background-color: transparent;
94
+ }
95
+ }
96
+
97
+ .ins-list_triangle > & {
98
+ padding-inline-start: 1.75rem;
99
+
100
+ &::before {
101
+ content: '\25E4'; // represent symbol '◤'
102
+ left: 0;
103
+ top: 1px;
104
+ inline-size: auto;
105
+ block-size: auto;
106
+ background-color: transparent;
107
+ color: var(--ins-text-tertiary);
108
+ font-size: 0.75rem;
109
+ }
110
+ }
111
+ }
112
+
113
+ &__item-title {
114
+ font: var(--ins-font-heading-5);
115
+ margin: 0;
116
+
117
+ .ins-list_small & {
118
+ line-height: 1.25rem;
119
+ font-weight: bold;
120
+ }
121
+ }
122
+
123
+ &__description {
124
+ margin: 0.5rem 0 0;
125
+ color: var(--ins-text-secondary);
126
+
127
+ .ins-list_small & {
128
+ margin-block-start: 0.25rem;
129
+ }
130
+
131
+ .ins-list_large & {
132
+ line-height: 1.75rem;
133
+ margin-block-start: 0.75rem;
134
+ }
135
+ }
136
+ }
@@ -0,0 +1,13 @@
1
+ .ins-required {
2
+ &::after {
3
+ content: '*';
4
+ }
5
+
6
+ &_float::after {
7
+ position: absolute;
8
+ }
9
+
10
+ &_spacing::after {
11
+ content: '\0000a0*';
12
+ }
13
+ }
@@ -0,0 +1,184 @@
1
+ @height-cell-large: 5rem;
2
+
3
+ .ins-table {
4
+ inline-size: 100%;
5
+
6
+ &_layout_fixed {
7
+ table-layout: fixed;
8
+ }
9
+
10
+ &__tr {
11
+ .transition(background);
12
+
13
+ outline: none;
14
+
15
+ &:not(&_hover_disabled):hover {
16
+ background: var(--ins-background-base-alt);
17
+ }
18
+
19
+ &:not(&_border_none) {
20
+ border-block-end: 1px solid var(--ins-border-normal);
21
+ }
22
+
23
+ &_border_top {
24
+ border-block-start: 1px solid var(--ins-border-normal);
25
+ }
26
+
27
+ &_cursor_pointer {
28
+ cursor: pointer;
29
+ }
30
+ }
31
+
32
+ &__th {
33
+ .text-overflow();
34
+
35
+ font: var(--ins-font-text-s);
36
+ padding: 0.5rem 1rem;
37
+ vertical-align: middle;
38
+ block-size: 2.5rem;
39
+ color: var(--ins-text-secondary);
40
+ background: inherit;
41
+
42
+ &_font-size_l,
43
+ .ins-table_font-size_l & {
44
+ font: var(--ins-font-text-m);
45
+ }
46
+ }
47
+
48
+ &__td {
49
+ font: var(--ins-font-text-m);
50
+ padding: 1rem 1rem 0.875rem;
51
+ vertical-align: top;
52
+ overflow-wrap: break-word;
53
+ block-size: 3.4375rem;
54
+ color: var(--ins-text-primary);
55
+ background: inherit;
56
+
57
+ &_size_l,
58
+ .ins-table_size_l & {
59
+ block-size: @height-cell-large - 0.0625rem;
60
+ }
61
+
62
+ &_font-size_l,
63
+ .ins-table_font-size_l & {
64
+ font: var(--ins-font-text-l);
65
+ }
66
+
67
+ &_font-size_s,
68
+ .ins-table_font-size_s & {
69
+ font: var(--ins-font-text-s);
70
+ }
71
+
72
+ &_align_center {
73
+ vertical-align: middle;
74
+ }
75
+ }
76
+
77
+ &__td,
78
+ &__th {
79
+ box-sizing: border-box;
80
+ text-align: start;
81
+
82
+ .ins-table_size_l &::before {
83
+ inline-size: 1rem;
84
+ border-start-start-radius: 1rem;
85
+ border-end-start-radius: 1rem;
86
+ }
87
+
88
+ &_first::before,
89
+ &_last::before {
90
+ content: '';
91
+ position: absolute;
92
+ top: 0;
93
+ inline-size: 0.75rem;
94
+ block-size: 100%;
95
+ background: inherit;
96
+ border-start-start-radius: 0.75rem;
97
+ border-end-start-radius: 0.75rem;
98
+ }
99
+
100
+ &_first {
101
+ position: relative;
102
+ padding-left: 0;
103
+ overflow: visible;
104
+
105
+ &::before {
106
+ right: 100%;
107
+ }
108
+ }
109
+
110
+ &_last {
111
+ position: relative;
112
+ padding-right: 0;
113
+ overflow: visible;
114
+
115
+ &::before {
116
+ left: 100%;
117
+ transform: scaleX(-1);
118
+ }
119
+ }
120
+
121
+ &_text_center {
122
+ text-align: center;
123
+ }
124
+
125
+ &_text_right {
126
+ text-align: end;
127
+ }
128
+
129
+ &_text_overflow {
130
+ .text-overflow();
131
+ }
132
+ }
133
+
134
+ &__subtext {
135
+ font: var(--ins-font-text-s);
136
+ margin: 0.25rem 0 0;
137
+ color: var(--ins-text-tertiary);
138
+ }
139
+
140
+ &__sort {
141
+ .button-clear();
142
+ .transition(color);
143
+
144
+ position: relative;
145
+ display: inline-flex;
146
+ align-items: center;
147
+ outline: none;
148
+ cursor: pointer;
149
+
150
+ &:hover {
151
+ color: var(--ins-text-primary);
152
+ }
153
+
154
+ &_active {
155
+ color: var(--ins-text-action);
156
+
157
+ &:hover {
158
+ color: var(--ins-text-action-hover);
159
+ }
160
+ }
161
+ }
162
+
163
+ &__sort-icon {
164
+ .center-top();
165
+
166
+ left: 100%;
167
+ margin-left: 0.125rem;
168
+ inline-size: 1rem;
169
+ block-size: 1rem;
170
+ flex-shrink: 0;
171
+ opacity: 0;
172
+
173
+ .ins-table__sort_active &,
174
+ .ins-table__sort:hover & {
175
+ .transition(transform);
176
+
177
+ opacity: 1;
178
+ }
179
+
180
+ .ins-table__sort_active.ins-table__sort_up & {
181
+ transform: rotate(180deg) translateY(50%);
182
+ }
183
+ }
184
+ }
@@ -0,0 +1,45 @@
1
+ @import 'mixins.less';
2
+
3
+ .appearance-hover(@content) {
4
+ .interactive({
5
+ @media @ins-mouse {
6
+ &:hover:not(:disabled):not([data-state]) {
7
+ @content();
8
+ }
9
+ }
10
+ });
11
+
12
+ &[data-state='hover'] {
13
+ @content();
14
+ }
15
+
16
+ }
17
+
18
+ .appearance-active(@content) {
19
+ .interactive({
20
+ &:active:not(:disabled):not([data-state]) {
21
+ @content();
22
+ }
23
+ });
24
+
25
+ &[data-state='active'] {
26
+ @content();
27
+ }
28
+ }
29
+
30
+ .appearance-disabled(@content) {
31
+ &:disabled:not([data-state]),
32
+ &[data-state='disabled'] {
33
+ @content();
34
+ }
35
+ }
36
+
37
+ .appearance-focus(@content) {
38
+ &:focus-visible:not([data-focus='false']) {
39
+ @content();
40
+ }
41
+
42
+ &[data-focus='true'] {
43
+ @content();
44
+ }
45
+ }
@@ -0,0 +1,172 @@
1
+ // @import 'browsers.less';
2
+
3
+ .interactive(@ruleset) {
4
+ &:is(a, button, select, textarea, input, label):not(:disabled) {
5
+ @ruleset();
6
+ }
7
+ }
8
+
9
+ // centering with translate
10
+ .center-left() {
11
+ position: absolute;
12
+ left: 50%;
13
+ transform: translate(-50%, 0);
14
+ }
15
+
16
+ .center-top() {
17
+ position: absolute;
18
+ top: 50%;
19
+ transform: translate(0, -50%);
20
+ }
21
+
22
+ .center-all() {
23
+ position: absolute;
24
+ top: 50%;
25
+ left: 50%;
26
+ transform: translate(-50%, -50%);
27
+ }
28
+ .fullsize(@position: absolute, @mode: height) {
29
+ position: @position;
30
+ top: 0;
31
+ left: 0;
32
+
33
+ & when (@mode = height) {
34
+ inline-size: 100%;
35
+ block-size: 100%;
36
+ }
37
+
38
+ & when (@mode = inset) {
39
+ bottom: 0;
40
+ right: 0;
41
+ }
42
+ }
43
+ // //.fullsize
44
+ // .fullsize(@position: absolute) {
45
+ // position: @position;
46
+ // top: 0;
47
+ // left: 0;
48
+ // inline-size: 100%;
49
+ // block-size: 100%;
50
+ // // bottom: 0;
51
+ // // right: 0;
52
+
53
+ // }
54
+
55
+ .button-clear() {
56
+ appearance: none;
57
+ padding: 0;
58
+ border: 0;
59
+ background: none;
60
+ font: inherit;
61
+ line-height: inherit;
62
+ text-decoration: none;
63
+ }
64
+
65
+ .button-base() {
66
+ .button-clear();
67
+
68
+ position: relative;
69
+ display: inline-flex;
70
+ align-items: center;
71
+ flex-shrink: 0;
72
+ box-sizing: border-box;
73
+ white-space: nowrap;
74
+ overflow: hidden;
75
+ vertical-align: middle;
76
+ max-inline-size: 100%;
77
+ gap: calc(var(--t-gap, ~'0rem') - 2 * var(--t-margin, 0rem));
78
+
79
+ > img,
80
+ > ins-svg,
81
+ > ins-icon,
82
+ > ins-avatar,
83
+ > ins-badge,
84
+ > [insBadge],
85
+ > [insRadio],
86
+ > [insSwitch],
87
+ > [insCheckbox],
88
+ &[insIcons]::before,
89
+ &[insIcons]::after {
90
+ margin: var(--t-margin);
91
+ }
92
+ }
93
+
94
+ // transition
95
+ .transition(@param: all, @speed: var(--ins-duration, 300ms)) {
96
+ transition-property: @param;
97
+ transition-duration: @speed;
98
+ transition-timing-function: ease-in-out;
99
+ }
100
+
101
+ // gradient
102
+ .gradient(@start-color, @end-color, @angle: 45deg) {
103
+ background-image: linear-gradient(@angle, @start-color 0%, @end-color 100%);
104
+ }
105
+
106
+ // typical properties for text overflow with ellipsis
107
+ .text-overflow(@type: nowrap) {
108
+ white-space: @type;
109
+ overflow: hidden;
110
+ text-overflow: ellipsis;
111
+ }
112
+
113
+ .scrollbar-hidden() {
114
+ /* stylelint-disable*/
115
+ scrollbar-width: none;
116
+ -ms-overflow-style: none;
117
+ /* stylelint-enable*/
118
+
119
+ &::-webkit-scrollbar,
120
+ &::-webkit-scrollbar-thumb {
121
+ display: none;
122
+ }
123
+ }
124
+
125
+ // hide an element visually without hiding it from screen readers
126
+ .sr-only() {
127
+ position: absolute;
128
+ clip: rect(1px, 1px, 1px, 1px);
129
+ clip-path: inset(50%);
130
+ block-size: 1px;
131
+ inline-size: 1px;
132
+ margin: -1px;
133
+ overflow: hidden;
134
+ padding: 0;
135
+ }
136
+
137
+ // prevent scrolling to focused element on IOS
138
+ // .ins-prevent-ios-scroll() {
139
+ // .ios-only({
140
+ // &:focus {
141
+ // animation: insPreventIOSScroll 0.001s;
142
+ // }
143
+ // });
144
+ // @keyframes insPreventIOSScroll {
145
+ // 0% {
146
+ // opacity: 0;
147
+ // }
148
+
149
+ // 100% {
150
+ // opacity: 1;
151
+ // }
152
+ // }
153
+ // }
154
+
155
+ .clearinput() {
156
+ // .autofill(@mode);
157
+
158
+ padding: 0;
159
+ margin: 0;
160
+ border-width: 0;
161
+ // border-radius: inherit;
162
+ background: none;
163
+ font-size: inherit;
164
+ line-height: inherit;
165
+ font-weight: inherit;
166
+ color: inherit;
167
+ caret-color: currentColor;
168
+ outline: none;
169
+ appearance: none;
170
+ word-break: keep-all;
171
+ -webkit-text-fill-color: currentColor; // for Safari
172
+ }
@@ -0,0 +1,14 @@
1
+ @import '../../ui-local.less';
2
+
3
+ [insAppearance][data-appearance='accent'] {
4
+ background: var(--ins-background-accent-2);
5
+ color: var(--ins-text-primary-on-accent);
6
+
7
+ .appearance-hover({
8
+ background: var(--ins-background-accent-2-hover);
9
+ });
10
+
11
+ .appearance-active({
12
+ background: var(--ins-background-accent-2-pressed);
13
+ });
14
+ }
@@ -0,0 +1,40 @@
1
+
2
+
3
+ [insAppearance][data-appearance='action'] {
4
+ color: var(--ins-text-action);
5
+ background: transparent;
6
+
7
+ .appearance-hover({
8
+ color: var(--ins-text-action-hover);
9
+ });
10
+
11
+ .appearance-active({
12
+ color: var(--ins-text-action-hover);
13
+ });
14
+ }
15
+
16
+ [insAppearance][data-appearance='action-destructive'] {
17
+ color: var(--ins-text-negative);
18
+ background: transparent;
19
+
20
+ .appearance-hover({
21
+ color: var(--ins-text-negative-hover);
22
+ });
23
+
24
+ .appearance-active({
25
+ color: var(--ins-text-negative-hover);
26
+ });
27
+ }
28
+
29
+ [insAppearance][data-appearance='action-grayscale'] {
30
+ color: var(--ins-text-secondary);
31
+ background: transparent;
32
+
33
+ .appearance-hover({
34
+ color: var(--ins-text-primary);
35
+ });
36
+
37
+ .appearance-active({
38
+ color: var(--ins-text-primary);
39
+ });
40
+ }
@@ -0,0 +1,23 @@
1
+ @import '../../ui-local.less';
2
+
3
+ [insAppearance][data-appearance='flat'],
4
+ [insAppearance][data-appearance='flat-destructive'],
5
+ [insAppearance][data-appearance='flat-grayscale'] {
6
+ .appearance-hover({
7
+ background: var(--ins-background-neutral-1-hover);
8
+ });
9
+
10
+ .appearance-active({
11
+ background: var(--ins-background-neutral-1-pressed);
12
+ });
13
+ }
14
+ [insAppearance][data-appearance='flat']{
15
+ color: var(--ins-text-action);
16
+ }
17
+ [insAppearance][data-appearance='flat-destructive'] {
18
+ color: var(--ins-text-negative);
19
+ }
20
+
21
+ [insAppearance][data-appearance='flat-grayscale'] {
22
+ color: var(--ins-text-primary);
23
+ }
@@ -0,0 +1,17 @@
1
+ @import '../../ui-local.less';
2
+
3
+ [insAppearance][data-appearance='glass'] {
4
+ background: rgba(0, 0, 0, 0.4);
5
+ color: #fff;
6
+ backdrop-filter: blur(1rem);
7
+
8
+ --ins-border-focus: rgba(255, 255, 255, 0.64);
9
+
10
+ .appearance-hover({
11
+ background: rgba(0, 0, 0, 0.48);
12
+ });
13
+
14
+ .appearance-active({
15
+ background: rgba(0, 0, 0, 0.6);
16
+ });
17
+ }
@@ -0,0 +1,55 @@
1
+ @import '../../ui-local.less';
2
+
3
+ [insAppearance][data-appearance='outline'],
4
+ [insAppearance][data-appearance='outline-destructive'],
5
+ [insAppearance][data-appearance='outline-grayscale'] {
6
+ --t-bs: var(--ins-border-normal);
7
+
8
+ color: var(--ins-text-action);
9
+ box-shadow: inset 0 0 0 1px var(--t-bs);
10
+
11
+ &:checked:not([data-mode]),
12
+ &[data-mode~='checked'] {
13
+ --t-bs: var(--ins-background-accent-1);
14
+
15
+ box-shadow: inset 0 0 0 2px var(--t-bs);
16
+
17
+ .appearance-hover({
18
+ --t-bs: var(--ins-background-accent-1-hover);
19
+ });
20
+
21
+ .appearance-active({
22
+ --t-bs: var(--ins-background-accent-1-pressed);
23
+ });
24
+ }
25
+
26
+ &:invalid:not([data-mode]),
27
+ &[data-mode~='invalid'] {
28
+ box-shadow: inset 0 0 0 1px var(--ins-status-negative-pale-hover);
29
+ }
30
+
31
+ &:checked:invalid:not([data-mode]),
32
+ &[data-mode~='checked'][data-mode~='invalid'] {
33
+ box-shadow: inset 0 0 0 2px var(--ins-status-negative);
34
+ }
35
+
36
+ .appearance-hover({
37
+ background: var(--ins-background-neutral-1);
38
+ cursor: pointer;
39
+ --t-bs: var(--ins-border-hover);
40
+ });
41
+
42
+ .appearance-active({
43
+ background: var(--ins-background-neutral-1);
44
+ --t-bs: var(--ins-border-hover);
45
+ });
46
+ }
47
+
48
+ [insAppearance][data-appearance='outline-grayscale']{
49
+ color: var(--ins-text-primary);
50
+ }
51
+
52
+
53
+ [insAppearance][data-appearance='outline-destructive'] {
54
+ color: var(--ins-text-negative);
55
+ }