@thalassic/ui 0.0.1 → 0.1.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.
package/README.md CHANGED
@@ -1,7 +1 @@
1
- # ui
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Running unit tests
6
-
7
- Run `nx test ui` to execute the unit tests.
1
+ # Thalassic
@@ -0,0 +1,144 @@
1
+ :host {
2
+ .tls-button {
3
+ @mixin hover-focus-state {
4
+ &:not(.tls-button--disabled):hover,
5
+ &:not(.tls-button--disabled):focus-visible {
6
+ @content;
7
+ }
8
+ }
9
+
10
+ @mixin active-state {
11
+ &:not(.tls-button--disabled):active {
12
+ @content;
13
+ }
14
+ }
15
+
16
+ // Appearances
17
+ &--filled {
18
+ .tls-button__content {
19
+ color: var(--tls-button-on-color);
20
+ }
21
+
22
+ .tls-button__background {
23
+ background-color: var(--tls-button-color);
24
+ }
25
+
26
+ @include hover-focus-state {
27
+ .tls-button__background {
28
+ opacity: 0.85;
29
+ }
30
+ }
31
+
32
+ @include active-state {
33
+ .tls-button__background {
34
+ opacity: 0.75;
35
+ }
36
+ }
37
+ }
38
+
39
+ &--outlined {
40
+ .tls-button__content {
41
+ color: var(--tls-button-color);
42
+ }
43
+
44
+ .tls-button__background {
45
+ background-color: var(--tls-button-color);
46
+
47
+ opacity: 0;
48
+ }
49
+
50
+ @include hover-focus-state {
51
+ .tls-button__background {
52
+ opacity: 0.075;
53
+ }
54
+ }
55
+
56
+ @include active-state {
57
+ .tls-button__background {
58
+ opacity: 0.15;
59
+ }
60
+ }
61
+ }
62
+
63
+ &--text {
64
+ border-color: transparent;
65
+
66
+ .tls-button__content {
67
+ color: var(--tls-button-color);
68
+ }
69
+
70
+ .tls-button__background {
71
+ background-color: var(--tls-button-color);
72
+
73
+ opacity: 0;
74
+ }
75
+
76
+ @include hover-focus-state {
77
+ .tls-button__background {
78
+ opacity: 0.075;
79
+ }
80
+ }
81
+
82
+ @include active-state {
83
+ .tls-button__background {
84
+ opacity: 0.15;
85
+ }
86
+ }
87
+ }
88
+
89
+ &--elevated {
90
+ border: none;
91
+
92
+ box-shadow: var(--shadow-sm);
93
+
94
+ transition: box-shadow var(--motion-fast) var(--motion-ease-in-out);
95
+
96
+ .tls-button__content {
97
+ color: var(--tls-button-color);
98
+ }
99
+
100
+ .tls-button__background {
101
+ background-color: var(--tls-button-color);
102
+
103
+ opacity: 0;
104
+ }
105
+
106
+ &:not(.tls-button--disabled) {
107
+ padding-inline: calc(var(--tls-button-padding-inline) + var(--tls-button-border-width));
108
+ }
109
+
110
+ @include hover-focus-state {
111
+ box-shadow: var(--shadow-md);
112
+
113
+ .tls-button__background {
114
+ opacity: 0.075;
115
+ }
116
+ }
117
+
118
+ @include active-state {
119
+ box-shadow: var(--shadow-sm);
120
+
121
+ .tls-button__background {
122
+ opacity: 0.15;
123
+ }
124
+ }
125
+ }
126
+
127
+ &--disabled {
128
+ cursor: not-allowed;
129
+
130
+ border: var(--tls-button-border-width) solid var(--color-outline);
131
+
132
+ box-shadow: none;
133
+
134
+ .tls-button__content {
135
+ color: var(--tls-button-on-color);
136
+ }
137
+
138
+ .tls-button__background {
139
+ opacity: 1;
140
+ transition: none;
141
+ }
142
+ }
143
+ }
144
+ }
@@ -0,0 +1,41 @@
1
+ :host {
2
+ &:has(.tls-button.tls-button--primary) {
3
+ --tls-button-on-color: var(--color-on-primary);
4
+ --tls-button-color: var(--color-primary);
5
+ }
6
+
7
+ &:has(.tls-button.tls-button--secondary) {
8
+ --tls-button-on-color: var(--color-on-secondary);
9
+ --tls-button-color: var(--color-secondary);
10
+ }
11
+
12
+ &:has(.tls-button.tls-button--tertiary) {
13
+ --tls-button-on-color: var(--color-on-tertiary);
14
+ --tls-button-color: var(--color-tertiary);
15
+ }
16
+
17
+ &:has(.tls-button.tls-button--success) {
18
+ --tls-button-on-color: var(--color-on-success);
19
+ --tls-button-color: var(--color-success);
20
+ }
21
+
22
+ &:has(.tls-button.tls-button--info) {
23
+ --tls-button-on-color: var(--color-on-info);
24
+ --tls-button-color: var(--color-info);
25
+ }
26
+
27
+ &:has(.tls-button.tls-button--warning) {
28
+ --tls-button-on-color: var(--color-on-warning);
29
+ --tls-button-color: var(--color-warning);
30
+ }
31
+
32
+ &:has(.tls-button.tls-button--danger) {
33
+ --tls-button-on-color: var(--color-on-danger);
34
+ --tls-button-color: var(--color-danger);
35
+ }
36
+
37
+ &:has(.tls-button.tls-button--disabled) {
38
+ --tls-button-on-color: var(--color-on-surface-variant);
39
+ --tls-button-color: var(--color-surface-variant);
40
+ }
41
+ }
@@ -0,0 +1,47 @@
1
+ :host {
2
+ .tls-button {
3
+ height: var(--tls-button-height);
4
+ padding-inline: var(--tls-button-padding-inline);
5
+
6
+ font-size: var(--tls-button-font-size);
7
+ font-weight: var(--tls-button-font-weight);
8
+ line-height: var(--tls-button-line-height);
9
+ letter-spacing: var(--tls-button-letter-spacing);
10
+
11
+ &.tls-button--icon-only {
12
+ padding-inline: 0;
13
+
14
+ aspect-ratio: 1/1;
15
+ }
16
+ }
17
+
18
+ &:has(.tls-button.tls-button--sm) {
19
+ --tls-button-height: var(--control-height-sm);
20
+ --tls-button-padding-inline: var(--spacing-3);
21
+
22
+ --tls-button-font-size: var(--font-label-small-size);
23
+ --tls-button-font-weight: var(--font-label-small-weight);
24
+ --tls-button-line-height: var(--font-label-small-line-height);
25
+ --tls-button-letter-spacing: var(--font-label-small-letter-spacing);
26
+ }
27
+
28
+ &:has(.tls-button.tls-button--md) {
29
+ --tls-button-height: var(--control-height-md);
30
+ --tls-button-padding-inline: var(--spacing-4);
31
+
32
+ --tls-button-font-size: var(--font-label-medium-size);
33
+ --tls-button-font-weight: var(--font-label-medium-weight);
34
+ --tls-button-line-height: var(--font-label-medium-line-height);
35
+ --tls-button-letter-spacing: var(--font-label-medium-letter-spacing);
36
+ }
37
+
38
+ &:has(.tls-button.tls-button--lg) {
39
+ --tls-button-height: var(--control-height-lg);
40
+ --tls-button-padding-inline: var(--spacing-5);
41
+
42
+ --tls-button-font-size: var(--font-label-large-size);
43
+ --tls-button-font-weight: var(--font-label-large-weight);
44
+ --tls-button-line-height: var(--font-label-large-line-height);
45
+ --tls-button-letter-spacing: var(--font-label-large-letter-spacing);
46
+ }
47
+ }
@@ -0,0 +1,55 @@
1
+ @use '../../styles/mixins' as mixins;
2
+
3
+ :host {
4
+ width: fit-content;
5
+
6
+ display: inline-block;
7
+
8
+ --tls-button-border-width: 1px;
9
+
10
+ &:focus-visible {
11
+ outline: none;
12
+ }
13
+
14
+ .tls-button {
15
+ position: relative;
16
+
17
+ display: inline-flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+
21
+ gap: 0.25rem;
22
+
23
+ border: var(--tls-button-border-width) solid var(--tls-button-color);
24
+ border-radius: var(--radius-md);
25
+
26
+ cursor: pointer;
27
+ user-select: none;
28
+
29
+ transition: border-color var(--motion-fast) var(--motion-ease-in-out);
30
+
31
+ &:focus-visible {
32
+ @include mixins.focus-ring;
33
+ }
34
+
35
+ &__content {
36
+ z-index: 1;
37
+
38
+ display: flex;
39
+ align-items: center;
40
+
41
+ transition: color var(--motion-fast) var(--motion-ease-in-out);
42
+ }
43
+
44
+ &__background {
45
+ position: absolute;
46
+ inset: 0;
47
+
48
+ border-radius: inherit;
49
+
50
+ transition:
51
+ background-color var(--motion-fast) var(--motion-ease-in-out),
52
+ opacity var(--motion-fast) var(--motion-ease-in-out);
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,95 @@
1
+ @use '../../../styles/mixins' as mixins;
2
+
3
+ :host.tls-checkbox {
4
+ --tls-checkbox-size: 20px;
5
+ --tls-checkbox-border-width: 1px;
6
+ --tls-checkbox-border-color: var(--color-primary);
7
+ --tls-checkbox-checked-icon-color: var(--color-surface);
8
+
9
+ position: relative;
10
+
11
+ width: var(--tls-checkbox-size);
12
+ height: var(--tls-checkbox-size);
13
+
14
+ display: inline-block;
15
+
16
+ transition: filter var(--motion-fast) var(--motion-ease-in-out);
17
+
18
+ .tls-checkbox-input {
19
+ width: 100%;
20
+ height: 100%;
21
+ margin: 0;
22
+
23
+ appearance: none;
24
+
25
+ border: var(--tls-checkbox-border-width) solid var(--tls-checkbox-border-color);
26
+ border-radius: 4px;
27
+
28
+ cursor: pointer;
29
+
30
+ background-color: var(--color-surface);
31
+
32
+ transition:
33
+ box-shadow var(--motion-fast) var(--motion-ease-in-out),
34
+ border-color var(--motion-fast) var(--motion-ease-in-out),
35
+ background-color var(--motion-fast) var(--motion-ease-in-out);
36
+
37
+ &:checked {
38
+ background-color: var(--color-primary);
39
+ }
40
+
41
+ &:focus-visible {
42
+ @include mixins.focus-ring;
43
+ }
44
+ }
45
+
46
+ .tls-checkbox-icon {
47
+ position: absolute;
48
+ inset: 0;
49
+
50
+ opacity: 0;
51
+ scale: 0;
52
+
53
+ pointer-events: none;
54
+
55
+ color: var(--tls-checkbox-checked-icon-color);
56
+
57
+ transition:
58
+ scale var(--motion-default) var(--motion-ease-bounce),
59
+ opacity var(--motion-fast) var(--motion-ease-in-out);
60
+ }
61
+
62
+ // Checked & Indeterminate
63
+ &.tls-checkbox--checked,
64
+ &.tls-checkbox--indeterminate {
65
+ .tls-checkbox-input {
66
+ background-color: var(--color-primary);
67
+ }
68
+
69
+ .tls-checkbox-icon {
70
+ opacity: 1;
71
+ scale: 1;
72
+ }
73
+ }
74
+
75
+ // Form control
76
+ &.tls-checkbox--disabled {
77
+ --tls-checkbox-border-color: var(--color-outline);
78
+
79
+ filter: brightness(0.9);
80
+
81
+ cursor: not-allowed;
82
+
83
+ .tls-checkbox-input {
84
+ pointer-events: none;
85
+ }
86
+ }
87
+
88
+ &:not(.tls-checkbox--disabled).tls-checkbox--touched.tls-checkbox--invalid {
89
+ --tls-checkbox-border-color: var(--color-danger);
90
+
91
+ .tls-checkbox-input {
92
+ box-shadow: 0 0 4px -1px var(--color-danger);
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,3 @@
1
+ :host {
2
+ display: inline-block;
3
+ }
@@ -0,0 +1,25 @@
1
+ @use '../../../styles/mixins';
2
+
3
+ :host {
4
+ display: inline-flex;
5
+
6
+ .tls-password-toggle {
7
+ display: grid;
8
+ align-items: center;
9
+
10
+ &:focus-visible {
11
+ @include mixins.focus-ring;
12
+ border-radius: var(--radius-md);
13
+ }
14
+
15
+ &__item {
16
+ grid-area: 1 / 1;
17
+
18
+ text-align: center;
19
+
20
+ &--hidden {
21
+ visibility: hidden;
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,103 @@
1
+ @use '../../../styles/mixins' as mixins;
2
+
3
+ :host.tls-radio-button {
4
+ --tls-radio-button-size: 20px;
5
+ --tls-radio-button-circle-size: 12px;
6
+ --tls-radio-button-border-size: 1px;
7
+ --tls-radio-button-border-color: var(--color-primary);
8
+ --tls-radio-button-circle-color: var(--color-primary);
9
+
10
+ position: relative;
11
+
12
+ width: var(--tls-radio-button-size);
13
+ height: var(--tls-radio-button-size);
14
+
15
+ display: inline-block;
16
+
17
+ transition: filter var(--motion-fast) var(--motion-ease-in-out);
18
+
19
+ .tls-radio-button-input {
20
+ width: 100%;
21
+ height: 100%;
22
+ margin: 0;
23
+
24
+ appearance: none;
25
+
26
+ border: var(--tls-radio-button-border-size) solid var(--tls-radio-button-border-color);
27
+ border-radius: 50%;
28
+
29
+ cursor: pointer;
30
+
31
+ background-color: var(--color-surface);
32
+
33
+ transition:
34
+ box-shadow var(--motion-fast) var(--motion-ease-in-out),
35
+ border-color var(--motion-fast) var(--motion-ease-in-out),
36
+ background-color var(--motion-fast) var(--motion-ease-in-out);
37
+
38
+ &:focus-visible {
39
+ @include mixins.focus-ring;
40
+ }
41
+ }
42
+
43
+ .tls-radio-button-circle {
44
+ position: absolute;
45
+ inset: 0;
46
+
47
+ display: flex;
48
+ justify-content: center;
49
+ align-items: center;
50
+
51
+ pointer-events: none;
52
+
53
+ &::before {
54
+ content: '';
55
+
56
+ width: var(--tls-radio-button-circle-size);
57
+ height: var(--tls-radio-button-circle-size);
58
+
59
+ display: inline-block;
60
+
61
+ opacity: 0;
62
+ scale: 0.75;
63
+
64
+ border-radius: 50%;
65
+ background-color: var(--tls-radio-button-circle-color);
66
+
67
+ transition:
68
+ scale var(--motion-fast) var(--motion-ease-in-out),
69
+ opacity var(--motion-default) var(--motion-ease-in-out);
70
+ }
71
+ }
72
+
73
+ // Checked
74
+ &.tls-radio-button--checked {
75
+ .tls-radio-button-circle {
76
+ &::before {
77
+ opacity: 1;
78
+ scale: 1;
79
+ }
80
+ }
81
+ }
82
+
83
+ // Form control
84
+ &.tls-radio-button--disabled {
85
+ --tls-radio-button-border-color: var(--color-outline);
86
+
87
+ filter: brightness(0.9);
88
+
89
+ cursor: not-allowed;
90
+
91
+ .tls-radio-button-input {
92
+ pointer-events: none;
93
+ }
94
+ }
95
+
96
+ &:not(.tls-radio-button--disabled).tls-radio-button--touched.tls-radio-button--invalid {
97
+ --tls-radio-button-border-color: var(--color-danger);
98
+
99
+ .tls-radio-button-input {
100
+ box-shadow: 0 0 4px -1px var(--color-danger);
101
+ }
102
+ }
103
+ }
@@ -0,0 +1,36 @@
1
+ :host {
2
+ &.tls-switch--checked.tls-switch--primary {
3
+ --tls-switch-color: var(--color-primary);
4
+ --tls-switch-on-color: var(--color-on-primary);
5
+ }
6
+
7
+ &.tls-switch--checked.tls-switch--secondary {
8
+ --tls-switch-color: var(--color-secondary);
9
+ --tls-switch-on-color: var(--color-on-secondary);
10
+ }
11
+
12
+ &.tls-switch--checked.tls-switch--tertiary {
13
+ --tls-switch-color: var(--color-tertiary);
14
+ --tls-switch-on-color: var(--color-on-tertiary);
15
+ }
16
+
17
+ &.tls-switch--checked.tls-switch--success {
18
+ --tls-switch-color: var(--color-success);
19
+ --tls-switch-on-color: var(--color-on-success);
20
+ }
21
+
22
+ &.tls-switch--checked.tls-switch--info {
23
+ --tls-switch-color: var(--color-info);
24
+ --tls-switch-on-color: var(--color-on-info);
25
+ }
26
+
27
+ &.tls-switch--checked.tls-switch--warning {
28
+ --tls-switch-color: var(--color-warning);
29
+ --tls-switch-on-color: var(--color-on-warning);
30
+ }
31
+
32
+ &.tls-switch--checked.tls-switch--danger {
33
+ --tls-switch-color: var(--color-danger);
34
+ --tls-switch-on-color: var(--color-on-danger);
35
+ }
36
+ }
@@ -0,0 +1,82 @@
1
+ @use '../../../styles/mixins' as mixins;
2
+
3
+ :host.tls-switch {
4
+ --tls-switch-width: 48px;
5
+ --tls-switch-height: var(--control-height-sm);
6
+ --tls-switch-handle-gap: 4px;
7
+ --tls-switch-handle-size: calc(
8
+ var(--tls-switch-height) - (var(--tls-switch-handle-gap) * 2) -
9
+ (var(--tls-switch-border-width) * 2)
10
+ );
11
+
12
+ --tls-switch-border-width: 1px;
13
+ --tls-switch-border-radius: 24px;
14
+
15
+ --tls-switch-color: var(--color-surface-variant);
16
+ --tls-switch-on-color: var(--color-surface);
17
+ --tls-switch-border-color: var(--tls-switch-color);
18
+
19
+ width: var(--tls-switch-width);
20
+ height: var(--tls-switch-height);
21
+
22
+ display: flex;
23
+
24
+ border: var(--tls-switch-border-width) solid var(--tls-switch-border-color);
25
+ border-radius: var(--tls-switch-border-radius);
26
+
27
+ background-color: var(--tls-switch-color);
28
+
29
+ cursor: pointer;
30
+
31
+ transition:
32
+ background-color var(--motion-fast) var(--motion-ease-in-out),
33
+ border-color var(--motion-fast) var(--motion-ease-in-out),
34
+ filter var(--motion-fast) var(--motion-ease-in-out);
35
+
36
+ &:focus-visible {
37
+ @include mixins.focus-ring;
38
+ }
39
+
40
+ .tls-switch-input {
41
+ display: none;
42
+ }
43
+
44
+ .tls-switch-handle {
45
+ width: var(--tls-switch-handle-size);
46
+ height: var(--tls-switch-handle-size);
47
+
48
+ margin: calc(var(--tls-switch-handle-gap));
49
+
50
+ border-radius: 50%;
51
+
52
+ background-color: var(--tls-switch-on-color);
53
+
54
+ box-shadow: var(--shadow-xs);
55
+
56
+ transition: transform var(--motion-fast) var(--motion-ease-in-out);
57
+ }
58
+
59
+ // Checked
60
+ &.tls-switch--checked {
61
+ --tls-switch-handle-gap: 3px;
62
+
63
+ .tls-switch-handle {
64
+ $translate-x: calc(
65
+ var(--tls-switch-width) - var(--tls-switch-handle-size) -
66
+ (var(--tls-switch-handle-gap) * 2) - (var(--tls-switch-border-width) * 2)
67
+ );
68
+
69
+ transform: translateX(#{$translate-x});
70
+ }
71
+ }
72
+
73
+ // Form control
74
+ &.tls-switch--disabled {
75
+ cursor: not-allowed;
76
+ filter: brightness(0.9);
77
+ }
78
+
79
+ &:not(.tls-switch--disabled).tls-switch--touched.tls-switch--invalid {
80
+ --tls-switch-border-color: var(--color-danger);
81
+ }
82
+ }