@astryxdesign/lab 0.7.6-canary.e736b92 → 0.7.6-canary.e7530db

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../src/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAkBlD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,8BAA8B,CAAC;AAuF5D,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,SAAS,CAAC,cAAc,CAAC,EACzB,UAAU,CACX;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,+BAA+B;IAC/B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,uBAAuB;IACvB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;IAC5D;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAsED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,w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AAS,EAAE,CAAC;IAC5D;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAsED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,QAAsB,EACtB,cAAsB,EACtB,UAAkB,EAClB,WAAW,EACX,SAAS,EACT,IAAW,EACX,SAAS,EAAE,eAAe,EAC1B,KAAK,EACL,UAAqE,EACrE,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,eAAe,+BAsVjB;yBAvWe,UAAU"}
@@ -450,6 +450,7 @@ export function CodeEditor({
450
450
  }), stylex.props(styles.root, focused && styles.rootFocused, xstyle), className, style),
451
451
  ...props,
452
452
  children: /*#__PURE__*/_jsxs("div", {
453
+ dir: "ltr",
453
454
  ...{
454
455
  className: "x78zum5 x98rzlu xysyzu8"
455
456
  },
@@ -468,7 +469,12 @@ export function CodeEditor({
468
469
  position: 'relative',
469
470
  flex: 1
470
471
  },
471
- children: [showPlaceholder && /*#__PURE__*/_jsx("div", {
472
+ children: [showPlaceholder &&
473
+ /*#__PURE__*/
474
+ // The placeholder is prose, not code: it takes its own text's
475
+ // direction, so an Arabic or Hebrew hint still reads correctly.
476
+ _jsx("div", {
477
+ dir: "auto",
472
478
  ...stylex.props(styles.placeholder, sizeStyle),
473
479
  children: placeholder
474
480
  }), /*#__PURE__*/_jsx("code", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/lab",
3
- "version": "0.7.6-canary.e736b92",
3
+ "version": "0.7.6-canary.e7530db",
4
4
  "description": "Experimental Astryx components — published to npm only under the @canary dist-tag for early testing; never released as a stable (latest) version.",
5
5
  "author": "Meta Open Source",
6
6
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@stylexjs/stylex": ">=0.10.0",
52
- "@astryxdesign/core": "0.7.6-canary.e736b92",
52
+ "@astryxdesign/core": "0.7.6-canary.e7530db",
53
53
  "react": ">=19.0.0",
54
54
  "react-dom": ">=19.0.0"
55
55
  },
@@ -59,8 +59,8 @@
59
59
  "d3-shape": "^3.2.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@astryxdesign/a11y-spec": "0.7.6-canary.e736b92",
63
- "@astryxdesign/cli": "0.7.6-canary.e736b92",
62
+ "@astryxdesign/a11y-spec": "0.7.6-canary.e7530db",
63
+ "@astryxdesign/cli": "0.7.6-canary.e7530db",
64
64
  "@babel/cli": "^7.29.7",
65
65
  "@babel/core": "^7.29.7",
66
66
  "@babel/preset-react": "^7.29.7",
@@ -51,6 +51,33 @@ function renderEditor(value = '', props: {escapeHint?: string} = {}) {
51
51
  }
52
52
 
53
53
  describe('CodeEditor', () => {
54
+ it('keeps the code left-to-right inside a right-to-left page', () => {
55
+ render(
56
+ <div dir="rtl">
57
+ <CodeEditor label="Code" value="const a = 1;" onChange={() => {}} />
58
+ </div>,
59
+ );
60
+ const editor = screen.getByRole('textbox', {name: 'Code'});
61
+ expect(editor.closest('[dir]')).toHaveAttribute('dir', 'ltr');
62
+ });
63
+
64
+ it('lets the placeholder take its own text direction', () => {
65
+ render(
66
+ <div dir="rtl">
67
+ <CodeEditor
68
+ label="Code"
69
+ value=""
70
+ onChange={() => {}}
71
+ placeholder="اكتب الكود هنا..."
72
+ />
73
+ </div>,
74
+ );
75
+ expect(screen.getByText('اكتب الكود هنا...')).toHaveAttribute(
76
+ 'dir',
77
+ 'auto',
78
+ );
79
+ });
80
+
54
81
  it('uses the label prop as the accessible name', () => {
55
82
  render(
56
83
  <CodeEditor
@@ -556,7 +556,13 @@ export function CodeEditor({
556
556
  style,
557
557
  )}
558
558
  {...props}>
559
- <div {...stylex.props(styles.editorContainer)} style={containerStyle}>
559
+ {/* Code, with its line numbers, keeps its own left-to-right direction
560
+ inside a right-to-left page (design:bidirectionality DR2): lines read
561
+ and indent correctly, and a long line scrolls from its start. */}
562
+ <div
563
+ dir="ltr"
564
+ {...stylex.props(styles.editorContainer)}
565
+ style={containerStyle}>
560
566
  {hasLineNumbers && (
561
567
  <div
562
568
  {...stylex.props(styles.gutter, gutterSizeStyle)}
@@ -570,7 +576,9 @@ export function CodeEditor({
570
576
  )}
571
577
  <div style={{position: 'relative', flex: 1}}>
572
578
  {showPlaceholder && (
573
- <div {...stylex.props(styles.placeholder, sizeStyle)}>
579
+ // The placeholder is prose, not code: it takes its own text's
580
+ // direction, so an Arabic or Hebrew hint still reads correctly.
581
+ <div dir="auto" {...stylex.props(styles.placeholder, sizeStyle)}>
574
582
  {placeholder}
575
583
  </div>
576
584
  )}