@box/blueprint-web 12.78.6 → 12.78.7
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.
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { PointerChevronUp, PointerChevronDown } from '@box/blueprint-web-assets/icons/Fill';
|
|
3
|
+
import { ChevronUp, ChevronDown } from '@box/blueprint-web-assets/icons/Medium';
|
|
3
4
|
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
4
5
|
import clsx from 'clsx';
|
|
5
|
-
import { forwardRef, useState, useEffect, useCallback } from 'react';
|
|
6
|
+
import { forwardRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
7
|
+
import { useBlueprintModernization } from '../blueprint-modernization-context/useBlueprintModernization.js';
|
|
6
8
|
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
7
9
|
import { Slot } from '../primitives/slot.js';
|
|
8
10
|
import { useNamedSlots } from '../utils/useNamedSlots.hook.js';
|
|
9
11
|
import styles from './collapsible-section.module.js';
|
|
10
|
-
import { useBlueprintModernization } from '../blueprint-modernization-context/useBlueprintModernization.js';
|
|
11
12
|
|
|
12
13
|
const CollapsibleSectionImpl = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
13
14
|
const {
|
|
@@ -31,6 +32,11 @@ const CollapsibleSectionImpl = /*#__PURE__*/forwardRef((props, forwardedRef) =>
|
|
|
31
32
|
setCollapsibleSectionOpen(isOpen);
|
|
32
33
|
onOpenChange?.(isOpen);
|
|
33
34
|
}, [onOpenChange]);
|
|
35
|
+
const icon = useMemo(() => ({
|
|
36
|
+
up: enableModernizedComponents ? ChevronUp : PointerChevronUp,
|
|
37
|
+
down: enableModernizedComponents ? ChevronDown : PointerChevronDown,
|
|
38
|
+
size: enableModernizedComponents ? 'large' : 'x-small'
|
|
39
|
+
}), [enableModernizedComponents]);
|
|
34
40
|
return jsxs(Collapsible.Root, {
|
|
35
41
|
...rest,
|
|
36
42
|
ref: forwardedRef,
|
|
@@ -46,8 +52,8 @@ const CollapsibleSectionImpl = /*#__PURE__*/forwardRef((props, forwardedRef) =>
|
|
|
46
52
|
children: [headerSlot?.props.children, jsx(IconButton, {
|
|
47
53
|
"aria-label": collapsibleSectionOpen ? closeSectionButtonAriaLabel : openSectionButtonAriaLabel,
|
|
48
54
|
className: styles.collapsibleSectionHeaderArrow,
|
|
49
|
-
icon: collapsibleSectionOpen ?
|
|
50
|
-
size:
|
|
55
|
+
icon: collapsibleSectionOpen ? icon.up : icon.down,
|
|
56
|
+
size: icon.size,
|
|
51
57
|
type: "button"
|
|
52
58
|
})]
|
|
53
59
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"collapsibleSection":"bp_collapsible_section_module_collapsibleSection--
|
|
2
|
+
var styles = {"collapsibleSection":"bp_collapsible_section_module_collapsibleSection--35a18","collapsibleSectionHeader":"bp_collapsible_section_module_collapsibleSectionHeader--35a18","collapsibleSectionHeaderArrow":"bp_collapsible_section_module_collapsibleSectionHeaderArrow--35a18","collapsibleSectionContent":"bp_collapsible_section_module_collapsibleSectionContent--35a18","slideDown":"bp_collapsible_section_module_slideDown--35a18","slideUp":"bp_collapsible_section_module_slideUp--35a18","collapsibleSectionBody":"bp_collapsible_section_module_collapsibleSectionBody--35a18"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
package/dist/lib-esm/index.css
CHANGED
|
@@ -2051,36 +2051,40 @@
|
|
|
2051
2051
|
height:var(--icon-button-size-x-small);
|
|
2052
2052
|
width:var(--icon-button-size-x-small);
|
|
2053
2053
|
}
|
|
2054
|
-
.bp_collapsible_section_module_collapsibleSection--
|
|
2054
|
+
.bp_collapsible_section_module_collapsibleSection--35a18[data-modern=false]{
|
|
2055
|
+
--collapsible-section-header-padding:var(--space-5);
|
|
2056
|
+
--collapsible-section-body-padding:var(--space-5);
|
|
2055
2057
|
--collapsible-section-padding:var(--space-5);
|
|
2056
2058
|
--collapsible-section-border-radius:var(--radius-3);
|
|
2057
2059
|
--collapsible-section-outline-border-radius:var(--radius-2);
|
|
2058
|
-
--collapsible-section-background-color:var(--surface-surface);
|
|
2059
2060
|
--collapsible-section-border:var(--border-1) solid var(--border-collapsible-border);
|
|
2060
2061
|
--collapsible-section-outline-width:var(--border-2);
|
|
2061
2062
|
--collapsible-section-outline-offset:var(--space-05);
|
|
2062
2063
|
--collapsible-section-header-focus-color:var(--outline-focus-on-light);
|
|
2063
2064
|
--collapsible-section-header-background-color:var(--surface-surface);
|
|
2064
2065
|
--collapsible-section-content-background-color:var(--surface-surface);
|
|
2066
|
+
--collapsible-section-header-expanded-border-bottom:var(--border-1) solid var(--border-collapsible-border);
|
|
2065
2067
|
}
|
|
2066
2068
|
|
|
2067
|
-
.bp_collapsible_section_module_collapsibleSection--
|
|
2069
|
+
.bp_collapsible_section_module_collapsibleSection--35a18[data-modern=true]{
|
|
2070
|
+
--collapsible-section-header-padding:var(--bp-space-050) var(--bp-space-020);
|
|
2071
|
+
--collapsible-section-body-padding:var(--bp-space-040) var(--bp-space-050);
|
|
2068
2072
|
--collapsible-section-padding:var(--bp-space-050);
|
|
2069
2073
|
--collapsible-section-border-radius:var(--bp-radius-10);
|
|
2070
2074
|
--collapsible-section-outline-border-radius:var(--bp-radius-03);
|
|
2071
|
-
--collapsible-section-background-color:var(--bp-surface-surface);
|
|
2072
2075
|
--collapsible-section-border:var(--bp-border-01) solid var(--bp-border-collapsible-section-border);
|
|
2073
2076
|
--collapsible-section-outline-width:var(--bp-border-02);
|
|
2074
2077
|
--collapsible-section-outline-offset:var(--bp-space-005);
|
|
2075
2078
|
--collapsible-section-header-focus-color:var(--bp-outline-focus-on-light);
|
|
2076
|
-
--collapsible-section-header-background-color:var(--bp-surface-surface);
|
|
2077
|
-
--collapsible-section-content-background-color:var(--bp-surface-surface);
|
|
2079
|
+
--collapsible-section-header-background-color:var(--bp-surface-collapsible-section-surface);
|
|
2080
|
+
--collapsible-section-content-background-color:var(--bp-surface-collapsible-section-surface);
|
|
2081
|
+
--collapsible-section-header-expanded-border-bottom:none;
|
|
2078
2082
|
}
|
|
2079
2083
|
|
|
2080
|
-
.bp_collapsible_section_module_collapsibleSection--
|
|
2084
|
+
.bp_collapsible_section_module_collapsibleSection--35a18{
|
|
2081
2085
|
width:100%;
|
|
2082
2086
|
}
|
|
2083
|
-
.bp_collapsible_section_module_collapsibleSectionHeader--
|
|
2087
|
+
.bp_collapsible_section_module_collapsibleSectionHeader--35a18{
|
|
2084
2088
|
align-items:center;
|
|
2085
2089
|
background:var(--collapsible-section-header-background-color);
|
|
2086
2090
|
border:var(--collapsible-section-border);
|
|
@@ -2097,7 +2101,7 @@
|
|
|
2097
2101
|
user-select:none;
|
|
2098
2102
|
width:100%;
|
|
2099
2103
|
}
|
|
2100
|
-
.bp_collapsible_section_module_collapsibleSectionHeader--
|
|
2104
|
+
.bp_collapsible_section_module_collapsibleSectionHeader--35a18:focus::before{
|
|
2101
2105
|
border:var(--collapsible-section-outline-width) solid var(--collapsible-section-header-focus-color);
|
|
2102
2106
|
border-radius:var(--collapsible-section-outline-border-radius);
|
|
2103
2107
|
bottom:var(--collapsible-section-outline-offset);
|
|
@@ -2107,27 +2111,29 @@
|
|
|
2107
2111
|
right:var(--collapsible-section-outline-offset);
|
|
2108
2112
|
top:var(--collapsible-section-outline-offset);
|
|
2109
2113
|
}
|
|
2110
|
-
.bp_collapsible_section_module_collapsibleSectionHeader--
|
|
2114
|
+
.bp_collapsible_section_module_collapsibleSectionHeader--35a18[aria-expanded=true],.bp_collapsible_section_module_collapsibleSectionHeader--35a18[aria-expanded=true]::before{
|
|
2115
|
+
border-bottom:var(--collapsible-section-header-expanded-border-bottom);
|
|
2111
2116
|
border-end-end-radius:0;
|
|
2112
2117
|
border-end-start-radius:0;
|
|
2118
|
+
padding-block:var(--collapsible-section-header-padding);
|
|
2113
2119
|
}
|
|
2114
|
-
.bp_collapsible_section_module_collapsibleSectionHeaderArrow--
|
|
2120
|
+
.bp_collapsible_section_module_collapsibleSectionHeaderArrow--35a18{
|
|
2115
2121
|
display:block;
|
|
2116
2122
|
margin-inline-start:var(--collapsible-section-padding);
|
|
2117
2123
|
}
|
|
2118
|
-
.bp_collapsible_section_module_collapsibleSectionHeaderArrow--
|
|
2124
|
+
.bp_collapsible_section_module_collapsibleSectionHeaderArrow--35a18 > svg{
|
|
2119
2125
|
vertical-align:middle;
|
|
2120
2126
|
}
|
|
2121
|
-
.bp_collapsible_section_module_collapsibleSectionContent--
|
|
2127
|
+
.bp_collapsible_section_module_collapsibleSectionContent--35a18{
|
|
2122
2128
|
overflow:hidden;
|
|
2123
2129
|
}
|
|
2124
|
-
.bp_collapsible_section_module_collapsibleSectionContent--
|
|
2125
|
-
animation:bp_collapsible_section_module_slideDown--
|
|
2130
|
+
.bp_collapsible_section_module_collapsibleSectionContent--35a18[data-state=open]{
|
|
2131
|
+
animation:bp_collapsible_section_module_slideDown--35a18 .25s ease-out;
|
|
2126
2132
|
}
|
|
2127
|
-
.bp_collapsible_section_module_collapsibleSectionContent--
|
|
2128
|
-
animation:bp_collapsible_section_module_slideUp--
|
|
2133
|
+
.bp_collapsible_section_module_collapsibleSectionContent--35a18[data-state=closed]{
|
|
2134
|
+
animation:bp_collapsible_section_module_slideUp--35a18 .25s ease-out;
|
|
2129
2135
|
}
|
|
2130
|
-
.bp_collapsible_section_module_collapsibleSectionBody--
|
|
2136
|
+
.bp_collapsible_section_module_collapsibleSectionBody--35a18{
|
|
2131
2137
|
align-items:center;
|
|
2132
2138
|
background:var(--collapsible-section-content-background-color);
|
|
2133
2139
|
border:var(--collapsible-section-border);
|
|
@@ -2136,11 +2142,11 @@
|
|
|
2136
2142
|
border-top:none;
|
|
2137
2143
|
display:flex;
|
|
2138
2144
|
justify-content:space-between;
|
|
2139
|
-
padding-block:var(--collapsible-section-padding);
|
|
2145
|
+
padding-block:var(--collapsible-section-body-padding);
|
|
2140
2146
|
padding-inline:var(--collapsible-section-padding);
|
|
2141
2147
|
}
|
|
2142
2148
|
|
|
2143
|
-
@keyframes bp_collapsible_section_module_slideDown--
|
|
2149
|
+
@keyframes bp_collapsible_section_module_slideDown--35a18{
|
|
2144
2150
|
from{
|
|
2145
2151
|
height:0;
|
|
2146
2152
|
}
|
|
@@ -2148,7 +2154,7 @@
|
|
|
2148
2154
|
height:var(--radix-collapsible-content-height);
|
|
2149
2155
|
}
|
|
2150
2156
|
}
|
|
2151
|
-
@keyframes bp_collapsible_section_module_slideUp--
|
|
2157
|
+
@keyframes bp_collapsible_section_module_slideUp--35a18{
|
|
2152
2158
|
from{
|
|
2153
2159
|
height:var(--radix-collapsible-content-height);
|
|
2154
2160
|
}
|