@atlaskit/editor-plugin-extension 0.5.1 → 0.6.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#67100](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67100) [`55cdf07c41cb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/55cdf07c41cb) - Allow create label formatting for custom fields from extension
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 0.5.2
14
+
15
+ ### Patch Changes
16
+
17
+ - [#66759](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66759) [`906578f1ea5d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/906578f1ea5d) - [ux] ED-21787: Migrating few CSS entries to space and color tokens
18
+
3
19
  ## 0.5.1
4
20
 
5
21
  ### Patch Changes
@@ -26,7 +26,7 @@ var toggleFieldWrapperStyles = (0, _react2.css)({
26
26
  });
27
27
  var toggleLabelStyles = (0, _react2.css)({
28
28
  display: 'flex',
29
- padding: '3px 3px 3px 0px',
29
+ padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-050, 4px)", " ", "var(--ds-space-050, 4px)", " ", "var(--ds-space-0, 0px)"),
30
30
  flexGrow: 1
31
31
  });
32
32
  function _validate(value, isRequired) {
@@ -362,7 +362,10 @@ var ColorPicker = function ColorPicker(props) {
362
362
  height: "var(--ds-space-300, 24px)"
363
363
  }
364
364
  /* ED-18288 We align the palette to the right edge which is 1.5rem spacing away to avoid
365
- excess overflow on left. Additional 1 is to mitigate 1px added by floating toolbar. */,
365
+ excess overflow on left. Additional 1 is to mitigate 1px added by floating toolbar. */
366
+ // Disabling design token check as this is a calculated value
367
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
368
+ ,
366
369
  absoluteOffset: {
367
370
  right: Number(-1.5 * getCurrentRemSize() - 1)
368
371
  }
@@ -142,7 +142,8 @@ function CustomSelect(_ref2) {
142
142
  var message = intl.formatMessage(_messages.messages.createOption);
143
143
  return "".concat(message, " \"").concat(value, "\"");
144
144
  }
145
- var isCreatable = options.isCreatable;
145
+ var isCreatable = options.isCreatable,
146
+ customFormatCreateLabel = options.formatCreateLabel;
146
147
  return /*#__PURE__*/_react.default.createElement(_form.Field, {
147
148
  name: name,
148
149
  label: label,
@@ -172,7 +173,7 @@ function CustomSelect(_ref2) {
172
173
  validationState: error ? 'error' : 'default',
173
174
  defaultOptions: defaultOptions,
174
175
  formatCreateLabel: function formatCreateLabel(value) {
175
- return _formatCreateLabel(value);
176
+ return customFormatCreateLabel ? customFormatCreateLabel(value) : _formatCreateLabel(value);
176
177
  },
177
178
  formatOptionLabel: _SelectItem.formatOptionLabel,
178
179
  loadOptions: function loadOptions(searchTerm) {
@@ -22,9 +22,11 @@ var itemWrapperStyles = (0, _react.css)({
22
22
  var iconWrapperStyles = (0, _react.css)({
23
23
  lineHeight: 1
24
24
  });
25
+
26
+ // Adding 4px instead of 3px, since Design tokens supports space sizes in 2 multiples only Ref: https://atlassian.design/components/tokens/all-tokens
25
27
  var iconWrapperMenuStyles = (0, _react.css)({
26
28
  alignSelf: 'flex-start',
27
- marginTop: '3px'
29
+ marginTop: "var(--ds-space-050, 4px)"
28
30
  });
29
31
  var getIconSize = function getIconSize(context, description) {
30
32
  if (context === 'value' || !description) {
@@ -13,7 +13,7 @@ const toggleFieldWrapperStyles = css({
13
13
  });
14
14
  const toggleLabelStyles = css({
15
15
  display: 'flex',
16
- padding: '3px 3px 3px 0px',
16
+ padding: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-0, 0px)"}`,
17
17
  flexGrow: 1
18
18
  });
19
19
  function validate(value, isRequired) {
@@ -353,7 +353,10 @@ const ColorPicker = props => {
353
353
  height: "var(--ds-space-300, 24px)"
354
354
  }
355
355
  /* ED-18288 We align the palette to the right edge which is 1.5rem spacing away to avoid
356
- excess overflow on left. Additional 1 is to mitigate 1px added by floating toolbar. */,
356
+ excess overflow on left. Additional 1 is to mitigate 1px added by floating toolbar. */
357
+ // Disabling design token check as this is a calculated value
358
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
359
+ ,
357
360
  absoluteOffset: {
358
361
  right: Number(-1.5 * getCurrentRemSize() - 1)
359
362
  }
@@ -88,7 +88,8 @@ function CustomSelect({
88
88
  return `${message} "${value}"`;
89
89
  }
90
90
  const {
91
- isCreatable
91
+ isCreatable,
92
+ formatCreateLabel: customFormatCreateLabel
92
93
  } = options;
93
94
  return /*#__PURE__*/React.createElement(Field, {
94
95
  name: name,
@@ -114,7 +115,7 @@ function CustomSelect({
114
115
  isValidNewOption: value => !!(isCreatable && value),
115
116
  validationState: error ? 'error' : 'default',
116
117
  defaultOptions: defaultOptions,
117
- formatCreateLabel: value => formatCreateLabel(value),
118
+ formatCreateLabel: value => customFormatCreateLabel ? customFormatCreateLabel(value) : formatCreateLabel(value),
118
119
  formatOptionLabel: formatOptionLabel,
119
120
  loadOptions: searchTerm => {
120
121
  return resolver(searchTerm, fieldDefaultValue, parameters);
@@ -14,9 +14,11 @@ const itemWrapperStyles = css({
14
14
  const iconWrapperStyles = css({
15
15
  lineHeight: 1
16
16
  });
17
+
18
+ // Adding 4px instead of 3px, since Design tokens supports space sizes in 2 multiples only Ref: https://atlassian.design/components/tokens/all-tokens
17
19
  const iconWrapperMenuStyles = css({
18
20
  alignSelf: 'flex-start',
19
- marginTop: '3px'
21
+ marginTop: "var(--ds-space-050, 4px)"
20
22
  });
21
23
  const getIconSize = (context, description) => {
22
24
  if (context === 'value' || !description) {
@@ -16,7 +16,7 @@ var toggleFieldWrapperStyles = css({
16
16
  });
17
17
  var toggleLabelStyles = css({
18
18
  display: 'flex',
19
- padding: '3px 3px 3px 0px',
19
+ padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-050, 4px)", " ", "var(--ds-space-050, 4px)", " ", "var(--ds-space-0, 0px)"),
20
20
  flexGrow: 1
21
21
  });
22
22
  function _validate(value, isRequired) {
@@ -356,7 +356,10 @@ var ColorPicker = function ColorPicker(props) {
356
356
  height: "var(--ds-space-300, 24px)"
357
357
  }
358
358
  /* ED-18288 We align the palette to the right edge which is 1.5rem spacing away to avoid
359
- excess overflow on left. Additional 1 is to mitigate 1px added by floating toolbar. */,
359
+ excess overflow on left. Additional 1 is to mitigate 1px added by floating toolbar. */
360
+ // Disabling design token check as this is a calculated value
361
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
362
+ ,
360
363
  absoluteOffset: {
361
364
  right: Number(-1.5 * getCurrentRemSize() - 1)
362
365
  }
@@ -132,7 +132,8 @@ function CustomSelect(_ref2) {
132
132
  var message = intl.formatMessage(messages.createOption);
133
133
  return "".concat(message, " \"").concat(value, "\"");
134
134
  }
135
- var isCreatable = options.isCreatable;
135
+ var isCreatable = options.isCreatable,
136
+ customFormatCreateLabel = options.formatCreateLabel;
136
137
  return /*#__PURE__*/React.createElement(Field, {
137
138
  name: name,
138
139
  label: label,
@@ -162,7 +163,7 @@ function CustomSelect(_ref2) {
162
163
  validationState: error ? 'error' : 'default',
163
164
  defaultOptions: defaultOptions,
164
165
  formatCreateLabel: function formatCreateLabel(value) {
165
- return _formatCreateLabel(value);
166
+ return customFormatCreateLabel ? customFormatCreateLabel(value) : _formatCreateLabel(value);
166
167
  },
167
168
  formatOptionLabel: formatOptionLabel,
168
169
  loadOptions: function loadOptions(searchTerm) {
@@ -14,9 +14,11 @@ var itemWrapperStyles = css({
14
14
  var iconWrapperStyles = css({
15
15
  lineHeight: 1
16
16
  });
17
+
18
+ // Adding 4px instead of 3px, since Design tokens supports space sizes in 2 multiples only Ref: https://atlassian.design/components/tokens/all-tokens
17
19
  var iconWrapperMenuStyles = css({
18
20
  alignSelf: 'flex-start',
19
- marginTop: '3px'
21
+ marginTop: "var(--ds-space-050, 4px)"
20
22
  });
21
23
  var getIconSize = function getIconSize(context, description) {
22
24
  if (context === 'value' || !description) {
@@ -565,6 +565,21 @@ export const customFields: FieldDefinition[] = [
565
565
  },
566
566
  },
567
567
  },
568
+ {
569
+ name: 'custom-format-create-label',
570
+ type: 'custom',
571
+ label: 'Custom: Customized create label',
572
+ description: 'Select or create an option with a custom label',
573
+ options: {
574
+ isCreatable: true,
575
+ formatCreateLabel: (value: string) => {
576
+ return `Add "${value}" to the list`;
577
+ },
578
+ resolver: {
579
+ type: 'mock-resolver',
580
+ },
581
+ },
582
+ },
568
583
  {
569
584
  name: 'unsupported',
570
585
  type: 'custom',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/button": "^17.2.0",
32
32
  "@atlaskit/checkbox": "^13.0.0",
33
33
  "@atlaskit/datetime-picker": "^13.0.3",
34
- "@atlaskit/editor-common": "^76.39.0",
34
+ "@atlaskit/editor-common": "^76.41.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.10.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
37
37
  "@atlaskit/editor-plugin-context-panel": "^0.2.0",