@croquiscom/pds 8.34.4 → 8.35.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 +7 -0
- package/README.md +53 -0
- package/assets/icons/BoxMove.svg +4 -0
- package/assets/icons/BoxSearch.svg +4 -0
- package/assets/icons/BoxStock.svg +4 -0
- package/assets/icons/BoxTaped.svg +3 -0
- package/assets/icons/BoxUnload.svg +3 -0
- package/assets/icons/Boxes.svg +3 -0
- package/assets/icons/CartCheck.svg +6 -0
- package/assets/icons/CartClock.svg +6 -0
- package/assets/icons/CartMove.svg +7 -0
- package/assets/icons/Classification.svg +8 -0
- package/assets/icons/Home.svg +3 -0
- package/assets/icons/HomeIn.svg +4 -0
- package/assets/icons/HomeOut.svg +3 -0
- package/assets/icons/HomeSetting.svg +5 -0
- package/assets/icons/Inspection.svg +5 -0
- package/assets/icons/Person.svg +4 -0
- package/assets/icons/Picking.svg +3 -0
- package/assets/icons/PickingOut.svg +4 -0
- package/assets/icons/TruckReturn.svg +4 -0
- package/assets/icons/TruckSetting.svg +5 -0
- package/assets/icons/Warehouse.svg +3 -0
- package/dist/components/badge/Badge.figma.d.ts +1 -0
- package/dist/components/banner/Banner.figma.d.ts +1 -0
- package/dist/components/bottom-sheet/BottomSheet.figma.d.ts +1 -0
- package/dist/components/button/Button.figma.d.ts +1 -0
- package/dist/components/button/IconButton.figma.d.ts +1 -0
- package/dist/components/button/PopoverButton.figma.d.ts +1 -0
- package/dist/components/button/TextButton.figma.d.ts +1 -0
- package/dist/components/category-selector/CategorySelector.figma.d.ts +1 -0
- package/dist/components/checkbox/Checkbox.figma.d.ts +1 -0
- package/dist/components/chip/Chip.figma.d.ts +1 -0
- package/dist/components/chip/SelectChip.figma.d.ts +1 -0
- package/dist/components/color-picker/ColorPicker.figma.d.ts +1 -0
- package/dist/components/column-view-controller/ColumnViewController.figma.d.ts +1 -0
- package/dist/components/date-picker/DatePicker.figma.d.ts +1 -0
- package/dist/components/date-picker/DateRangePicker.figma.d.ts +1 -0
- package/dist/components/date-picker/DateUnitPicker.figma.d.ts +1 -0
- package/dist/components/divider/Divider.figma.d.ts +1 -0
- package/dist/components/dropdown/Dropdown.figma.d.ts +1 -0
- package/dist/components/dropdown/DropdownInput.figma.d.ts +1 -0
- package/dist/components/file-upload/FileUpload.figma.d.ts +1 -0
- package/dist/components/form/FormField.figma.d.ts +1 -0
- package/dist/components/form/FormHelperText.figma.d.ts +1 -0
- package/dist/components/form/FormLabel.figma.d.ts +1 -0
- package/dist/components/icons/generated/BoxMove.d.ts +4 -0
- package/dist/components/icons/generated/BoxSearch.d.ts +4 -0
- package/dist/components/icons/generated/BoxStock.d.ts +4 -0
- package/dist/components/icons/generated/BoxTaped.d.ts +4 -0
- package/dist/components/icons/generated/BoxUnload.d.ts +4 -0
- package/dist/components/icons/generated/Boxes.d.ts +4 -0
- package/dist/components/icons/generated/CartCheck.d.ts +4 -0
- package/dist/components/icons/generated/CartClock.d.ts +4 -0
- package/dist/components/icons/generated/CartMove.d.ts +4 -0
- package/dist/components/icons/generated/Classification.d.ts +4 -0
- package/dist/components/icons/generated/Home.d.ts +4 -0
- package/dist/components/icons/generated/HomeIn.d.ts +4 -0
- package/dist/components/icons/generated/HomeOut.d.ts +4 -0
- package/dist/components/icons/generated/HomeSetting.d.ts +4 -0
- package/dist/components/icons/generated/Inspection.d.ts +4 -0
- package/dist/components/icons/generated/Person.d.ts +4 -0
- package/dist/components/icons/generated/Picking.d.ts +4 -0
- package/dist/components/icons/generated/PickingOut.d.ts +4 -0
- package/dist/components/icons/generated/TruckReturn.d.ts +4 -0
- package/dist/components/icons/generated/TruckSetting.d.ts +4 -0
- package/dist/components/icons/generated/Warehouse.d.ts +4 -0
- package/dist/components/icons/generated/index.d.ts +21 -0
- package/dist/components/icons/generated/index.figma.d.ts +1 -0
- package/dist/components/images/generated/index.figma.d.ts +1 -0
- package/dist/components/input/Input.figma.d.ts +1 -0
- package/dist/components/list-item/ListItem.figma.d.ts +1 -0
- package/dist/components/notification/Notification.figma.d.ts +1 -0
- package/dist/components/page-indicator/PageIndicator.figma.d.ts +1 -0
- package/dist/components/pagination/Pagination.figma.d.ts +1 -0
- package/dist/components/pagination/PaginationArrow.figma.d.ts +1 -0
- package/dist/components/popover/Popover.figma.d.ts +1 -0
- package/dist/components/radio/Radio.figma.d.ts +1 -0
- package/dist/components/radio/RadioGroup.figma.d.ts +1 -0
- package/dist/components/switch/Switch.figma.d.ts +1 -0
- package/dist/components/tabs/LineTab.figma.d.ts +1 -0
- package/dist/components/tabs/LineTabs.figma.d.ts +1 -0
- package/dist/components/tabs/PanelTabs/PanelTab.figma.d.ts +1 -0
- package/dist/components/tabs/PanelTabs/PanelTabGroup.figma.d.ts +1 -0
- package/dist/components/tabs/PanelTabs/PanelTabs.figma.d.ts +1 -0
- package/dist/components/time-picker/TimePicker.figma.d.ts +1 -0
- package/dist/components/time-picker/TimeRangePicker.figma.d.ts +1 -0
- package/dist/components/toast/Toast.figma.d.ts +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +6 -2
- package/dist/components/tooltip/Tooltip.figma.d.ts +1 -0
- package/dist/container/page-header/PageHeader.figma.d.ts +1 -0
- package/dist/container/section-title/SectionTitle.figma.d.ts +1 -0
- package/dist/container/state/State.figma.d.ts +1 -0
- package/dist/index.es.js +7 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/docs/figma_copy_link.png +0 -0
- package/docs/figma_main_component.png +0 -0
- package/figma.config.json +8 -0
- package/package.json +3 -2
- package/scripts/figma-import-icons.js +103 -0
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@croquiscom/pds",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.35.0",
|
|
4
4
|
"description": "Design system for Zigzag's Partner Center",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build": "npm run build-rollup && npm run test:type",
|
|
24
24
|
"lint": "eslint 'src/**/*.{js,ts,tsx}' --quiet --fix",
|
|
25
25
|
"changeset": "changeset",
|
|
26
|
-
"svgr": "yarn svgr:icons && yarn svgr:images",
|
|
26
|
+
"svgr": "yarn svgr:icons && yarn svgr:images && node ./scripts/figma-import-icons.js",
|
|
27
27
|
"svgr:icons": "svgr --config-file .svgrrc.icons.js -- assets/icons",
|
|
28
28
|
"svgr:images": "svgr --config-file .svgrrc.images.js -- assets/images",
|
|
29
29
|
"release": "yarn build && changeset publish",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@emotion/babel-preset-css-prop": "^11.2.0",
|
|
44
44
|
"@emotion/react": "^11.4.0",
|
|
45
45
|
"@emotion/styled": "^11.3.0",
|
|
46
|
+
"@figma/code-connect": "^1.0.6",
|
|
46
47
|
"@figma/plugin-typings": "^1.97.0",
|
|
47
48
|
"@rollup/plugin-babel": "^5.3.0",
|
|
48
49
|
"@rollup/plugin-commonjs": "^19.0.0",
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
|
|
3
|
+
const figma_rest_api = require('@figma/code-connect/dist/connect/figma_rest_api');
|
|
4
|
+
const helpers = require('@figma/code-connect/dist/connect/helpers');
|
|
5
|
+
require('dotenv').config();
|
|
6
|
+
/**
|
|
7
|
+
* Fetch components from a figma file. If the `node-id` query parameter is used,
|
|
8
|
+
* only components within those frames will be included. This is useful if your
|
|
9
|
+
* file is very large, as this will speed up the query.
|
|
10
|
+
*
|
|
11
|
+
* @param fileOrNode a figma file URL
|
|
12
|
+
* @param match a function that returns true if the component should be included
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
async function getComponents(fileOrNode) {
|
|
16
|
+
if (!process.env.FIGMA_ACCESS_TOKEN) {
|
|
17
|
+
throw new Error('FIGMA_ACCESS_TOKEN is not set');
|
|
18
|
+
}
|
|
19
|
+
const fileKey = helpers.parseFileKey(fileOrNode);
|
|
20
|
+
if (!fileKey) {
|
|
21
|
+
throw new Error(`Invalid Figma file URL: ${fileOrNode}, file key missing`);
|
|
22
|
+
}
|
|
23
|
+
const nodeIds = helpers.parseNodeIds([fileOrNode]);
|
|
24
|
+
let apiUrl = figma_rest_api.getApiUrl(fileOrNode ?? '') + `/files/${fileKey}`;
|
|
25
|
+
if (nodeIds.length > 0) {
|
|
26
|
+
apiUrl += `?ids=${nodeIds.join(',')}`;
|
|
27
|
+
}
|
|
28
|
+
const doc = await figma_rest_api.getDocument(apiUrl, process.env.FIGMA_ACCESS_TOKEN);
|
|
29
|
+
// `doc` in this case will only include the top frame(s) passed via `ids`. We omit the
|
|
30
|
+
// nodeIds arg here because we want to return all components within the frame(s)
|
|
31
|
+
return helpers.findComponentsInDocument(doc).map((component) => ({
|
|
32
|
+
...component,
|
|
33
|
+
fileKey,
|
|
34
|
+
figmaUrl: helpers.figmaUrlOfComponent(component, fileKey),
|
|
35
|
+
componentPropertyDefinitions: Object.keys(component.componentPropertyDefinitions ?? {}).reduce((result, key) => {
|
|
36
|
+
return {
|
|
37
|
+
...result,
|
|
38
|
+
// this removes the ID prefix from property names e.g #123:name -> name
|
|
39
|
+
[helpers.normalizePropName(key)]: component.componentPropertyDefinitions[key],
|
|
40
|
+
};
|
|
41
|
+
}, {}),
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const fs = require('fs/promises');
|
|
46
|
+
const path = require('path');
|
|
47
|
+
|
|
48
|
+
async function generateIcons(workdir, url, prefix) {
|
|
49
|
+
const file_list = await fs.readdir(workdir);
|
|
50
|
+
const file_names = new Map();
|
|
51
|
+
file_list.forEach((name) => {
|
|
52
|
+
const match = /^(.+)\.tsx$/.exec(name);
|
|
53
|
+
if (match != null) {
|
|
54
|
+
const name = prefix + match[1];
|
|
55
|
+
file_names.set(name.toLowerCase(), name);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// fetch components from a figma file. If the `node-id` query parameter is used,
|
|
60
|
+
// only components within those frames will be included. This is useful if your
|
|
61
|
+
// file is very large, as this will speed up the query by a lot
|
|
62
|
+
let components = await getComponents(url);
|
|
63
|
+
|
|
64
|
+
components = components
|
|
65
|
+
.filter((component) => !component.name.startsWith('_') && !['Divider', 'Badge'].includes(component.name))
|
|
66
|
+
.map((component) => ({
|
|
67
|
+
...component,
|
|
68
|
+
name: prefix + component.name,
|
|
69
|
+
}))
|
|
70
|
+
.filter((component) => file_names.has(component.name.toLowerCase()));
|
|
71
|
+
|
|
72
|
+
const unique_names = new Set([...components.map((c) => c.name)]);
|
|
73
|
+
|
|
74
|
+
await fs.writeFile(
|
|
75
|
+
path.resolve(workdir, 'index.figma.tsx'),
|
|
76
|
+
`\
|
|
77
|
+
import figma from '@figma/code-connect';
|
|
78
|
+
|
|
79
|
+
import {
|
|
80
|
+
${Array.from(unique_names)
|
|
81
|
+
.map((icon_name) => ` ${file_names.get(icon_name.toLowerCase())},`)
|
|
82
|
+
.join('\n')}
|
|
83
|
+
} from './index';
|
|
84
|
+
|
|
85
|
+
${components.map((c) => `figma.connect(${file_names.get(c.name.toLowerCase())}, '${c.figmaUrl}');`).join('\n')}
|
|
86
|
+
`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function main() {
|
|
91
|
+
await generateIcons(
|
|
92
|
+
path.resolve(__dirname, '../src/components/icons/generated'),
|
|
93
|
+
'https://www.figma.com/design/wywk2ryXpfBhqmT7gCLqA3/PDS-1.0.0?node-id=27143-50477&t=iHi25buXZJjDriTk-4',
|
|
94
|
+
'Icon',
|
|
95
|
+
);
|
|
96
|
+
await generateIcons(
|
|
97
|
+
path.resolve(__dirname, '../src/components/images/generated'),
|
|
98
|
+
'https://www.figma.com/design/wywk2ryXpfBhqmT7gCLqA3/PDS-1.0.0?node-id=32677-30981&t=Y6JYW1FKqR7VNCsj-4',
|
|
99
|
+
'Image',
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
main();
|