@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
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@liuk123/insui",
3
+ "version": "0.0.1-alpha.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "peerDependencies": {
8
+ "@angular/common": ">=19.2.0",
9
+ "@angular/core": ">=19.2.0"
10
+ },
11
+ "dependencies": {
12
+ "tslib": "^2.3.0"
13
+ },
14
+ "sideEffects": false,
15
+ "module": "fesm2022/liuk123-insui.mjs",
16
+ "typings": "index.d.ts",
17
+ "exports": {
18
+ "./package.json": {
19
+ "default": "./package.json"
20
+ },
21
+ ".": {
22
+ "types": "./index.d.ts",
23
+ "default": "./fesm2022/liuk123-insui.mjs"
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,48 @@
1
+ body {
2
+ text-rendering: optimizeLegibility;
3
+ -webkit-font-smoothing: antialiased;
4
+ -moz-osx-font-smoothing: grayscale;
5
+ }
6
+
7
+ ul,
8
+ ol {
9
+ list-style: none;
10
+ padding: 0;
11
+ margin: 0;
12
+ }
13
+
14
+ table {
15
+ border-collapse: collapse;
16
+ border-spacing: 0;
17
+ }
18
+
19
+ // input,
20
+ // button,
21
+ // select,
22
+ // textarea {
23
+ // font-family: inherit;
24
+ // color: inherit;
25
+ // }
26
+
27
+ hr {
28
+ margin: 0;
29
+ block-size: 1px;
30
+ border: none;
31
+ background: var(--ins-border-normal);
32
+ }
33
+
34
+ iframe {
35
+ border: none;
36
+ }
37
+
38
+ // html::selection {
39
+ // background-color: var(--ins-background-selected);
40
+ // }
41
+
42
+ ::-ms-clear {
43
+ display: none;
44
+ }
45
+
46
+ ::-ms-reveal {
47
+ display: none;
48
+ }
@@ -0,0 +1,39 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Appearance
5
+ * @selector [insAppearance]
6
+ *
7
+ * @description
8
+ * Base directive to apply different styles to interactive elements
9
+ *
10
+ * @attributes
11
+ * data-appearance — current appearance
12
+ * data-state — manual interactive state override ('active' | 'disabled' | 'hover')
13
+ * data-focus — manual :focus-visible state override
14
+ * data-mode — arbitrary manual mode like 'checked', 'invalid' or 'readonly'
15
+ *
16
+ * @example
17
+ * <button insAppearance data-appearance='primary'></button>
18
+ *
19
+ * @see-also
20
+ * Button
21
+ */
22
+ [insAppearance] {
23
+ .transition(all);
24
+
25
+ position: relative;
26
+ appearance: none;
27
+ outline: 0.125rem solid transparent;
28
+ outline-offset: -0.125rem;
29
+ // transition-property: color, background-color, opacity, box-shadow, border, border-radius, filter;
30
+
31
+ .appearance-focus({
32
+ outline-color: var(--ins-border-focus);
33
+ });
34
+
35
+ .appearance-disabled({
36
+ cursor: initial;
37
+ opacity: var(--ins-disabled-opacity);
38
+ });
39
+ }
@@ -0,0 +1,108 @@
1
+ @import '../ui-local.less';
2
+
3
+ [insAvatar],
4
+ ins-avatar {
5
+ --t-size: 3.5rem;
6
+ --t-radius: 0.75rem;
7
+
8
+ position: relative;
9
+ display: inline-flex;
10
+ flex-shrink: 0;
11
+ inline-size: var(--t-size);
12
+ block-size: var(--t-size);
13
+ align-items: center;
14
+ justify-content: center;
15
+ overflow: hidden;
16
+ white-space: nowrap;
17
+ border-radius: var(--t-radius);
18
+ border: none;
19
+ background: var(--ins-background-neutral-1);
20
+ color: var(--ins-text-secondary);
21
+ vertical-align: middle;
22
+ box-sizing: border-box;
23
+ padding: 0.25rem;
24
+
25
+ &[data-size='xs'] {
26
+ --t-size: var(--ins-height-xs);
27
+ --t-radius: 0.5rem;
28
+
29
+ font: var(--ins-font-text-xs);
30
+ font-weight: bold;
31
+ }
32
+
33
+ &[data-size='s'] {
34
+ --t-size: var(--ins-height-s);
35
+ --t-radius: 0.5rem;
36
+
37
+ font: var(--ins-font-text-s);
38
+ font-weight: bold;
39
+ }
40
+
41
+ &[data-size='m'] {
42
+ --t-size: var(--ins-height-m);
43
+ --t-radius: 0.75rem;
44
+
45
+ font: var(--ins-font-text-l);
46
+ font-weight: bold;
47
+
48
+ }
49
+
50
+ &[data-size='l'] {
51
+ --t-size: var(--ins-height-l);
52
+ --t-radius: 0.75rem;
53
+
54
+ font: var(--ins-font-heading-5);
55
+ }
56
+
57
+ &[data-size='xl'] {
58
+ --t-size: 5rem;
59
+ --t-radius: 0.75rem;
60
+
61
+ font: var(--ins-font-heading-3);
62
+ }
63
+
64
+ &[data-size='xxl'] {
65
+ --t-size: 6.5rem;
66
+ --t-radius: 1rem;
67
+
68
+ font: var(--ins-font-heading-3);
69
+ }
70
+
71
+ &[data-size='xxxl'] {
72
+ --t-size: 9rem;
73
+ --t-radius: 1.25rem;
74
+
75
+ font: var(--ins-font-heading-2);
76
+
77
+ }
78
+
79
+
80
+ &._round {
81
+ --t-radius: calc(var(--t-size) / 2);
82
+ }
83
+
84
+ // &._svg img {
85
+ // padding: 20%;
86
+ // object-fit: contain;
87
+ // }
88
+
89
+ ins-icon {
90
+ .center-all();
91
+
92
+ inline-size: 60%;
93
+ block-size: 60%;
94
+ }
95
+
96
+ img,
97
+ picture,
98
+ video {
99
+ .fullsize();
100
+ inline-size: 100%;
101
+ block-size: 100%;
102
+
103
+ object-fit: cover;
104
+ box-sizing: border-box;
105
+ border-radius: inherit;
106
+ // transform: translateZ(0);
107
+ }
108
+ }
@@ -0,0 +1,145 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Button
5
+ * @selector [insButton], [insIconButton]
6
+ *
7
+ * @description
8
+ * Plain button design, applicable to both links and buttons
9
+ *
10
+ * @attributes
11
+ * data-size — size (default: 'l') ('xs' | 's' | 'm' | 'l')
12
+ *
13
+ * @example
14
+ * <button insButton>Click me</button>
15
+ *
16
+ * @see-also
17
+ * Icons, Appearance, Link
18
+ */
19
+ [insButton],
20
+ [insIconButton] {
21
+ --t-size: var(--ins-height-m);
22
+ --t-radius: var(--ins-radius-m);
23
+ --t-gap: 0.125rem;
24
+ --t-padding: 0 1rem;
25
+ --t-margin: -0.375rem;
26
+
27
+ .button-base();
28
+
29
+ block-size: var(--t-size);
30
+ justify-content: center;
31
+ border-radius: var(--t-radius);
32
+ padding: var(--t-padding);
33
+ user-select: none;
34
+ cursor: pointer;
35
+ font: var(--ins-font-text-m);
36
+
37
+ >.t-loader {
38
+ .center-all();
39
+
40
+ .t-text {
41
+ position: absolute;
42
+ }
43
+ }
44
+
45
+ &[data-size='xs'] {
46
+ --t-size: var(--ins-height-xs);
47
+ --t-radius: var(--ins-radius-xs);
48
+ --t-gap: 0.125rem;
49
+ --t-padding: 0 0.375rem;
50
+ --t-margin: -0.125rem;
51
+
52
+ font: var(--ins-font-text-s);
53
+
54
+ ins-svg,
55
+ ins-icon,
56
+ &::before {
57
+ font-size: 1rem;
58
+ }
59
+ }
60
+
61
+ &[data-size='s'] {
62
+ --t-size: var(--ins-height-s);
63
+ --t-radius: var(--ins-radius-s);
64
+ --t-gap: 0.125rem;
65
+ --t-padding: 0 0.625rem;
66
+ --t-margin: -0.125rem;
67
+
68
+ font: var(--ins-font-text-s);
69
+
70
+ ins-svg,
71
+ ins-icon,
72
+ &::before {
73
+ font-size: 1rem;
74
+ }
75
+ }
76
+
77
+ &[data-size='l'] {
78
+ --t-size: var(--ins-height-l);
79
+ --t-radius: var(--ins-radius-l);
80
+ --t-gap: 0.25rem;
81
+ --t-padding: 0 1.25rem;
82
+ --t-margin: -0.125rem;
83
+
84
+ font: var(--ins-font-text-l);
85
+ // font-weight: bold;
86
+
87
+ &::after {
88
+ margin-inline-end: -0.125rem;
89
+ }
90
+ }
91
+
92
+ &._loading {
93
+ --ins-disabled-opacity: 1;
94
+
95
+ -webkit-text-fill-color: transparent;
96
+
97
+ >*,
98
+ &::before,
99
+ &::after {
100
+ opacity: 0;
101
+ }
102
+
103
+ >.t-loader {
104
+ opacity: 1;
105
+ }
106
+ }
107
+
108
+ &[insIcons]::after {
109
+ font-size: 1rem;
110
+ }
111
+
112
+ &[insButtonVertical] {
113
+ --t-margin: ~'0rem' !important;
114
+ --t-line-height: 1rem;
115
+ // --t-margin: 0rem !important;
116
+
117
+ flex-direction: column;
118
+ flex-shrink: 1;
119
+ block-size: auto;
120
+ padding: 0.75rem;
121
+ gap: 0.375rem;
122
+ min-inline-size: 5rem;
123
+ white-space: pre-line;
124
+ font: var(--ins-font-text-s);
125
+
126
+ &>* {
127
+ max-block-size: calc(var(--t-line-height) * 2);
128
+ }
129
+ }
130
+ }
131
+
132
+ [insIconButton] {
133
+ gap: 0;
134
+ inline-size: var(--t-size);
135
+ font-size: 0 !important;
136
+ padding: 0;
137
+
138
+ // &[data-size='l']::after {
139
+ // margin: 0;
140
+ // }
141
+
142
+ // &&[style*='--t-icon-start:']::after {
143
+ // display: none;
144
+ // }
145
+ }
@@ -0,0 +1,81 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Checkbox
5
+ * @selector [insCheckbox]
6
+ *
7
+ * @description
8
+ * A stylized input type="checkbox"
9
+ *
10
+ * @attributes
11
+ * data-size — size (default: 'm') ('s' | 'm')
12
+ *
13
+ * @vars
14
+ * --t-checked-icon — checkmark icon
15
+ * --t-indeterminate-icon — indeterminate state icon
16
+ *
17
+ * @example
18
+ * <input type="checkbox" insCheckbox />
19
+ *
20
+ * @see-also
21
+ * Switch, Radio, Appearance
22
+ */
23
+ [insCheckbox] {
24
+ --t-size: 1.5rem;
25
+ --t-radius: var(--ins-radius-s);
26
+
27
+ inline-size: var(--t-size);
28
+ block-size: var(--t-size);
29
+ border-radius: var(--t-radius);
30
+ cursor: pointer;
31
+ margin: 0;
32
+ flex-shrink: 0;
33
+
34
+ &::before {
35
+ .fullsize(absolute, inset);
36
+
37
+ content: '';
38
+ inline-size: 1rem;
39
+ block-size: 1rem;
40
+ margin: auto;
41
+ background: currentColor;
42
+ mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"></svg>') center/100%;
43
+ transform: scale(0);
44
+ transition:
45
+ transform var(--ins-duration) ease-in-out,
46
+ mask 0s var(--ins-duration) ease-in-out;
47
+ }
48
+
49
+ &:disabled._readonly {
50
+ opacity: 1;
51
+ }
52
+
53
+ &:checked,
54
+ &:indeterminate {
55
+ &::before {
56
+ mask-image: var(--t-checked-icon);
57
+ transform: scale(1);
58
+ transition:
59
+ transform var(--ins-duration) ease-in-out,
60
+ mask 0s ease-in-out;
61
+ }
62
+ }
63
+
64
+ &:indeterminate::before {
65
+ mask-image: var(--t-indeterminate-icon);
66
+ }
67
+
68
+ &[data-size='s'] {
69
+ --t-size: 1rem;
70
+ --t-radius: var(--ins-radius-xs);
71
+
72
+ // &::before {
73
+ // inline-size: 0.875rem;
74
+ // block-size: 0.875rem;
75
+ // }
76
+ }
77
+ &:invalid:not([data-mode]),
78
+ &[data-mode~='invalid'] {
79
+ color: #fff;
80
+ }
81
+ }
@@ -0,0 +1,109 @@
1
+ @import '../ui-local.less';
2
+
3
+ /**
4
+ * @name Chip
5
+ * @selector ins-chip, [insChip]
6
+ *
7
+ * @description
8
+ * A chip component that can be used on it's own or on buttons/links/inputs
9
+ *
10
+ * @attributes
11
+ * data-size — size (default: 's') ('xxs' | 'xs' | 's' | 'm')
12
+ *
13
+ * @example
14
+ * <ins-chip>Sale</ins-badge>
15
+ *
16
+ * @see-also
17
+ * Icons, Appearance, Badge, Block
18
+ */
19
+ [insChip] {
20
+ --t-gap: 0.125rem;
21
+ --t-margin: -0.125rem;
22
+ --t-icon-size: 1.2rem;
23
+ --t-padding: 0 0.625rem;
24
+ --t-size: var(--ins-height-m);
25
+
26
+ .button-base();
27
+
28
+ font: var(--ins-font-text-m);
29
+ border-radius: var(--ins-radius-m);
30
+ padding: var(--t-padding);
31
+ block-size: var(--t-size);
32
+ inline-size: fit-content;
33
+ min-inline-size: 2rem;
34
+ isolation: isolate;
35
+
36
+ .interactive({
37
+ cursor: pointer;
38
+ });
39
+
40
+ > ins-icon,
41
+ &[insIcons]::before,
42
+ &[insIcons]::after {
43
+ font-size: var(--t-icon-size) !important;
44
+ }
45
+
46
+ & > [insIconButton] {
47
+ margin: -0.375rem;
48
+ }
49
+ &[data-size='xs'] {
50
+ --t-padding: 0 0.375rem;
51
+ --t-size: var(--ins-height-xs);
52
+
53
+ font: var(--ins-font-text-xs);
54
+ border-radius: var(--ins-radius-xs);
55
+
56
+ & > [insIconButton] {
57
+ margin: -0.175rem;
58
+ }
59
+ }
60
+ &[data-size='s'] {
61
+ --t-padding: 0 0.625rem;
62
+ --t-size: var(--ins-height-s);
63
+
64
+ font: var(--ins-font-text-s);
65
+ border-radius: var(--ins-radius-s);
66
+
67
+ & > [insIconButton] {
68
+ margin: -0.375rem;
69
+ }
70
+ }
71
+
72
+ &[data-size='l'] {
73
+ --t-margin: -0.375rem;
74
+ --t-icon-size: 1.5rem;
75
+ --t-padding: 0 1rem;
76
+ --t-size: var(--ins-height-l);
77
+
78
+ font: var(--ins-font-text-l);
79
+
80
+ & > [insIconButton] {
81
+ margin: -0.75rem;
82
+ }
83
+ }
84
+
85
+ & > img,
86
+ ins-avatar {
87
+ inline-size: 1.5rem;
88
+ block-size: 1.5rem;
89
+ margin-inline-start: -0.375rem;
90
+ }
91
+
92
+ & > [insFade] {
93
+ &:first-of-type {
94
+ flex: 1 0 30%;
95
+ max-inline-size: fit-content;
96
+ }
97
+
98
+ &:last-of-type {
99
+ flex: 0 1 auto;
100
+ }
101
+ }
102
+
103
+ & > input[insChip] {
104
+ .fullsize();
105
+
106
+ // z-index: -1;
107
+ margin: 0;
108
+ }
109
+ }
@@ -0,0 +1,155 @@
1
+ /**
2
+ * @name Group
3
+ * @selector [insGroup]
4
+ *
5
+ * @description
6
+ * A directive to combine children into rounded flex group
7
+ *
8
+ * @attributes
9
+ * data-size — size (default: 'l') ('s' | 'm' | 'l')
10
+ * data-orientation — orientation (default: 'horizontal') ('horizontal' | 'vertical')
11
+ *
12
+ * @example
13
+ * <div insGroup>
14
+ * <button insButton>Click me</button>
15
+ * <button insButton>Click me</button>
16
+ * <button insButton>Click me</button>
17
+ * </div>
18
+ *
19
+ * @see-also
20
+ * Button, Block, Textfield
21
+ */
22
+ [insGroup] {
23
+ // position: relative;
24
+ display: flex;
25
+ // isolation: isolate;
26
+
27
+ --t-group-radius: var(--ins-radius-l);
28
+ --t-group-margin: -1px;
29
+ --t-group-mask: linear-gradient(
30
+ to right,
31
+ rgba(0, 0, 0, 0.5) 1px,
32
+ #000 2px,
33
+ #000 calc(100% - 2px),
34
+ rgba(0, 0, 0, 0.5)
35
+ );
36
+ --t-group-mask-end: linear-gradient(to right, rgba(0, 0, 0, 0.5) 1px, #000 2px);
37
+ --t-group-mask-start: linear-gradient(to right, #000 calc(100% - 2px), rgba(0, 0, 0, 0.5) calc(100% - 1px));
38
+
39
+ & > * {
40
+ z-index: 1;
41
+ flex: 1 1 0;
42
+ min-inline-size: 0;
43
+ mask: var(--t-group-mask);
44
+ mask-clip: no-clip;
45
+
46
+ &:disabled,
47
+ &._disabled {
48
+ z-index: 0;
49
+ }
50
+
51
+ &:invalid:not([data-mode]),
52
+ &[data-mode~='invalid'] {
53
+ z-index: 2;
54
+
55
+ --t-group-mask: none;
56
+ }
57
+
58
+ &:has(:invalid:not([data-mode])),
59
+ &:has([data-mode~='invalid']) {
60
+ z-index: 2;
61
+
62
+ --t-group-mask: none;
63
+ }
64
+
65
+ &:has(:focus-visible) {
66
+ z-index: 3;
67
+
68
+ --t-group-mask: none;
69
+ }
70
+
71
+ &:has([data-focus='true']) {
72
+ z-index: 3;
73
+
74
+ --t-group-mask: none;
75
+ }
76
+
77
+ &:checked:not([data-mode]),
78
+ &[data-mode~='checked'] {
79
+ z-index: 4;
80
+
81
+ --t-group-mask: none;
82
+ }
83
+
84
+ // &:has([insBlock]:checked) {
85
+ // z-index: 4;
86
+
87
+ // --t-group-mask: none;
88
+ // }
89
+
90
+ &:not(:last-child) {
91
+ margin-inline-end: var(--t-group-margin);
92
+ }
93
+
94
+ &:nth-child(n) {
95
+ border-radius: 0;
96
+ }
97
+
98
+ &:first-child {
99
+ border-radius: var(--t-group-radius) 0 0 var(--t-group-radius);
100
+ mask-image: var(--t-group-mask-start);
101
+ }
102
+
103
+ &:last-child {
104
+ border-radius: 0 var(--t-group-radius) var(--t-group-radius) 0;
105
+ mask-image: var(--t-group-mask-end);
106
+ }
107
+
108
+ &:only-child {
109
+ border-radius: var(--t-group-radius);
110
+ mask: none;
111
+ }
112
+ }
113
+
114
+ &[data-size='s'],
115
+ &[data-size='m'] {
116
+ --t-group-radius: var(--ins-radius-m);
117
+ }
118
+
119
+ &[data-orientation='vertical'] {
120
+ display: flex;
121
+ flex-direction: column;
122
+
123
+ --t-group-mask: linear-gradient(
124
+ to bottom,
125
+ rgba(0, 0, 0, 0.5) 1px,
126
+ #000 2px,
127
+ #000 calc(100% - 2px),
128
+ rgba(0, 0, 0, 0.5)
129
+ );
130
+ --t-group-mask-start: linear-gradient(to bottom, #000 calc(100% - 2px), rgba(0, 0, 0, 0.5) calc(100% - 1px));
131
+ --t-group-mask-end: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 1px, #000 2px);
132
+
133
+ & > * {
134
+ min-block-size: auto;
135
+ flex: 0 0 auto;
136
+
137
+ &:not(:last-child) {
138
+ margin-inline-end: 0;
139
+ margin-block-end: var(--t-group-margin);
140
+ }
141
+
142
+ &:first-child {
143
+ border-radius: var(--t-group-radius) var(--t-group-radius) 0 0;
144
+ }
145
+
146
+ &:last-child {
147
+ border-radius: 0 0 var(--t-group-radius) var(--t-group-radius);
148
+ }
149
+
150
+ &:only-child {
151
+ border-radius: var(--t-group-radius);
152
+ }
153
+ }
154
+ }
155
+ }