@webstudio-is/sdk-components-react 0.87.1 → 0.88.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.
@@ -344,12 +344,6 @@ const props = {
344
344
  color: { required: false, control: "color", type: "string" },
345
345
  content: { required: false, control: "text", type: "string" },
346
346
  contextMenu: { required: false, control: "text", type: "string" },
347
- crossOrigin: {
348
- required: false,
349
- control: "radio",
350
- type: "string",
351
- options: ["", "anonymous", "use-credentials"]
352
- },
353
347
  datatype: { required: false, control: "text", type: "string" },
354
348
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
355
349
  dir: { required: false, control: "text", type: "string" },
@@ -18,7 +18,7 @@ const props = {
18
18
  required: false,
19
19
  control: "select",
20
20
  type: "string",
21
- options: ["inline", "list", "none", "both"]
21
+ options: ["list", "none", "inline", "both"]
22
22
  },
23
23
  "aria-braillelabel": {
24
24
  description: "Defines a string value that labels the current element, which is intended to be converted into Braille.\n@see aria-label.",
@@ -346,12 +346,6 @@ const props = {
346
346
  draggable: { required: false, control: "boolean", type: "boolean" },
347
347
  hidden: { required: false, control: "boolean", type: "boolean" },
348
348
  id: { required: false, control: "text", type: "string" },
349
- inline: {
350
- required: false,
351
- control: "boolean",
352
- type: "boolean",
353
- defaultValue: false
354
- },
355
349
  inputMode: {
356
350
  description: "Hints at the type of data that might be entered by the user while editing the element or its contents\n@see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute",
357
351
  required: false,
@@ -380,7 +374,6 @@ const props = {
380
374
  itemScope: { required: false, control: "boolean", type: "boolean" },
381
375
  itemType: { required: false, control: "text", type: "string" },
382
376
  lang: { required: false, control: "text", type: "string" },
383
- meta: { required: false, control: "text", type: "string" },
384
377
  nonce: { required: false, control: "text", type: "string" },
385
378
  placeholder: { required: false, control: "text", type: "string" },
386
379
  prefix: { required: false, control: "text", type: "string" },
@@ -344,12 +344,6 @@ const props = {
344
344
  color: { required: false, control: "color", type: "string" },
345
345
  content: { required: false, control: "text", type: "string" },
346
346
  contextMenu: { required: false, control: "text", type: "string" },
347
- crossOrigin: {
348
- required: false,
349
- control: "radio",
350
- type: "string",
351
- options: ["", "anonymous", "use-credentials"]
352
- },
353
347
  datatype: { required: false, control: "text", type: "string" },
354
348
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
355
349
  dir: { required: false, control: "text", type: "string" },
@@ -344,12 +344,6 @@ const props = {
344
344
  color: { required: false, control: "color", type: "string" },
345
345
  content: { required: false, control: "text", type: "string" },
346
346
  contextMenu: { required: false, control: "text", type: "string" },
347
- crossOrigin: {
348
- required: false,
349
- control: "radio",
350
- type: "string",
351
- options: ["", "anonymous", "use-credentials"]
352
- },
353
347
  datatype: { required: false, control: "text", type: "string" },
354
348
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
355
349
  dir: { required: false, control: "text", type: "string" },
@@ -400,10 +400,10 @@ const props = {
400
400
  tabIndex: { required: false, control: "number", type: "number" },
401
401
  tag: {
402
402
  required: false,
403
- control: "radio",
403
+ control: "select",
404
404
  type: "string",
405
405
  defaultValue: "div",
406
- options: ["div", "figcaption", "span"]
406
+ options: ["div", "cite", "figcaption", "span"]
407
407
  },
408
408
  title: { required: false, control: "text", type: "string" },
409
409
  translate: {
@@ -69,7 +69,7 @@ const meta = {
69
69
  };
70
70
  const propsMeta = {
71
71
  props,
72
- initialProps: ["id"]
72
+ initialProps: ["id", "cite"]
73
73
  };
74
74
  export {
75
75
  meta,
@@ -367,12 +367,6 @@ const props = {
367
367
  color: { required: false, control: "color", type: "string" },
368
368
  content: { required: false, control: "text", type: "string" },
369
369
  contextMenu: { required: false, control: "text", type: "string" },
370
- crossOrigin: {
371
- required: false,
372
- control: "radio",
373
- type: "string",
374
- options: ["", "anonymous", "use-credentials"]
375
- },
376
370
  datatype: { required: false, control: "text", type: "string" },
377
371
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
378
372
  dir: { required: false, control: "text", type: "string" },
@@ -41,7 +41,7 @@ const props = {
41
41
  required: false,
42
42
  control: "select",
43
43
  type: "string",
44
- options: ["inline", "list", "none", "both"]
44
+ options: ["list", "none", "inline", "both"]
45
45
  },
46
46
  "aria-braillelabel": {
47
47
  description: "Defines a string value that labels the current element, which is intended to be converted into Braille.\n@see aria-label.",
@@ -369,12 +369,6 @@ const props = {
369
369
  draggable: { required: false, control: "boolean", type: "boolean" },
370
370
  hidden: { required: false, control: "boolean", type: "boolean" },
371
371
  id: { required: false, control: "text", type: "string" },
372
- inline: {
373
- required: false,
374
- control: "boolean",
375
- type: "boolean",
376
- defaultValue: false
377
- },
378
372
  inputMode: {
379
373
  description: "Hints at the type of data that might be entered by the user while editing the element or its contents\n@see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute",
380
374
  required: false,
@@ -403,7 +397,6 @@ const props = {
403
397
  itemScope: { required: false, control: "boolean", type: "boolean" },
404
398
  itemType: { required: false, control: "text", type: "string" },
405
399
  lang: { required: false, control: "text", type: "string" },
406
- meta: { required: false, control: "text", type: "string" },
407
400
  nonce: { required: false, control: "text", type: "string" },
408
401
  placeholder: { required: false, control: "text", type: "string" },
409
402
  prefix: { required: false, control: "text", type: "string" },
@@ -367,12 +367,6 @@ const props = {
367
367
  color: { required: false, control: "color", type: "string" },
368
368
  content: { required: false, control: "text", type: "string" },
369
369
  contextMenu: { required: false, control: "text", type: "string" },
370
- crossOrigin: {
371
- required: false,
372
- control: "radio",
373
- type: "string",
374
- options: ["", "anonymous", "use-credentials"]
375
- },
376
370
  datatype: { required: false, control: "text", type: "string" },
377
371
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
378
372
  dir: { required: false, control: "text", type: "string" },
@@ -367,12 +367,6 @@ const props = {
367
367
  color: { required: false, control: "color", type: "string" },
368
368
  content: { required: false, control: "text", type: "string" },
369
369
  contextMenu: { required: false, control: "text", type: "string" },
370
- crossOrigin: {
371
- required: false,
372
- control: "radio",
373
- type: "string",
374
- options: ["", "anonymous", "use-credentials"]
375
- },
376
370
  datatype: { required: false, control: "text", type: "string" },
377
371
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
378
372
  dir: { required: false, control: "text", type: "string" },
@@ -423,10 +423,10 @@ const props = {
423
423
  tabIndex: { required: false, control: "number", type: "number" },
424
424
  tag: {
425
425
  required: false,
426
- control: "radio",
426
+ control: "select",
427
427
  type: "string",
428
428
  defaultValue: "div",
429
- options: ["div", "figcaption", "span"]
429
+ options: ["div", "cite", "figcaption", "span"]
430
430
  },
431
431
  title: { required: false, control: "text", type: "string" },
432
432
  translate: {
@@ -91,5 +91,5 @@ const meta = {
91
91
  };
92
92
  const propsMeta = {
93
93
  props: import_blockquote.props,
94
- initialProps: ["id"]
94
+ initialProps: ["id", "cite"]
95
95
  };
@@ -19,21 +19,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var code_text_exports = {};
20
20
  __export(code_text_exports, {
21
21
  CodeText: () => CodeText,
22
- defaultTag: () => defaultTag,
23
- displayVarNamespace: () => displayVarNamespace
22
+ defaultTag: () => defaultTag
24
23
  });
25
24
  module.exports = __toCommonJS(code_text_exports);
26
25
  var import_react = require("react");
27
- var import_css_vars = require("@webstudio-is/css-vars");
28
26
  const defaultTag = "code";
29
- const displayVarNamespace = import_css_vars.cssVars.define("code-display");
30
- const blockStyle = {
31
- [import_css_vars.cssVars.define(displayVarNamespace)]: "block"
32
- };
33
- const CodeText = (0, import_react.forwardRef)(
34
- ({ inline = false, ...props }, ref) => {
35
- const style = inline ? void 0 : blockStyle;
36
- return (0, import_react.createElement)(defaultTag, { ...props, style, ref });
37
- }
38
- );
27
+ const CodeText = (0, import_react.forwardRef)((props, ref) => {
28
+ return (0, import_react.createElement)(defaultTag, { ...props, ref });
29
+ });
39
30
  CodeText.displayName = "CodeText";
@@ -25,18 +25,17 @@ module.exports = __toCommonJS(code_text_ws_exports);
25
25
  var import_svg = require("@webstudio-is/icons/svg");
26
26
  var import_react_sdk = require("@webstudio-is/react-sdk");
27
27
  var import_css_normalize = require("@webstudio-is/react-sdk/css-normalize");
28
- var import_code_text = require("./code-text");
29
- var import_code_text2 = require("./__generated__/code-text.props");
28
+ var import_code_text = require("./__generated__/code-text.props");
30
29
  const presetStyle = {
31
30
  code: [
32
31
  ...import_css_normalize.code,
33
32
  {
34
33
  property: "display",
35
- value: {
36
- type: "var",
37
- value: import_code_text.displayVarNamespace,
38
- fallbacks: [{ type: "keyword", value: "inline-block" }]
39
- }
34
+ value: { type: "keyword", value: "block" }
35
+ },
36
+ {
37
+ property: "whiteSpace",
38
+ value: { type: "keyword", value: "pre-wrap" }
40
39
  },
41
40
  {
42
41
  property: "paddingLeft",
@@ -69,6 +68,6 @@ const meta = {
69
68
  order: 8
70
69
  };
71
70
  const propsMeta = {
72
- props: import_code_text2.props,
73
- initialProps: ["id", "inline", "lang", "meta"]
71
+ props: import_code_text.props,
72
+ initialProps: ["id", "lang"]
74
73
  };
package/lib/code-text.js CHANGED
@@ -2,21 +2,12 @@ import {
2
2
  forwardRef,
3
3
  createElement
4
4
  } from "react";
5
- import { cssVars } from "@webstudio-is/css-vars";
6
5
  const defaultTag = "code";
7
- const displayVarNamespace = cssVars.define("code-display");
8
- const blockStyle = {
9
- [cssVars.define(displayVarNamespace)]: "block"
10
- };
11
- const CodeText = forwardRef(
12
- ({ inline = false, ...props }, ref) => {
13
- const style = inline ? void 0 : blockStyle;
14
- return createElement(defaultTag, { ...props, style, ref });
15
- }
16
- );
6
+ const CodeText = forwardRef((props, ref) => {
7
+ return createElement(defaultTag, { ...props, ref });
8
+ });
17
9
  CodeText.displayName = "CodeText";
18
10
  export {
19
11
  CodeText,
20
- defaultTag,
21
- displayVarNamespace
12
+ defaultTag
22
13
  };
@@ -3,18 +3,17 @@ import {
3
3
  defaultStates
4
4
  } from "@webstudio-is/react-sdk";
5
5
  import { code } from "@webstudio-is/react-sdk/css-normalize";
6
- import { displayVarNamespace } from "./code-text";
7
6
  import { props } from "./__generated__/code-text.props";
8
7
  const presetStyle = {
9
8
  code: [
10
9
  ...code,
11
10
  {
12
11
  property: "display",
13
- value: {
14
- type: "var",
15
- value: displayVarNamespace,
16
- fallbacks: [{ type: "keyword", value: "inline-block" }]
17
- }
12
+ value: { type: "keyword", value: "block" }
13
+ },
14
+ {
15
+ property: "whiteSpace",
16
+ value: { type: "keyword", value: "pre-wrap" }
18
17
  },
19
18
  {
20
19
  property: "paddingLeft",
@@ -48,7 +47,7 @@ const meta = {
48
47
  };
49
48
  const propsMeta = {
50
49
  props,
51
- initialProps: ["id", "inline", "lang", "meta"]
50
+ initialProps: ["id", "lang"]
52
51
  };
53
52
  export {
54
53
  meta,
@@ -1,9 +1,3 @@
1
- import { type ComponentProps } from "react";
1
+ /// <reference types="react" />
2
2
  export declare const defaultTag = "code";
3
- export declare const displayVarNamespace: "--code-display-w7ovd";
4
- type Props = Omit<ComponentProps<typeof defaultTag>, "inline"> & {
5
- inline?: boolean;
6
- meta?: string;
7
- };
8
- export declare const CodeText: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLElement>>;
9
- export {};
3
+ export declare const CodeText: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & import("react").RefAttributes<HTMLElement>>;
@@ -1,7 +1,7 @@
1
1
  import { type ComponentProps } from "react";
2
2
  export declare const defaultTag = "div";
3
3
  type Props = ComponentProps<typeof defaultTag> & {
4
- tag?: "div" | "span" | "figcaption";
4
+ tag?: "div" | "span" | "figcaption" | "cite";
5
5
  };
6
6
  export declare const Text: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
7
7
  export {};
@@ -272,12 +272,12 @@ export declare const VimeoPreviewImage: import("react").ForwardRefExoticComponen
272
272
  onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
273
273
  height?: string | number | undefined;
274
274
  width?: string | number | undefined;
275
- alt?: string | undefined;
276
275
  src?: string | undefined;
277
- crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
276
+ alt?: string | undefined;
278
277
  referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
279
278
  quality?: number | undefined;
280
279
  sizes?: string | undefined;
280
+ crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
281
281
  decoding?: "auto" | "async" | "sync" | undefined;
282
282
  loading?: "eager" | "lazy" | undefined;
283
283
  srcSet?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-react",
3
- "version": "0.87.1",
3
+ "version": "0.88.0",
4
4
  "description": "Webstudio default library for react",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -40,11 +40,11 @@
40
40
  "@react-aria/utils": "^3.19.0",
41
41
  "colord": "^2.9.3",
42
42
  "shallow-equal": "^3.1.0",
43
- "@webstudio-is/css-vars": "^0.87.1",
44
- "@webstudio-is/generate-arg-types": "^0.87.1",
45
- "@webstudio-is/icons": "^0.87.1",
46
- "@webstudio-is/image": "^0.87.1",
47
- "@webstudio-is/react-sdk": "^0.87.1"
43
+ "@webstudio-is/css-vars": "^0.88.0",
44
+ "@webstudio-is/generate-arg-types": "^0.88.0",
45
+ "@webstudio-is/icons": "^0.88.0",
46
+ "@webstudio-is/image": "^0.88.0",
47
+ "@webstudio-is/react-sdk": "^0.88.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@storybook/react": "^7.2.1",
@@ -394,12 +394,6 @@ export const props: Record<string, PropMeta> = {
394
394
  color: { required: false, control: "color", type: "string" },
395
395
  content: { required: false, control: "text", type: "string" },
396
396
  contextMenu: { required: false, control: "text", type: "string" },
397
- crossOrigin: {
398
- required: false,
399
- control: "radio",
400
- type: "string",
401
- options: ["", "anonymous", "use-credentials"],
402
- },
403
397
  datatype: { required: false, control: "text", type: "string" },
404
398
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
405
399
  dir: { required: false, control: "text", type: "string" },
@@ -23,7 +23,7 @@ export const props: Record<string, PropMeta> = {
23
23
  required: false,
24
24
  control: "select",
25
25
  type: "string",
26
- options: ["inline", "list", "none", "both"],
26
+ options: ["list", "none", "inline", "both"],
27
27
  },
28
28
  "aria-braillelabel": {
29
29
  description:
@@ -396,12 +396,6 @@ export const props: Record<string, PropMeta> = {
396
396
  draggable: { required: false, control: "boolean", type: "boolean" },
397
397
  hidden: { required: false, control: "boolean", type: "boolean" },
398
398
  id: { required: false, control: "text", type: "string" },
399
- inline: {
400
- required: false,
401
- control: "boolean",
402
- type: "boolean",
403
- defaultValue: false,
404
- },
405
399
  inputMode: {
406
400
  description:
407
401
  "Hints at the type of data that might be entered by the user while editing the element or its contents\n@see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute",
@@ -432,7 +426,6 @@ export const props: Record<string, PropMeta> = {
432
426
  itemScope: { required: false, control: "boolean", type: "boolean" },
433
427
  itemType: { required: false, control: "text", type: "string" },
434
428
  lang: { required: false, control: "text", type: "string" },
435
- meta: { required: false, control: "text", type: "string" },
436
429
  nonce: { required: false, control: "text", type: "string" },
437
430
  placeholder: { required: false, control: "text", type: "string" },
438
431
  prefix: { required: false, control: "text", type: "string" },
@@ -394,12 +394,6 @@ export const props: Record<string, PropMeta> = {
394
394
  color: { required: false, control: "color", type: "string" },
395
395
  content: { required: false, control: "text", type: "string" },
396
396
  contextMenu: { required: false, control: "text", type: "string" },
397
- crossOrigin: {
398
- required: false,
399
- control: "radio",
400
- type: "string",
401
- options: ["", "anonymous", "use-credentials"],
402
- },
403
397
  datatype: { required: false, control: "text", type: "string" },
404
398
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
405
399
  dir: { required: false, control: "text", type: "string" },
@@ -394,12 +394,6 @@ export const props: Record<string, PropMeta> = {
394
394
  color: { required: false, control: "color", type: "string" },
395
395
  content: { required: false, control: "text", type: "string" },
396
396
  contextMenu: { required: false, control: "text", type: "string" },
397
- crossOrigin: {
398
- required: false,
399
- control: "radio",
400
- type: "string",
401
- options: ["", "anonymous", "use-credentials"],
402
- },
403
397
  datatype: { required: false, control: "text", type: "string" },
404
398
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
405
399
  dir: { required: false, control: "text", type: "string" },
@@ -452,10 +452,10 @@ export const props: Record<string, PropMeta> = {
452
452
  tabIndex: { required: false, control: "number", type: "number" },
453
453
  tag: {
454
454
  required: false,
455
- control: "radio",
455
+ control: "select",
456
456
  type: "string",
457
457
  defaultValue: "div",
458
- options: ["div", "figcaption", "span"],
458
+ options: ["div", "cite", "figcaption", "span"],
459
459
  },
460
460
  title: { required: false, control: "text", type: "string" },
461
461
  translate: {
@@ -78,5 +78,5 @@ export const meta: WsComponentMeta = {
78
78
 
79
79
  export const propsMeta: WsComponentPropsMeta = {
80
80
  props,
81
- initialProps: ["id"],
81
+ initialProps: ["id", "cite"],
82
82
  };
package/src/code-text.tsx CHANGED
@@ -1,31 +1,17 @@
1
1
  import {
2
- forwardRef,
3
- createElement,
4
2
  type ElementRef,
5
3
  type ComponentProps,
4
+ forwardRef,
5
+ createElement,
6
6
  } from "react";
7
- import { cssVars } from "@webstudio-is/css-vars";
8
7
 
9
8
  export const defaultTag = "code";
10
9
 
11
- export const displayVarNamespace = cssVars.define("code-display");
12
-
13
- const blockStyle = {
14
- [cssVars.define(displayVarNamespace)]: "block",
15
- };
16
-
17
- type Props = Omit<ComponentProps<typeof defaultTag>, "inline"> & {
18
- inline?: boolean;
19
- meta?: string;
20
- };
21
-
22
- export const CodeText = forwardRef<ElementRef<typeof defaultTag>, Props>(
23
- ({ inline = false, ...props }, ref) => {
24
- // @todo in the future we should expose the inline prop a an attribute
25
- // and define the display style in `presetStyle` in meta.
26
- const style = inline ? undefined : blockStyle;
27
- return createElement(defaultTag, { ...props, style, ref });
28
- }
29
- );
10
+ export const CodeText = forwardRef<
11
+ ElementRef<typeof defaultTag>,
12
+ ComponentProps<typeof defaultTag>
13
+ >((props, ref) => {
14
+ return createElement(defaultTag, { ...props, ref });
15
+ });
30
16
 
31
17
  CodeText.displayName = "CodeText";
@@ -6,7 +6,7 @@ import {
6
6
  type WsComponentPropsMeta,
7
7
  } from "@webstudio-is/react-sdk";
8
8
  import { code } from "@webstudio-is/react-sdk/css-normalize";
9
- import { type defaultTag, displayVarNamespace } from "./code-text";
9
+ import type { defaultTag } from "./code-text";
10
10
  import { props } from "./__generated__/code-text.props";
11
11
 
12
12
  const presetStyle = {
@@ -14,11 +14,11 @@ const presetStyle = {
14
14
  ...code,
15
15
  {
16
16
  property: "display",
17
- value: {
18
- type: "var",
19
- value: displayVarNamespace,
20
- fallbacks: [{ type: "keyword", value: "inline-block" }],
21
- },
17
+ value: { type: "keyword", value: "block" },
18
+ },
19
+ {
20
+ property: "whiteSpace",
21
+ value: { type: "keyword", value: "pre-wrap" },
22
22
  },
23
23
  {
24
24
  property: "paddingLeft",
@@ -54,5 +54,5 @@ export const meta: WsComponentMeta = {
54
54
 
55
55
  export const propsMeta: WsComponentPropsMeta = {
56
56
  props,
57
- initialProps: ["id", "inline", "lang", "meta"],
57
+ initialProps: ["id", "lang"],
58
58
  };
package/src/text.tsx CHANGED
@@ -9,7 +9,7 @@ export const defaultTag = "div";
9
9
 
10
10
  // We don't want to enable all tags because Box is usually a container and we have specific components for many tags.
11
11
  type Props = ComponentProps<typeof defaultTag> & {
12
- tag?: "div" | "span" | "figcaption";
12
+ tag?: "div" | "span" | "figcaption" | "cite";
13
13
  };
14
14
 
15
15
  export const Text = forwardRef<ElementRef<typeof defaultTag>, Props>(