@tangible/ui 0.0.18 → 0.0.19
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 +31 -1
- package/package.json +3 -1
- package/styles/components/_bundle.scss +98 -71
- package/styles/components/accordion.scss +289 -0
- package/styles/components/avatar.scss +346 -0
- package/styles/components/button.scss +468 -0
- package/styles/components/card.scss +261 -0
- package/styles/components/checkbox.scss +184 -0
- package/styles/components/chip-group.scss +49 -0
- package/styles/components/chip.scss +472 -0
- package/styles/components/combobox.scss +378 -0
- package/styles/components/content-indicator.scss +114 -0
- package/styles/components/dropdown.scss +179 -0
- package/styles/components/field.scss +120 -0
- package/styles/components/icon-button.scss +311 -0
- package/styles/components/icon.scss +42 -0
- package/styles/components/modal.scss +312 -0
- package/styles/components/move-handle.scss +383 -0
- package/styles/components/multi-select.scss +449 -0
- package/styles/components/notice.scss +430 -0
- package/styles/components/overlap-stack.scss +81 -0
- package/styles/components/pager.scss +83 -0
- package/styles/components/popover.scss +70 -0
- package/styles/components/progress.scss +391 -0
- package/styles/components/radio.scss +259 -0
- package/styles/components/rating.scss +142 -0
- package/styles/components/segmented-control.scss +285 -0
- package/styles/components/select.scss +386 -0
- package/styles/components/sidebar.scss +240 -0
- package/styles/components/step-indicator.scss +118 -0
- package/styles/components/step-list.scss +130 -0
- package/styles/components/switch.scss +229 -0
- package/styles/components/table.scss +139 -0
- package/styles/components/tabs.scss +297 -0
- package/styles/components/text-input.scss +142 -0
- package/styles/components/textarea.scss +35 -0
- package/styles/components/toolbar.scss +62 -0
- package/styles/components/tooltip.scss +102 -0
- package/styles/core.css +1 -0
- package/styles/core.scss +12 -0
- package/styles/core.unlayered.css +1 -0
- package/styles/index.scss +29 -4
- package/tui-manifest.json +2 -2
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Some components require additional packages. Install only what you use:
|
|
|
27
27
|
|
|
28
28
|
| Package | Required by | Size |
|
|
29
29
|
|---------|-------------|------|
|
|
30
|
-
| `@floating-ui/react` | Select, MultiSelect, Combobox, Dropdown, Tooltip | ~90 KB |
|
|
30
|
+
| `@floating-ui/react` | Select, MultiSelect, Combobox, Dropdown, Tooltip, Popover | ~90 KB |
|
|
31
31
|
| `@tanstack/react-table` | DataTable | ~50 KB |
|
|
32
32
|
|
|
33
33
|
```bash
|
|
@@ -42,6 +42,8 @@ Components without these dependencies (Button, Card, Accordion, Modal, Tabs, etc
|
|
|
42
42
|
|
|
43
43
|
### Import styles
|
|
44
44
|
|
|
45
|
+
The prebuilt stylesheet ships every component:
|
|
46
|
+
|
|
45
47
|
```tsx
|
|
46
48
|
import '@tangible/ui/styles';
|
|
47
49
|
```
|
|
@@ -52,6 +54,34 @@ For WordPress plugin contexts where CSS layers can lose to unlayered theme style
|
|
|
52
54
|
import '@tangible/ui/styles/unlayered';
|
|
53
55
|
```
|
|
54
56
|
|
|
57
|
+
Prebuilt core-only builds (tokens, resets, utilities, icon — no components)
|
|
58
|
+
are available as `@tangible/ui/styles/core` and
|
|
59
|
+
`@tangible/ui/styles/core.unlayered`.
|
|
60
|
+
|
|
61
|
+
#### Compiling a subset
|
|
62
|
+
|
|
63
|
+
If your build compiles Sass, you can ship only the components you use —
|
|
64
|
+
a typical five-component subset weighs ~63 KB instead of the full ~200 KB:
|
|
65
|
+
|
|
66
|
+
```scss
|
|
67
|
+
// tui-subset.scss
|
|
68
|
+
@use "@tangible/ui/styles/index" with (
|
|
69
|
+
$components: (button, checkbox, radio, notice, modal),
|
|
70
|
+
$layers: false // flat output for WordPress-style unlayered hosts
|
|
71
|
+
);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Notes:
|
|
75
|
+
|
|
76
|
+
- Component keys are the kebab-case component names (`button`, `text-input`,
|
|
77
|
+
`icon-button`, `chip-group`, …).
|
|
78
|
+
- Core tokens, resets, utilities, and icon styles always emit.
|
|
79
|
+
- The shared input-core styles are pulled in automatically when any of
|
|
80
|
+
`field`, `text-input`, `textarea`, or `pager` is requested (or request
|
|
81
|
+
them directly with `input`).
|
|
82
|
+
- Omit `$layers: false` to keep the cascade-layer organisation
|
|
83
|
+
(`resets`, `components`, `utilities`).
|
|
84
|
+
|
|
55
85
|
### Set up the interface wrapper
|
|
56
86
|
|
|
57
87
|
All components require the `.tui-interface` wrapper to access design tokens:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangible/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Tangible Design System",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./components/index.js",
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
"./styles/unlayered": "./styles/all.unlayered.css",
|
|
18
18
|
"./styles/all.unlayered.css": "./styles/all.unlayered.css",
|
|
19
19
|
"./styles/expanded.unlayered": "./styles/all.expanded.unlayered.css",
|
|
20
|
+
"./styles/core": "./styles/core.css",
|
|
21
|
+
"./styles/core.unlayered": "./styles/core.unlayered.css",
|
|
20
22
|
"./styles/scss": "./styles/index.scss",
|
|
21
23
|
"./styles/*": "./styles/*",
|
|
22
24
|
"./utils/focus-trap": {
|
|
@@ -1,75 +1,102 @@
|
|
|
1
|
-
@use "
|
|
2
|
-
|
|
3
|
-
@use "
|
|
4
|
-
@use "
|
|
5
|
-
@use "
|
|
6
|
-
@use "
|
|
7
|
-
@use "
|
|
8
|
-
@use "
|
|
9
|
-
@use "
|
|
10
|
-
@use "
|
|
11
|
-
@use "
|
|
12
|
-
@use "
|
|
13
|
-
@use "
|
|
1
|
+
@use "sass:list";
|
|
2
|
+
|
|
3
|
+
@use "./accordion" as accordion;
|
|
4
|
+
@use "./avatar" as avatar;
|
|
5
|
+
@use "./button" as button;
|
|
6
|
+
@use "./card" as card;
|
|
7
|
+
@use "./checkbox" as checkbox;
|
|
8
|
+
@use "./chip" as chip;
|
|
9
|
+
@use "./chip-group" as chipgroup;
|
|
10
|
+
@use "./combobox" as combobox;
|
|
11
|
+
@use "./content-indicator" as contentindicator;
|
|
12
|
+
@use "./dropdown" as dropdown;
|
|
13
|
+
@use "./field" as field;
|
|
14
|
+
@use "./multi-select" as multiselect;
|
|
15
|
+
@use "./select" as select;
|
|
14
16
|
@use "./input/index" as input;
|
|
15
|
-
@use "
|
|
16
|
-
@use "
|
|
17
|
-
@use "
|
|
18
|
-
@use "
|
|
19
|
-
@use "
|
|
20
|
-
@use "
|
|
21
|
-
@use "
|
|
22
|
-
@use "
|
|
23
|
-
@use "
|
|
24
|
-
@use "
|
|
25
|
-
@use "
|
|
26
|
-
@use "
|
|
27
|
-
@use "
|
|
28
|
-
@use "
|
|
29
|
-
@use "
|
|
30
|
-
@use "
|
|
31
|
-
@use "
|
|
32
|
-
@use "
|
|
33
|
-
@use "
|
|
34
|
-
@use "
|
|
35
|
-
@use "
|
|
36
|
-
@use "
|
|
17
|
+
@use "./icon" as icon;
|
|
18
|
+
@use "./icon-button" as iconbutton;
|
|
19
|
+
@use "./modal" as modal;
|
|
20
|
+
@use "./move-handle" as movehandle;
|
|
21
|
+
@use "./notice" as notice;
|
|
22
|
+
@use "./overlap-stack" as overlapstack;
|
|
23
|
+
@use "./pager" as pager;
|
|
24
|
+
@use "./popover" as popover;
|
|
25
|
+
@use "./radio" as radio;
|
|
26
|
+
@use "./rating" as rating;
|
|
27
|
+
@use "./progress" as progress;
|
|
28
|
+
@use "./segmented-control" as segmentedcontrol;
|
|
29
|
+
@use "./switch" as switch;
|
|
30
|
+
@use "./sidebar" as sidebar;
|
|
31
|
+
@use "./step-indicator" as stepindicator;
|
|
32
|
+
@use "./step-list" as steplist;
|
|
33
|
+
@use "./table" as table;
|
|
34
|
+
@use "./tabs" as tabs;
|
|
35
|
+
@use "./textarea" as textarea;
|
|
36
|
+
@use "./text-input" as textinput;
|
|
37
|
+
@use "./toolbar" as toolbar;
|
|
38
|
+
@use "./tooltip" as tooltip;
|
|
39
|
+
|
|
40
|
+
// Whether $only requests $key. Null means "everything" (the full bundle).
|
|
41
|
+
@function -wants($only, $key) {
|
|
42
|
+
@return $only == null or list.index($only, $key) != null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Components whose runtime markup renders the shared input-core classes
|
|
46
|
+
// (.tui-input etc.) — requesting any of them pulls the input core in.
|
|
47
|
+
$-input-dependents: (input, field, text-input, textarea, pager);
|
|
48
|
+
|
|
49
|
+
@function -needs-input($only) {
|
|
50
|
+
@if $only == null {
|
|
51
|
+
@return true;
|
|
52
|
+
}
|
|
53
|
+
@each $key in $-input-dependents {
|
|
54
|
+
@if list.index($only, $key) != null {
|
|
55
|
+
@return true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
@return false;
|
|
59
|
+
}
|
|
37
60
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
@include
|
|
44
|
-
@include
|
|
45
|
-
@include
|
|
46
|
-
@include
|
|
47
|
-
@include
|
|
48
|
-
@include
|
|
49
|
-
@include
|
|
50
|
-
@include
|
|
51
|
-
@include
|
|
52
|
-
@include
|
|
61
|
+
// Emit component styles. $only is a list of kebab-case component keys
|
|
62
|
+
// (matching src/components dir names: button, text-input, icon-button, …)
|
|
63
|
+
// or null for the full catalogue. Icon styles always emit — most components
|
|
64
|
+
// render icons internally and the partial is a few hundred bytes.
|
|
65
|
+
@mixin bundle($only: null) {
|
|
66
|
+
@if -wants($only, accordion) { @include accordion.styles(); }
|
|
67
|
+
@if -wants($only, avatar) { @include avatar.styles(); }
|
|
68
|
+
@if -wants($only, button) { @include button.styles(); }
|
|
69
|
+
@if -wants($only, card) { @include card.styles(); }
|
|
70
|
+
@if -wants($only, checkbox) { @include checkbox.styles(); }
|
|
71
|
+
@if -wants($only, chip) { @include chip.styles(); }
|
|
72
|
+
@if -wants($only, chip-group) { @include chipgroup.styles(); }
|
|
73
|
+
@if -wants($only, combobox) { @include combobox.styles(); }
|
|
74
|
+
@if -wants($only, content-indicator) { @include contentindicator.styles(); }
|
|
75
|
+
@if -wants($only, dropdown) { @include dropdown.styles(); }
|
|
76
|
+
@if -wants($only, field) { @include field.styles(); }
|
|
77
|
+
@if -wants($only, multi-select) { @include multiselect.styles(); }
|
|
78
|
+
@if -wants($only, select) { @include select.styles(); }
|
|
79
|
+
@if -needs-input($only) { @include input.styles(); }
|
|
53
80
|
@include icon.styles();
|
|
54
|
-
@include iconbutton.styles();
|
|
55
|
-
@include modal.styles();
|
|
56
|
-
@include movehandle.styles();
|
|
57
|
-
@include notice.styles();
|
|
58
|
-
@include overlapstack.styles();
|
|
59
|
-
@include pager.styles();
|
|
60
|
-
@include popover.styles();
|
|
61
|
-
@include radio.styles();
|
|
62
|
-
@include rating.styles();
|
|
63
|
-
@include progress.styles();
|
|
64
|
-
@include segmentedcontrol.styles();
|
|
65
|
-
@include switch.styles();
|
|
66
|
-
@include sidebar.styles();
|
|
67
|
-
@include stepindicator.styles();
|
|
68
|
-
@include steplist.styles();
|
|
69
|
-
@include table.styles();
|
|
70
|
-
@include tabs.styles();
|
|
71
|
-
@include textarea.styles();
|
|
72
|
-
@include textinput.styles();
|
|
73
|
-
@include toolbar.styles();
|
|
74
|
-
@include tooltip.styles();
|
|
81
|
+
@if -wants($only, icon-button) { @include iconbutton.styles(); }
|
|
82
|
+
@if -wants($only, modal) { @include modal.styles(); }
|
|
83
|
+
@if -wants($only, move-handle) { @include movehandle.styles(); }
|
|
84
|
+
@if -wants($only, notice) { @include notice.styles(); }
|
|
85
|
+
@if -wants($only, overlap-stack) { @include overlapstack.styles(); }
|
|
86
|
+
@if -wants($only, pager) { @include pager.styles(); }
|
|
87
|
+
@if -wants($only, popover) { @include popover.styles(); }
|
|
88
|
+
@if -wants($only, radio) { @include radio.styles(); }
|
|
89
|
+
@if -wants($only, rating) { @include rating.styles(); }
|
|
90
|
+
@if -wants($only, progress) { @include progress.styles(); }
|
|
91
|
+
@if -wants($only, segmented-control) { @include segmentedcontrol.styles(); }
|
|
92
|
+
@if -wants($only, switch) { @include switch.styles(); }
|
|
93
|
+
@if -wants($only, sidebar) { @include sidebar.styles(); }
|
|
94
|
+
@if -wants($only, step-indicator) { @include stepindicator.styles(); }
|
|
95
|
+
@if -wants($only, step-list) { @include steplist.styles(); }
|
|
96
|
+
@if -wants($only, table) { @include table.styles(); }
|
|
97
|
+
@if -wants($only, tabs) { @include tabs.styles(); }
|
|
98
|
+
@if -wants($only, textarea) { @include textarea.styles(); }
|
|
99
|
+
@if -wants($only, text-input) { @include textinput.styles(); }
|
|
100
|
+
@if -wants($only, toolbar) { @include toolbar.styles(); }
|
|
101
|
+
@if -wants($only, tooltip) { @include tooltip.styles(); }
|
|
75
102
|
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-accordion-bg
|
|
5
|
+
--tui-accordion-bg-open
|
|
6
|
+
--tui-accordion-border
|
|
7
|
+
--tui-accordion-divider
|
|
8
|
+
--tui-accordion-radius
|
|
9
|
+
--tui-accordion-padding
|
|
10
|
+
--tui-accordion-trigger-padding
|
|
11
|
+
--tui-accordion-trigger-bg
|
|
12
|
+
--tui-accordion-trigger-hover
|
|
13
|
+
--tui-accordion-panel-padding
|
|
14
|
+
--tui-accordion-panel-bg
|
|
15
|
+
--tui-accordion-panel-spacing
|
|
16
|
+
--tui-accordion-gap
|
|
17
|
+
--tui-accordion-indicator
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
@mixin styles() {
|
|
21
|
+
// ==========================================================================
|
|
22
|
+
// Accordion Component
|
|
23
|
+
// ==========================================================================
|
|
24
|
+
//
|
|
25
|
+
// Component API tokens (never defined here, only read via fallback):
|
|
26
|
+
// --tui-accordion-bg Item background
|
|
27
|
+
// --tui-accordion-bg-open Background when expanded
|
|
28
|
+
// --tui-accordion-border Border color
|
|
29
|
+
// --tui-accordion-divider Border between trigger and panel when open
|
|
30
|
+
// --tui-accordion-radius Border radius
|
|
31
|
+
// --tui-accordion-padding Shared padding (trigger + panel fallback)
|
|
32
|
+
// --tui-accordion-trigger-padding Trigger padding (falls back to -padding)
|
|
33
|
+
// --tui-accordion-trigger-bg Trigger background
|
|
34
|
+
// --tui-accordion-trigger-hover Trigger hover background
|
|
35
|
+
// --tui-accordion-panel-padding Panel inline padding (falls back to -padding)
|
|
36
|
+
// --tui-accordion-panel-bg Panel background
|
|
37
|
+
// --tui-accordion-panel-spacing Panel block spacing — top padding + bottom pseudo
|
|
38
|
+
// (falls back to -panel-padding; set to 0 to remove)
|
|
39
|
+
// --tui-accordion-gap Gap between items
|
|
40
|
+
// --tui-accordion-indicator Chevron color
|
|
41
|
+
//
|
|
42
|
+
// To override from consuming code:
|
|
43
|
+
// .my-context .tui-accordion__item { --tui-accordion-bg: hotpink; }
|
|
44
|
+
//
|
|
45
|
+
// ==========================================================================
|
|
46
|
+
|
|
47
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: var(--#{sys.$prefix}accordion-gap, var(--#{sys.$prefix}spacing-sm));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Item
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__item {
|
|
58
|
+
// Internal tokens — read component API with fallback to primitives
|
|
59
|
+
--_bg: var(--#{sys.$prefix}accordion-bg, var(--#{sys.$prefix}color-bg-surface));
|
|
60
|
+
--_bg-open: var(--#{sys.$prefix}accordion-bg-open, var(--#{sys.$prefix}color-bg-surface));
|
|
61
|
+
--_border: var(--#{sys.$prefix}accordion-border, var(--#{sys.$prefix}color-border));
|
|
62
|
+
--_divider: var(--#{sys.$prefix}accordion-divider, var(--_border));
|
|
63
|
+
--_radius: var(--#{sys.$prefix}accordion-radius, var(--#{sys.$prefix}radius-md));
|
|
64
|
+
--_padding: var(--#{sys.$prefix}accordion-padding, var(--#{sys.$prefix}spacing-md));
|
|
65
|
+
--_trigger-padding: var(--#{sys.$prefix}accordion-trigger-padding, var(--_padding));
|
|
66
|
+
--_trigger-bg: var(--#{sys.$prefix}accordion-trigger-bg, transparent);
|
|
67
|
+
--_trigger-hover: var(--#{sys.$prefix}accordion-trigger-hover, var(--#{sys.$prefix}color-bg-muted));
|
|
68
|
+
--_panel-padding: var(--#{sys.$prefix}accordion-panel-padding, var(--_padding));
|
|
69
|
+
--_panel-bg: var(--#{sys.$prefix}accordion-panel-bg, transparent);
|
|
70
|
+
--_indicator: var(--#{sys.$prefix}accordion-indicator, currentColor);
|
|
71
|
+
|
|
72
|
+
background-color: var(--_bg);
|
|
73
|
+
border: var(--#{sys.$prefix}border-width) solid var(--_border);
|
|
74
|
+
border-radius: var(--_radius);
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
|
|
77
|
+
&[data-state="open"] {
|
|
78
|
+
--_bg: var(--_bg-open);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&[data-disabled] {
|
|
82
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// Heading (wrapper when headingLevel is set)
|
|
88
|
+
// Full specificity required — h2–h6 are themed elements that host styles
|
|
89
|
+
// (e.g. WordPress) will target with higher specificity than :where().
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
.#{sys.$prefix}interface .#{sys.$prefix}accordion__heading {
|
|
93
|
+
margin: 0;
|
|
94
|
+
font: inherit;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Trigger
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
|
|
101
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__trigger {
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
gap: var(--#{sys.$prefix}spacing-sm);
|
|
106
|
+
width: 100%;
|
|
107
|
+
padding: var(--_trigger-padding);
|
|
108
|
+
border: none;
|
|
109
|
+
border-radius: var(--_radius);
|
|
110
|
+
background: var(--_trigger-bg);
|
|
111
|
+
color: inherit;
|
|
112
|
+
font: inherit;
|
|
113
|
+
font-weight: var(--#{sys.$prefix}font-weight-medium, 500);
|
|
114
|
+
text-align: start;
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
transition-property: background-color;
|
|
117
|
+
transition-duration: var(--#{sys.$prefix}motion-duration);
|
|
118
|
+
transition-timing-function: var(--#{sys.$prefix}motion-timing);
|
|
119
|
+
|
|
120
|
+
&:hover:not(:disabled) {
|
|
121
|
+
background-color: var(--_trigger-hover);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&:focus-visible {
|
|
125
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
126
|
+
outline-offset: calc(var(--#{sys.$prefix}focus-ring-offset) * -1 - 1px);
|
|
127
|
+
z-index: 1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&:disabled {
|
|
131
|
+
cursor: not-allowed;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
// Trigger Content
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__trigger-content {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: var(--#{sys.$prefix}spacing-sm);
|
|
143
|
+
flex: 1;
|
|
144
|
+
min-width: 0; // Allow text truncation if needed
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
// Indicator (Chevron)
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
|
|
151
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__indicator {
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
color: var(--_indicator);
|
|
154
|
+
transition-property: transform;
|
|
155
|
+
transition-duration: var(--#{sys.$prefix}motion-duration);
|
|
156
|
+
transition-timing-function: var(--#{sys.$prefix}motion-timing);
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__trigger[data-state="open"] > .#{sys.$prefix}accordion__indicator {
|
|
161
|
+
transform: rotate(180deg);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Panel
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__panel {
|
|
169
|
+
display: grid;
|
|
170
|
+
grid-template-rows: 0fr;
|
|
171
|
+
transition-property: grid-template-rows;
|
|
172
|
+
transition-duration: var(--#{sys.$prefix}motion-duration);
|
|
173
|
+
transition-timing-function: var(--#{sys.$prefix}motion-timing);
|
|
174
|
+
|
|
175
|
+
&[data-state="open"] {
|
|
176
|
+
grid-template-rows: 1fr;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
// Panel Content
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
|
|
184
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__panel-content {
|
|
185
|
+
// Internal: block spacing for panel content. Defaults to panel padding.
|
|
186
|
+
// Set --tui-accordion-panel-spacing to 0 to remove top/bottom breathing room
|
|
187
|
+
// (e.g. when panel contains its own padded container).
|
|
188
|
+
--_panel-spacing: var(--#{sys.$prefix}accordion-panel-spacing, var(--_panel-padding));
|
|
189
|
+
|
|
190
|
+
// min-height: 0 is required for grid-template-rows animation to work
|
|
191
|
+
min-height: 0;
|
|
192
|
+
overflow: hidden;
|
|
193
|
+
padding-inline: var(--_panel-padding);
|
|
194
|
+
background: var(--_panel-bg);
|
|
195
|
+
// No padding-block — it would prevent full collapse during the
|
|
196
|
+
// grid-template-rows animation. Both top and bottom spacing use
|
|
197
|
+
// pseudo-elements that participate in the grid row and shrink to 0.
|
|
198
|
+
|
|
199
|
+
> *:first-child {
|
|
200
|
+
margin-block-start: 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
> *:last-child {
|
|
204
|
+
margin-block-end: 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Top spacing via pseudo-element so it collapses with grid animation
|
|
208
|
+
&::before {
|
|
209
|
+
content: "";
|
|
210
|
+
display: block;
|
|
211
|
+
height: var(--_panel-spacing);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Bottom spacing via pseudo-element (same reason)
|
|
215
|
+
&::after {
|
|
216
|
+
content: "";
|
|
217
|
+
display: block;
|
|
218
|
+
height: var(--_panel-spacing);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Fade animations for panel content (separate selectors to avoid nesting issues)
|
|
223
|
+
// Using keyframes with fill-mode so default opacity stays 1 (safe fallback)
|
|
224
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__panel[data-state="closed"] > .#{sys.$prefix}accordion__panel-content {
|
|
225
|
+
animation: #{sys.$prefix}fadeToTransparent var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing) forwards;
|
|
226
|
+
// Note: padding is kept during close animation to prevent content jump.
|
|
227
|
+
// The grid-template-rows animation handles the height collapse smoothly.
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__panel[data-state="open"] > .#{sys.$prefix}accordion__panel-content {
|
|
231
|
+
animation: #{sys.$prefix}fadeFromTransparent var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing) forwards;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ---------------------------------------------------------------------------
|
|
235
|
+
// Divider (between trigger and panel when open)
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
|
|
238
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__item[data-state="open"] > .#{sys.$prefix}accordion__panel {
|
|
239
|
+
border-block-start: var(--#{sys.$prefix}border-width) solid var(--_divider);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// ---------------------------------------------------------------------------
|
|
243
|
+
// Variant: flush (shared borders, no gap, no per-item radius)
|
|
244
|
+
// ---------------------------------------------------------------------------
|
|
245
|
+
|
|
246
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion.is-variant-flush {
|
|
247
|
+
gap: 0;
|
|
248
|
+
border: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}accordion-border, var(--#{sys.$prefix}color-border));
|
|
249
|
+
border-radius: var(--#{sys.$prefix}accordion-radius, var(--#{sys.$prefix}radius-md));
|
|
250
|
+
overflow: hidden;
|
|
251
|
+
|
|
252
|
+
.#{sys.$prefix}accordion__item {
|
|
253
|
+
border: none;
|
|
254
|
+
border-radius: 0;
|
|
255
|
+
|
|
256
|
+
// Shared border between items
|
|
257
|
+
& + .#{sys.$prefix}accordion__item {
|
|
258
|
+
border-block-start: var(--#{sys.$prefix}border-width) solid var(--_border);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.#{sys.$prefix}accordion__trigger {
|
|
263
|
+
border-radius: 0;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// ---------------------------------------------------------------------------
|
|
268
|
+
// Forced colors (Windows High Contrast Mode)
|
|
269
|
+
// ---------------------------------------------------------------------------
|
|
270
|
+
|
|
271
|
+
@media (forced-colors: active) {
|
|
272
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__item {
|
|
273
|
+
border-color: CanvasText;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}accordion__trigger {
|
|
277
|
+
&:hover:not(:disabled) {
|
|
278
|
+
background-color: Highlight;
|
|
279
|
+
color: HighlightText;
|
|
280
|
+
forced-color-adjust: none;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
&:focus-visible {
|
|
284
|
+
outline-color: Highlight;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
}
|