@guardian/stand 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +394 -7
- package/dist/{byline → components/byline}/Byline.cjs +5 -5
- package/dist/{byline → components/byline}/Byline.js +5 -5
- package/dist/components/byline/styles.cjs +266 -0
- package/dist/components/byline/styles.js +256 -0
- package/dist/components/tag-picker/TagAutocomplete.cjs +107 -0
- package/dist/components/tag-picker/TagAutocomplete.js +26 -0
- package/dist/components/tag-picker/TagTable.cjs +203 -0
- package/dist/components/tag-picker/TagTable.js +91 -0
- package/dist/components/tag-picker/styles.cjs +198 -0
- package/dist/components/tag-picker/styles.js +185 -0
- package/dist/components/util.cjs +19 -0
- package/dist/components/util.js +17 -0
- package/dist/index.cjs +15 -1
- package/dist/index.js +8 -1
- package/dist/styleD/build/css/css/base/colors.css +122 -0
- package/dist/styleD/build/css/css/base/typography.css +43 -0
- package/dist/styleD/build/css/css/component/byline.css +36 -0
- package/dist/styleD/build/css/css/component/tagAutocomplete.css +23 -0
- package/dist/styleD/build/css/css/component/tagTable.css +39 -0
- package/dist/styleD/build/css/css/semantic/colors.css +27 -0
- package/dist/styleD/build/css/css/semantic/typography.css +138 -0
- package/dist/styleD/build/typescript/base/colors.cjs +144 -0
- package/dist/styleD/build/typescript/base/colors.js +142 -0
- package/dist/styleD/build/typescript/base/typography.cjs +65 -0
- package/dist/styleD/build/typescript/base/typography.js +63 -0
- package/dist/styleD/build/typescript/component/byline.cjs +42 -0
- package/dist/styleD/build/typescript/component/byline.js +40 -0
- package/dist/styleD/build/typescript/component/tagAutocomplete.cjs +29 -0
- package/dist/styleD/build/typescript/component/tagAutocomplete.js +27 -0
- package/dist/styleD/build/typescript/component/tagTable.cjs +53 -0
- package/dist/styleD/build/typescript/component/tagTable.js +51 -0
- package/dist/styleD/build/typescript/semantic/colors.cjs +37 -0
- package/dist/styleD/build/typescript/semantic/colors.js +35 -0
- package/dist/styleD/build/typescript/semantic/typography.cjs +462 -0
- package/dist/styleD/build/typescript/semantic/typography.js +460 -0
- package/dist/styleD/utils/semantic/typography.cjs +17 -0
- package/dist/styleD/utils/semantic/typography.js +15 -0
- package/dist/types/components/byline/Byline.d.ts +83 -0
- package/dist/types/components/byline/styles.d.ts +13 -0
- package/dist/types/components/byline/theme.d.ts +3 -0
- package/dist/types/components/tag-picker/TagAutocomplete.d.ts +117 -0
- package/dist/types/components/tag-picker/TagTable.d.ts +126 -0
- package/dist/types/components/tag-picker/example-tags.d.ts +2 -0
- package/dist/types/components/tag-picker/styles.d.ts +16 -0
- package/dist/types/components/tag-picker/types.d.ts +65 -0
- package/dist/types/{byline → components}/util.d.ts +1 -0
- package/dist/types/index.d.ts +26 -2
- package/dist/types/styleD/build/typescript/base/colors.d.ts +144 -0
- package/dist/types/styleD/build/typescript/base/typography.d.ts +65 -0
- package/dist/types/styleD/build/typescript/component/byline.d.ts +42 -0
- package/dist/types/styleD/build/typescript/component/tagAutocomplete.d.ts +29 -0
- package/dist/types/styleD/build/typescript/component/tagTable.d.ts +53 -0
- package/dist/types/styleD/build/typescript/semantic/colors.d.ts +37 -0
- package/dist/types/styleD/build/typescript/semantic/typography.d.ts +462 -0
- package/dist/types/styleD/stories/base/Typography.d.ts +1 -0
- package/dist/types/styleD/stories/base/storybookColorPalette.d.ts +19 -0
- package/dist/types/styleD/stories/semantic/TypographyPresets.d.ts +1 -0
- package/dist/types/styleD/utils/semantic/typography.d.ts +15 -0
- package/dist/types/styleD/utils/semantic/typography.test.d.ts +1 -0
- package/package.json +67 -22
- package/dist/byline/styles.cjs +0 -244
- package/dist/byline/styles.js +0 -234
- package/dist/types/byline/Byline.d.ts +0 -17
- package/dist/types/byline/styles.d.ts +0 -11
- package/dist/types/byline/theme.d.ts +0 -44
- /package/dist/{byline → components/byline}/Preview.cjs +0 -0
- /package/dist/{byline → components/byline}/Preview.js +0 -0
- /package/dist/{byline → components/byline}/lib.cjs +0 -0
- /package/dist/{byline → components/byline}/lib.js +0 -0
- /package/dist/{byline → components/byline}/placeholder.cjs +0 -0
- /package/dist/{byline → components/byline}/placeholder.js +0 -0
- /package/dist/{byline → components/byline}/plugins.cjs +0 -0
- /package/dist/{byline → components/byline}/plugins.js +0 -0
- /package/dist/{byline → components/byline}/schema.cjs +0 -0
- /package/dist/{byline → components/byline}/schema.js +0 -0
- /package/dist/types/{byline → components/byline}/Preview.d.ts +0 -0
- /package/dist/types/{byline → components/byline}/contributors-fixture.d.ts +0 -0
- /package/dist/types/{byline → components/byline}/lib.d.ts +0 -0
- /package/dist/types/{byline → components/byline}/lib.test.d.ts +0 -0
- /package/dist/types/{byline → components/byline}/placeholder.d.ts +0 -0
- /package/dist/types/{byline → components/byline}/plugins.d.ts +0 -0
- /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.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
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,31 @@
|
|
|
17
26
|
"main": "./dist/index.cjs",
|
|
18
27
|
"types": "./dist/types/index.d.ts",
|
|
19
28
|
"devDependencies": {
|
|
20
|
-
"@changesets/cli": "^2.29.
|
|
29
|
+
"@changesets/cli": "^2.29.8",
|
|
21
30
|
"@emotion/react": "11.11.4",
|
|
22
|
-
"@
|
|
23
|
-
"@guardian/
|
|
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.
|
|
26
|
-
"@playwright/experimental-ct-react17": "^1.
|
|
27
|
-
"@rollup/plugin-commonjs": "
|
|
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": "^
|
|
31
|
-
"@storybook/addon-themes": "^
|
|
32
|
-
"@storybook/react-vite": "^
|
|
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",
|
|
33
44
|
"@types/jest": "30.0.0",
|
|
34
|
-
"@types/node": "^24.
|
|
45
|
+
"@types/node": "^24.10.1",
|
|
35
46
|
"@types/react": "17.0.76",
|
|
36
47
|
"@types/react-dom": "17.0.25",
|
|
37
|
-
"
|
|
38
|
-
"eslint
|
|
48
|
+
"change-case": "^5.4.4",
|
|
49
|
+
"eslint": "9.39.2",
|
|
50
|
+
"eslint-plugin-storybook": "^10.1.11",
|
|
39
51
|
"jest": "30.2.0",
|
|
40
52
|
"jest-environment-jsdom": "^30.1.2",
|
|
41
|
-
"prettier": "3.
|
|
53
|
+
"prettier": "3.7.4",
|
|
42
54
|
"prosemirror-dropcursor": "1.8.2",
|
|
43
55
|
"prosemirror-history": "1.4.1",
|
|
44
56
|
"prosemirror-keymap": "1.2.2",
|
|
@@ -46,13 +58,16 @@
|
|
|
46
58
|
"prosemirror-state": "1.4.3",
|
|
47
59
|
"prosemirror-view": "1.37.2",
|
|
48
60
|
"react": "17.0.2",
|
|
61
|
+
"react-aria-components": "1.13.0",
|
|
49
62
|
"react-dom": "17.0.2",
|
|
50
|
-
"rimraf": "6.
|
|
51
|
-
"rollup": "4.
|
|
63
|
+
"rimraf": "6.1.2",
|
|
64
|
+
"rollup": "4.54.0",
|
|
65
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
52
66
|
"rollup-plugin-esbuild": "6.2.1",
|
|
53
|
-
"rollup-plugin-node-externals": "8.1.
|
|
54
|
-
"storybook": "^
|
|
55
|
-
"
|
|
67
|
+
"rollup-plugin-node-externals": "8.1.2",
|
|
68
|
+
"storybook": "^10.1.11",
|
|
69
|
+
"style-dictionary": "^5.1.1",
|
|
70
|
+
"ts-jest": "29.4.6",
|
|
56
71
|
"tslib": "2.8.1",
|
|
57
72
|
"typescript": "5.1.3"
|
|
58
73
|
},
|
|
@@ -66,13 +81,43 @@
|
|
|
66
81
|
"prosemirror-state": "1.4.3",
|
|
67
82
|
"prosemirror-view": "1.37.2",
|
|
68
83
|
"react": "^17.0.2 || ^18.0.0 || ^19.0.0",
|
|
84
|
+
"react-aria-components": "1.13.0",
|
|
69
85
|
"react-dom": "^17.0.2 || ^18.0.0 || ^19.0.0",
|
|
70
86
|
"typescript": ">=5.0.0 <=5.9.3"
|
|
71
87
|
},
|
|
88
|
+
"peerDependenciesMeta": {
|
|
89
|
+
"@guardian/prosemirror-invisibles": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"prosemirror-dropcursor": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"prosemirror-history": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"prosemirror-keymap": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"prosemirror-model": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"prosemirror-state": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"prosemirror-view": {
|
|
108
|
+
"optional": true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
72
111
|
"scripts": {
|
|
73
112
|
"build": "rimraf dist && rollup -c",
|
|
113
|
+
"build-styled": "cd src/styleD && node build.js",
|
|
74
114
|
"storybook": "storybook dev -p 6007",
|
|
75
115
|
"build-storybook": "storybook build",
|
|
116
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
117
|
+
"lint:fix": "eslint --fix . --ext .ts,.tsx",
|
|
118
|
+
"lint:tokens": "tz check",
|
|
119
|
+
"format:check": "prettier --check .",
|
|
120
|
+
"format:fix": "prettier --write .",
|
|
76
121
|
"tsc": "tsc",
|
|
77
122
|
"test": "jest",
|
|
78
123
|
"test:e2e": "playwright test -c playwright-ct.config.ts",
|
package/dist/byline/styles.cjs
DELETED
|
@@ -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;
|
package/dist/byline/styles.js
DELETED
|
@@ -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
|
|
File without changes
|