@assistanz/carbideui 1.3.0 → 1.4.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 +58 -8
- package/fesm2022/assistanz-carbideui.mjs +2742 -223
- package/fesm2022/assistanz-carbideui.mjs.map +1 -1
- package/index.d.ts +996 -71
- package/package.json +1 -1
- package/styles/_content-switcher.scss +50 -0
- package/styles/_theme-button-align.scss +22 -0
- package/styles/_theme-corners.scss +117 -0
- package/styles/carbon.scss +5 -0
package/package.json
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// ngcc-content-switcher wraps every Carbon button in an <ngcc-content-switcher-option>, so Carbon's
|
|
2
|
+
// sibling-based rules (:first-child, :last-child, :first-of-type, `+`) see each button as both the
|
|
3
|
+
// first and the last. These rules re-create the intended look from the option's position instead.
|
|
4
|
+
// Selectors out-rank Carbon's (0,4,0) first/last-child rules without !important.
|
|
5
|
+
.cds--content-switcher:not(.cds--content-switcher--icon-only) {
|
|
6
|
+
ngcc-content-switcher-option > .cds--content-switcher-btn {
|
|
7
|
+
border-radius: 0;
|
|
8
|
+
box-shadow: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
ngcc-content-switcher-option:first-child > .cds--content-switcher-btn {
|
|
12
|
+
border-end-start-radius: 0.25rem;
|
|
13
|
+
border-start-start-radius: 0.25rem;
|
|
14
|
+
box-shadow: inset 0.0625rem 0 0 0 var(--cds-border-inverse);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ngcc-content-switcher-option:last-child > .cds--content-switcher-btn {
|
|
18
|
+
border-end-end-radius: 0.25rem;
|
|
19
|
+
border-start-end-radius: 0.25rem;
|
|
20
|
+
box-shadow: inset -0.0625rem 0 0 0 var(--cds-border-inverse);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ngcc-content-switcher-option:only-child > .cds--content-switcher-btn {
|
|
24
|
+
box-shadow:
|
|
25
|
+
inset 0.0625rem 0 0 0 var(--cds-border-inverse),
|
|
26
|
+
inset -0.0625rem 0 0 0 var(--cds-border-inverse);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Divider between neighbours; Carbon hides it on every button here.
|
|
30
|
+
ngcc-content-switcher-option:not(:first-child) > .cds--content-switcher-btn::before {
|
|
31
|
+
background-color: var(--cds-border-subtle);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// No divider next to the hovered, focused or selected button.
|
|
35
|
+
ngcc-content-switcher-option:not(:first-child) > .cds--content-switcher-btn:hover::before,
|
|
36
|
+
ngcc-content-switcher-option:not(:first-child) > .cds--content-switcher-btn:focus::before,
|
|
37
|
+
ngcc-content-switcher-option:not(:first-child)
|
|
38
|
+
> .cds--content-switcher-btn.cds--content-switcher--selected::before,
|
|
39
|
+
ngcc-content-switcher-option:hover
|
|
40
|
+
+ ngcc-content-switcher-option
|
|
41
|
+
> .cds--content-switcher-btn::before,
|
|
42
|
+
ngcc-content-switcher-option:focus-within
|
|
43
|
+
+ ngcc-content-switcher-option
|
|
44
|
+
> .cds--content-switcher-btn::before,
|
|
45
|
+
ngcc-content-switcher-option:has(> .cds--content-switcher--selected)
|
|
46
|
+
+ ngcc-content-switcher-option
|
|
47
|
+
> .cds--content-switcher-btn::before {
|
|
48
|
+
background-color: transparent;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Button label alignment — controlled by `data-button-align="left|centered"` on <html>.
|
|
2
|
+
//
|
|
3
|
+
// Left is Carbon's default (label at the start, icon at the end) and emits no rules.
|
|
4
|
+
// Centered groups label + icon in the middle with an 8px gap and balanced padding.
|
|
5
|
+
// Icon-only buttons are untouched. Independent of Corner style.
|
|
6
|
+
|
|
7
|
+
:root[data-button-align='centered'] {
|
|
8
|
+
.cds--btn:not(.cds--btn--icon-only) {
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
gap: 0.5rem;
|
|
12
|
+
text-align: center;
|
|
13
|
+
// Carbon reserves extra end padding for an absolutely positioned icon; balance it.
|
|
14
|
+
padding-inline: calc(var(--cds-layout-density-padding-inline-local) - 0.0625rem);
|
|
15
|
+
|
|
16
|
+
.cds--btn__icon {
|
|
17
|
+
position: static;
|
|
18
|
+
inset: auto;
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Corner style — controlled by `data-corner-style="square|rounded|curved"` on <html>.
|
|
2
|
+
//
|
|
3
|
+
// Everything flows through tokens + global overrides; feature components are not edited.
|
|
4
|
+
// Controls → --ngcc-radius-button / --ngcc-radius-input
|
|
5
|
+
// Containers → --ngcc-radius-container
|
|
6
|
+
//
|
|
7
|
+
// Square is Carbon's own look: no overrides are emitted for it, only tokens (all 0),
|
|
8
|
+
// so the default rendering is byte-for-byte what Carbon ships.
|
|
9
|
+
|
|
10
|
+
:root {
|
|
11
|
+
--ngcc-radius-button: 0;
|
|
12
|
+
--ngcc-radius-input: 0;
|
|
13
|
+
--ngcc-radius-container: 0;
|
|
14
|
+
--ngcc-radius-checkbox: 2px; // Carbon default, never exceeds 2px
|
|
15
|
+
|
|
16
|
+
// Tokens that existing components already read (ngcc-button / ngcc-input).
|
|
17
|
+
--sb--button-corner-radius: var(--ngcc-radius-button);
|
|
18
|
+
--sb--input-corner-radius: var(--ngcc-radius-input);
|
|
19
|
+
--ngcc--input-corner-radius: var(--ngcc-radius-input);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:root[data-corner-style='square'] {
|
|
23
|
+
--ngcc-radius-button: 0;
|
|
24
|
+
--ngcc-radius-input: 0;
|
|
25
|
+
--ngcc-radius-container: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:root[data-corner-style='rounded'] {
|
|
29
|
+
--ngcc-radius-button: 4px;
|
|
30
|
+
--ngcc-radius-input: 4px;
|
|
31
|
+
--ngcc-radius-container: 8px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:root[data-corner-style='curved'] {
|
|
35
|
+
--ngcc-radius-button: 999px;
|
|
36
|
+
--ngcc-radius-input: 24px;
|
|
37
|
+
--ngcc-radius-container: 16px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Selector is (0,3,0) once nested, which beats Carbon (0,1,0) and the
|
|
41
|
+
// encapsulated component rules (0,2,0) without !important.
|
|
42
|
+
:root:is([data-corner-style='rounded'], [data-corner-style='curved']) {
|
|
43
|
+
// ── Controls ───────────────────────────────────────────────────────────────
|
|
44
|
+
.cds--btn {
|
|
45
|
+
border-radius: var(--ngcc-radius-button);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Full-bleed footer buttons stay square; the modal container clips them.
|
|
49
|
+
.cds--modal-footer .cds--btn {
|
|
50
|
+
border-radius: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.cds--text-input,
|
|
54
|
+
.cds--text-area,
|
|
55
|
+
.cds--number input[type='number'],
|
|
56
|
+
.cds--date-picker__input,
|
|
57
|
+
.cds--search-input,
|
|
58
|
+
.cds--select-input,
|
|
59
|
+
.cds--list-box {
|
|
60
|
+
border-radius: var(--ngcc-radius-input);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// The inner field owns the focus ring, so it must follow the trigger's radius.
|
|
64
|
+
.cds--list-box__field {
|
|
65
|
+
border-radius: inherit;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// An open dropdown joins its menu: square the bottom of the trigger.
|
|
69
|
+
.cds--list-box--expanded {
|
|
70
|
+
border-end-start-radius: 0;
|
|
71
|
+
border-end-end-radius: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Segmented control behaves like a button group.
|
|
75
|
+
.cds--content-switcher {
|
|
76
|
+
border-radius: var(--ngcc-radius-button);
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ── Containers ─────────────────────────────────────────────────────────────
|
|
81
|
+
.cds--modal-container,
|
|
82
|
+
.cds--tile,
|
|
83
|
+
.cds--toast-notification,
|
|
84
|
+
.cds--popover-content,
|
|
85
|
+
.cds--overflow-menu-options {
|
|
86
|
+
border-radius: var(--ngcc-radius-container);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.cds--modal-container {
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Docked to the right edge: only the free (inline-start) corners are rounded.
|
|
94
|
+
.cds--header-panel {
|
|
95
|
+
border-start-start-radius: var(--ngcc-radius-container);
|
|
96
|
+
border-end-start-radius: var(--ngcc-radius-container);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Dropdown list hangs from its trigger: top corners stay square.
|
|
100
|
+
.cds--list-box__menu {
|
|
101
|
+
border-end-start-radius: var(--ngcc-radius-container);
|
|
102
|
+
border-end-end-radius: var(--ngcc-radius-container);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Header menu panel hangs from the header: bottom corners only.
|
|
106
|
+
.cds--header__submenu .cds--header__menu {
|
|
107
|
+
border-end-start-radius: var(--ngcc-radius-container);
|
|
108
|
+
border-end-end-radius: var(--ngcc-radius-container);
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// `clip` (not `hidden`) so sticky headers keep working.
|
|
113
|
+
.cds--data-table-container {
|
|
114
|
+
border-radius: var(--ngcc-radius-container);
|
|
115
|
+
overflow: clip;
|
|
116
|
+
}
|
|
117
|
+
}
|
package/styles/carbon.scss
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
@use '@carbon/styles';
|
|
2
2
|
|
|
3
|
+
// Order matters: these set the token defaults, then custom-themes (which still
|
|
4
|
+
// supports the legacy data-carbon-theme="rounded|curved|centered" values) comes last.
|
|
5
|
+
@use 'theme-corners';
|
|
6
|
+
@use 'theme-button-align';
|
|
7
|
+
@use 'content-switcher';
|
|
3
8
|
@use 'custom-themes' as *;
|