@sproutsocial/seeds-react-tree 0.4.1 → 0.4.4
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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +33 -0
- package/dist/esm/index.js +106 -281
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +106 -281
- package/dist/index.js.map +1 -1
- package/dist/tree.css +318 -0
- package/package.json +12 -11
- package/src/Common/TreeSearchableSelectBase.tsx +36 -119
- package/src/Tree.stories.tsx +26 -0
- package/src/Tree.tsx +4 -4
- package/src/TreeCombobox.tsx +17 -71
- package/src/TreeItem.tsx +33 -22
- package/src/__tests__/Tree.test.tsx +61 -0
- package/src/cn.ts +28 -0
- package/src/tree.css +318 -0
- package/src/TreeStyles.tsx +0 -115
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
yarn run v1.22.22
|
|
2
|
-
$ tsup --dts
|
|
2
|
+
$ tsup --dts && cp src/tree.css dist/tree.css
|
|
3
3
|
[34mCLI[39m Building entry: src/index.ts
|
|
4
4
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
5
5
|
[34mCLI[39m tsup v8.5.0
|
|
@@ -8,14 +8,14 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m35.40 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m75.93 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 22ms
|
|
14
|
+
[32mESM[39m [1mdist/esm/index.js [22m[32m32.47 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/esm/index.js.map [22m[32m75.54 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 22ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 1071ms
|
|
19
19
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m7.37 KB[39m
|
|
20
20
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m7.37 KB[39m
|
|
21
|
-
Done in
|
|
21
|
+
Done in 1.96s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-tree
|
|
2
2
|
|
|
3
|
+
## 0.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [917a951]
|
|
8
|
+
- Updated dependencies [6611f6a]
|
|
9
|
+
- @sproutsocial/seeds-react-icon@2.4.3
|
|
10
|
+
- @sproutsocial/seeds-react-system-props@3.1.2
|
|
11
|
+
- @sproutsocial/seeds-react-popout@2.5.12
|
|
12
|
+
|
|
13
|
+
## 0.4.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 5172641: Migrate `seeds-react-tree` from styled-components to Tailwind/CSS classes.
|
|
18
|
+
`Tree`, `TreeItem`, `TreeCombobox`, and the Single/Multi `TreeSearchableSelect`
|
|
19
|
+
components now render Seeds CSS classes (`tree.css`, scoped under
|
|
20
|
+
`@layer components`) instead of styled-components. Public component APIs,
|
|
21
|
+
props, DOM structure, and accessibility behavior are unchanged. Consumers pick
|
|
22
|
+
up the styles via `@sproutsocial/racine/css/components` (or the package's
|
|
23
|
+
`./dist/tree.css` export); nothing needs to change in app code.
|
|
24
|
+
|
|
25
|
+
## 0.4.2
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [85f9728]
|
|
30
|
+
- Updated dependencies [fa7d859]
|
|
31
|
+
- @sproutsocial/seeds-react-theme@4.2.0
|
|
32
|
+
- @sproutsocial/seeds-react-icon@2.4.2
|
|
33
|
+
- @sproutsocial/seeds-react-mixins@4.3.9
|
|
34
|
+
- @sproutsocial/seeds-react-popout@2.5.11
|
|
35
|
+
|
|
3
36
|
## 0.4.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -98,105 +98,23 @@ function useTreeState(opts) {
|
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
// src/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
gap: ${({ theme }) => theme.space[300]};
|
|
116
|
-
padding: ${({ theme }) => theme.space[300]};
|
|
117
|
-
padding-left: ${({ theme, $level }) => `calc(${theme.space[300]} + ${$level - 1} * ${theme.space[400]})`};
|
|
118
|
-
border-radius: ${({ theme }) => theme.radii[400]};
|
|
119
|
-
cursor: pointer;
|
|
120
|
-
user-select: none;
|
|
121
|
-
background: transparent;
|
|
122
|
-
transition: background-color ${({ theme }) => theme.duration.fast}
|
|
123
|
-
${({ theme }) => theme.easing.ease_in};
|
|
124
|
-
|
|
125
|
-
&:hover {
|
|
126
|
-
background: ${({ theme }) => theme.colors.listItem.background.hover};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
${({ $selected, theme }) => $selected && css`
|
|
130
|
-
background: ${theme.colors.listItem.background.hover};
|
|
131
|
-
font-weight: ${theme.fontWeights.semibold};
|
|
132
|
-
`}
|
|
133
|
-
|
|
134
|
-
${({ $disabled }) => $disabled && css`
|
|
135
|
-
opacity: 0.4;
|
|
136
|
-
cursor: not-allowed;
|
|
137
|
-
pointer-events: none;
|
|
138
|
-
`}
|
|
139
|
-
`;
|
|
140
|
-
var TreeItemEl = styled.li`
|
|
141
|
-
list-style: none;
|
|
142
|
-
outline: none;
|
|
143
|
-
|
|
144
|
-
/*
|
|
145
|
-
* Tree rows stack tightly, so the standard outset Seeds focusRing bleeds
|
|
146
|
-
* into adjacent rows. Use an inset outline so the ring is drawn just inside
|
|
147
|
-
* the row's edge and never overlaps siblings or children.
|
|
148
|
-
*
|
|
149
|
-
* The same ring is drawn when [data-treeitem-active] is set so combobox
|
|
150
|
-
* hosts that drive the tree via aria-activedescendant (no real DOM focus)
|
|
151
|
-
* still get a visible "active" indicator on the row.
|
|
152
|
-
*/
|
|
153
|
-
&:focus-visible > ${TreeItemRow}, &[data-treeitem-active] > ${TreeItemRow} {
|
|
154
|
-
outline: 2px solid
|
|
155
|
-
${({ theme }) => theme.colors.button.primary.background.base};
|
|
156
|
-
outline-offset: -2px;
|
|
157
|
-
}
|
|
158
|
-
`;
|
|
159
|
-
var TreeItemGroup = styled.ul`
|
|
160
|
-
list-style: none;
|
|
161
|
-
margin: 0;
|
|
162
|
-
padding: 0;
|
|
163
|
-
`;
|
|
164
|
-
var TreeItemLabel = styled.span`
|
|
165
|
-
flex: 1;
|
|
166
|
-
min-width: 0;
|
|
167
|
-
overflow: hidden;
|
|
168
|
-
text-overflow: ellipsis;
|
|
169
|
-
white-space: nowrap;
|
|
170
|
-
`;
|
|
171
|
-
var TreeItemIcon = styled.span`
|
|
172
|
-
display: inline-flex;
|
|
173
|
-
align-items: center;
|
|
174
|
-
flex-shrink: 0;
|
|
175
|
-
`;
|
|
176
|
-
var TreeItemChevron = styled.button.attrs({
|
|
177
|
-
type: "button",
|
|
178
|
-
tabIndex: -1
|
|
179
|
-
})`
|
|
180
|
-
display: inline-flex;
|
|
181
|
-
align-items: center;
|
|
182
|
-
justify-content: center;
|
|
183
|
-
flex-shrink: 0;
|
|
184
|
-
width: ${({ theme }) => theme.space[500]};
|
|
185
|
-
height: ${({ theme }) => theme.space[500]};
|
|
186
|
-
padding: 0;
|
|
187
|
-
border: none;
|
|
188
|
-
background: transparent;
|
|
189
|
-
color: ${({ theme }) => theme.colors.icon.base};
|
|
190
|
-
cursor: pointer;
|
|
191
|
-
border-radius: ${({ theme }) => theme.radii[300]};
|
|
192
|
-
transition: transform ${({ theme }) => theme.duration.fast}
|
|
193
|
-
${({ theme }) => theme.easing.ease_in};
|
|
194
|
-
transform: ${({ $expanded }) => $expanded ? "rotate(0deg)" : "rotate(-90deg)"};
|
|
195
|
-
|
|
196
|
-
&:hover {
|
|
197
|
-
background: ${({ theme }) => theme.colors.listItem.background.hover};
|
|
101
|
+
// src/cn.ts
|
|
102
|
+
function cn(...inputs) {
|
|
103
|
+
const classes = [];
|
|
104
|
+
for (const input of inputs) {
|
|
105
|
+
if (!input) continue;
|
|
106
|
+
if (typeof input === "string") {
|
|
107
|
+
classes.push(input);
|
|
108
|
+
} else if (typeof input === "object") {
|
|
109
|
+
for (const [key, value] of Object.entries(input)) {
|
|
110
|
+
if (value) {
|
|
111
|
+
classes.push(key);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
198
115
|
}
|
|
199
|
-
|
|
116
|
+
return classes.join(" ");
|
|
117
|
+
}
|
|
200
118
|
|
|
201
119
|
// src/Tree.tsx
|
|
202
120
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -285,12 +203,12 @@ var Tree = React.forwardRef(function Tree2(props, forwardedRef) {
|
|
|
285
203
|
]
|
|
286
204
|
);
|
|
287
205
|
return /* @__PURE__ */ jsx(TreeContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx(TreeItemContext.Provider, { value: { level: 1 }, children: /* @__PURE__ */ jsx(
|
|
288
|
-
|
|
206
|
+
"ul",
|
|
289
207
|
{
|
|
290
208
|
ref: innerRef,
|
|
291
209
|
role: "tree",
|
|
292
210
|
id,
|
|
293
|
-
className,
|
|
211
|
+
className: cn("seeds-tree", className),
|
|
294
212
|
"aria-label": ariaLabel,
|
|
295
213
|
"aria-labelledby": ariaLabelledBy,
|
|
296
214
|
"aria-multiselectable": selectionMode === "multiple" ? true : void 0,
|
|
@@ -573,9 +491,10 @@ function TreeItem(props) {
|
|
|
573
491
|
const groupId = `${id}__group`;
|
|
574
492
|
const labelId = `${id}__label`;
|
|
575
493
|
return /* @__PURE__ */ jsxs(
|
|
576
|
-
|
|
494
|
+
"li",
|
|
577
495
|
{
|
|
578
496
|
ref: itemRef,
|
|
497
|
+
className: "seeds-tree-item",
|
|
579
498
|
id: treeItemDomId(id),
|
|
580
499
|
role: "treeitem",
|
|
581
500
|
"data-treeitem-id": id,
|
|
@@ -614,26 +533,32 @@ function TreeItem(props) {
|
|
|
614
533
|
},
|
|
615
534
|
children: [
|
|
616
535
|
/* @__PURE__ */ jsxs(
|
|
617
|
-
|
|
536
|
+
"div",
|
|
618
537
|
{
|
|
619
538
|
"data-treeitem-row": true,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
539
|
+
className: cn("seeds-tree-item-row", {
|
|
540
|
+
selected: isSelected,
|
|
541
|
+
disabled
|
|
542
|
+
}),
|
|
543
|
+
style: { "--tree-level": level },
|
|
623
544
|
children: [
|
|
624
545
|
ctx.renderSelectionIndicator && !(ctx.selectableNodes === "leaves" && hasChildren) ? ctx.renderSelectionIndicator({
|
|
625
546
|
selected: isSelected,
|
|
626
547
|
disabled,
|
|
627
548
|
selectionMode
|
|
628
549
|
}) : null,
|
|
629
|
-
icon != null ? /* @__PURE__ */ jsx2(
|
|
630
|
-
/* @__PURE__ */ jsx2(
|
|
550
|
+
icon != null ? /* @__PURE__ */ jsx2("span", { className: "seeds-tree-item-icon", "aria-hidden": true, children: icon }) : null,
|
|
551
|
+
/* @__PURE__ */ jsx2("span", { className: "seeds-tree-item-label", id: labelId, children: label }),
|
|
631
552
|
hasChildren ? /* @__PURE__ */ jsx2(
|
|
632
|
-
|
|
553
|
+
"button",
|
|
633
554
|
{
|
|
555
|
+
type: "button",
|
|
556
|
+
tabIndex: -1,
|
|
634
557
|
"data-tree-chevron": true,
|
|
635
558
|
"aria-hidden": true,
|
|
636
|
-
|
|
559
|
+
className: cn("seeds-tree-item-chevron", {
|
|
560
|
+
expanded: isExpanded
|
|
561
|
+
}),
|
|
637
562
|
onClick: handleChevronClick,
|
|
638
563
|
children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-down-outline", size: "small" })
|
|
639
564
|
}
|
|
@@ -641,7 +566,16 @@ function TreeItem(props) {
|
|
|
641
566
|
]
|
|
642
567
|
}
|
|
643
568
|
),
|
|
644
|
-
hasChildren ? /* @__PURE__ */ jsx2(
|
|
569
|
+
hasChildren ? /* @__PURE__ */ jsx2(
|
|
570
|
+
"ul",
|
|
571
|
+
{
|
|
572
|
+
className: "seeds-tree-item-group",
|
|
573
|
+
role: "group",
|
|
574
|
+
id: groupId,
|
|
575
|
+
hidden: !isExpanded,
|
|
576
|
+
children: /* @__PURE__ */ jsx2(TreeItemContext.Provider, { value: { level: level + 1 }, children })
|
|
577
|
+
}
|
|
578
|
+
) : null
|
|
645
579
|
]
|
|
646
580
|
}
|
|
647
581
|
);
|
|
@@ -650,9 +584,7 @@ TreeItem.displayName = "TreeItem";
|
|
|
650
584
|
|
|
651
585
|
// src/TreeCombobox.tsx
|
|
652
586
|
import * as React3 from "react";
|
|
653
|
-
import styled2 from "styled-components";
|
|
654
587
|
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
655
|
-
import { focusRing } from "@sproutsocial/seeds-react-mixins";
|
|
656
588
|
|
|
657
589
|
// src/Common/filterTree.ts
|
|
658
590
|
function filterTree(items, query) {
|
|
@@ -681,58 +613,6 @@ function filterTree(items, query) {
|
|
|
681
613
|
|
|
682
614
|
// src/TreeCombobox.tsx
|
|
683
615
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
684
|
-
var Root = styled2.div`
|
|
685
|
-
display: flex;
|
|
686
|
-
flex-direction: column;
|
|
687
|
-
flex: 1;
|
|
688
|
-
min-height: 0;
|
|
689
|
-
`;
|
|
690
|
-
var SearchSection = styled2.div`
|
|
691
|
-
padding: ${({ theme }) => theme.space[300]};
|
|
692
|
-
border-bottom: 1px solid ${({ theme }) => theme.colors.container.border.base};
|
|
693
|
-
flex-shrink: 0;
|
|
694
|
-
`;
|
|
695
|
-
var InputGroup = styled2.div`
|
|
696
|
-
display: flex;
|
|
697
|
-
align-items: center;
|
|
698
|
-
gap: ${({ theme }) => theme.space[200]};
|
|
699
|
-
padding: ${({ theme }) => theme.space[200]} ${({ theme }) => theme.space[300]};
|
|
700
|
-
border-radius: ${({ theme }) => theme.radii[500]};
|
|
701
|
-
border: 1px solid ${({ theme }) => theme.colors.container.border.base};
|
|
702
|
-
background: ${({ theme }) => theme.colors.container.background.base};
|
|
703
|
-
color: ${({ theme }) => theme.colors.icon.base};
|
|
704
|
-
|
|
705
|
-
&:focus-within {
|
|
706
|
-
${focusRing}
|
|
707
|
-
}
|
|
708
|
-
`;
|
|
709
|
-
var ComboboxInput = styled2.input`
|
|
710
|
-
flex: 1;
|
|
711
|
-
border: none;
|
|
712
|
-
background: transparent;
|
|
713
|
-
outline: none;
|
|
714
|
-
font-family: ${({ theme }) => theme.fontFamily};
|
|
715
|
-
font-size: ${({ theme }) => theme.typography[200].fontSize};
|
|
716
|
-
line-height: ${({ theme }) => theme.typography[200].lineHeight};
|
|
717
|
-
color: ${({ theme }) => theme.colors.text.body};
|
|
718
|
-
|
|
719
|
-
&::placeholder {
|
|
720
|
-
color: ${({ theme }) => theme.colors.text.subtext};
|
|
721
|
-
}
|
|
722
|
-
`;
|
|
723
|
-
var ListSection = styled2.div`
|
|
724
|
-
padding: ${({ theme }) => theme.space[200]};
|
|
725
|
-
overflow: auto;
|
|
726
|
-
flex: 1;
|
|
727
|
-
min-height: 0;
|
|
728
|
-
`;
|
|
729
|
-
var EmptyState = styled2.div`
|
|
730
|
-
padding: ${({ theme }) => `${theme.space[300]} ${theme.space[350]}`};
|
|
731
|
-
text-align: center;
|
|
732
|
-
color: ${({ theme }) => theme.colors.text.subtext};
|
|
733
|
-
font-size: ${({ theme }) => theme.typography[200].fontSize};
|
|
734
|
-
line-height: ${({ theme }) => theme.typography[200].lineHeight};
|
|
735
|
-
`;
|
|
736
616
|
var NAV_KEYS = /* @__PURE__ */ new Set([
|
|
737
617
|
"ArrowDown",
|
|
738
618
|
"ArrowUp",
|
|
@@ -843,12 +723,13 @@ function TreeCombobox(props) {
|
|
|
843
723
|
}
|
|
844
724
|
}, [focusedId]);
|
|
845
725
|
const showEmpty = visibleItems.length === 0;
|
|
846
|
-
return /* @__PURE__ */ jsxs2(
|
|
847
|
-
/* @__PURE__ */ jsx3(
|
|
726
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("seeds-tree-combobox", className), children: [
|
|
727
|
+
/* @__PURE__ */ jsx3("div", { className: "seeds-tree-combobox-search", children: /* @__PURE__ */ jsxs2("div", { className: "seeds-tree-combobox-input-group", children: [
|
|
848
728
|
/* @__PURE__ */ jsx3(Icon2, { name: "magnifying-glass-outline", size: "small", "aria-hidden": true }),
|
|
849
729
|
/* @__PURE__ */ jsx3(
|
|
850
|
-
|
|
730
|
+
"input",
|
|
851
731
|
{
|
|
732
|
+
className: "seeds-tree-combobox-input",
|
|
852
733
|
type: "text",
|
|
853
734
|
role: "combobox",
|
|
854
735
|
id,
|
|
@@ -866,7 +747,7 @@ function TreeCombobox(props) {
|
|
|
866
747
|
}
|
|
867
748
|
)
|
|
868
749
|
] }) }),
|
|
869
|
-
/* @__PURE__ */ jsxs2(
|
|
750
|
+
/* @__PURE__ */ jsxs2("div", { className: "seeds-tree-combobox-list", children: [
|
|
870
751
|
/* @__PURE__ */ jsx3(
|
|
871
752
|
Tree,
|
|
872
753
|
{
|
|
@@ -888,7 +769,15 @@ function TreeCombobox(props) {
|
|
|
888
769
|
children: visibleItems.map((item) => /* @__PURE__ */ jsx3(TreeNode, { item }, item.id))
|
|
889
770
|
}
|
|
890
771
|
),
|
|
891
|
-
showEmpty ? /* @__PURE__ */ jsx3(
|
|
772
|
+
showEmpty ? /* @__PURE__ */ jsx3(
|
|
773
|
+
"div",
|
|
774
|
+
{
|
|
775
|
+
className: "seeds-tree-combobox-empty",
|
|
776
|
+
role: "status",
|
|
777
|
+
"aria-live": "polite",
|
|
778
|
+
children: emptyText
|
|
779
|
+
}
|
|
780
|
+
) : null
|
|
892
781
|
] })
|
|
893
782
|
] });
|
|
894
783
|
}
|
|
@@ -910,9 +799,7 @@ import * as React5 from "react";
|
|
|
910
799
|
|
|
911
800
|
// src/Common/TreeSearchableSelectBase.tsx
|
|
912
801
|
import * as React4 from "react";
|
|
913
|
-
import styled3, { css as css2 } from "styled-components";
|
|
914
802
|
import { Icon as Icon3 } from "@sproutsocial/seeds-react-icon";
|
|
915
|
-
import { focusRing as focusRing2 } from "@sproutsocial/seeds-react-mixins";
|
|
916
803
|
import { Popout } from "@sproutsocial/seeds-react-popout/v2";
|
|
917
804
|
|
|
918
805
|
// src/Common/flattenTree.ts
|
|
@@ -930,95 +817,14 @@ function flattenTreeItems(items) {
|
|
|
930
817
|
|
|
931
818
|
// src/Common/TreeSearchableSelectBase.tsx
|
|
932
819
|
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
933
|
-
var invalidStyles = css2`
|
|
934
|
-
border-color: ${({ theme }) => theme.colors.form.border.error};
|
|
935
|
-
`;
|
|
936
|
-
var Trigger = styled3.button`
|
|
937
|
-
display: flex;
|
|
938
|
-
align-items: center;
|
|
939
|
-
justify-content: space-between;
|
|
940
|
-
gap: ${({ theme }) => theme.space[300]};
|
|
941
|
-
padding: ${({ theme }) => theme.space[200]} ${({ theme }) => theme.space[350]};
|
|
942
|
-
min-width: 160px;
|
|
943
|
-
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
944
|
-
border-radius: ${({ theme }) => theme.radii[500]};
|
|
945
|
-
border: 1px solid ${({ theme }) => theme.colors.form.border.base};
|
|
946
|
-
background: ${({ theme }) => theme.colors.form.background.base};
|
|
947
|
-
font-family: ${({ theme }) => theme.fontFamily};
|
|
948
|
-
font-size: ${({ theme }) => theme.typography[200].fontSize};
|
|
949
|
-
line-height: ${({ theme }) => theme.typography[200].lineHeight};
|
|
950
|
-
color: ${({ theme }) => theme.colors.text.body};
|
|
951
|
-
text-align: left;
|
|
952
|
-
cursor: default;
|
|
953
|
-
outline: none;
|
|
954
|
-
user-select: none;
|
|
955
|
-
transition: border-color ${({ theme }) => theme.duration.fast}
|
|
956
|
-
${({ theme }) => theme.easing.ease_in},
|
|
957
|
-
box-shadow ${({ theme }) => theme.duration.fast}
|
|
958
|
-
${({ theme }) => theme.easing.ease_in};
|
|
959
|
-
|
|
960
|
-
&:focus-visible {
|
|
961
|
-
${focusRing2}
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
&[aria-disabled="true"],
|
|
965
|
-
&:disabled {
|
|
966
|
-
opacity: 0.4;
|
|
967
|
-
cursor: not-allowed;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
${({ $isInvalid }) => $isInvalid && invalidStyles}
|
|
971
|
-
`;
|
|
972
|
-
var TriggerLabel = styled3.span`
|
|
973
|
-
flex: 1;
|
|
974
|
-
min-width: 0;
|
|
975
|
-
overflow: hidden;
|
|
976
|
-
text-overflow: ellipsis;
|
|
977
|
-
white-space: nowrap;
|
|
978
|
-
`;
|
|
979
|
-
var PlaceholderText = styled3.span`
|
|
980
|
-
color: ${({ theme }) => theme.colors.text.subtext};
|
|
981
|
-
`;
|
|
982
|
-
var Chevron = styled3.span`
|
|
983
|
-
display: inline-flex;
|
|
984
|
-
align-items: center;
|
|
985
|
-
color: ${({ theme }) => theme.colors.icon.base};
|
|
986
|
-
transition: transform ${({ theme }) => theme.duration.fast}
|
|
987
|
-
${({ theme }) => theme.easing.ease_in};
|
|
988
|
-
${({ $open }) => $open && css2`
|
|
989
|
-
transform: rotate(-180deg);
|
|
990
|
-
`}
|
|
991
|
-
`;
|
|
992
|
-
var HiddenInput = styled3.input`
|
|
993
|
-
clip-path: inset(50%);
|
|
994
|
-
overflow: hidden;
|
|
995
|
-
white-space: nowrap;
|
|
996
|
-
border: 0;
|
|
997
|
-
padding: 0;
|
|
998
|
-
width: 1px;
|
|
999
|
-
height: 1px;
|
|
1000
|
-
margin: -1px;
|
|
1001
|
-
position: fixed;
|
|
1002
|
-
top: 0;
|
|
1003
|
-
left: 0;
|
|
1004
|
-
`;
|
|
1005
|
-
var PopoutContent = styled3.div`
|
|
1006
|
-
display: flex;
|
|
1007
|
-
flex-direction: column;
|
|
1008
|
-
/* Width sizes to content within bounds: at least the trigger width, never */
|
|
1009
|
-
/* wider than the available viewport space. Shallow popups stay flush with */
|
|
1010
|
-
/* the trigger; deeply nested trees expand horizontally as needed. */
|
|
1011
|
-
min-width: var(--radix-popover-trigger-width);
|
|
1012
|
-
max-width: var(--radix-popper-available-width);
|
|
1013
|
-
/* Height caps at 400px (or available viewport) so a popup with many */
|
|
1014
|
-
/* expanded branches scrolls vertically instead of growing off-screen. */
|
|
1015
|
-
max-height: min(var(--radix-popper-available-height), 400px);
|
|
1016
|
-
width: ${({ $width }) => $width === void 0 ? "max-content" : typeof $width === "number" ? `${$width}px` : $width};
|
|
1017
|
-
`;
|
|
1018
820
|
var MAX_INLINE_LABELS = 3;
|
|
821
|
+
function popoutWidth(width) {
|
|
822
|
+
if (width === void 0) return void 0;
|
|
823
|
+
return typeof width === "number" ? `${width}px` : width;
|
|
824
|
+
}
|
|
1019
825
|
function defaultRenderTrigger(selected, placeholder) {
|
|
1020
826
|
if (selected.length === 0) {
|
|
1021
|
-
return /* @__PURE__ */ jsx4(
|
|
827
|
+
return /* @__PURE__ */ jsx4("span", { className: "seeds-tree-select-placeholder", children: placeholder });
|
|
1022
828
|
}
|
|
1023
829
|
if (selected.length <= MAX_INLINE_LABELS) {
|
|
1024
830
|
return selected.map((s) => s.label).join(", ");
|
|
@@ -1084,8 +890,9 @@ function TreeSearchableSelectBase(props) {
|
|
|
1084
890
|
const primaryInputId = id && primaryInputName == null ? `${id}-hidden-input` : void 0;
|
|
1085
891
|
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1086
892
|
/* @__PURE__ */ jsx4(
|
|
1087
|
-
|
|
893
|
+
"input",
|
|
1088
894
|
{
|
|
895
|
+
className: "seeds-tree-select-hidden-input",
|
|
1089
896
|
type: "text",
|
|
1090
897
|
id: primaryInputId,
|
|
1091
898
|
name: primaryInputName,
|
|
@@ -1121,33 +928,44 @@ function TreeSearchableSelectBase(props) {
|
|
|
1121
928
|
event.preventDefault();
|
|
1122
929
|
}
|
|
1123
930
|
},
|
|
1124
|
-
content: /* @__PURE__ */ jsx4(
|
|
1125
|
-
|
|
931
|
+
content: /* @__PURE__ */ jsx4(
|
|
932
|
+
"div",
|
|
1126
933
|
{
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
934
|
+
className: "seeds-tree-select-popout",
|
|
935
|
+
id: popupId,
|
|
936
|
+
style: {
|
|
937
|
+
"--tree-select-width": popoutWidth(contentWidth)
|
|
938
|
+
},
|
|
939
|
+
children: /* @__PURE__ */ jsx4(
|
|
940
|
+
TreeCombobox,
|
|
941
|
+
{
|
|
942
|
+
"aria-label": "Search",
|
|
943
|
+
items,
|
|
944
|
+
placeholder: searchPlaceholder,
|
|
945
|
+
emptyText,
|
|
946
|
+
query,
|
|
947
|
+
onQueryChange: setQuery,
|
|
948
|
+
selectionMode,
|
|
949
|
+
selectableNodes,
|
|
950
|
+
selected: selectedIds,
|
|
951
|
+
onSelectionChange: handleSelectionChange,
|
|
952
|
+
renderSelectionIndicator,
|
|
953
|
+
defaultExpanded,
|
|
954
|
+
expanded,
|
|
955
|
+
onExpandedChange
|
|
956
|
+
}
|
|
957
|
+
)
|
|
1141
958
|
}
|
|
1142
|
-
)
|
|
959
|
+
),
|
|
1143
960
|
children: /* @__PURE__ */ jsxs3(
|
|
1144
|
-
|
|
961
|
+
"button",
|
|
1145
962
|
{
|
|
963
|
+
className: cn("seeds-tree-select-trigger", className, {
|
|
964
|
+
"full-width": fullWidth,
|
|
965
|
+
invalid: !!isInvalid
|
|
966
|
+
}),
|
|
1146
967
|
type: "button",
|
|
1147
968
|
id,
|
|
1148
|
-
className,
|
|
1149
|
-
$isInvalid: isInvalid,
|
|
1150
|
-
$fullWidth: fullWidth,
|
|
1151
969
|
disabled,
|
|
1152
970
|
role: "combobox",
|
|
1153
971
|
"aria-haspopup": "dialog",
|
|
@@ -1159,8 +977,15 @@ function TreeSearchableSelectBase(props) {
|
|
|
1159
977
|
"aria-invalid": isInvalid || void 0,
|
|
1160
978
|
"aria-required": required || void 0,
|
|
1161
979
|
children: [
|
|
1162
|
-
/* @__PURE__ */ jsx4(
|
|
1163
|
-
/* @__PURE__ */ jsx4(
|
|
980
|
+
/* @__PURE__ */ jsx4("span", { className: "seeds-tree-select-trigger-label", children: triggerContent }),
|
|
981
|
+
/* @__PURE__ */ jsx4(
|
|
982
|
+
"span",
|
|
983
|
+
{
|
|
984
|
+
className: cn("seeds-tree-select-chevron", { open }),
|
|
985
|
+
"aria-hidden": true,
|
|
986
|
+
children: /* @__PURE__ */ jsx4(Icon3, { name: "chevron-down-outline", size: "small" })
|
|
987
|
+
}
|
|
988
|
+
)
|
|
1164
989
|
]
|
|
1165
990
|
}
|
|
1166
991
|
)
|