canny-ui 2.0.0 → 4.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.
@@ -0,0 +1,130 @@
1
+ @use '../tokens/primitives' as *;
2
+
3
+ // Charts — from-scratch SVG bar & donut charts.
4
+
5
+ .cny-chart {
6
+ width: 100%;
7
+ font-family: var(--font-body);
8
+ }
9
+
10
+ .cny-chart-responsive {
11
+ display: block;
12
+ }
13
+
14
+ .cny-chart-grid {
15
+ stroke: var(--hairline-color);
16
+ stroke-width: 1;
17
+ }
18
+
19
+ .cny-chart-axis {
20
+ fill: var(--text-muted);
21
+ font-size: 0.6875rem;
22
+ }
23
+
24
+ .cny-chart-bar {
25
+ transition: opacity 120ms ease;
26
+
27
+ &:hover {
28
+ opacity: 0.85;
29
+ }
30
+ }
31
+
32
+ .cny-chart-line {
33
+ stroke-width: 2;
34
+ stroke-linejoin: round;
35
+ stroke-linecap: round;
36
+ }
37
+
38
+ .cny-chart-area {
39
+ opacity: 0.16;
40
+ }
41
+
42
+ .cny-chart-dot {
43
+ stroke: var(--bg-surface-lowest);
44
+ stroke-width: 1.5;
45
+ }
46
+
47
+ .cny-chart-slice {
48
+ stroke: var(--bg-surface-lowest);
49
+ stroke-width: 2;
50
+ transition: opacity 120ms ease;
51
+
52
+ &.is-active {
53
+ opacity: 0.85;
54
+ }
55
+ }
56
+
57
+ .cny-chart-center {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ width: 100%;
62
+ height: 100%;
63
+ text-align: center;
64
+ font-size: 0.875rem;
65
+ font-weight: 600;
66
+ color: var(--text-primary);
67
+ }
68
+
69
+ // floating tooltip
70
+ .cny-chart-tooltip {
71
+ position: absolute;
72
+ transform: translate(-50%, calc(-100% - 8px));
73
+ min-width: 120px;
74
+ padding: $space-2 $space-3;
75
+ border-radius: $radius-md;
76
+ background: var(--bg-surface-lowest);
77
+ border: 1px solid var(--border-color);
78
+ box-shadow: var(--shadow-md);
79
+ font-size: 0.75rem;
80
+ color: var(--text-primary);
81
+ pointer-events: none;
82
+ z-index: 2;
83
+ }
84
+
85
+ .cny-chart-tooltip-title {
86
+ font-weight: 600;
87
+ margin-bottom: 4px;
88
+ }
89
+
90
+ .cny-chart-tooltip-row {
91
+ display: flex;
92
+ align-items: center;
93
+ gap: 6px;
94
+ line-height: 1.6;
95
+ }
96
+
97
+ .cny-chart-tooltip-label {
98
+ color: var(--text-secondary);
99
+ }
100
+
101
+ .cny-chart-tooltip-value {
102
+ margin-inline-start: auto;
103
+ font-weight: 600;
104
+ font-variant-numeric: tabular-nums;
105
+ }
106
+
107
+ // legend
108
+ .cny-chart-legend {
109
+ display: flex;
110
+ flex-wrap: wrap;
111
+ gap: $space-2 $space-4;
112
+ justify-content: center;
113
+ margin-top: $space-2;
114
+ font-size: 0.75rem;
115
+ color: var(--text-secondary);
116
+ }
117
+
118
+ .cny-chart-legend-item {
119
+ display: inline-flex;
120
+ align-items: center;
121
+ gap: 6px;
122
+ }
123
+
124
+ .cny-chart-swatch {
125
+ display: inline-block;
126
+ width: 10px;
127
+ height: 10px;
128
+ border-radius: 3px;
129
+ flex: none;
130
+ }
@@ -0,0 +1,122 @@
1
+ @use '../tokens/primitives' as *;
2
+
3
+ // Chip — compact label / status / filter pill / removable token.
4
+
5
+ .cny-chip {
6
+ --chip-color: var(--text-secondary);
7
+ --chip-bg: var(--bg-surface-low);
8
+ --chip-border: var(--hairline-color);
9
+
10
+ display: inline-flex;
11
+ align-items: center;
12
+ gap: 6px;
13
+ height: 26px;
14
+ padding: 0 10px;
15
+ border-radius: 999px;
16
+ font-family: var(--font-body);
17
+ font-size: 0.75rem;
18
+ font-weight: 550;
19
+ letter-spacing: -0.005em;
20
+ white-space: nowrap;
21
+ background: var(--chip-bg);
22
+ color: var(--chip-color);
23
+ border: 1px solid var(--chip-border);
24
+ transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
25
+ user-select: none;
26
+
27
+ &.sm {
28
+ height: 22px;
29
+ padding: 0 8px;
30
+ font-size: 0.6875rem;
31
+ gap: 4px;
32
+ }
33
+
34
+ &-icon, &-avatar {
35
+ display: inline-flex;
36
+ align-items: center;
37
+ flex: none;
38
+ }
39
+ &-avatar { margin-left: -4px; }
40
+ &-label { line-height: 1; }
41
+
42
+ &-delete {
43
+ flex: none;
44
+ display: inline-flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ width: 16px;
48
+ height: 16px;
49
+ margin-right: -4px;
50
+ background: transparent;
51
+ border: 0;
52
+ border-radius: 50%;
53
+ color: currentColor;
54
+ opacity: 0.6;
55
+ cursor: pointer;
56
+ transition: opacity 120ms ease, background-color 120ms ease;
57
+
58
+ &:hover {
59
+ opacity: 1;
60
+ background: color-mix(in srgb, var(--chip-color) 15%, transparent);
61
+ }
62
+ &:focus-visible {
63
+ outline: 2px solid var(--chip-color);
64
+ outline-offset: 1px;
65
+ }
66
+ }
67
+ .sm &-delete { width: 14px; height: 14px; margin-right: -3px; }
68
+
69
+ // Interactive (clickable) state
70
+ &.is-interactive {
71
+ cursor: pointer;
72
+ &:hover { transform: translateY(-1px); }
73
+ &:active { transform: translateY(0); }
74
+ &:focus-visible {
75
+ outline: 2px solid color-mix(in srgb, var(--chip-color) 60%, transparent);
76
+ outline-offset: 2px;
77
+ }
78
+ }
79
+ &.is-disabled {
80
+ opacity: 0.55;
81
+ cursor: not-allowed;
82
+ pointer-events: none;
83
+ }
84
+
85
+ // ── Color tones ──
86
+ &.primary {
87
+ --chip-color: var(--color-primary);
88
+ --chip-bg: color-mix(in srgb, var(--color-primary) 10%, transparent);
89
+ --chip-border: color-mix(in srgb, var(--color-primary) 22%, transparent);
90
+ }
91
+ &.success {
92
+ --chip-color: var(--color-success);
93
+ --chip-bg: color-mix(in srgb, var(--color-success) 10%, transparent);
94
+ --chip-border: color-mix(in srgb, var(--color-success) 24%, transparent);
95
+ }
96
+ &.info {
97
+ --chip-color: var(--color-info);
98
+ --chip-bg: color-mix(in srgb, var(--color-info) 10%, transparent);
99
+ --chip-border: color-mix(in srgb, var(--color-info) 24%, transparent);
100
+ }
101
+ &.warning {
102
+ --chip-color: var(--color-warning);
103
+ --chip-bg: color-mix(in srgb, var(--color-warning) 12%, transparent);
104
+ --chip-border: color-mix(in srgb, var(--color-warning) 26%, transparent);
105
+ }
106
+ &.danger {
107
+ --chip-color: var(--color-danger);
108
+ --chip-bg: color-mix(in srgb, var(--color-danger) 10%, transparent);
109
+ --chip-border: color-mix(in srgb, var(--color-danger) 26%, transparent);
110
+ }
111
+
112
+ // ── Variants ──
113
+ &.outline {
114
+ background: transparent;
115
+ }
116
+ &.solid.primary { background: var(--color-primary); color: var(--color-primary-on, #fff); border-color: var(--color-primary); }
117
+ &.solid.success { background: var(--color-success); color: var(--color-success-on, #fff); border-color: var(--color-success); }
118
+ &.solid.info { background: var(--color-info); color: var(--color-info-on, #fff); border-color: var(--color-info); }
119
+ &.solid.warning { background: var(--color-warning); color: var(--color-warning-on, #fff); border-color: var(--color-warning); }
120
+ &.solid.danger { background: var(--color-danger); color: var(--color-danger-on, #fff); border-color: var(--color-danger); }
121
+ &.solid.default { background: var(--text-primary); color: var(--bg-surface-lowest); border-color: var(--text-primary); }
122
+ }
@@ -0,0 +1,11 @@
1
+ @use '../tokens/primitives' as *;
2
+
3
+ // ConfirmDialog — preset on Dialog. Inherits dialog chrome; only the body copy is styled.
4
+
5
+ .cny-confirm-message {
6
+ margin: 0;
7
+ font-family: var(--font-body);
8
+ font-size: 0.875rem;
9
+ line-height: 1.5;
10
+ color: var(--text-secondary);
11
+ }
@@ -0,0 +1,176 @@
1
+ @use '../tokens/primitives' as *;
2
+
3
+ // DataTable — server-driven data grid (sorting header, selection, pagination footer).
4
+
5
+ .cny-dt {
6
+ display: flex;
7
+ flex-direction: column;
8
+ width: 100%;
9
+ border: 1px solid var(--border-color);
10
+ border-radius: $radius-lg;
11
+ background: var(--bg-surface-lowest);
12
+ overflow: hidden;
13
+ font-family: var(--font-body);
14
+ }
15
+
16
+ // horizontal scroll keeps the grid responsive on narrow screens
17
+ .cny-dt-scroll {
18
+ width: 100%;
19
+ overflow-x: auto;
20
+ }
21
+
22
+ .cny-dt-table {
23
+ width: 100%;
24
+ border-collapse: collapse;
25
+ font-size: 0.875rem;
26
+ color: var(--text-primary);
27
+
28
+ th,
29
+ td {
30
+ padding: $space-3 $space-4;
31
+ text-align: left;
32
+ vertical-align: middle;
33
+ white-space: nowrap;
34
+ }
35
+
36
+ thead th {
37
+ position: sticky;
38
+ top: 0;
39
+ z-index: 1;
40
+ font-size: 0.75rem;
41
+ font-weight: 600;
42
+ color: var(--text-muted);
43
+ text-transform: uppercase;
44
+ letter-spacing: 0.04em;
45
+ background: var(--bg-surface-low);
46
+ border-bottom: 1px solid var(--border-color);
47
+ }
48
+
49
+ tbody td {
50
+ border-bottom: 1px solid var(--hairline-color);
51
+ }
52
+
53
+ tbody tr:last-child td {
54
+ border-bottom: 0;
55
+ }
56
+ }
57
+
58
+ .cny-dt-left {
59
+ text-align: left;
60
+ }
61
+ .cny-dt-center {
62
+ text-align: center;
63
+ }
64
+ .cny-dt-right {
65
+ text-align: right;
66
+ }
67
+
68
+ .cny-dt-th-inner {
69
+ display: inline-flex;
70
+ align-items: center;
71
+ gap: 4px;
72
+ }
73
+
74
+ // right-aligned headers push the sort affordance to the correct edge
75
+ .cny-dt-right .cny-dt-th-inner {
76
+ flex-direction: row-reverse;
77
+ }
78
+ .cny-dt-center .cny-dt-th-inner {
79
+ justify-content: center;
80
+ }
81
+
82
+ .cny-dt-sortable {
83
+ cursor: pointer;
84
+ user-select: none;
85
+ transition: color 120ms ease;
86
+
87
+ &:hover {
88
+ color: var(--text-primary);
89
+ }
90
+
91
+ &.is-sorted {
92
+ color: var(--color-primary);
93
+ }
94
+ }
95
+
96
+ .cny-dt-sort-icon {
97
+ display: inline-flex;
98
+ align-items: center;
99
+ opacity: 0.5;
100
+ }
101
+
102
+ // drag-to-resize handle on the right edge of each header cell
103
+ .cny-dt-resizer {
104
+ position: absolute;
105
+ top: 0;
106
+ right: 0;
107
+ width: 9px;
108
+ height: 100%;
109
+ cursor: col-resize;
110
+ user-select: none;
111
+ touch-action: none;
112
+
113
+ &::after {
114
+ content: '';
115
+ position: absolute;
116
+ top: 20%;
117
+ right: 4px;
118
+ width: 2px;
119
+ height: 60%;
120
+ border-radius: 2px;
121
+ background: transparent;
122
+ transition: background-color 120ms ease;
123
+ }
124
+
125
+ &:hover::after {
126
+ background: var(--color-primary);
127
+ }
128
+ }
129
+
130
+ .cny-dt-sortable.is-sorted .cny-dt-sort-icon {
131
+ opacity: 1;
132
+ }
133
+
134
+ .cny-dt-row {
135
+ transition: background-color 120ms ease;
136
+
137
+ &.is-clickable {
138
+ cursor: pointer;
139
+ }
140
+
141
+ &:hover {
142
+ background: var(--bg-surface-low);
143
+ }
144
+
145
+ &.is-selected {
146
+ background: var(--color-primary-soft);
147
+ }
148
+ }
149
+
150
+ .cny-dt-checkbox-cell {
151
+ width: 1%;
152
+ white-space: nowrap;
153
+ text-align: center;
154
+ }
155
+
156
+ .cny-dt-empty {
157
+ padding: $space-8 $space-4;
158
+ text-align: center;
159
+ color: var(--text-muted);
160
+ }
161
+
162
+ .cny-dt-footer {
163
+ display: flex;
164
+ flex-wrap: wrap;
165
+ align-items: center;
166
+ justify-content: space-between;
167
+ gap: $space-2;
168
+ padding: $space-2 $space-3;
169
+ border-top: 1px solid var(--border-color);
170
+ background: var(--bg-surface-low);
171
+ }
172
+
173
+ .cny-dt-count {
174
+ font-size: 0.8125rem;
175
+ color: var(--text-muted);
176
+ }
@@ -0,0 +1,113 @@
1
+ @use '../tokens/primitives' as *;
2
+
3
+ // Dialog (Modal) — portaled, centered, focus-trapped.
4
+
5
+ @keyframes cny-dialog-overlay-in { from { opacity: 0; } to { opacity: 1; } }
6
+ @keyframes cny-dialog-content-in {
7
+ from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
8
+ to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
9
+ }
10
+
11
+ .cny-dialog-overlay {
12
+ position: fixed;
13
+ inset: 0;
14
+ background: rgba(9, 9, 11, 0.55);
15
+ z-index: 1000;
16
+ backdrop-filter: blur(2px);
17
+ -webkit-backdrop-filter: blur(2px);
18
+ animation: cny-dialog-overlay-in 160ms ease-out;
19
+ }
20
+ .cny-dark .cny-dialog-overlay { background: rgba(0, 0, 0, 0.7); }
21
+
22
+ .cny-dialog-content {
23
+ position: fixed;
24
+ top: 50%;
25
+ left: 50%;
26
+ transform: translate(-50%, -50%);
27
+ z-index: 1001;
28
+ display: flex;
29
+ flex-direction: column;
30
+ max-height: calc(100vh - 32px);
31
+ background: var(--bg-surface-lowest);
32
+ border: 1px solid var(--border-color);
33
+ border-radius: var(--radius-md);
34
+ box-shadow:
35
+ 0 24px 60px -24px rgba(0, 0, 0, 0.45),
36
+ 0 0 0 1px var(--border-color);
37
+ font-family: var(--font-body);
38
+ color: var(--text-primary);
39
+ animation: cny-dialog-content-in 200ms cubic-bezier(0.2, 0, 0, 1);
40
+ outline: none;
41
+ overflow: hidden;
42
+
43
+ &.size-sm { width: min(420px, calc(100vw - 32px)); }
44
+ &.size-md { width: min(560px, calc(100vw - 32px)); }
45
+ &.size-lg { width: min(760px, calc(100vw - 32px)); }
46
+ &.size-xl { width: min(960px, calc(100vw - 32px)); }
47
+ &.size-full { width: calc(100vw - 32px); height: calc(100vh - 32px); }
48
+ }
49
+
50
+ .cny-dialog-header {
51
+ display: flex;
52
+ align-items: flex-start;
53
+ gap: 12px;
54
+ padding: 18px 20px 14px;
55
+ border-bottom: 1px solid var(--hairline-color);
56
+ }
57
+
58
+ .cny-dialog-titles { flex: 1 1 auto; min-width: 0; }
59
+ .cny-dialog-title {
60
+ margin: 0;
61
+ font-size: 1rem;
62
+ font-weight: 650;
63
+ letter-spacing: -0.005em;
64
+ color: var(--text-primary);
65
+ }
66
+ .cny-dialog-description {
67
+ margin: 4px 0 0;
68
+ font-size: 0.875rem;
69
+ line-height: 1.55;
70
+ color: var(--text-secondary);
71
+ }
72
+
73
+ .cny-dialog-close {
74
+ flex: none;
75
+ display: inline-flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ width: 28px;
79
+ height: 28px;
80
+ background: transparent;
81
+ border: 0;
82
+ color: var(--text-muted);
83
+ cursor: pointer;
84
+ border-radius: var(--radius-xs);
85
+ transition: color 120ms ease, background-color 120ms ease;
86
+
87
+ &:hover { color: var(--text-primary); background: var(--bg-surface-low); }
88
+ &:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
89
+ }
90
+
91
+ .cny-dialog-body {
92
+ flex: 1 1 auto;
93
+ overflow-y: auto;
94
+ padding: 18px 20px;
95
+ font-size: 0.9375rem;
96
+ line-height: 1.6;
97
+ color: var(--text-secondary);
98
+ }
99
+
100
+ .cny-dialog-footer {
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: flex-end;
104
+ gap: 8px;
105
+ padding: 14px 20px;
106
+ border-top: 1px solid var(--hairline-color);
107
+ background: var(--bg-surface-lowest);
108
+ }
109
+
110
+ @media (prefers-reduced-motion: reduce) {
111
+ .cny-dialog-overlay,
112
+ .cny-dialog-content { animation: none; }
113
+ }
@@ -0,0 +1,133 @@
1
+ @use '../tokens/primitives' as *;
2
+
3
+ // Drawer / Sheet — slide-in panel from any edge.
4
+
5
+ @keyframes cny-drawer-overlay-in { from { opacity: 0; } to { opacity: 1; } }
6
+ @keyframes cny-drawer-in-right { from { transform: translateX(100%); } to { transform: translateX(0); } }
7
+ @keyframes cny-drawer-in-left { from { transform: translateX(-100%); } to { transform: translateX(0); } }
8
+ @keyframes cny-drawer-in-top { from { transform: translateY(-100%); } to { transform: translateY(0); } }
9
+ @keyframes cny-drawer-in-bottom { from { transform: translateY(100%); } to { transform: translateY(0); } }
10
+
11
+ .cny-drawer-overlay {
12
+ position: fixed;
13
+ inset: 0;
14
+ background: rgba(9, 9, 11, 0.55);
15
+ z-index: 1000;
16
+ backdrop-filter: blur(2px);
17
+ -webkit-backdrop-filter: blur(2px);
18
+ animation: cny-drawer-overlay-in 160ms ease-out;
19
+ }
20
+ .cny-dark .cny-drawer-overlay { background: rgba(0, 0, 0, 0.7); }
21
+
22
+ .cny-drawer-content {
23
+ position: fixed;
24
+ z-index: 1001;
25
+ display: flex;
26
+ flex-direction: column;
27
+ background: var(--bg-surface-lowest);
28
+ border: 1px solid var(--border-color);
29
+ box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.45);
30
+ font-family: var(--font-body);
31
+ color: var(--text-primary);
32
+ outline: none;
33
+
34
+ // ── Side anchoring ──
35
+ &.side-right {
36
+ top: 0; right: 0; bottom: 0;
37
+ border-left: 1px solid var(--border-color);
38
+ animation: cny-drawer-in-right 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
39
+ &.size-sm { width: min(320px, 90vw); }
40
+ &.size-md { width: min(420px, 90vw); }
41
+ &.size-lg { width: min(560px, 92vw); }
42
+ &.size-xl { width: min(720px, 96vw); }
43
+ }
44
+ &.side-left {
45
+ top: 0; left: 0; bottom: 0;
46
+ border-right: 1px solid var(--border-color);
47
+ animation: cny-drawer-in-left 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
48
+ &.size-sm { width: min(320px, 90vw); }
49
+ &.size-md { width: min(420px, 90vw); }
50
+ &.size-lg { width: min(560px, 92vw); }
51
+ &.size-xl { width: min(720px, 96vw); }
52
+ }
53
+ &.side-top {
54
+ top: 0; left: 0; right: 0;
55
+ border-bottom: 1px solid var(--border-color);
56
+ animation: cny-drawer-in-top 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
57
+ &.size-sm { height: min(40vh, 320px); }
58
+ &.size-md { height: min(50vh, 480px); }
59
+ &.size-lg { height: min(60vh, 640px); }
60
+ &.size-xl { height: min(80vh, 800px); }
61
+ }
62
+ &.side-bottom {
63
+ bottom: 0; left: 0; right: 0;
64
+ border-top: 1px solid var(--border-color);
65
+ animation: cny-drawer-in-bottom 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
66
+ &.size-sm { height: min(40vh, 320px); }
67
+ &.size-md { height: min(50vh, 480px); }
68
+ &.size-lg { height: min(60vh, 640px); }
69
+ &.size-xl { height: min(80vh, 800px); }
70
+ }
71
+ }
72
+
73
+ .cny-drawer-header {
74
+ display: flex;
75
+ align-items: flex-start;
76
+ gap: 12px;
77
+ padding: 18px 20px 14px;
78
+ border-bottom: 1px solid var(--hairline-color);
79
+ }
80
+
81
+ .cny-drawer-titles { flex: 1 1 auto; min-width: 0; }
82
+ .cny-drawer-title {
83
+ margin: 0;
84
+ font-size: 1rem;
85
+ font-weight: 650;
86
+ letter-spacing: -0.005em;
87
+ color: var(--text-primary);
88
+ }
89
+ .cny-drawer-description {
90
+ margin: 4px 0 0;
91
+ font-size: 0.875rem;
92
+ line-height: 1.55;
93
+ color: var(--text-secondary);
94
+ }
95
+
96
+ .cny-drawer-close {
97
+ flex: none;
98
+ display: inline-flex;
99
+ align-items: center;
100
+ justify-content: center;
101
+ width: 28px;
102
+ height: 28px;
103
+ background: transparent;
104
+ border: 0;
105
+ color: var(--text-muted);
106
+ cursor: pointer;
107
+ border-radius: var(--radius-xs);
108
+ transition: color 120ms ease, background-color 120ms ease;
109
+
110
+ &:hover { color: var(--text-primary); background: var(--bg-surface-low); }
111
+ &:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
112
+ }
113
+
114
+ .cny-drawer-body {
115
+ flex: 1 1 auto;
116
+ overflow-y: auto;
117
+ padding: 18px 20px;
118
+ color: var(--text-secondary);
119
+ }
120
+
121
+ .cny-drawer-footer {
122
+ display: flex;
123
+ align-items: center;
124
+ justify-content: flex-end;
125
+ gap: 8px;
126
+ padding: 14px 20px;
127
+ border-top: 1px solid var(--hairline-color);
128
+ }
129
+
130
+ @media (prefers-reduced-motion: reduce) {
131
+ .cny-drawer-overlay,
132
+ .cny-drawer-content { animation: none; }
133
+ }