cozy-ui 113.5.0 → 113.7.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,3 +1,17 @@
1
+ # [113.7.0](https://github.com/cozy/cozy-ui/compare/v113.6.0...v113.7.0) (2024-11-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * **Actions:** Add copyToClipboard and editAttribute ([a7e91a6](https://github.com/cozy/cozy-ui/commit/a7e91a6))
7
+
8
+ # [113.6.0](https://github.com/cozy/cozy-ui/compare/v113.5.0...v113.6.0) (2024-11-27)
9
+
10
+
11
+ ### Features
12
+
13
+ * **Icon:** Add Text ([fc7ddcb](https://github.com/cozy/cozy-ui/commit/fc7ddcb))
14
+
1
15
  # [113.5.0](https://github.com/cozy/cozy-ui/compare/v113.4.0...v113.5.0) (2024-11-27)
2
16
 
3
17
 
@@ -0,0 +1 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 13a1 1 0 1 1 0 2H1a1 1 0 1 1 0-2h8Zm6-4a1 1 0 1 1 0 2H1a1 1 0 1 1 0-2h14Zm0-4a1 1 0 1 1 0 2H1a1 1 0 0 1 0-2h14Zm0-4a1 1 0 1 1 0 2H1a1 1 0 0 1 0-2h14Z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "113.5.0",
3
+ "version": "113.7.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -0,0 +1,55 @@
1
+ import React, { forwardRef } from 'react'
2
+
3
+ import { getActionsI18n } from './locales/withActionsLocales'
4
+ import Icon from '../../Icon'
5
+ import CopyIcon from '../../Icons/Copy'
6
+ import ListItemIcon from '../../ListItemIcon'
7
+ import ListItemText from '../../ListItemText'
8
+ import ActionsMenuItem from '../ActionsMenuItem'
9
+
10
+ const makeComponent = (label, icon) => {
11
+ const Component = forwardRef((props, ref) => {
12
+ return (
13
+ <ActionsMenuItem {...props} ref={ref}>
14
+ <ListItemIcon>
15
+ <Icon icon={icon} />
16
+ </ListItemIcon>
17
+ <ListItemText primary={label} />
18
+ </ActionsMenuItem>
19
+ )
20
+ })
21
+
22
+ Component.displayName = 'copyToClipboard'
23
+
24
+ return Component
25
+ }
26
+
27
+ export const copyToClipboard = () => {
28
+ const { t } = getActionsI18n()
29
+ const icon = CopyIcon
30
+ const label = t('copyToClipboard.copy')
31
+
32
+ return {
33
+ name: 'copyToClipboard',
34
+ icon,
35
+ label,
36
+ Component: makeComponent(label, icon),
37
+ action: async (_, { showAlert, copyValue }) => {
38
+ if (!copyValue) return false
39
+ try {
40
+ await navigator.clipboard.writeText(copyValue)
41
+ showAlert({
42
+ message: t('copyToClipboard.success'),
43
+ severity: 'success',
44
+ variant: 'filled'
45
+ })
46
+ } catch (error) {
47
+ showAlert({
48
+ message: t('copyToClipboard.error'),
49
+ severity: 'error',
50
+ variant: 'filled'
51
+ })
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,41 @@
1
+ import React, { forwardRef } from 'react'
2
+
3
+ import { getActionsI18n } from './locales/withActionsLocales'
4
+ import Icon from '../../Icon'
5
+ import TextInfoIcon from '../../Icons/TextInfo'
6
+ import ListItemIcon from '../../ListItemIcon'
7
+ import ListItemText from '../../ListItemText'
8
+ import ActionsMenuItem from '../ActionsMenuItem'
9
+
10
+ const makeComponent = (label, icon) => {
11
+ const Component = forwardRef((props, ref) => {
12
+ return (
13
+ <ActionsMenuItem {...props} ref={ref}>
14
+ <ListItemIcon>
15
+ <Icon icon={icon} />
16
+ </ListItemIcon>
17
+ <ListItemText primary={label} />
18
+ </ActionsMenuItem>
19
+ )
20
+ })
21
+
22
+ Component.displayName = 'editAttribute'
23
+
24
+ return Component
25
+ }
26
+
27
+ export const editAttribute = () => {
28
+ const { t } = getActionsI18n()
29
+ const icon = TextInfoIcon
30
+ const label = t('editAttribute')
31
+
32
+ return {
33
+ name: 'editAttribute',
34
+ icon,
35
+ label,
36
+ Component: makeComponent(label, icon),
37
+ action: (docs, { editAttributeCallback }) => {
38
+ editAttributeCallback(docs)
39
+ }
40
+ }
41
+ }
@@ -7,4 +7,6 @@ export { emailTo } from './emailTo'
7
7
  export { print } from './print'
8
8
  export { viewInContacts } from './viewInContacts'
9
9
  export { viewInDrive } from './viewInDrive'
10
+ export { copyToClipboard } from './copyToClipboard'
11
+ export { editAttribute } from './editAttribute'
10
12
  export { others } from './others'
@@ -6,5 +6,11 @@
6
6
  "smsTo": "Send a message",
7
7
  "print": "Print",
8
8
  "others": "Others",
9
+ "editAttribute": "Edit attribute",
10
+ "copyToClipboard": {
11
+ "copy": "Copy",
12
+ "success": "Copied to clipboard",
13
+ "error": "Cannot copy to clipboard"
14
+ },
9
15
  "call": "Call"
10
16
  }
@@ -6,5 +6,11 @@
6
6
  "smsTo": "Envoyer un message",
7
7
  "print": "Imprimer",
8
8
  "others": "Autres",
9
+ "editAttribute": "Editer l'attribut",
10
+ "copyToClipboard": {
11
+ "copy": "Copier",
12
+ "success": "Copié dans le presse-papier",
13
+ "error": "Impossible de copier dans le presse-papier"
14
+ },
9
15
  "call": "Appeler"
10
16
  }
@@ -304,6 +304,7 @@ import Task from 'cozy-ui/transpiled/react/Icons/Task'
304
304
  import Team from 'cozy-ui/transpiled/react/Icons/Team'
305
305
  import Telecom from 'cozy-ui/transpiled/react/Icons/Telecom'
306
306
  import Telephone from 'cozy-ui/transpiled/react/Icons/Telephone'
307
+ import Text from 'cozy-ui/transpiled/react/Icons/Text'
307
308
  import TextInfo from 'cozy-ui/transpiled/react/Icons/TextInfo'
308
309
  import Top from 'cozy-ui/transpiled/react/Icons/Top'
309
310
  import ToTheCloud from 'cozy-ui/transpiled/react/Icons/ToTheCloud'
@@ -571,6 +572,7 @@ const icons = [
571
572
  Team,
572
573
  Telecom,
573
574
  Telephone,
575
+ Text,
574
576
  TextInfo,
575
577
  Top,
576
578
  ToTheCloud,
@@ -933,7 +935,7 @@ import Typography from 'cozy-ui/transpiled/react/Typography'
933
935
 
934
936
  const colors = ['#297EF2', '#08b442', '#B449E7', '#F52D2D', '#FF962F']
935
937
  let i = 0
936
- const availableIcons = ['album-add','album-remove','album','answer','apple','archive','arrowUp','attachment','attention','bank-check','bank','banking-add','banking','bell','benefit','bike','bill','bottom','browser-brave','browser-chrome','browser-duckduckgo','browser-edge','browser-edge-chromium','browser-firefox','browser-ie','browser-opera','browser-safari','burger','bus','calendar','camera','car','carbonCopy','carpooling','categories','certified','check-circle','check-list','check-square','check','checkbox','chess','child','circle-filled','clock','clock-outline','cloud-happy','cloud-plus-outlined','cloud','collect','cocktail','comment','company','compare','compass','connector','contract','contrast','copy','cozy-circle','cozy-laugh', 'cozy-lock', 'cozy-text', 'cozy-release', 'credit-card-add','credit-card','credit','crop','cross-circle-outline','cross-circle','cross-medium','cross-small','cross','cube','dash','dashboard','data-control','debit','devices','dots','down','download','drawing-arrow-up','dropdown-close','dropdown-open','dropdown','dropup','electric-bike','electric-car','electric-scooter','email-notification','email','eu','euro','exchange','eye-closed','eye','face-id','file-add','file-duotone','file-new','file-none','file-outline','file','filter','fingerprint','fitness','flag-outlined','flag','flash-auto','flashlight','folder-add','folder-moveto','folder-open','folder','forbidden','from-user','gear','globe','gouv','graph-circle','grid','group-list','groups','growth','hand','heart','help','help-outlined','history','home','hourglass','image','info-outlined','info','justice','key','label-outlined','laudry','laptop','left','library','lightbulb','lightning','link-out','link','list','list-min','location','lock', 'lock-screen', 'logout','magic-trick','magnet','magnifier','merge','moped','mosaic-min','motorcycle','mountain','movement-in','movement-out','mouvement','moveto','multi-files','music','new','next','note','notification-email','offline','online', 'openapp', 'openwith','palette','paper','paperplane','password','pen','people','percent-circle','percent','personal-data','phone-download','phone-upload','phone','pie-chart','pin','plane','plus-small','plus', 'pop-inside', 'previous','printer','qualify','radio-checked','radio-unchecked','refresh','relationship','remboursement','rename','repare','reply','restaurant','restore-straight','restore','right','rise','rotate-left','rotate-right','sad-cozy','safe','school','scooter','select-all','server','setting','share-circle','share','shield','shop','sound','spinner','sport-bag','stack','star','star-outline','stats','stop', 'subway', 'support', 'swap', 'sync-cozy','sync','tab','tag','target','task','team','telecom','telephone','text-info','to-the-cloud','top','train','tram','trash','trophy', 'uncloud', 'unknow','unlink','unlock','up','upload','videos','walk','wallet-add','wallet-new','wallet','warn','warning-circle','warning','water','wrench-circle','work']
938
+ const availableIcons = ['album-add','album-remove','album','answer','apple','archive','arrowUp','attachment','attention','bank-check','bank','banking-add','banking','bell','benefit','bike','bill','bottom','browser-brave','browser-chrome','browser-duckduckgo','browser-edge','browser-edge-chromium','browser-firefox','browser-ie','browser-opera','browser-safari','burger','bus','calendar','camera','car','carbonCopy','carpooling','categories','certified','check-circle','check-list','check-square','check','checkbox','chess','child','circle-filled','clock','clock-outline','cloud-happy','cloud-plus-outlined','cloud','collect','cocktail','comment','company','compare','compass','connector','contract','contrast','copy','cozy-circle','cozy-laugh', 'cozy-lock', 'cozy-text', 'cozy-release', 'credit-card-add','credit-card','credit','crop','cross-circle-outline','cross-circle','cross-medium','cross-small','cross','cube','dash','dashboard','data-control','debit','devices','dots','down','download','drawing-arrow-up','dropdown-close','dropdown-open','dropdown','dropup','electric-bike','electric-car','electric-scooter','email-notification','email','eu','euro','exchange','eye-closed','eye','face-id','file-add','file-duotone','file-new','file-none','file-outline','file','filter','fingerprint','fitness','flag-outlined','flag','flash-auto','flashlight','folder-add','folder-moveto','folder-open','folder','forbidden','from-user','gear','globe','gouv','graph-circle','grid','group-list','groups','growth','hand','heart','help','help-outlined','history','home','hourglass','image','info-outlined','info','justice','key','label-outlined','laudry','laptop','left','library','lightbulb','lightning','link-out','link','list','list-min','location','lock', 'lock-screen', 'logout','magic-trick','magnet','magnifier','merge','moped','mosaic-min','motorcycle','mountain','movement-in','movement-out','mouvement','moveto','multi-files','music','new','next','note','notification-email','offline','online', 'openapp', 'openwith','palette','paper','paperplane','password','pen','people','percent-circle','percent','personal-data','phone-download','phone-upload','phone','pie-chart','pin','plane','plus-small','plus', 'pop-inside', 'previous','printer','qualify','radio-checked','radio-unchecked','refresh','relationship','remboursement','rename','repare','reply','restaurant','restore-straight','restore','right','rise','rotate-left','rotate-right','sad-cozy','safe','school','scooter','select-all','server','setting','share-circle','share','shield','shop','sound','spinner','sport-bag','stack','star','star-outline','stats','stop', 'subway', 'support', 'swap', 'sync-cozy','sync','tab','tag','target','task','team','telecom','telephone','text','text-info','to-the-cloud','top','train','tram','trash','trophy', 'uncloud', 'unknow','unlink','unlock','up','upload','videos','walk','wallet-add','wallet-new','wallet','warn','warning-circle','warning','water','wrench-circle','work']
937
939
  ;
938
940
  <div style={{ fontSize: '2rem', display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)' }}>
939
941
  <Sprite />
@@ -0,0 +1,16 @@
1
+ // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/text.svg` to regenerate;
2
+ import React from 'react'
3
+
4
+ function SvgText(props) {
5
+ return (
6
+ <svg viewBox="0 0 16 16" {...props}>
7
+ <path
8
+ fillRule="evenodd"
9
+ clipRule="evenodd"
10
+ d="M9 13a1 1 0 110 2H1a1 1 0 110-2h8zm6-4a1 1 0 110 2H1a1 1 0 110-2h14zm0-4a1 1 0 110 2H1a1 1 0 010-2h14zm0-4a1 1 0 110 2H1a1 1 0 010-2h14z"
11
+ />
12
+ </svg>
13
+ )
14
+ }
15
+
16
+ export default SvgText
@@ -0,0 +1,91 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import React, { forwardRef } from 'react';
5
+ import { getActionsI18n } from "cozy-ui/transpiled/react/ActionsMenu/Actions/locales/withActionsLocales";
6
+ import Icon from "cozy-ui/transpiled/react/Icon";
7
+ import CopyIcon from "cozy-ui/transpiled/react/Icons/Copy";
8
+ import ListItemIcon from "cozy-ui/transpiled/react/ListItemIcon";
9
+ import ListItemText from "cozy-ui/transpiled/react/ListItemText";
10
+ import ActionsMenuItem from "cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem";
11
+
12
+ var makeComponent = function makeComponent(label, icon) {
13
+ var Component = /*#__PURE__*/forwardRef(function (props, ref) {
14
+ return /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, props, {
15
+ ref: ref
16
+ }), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
17
+ icon: icon
18
+ })), /*#__PURE__*/React.createElement(ListItemText, {
19
+ primary: label
20
+ }));
21
+ });
22
+ Component.displayName = 'copyToClipboard';
23
+ return Component;
24
+ };
25
+
26
+ export var copyToClipboard = function copyToClipboard() {
27
+ var _getActionsI18n = getActionsI18n(),
28
+ t = _getActionsI18n.t;
29
+
30
+ var icon = CopyIcon;
31
+ var label = t('copyToClipboard.copy');
32
+ return {
33
+ name: 'copyToClipboard',
34
+ icon: icon,
35
+ label: label,
36
+ Component: makeComponent(label, icon),
37
+ action: function () {
38
+ var _action = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_, _ref) {
39
+ var showAlert, copyValue;
40
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
41
+ while (1) {
42
+ switch (_context.prev = _context.next) {
43
+ case 0:
44
+ showAlert = _ref.showAlert, copyValue = _ref.copyValue;
45
+
46
+ if (copyValue) {
47
+ _context.next = 3;
48
+ break;
49
+ }
50
+
51
+ return _context.abrupt("return", false);
52
+
53
+ case 3:
54
+ _context.prev = 3;
55
+ _context.next = 6;
56
+ return navigator.clipboard.writeText(copyValue);
57
+
58
+ case 6:
59
+ showAlert({
60
+ message: t('copyToClipboard.success'),
61
+ severity: 'success',
62
+ variant: 'filled'
63
+ });
64
+ _context.next = 12;
65
+ break;
66
+
67
+ case 9:
68
+ _context.prev = 9;
69
+ _context.t0 = _context["catch"](3);
70
+ showAlert({
71
+ message: t('copyToClipboard.error'),
72
+ severity: 'error',
73
+ variant: 'filled'
74
+ });
75
+
76
+ case 12:
77
+ case "end":
78
+ return _context.stop();
79
+ }
80
+ }
81
+ }, _callee, null, [[3, 9]]);
82
+ }));
83
+
84
+ function action(_x, _x2) {
85
+ return _action.apply(this, arguments);
86
+ }
87
+
88
+ return action;
89
+ }()
90
+ };
91
+ };
@@ -0,0 +1,40 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { forwardRef } from 'react';
3
+ import { getActionsI18n } from "cozy-ui/transpiled/react/ActionsMenu/Actions/locales/withActionsLocales";
4
+ import Icon from "cozy-ui/transpiled/react/Icon";
5
+ import TextInfoIcon from "cozy-ui/transpiled/react/Icons/TextInfo";
6
+ import ListItemIcon from "cozy-ui/transpiled/react/ListItemIcon";
7
+ import ListItemText from "cozy-ui/transpiled/react/ListItemText";
8
+ import ActionsMenuItem from "cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem";
9
+
10
+ var makeComponent = function makeComponent(label, icon) {
11
+ var Component = /*#__PURE__*/forwardRef(function (props, ref) {
12
+ return /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, props, {
13
+ ref: ref
14
+ }), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
15
+ icon: icon
16
+ })), /*#__PURE__*/React.createElement(ListItemText, {
17
+ primary: label
18
+ }));
19
+ });
20
+ Component.displayName = 'editAttribute';
21
+ return Component;
22
+ };
23
+
24
+ export var editAttribute = function editAttribute() {
25
+ var _getActionsI18n = getActionsI18n(),
26
+ t = _getActionsI18n.t;
27
+
28
+ var icon = TextInfoIcon;
29
+ var label = t('editAttribute');
30
+ return {
31
+ name: 'editAttribute',
32
+ icon: icon,
33
+ label: label,
34
+ Component: makeComponent(label, icon),
35
+ action: function action(docs, _ref) {
36
+ var editAttributeCallback = _ref.editAttributeCallback;
37
+ editAttributeCallback(docs);
38
+ }
39
+ };
40
+ };
@@ -7,4 +7,6 @@ export { emailTo } from './emailTo';
7
7
  export { print } from './print';
8
8
  export { viewInContacts } from './viewInContacts';
9
9
  export { viewInDrive } from './viewInDrive';
10
+ export { copyToClipboard } from './copyToClipboard';
11
+ export { editAttribute } from './editAttribute';
10
12
  export { others } from './others';
@@ -6,6 +6,12 @@ var en = {
6
6
  smsTo: "Send a message",
7
7
  print: "Print",
8
8
  others: "Others",
9
+ editAttribute: "Edit attribute",
10
+ copyToClipboard: {
11
+ copy: "Copy",
12
+ success: "Copied to clipboard",
13
+ error: "Cannot copy to clipboard"
14
+ },
9
15
  call: "Call"
10
16
  };
11
17
  var fr = {
@@ -16,6 +22,12 @@ var fr = {
16
22
  smsTo: "Envoyer un message",
17
23
  print: "Imprimer",
18
24
  others: "Autres",
25
+ editAttribute: "Editer l'attribut",
26
+ copyToClipboard: {
27
+ copy: "Copier",
28
+ success: "Copi\xE9 dans le presse-papier",
29
+ error: "Impossible de copier dans le presse-papier"
30
+ },
19
31
  call: "Appeler"
20
32
  };
21
33
  import { getI18n } from "cozy-ui/transpiled/react/providers/I18n/helpers";