@redvars/peacock 3.15.0 → 3.17.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.
Files changed (157) hide show
  1. package/dist/assets/styles.css +1 -1
  2. package/dist/assets/styles.css.map +1 -1
  3. package/dist/assets/theme.js +19 -19
  4. package/dist/assets/tokens.css +1 -1
  5. package/dist/assets/tokens.css.map +1 -1
  6. package/dist/card-content.js +8 -7
  7. package/dist/card-content.js.map +1 -1
  8. package/dist/card.js +142 -98
  9. package/dist/card.js.map +1 -1
  10. package/dist/{chart-bar-D5dGFJfK.js → cartesian-chart-DgE4USyC.js} +529 -312
  11. package/dist/cartesian-chart-DgE4USyC.js.map +1 -0
  12. package/dist/chart-area.js +78 -0
  13. package/dist/chart-area.js.map +1 -0
  14. package/dist/chart-bar.js +283 -213
  15. package/dist/chart-bar.js.map +1 -1
  16. package/dist/{transform-DSwFSqzD.js → chart-base-C2qRMF48.js} +771 -102
  17. package/dist/chart-base-C2qRMF48.js.map +1 -0
  18. package/dist/chart-doughnut.js +55 -287
  19. package/dist/chart-doughnut.js.map +1 -1
  20. package/dist/chart-line.js +626 -0
  21. package/dist/chart-line.js.map +1 -0
  22. package/dist/chart-pie.js +637 -195
  23. package/dist/chart-pie.js.map +1 -1
  24. package/dist/code-editor.js +704 -131
  25. package/dist/code-editor.js.map +1 -1
  26. package/dist/code-group.js +188 -0
  27. package/dist/code-group.js.map +1 -0
  28. package/dist/code-highlighter.js +895 -257
  29. package/dist/code-highlighter.js.map +1 -1
  30. package/dist/custom-elements-jsdocs.json +2278 -677
  31. package/dist/custom-elements.json +13962 -3690
  32. package/dist/image.js +5 -1
  33. package/dist/image.js.map +1 -1
  34. package/dist/index.js +8 -7
  35. package/dist/index.js.map +1 -1
  36. package/dist/loader-full.js +1 -1
  37. package/dist/loader.js +9 -3
  38. package/dist/loader.js.map +1 -1
  39. package/dist/{is-dark-mode-DOcaw4Yq.js → observe-theme-change-DCifz1uv.js} +2 -6
  40. package/dist/observe-theme-change-DCifz1uv.js.map +1 -0
  41. package/dist/pagination.js +408 -110
  42. package/dist/pagination.js.map +1 -1
  43. package/dist/path-CJ0Arqcy.js +166 -0
  44. package/dist/path-CJ0Arqcy.js.map +1 -0
  45. package/dist/snackbar.js +89 -34
  46. package/dist/snackbar.js.map +1 -1
  47. package/dist/src/__internal/chart/cartesian-chart.d.ts +80 -0
  48. package/dist/src/__internal/chart/chart-base.d.ts +113 -0
  49. package/dist/src/__internal/chart/paths.d.ts +5 -0
  50. package/dist/src/__internal/chart/types.d.ts +42 -0
  51. package/dist/src/card/card-content.d.ts +2 -3
  52. package/dist/src/card/card.d.ts +31 -17
  53. package/dist/src/chart-area/chart-area.d.ts +54 -0
  54. package/dist/src/chart-area/index.d.ts +1 -0
  55. package/dist/src/chart-bar/chart-bar.d.ts +44 -33
  56. package/dist/src/chart-bar/index.d.ts +0 -1
  57. package/dist/src/chart-doughnut/chart-doughnut.d.ts +33 -39
  58. package/dist/src/chart-line/chart-line.d.ts +69 -0
  59. package/dist/src/chart-line/index.d.ts +1 -0
  60. package/dist/src/chart-pie/chart-pie.d.ts +63 -28
  61. package/dist/src/code-editor/code-editor.d.ts +52 -13
  62. package/dist/src/code-editor/editor-theme.d.ts +60 -0
  63. package/dist/src/code-highlighter/code-group.d.ts +52 -0
  64. package/dist/src/code-highlighter/code-highlighter.d.ts +122 -15
  65. package/dist/src/code-highlighter/index.d.ts +1 -0
  66. package/dist/src/code-highlighter/line-ranges.d.ts +24 -0
  67. package/dist/src/code-highlighter/local.d.ts +4 -1
  68. package/dist/src/code-highlighter/token-colors.d.ts +8 -0
  69. package/dist/src/index.d.ts +4 -2
  70. package/dist/src/pagination/page-items.d.ts +14 -0
  71. package/dist/src/pagination/pagination.d.ts +46 -7
  72. package/dist/src/snackbar/snackbar.d.ts +13 -1
  73. package/dist/src/table/table.d.ts +125 -27
  74. package/dist/src/toolbar/toolbar.d.ts +56 -51
  75. package/dist/table.js +1007 -338
  76. package/dist/table.js.map +1 -1
  77. package/dist/test/chart.test.d.ts +1 -0
  78. package/dist/test/code-highlighter.test.d.ts +1 -0
  79. package/dist/test/pagination.test.d.ts +1 -0
  80. package/dist/test/table.test.d.ts +1 -0
  81. package/dist/token-colors-0TFHWbcq.js +81 -0
  82. package/dist/token-colors-0TFHWbcq.js.map +1 -0
  83. package/dist/toolbar.js +195 -184
  84. package/dist/toolbar.js.map +1 -1
  85. package/dist/tsconfig.tsbuildinfo +1 -1
  86. package/package.json +1 -2
  87. package/readme.md +7 -6
  88. package/scss/_code-block.scss +139 -0
  89. package/scss/tokens.css +24 -0
  90. package/src/__internal/chart/cartesian-chart.ts +404 -0
  91. package/src/__internal/chart/chart-base.scss +252 -0
  92. package/src/__internal/chart/chart-base.ts +474 -0
  93. package/src/__internal/chart/paths.ts +28 -0
  94. package/src/__internal/chart/types.ts +49 -0
  95. package/src/card/card-content.ts +12 -9
  96. package/src/card/card.scss +66 -54
  97. package/src/card/card.ts +109 -73
  98. package/src/chart-area/chart-area.ts +82 -0
  99. package/src/chart-area/index.ts +1 -0
  100. package/src/chart-bar/chart-bar.ts +336 -250
  101. package/src/chart-bar/index.ts +0 -1
  102. package/src/chart-doughnut/chart-doughnut.ts +62 -262
  103. package/src/chart-doughnut/demo/index.html +14 -22
  104. package/src/chart-line/chart-line.scss +25 -0
  105. package/src/chart-line/chart-line.ts +346 -0
  106. package/src/chart-line/index.ts +1 -0
  107. package/src/chart-pie/chart-pie.scss +35 -16
  108. package/src/chart-pie/chart-pie.ts +282 -188
  109. package/src/chart-pie/demo/index.html +13 -21
  110. package/src/code-editor/code-editor.scss +132 -36
  111. package/src/code-editor/code-editor.ts +308 -88
  112. package/src/code-editor/demo/index.html +39 -12
  113. package/src/code-editor/editor-theme.ts +213 -0
  114. package/src/code-highlighter/code-group.scss +34 -0
  115. package/src/code-highlighter/code-group.ts +173 -0
  116. package/src/code-highlighter/code-highlighter.scss +226 -111
  117. package/src/code-highlighter/code-highlighter.ts +554 -199
  118. package/src/code-highlighter/demo/index.html +68 -4
  119. package/src/code-highlighter/index.ts +1 -0
  120. package/src/code-highlighter/line-ranges.ts +81 -0
  121. package/src/code-highlighter/local.ts +9 -3
  122. package/src/code-highlighter/token-colors.ts +42 -0
  123. package/src/index.ts +4 -2
  124. package/src/loader.ts +8 -2
  125. package/src/pagination/page-items.ts +50 -0
  126. package/src/pagination/pagination.scss +159 -44
  127. package/src/pagination/pagination.ts +275 -74
  128. package/src/snackbar/demo/index.html +39 -4
  129. package/src/snackbar/snackbar.scss +27 -10
  130. package/src/snackbar/snackbar.ts +80 -37
  131. package/src/table/table.scss +337 -109
  132. package/src/table/table.ts +812 -272
  133. package/src/toolbar/toolbar-colors.scss +6 -7
  134. package/src/toolbar/toolbar.scss +35 -106
  135. package/src/toolbar/toolbar.ts +180 -80
  136. package/dist/array-D5vjT2Xm.js +0 -14
  137. package/dist/array-D5vjT2Xm.js.map +0 -1
  138. package/dist/chart-bar-D5dGFJfK.js.map +0 -1
  139. package/dist/chart-stacked-bar.js +0 -403
  140. package/dist/chart-stacked-bar.js.map +0 -1
  141. package/dist/copy-to-clipboard-upGx-Ueo.js +0 -39
  142. package/dist/copy-to-clipboard-upGx-Ueo.js.map +0 -1
  143. package/dist/is-dark-mode-DOcaw4Yq.js.map +0 -1
  144. package/dist/pie-Dz0IDiPt.js +0 -537
  145. package/dist/pie-Dz0IDiPt.js.map +0 -1
  146. package/dist/pierre-dark-DFWl0m-C.js +0 -4
  147. package/dist/pierre-dark-DFWl0m-C.js.map +0 -1
  148. package/dist/pierre-light-BEkAPImt.js +0 -4
  149. package/dist/pierre-light-BEkAPImt.js.map +0 -1
  150. package/dist/src/chart-bar/chart-stacked-bar.d.ts +0 -78
  151. package/dist/src/code-highlighter/constants.d.ts +0 -1
  152. package/dist/transform-DSwFSqzD.js.map +0 -1
  153. package/src/chart-bar/chart-bar.scss +0 -58
  154. package/src/chart-bar/chart-stacked-bar.ts +0 -398
  155. package/src/chart-doughnut/chart-donut.scss +0 -37
  156. package/src/code-highlighter/constants.ts +0 -117
  157. /package/dist/test/{chart-bar.test.d.ts → card.test.d.ts} +0 -0
@@ -1,137 +1,252 @@
1
1
  @use '../../scss/mixin';
2
+ @use '../../scss/code-block';
2
3
 
3
4
  @include mixin.base-styles;
5
+ @include code-block.chrome(code-highlighter);
4
6
 
5
7
  :host {
6
8
  display: block;
7
- height: 100%;
8
- --code-highlighter-background: var(--color-surface-container);
9
+ min-width: 0;
9
10
  }
10
11
 
11
- .code-loader {
12
- height: 10rem;
13
- background-color: var(--code-highlighter-background);
14
- color: var(--color-on-surface);
12
+ :host([hidden]) {
13
+ display: none;
14
+ }
15
+
16
+ .code-block:has(.content:focus-visible) {
17
+ outline: 3px solid var(--color-primary);
18
+ outline-offset: 2px;
19
+ }
20
+
21
+ // ── Content ────────────────────────────────────────────────────────────────
22
+
23
+ .content {
24
+ flex: 1 1 auto;
25
+ min-height: 0;
26
+ max-height: var(--code-highlighter-max-height, none);
27
+ margin: 0;
28
+ padding-block: var(--_pad-block);
29
+ padding-inline: 0;
30
+ overflow: auto;
31
+ outline: none;
32
+ white-space: pre;
33
+ text-align: start;
34
+ scrollbar-width: thin;
35
+ scrollbar-color: var(--color-outline-variant) transparent;
36
+
37
+ @include mixin.get-typography(code-medium);
38
+ }
39
+
40
+ .has-header .content {
41
+ padding-block-start: var(--_pad-near);
42
+ }
43
+
44
+ .has-footer .content {
45
+ padding-block-end: var(--_pad-near);
46
+ }
47
+
48
+ .code {
49
+ display: grid;
50
+ grid-template-columns: minmax(0, 1fr);
51
+ align-content: start;
52
+ min-width: max-content;
53
+ min-height: 1lh;
54
+ font: inherit;
55
+ }
56
+
57
+ .line {
58
+ position: relative;
59
+ display: block;
60
+ min-height: 1lh;
61
+ padding-inline: var(--_pad-inline);
62
+ }
63
+
64
+ .line-numbers {
65
+ .code {
66
+ grid-template-columns: auto minmax(0, 1fr);
67
+ column-gap: var(--spacing-200);
68
+ }
69
+
70
+ .line {
71
+ display: grid;
72
+ grid-column: 1 / -1;
73
+ grid-template-columns: subgrid;
74
+ }
75
+
76
+ .line::before {
77
+ min-width: 1.5rem;
78
+ color: var(--color-on-surface-variant);
79
+ text-align: end;
80
+ font-variant-numeric: tabular-nums;
81
+ counter-increment: line;
82
+ content: counter(line);
83
+ content: counter(line) / '';
84
+ user-select: none;
85
+ pointer-events: none;
86
+ }
87
+ }
88
+
89
+ .wrap {
90
+ .code {
91
+ min-width: 0;
92
+ }
93
+
94
+ .line-content {
95
+ white-space: pre-wrap;
96
+ overflow-wrap: anywhere;
97
+ }
98
+ }
99
+
100
+ // ── Line variants ──────────────────────────────────────────────────────────
101
+
102
+ .line[data-variant='highlighted'] {
103
+ background: color-mix(in srgb, var(--color-primary) 12%, transparent);
104
+ }
105
+
106
+ .line[data-variant='added'] {
107
+ background: color-mix(in srgb, var(--color-success) 12%, transparent);
108
+ }
109
+
110
+ .line[data-variant='removed'] {
111
+ background: color-mix(in srgb, var(--color-error) 12%, transparent);
112
+ }
113
+
114
+ .line[data-variant='added']::after,
115
+ .line[data-variant='removed']::after {
116
+ position: absolute;
117
+ inset-block-start: 0;
118
+ inset-inline-start: var(--spacing-050);
119
+ user-select: none;
120
+ pointer-events: none;
121
+ }
122
+
123
+ .line[data-variant='added']::after {
124
+ color: var(--color-success);
125
+ content: '+';
126
+ }
127
+
128
+ .line[data-variant='removed']::after {
129
+ color: var(--color-error);
130
+ content: '\2212';
131
+ }
132
+
133
+ // ── Tokens ─────────────────────────────────────────────────────────────────
134
+
135
+ .italic {
136
+ font-style: italic;
137
+ }
138
+
139
+ .bold {
140
+ font-weight: 700;
141
+ }
142
+
143
+ .underline {
144
+ text-decoration: underline;
145
+ }
146
+
147
+ .strikethrough {
148
+ text-decoration: line-through;
149
+ }
150
+
151
+ // ── Collapsible ────────────────────────────────────────────────────────────
152
+
153
+ .collapsed .content {
154
+ max-height: var(--code-highlighter-collapsed-height, 16rem);
155
+ overflow-y: hidden;
156
+ }
157
+
158
+ .overflowing .content {
159
+ mask-image: linear-gradient(
160
+ to bottom,
161
+ black calc(100% - var(--spacing-600)),
162
+ transparent
163
+ );
164
+ }
165
+
166
+ .footer {
15
167
  display: flex;
16
- align-items: center;
17
168
  justify-content: center;
18
- gap: var(--spacing-050);
169
+ padding: 0 var(--_pad-inline) var(--spacing-100);
19
170
  }
20
171
 
21
- .code-highlighter {
22
- height: 100%;
23
- display: flex;
24
- flex-direction: column;
25
- color: var(--color-on-surface);
26
-
27
- .header {
28
- padding: var(--spacing-100);
29
- padding-inline-start: var(--spacing-200);
30
- display: flex;
31
- align-items: center;
32
- justify-content: space-between;
33
- background-color: var(--code-highlighter-background);
34
- border-bottom: 1px solid var(--color-outline-variant);
35
-
36
- @include mixin.get-typography(body-medium);
37
-
38
- .copy-button {
39
- --button-container-shape: var(--shape-corner-full);
40
- }
172
+ .expand-icon {
173
+ transition: transform var(--duration-short4) var(--easing-standard);
174
+
175
+ &.flipped {
176
+ transform: rotate(180deg);
177
+ }
178
+ }
179
+
180
+ @media (prefers-reduced-motion: reduce) {
181
+ .expand-icon {
182
+ transition: none;
183
+ }
184
+ }
185
+
186
+ // ── Size ───────────────────────────────────────────────────────────────────
187
+
188
+ :host([size='sm']) {
189
+ .content {
190
+ @include mixin.get-typography(code-small);
41
191
  }
42
192
 
43
- .scroll-wrapper {
44
- flex: 1;
45
- overflow-y: auto;
46
- background-color: var(--code-highlighter-background);
47
-
48
- .highlighter {
49
- margin: 0;
50
- position: relative;
51
-
52
- .shiki {
53
- margin: 0;
54
- padding: var(--spacing-200);
55
- width: fit-content;
56
- background: transparent !important;
57
- font-family: var(--font-family-monospace);
58
- --shiki-dark-bg: transparent !important;
59
-
60
- code {
61
- @include mixin.get-typography(code-medium);
62
- }
63
- }
64
- }
193
+ .line[data-variant='added']::after,
194
+ .line[data-variant='removed']::after {
195
+ inset-inline-start: var(--spacing-025);
196
+ }
197
+ }
198
+
199
+ // ── Error variant ──────────────────────────────────────────────────────────
200
+
201
+ :host([variant='error']) {
202
+ .code-block {
203
+ --_background: var(
204
+ --code-highlighter-background,
205
+ color-mix(
206
+ in srgb,
207
+ var(--color-error-container) 40%,
208
+ var(--color-surface-container-low)
209
+ )
210
+ );
211
+ --_border-color: var(
212
+ --code-highlighter-border-color,
213
+ color-mix(in srgb, var(--color-error) 40%, transparent)
214
+ );
215
+ --_foreground: var(--code-highlighter-foreground, var(--color-error));
65
216
  }
66
217
 
67
- &.line-numbers {
68
- .highlighter .shiki {
69
- /* Reset counter for line numbers */
70
- counter-reset: line-counter;
71
- }
72
-
73
- .line {
74
- position: relative;
75
- padding-left: 2rem; /* Space for numbers */
76
- }
77
-
78
- .line::before {
79
- counter-increment: line-counter;
80
- content: counter(line-counter);
81
-
82
- /* Positioning */
83
- position: absolute;
84
- left: -1.5rem; /* Pull back into padding */
85
- width: 2.5rem; /* Fixed width for alignment */
86
- text-align: right;
87
- padding-right: 1rem;
88
-
89
- /* Visuals */
90
- color: var(--num-color);
91
- opacity: 0.6;
92
- font-variant-numeric: tabular-nums; /* Ensures numbers align vertically */
93
- user-select: none; /* Don't copy line numbers when selecting text */
94
- pointer-events: none;
95
- }
218
+ .title,
219
+ ::slotted([slot='icon']) {
220
+ color: var(--color-error);
96
221
  }
97
222
  }
98
223
 
99
- :host-context([data-theme='dark']) {
100
- .highlighter {
101
- .shiki,
102
- .shiki span {
103
- color: var(--shiki-dark) !important;
104
- background-color: var(--shiki-dark-bg) !important;
105
- }
224
+ // ── Grouped ────────────────────────────────────────────────────────────────
225
+
226
+ // Inside wc-code-group the group draws the frame, so the block sits flush and
227
+ // its focus ring is drawn inside the frame instead of being clipped by it.
228
+ :host([grouped]) .code-block {
229
+ border: 0;
230
+ border-radius: 0;
231
+
232
+ &:has(.content:focus-visible) {
233
+ outline-offset: -3px;
106
234
  }
107
235
  }
108
236
 
237
+ // ── Inline ─────────────────────────────────────────────────────────────────
238
+
109
239
  :host([inline]) {
110
240
  display: inline;
111
- height: initial;
112
-
113
- .code-highlighter {
114
- display: inline;
115
- cursor: pointer;
116
-
117
- .scroll-wrapper {
118
- display: inline;
119
-
120
- .line-numbers-wrapper {
121
- padding: 0 var(--spacing-100);
122
- font-size: inherit;
123
- display: inline;
124
- word-wrap: break-word;
125
-
126
- .highlighter {
127
- display: inline;
128
- }
129
- }
130
- }
131
- }
241
+ }
132
242
 
133
- .code-loader {
134
- height: initial;
135
- display: inline;
136
- }
243
+ .inline {
244
+ padding: 0 var(--spacing-050);
245
+ font-family: var(--font-family-monospace);
246
+ font-size: 0.875em;
247
+ color: var(--code-highlighter-foreground, var(--color-on-surface));
248
+ background: var(--color-surface-container-high);
249
+ border-radius: var(--shape-corner-extra-small);
250
+ box-decoration-break: clone;
251
+ -webkit-box-decoration-break: clone;
137
252
  }