@guardian/stand 0.0.5 → 0.0.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.
Files changed (83) hide show
  1. package/README.md +445 -7
  2. package/dist/{byline → components/byline}/Byline.cjs +5 -5
  3. package/dist/{byline → components/byline}/Byline.js +5 -5
  4. package/dist/components/byline/styles.cjs +266 -0
  5. package/dist/components/byline/styles.js +256 -0
  6. package/dist/components/tag-picker/TagAutocomplete.cjs +107 -0
  7. package/dist/components/tag-picker/TagAutocomplete.js +26 -0
  8. package/dist/components/tag-picker/TagTable.cjs +203 -0
  9. package/dist/components/tag-picker/TagTable.js +91 -0
  10. package/dist/components/tag-picker/styles.cjs +198 -0
  11. package/dist/components/tag-picker/styles.js +185 -0
  12. package/dist/components/util.cjs +19 -0
  13. package/dist/components/util.js +17 -0
  14. package/dist/index.cjs +16 -1
  15. package/dist/index.js +8 -1
  16. package/dist/styleD/build/css/css/base/colors.css +122 -0
  17. package/dist/styleD/build/css/css/base/typography.css +43 -0
  18. package/dist/styleD/build/css/css/component/byline.css +36 -0
  19. package/dist/styleD/build/css/css/component/tagAutocomplete.css +23 -0
  20. package/dist/styleD/build/css/css/component/tagTable.css +39 -0
  21. package/dist/styleD/build/css/css/semantic/colors.css +27 -0
  22. package/dist/styleD/build/css/css/semantic/typography.css +138 -0
  23. package/dist/styleD/build/typescript/base/colors.cjs +144 -0
  24. package/dist/styleD/build/typescript/base/colors.js +142 -0
  25. package/dist/styleD/build/typescript/base/typography.cjs +65 -0
  26. package/dist/styleD/build/typescript/base/typography.js +63 -0
  27. package/dist/styleD/build/typescript/component/byline.cjs +42 -0
  28. package/dist/styleD/build/typescript/component/byline.js +40 -0
  29. package/dist/styleD/build/typescript/component/tagAutocomplete.cjs +29 -0
  30. package/dist/styleD/build/typescript/component/tagAutocomplete.js +27 -0
  31. package/dist/styleD/build/typescript/component/tagTable.cjs +53 -0
  32. package/dist/styleD/build/typescript/component/tagTable.js +51 -0
  33. package/dist/styleD/build/typescript/semantic/colors.cjs +37 -0
  34. package/dist/styleD/build/typescript/semantic/colors.js +35 -0
  35. package/dist/styleD/build/typescript/semantic/typography.cjs +462 -0
  36. package/dist/styleD/build/typescript/semantic/typography.js +460 -0
  37. package/dist/styleD/utils/semantic/typography.cjs +29 -0
  38. package/dist/styleD/utils/semantic/typography.js +26 -0
  39. package/dist/types/components/byline/Byline.d.ts +83 -0
  40. package/dist/types/components/byline/styles.d.ts +13 -0
  41. package/dist/types/components/byline/theme.d.ts +3 -0
  42. package/dist/types/components/tag-picker/TagAutocomplete.d.ts +117 -0
  43. package/dist/types/components/tag-picker/TagTable.d.ts +126 -0
  44. package/dist/types/components/tag-picker/example-tags.d.ts +2 -0
  45. package/dist/types/components/tag-picker/styles.d.ts +16 -0
  46. package/dist/types/components/tag-picker/types.d.ts +65 -0
  47. package/dist/types/{byline → components}/util.d.ts +1 -0
  48. package/dist/types/index.d.ts +26 -2
  49. package/dist/types/styleD/build/typescript/base/colors.d.ts +144 -0
  50. package/dist/types/styleD/build/typescript/base/typography.d.ts +65 -0
  51. package/dist/types/styleD/build/typescript/component/byline.d.ts +42 -0
  52. package/dist/types/styleD/build/typescript/component/tagAutocomplete.d.ts +29 -0
  53. package/dist/types/styleD/build/typescript/component/tagTable.d.ts +53 -0
  54. package/dist/types/styleD/build/typescript/semantic/colors.d.ts +37 -0
  55. package/dist/types/styleD/build/typescript/semantic/typography.d.ts +462 -0
  56. package/dist/types/styleD/stories/base/Typography.d.ts +1 -0
  57. package/dist/types/styleD/stories/base/storybookColorPalette.d.ts +19 -0
  58. package/dist/types/styleD/stories/semantic/TypographyPresets.d.ts +1 -0
  59. package/dist/types/styleD/utils/semantic/typography.d.ts +16 -0
  60. package/dist/types/styleD/utils/semantic/typography.test.d.ts +1 -0
  61. package/package.json +68 -22
  62. package/dist/byline/styles.cjs +0 -244
  63. package/dist/byline/styles.js +0 -234
  64. package/dist/types/byline/Byline.d.ts +0 -17
  65. package/dist/types/byline/styles.d.ts +0 -11
  66. package/dist/types/byline/theme.d.ts +0 -44
  67. /package/dist/{byline → components/byline}/Preview.cjs +0 -0
  68. /package/dist/{byline → components/byline}/Preview.js +0 -0
  69. /package/dist/{byline → components/byline}/lib.cjs +0 -0
  70. /package/dist/{byline → components/byline}/lib.js +0 -0
  71. /package/dist/{byline → components/byline}/placeholder.cjs +0 -0
  72. /package/dist/{byline → components/byline}/placeholder.js +0 -0
  73. /package/dist/{byline → components/byline}/plugins.cjs +0 -0
  74. /package/dist/{byline → components/byline}/plugins.js +0 -0
  75. /package/dist/{byline → components/byline}/schema.cjs +0 -0
  76. /package/dist/{byline → components/byline}/schema.js +0 -0
  77. /package/dist/types/{byline → components/byline}/Preview.d.ts +0 -0
  78. /package/dist/types/{byline → components/byline}/contributors-fixture.d.ts +0 -0
  79. /package/dist/types/{byline → components/byline}/lib.d.ts +0 -0
  80. /package/dist/types/{byline → components/byline}/lib.test.d.ts +0 -0
  81. /package/dist/types/{byline → components/byline}/placeholder.d.ts +0 -0
  82. /package/dist/types/{byline → components/byline}/plugins.d.ts +0 -0
  83. /package/dist/types/{byline → components/byline}/schema.d.ts +0 -0
package/package.json CHANGED
@@ -1,11 +1,20 @@
1
1
  {
2
2
  "name": "@guardian/stand",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "exports": {
6
- "types": "./dist/types/index.d.ts",
7
- "import": "./dist/index.js",
8
- "require": "./dist/index.cjs"
6
+ ".": {
7
+ "types": "./dist/types/index.d.ts",
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.cjs"
10
+ },
11
+ "./base/colors.css": "./dist/styleD/build/css/base/colors.css",
12
+ "./base/typography.css": "./dist/styleD/build/css/base/typography.css",
13
+ "./semantic/colors.css": "./dist/styleD/build/css/semantic/colors.css",
14
+ "./semantic/typography.css": "./dist/styleD/build/css/semantic/typography.css",
15
+ "./component/byline.css": "./dist/styleD/build/css/component/byline.css",
16
+ "./component/tagAutocomplete.css": "./dist/styleD/build/css/component/tagAutocomplete.css",
17
+ "./component/tagTable.css": "./dist/styleD/build/css/component/tagTable.css"
9
18
  },
10
19
  "files": [
11
20
  "dist"
@@ -17,28 +26,32 @@
17
26
  "main": "./dist/index.cjs",
18
27
  "types": "./dist/types/index.d.ts",
19
28
  "devDependencies": {
20
- "@changesets/cli": "^2.29.7",
29
+ "@changesets/cli": "^2.29.8",
21
30
  "@emotion/react": "11.11.4",
22
- "@guardian/eslint-config": "12.0.0",
23
- "@guardian/prettier": "8.0.1",
31
+ "@figma/rest-api-spec": "^0.34.0",
32
+ "@guardian/eslint-config": "13.0.1",
33
+ "@guardian/prettier": "9.0.0",
24
34
  "@guardian/prosemirror-invisibles": "3.1.1",
25
- "@guardian/tsconfig": "1.0.0",
26
- "@playwright/experimental-ct-react17": "^1.56.1",
27
- "@rollup/plugin-commonjs": "28.0.9",
35
+ "@guardian/tsconfig": "1.0.1",
36
+ "@playwright/experimental-ct-react17": "^1.57.0",
37
+ "@rollup/plugin-commonjs": "29.0.0",
28
38
  "@rollup/plugin-node-resolve": "16.0.3",
29
39
  "@rollup/plugin-typescript": "12.3.0",
30
- "@storybook/addon-docs": "^9.1.15",
31
- "@storybook/addon-themes": "^9.1.15",
32
- "@storybook/react-vite": "^9.1.15",
40
+ "@storybook/addon-docs": "^10.1.11",
41
+ "@storybook/addon-themes": "^10.1.11",
42
+ "@storybook/react-vite": "^10.1.11",
43
+ "@terrazzo/cli": "^0.10.5",
44
+ "@testing-library/jest-dom": "^6.9.1",
33
45
  "@types/jest": "30.0.0",
34
- "@types/node": "^24.9.1",
46
+ "@types/node": "^24.10.1",
35
47
  "@types/react": "17.0.76",
36
48
  "@types/react-dom": "17.0.25",
37
- "eslint": "9.38.0",
38
- "eslint-plugin-storybook": "^9.1.15",
49
+ "change-case": "^5.4.4",
50
+ "eslint": "9.39.2",
51
+ "eslint-plugin-storybook": "^10.1.11",
39
52
  "jest": "30.2.0",
40
53
  "jest-environment-jsdom": "^30.1.2",
41
- "prettier": "3.6.2",
54
+ "prettier": "3.7.4",
42
55
  "prosemirror-dropcursor": "1.8.2",
43
56
  "prosemirror-history": "1.4.1",
44
57
  "prosemirror-keymap": "1.2.2",
@@ -46,13 +59,16 @@
46
59
  "prosemirror-state": "1.4.3",
47
60
  "prosemirror-view": "1.37.2",
48
61
  "react": "17.0.2",
62
+ "react-aria-components": "1.13.0",
49
63
  "react-dom": "17.0.2",
50
- "rimraf": "6.0.1",
51
- "rollup": "4.52.5",
64
+ "rimraf": "6.1.2",
65
+ "rollup": "4.54.0",
66
+ "rollup-plugin-copy": "^3.5.0",
52
67
  "rollup-plugin-esbuild": "6.2.1",
53
- "rollup-plugin-node-externals": "8.1.1",
54
- "storybook": "^9.1.15",
55
- "ts-jest": "29.4.5",
68
+ "rollup-plugin-node-externals": "8.1.2",
69
+ "storybook": "^10.1.11",
70
+ "style-dictionary": "^5.1.1",
71
+ "ts-jest": "29.4.6",
56
72
  "tslib": "2.8.1",
57
73
  "typescript": "5.1.3"
58
74
  },
@@ -66,13 +82,43 @@
66
82
  "prosemirror-state": "1.4.3",
67
83
  "prosemirror-view": "1.37.2",
68
84
  "react": "^17.0.2 || ^18.0.0 || ^19.0.0",
85
+ "react-aria-components": "1.13.0",
69
86
  "react-dom": "^17.0.2 || ^18.0.0 || ^19.0.0",
70
87
  "typescript": ">=5.0.0 <=5.9.3"
71
88
  },
89
+ "peerDependenciesMeta": {
90
+ "@guardian/prosemirror-invisibles": {
91
+ "optional": true
92
+ },
93
+ "prosemirror-dropcursor": {
94
+ "optional": true
95
+ },
96
+ "prosemirror-history": {
97
+ "optional": true
98
+ },
99
+ "prosemirror-keymap": {
100
+ "optional": true
101
+ },
102
+ "prosemirror-model": {
103
+ "optional": true
104
+ },
105
+ "prosemirror-state": {
106
+ "optional": true
107
+ },
108
+ "prosemirror-view": {
109
+ "optional": true
110
+ }
111
+ },
72
112
  "scripts": {
73
113
  "build": "rimraf dist && rollup -c",
114
+ "build-styled": "cd src/styleD && node build.js",
74
115
  "storybook": "storybook dev -p 6007",
75
116
  "build-storybook": "storybook build",
117
+ "lint": "eslint . --ext .ts,.tsx",
118
+ "lint:fix": "eslint --fix . --ext .ts,.tsx",
119
+ "lint:tokens": "tz check",
120
+ "format:check": "prettier --check .",
121
+ "format:fix": "prettier --write .",
76
122
  "tsc": "tsc",
77
123
  "test": "jest",
78
124
  "test:e2e": "playwright test -c playwright-ct.config.ts",
@@ -1,244 +0,0 @@
1
- 'use strict';
2
-
3
- var react = require('@emotion/react');
4
-
5
- const bylineContainerStyles = react.css`
6
- position: relative;
7
- width: 100%;
8
- `;
9
- const bylineEditorStyles = (theme) => react.css`
10
- border: ${theme?.border ?? "1px black solid"};
11
- background-color: ${theme?.background ?? "white"};
12
- color: ${theme?.color ?? "inherit"};
13
-
14
- /* ProseMirror styles from prosemirror-view/styles/prosemirror.css */
15
- .ProseMirror {
16
- padding: 4px 4px;
17
- word-wrap: break-word;
18
- white-space: pre-wrap;
19
- white-space: break-spaces;
20
- -webkit-font-variant-ligatures: none;
21
- font-variant-ligatures: none;
22
- font-feature-settings: 'liga' 0; /* the above doesn't seem to work in Edge */
23
- line-height: ${theme?.lineHeight ?? "1.8"};
24
- }
25
-
26
- .ProseMirror[contenteditable='false'] {
27
- background: ${theme?.readOnlyBackground ?? "#dcdcdc"};
28
- cursor: 'not-allowed';
29
- }
30
-
31
- .ProseMirror pre {
32
- white-space: pre-wrap;
33
- }
34
-
35
- .ProseMirror li {
36
- position: relative;
37
- }
38
-
39
- .ProseMirror-hideselection *::selection {
40
- background: transparent;
41
- }
42
- .ProseMirror-hideselection *::-moz-selection {
43
- background: transparent;
44
- }
45
- .ProseMirror-hideselection {
46
- caret-color: transparent;
47
- }
48
-
49
- /* See https://github.com/ProseMirror/prosemirror/issues/1421#issuecomment-1759320191 */
50
- .ProseMirror [draggable][contenteditable='false'] {
51
- user-select: text;
52
- }
53
-
54
- .ProseMirror-selectednode {
55
- outline: ${theme?.chip?.selected?.border ?? "1px solid #b4d9ff"};
56
- }
57
-
58
- /* Make sure li selections wrap around markers */
59
-
60
- li.ProseMirror-selectednode {
61
- outline: none;
62
- }
63
-
64
- li.ProseMirror-selectednode:after {
65
- content: '';
66
- position: absolute;
67
- left: -32px;
68
- right: -2px;
69
- top: -2px;
70
- bottom: -2px;
71
- border: ${theme?.chip?.selected?.border ?? "1px solid #b4d9ff"};
72
- pointer-events: none;
73
- }
74
-
75
- /* Protect against generic img rules */
76
-
77
- img.ProseMirror-separator {
78
- display: inline !important;
79
- border: none !important;
80
- margin: 0 !important;
81
- }
82
-
83
- .ProseMirror:focus {
84
- outline: none;
85
- }
86
-
87
- /* Invisible styles from @guardian/prosemirror-invisibles/dist/style.css */
88
-
89
- .invisible {
90
- /* Chrome in particular dislikes doing the right thing
91
- * with carets and inline elements when contenteditable
92
- * is 'false'. See e.g. https://github.com/ProseMirror/prosemirror/issues/1061
93
- */
94
- display: inline;
95
- position: relative;
96
- pointer-events: none;
97
- }
98
-
99
- .invisible:before {
100
- position: relative;
101
- caret-color: inherit;
102
- color: ${theme?.invisibles?.color ?? "gray"};
103
- display: inline-block;
104
- font-weight: 400;
105
- font-style: normal;
106
- line-height: initial;
107
- width: 0;
108
- top: 0;
109
- left: 0;
110
- z-index: 1;
111
- }
112
-
113
- .invisible__selected-marker {
114
- position: absolute;
115
- caret-color: inherit;
116
- background-color: #dcdcdc;
117
- display: inline-block;
118
- font-weight: 400;
119
- font-style: normal;
120
- line-height: initial;
121
- top: 0;
122
- left: 0;
123
- width: 10px;
124
- height: 100%;
125
- z-index: 0;
126
- }
127
-
128
- .ProseMirror-focused .invisible__selected-marker {
129
- background-color: #b4d9ff;
130
- }
131
-
132
- .ProseMirror-focused .invisible--is-selected::before {
133
- background-color: #b4d8ff;
134
- }
135
-
136
- .invisible--is-selected::before {
137
- background-color: #dcdcdc;
138
- }
139
-
140
- .invisible--space:before {
141
- content: '·';
142
- }
143
-
144
- .invisible--nb-space {
145
- vertical-align: text-bottom;
146
- }
147
-
148
- .invisible--nb-space:before {
149
- font-size: 15px;
150
- content: '^';
151
- position: absolute;
152
- top: 9px;
153
- left: -1px;
154
- }
155
-
156
- chip {
157
- border: ${theme?.chip?.border ?? "2px solid lightgrey"};
158
- border-radius: ${theme?.chip?.borderRadius ?? "8px"};
159
- padding: ${theme?.chip?.padding ?? "2px 4px"};
160
- color: ${theme?.chip?.color ?? "inherit"};
161
-
162
- cursor: default;
163
-
164
- &[data-type='tagged'] {
165
- background-color: ${theme?.chip?.taggedBackground ?? "lightgrey"};
166
- }
167
-
168
- &[data-type='untagged'] {
169
- color: ${theme?.chip?.untagged?.color ?? "inherit"};
170
- }
171
-
172
- ::after {
173
- content: '';
174
- display: inline-block;
175
- }
176
-
177
- span {
178
- cursor: pointer;
179
- margin-left: 5px;
180
- }
181
- }
182
-
183
- /* Leave space between subsequent chips */
184
- chip + chip {
185
- margin-left: 3px;
186
- }
187
-
188
- .placeholder {
189
- display: inline-block;
190
- height: 0;
191
- width: 0;
192
- white-space: nowrap;
193
- color: ${theme?.placeholder?.color ?? "#777575"};
194
- pointer-events: none;
195
- cursor: text;
196
- }
197
- `;
198
- const dropdownContainerStyles = (showDropdown, theme) => react.css`
199
- position: absolute;
200
- box-sizing: border-box;
201
- width: 100%;
202
- z-index: 1000;
203
- border: ${theme?.border ?? "1px solid #ccc"};
204
- background-color: ${theme?.background ?? "rgba(255, 255, 255, 0.8)"};
205
- display: ${showDropdown ? "block" : "none"};
206
- max-height: ${theme?.maxHeight ?? "320px"};
207
- overflow-y: auto;
208
- `;
209
- const dropdownUlStyles = react.css`
210
- margin: 0;
211
- padding: 0;
212
- list-style-type: none;
213
- `;
214
- const dropdownLiStyles = (theme) => react.css`
215
- cursor: pointer;
216
- padding: 5px;
217
- border-bottom: ${theme?.dropdown?.li?.borderBottom ?? "1px solid #ccc"};
218
- color: ${theme?.dropdown?.li?.color ?? "inherit"};
219
- `;
220
- const selectedDropdownLiStyles = (theme) => react.css`
221
- background-color: ${theme?.dropdown?.li?.selected?.background ?? "cadetblue"};
222
- color: ${theme?.dropdown?.li?.selected?.color ?? "white"};
223
- `;
224
- const previewStyles = react.css`
225
- margin-top: 5px;
226
- white-space: pre-wrap;
227
- `;
228
- const previewFreeTextStyles = react.css`
229
- font-style: italic;
230
- `;
231
- const previewContributorStyles = (node) => react.css`
232
- ${node.attrs.type === "tagged" ? "text-decoration: underline;" : ""}
233
- color: inherit;
234
- `;
235
-
236
- exports.bylineContainerStyles = bylineContainerStyles;
237
- exports.bylineEditorStyles = bylineEditorStyles;
238
- exports.dropdownContainerStyles = dropdownContainerStyles;
239
- exports.dropdownLiStyles = dropdownLiStyles;
240
- exports.dropdownUlStyles = dropdownUlStyles;
241
- exports.previewContributorStyles = previewContributorStyles;
242
- exports.previewFreeTextStyles = previewFreeTextStyles;
243
- exports.previewStyles = previewStyles;
244
- exports.selectedDropdownLiStyles = selectedDropdownLiStyles;
@@ -1,234 +0,0 @@
1
- import { css } from '@emotion/react';
2
-
3
- const bylineContainerStyles = css`
4
- position: relative;
5
- width: 100%;
6
- `;
7
- const bylineEditorStyles = (theme) => css`
8
- border: ${theme?.border ?? "1px black solid"};
9
- background-color: ${theme?.background ?? "white"};
10
- color: ${theme?.color ?? "inherit"};
11
-
12
- /* ProseMirror styles from prosemirror-view/styles/prosemirror.css */
13
- .ProseMirror {
14
- padding: 4px 4px;
15
- word-wrap: break-word;
16
- white-space: pre-wrap;
17
- white-space: break-spaces;
18
- -webkit-font-variant-ligatures: none;
19
- font-variant-ligatures: none;
20
- font-feature-settings: 'liga' 0; /* the above doesn't seem to work in Edge */
21
- line-height: ${theme?.lineHeight ?? "1.8"};
22
- }
23
-
24
- .ProseMirror[contenteditable='false'] {
25
- background: ${theme?.readOnlyBackground ?? "#dcdcdc"};
26
- cursor: 'not-allowed';
27
- }
28
-
29
- .ProseMirror pre {
30
- white-space: pre-wrap;
31
- }
32
-
33
- .ProseMirror li {
34
- position: relative;
35
- }
36
-
37
- .ProseMirror-hideselection *::selection {
38
- background: transparent;
39
- }
40
- .ProseMirror-hideselection *::-moz-selection {
41
- background: transparent;
42
- }
43
- .ProseMirror-hideselection {
44
- caret-color: transparent;
45
- }
46
-
47
- /* See https://github.com/ProseMirror/prosemirror/issues/1421#issuecomment-1759320191 */
48
- .ProseMirror [draggable][contenteditable='false'] {
49
- user-select: text;
50
- }
51
-
52
- .ProseMirror-selectednode {
53
- outline: ${theme?.chip?.selected?.border ?? "1px solid #b4d9ff"};
54
- }
55
-
56
- /* Make sure li selections wrap around markers */
57
-
58
- li.ProseMirror-selectednode {
59
- outline: none;
60
- }
61
-
62
- li.ProseMirror-selectednode:after {
63
- content: '';
64
- position: absolute;
65
- left: -32px;
66
- right: -2px;
67
- top: -2px;
68
- bottom: -2px;
69
- border: ${theme?.chip?.selected?.border ?? "1px solid #b4d9ff"};
70
- pointer-events: none;
71
- }
72
-
73
- /* Protect against generic img rules */
74
-
75
- img.ProseMirror-separator {
76
- display: inline !important;
77
- border: none !important;
78
- margin: 0 !important;
79
- }
80
-
81
- .ProseMirror:focus {
82
- outline: none;
83
- }
84
-
85
- /* Invisible styles from @guardian/prosemirror-invisibles/dist/style.css */
86
-
87
- .invisible {
88
- /* Chrome in particular dislikes doing the right thing
89
- * with carets and inline elements when contenteditable
90
- * is 'false'. See e.g. https://github.com/ProseMirror/prosemirror/issues/1061
91
- */
92
- display: inline;
93
- position: relative;
94
- pointer-events: none;
95
- }
96
-
97
- .invisible:before {
98
- position: relative;
99
- caret-color: inherit;
100
- color: ${theme?.invisibles?.color ?? "gray"};
101
- display: inline-block;
102
- font-weight: 400;
103
- font-style: normal;
104
- line-height: initial;
105
- width: 0;
106
- top: 0;
107
- left: 0;
108
- z-index: 1;
109
- }
110
-
111
- .invisible__selected-marker {
112
- position: absolute;
113
- caret-color: inherit;
114
- background-color: #dcdcdc;
115
- display: inline-block;
116
- font-weight: 400;
117
- font-style: normal;
118
- line-height: initial;
119
- top: 0;
120
- left: 0;
121
- width: 10px;
122
- height: 100%;
123
- z-index: 0;
124
- }
125
-
126
- .ProseMirror-focused .invisible__selected-marker {
127
- background-color: #b4d9ff;
128
- }
129
-
130
- .ProseMirror-focused .invisible--is-selected::before {
131
- background-color: #b4d8ff;
132
- }
133
-
134
- .invisible--is-selected::before {
135
- background-color: #dcdcdc;
136
- }
137
-
138
- .invisible--space:before {
139
- content: '·';
140
- }
141
-
142
- .invisible--nb-space {
143
- vertical-align: text-bottom;
144
- }
145
-
146
- .invisible--nb-space:before {
147
- font-size: 15px;
148
- content: '^';
149
- position: absolute;
150
- top: 9px;
151
- left: -1px;
152
- }
153
-
154
- chip {
155
- border: ${theme?.chip?.border ?? "2px solid lightgrey"};
156
- border-radius: ${theme?.chip?.borderRadius ?? "8px"};
157
- padding: ${theme?.chip?.padding ?? "2px 4px"};
158
- color: ${theme?.chip?.color ?? "inherit"};
159
-
160
- cursor: default;
161
-
162
- &[data-type='tagged'] {
163
- background-color: ${theme?.chip?.taggedBackground ?? "lightgrey"};
164
- }
165
-
166
- &[data-type='untagged'] {
167
- color: ${theme?.chip?.untagged?.color ?? "inherit"};
168
- }
169
-
170
- ::after {
171
- content: '';
172
- display: inline-block;
173
- }
174
-
175
- span {
176
- cursor: pointer;
177
- margin-left: 5px;
178
- }
179
- }
180
-
181
- /* Leave space between subsequent chips */
182
- chip + chip {
183
- margin-left: 3px;
184
- }
185
-
186
- .placeholder {
187
- display: inline-block;
188
- height: 0;
189
- width: 0;
190
- white-space: nowrap;
191
- color: ${theme?.placeholder?.color ?? "#777575"};
192
- pointer-events: none;
193
- cursor: text;
194
- }
195
- `;
196
- const dropdownContainerStyles = (showDropdown, theme) => css`
197
- position: absolute;
198
- box-sizing: border-box;
199
- width: 100%;
200
- z-index: 1000;
201
- border: ${theme?.border ?? "1px solid #ccc"};
202
- background-color: ${theme?.background ?? "rgba(255, 255, 255, 0.8)"};
203
- display: ${showDropdown ? "block" : "none"};
204
- max-height: ${theme?.maxHeight ?? "320px"};
205
- overflow-y: auto;
206
- `;
207
- const dropdownUlStyles = css`
208
- margin: 0;
209
- padding: 0;
210
- list-style-type: none;
211
- `;
212
- const dropdownLiStyles = (theme) => css`
213
- cursor: pointer;
214
- padding: 5px;
215
- border-bottom: ${theme?.dropdown?.li?.borderBottom ?? "1px solid #ccc"};
216
- color: ${theme?.dropdown?.li?.color ?? "inherit"};
217
- `;
218
- const selectedDropdownLiStyles = (theme) => css`
219
- background-color: ${theme?.dropdown?.li?.selected?.background ?? "cadetblue"};
220
- color: ${theme?.dropdown?.li?.selected?.color ?? "white"};
221
- `;
222
- const previewStyles = css`
223
- margin-top: 5px;
224
- white-space: pre-wrap;
225
- `;
226
- const previewFreeTextStyles = css`
227
- font-style: italic;
228
- `;
229
- const previewContributorStyles = (node) => css`
230
- ${node.attrs.type === "tagged" ? "text-decoration: underline;" : ""}
231
- color: inherit;
232
- `;
233
-
234
- export { bylineContainerStyles, bylineEditorStyles, dropdownContainerStyles, dropdownLiStyles, dropdownUlStyles, previewContributorStyles, previewFreeTextStyles, previewStyles, selectedDropdownLiStyles };
@@ -1,17 +0,0 @@
1
- import type { FocusEventHandler } from 'react';
2
- import type { BylineModel, TaggedContributor } from './lib';
3
- import type { PartialBylineTheme } from './theme';
4
- type BylineProps = {
5
- theme?: PartialBylineTheme;
6
- allowUntaggedContributors?: boolean;
7
- contributorLimit?: number;
8
- enablePreview?: boolean;
9
- placeholder?: string;
10
- initialValue?: BylineModel;
11
- readOnly?: boolean;
12
- handleSave: (newValue: BylineModel) => void;
13
- searchContributors?: (selectedText: string) => Promise<TaggedContributor[]>;
14
- onBlur?: FocusEventHandler<HTMLDivElement>;
15
- };
16
- export declare const Byline: ({ theme, allowUntaggedContributors, contributorLimit, enablePreview, placeholder, initialValue, readOnly, handleSave, searchContributors, onBlur, }: BylineProps) => import("@emotion/react/jsx-runtime").JSX.Element;
17
- export {};
@@ -1,11 +0,0 @@
1
- import type { Node } from 'prosemirror-model';
2
- import type { PartialBylineTheme } from './theme';
3
- export declare const bylineContainerStyles: import("@emotion/react").SerializedStyles;
4
- export declare const bylineEditorStyles: (theme: PartialBylineTheme['editor']) => import("@emotion/react").SerializedStyles;
5
- export declare const dropdownContainerStyles: (showDropdown: boolean, theme?: PartialBylineTheme['dropdown']) => import("@emotion/react").SerializedStyles;
6
- export declare const dropdownUlStyles: import("@emotion/react").SerializedStyles;
7
- export declare const dropdownLiStyles: (theme?: PartialBylineTheme) => import("@emotion/react").SerializedStyles;
8
- export declare const selectedDropdownLiStyles: (theme?: PartialBylineTheme) => import("@emotion/react").SerializedStyles;
9
- export declare const previewStyles: import("@emotion/react").SerializedStyles;
10
- export declare const previewFreeTextStyles: import("@emotion/react").SerializedStyles;
11
- export declare const previewContributorStyles: (node: Node) => import("@emotion/react").SerializedStyles;
@@ -1,44 +0,0 @@
1
- import type { DeepPartial } from './util';
2
- type BylineTheme = {
3
- editor: {
4
- invisibles: {
5
- color: string;
6
- };
7
- color: string;
8
- border: string;
9
- background: string;
10
- chip: {
11
- color: string;
12
- border: string;
13
- padding: string;
14
- borderRadius: string;
15
- taggedBackground: string;
16
- untagged: {
17
- color: string;
18
- };
19
- selected: {
20
- border: string;
21
- };
22
- };
23
- lineHeight: string;
24
- placeholder: {
25
- color: string;
26
- };
27
- readOnlyBackground: string;
28
- };
29
- dropdown: {
30
- background: string;
31
- border: string;
32
- maxHeight: string;
33
- li: {
34
- color: string;
35
- borderBottom: string;
36
- selected: {
37
- background: string;
38
- color: string;
39
- };
40
- };
41
- };
42
- };
43
- export type PartialBylineTheme = DeepPartial<BylineTheme>;
44
- export {};
File without changes
File without changes
File without changes
File without changes