@gravity-ui/querieskit 1.3.1 → 1.3.2
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/build/cjs/components/AttachmentList/AttachmentList.d.ts +2 -2
- package/build/cjs/components/AttachmentList/AttachmentList.js +9 -1
- package/build/cjs/components/AttachmentList/AttachmentList.js.map +1 -1
- package/build/cjs/components/AttachmentList/AttachmentList.stories.d.ts +36 -20
- package/build/cjs/components/AttachmentList/AttachmentList.stories.js +3 -0
- package/build/cjs/components/AttachmentList/AttachmentList.stories.js.map +1 -1
- package/build/cjs/components/AttachmentList/helpers/isInteractiveTarget.d.ts +2 -0
- package/build/cjs/components/AttachmentList/helpers/isInteractiveTarget.js +11 -0
- package/build/cjs/components/AttachmentList/helpers/isInteractiveTarget.js.map +1 -0
- package/build/cjs/modules/Attachments/Attachments.css +4 -0
- package/build/cjs/modules/Attachments/Attachments.css.map +1 -1
- package/build/cjs/modules/Attachments/Attachments.d.ts +2 -1
- package/build/cjs/modules/Attachments/Attachments.js +8 -1
- package/build/cjs/modules/Attachments/Attachments.js.map +1 -1
- package/build/cjs/modules/Attachments/Attachments.stories.d.ts +2 -1
- package/build/cjs/modules/Attachments/Attachments.stories.js +7 -3
- package/build/cjs/modules/Attachments/Attachments.stories.js.map +1 -1
- package/build/esm/components/AttachmentList/AttachmentList.d.ts +2 -2
- package/build/esm/components/AttachmentList/AttachmentList.js +9 -1
- package/build/esm/components/AttachmentList/AttachmentList.js.map +1 -1
- package/build/esm/components/AttachmentList/AttachmentList.stories.d.ts +36 -20
- package/build/esm/components/AttachmentList/AttachmentList.stories.js +3 -0
- package/build/esm/components/AttachmentList/AttachmentList.stories.js.map +1 -1
- package/build/esm/components/AttachmentList/helpers/isInteractiveTarget.d.ts +2 -0
- package/build/esm/components/AttachmentList/helpers/isInteractiveTarget.js +5 -0
- package/build/esm/components/AttachmentList/helpers/isInteractiveTarget.js.map +1 -0
- package/build/esm/modules/Attachments/Attachments.css +4 -0
- package/build/esm/modules/Attachments/Attachments.css.map +1 -1
- package/build/esm/modules/Attachments/Attachments.d.ts +2 -1
- package/build/esm/modules/Attachments/Attachments.js +8 -1
- package/build/esm/modules/Attachments/Attachments.js.map +1 -1
- package/build/esm/modules/Attachments/Attachments.scss +5 -0
- package/build/esm/modules/Attachments/Attachments.stories.d.ts +2 -1
- package/build/esm/modules/Attachments/Attachments.stories.js +7 -3
- package/build/esm/modules/Attachments/Attachments.stories.js.map +1 -1
- package/package.json +1 -1
|
@@ -62,14 +62,16 @@ export var Default = {
|
|
|
62
62
|
description: 'Add files or links that should be available to the query.',
|
|
63
63
|
linkForDoc: '#attachments-help',
|
|
64
64
|
linkText: 'About attachments'
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
|
+
onItemClick: console.info
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
/** Initial files and links supplied through the uncontrolled `attachments` API. */
|
|
70
71
|
export var WithAttachments = {
|
|
71
72
|
args: {
|
|
72
|
-
attachments: attachments
|
|
73
|
+
attachments: attachments,
|
|
74
|
+
onItemClick: console.info
|
|
73
75
|
}
|
|
74
76
|
};
|
|
75
77
|
|
|
@@ -77,7 +79,8 @@ export var WithAttachments = {
|
|
|
77
79
|
export var WithDeletedAttachments = {
|
|
78
80
|
args: {
|
|
79
81
|
attachments: attachments,
|
|
80
|
-
deletedAttachments: deletedAttachments
|
|
82
|
+
deletedAttachments: deletedAttachments,
|
|
83
|
+
onItemClick: console.info
|
|
81
84
|
}
|
|
82
85
|
};
|
|
83
86
|
var ControlledAttachments = function ControlledAttachments(props) {
|
|
@@ -93,6 +96,7 @@ var ControlledAttachments = function ControlledAttachments(props) {
|
|
|
93
96
|
return /*#__PURE__*/_jsx(Attachments, _objectSpread(_objectSpread({}, props), {}, {
|
|
94
97
|
attachments: currentAttachments,
|
|
95
98
|
deletedAttachments: currentDeletedAttachments,
|
|
99
|
+
onItemClick: console.info,
|
|
96
100
|
onChange: function onChange(payload) {
|
|
97
101
|
var _props$onChange;
|
|
98
102
|
setCurrentAttachments(payload.attachments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","fn","Attachments","jsx","_jsx","attachments","id","name","link","token","deletedAttachments","tokens","value","title","meta","component","tags","parameters","layout","decorators","Story","style","height","width","children","args","onChange","Default","placeholderProps","description","linkForDoc","linkText","WithAttachments","WithDeletedAttachments","ControlledAttachments","props","_props$attachments","_props$deletedAttachm","_useState","_useState2","_slicedToArray","currentAttachments","setCurrentAttachments","_useState3","_useState4","currentDeletedAttachments","setCurrentDeletedAttachments","_objectSpread","payload","_props$onChange","call","Controlled","render"],"sources":["Attachments.stories.tsx"],"sourcesContent":["import React, {useState} from 'react';\nimport type {Meta, StoryObj} from '@storybook/react';\nimport {fn} from 'storybook/test';\nimport {Attachments} from './Attachments';\n\ntype AttachmentsProps = React.ComponentProps<typeof Attachments>;\ntype Attachment = NonNullable<AttachmentsProps['attachments']>[number];\n\nconst attachments: Attachment[] = [\n {id: 'readme', name: 'README.md'},\n {id: 'query', name: 'daily-report.sql'},\n {\n id: 'documentation',\n name: 'Query documentation',\n link: 'https://example.com/docs/query',\n token: 'documentation-token',\n },\n];\n\nconst deletedAttachments: Attachment[] = [\n {id: 'archive', name: 'archive.csv'},\n {\n id: 'old-dashboard',\n name: 'Old dashboard',\n link: 'https://example.com/dashboards/old',\n token: 'dashboard-token',\n },\n];\n\nconst tokens: NonNullable<AttachmentsProps['tokens']> = [\n {value: 'documentation-token', title: 'Documentation token'},\n {value: 'dashboard-token', title: 'Dashboard token'},\n];\n\nconst meta = {\n title: 'Modules/Attachments',\n component: Attachments,\n tags: ['autodocs'],\n parameters: {\n layout: 'padded',\n },\n decorators: [\n (Story) => (\n <div style={{height: 500, width: 322}}>\n <Story />\n </div>\n ),\n ],\n args: {\n tokens,\n onChange: fn(),\n },\n} satisfies Meta<typeof Attachments>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\n/** Empty state with content configured through `placeholderProps`. */\nexport const Default: Story = {\n args: {\n placeholderProps: {\n title: 'No attachments',\n description: 'Add files or links that should be available to the query.',\n linkForDoc: '#attachments-help',\n linkText: 'About attachments',\n },\n },\n};\n\n/** Initial files and links supplied through the uncontrolled `attachments` API. */\nexport const WithAttachments: Story = {\n args: {\n attachments,\n },\n};\n\n/** Current and deleted collections. Open the Deleted tab to restore an attachment. */\nexport const WithDeletedAttachments: Story = {\n args: {\n attachments,\n deletedAttachments,\n },\n};\n\nconst ControlledAttachments = (props: AttachmentsProps) => {\n const [currentAttachments, setCurrentAttachments] = useState(props.attachments ?? []);\n const [currentDeletedAttachments, setCurrentDeletedAttachments] = useState(\n props.deletedAttachments ?? [],\n );\n\n return (\n <Attachments\n {...props}\n attachments={currentAttachments}\n deletedAttachments={currentDeletedAttachments}\n onChange={(payload) => {\n setCurrentAttachments(payload.attachments);\n setCurrentDeletedAttachments(payload.deletedAttachments);\n props.onChange?.(payload);\n }}\n />\n );\n};\n\n/** Controlled usage: every edit, delete, restore, or addition is applied from `onChange`. */\nexport const Controlled: Story = {\n args: {\n attachments,\n deletedAttachments,\n },\n render: (args) => <ControlledAttachments {...args} />,\n};\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,QAAQ,QAAO,OAAO;AAErC,SAAQC,EAAE,QAAO,gBAAgB;AACjC,SAAQC,WAAW;AAAuB,SAAAC,GAAA,IAAAC,IAAA;AAK1C,IAAMC,WAAyB,GAAG,CAC9B;EAACC,EAAE,EAAE,QAAQ;EAAEC,IAAI,EAAE;AAAW,CAAC,EACjC;EAACD,EAAE,EAAE,OAAO;EAAEC,IAAI,EAAE;AAAkB,CAAC,EACvC;EACID,EAAE,EAAE,eAAe;EACnBC,IAAI,EAAE,qBAAqB;EAC3BC,IAAI,EAAE,gCAAgC;EACtCC,KAAK,EAAE;AACX,CAAC,CACJ;AAED,IAAMC,kBAAgC,GAAG,CACrC;EAACJ,EAAE,EAAE,SAAS;EAAEC,IAAI,EAAE;AAAa,CAAC,EACpC;EACID,EAAE,EAAE,eAAe;EACnBC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,oCAAoC;EAC1CC,KAAK,EAAE;AACX,CAAC,CACJ;AAED,IAAME,MAA+C,GAAG,CACpD;EAACC,KAAK,EAAE,qBAAqB;EAAEC,KAAK,EAAE;AAAqB,CAAC,EAC5D;EAACD,KAAK,EAAE,iBAAiB;EAAEC,KAAK,EAAE;AAAiB,CAAC,CACvD;AAED,IAAMC,IAAI,GAAG;EACTD,KAAK,EAAE,qBAAqB;EAC5BE,SAAS,EAAEb,WAAW;EACtBc,IAAI,EAAE,CAAC,UAAU,CAAC;EAClBC,UAAU,EAAE;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,UAAU,EAAE,CACR,UAACC,KAAK;IAAA,oBACFhB,IAAA;MAAKiB,KAAK,EAAE;QAACC,MAAM,EAAE,GAAG;QAAEC,KAAK,EAAE;MAAG,CAAE;MAAAC,QAAA,eAClCpB,IAAA,CAACgB,KAAK,IAAE;IAAC,CACR,CAAC;EAAA,CACT,CACJ;EACDK,IAAI,EAAE;IACFd,MAAM,EAANA,MAAM;IACNe,QAAQ,EAAEzB,EAAE,CAAC;EACjB;AACJ,CAAoC;AAEpC,eAAea,IAAI;AAGnB;AACA,OAAO,IAAMa,OAAc,GAAG;EAC1BF,IAAI,EAAE;IACFG,gBAAgB,EAAE;MACdf,KAAK,EAAE,gBAAgB;MACvBgB,WAAW,EAAE,2DAA2D;MACxEC,UAAU,EAAE,mBAAmB;MAC/BC,QAAQ,EAAE;IACd;
|
|
1
|
+
{"version":3,"names":["React","useState","fn","Attachments","jsx","_jsx","attachments","id","name","link","token","deletedAttachments","tokens","value","title","meta","component","tags","parameters","layout","decorators","Story","style","height","width","children","args","onChange","Default","placeholderProps","description","linkForDoc","linkText","onItemClick","console","info","WithAttachments","WithDeletedAttachments","ControlledAttachments","props","_props$attachments","_props$deletedAttachm","_useState","_useState2","_slicedToArray","currentAttachments","setCurrentAttachments","_useState3","_useState4","currentDeletedAttachments","setCurrentDeletedAttachments","_objectSpread","payload","_props$onChange","call","Controlled","render"],"sources":["Attachments.stories.tsx"],"sourcesContent":["import React, {useState} from 'react';\nimport type {Meta, StoryObj} from '@storybook/react';\nimport {fn} from 'storybook/test';\nimport {Attachments} from './Attachments';\n\ntype AttachmentsProps = React.ComponentProps<typeof Attachments>;\ntype Attachment = NonNullable<AttachmentsProps['attachments']>[number];\n\nconst attachments: Attachment[] = [\n {id: 'readme', name: 'README.md'},\n {id: 'query', name: 'daily-report.sql'},\n {\n id: 'documentation',\n name: 'Query documentation',\n link: 'https://example.com/docs/query',\n token: 'documentation-token',\n },\n];\n\nconst deletedAttachments: Attachment[] = [\n {id: 'archive', name: 'archive.csv'},\n {\n id: 'old-dashboard',\n name: 'Old dashboard',\n link: 'https://example.com/dashboards/old',\n token: 'dashboard-token',\n },\n];\n\nconst tokens: NonNullable<AttachmentsProps['tokens']> = [\n {value: 'documentation-token', title: 'Documentation token'},\n {value: 'dashboard-token', title: 'Dashboard token'},\n];\n\nconst meta = {\n title: 'Modules/Attachments',\n component: Attachments,\n tags: ['autodocs'],\n parameters: {\n layout: 'padded',\n },\n decorators: [\n (Story) => (\n <div style={{height: 500, width: 322}}>\n <Story />\n </div>\n ),\n ],\n args: {\n tokens,\n onChange: fn(),\n },\n} satisfies Meta<typeof Attachments>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\n/** Empty state with content configured through `placeholderProps`. */\nexport const Default: Story = {\n args: {\n placeholderProps: {\n title: 'No attachments',\n description: 'Add files or links that should be available to the query.',\n linkForDoc: '#attachments-help',\n linkText: 'About attachments',\n },\n onItemClick: console.info,\n },\n};\n\n/** Initial files and links supplied through the uncontrolled `attachments` API. */\nexport const WithAttachments: Story = {\n args: {\n attachments,\n onItemClick: console.info,\n },\n};\n\n/** Current and deleted collections. Open the Deleted tab to restore an attachment. */\nexport const WithDeletedAttachments: Story = {\n args: {\n attachments,\n deletedAttachments,\n onItemClick: console.info,\n },\n};\n\nconst ControlledAttachments = (props: AttachmentsProps) => {\n const [currentAttachments, setCurrentAttachments] = useState(props.attachments ?? []);\n const [currentDeletedAttachments, setCurrentDeletedAttachments] = useState(\n props.deletedAttachments ?? [],\n );\n\n return (\n <Attachments\n {...props}\n attachments={currentAttachments}\n deletedAttachments={currentDeletedAttachments}\n onItemClick={console.info}\n onChange={(payload) => {\n setCurrentAttachments(payload.attachments);\n setCurrentDeletedAttachments(payload.deletedAttachments);\n props.onChange?.(payload);\n }}\n />\n );\n};\n\n/** Controlled usage: every edit, delete, restore, or addition is applied from `onChange`. */\nexport const Controlled: Story = {\n args: {\n attachments,\n deletedAttachments,\n },\n render: (args) => <ControlledAttachments {...args} />,\n};\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,QAAQ,QAAO,OAAO;AAErC,SAAQC,EAAE,QAAO,gBAAgB;AACjC,SAAQC,WAAW;AAAuB,SAAAC,GAAA,IAAAC,IAAA;AAK1C,IAAMC,WAAyB,GAAG,CAC9B;EAACC,EAAE,EAAE,QAAQ;EAAEC,IAAI,EAAE;AAAW,CAAC,EACjC;EAACD,EAAE,EAAE,OAAO;EAAEC,IAAI,EAAE;AAAkB,CAAC,EACvC;EACID,EAAE,EAAE,eAAe;EACnBC,IAAI,EAAE,qBAAqB;EAC3BC,IAAI,EAAE,gCAAgC;EACtCC,KAAK,EAAE;AACX,CAAC,CACJ;AAED,IAAMC,kBAAgC,GAAG,CACrC;EAACJ,EAAE,EAAE,SAAS;EAAEC,IAAI,EAAE;AAAa,CAAC,EACpC;EACID,EAAE,EAAE,eAAe;EACnBC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,oCAAoC;EAC1CC,KAAK,EAAE;AACX,CAAC,CACJ;AAED,IAAME,MAA+C,GAAG,CACpD;EAACC,KAAK,EAAE,qBAAqB;EAAEC,KAAK,EAAE;AAAqB,CAAC,EAC5D;EAACD,KAAK,EAAE,iBAAiB;EAAEC,KAAK,EAAE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