@wordpress/media-fields 0.4.0 → 0.4.1-next.v.20260206T143.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.
@@ -38,6 +38,6 @@ function FileNameView({
38
38
  if (!fileName) {
39
39
  return "";
40
40
  }
41
- return fileName.length > TRUNCATE_LENGTH ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Tooltip, { text: fileName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { children: fileName }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: fileName });
41
+ return fileName.length > TRUNCATE_LENGTH ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Tooltip, { text: fileName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { limit: TRUNCATE_LENGTH, ellipsizeMode: "tail", children: fileName }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: fileName });
42
42
  }
43
43
  //# sourceMappingURL=view.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/filename/view.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tTooltip,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { getFilename } from '@wordpress/url';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\n\n// Hard-coded truncate length to match the available area in the media sidebar.\n// Longer file names will be truncated and wrapped in a tooltip showing the full name.\nconst TRUNCATE_LENGTH = 15;\n\nexport default function FileNameView( {\n\titem,\n}: DataViewRenderFieldProps< MediaItem > ) {\n\tconst fileName = useMemo(\n\t\t() => ( item?.source_url ? getFilename( item.source_url ) : null ),\n\t\t[ item?.source_url ]\n\t);\n\n\tif ( ! fileName ) {\n\t\treturn '';\n\t}\n\n\treturn fileName.length > TRUNCATE_LENGTH ? (\n\t\t<Tooltip text={ fileName }>\n\t\t\t<Truncate>{ fileName }</Truncate>\n\t\t</Tooltip>\n\t) : (\n\t\t<>{ fileName }</>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,qBAAwB;AACxB,iBAA4B;AAyBzB;AAhBH,IAAM,kBAAkB;AAET,SAAR,aAA+B;AAAA,EACrC;AACD,GAA2C;AAC1C,QAAM,eAAW;AAAA,IAChB,MAAQ,MAAM,iBAAa,wBAAa,KAAK,UAAW,IAAI;AAAA,IAC5D,CAAE,MAAM,UAAW;AAAA,EACpB;AAEA,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,SAAS,kBACxB,4CAAC,6BAAQ,MAAO,UACf,sDAAC,kBAAAA,wBAAA,EAAW,oBAAU,GACvB,IAEA,2EAAI,oBAAU;AAEhB;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tTooltip,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { getFilename } from '@wordpress/url';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\n\n// Hard-coded truncate length to match the available area in the media sidebar.\n// Longer file names will be truncated and wrapped in a tooltip showing the full name.\nconst TRUNCATE_LENGTH = 15;\n\nexport default function FileNameView( {\n\titem,\n}: DataViewRenderFieldProps< MediaItem > ) {\n\tconst fileName = useMemo(\n\t\t() => ( item?.source_url ? getFilename( item.source_url ) : null ),\n\t\t[ item?.source_url ]\n\t);\n\n\tif ( ! fileName ) {\n\t\treturn '';\n\t}\n\n\treturn fileName.length > TRUNCATE_LENGTH ? (\n\t\t<Tooltip text={ fileName }>\n\t\t\t<Truncate limit={ TRUNCATE_LENGTH } ellipsizeMode=\"tail\">\n\t\t\t\t{ fileName }\n\t\t\t</Truncate>\n\t\t</Tooltip>\n\t) : (\n\t\t<>{ fileName }</>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,qBAAwB;AACxB,iBAA4B;AAyBzB;AAhBH,IAAM,kBAAkB;AAET,SAAR,aAA+B;AAAA,EACrC;AACD,GAA2C;AAC1C,QAAM,eAAW;AAAA,IAChB,MAAQ,MAAM,iBAAa,wBAAa,KAAK,UAAW,IAAI;AAAA,IAC5D,CAAE,MAAM,UAAW;AAAA,EACpB;AAEA,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,SAAS,kBACxB,4CAAC,6BAAQ,MAAO,UACf,sDAAC,kBAAAA,wBAAA,EAAS,OAAQ,iBAAkB,eAAc,QAC/C,oBACH,GACD,IAEA,2EAAI,oBAAU;AAEhB;",
6
6
  "names": ["Truncate"]
7
7
  }
@@ -17,7 +17,7 @@ function FileNameView({
17
17
  if (!fileName) {
18
18
  return "";
19
19
  }
20
- return fileName.length > TRUNCATE_LENGTH ? /* @__PURE__ */ jsx(Tooltip, { text: fileName, children: /* @__PURE__ */ jsx(Truncate, { children: fileName }) }) : /* @__PURE__ */ jsx(Fragment, { children: fileName });
20
+ return fileName.length > TRUNCATE_LENGTH ? /* @__PURE__ */ jsx(Tooltip, { text: fileName, children: /* @__PURE__ */ jsx(Truncate, { limit: TRUNCATE_LENGTH, ellipsizeMode: "tail", children: fileName }) }) : /* @__PURE__ */ jsx(Fragment, { children: fileName });
21
21
  }
22
22
  export {
23
23
  FileNameView as default
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/filename/view.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tTooltip,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { getFilename } from '@wordpress/url';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\n\n// Hard-coded truncate length to match the available area in the media sidebar.\n// Longer file names will be truncated and wrapped in a tooltip showing the full name.\nconst TRUNCATE_LENGTH = 15;\n\nexport default function FileNameView( {\n\titem,\n}: DataViewRenderFieldProps< MediaItem > ) {\n\tconst fileName = useMemo(\n\t\t() => ( item?.source_url ? getFilename( item.source_url ) : null ),\n\t\t[ item?.source_url ]\n\t);\n\n\tif ( ! fileName ) {\n\t\treturn '';\n\t}\n\n\treturn fileName.length > TRUNCATE_LENGTH ? (\n\t\t<Tooltip text={ fileName }>\n\t\t\t<Truncate>{ fileName }</Truncate>\n\t\t</Tooltip>\n\t) : (\n\t\t<>{ fileName }</>\n\t);\n}\n"],
5
- "mappings": ";AAGA;AAAA,EACC;AAAA,EACA,0BAA0B;AAAA,OACpB;AACP,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAyBzB,SAGD,UAHC;AAhBH,IAAM,kBAAkB;AAET,SAAR,aAA+B;AAAA,EACrC;AACD,GAA2C;AAC1C,QAAM,WAAW;AAAA,IAChB,MAAQ,MAAM,aAAa,YAAa,KAAK,UAAW,IAAI;AAAA,IAC5D,CAAE,MAAM,UAAW;AAAA,EACpB;AAEA,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,SAAS,kBACxB,oBAAC,WAAQ,MAAO,UACf,8BAAC,YAAW,oBAAU,GACvB,IAEA,gCAAI,oBAAU;AAEhB;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tTooltip,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { getFilename } from '@wordpress/url';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\n\n// Hard-coded truncate length to match the available area in the media sidebar.\n// Longer file names will be truncated and wrapped in a tooltip showing the full name.\nconst TRUNCATE_LENGTH = 15;\n\nexport default function FileNameView( {\n\titem,\n}: DataViewRenderFieldProps< MediaItem > ) {\n\tconst fileName = useMemo(\n\t\t() => ( item?.source_url ? getFilename( item.source_url ) : null ),\n\t\t[ item?.source_url ]\n\t);\n\n\tif ( ! fileName ) {\n\t\treturn '';\n\t}\n\n\treturn fileName.length > TRUNCATE_LENGTH ? (\n\t\t<Tooltip text={ fileName }>\n\t\t\t<Truncate limit={ TRUNCATE_LENGTH } ellipsizeMode=\"tail\">\n\t\t\t\t{ fileName }\n\t\t\t</Truncate>\n\t\t</Tooltip>\n\t) : (\n\t\t<>{ fileName }</>\n\t);\n}\n"],
5
+ "mappings": ";AAGA;AAAA,EACC;AAAA,EACA,0BAA0B;AAAA,OACpB;AACP,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAyBzB,SAKD,UALC;AAhBH,IAAM,kBAAkB;AAET,SAAR,aAA+B;AAAA,EACrC;AACD,GAA2C;AAC1C,QAAM,WAAW;AAAA,IAChB,MAAQ,MAAM,aAAa,YAAa,KAAK,UAAW,IAAI;AAAA,IAC5D,CAAE,MAAM,UAAW;AAAA,EACpB;AAEA,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,SAAS,kBACxB,oBAAC,WAAQ,MAAO,UACf,8BAAC,YAAS,OAAQ,iBAAkB,eAAc,QAC/C,oBACH,GACD,IAEA,gCAAI,oBAAU;AAEhB;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/filename/view.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM1C,MAAM,CAAC,OAAO,UAAU,YAAY,CAAE,EACrC,IAAI,GACJ,EAAE,wBAAwB,CAAE,SAAS,CAAE,oCAiBvC"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/filename/view.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM1C,MAAM,CAAC,OAAO,UAAU,YAAY,CAAE,EACrC,IAAI,GACJ,EAAE,wBAAwB,CAAE,SAAS,CAAE,oCAmBvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/media-fields",
3
- "version": "0.4.0",
3
+ "version": "0.4.1-next.v.20260206T143.0+81f8de885",
4
4
  "description": "Reusable field definitions for displaying and editing media attachment properties in WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -49,18 +49,18 @@
49
49
  "src/**/*.scss"
50
50
  ],
51
51
  "dependencies": {
52
- "@wordpress/base-styles": "^6.15.0",
53
- "@wordpress/components": "^32.1.0",
54
- "@wordpress/compose": "^7.39.0",
55
- "@wordpress/core-data": "^7.39.0",
56
- "@wordpress/data": "^10.39.0",
57
- "@wordpress/dataviews": "^11.3.0",
58
- "@wordpress/date": "^5.39.0",
59
- "@wordpress/element": "^6.39.0",
60
- "@wordpress/i18n": "^6.12.0",
61
- "@wordpress/icons": "^11.6.0",
62
- "@wordpress/primitives": "^4.39.0",
63
- "@wordpress/url": "^4.39.0",
52
+ "@wordpress/base-styles": "^6.15.1-next.v.20260206T143.0+81f8de885",
53
+ "@wordpress/components": "^32.2.1-next.v.20260206T143.0+81f8de885",
54
+ "@wordpress/compose": "^7.39.1-next.v.20260206T143.0+81f8de885",
55
+ "@wordpress/core-data": "^7.39.1-next.v.20260206T143.0+81f8de885",
56
+ "@wordpress/data": "^10.39.1-next.v.20260206T143.0+81f8de885",
57
+ "@wordpress/dataviews": "^12.0.1-next.v.20260206T143.0+81f8de885",
58
+ "@wordpress/date": "^5.39.1-next.v.20260206T143.0+81f8de885",
59
+ "@wordpress/element": "^6.39.1-next.v.20260206T143.0+81f8de885",
60
+ "@wordpress/i18n": "^6.12.1-next.v.20260206T143.0+81f8de885",
61
+ "@wordpress/icons": "^11.6.1-next.v.20260206T143.0+81f8de885",
62
+ "@wordpress/primitives": "^4.39.1-next.v.20260206T143.0+81f8de885",
63
+ "@wordpress/url": "^4.39.1-next.v.20260206T143.0+81f8de885",
64
64
  "clsx": "2.1.1"
65
65
  },
66
66
  "devDependencies": {
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "eee1cfb1472f11183e40fb77465a5f13145df7ad"
76
+ "gitHead": "6ae3fbb907e6c309ff6a0685e5e5ff0c2ee23b15"
77
77
  }
@@ -49,7 +49,9 @@ describe( 'FileNameView', () => {
49
49
 
50
50
  // Verify the full filename text is accessible to users
51
51
  // (the component handles truncation via Truncate/Tooltip, but the text is still present)
52
- expect( screen.getByText( longFilename ) ).toBeInTheDocument();
52
+ expect(
53
+ screen.getByText( longFilename.slice( 0, 15 ) + '…' )
54
+ ).toBeInTheDocument();
53
55
  } );
54
56
  } );
55
57
 
@@ -31,7 +31,9 @@ export default function FileNameView( {
31
31
 
32
32
  return fileName.length > TRUNCATE_LENGTH ? (
33
33
  <Tooltip text={ fileName }>
34
- <Truncate>{ fileName }</Truncate>
34
+ <Truncate limit={ TRUNCATE_LENGTH } ellipsizeMode="tail">
35
+ { fileName }
36
+ </Truncate>
35
37
  </Tooltip>
36
38
  ) : (
37
39
  <>{ fileName }</>