@guardian/stand 0.0.50 → 0.0.52
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/dist/Modal.cjs +7 -0
- package/dist/Modal.d.cts +5 -0
- package/dist/Modal.d.ts +5 -0
- package/dist/Modal.js +3 -0
- package/dist/TagPicker.cjs +4 -2
- package/dist/TagPicker.d.cts +3 -2
- package/dist/TagPicker.d.ts +3 -2
- package/dist/TagPicker.js +3 -2
- package/dist/components/Form/Form.cjs +1 -0
- package/dist/components/Form/Form.js +1 -0
- package/dist/components/InlineMessage/InlineMessage.cjs +2 -1
- package/dist/components/InlineMessage/InlineMessage.d.cts +1 -0
- package/dist/components/InlineMessage/InlineMessage.d.ts +1 -0
- package/dist/components/InlineMessage/InlineMessage.js +2 -1
- package/dist/components/InlineMessage/types.d.cts +5 -0
- package/dist/components/InlineMessage/types.d.ts +5 -0
- package/dist/components/Modal/Modal.cjs +97 -0
- package/dist/components/Modal/Modal.d.cts +21 -0
- package/dist/components/Modal/Modal.d.ts +21 -0
- package/dist/components/Modal/Modal.js +93 -0
- package/dist/components/Modal/styles.cjs +100 -0
- package/dist/components/Modal/styles.d.cts +10 -0
- package/dist/components/Modal/styles.d.ts +10 -0
- package/dist/components/Modal/styles.js +92 -0
- package/dist/components/Modal/types.d.cts +20 -0
- package/dist/components/Modal/types.d.ts +20 -0
- package/dist/components/Select/Select.cjs +3 -1
- package/dist/components/Select/Select.d.cts +2 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.js +3 -1
- package/dist/components/Select/types.d.cts +15 -2
- package/dist/components/Select/types.d.ts +15 -2
- package/dist/components/TagPicker/Autocomplete.cjs +60 -48
- package/dist/components/TagPicker/Autocomplete.d.cts +12 -2
- package/dist/components/TagPicker/Autocomplete.d.ts +12 -2
- package/dist/components/TagPicker/Autocomplete.js +63 -51
- package/dist/components/TagPicker/TagPicker.cjs +105 -0
- package/dist/components/TagPicker/TagPicker.d.cts +91 -0
- package/dist/components/TagPicker/TagPicker.d.ts +91 -0
- package/dist/components/TagPicker/TagPicker.js +105 -0
- package/dist/components/TagPicker/TagSearchWithFilters.cjs +53 -0
- package/dist/components/TagPicker/TagSearchWithFilters.js +53 -0
- package/dist/components/TagPicker/TagTable.cjs +10 -49
- package/dist/components/TagPicker/TagTable.d.cts +12 -48
- package/dist/components/TagPicker/TagTable.d.ts +12 -48
- package/dist/components/TagPicker/TagTable.js +29 -68
- package/dist/components/TagPicker/styles.cjs +64 -3
- package/dist/components/TagPicker/styles.js +59 -4
- package/dist/components/TagPicker/types.d.cts +5 -1
- package/dist/components/TagPicker/types.d.ts +5 -1
- package/dist/components/Typography/Typography.cjs +7 -4
- package/dist/components/Typography/Typography.d.cts +1 -5
- package/dist/components/Typography/Typography.d.ts +1 -5
- package/dist/components/Typography/Typography.js +7 -4
- package/dist/components/Typography/types.d.cts +3 -2
- package/dist/components/Typography/types.d.ts +3 -2
- package/dist/components/UserMenu/PreferenceRadioGroup.js +5 -5
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/styleD/build/css/component/autocomplete.css +3 -0
- package/dist/styleD/build/css/component/modal.css +51 -0
- package/dist/styleD/build/css/component/tagPicker.css +11 -0
- package/dist/styleD/build/css/component/tagTable.css +2 -2
- package/dist/styleD/build/typescript/component/autocomplete.cjs +5 -0
- package/dist/styleD/build/typescript/component/autocomplete.d.cts +5 -0
- package/dist/styleD/build/typescript/component/autocomplete.d.ts +5 -0
- package/dist/styleD/build/typescript/component/autocomplete.js +5 -0
- package/dist/styleD/build/typescript/component/intendedAudienceSignifier.cjs +4 -1
- package/dist/styleD/build/typescript/component/intendedAudienceSignifier.d.cts +1 -0
- package/dist/styleD/build/typescript/component/intendedAudienceSignifier.d.ts +1 -0
- package/dist/styleD/build/typescript/component/intendedAudienceSignifier.js +4 -1
- package/dist/styleD/build/typescript/component/modal.cjs +72 -0
- package/dist/styleD/build/typescript/component/modal.d.cts +75 -0
- package/dist/styleD/build/typescript/component/modal.d.ts +75 -0
- package/dist/styleD/build/typescript/component/modal.js +72 -0
- package/dist/styleD/build/typescript/component/tagPicker.cjs +17 -0
- package/dist/styleD/build/typescript/component/tagPicker.d.cts +20 -0
- package/dist/styleD/build/typescript/component/tagPicker.d.ts +20 -0
- package/dist/styleD/build/typescript/component/tagPicker.js +17 -0
- package/dist/styleD/build/typescript/component/tagTable.cjs +2 -2
- package/dist/styleD/build/typescript/component/tagTable.js +2 -2
- package/package.json +16 -2
- package/dist/components/TagPicker/TagAutocomplete.cjs +0 -118
- package/dist/components/TagPicker/TagAutocomplete.d.cts +0 -144
- package/dist/components/TagPicker/TagAutocomplete.d.ts +0 -144
- package/dist/components/TagPicker/TagAutocomplete.js +0 -118
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeepPartial } from "../../util/types.js";
|
|
2
|
-
import { TagRow } from "./types.js";
|
|
3
2
|
import { ComponentTagTable } from "../../styleD/build/typescript/component/tagTable.js";
|
|
3
|
+
import { TagRow } from "./types.js";
|
|
4
4
|
import { ReactElement } from "react";
|
|
5
5
|
import { SerializedStyles } from "@emotion/react";
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ interface TagTableProps<R extends Row> {
|
|
|
12
12
|
/** `rows` - The collection of rows */
|
|
13
13
|
rows: R[];
|
|
14
14
|
/** `filterRows` - Function to filter rows from `rows` prop from appearing in the table */
|
|
15
|
-
filterRows
|
|
15
|
+
filterRows?: (row: R) => boolean;
|
|
16
16
|
/** `heading` - The table heading */
|
|
17
17
|
heading?: string;
|
|
18
18
|
/** `showTagType` - Whether to show tags' type in table */
|
|
@@ -21,6 +21,8 @@ interface TagTableProps<R extends Row> {
|
|
|
21
21
|
showTagSectionName?: boolean;
|
|
22
22
|
/** `removeAction` - Function called when the Remove button is pressed on a row */
|
|
23
23
|
removeAction?: (tag: R) => void;
|
|
24
|
+
/** `highlightFirstRow` - Whether to highlight the first row ("leading tag") */
|
|
25
|
+
highlightFirstRow?: boolean;
|
|
24
26
|
/** `addAction` - Function called when the Add button is pressed on a row */
|
|
25
27
|
addAction?: (tag: R) => void;
|
|
26
28
|
/** `onReorder` - Function called when a re-ordering of rows through drag and drop is performed */
|
|
@@ -53,37 +55,13 @@ interface TagTableProps<R extends Row> {
|
|
|
53
55
|
*
|
|
54
56
|
* ## Usage
|
|
55
57
|
*
|
|
56
|
-
* *Example with
|
|
58
|
+
* *Example with TagTable:*
|
|
57
59
|
*
|
|
58
60
|
* ```tsx
|
|
59
|
-
* import {
|
|
60
|
-
*
|
|
61
|
-
* const Component = () => {
|
|
62
|
-
* const [selectedTags, setSelectedTags] = useState<
|
|
63
|
-
* TagManagerObjectData[] // TagManagerObjectData is an internal type representing a Tag
|
|
64
|
-
* >([]);
|
|
65
|
-
|
|
66
|
-
* const [options, setOptions] = useState<TagManagerObjectData[]>([]);
|
|
67
|
-
* const [value, setValue] = useState('');
|
|
68
|
-
* const onChange = (inputText: string) => {
|
|
69
|
-
* setValue(inputText);
|
|
70
|
-
* if (inputText === '') {
|
|
71
|
-
* setOptions([]);
|
|
72
|
-
* return;
|
|
73
|
-
* }
|
|
74
|
-
*
|
|
75
|
-
* if (inputText === '*') {
|
|
76
|
-
* setOptions(exampleTags); // exampleTags is an array of Tags
|
|
77
|
-
* return;
|
|
78
|
-
* }
|
|
61
|
+
* import { TagTable } from '@guardian/stand';
|
|
79
62
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* t.internalName.toLowerCase().includes(inputText.toLowerCase()),
|
|
83
|
-
* );
|
|
84
|
-
* return setOptions(filteredItems);
|
|
85
|
-
* };
|
|
86
|
-
|
|
63
|
+
* // TagManagerObjectData is an internal type representing a Tag
|
|
64
|
+
* const Component = ({selectedTags}:{selectedTags:TagManagerObjectData[]}) => {
|
|
87
65
|
* return (
|
|
88
66
|
* <>
|
|
89
67
|
* <div
|
|
@@ -91,25 +69,10 @@ interface TagTableProps<R extends Row> {
|
|
|
91
69
|
* display: flex;
|
|
92
70
|
* `}
|
|
93
71
|
* >
|
|
94
|
-
* <TagAutocomplete
|
|
95
|
-
* onChange={onChange}
|
|
96
|
-
* options={options}
|
|
97
|
-
* label="Tags"
|
|
98
|
-
* addTag={(tag) =>
|
|
99
|
-
* setSelectedTags((tags) => {
|
|
100
|
-
* return [...tags, tag];
|
|
101
|
-
* })
|
|
102
|
-
* }
|
|
103
|
-
* loading={false}
|
|
104
|
-
* placeholder={''}
|
|
105
|
-
* disabled={false}
|
|
106
|
-
* value={value}
|
|
107
|
-
* />
|
|
108
|
-
* <select>
|
|
109
|
-
* option>All tags</option>
|
|
110
|
-
* </select>
|
|
111
|
-
* </div>
|
|
112
72
|
* <TagTable rows={selectedTags} filterRows={() => true} />
|
|
73
|
+
* <div>
|
|
74
|
+
* there are {selectedTags.length} tags.
|
|
75
|
+
* </div>
|
|
113
76
|
* </>
|
|
114
77
|
* );
|
|
115
78
|
* };
|
|
@@ -129,6 +92,7 @@ declare function TagTable<R extends Row>({
|
|
|
129
92
|
heading,
|
|
130
93
|
showTagType,
|
|
131
94
|
showTagSectionName,
|
|
95
|
+
highlightFirstRow,
|
|
132
96
|
removeAction: removeTag,
|
|
133
97
|
addAction: addTag,
|
|
134
98
|
onReorder,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { tagTableAddButtonStyles, tagTableCellStyles, tagTableDragButtonStyles, tagTableHeadingStyles, tagTableRemoveButtonStyles, tagTableRowStyles, tagTableStyles, tagTableTypeBadgeStyles } from "./styles.js";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { css } from "@emotion/react";
|
|
4
|
-
import { jsx
|
|
4
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
5
5
|
import { Button, Cell, Column, Row, Table, TableBody, TableHeader, useDragAndDrop } from "react-aria-components";
|
|
6
6
|
//#region src/components/TagPicker/TagTable.tsx
|
|
7
7
|
const rowToTag = (row) => "tag" in row ? row.tag : row;
|
|
8
8
|
const TypeBadge = (type, theme) => {
|
|
9
|
-
return /* @__PURE__ */ jsx
|
|
9
|
+
return /* @__PURE__ */ jsx("span", {
|
|
10
10
|
css: tagTableTypeBadgeStyles(theme),
|
|
11
11
|
children: type
|
|
12
12
|
});
|
|
@@ -28,37 +28,13 @@ const defaultCanRemove = () => true;
|
|
|
28
28
|
*
|
|
29
29
|
* ## Usage
|
|
30
30
|
*
|
|
31
|
-
* *Example with
|
|
31
|
+
* *Example with TagTable:*
|
|
32
32
|
*
|
|
33
33
|
* ```tsx
|
|
34
|
-
* import {
|
|
34
|
+
* import { TagTable } from '@guardian/stand';
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* TagManagerObjectData[] // TagManagerObjectData is an internal type representing a Tag
|
|
39
|
-
* >([]);
|
|
40
|
-
|
|
41
|
-
* const [options, setOptions] = useState<TagManagerObjectData[]>([]);
|
|
42
|
-
* const [value, setValue] = useState('');
|
|
43
|
-
* const onChange = (inputText: string) => {
|
|
44
|
-
* setValue(inputText);
|
|
45
|
-
* if (inputText === '') {
|
|
46
|
-
* setOptions([]);
|
|
47
|
-
* return;
|
|
48
|
-
* }
|
|
49
|
-
*
|
|
50
|
-
* if (inputText === '*') {
|
|
51
|
-
* setOptions(exampleTags); // exampleTags is an array of Tags
|
|
52
|
-
* return;
|
|
53
|
-
* }
|
|
54
|
-
*
|
|
55
|
-
* // Simple filtering against exampleTags
|
|
56
|
-
* const filteredItems = exampleTags.filter((t) =>
|
|
57
|
-
* t.internalName.toLowerCase().includes(inputText.toLowerCase()),
|
|
58
|
-
* );
|
|
59
|
-
* return setOptions(filteredItems);
|
|
60
|
-
* };
|
|
61
|
-
|
|
36
|
+
* // TagManagerObjectData is an internal type representing a Tag
|
|
37
|
+
* const Component = ({selectedTags}:{selectedTags:TagManagerObjectData[]}) => {
|
|
62
38
|
* return (
|
|
63
39
|
* <>
|
|
64
40
|
* <div
|
|
@@ -66,25 +42,10 @@ const defaultCanRemove = () => true;
|
|
|
66
42
|
* display: flex;
|
|
67
43
|
* `}
|
|
68
44
|
* >
|
|
69
|
-
* <TagAutocomplete
|
|
70
|
-
* onChange={onChange}
|
|
71
|
-
* options={options}
|
|
72
|
-
* label="Tags"
|
|
73
|
-
* addTag={(tag) =>
|
|
74
|
-
* setSelectedTags((tags) => {
|
|
75
|
-
* return [...tags, tag];
|
|
76
|
-
* })
|
|
77
|
-
* }
|
|
78
|
-
* loading={false}
|
|
79
|
-
* placeholder={''}
|
|
80
|
-
* disabled={false}
|
|
81
|
-
* value={value}
|
|
82
|
-
* />
|
|
83
|
-
* <select>
|
|
84
|
-
* option>All tags</option>
|
|
85
|
-
* </select>
|
|
86
|
-
* </div>
|
|
87
45
|
* <TagTable rows={selectedTags} filterRows={() => true} />
|
|
46
|
+
* <div>
|
|
47
|
+
* there are {selectedTags.length} tags.
|
|
48
|
+
* </div>
|
|
88
49
|
* </>
|
|
89
50
|
* );
|
|
90
51
|
* };
|
|
@@ -98,7 +59,7 @@ const defaultCanRemove = () => true;
|
|
|
98
59
|
*
|
|
99
60
|
* This is currently still in testing phase, so a production implementation is not yet available.
|
|
100
61
|
*/
|
|
101
|
-
function TagTable({ rows, filterRows, heading, showTagType, showTagSectionName, removeAction: removeTag, addAction: addTag, onReorder, canRemove = defaultCanRemove, "data-testid": dataTestId, removeIcon, gripIcon, theme, cssOverrides }) {
|
|
62
|
+
function TagTable({ rows, filterRows, heading, showTagType, showTagSectionName, highlightFirstRow = false, removeAction: removeTag, addAction: addTag, onReorder, canRemove = defaultCanRemove, "data-testid": dataTestId, removeIcon, gripIcon, theme, cssOverrides }) {
|
|
102
63
|
const canDrag = !!onReorder;
|
|
103
64
|
const [localRows, setLocalRows] = useState(() => [...rows]);
|
|
104
65
|
const localRowsRef = useRef(localRows);
|
|
@@ -106,7 +67,7 @@ function TagTable({ rows, filterRows, heading, showTagType, showTagSectionName,
|
|
|
106
67
|
useEffect(() => {
|
|
107
68
|
setLocalRows([...rows]);
|
|
108
69
|
}, [rows]);
|
|
109
|
-
const filtered = localRows.filter(filterRows);
|
|
70
|
+
const filtered = filterRows ? localRows.filter(filterRows) : [...localRows];
|
|
110
71
|
const { dragAndDropHooks } = useDragAndDrop({
|
|
111
72
|
getItems: (_keys, items) => {
|
|
112
73
|
return items.map((item) => ({ "text/plain": rowToTag(item).id.toString() }));
|
|
@@ -129,7 +90,7 @@ function TagTable({ rows, filterRows, heading, showTagType, showTagSectionName,
|
|
|
129
90
|
if (filtered.length === 0) return null;
|
|
130
91
|
return /* @__PURE__ */ jsxs("div", {
|
|
131
92
|
css: cssOverrides,
|
|
132
|
-
children: [heading && /* @__PURE__ */ jsx
|
|
93
|
+
children: [heading && /* @__PURE__ */ jsx("div", {
|
|
133
94
|
css: tagTableHeadingStyles(theme),
|
|
134
95
|
children: heading
|
|
135
96
|
}), /* @__PURE__ */ jsxs(Table, {
|
|
@@ -140,60 +101,60 @@ function TagTable({ rows, filterRows, heading, showTagType, showTagSectionName,
|
|
|
140
101
|
children: [/* @__PURE__ */ jsxs(TableHeader, {
|
|
141
102
|
hidden: true,
|
|
142
103
|
children: [
|
|
143
|
-
onReorder && /* @__PURE__ */ jsx
|
|
144
|
-
showTagType && /* @__PURE__ */ jsx
|
|
145
|
-
/* @__PURE__ */ jsx
|
|
104
|
+
onReorder && /* @__PURE__ */ jsx(Column, {}),
|
|
105
|
+
showTagType && /* @__PURE__ */ jsx(Column, { children: "Type" }),
|
|
106
|
+
/* @__PURE__ */ jsx(Column, {
|
|
146
107
|
isRowHeader: true,
|
|
147
108
|
children: "Name"
|
|
148
109
|
}),
|
|
149
|
-
showTagSectionName && /* @__PURE__ */ jsx
|
|
150
|
-
removeTag && /* @__PURE__ */ jsx
|
|
151
|
-
addTag && /* @__PURE__ */ jsx
|
|
110
|
+
showTagSectionName && /* @__PURE__ */ jsx(Column, { children: "Section" }),
|
|
111
|
+
removeTag && /* @__PURE__ */ jsx(Column, {}),
|
|
112
|
+
addTag && /* @__PURE__ */ jsx(Column, {})
|
|
152
113
|
]
|
|
153
|
-
}), /* @__PURE__ */ jsx
|
|
114
|
+
}), /* @__PURE__ */ jsx(TableBody, {
|
|
154
115
|
items: filtered,
|
|
155
116
|
dependencies: [localRows],
|
|
156
117
|
children: (item) => /* @__PURE__ */ jsxs(Row, {
|
|
157
118
|
id: rowToTag(item).id,
|
|
158
|
-
css: tagTableRowStyles(canDrag, theme),
|
|
119
|
+
css: tagTableRowStyles(canDrag, highlightFirstRow, theme),
|
|
159
120
|
textValue: rowToTag(item).name,
|
|
160
121
|
children: [
|
|
161
|
-
onReorder && /* @__PURE__ */ jsx
|
|
122
|
+
onReorder && /* @__PURE__ */ jsx(Cell, {
|
|
162
123
|
css: [css`
|
|
163
124
|
width: 1%;
|
|
164
125
|
`],
|
|
165
|
-
children: /* @__PURE__ */ jsx
|
|
126
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
166
127
|
slot: "drag",
|
|
167
128
|
css: tagTableDragButtonStyles,
|
|
168
129
|
children: gripIcon
|
|
169
130
|
})
|
|
170
131
|
}),
|
|
171
|
-
showTagType && /* @__PURE__ */ jsx
|
|
132
|
+
showTagType && /* @__PURE__ */ jsx(Cell, {
|
|
172
133
|
css: [tagTableCellStyles(theme), css`
|
|
173
134
|
position: relative;
|
|
174
135
|
width: 15%;
|
|
175
136
|
`],
|
|
176
137
|
children: TypeBadge(rowToTag(item).type)
|
|
177
138
|
}),
|
|
178
|
-
/* @__PURE__ */ jsx
|
|
139
|
+
/* @__PURE__ */ jsx(Cell, {
|
|
179
140
|
css: [tagTableCellStyles(theme), css`
|
|
180
141
|
width: 50%;
|
|
181
142
|
`],
|
|
182
143
|
"data-testid": `tags-table-item-${filtered.indexOf(item)}-name`,
|
|
183
144
|
children: rowToTag(item).name
|
|
184
145
|
}),
|
|
185
|
-
showTagSectionName && /* @__PURE__ */ jsx
|
|
146
|
+
showTagSectionName && /* @__PURE__ */ jsx(Cell, {
|
|
186
147
|
css: [tagTableCellStyles(theme), css`
|
|
187
148
|
width: 20%;
|
|
188
149
|
`],
|
|
189
150
|
children: rowToTag(item).sectionName
|
|
190
151
|
}),
|
|
191
|
-
removeTag && /* @__PURE__ */ jsx
|
|
152
|
+
removeTag && /* @__PURE__ */ jsx(Cell, {
|
|
192
153
|
css: [tagTableCellStyles(theme), css`
|
|
193
154
|
text-align: center;
|
|
194
155
|
width: 10%;
|
|
195
156
|
`],
|
|
196
|
-
children: canRemove(item) && /* @__PURE__ */ jsx
|
|
157
|
+
children: canRemove(item) && /* @__PURE__ */ jsx(Button, {
|
|
197
158
|
css: tagTableRemoveButtonStyles,
|
|
198
159
|
onPress: () => {
|
|
199
160
|
removeTag(item);
|
|
@@ -202,12 +163,12 @@ function TagTable({ rows, filterRows, heading, showTagType, showTagSectionName,
|
|
|
202
163
|
children: removeIcon ?? "Remove"
|
|
203
164
|
})
|
|
204
165
|
}),
|
|
205
|
-
addTag && /* @__PURE__ */ jsx
|
|
166
|
+
addTag && /* @__PURE__ */ jsx(Cell, {
|
|
206
167
|
css: [tagTableCellStyles(theme), css`
|
|
207
168
|
text-align: center;
|
|
208
169
|
width: 10%;
|
|
209
170
|
`],
|
|
210
|
-
children: /* @__PURE__ */ jsx
|
|
171
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
211
172
|
css: tagTableAddButtonStyles(theme),
|
|
212
173
|
onPress: () => {
|
|
213
174
|
addTag(item);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const require_mergeDeep = require("../../util/mergeDeep.cjs");
|
|
2
2
|
const require_autocomplete = require("../../styleD/build/typescript/component/autocomplete.cjs");
|
|
3
3
|
const require_tagTable = require("../../styleD/build/typescript/component/tagTable.cjs");
|
|
4
|
+
const require_tagPicker = require("../../styleD/build/typescript/component/tagPicker.cjs");
|
|
4
5
|
let _emotion_react = require("@emotion/react");
|
|
5
6
|
//#region src/components/TagPicker/styles.ts
|
|
6
|
-
const autocompleteInputStyles = (partialTheme = {}) => {
|
|
7
|
+
const autocompleteInputStyles = (hasIcon, partialTheme = {}) => {
|
|
7
8
|
const theme = require_mergeDeep.mergeDeep(require_autocomplete.componentAutocomplete, partialTheme);
|
|
8
9
|
return _emotion_react.css`
|
|
9
10
|
width: 100%;
|
|
@@ -14,6 +15,10 @@ const autocompleteInputStyles = (partialTheme = {}) => {
|
|
|
14
15
|
border-color: ${theme.input.borderColor};
|
|
15
16
|
border-width: ${theme.input.borderWidth};
|
|
16
17
|
border-style: ${theme.input.borderStyle};
|
|
18
|
+
${hasIcon && `
|
|
19
|
+
padding-right: calc(${theme.icon.paddingX} + ${theme.icon.size} + ${theme.icon.paddingX});
|
|
20
|
+
min-height: calc(${theme.icon.size});
|
|
21
|
+
`}
|
|
17
22
|
|
|
18
23
|
&[data-disabled] {
|
|
19
24
|
background-color: ${theme.input.disabledBackgroundColor};
|
|
@@ -67,6 +72,7 @@ const tagTableCellStyles = (partialTheme = {}) => {
|
|
|
67
72
|
const theme = require_mergeDeep.mergeDeep(require_tagTable.componentTagTable, partialTheme);
|
|
68
73
|
return _emotion_react.css`
|
|
69
74
|
padding: ${theme.cell.paddingY} ${theme.cell.paddingX};
|
|
75
|
+
vertical-align: middle;
|
|
70
76
|
|
|
71
77
|
:first-of-type {
|
|
72
78
|
padding-left: ${theme.cell.firstCellPaddingLeft};
|
|
@@ -79,7 +85,7 @@ const tagTableCellStyles = (partialTheme = {}) => {
|
|
|
79
85
|
}
|
|
80
86
|
`;
|
|
81
87
|
};
|
|
82
|
-
const tagTableRowStyles = (canDrag, partialTheme = {}) => {
|
|
88
|
+
const tagTableRowStyles = (canDrag, highlightFirstRow, partialTheme = {}) => {
|
|
83
89
|
const theme = require_mergeDeep.mergeDeep(require_tagTable.componentTagTable, partialTheme);
|
|
84
90
|
return _emotion_react.css`
|
|
85
91
|
background-color: ${theme.row.backgroundColor};
|
|
@@ -97,7 +103,7 @@ const tagTableRowStyles = (canDrag, partialTheme = {}) => {
|
|
|
97
103
|
opacity: 1;
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
|
-
${
|
|
106
|
+
${highlightFirstRow && `:first-of-type {
|
|
101
107
|
background-color: ${theme.row.firstRowBackgroundColor};
|
|
102
108
|
|
|
103
109
|
:hover {
|
|
@@ -184,11 +190,66 @@ const tagTableTypeBadgeStyles = (partialTheme = {}) => {
|
|
|
184
190
|
font-weight: ${theme.typeBadge.fontWeight};
|
|
185
191
|
`;
|
|
186
192
|
};
|
|
193
|
+
const iconStyles = (partialTheme = {}) => {
|
|
194
|
+
const theme = require_mergeDeep.mergeDeep(require_autocomplete.componentAutocomplete, partialTheme);
|
|
195
|
+
return _emotion_react.css`
|
|
196
|
+
pointer-events: none;
|
|
197
|
+
position: absolute;
|
|
198
|
+
right: ${theme.icon.paddingX};
|
|
199
|
+
color: ${theme.icon.color};
|
|
200
|
+
top: 50%;
|
|
201
|
+
transform: translateY(-50%);
|
|
202
|
+
font-size: ${theme.icon.size};
|
|
203
|
+
`;
|
|
204
|
+
};
|
|
205
|
+
const tagPickerStyles = (partialTheme = {}) => {
|
|
206
|
+
const theme = require_mergeDeep.mergeDeep(require_tagPicker.componentTagPicker, partialTheme);
|
|
207
|
+
return _emotion_react.css`
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-direction: column;
|
|
210
|
+
width: ${theme.shared.width};
|
|
211
|
+
gap: ${theme.shared.gap};
|
|
212
|
+
`;
|
|
213
|
+
};
|
|
214
|
+
const offlineSectionStyles = (partialTheme = {}) => {
|
|
215
|
+
return _emotion_react.css`
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-direction: column;
|
|
218
|
+
gap: ${require_mergeDeep.mergeDeep(require_tagPicker.componentTagPicker, partialTheme).offlineSection.gap};
|
|
219
|
+
`;
|
|
220
|
+
};
|
|
221
|
+
const tagSearchWithFilterStyles = (partialTheme = {}) => {
|
|
222
|
+
return _emotion_react.css`
|
|
223
|
+
display: flex;
|
|
224
|
+
gap: ${require_mergeDeep.mergeDeep(require_tagPicker.componentTagPicker, partialTheme).shared.gap};
|
|
225
|
+
`;
|
|
226
|
+
};
|
|
227
|
+
const filterSelectCssOverrides = (partialTheme = {}) => {
|
|
228
|
+
return _emotion_react.css`
|
|
229
|
+
flex-basis: ${require_mergeDeep.mergeDeep(require_tagPicker.componentTagPicker, partialTheme).select.flexBasis};
|
|
230
|
+
display: flex;
|
|
231
|
+
button {
|
|
232
|
+
height: 100%;
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
};
|
|
236
|
+
const modifyFilterSelectTheme = (selectTheme) => {
|
|
237
|
+
return require_mergeDeep.mergeDeep({ shared: {
|
|
238
|
+
width: void 0,
|
|
239
|
+
button: { marginTop: "0" }
|
|
240
|
+
} }, selectTheme);
|
|
241
|
+
};
|
|
187
242
|
//#endregion
|
|
188
243
|
exports.autocompleteInputStyles = autocompleteInputStyles;
|
|
244
|
+
exports.filterSelectCssOverrides = filterSelectCssOverrides;
|
|
245
|
+
exports.iconStyles = iconStyles;
|
|
189
246
|
exports.listboxInfoStyles = listboxInfoStyles;
|
|
190
247
|
exports.listboxItemStyles = listboxItemStyles;
|
|
191
248
|
exports.listboxStyles = listboxStyles;
|
|
249
|
+
exports.modifyFilterSelectTheme = modifyFilterSelectTheme;
|
|
250
|
+
exports.offlineSectionStyles = offlineSectionStyles;
|
|
251
|
+
exports.tagPickerStyles = tagPickerStyles;
|
|
252
|
+
exports.tagSearchWithFilterStyles = tagSearchWithFilterStyles;
|
|
192
253
|
exports.tagTableAddButtonStyles = tagTableAddButtonStyles;
|
|
193
254
|
exports.tagTableCellStyles = tagTableCellStyles;
|
|
194
255
|
exports.tagTableDragButtonStyles = tagTableDragButtonStyles;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { mergeDeep } from "../../util/mergeDeep.js";
|
|
2
2
|
import { componentAutocomplete } from "../../styleD/build/typescript/component/autocomplete.js";
|
|
3
3
|
import { componentTagTable } from "../../styleD/build/typescript/component/tagTable.js";
|
|
4
|
+
import { componentTagPicker } from "../../styleD/build/typescript/component/tagPicker.js";
|
|
4
5
|
import { css } from "@emotion/react";
|
|
5
6
|
//#region src/components/TagPicker/styles.ts
|
|
6
|
-
const autocompleteInputStyles = (partialTheme = {}) => {
|
|
7
|
+
const autocompleteInputStyles = (hasIcon, partialTheme = {}) => {
|
|
7
8
|
const theme = mergeDeep(componentAutocomplete, partialTheme);
|
|
8
9
|
return css`
|
|
9
10
|
width: 100%;
|
|
@@ -14,6 +15,10 @@ const autocompleteInputStyles = (partialTheme = {}) => {
|
|
|
14
15
|
border-color: ${theme.input.borderColor};
|
|
15
16
|
border-width: ${theme.input.borderWidth};
|
|
16
17
|
border-style: ${theme.input.borderStyle};
|
|
18
|
+
${hasIcon && `
|
|
19
|
+
padding-right: calc(${theme.icon.paddingX} + ${theme.icon.size} + ${theme.icon.paddingX});
|
|
20
|
+
min-height: calc(${theme.icon.size});
|
|
21
|
+
`}
|
|
17
22
|
|
|
18
23
|
&[data-disabled] {
|
|
19
24
|
background-color: ${theme.input.disabledBackgroundColor};
|
|
@@ -67,6 +72,7 @@ const tagTableCellStyles = (partialTheme = {}) => {
|
|
|
67
72
|
const theme = mergeDeep(componentTagTable, partialTheme);
|
|
68
73
|
return css`
|
|
69
74
|
padding: ${theme.cell.paddingY} ${theme.cell.paddingX};
|
|
75
|
+
vertical-align: middle;
|
|
70
76
|
|
|
71
77
|
:first-of-type {
|
|
72
78
|
padding-left: ${theme.cell.firstCellPaddingLeft};
|
|
@@ -79,7 +85,7 @@ const tagTableCellStyles = (partialTheme = {}) => {
|
|
|
79
85
|
}
|
|
80
86
|
`;
|
|
81
87
|
};
|
|
82
|
-
const tagTableRowStyles = (canDrag, partialTheme = {}) => {
|
|
88
|
+
const tagTableRowStyles = (canDrag, highlightFirstRow, partialTheme = {}) => {
|
|
83
89
|
const theme = mergeDeep(componentTagTable, partialTheme);
|
|
84
90
|
return css`
|
|
85
91
|
background-color: ${theme.row.backgroundColor};
|
|
@@ -97,7 +103,7 @@ const tagTableRowStyles = (canDrag, partialTheme = {}) => {
|
|
|
97
103
|
opacity: 1;
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
|
-
${
|
|
106
|
+
${highlightFirstRow && `:first-of-type {
|
|
101
107
|
background-color: ${theme.row.firstRowBackgroundColor};
|
|
102
108
|
|
|
103
109
|
:hover {
|
|
@@ -184,5 +190,54 @@ const tagTableTypeBadgeStyles = (partialTheme = {}) => {
|
|
|
184
190
|
font-weight: ${theme.typeBadge.fontWeight};
|
|
185
191
|
`;
|
|
186
192
|
};
|
|
193
|
+
const iconStyles = (partialTheme = {}) => {
|
|
194
|
+
const theme = mergeDeep(componentAutocomplete, partialTheme);
|
|
195
|
+
return css`
|
|
196
|
+
pointer-events: none;
|
|
197
|
+
position: absolute;
|
|
198
|
+
right: ${theme.icon.paddingX};
|
|
199
|
+
color: ${theme.icon.color};
|
|
200
|
+
top: 50%;
|
|
201
|
+
transform: translateY(-50%);
|
|
202
|
+
font-size: ${theme.icon.size};
|
|
203
|
+
`;
|
|
204
|
+
};
|
|
205
|
+
const tagPickerStyles = (partialTheme = {}) => {
|
|
206
|
+
const theme = mergeDeep(componentTagPicker, partialTheme);
|
|
207
|
+
return css`
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-direction: column;
|
|
210
|
+
width: ${theme.shared.width};
|
|
211
|
+
gap: ${theme.shared.gap};
|
|
212
|
+
`;
|
|
213
|
+
};
|
|
214
|
+
const offlineSectionStyles = (partialTheme = {}) => {
|
|
215
|
+
return css`
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-direction: column;
|
|
218
|
+
gap: ${mergeDeep(componentTagPicker, partialTheme).offlineSection.gap};
|
|
219
|
+
`;
|
|
220
|
+
};
|
|
221
|
+
const tagSearchWithFilterStyles = (partialTheme = {}) => {
|
|
222
|
+
return css`
|
|
223
|
+
display: flex;
|
|
224
|
+
gap: ${mergeDeep(componentTagPicker, partialTheme).shared.gap};
|
|
225
|
+
`;
|
|
226
|
+
};
|
|
227
|
+
const filterSelectCssOverrides = (partialTheme = {}) => {
|
|
228
|
+
return css`
|
|
229
|
+
flex-basis: ${mergeDeep(componentTagPicker, partialTheme).select.flexBasis};
|
|
230
|
+
display: flex;
|
|
231
|
+
button {
|
|
232
|
+
height: 100%;
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
};
|
|
236
|
+
const modifyFilterSelectTheme = (selectTheme) => {
|
|
237
|
+
return mergeDeep({ shared: {
|
|
238
|
+
width: void 0,
|
|
239
|
+
button: { marginTop: "0" }
|
|
240
|
+
} }, selectTheme);
|
|
241
|
+
};
|
|
187
242
|
//#endregion
|
|
188
|
-
export { autocompleteInputStyles, listboxInfoStyles, listboxItemStyles, listboxStyles, tagTableAddButtonStyles, tagTableCellStyles, tagTableDragButtonStyles, tagTableHeadingStyles, tagTableRemoveButtonStyles, tagTableRowStyles, tagTableStyles, tagTableTypeBadgeStyles };
|
|
243
|
+
export { autocompleteInputStyles, filterSelectCssOverrides, iconStyles, listboxInfoStyles, listboxItemStyles, listboxStyles, modifyFilterSelectTheme, offlineSectionStyles, tagPickerStyles, tagSearchWithFilterStyles, tagTableAddButtonStyles, tagTableCellStyles, tagTableDragButtonStyles, tagTableHeadingStyles, tagTableRemoveButtonStyles, tagTableRowStyles, tagTableStyles, tagTableTypeBadgeStyles };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
const require_mergeDeep = require("../../util/mergeDeep.cjs");
|
|
2
2
|
const require_styles = require("./styles.cjs");
|
|
3
|
-
let
|
|
3
|
+
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
4
|
+
let react_aria_components = require("react-aria-components");
|
|
4
5
|
//#region src/components/Typography/Typography.tsx
|
|
5
6
|
const Typography = ({ element = "span", variant = "bodyMd", children, cssOverrides, theme = {}, ...props }) => {
|
|
6
|
-
return (0,
|
|
7
|
+
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.Text, {
|
|
8
|
+
elementType: element,
|
|
7
9
|
css: [require_styles.typographyStyles(require_mergeDeep.mergeDeep(require_styles.defaultTypographyTheme, theme), { variant }), cssOverrides],
|
|
8
|
-
...props
|
|
9
|
-
|
|
10
|
+
...props,
|
|
11
|
+
children
|
|
12
|
+
});
|
|
10
13
|
};
|
|
11
14
|
//#endregion
|
|
12
15
|
exports.Typography = Typography;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TypographyProps } from "./types.cjs";
|
|
3
2
|
|
|
4
3
|
//#region src/components/Typography/Typography.d.ts
|
|
@@ -9,9 +8,6 @@ declare const Typography: ({
|
|
|
9
8
|
cssOverrides,
|
|
10
9
|
theme,
|
|
11
10
|
...props
|
|
12
|
-
}: TypographyProps) => import("react").
|
|
13
|
-
className?: string | undefined;
|
|
14
|
-
css: (import("@emotion/react").SerializedStyles | import("@emotion/react").SerializedStyles[] | undefined)[];
|
|
15
|
-
}, HTMLElement>;
|
|
11
|
+
}: TypographyProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
16
12
|
//#endregion
|
|
17
13
|
export { Typography };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TypographyProps } from "./types.js";
|
|
3
2
|
|
|
4
3
|
//#region src/components/Typography/Typography.d.ts
|
|
@@ -9,9 +8,6 @@ declare const Typography: ({
|
|
|
9
8
|
cssOverrides,
|
|
10
9
|
theme,
|
|
11
10
|
...props
|
|
12
|
-
}: TypographyProps) => import("react").
|
|
13
|
-
className?: string | undefined;
|
|
14
|
-
css: (import("@emotion/react").SerializedStyles | import("@emotion/react").SerializedStyles[] | undefined)[];
|
|
15
|
-
}, HTMLElement>;
|
|
11
|
+
}: TypographyProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
16
12
|
//#endregion
|
|
17
13
|
export { Typography };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { mergeDeep } from "../../util/mergeDeep.js";
|
|
2
2
|
import { defaultTypographyTheme, typographyStyles } from "./styles.js";
|
|
3
|
-
import { jsx } from "@emotion/react";
|
|
3
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
4
|
+
import { Text } from "react-aria-components";
|
|
4
5
|
//#region src/components/Typography/Typography.tsx
|
|
5
6
|
const Typography = ({ element = "span", variant = "bodyMd", children, cssOverrides, theme = {}, ...props }) => {
|
|
6
|
-
return jsx(
|
|
7
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
8
|
+
elementType: element,
|
|
7
9
|
css: [typographyStyles(mergeDeep(defaultTypographyTheme, theme), { variant }), cssOverrides],
|
|
8
|
-
...props
|
|
9
|
-
|
|
10
|
+
...props,
|
|
11
|
+
children
|
|
12
|
+
});
|
|
10
13
|
};
|
|
11
14
|
//#endregion
|
|
12
15
|
export { Typography };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultProps } from "../../util/types.cjs";
|
|
2
2
|
import { SemanticTypography } from "../../styleD/build/typescript/semantic/typography.cjs";
|
|
3
3
|
import { TypographyTheme } from "./styles.cjs";
|
|
4
|
+
import { TextProps } from "react-aria-components";
|
|
4
5
|
|
|
5
6
|
//#region src/components/Typography/types.d.ts
|
|
6
7
|
type TypographyVariant = keyof SemanticTypography;
|
|
7
|
-
interface TypographyProps extends
|
|
8
|
+
interface TypographyProps extends DefaultProps<TypographyTheme, TextProps['className']>, Omit<TextProps, 'elementType' | 'className'> {
|
|
8
9
|
/**
|
|
9
10
|
* HTML element to render with font applied to
|
|
10
11
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultProps } from "../../util/types.js";
|
|
2
2
|
import { SemanticTypography } from "../../styleD/build/typescript/semantic/typography.js";
|
|
3
3
|
import { TypographyTheme } from "./styles.js";
|
|
4
|
+
import { TextProps } from "react-aria-components";
|
|
4
5
|
|
|
5
6
|
//#region src/components/Typography/types.d.ts
|
|
6
7
|
type TypographyVariant = keyof SemanticTypography;
|
|
7
|
-
interface TypographyProps extends
|
|
8
|
+
interface TypographyProps extends DefaultProps<TypographyTheme, TextProps['className']>, Omit<TextProps, 'elementType' | 'className'> {
|
|
8
9
|
/**
|
|
9
10
|
* HTML element to render with font applied to
|
|
10
11
|
*/
|