@coveord/plasma-mantine 49.0.2 → 49.1.1
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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +13 -11
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/button/Button.js +28 -0
- package/dist/cjs/components/button/Button.js.map +1 -0
- package/dist/cjs/components/button/ButtonWithDisabledTooltip.js +64 -0
- package/dist/cjs/components/button/ButtonWithDisabledTooltip.js.map +1 -0
- package/dist/cjs/components/button/index.js +8 -0
- package/dist/cjs/components/button/index.js.map +1 -0
- package/dist/cjs/components/collection/Collection.js +7 -5
- package/dist/cjs/components/collection/Collection.js.map +1 -1
- package/dist/cjs/components/date-range-picker/DateRangePickerInlineCalendar.js +3 -2
- package/dist/cjs/components/date-range-picker/DateRangePickerInlineCalendar.js.map +1 -1
- package/dist/cjs/components/index.js +2 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/inline-confirm/InlineConfirmButton.js +2 -2
- package/dist/cjs/components/inline-confirm/InlineConfirmButton.js.map +1 -1
- package/dist/cjs/components/inline-confirm/InlineConfirmPrompt.js +3 -2
- package/dist/cjs/components/inline-confirm/InlineConfirmPrompt.js.map +1 -1
- package/dist/cjs/components/menu/Menu.js +29 -0
- package/dist/cjs/components/menu/Menu.js.map +1 -0
- package/dist/cjs/components/menu/index.js +8 -0
- package/dist/cjs/components/menu/index.js.map +1 -0
- package/dist/cjs/components/modal-wizard/ModalWizard.js +4 -3
- package/dist/cjs/components/modal-wizard/ModalWizard.js.map +1 -1
- package/dist/cjs/components/table/TableDateRangePicker.js +2 -1
- package/dist/cjs/components/table/TableDateRangePicker.js.map +1 -1
- package/dist/cjs/components/table/TableHeader.js +2 -1
- package/dist/cjs/components/table/TableHeader.js.map +1 -1
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/createPolymorphicComponent.js +14 -0
- package/dist/cjs/utils/createPolymorphicComponent.js.map +1 -0
- package/dist/cjs/utils/index.js +9 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/overrideComponent.js +29 -0
- package/dist/cjs/utils/overrideComponent.js.map +1 -0
- package/dist/definitions/components/button/Button.d.ts +16 -0
- package/dist/definitions/components/button/Button.d.ts.map +1 -0
- package/dist/definitions/components/button/ButtonWithDisabledTooltip.d.ts +24 -0
- package/dist/definitions/components/button/ButtonWithDisabledTooltip.d.ts.map +1 -0
- package/dist/definitions/components/button/index.d.ts +3 -0
- package/dist/definitions/components/button/index.d.ts.map +1 -0
- package/dist/definitions/components/collection/Collection.d.ts.map +1 -1
- package/dist/definitions/components/date-range-picker/DateRangePickerInlineCalendar.d.ts.map +1 -1
- package/dist/definitions/components/index.d.ts +2 -0
- package/dist/definitions/components/index.d.ts.map +1 -1
- package/dist/definitions/components/inline-confirm/InlineConfirmButton.d.ts +1 -1
- package/dist/definitions/components/inline-confirm/InlineConfirmButton.d.ts.map +1 -1
- package/dist/definitions/components/inline-confirm/InlineConfirmPrompt.d.ts.map +1 -1
- package/dist/definitions/components/menu/Menu.d.ts +16 -0
- package/dist/definitions/components/menu/Menu.d.ts.map +1 -0
- package/dist/definitions/components/menu/index.d.ts +2 -0
- package/dist/definitions/components/menu/index.d.ts.map +1 -0
- package/dist/definitions/components/modal-wizard/ModalWizard.d.ts.map +1 -1
- package/dist/definitions/components/table/TableDateRangePicker.d.ts.map +1 -1
- package/dist/definitions/components/table/TableHeader.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +1 -1
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/utils/createPolymorphicComponent.d.ts +3 -0
- package/dist/definitions/utils/createPolymorphicComponent.d.ts.map +1 -0
- package/dist/definitions/utils/index.d.ts +3 -0
- package/dist/definitions/utils/index.d.ts.map +1 -0
- package/dist/definitions/utils/overrideComponent.d.ts +10 -0
- package/dist/definitions/utils/overrideComponent.d.ts.map +1 -0
- package/dist/esm/components/button/Button.js +18 -0
- package/dist/esm/components/button/Button.js.map +1 -0
- package/dist/esm/components/button/ButtonWithDisabledTooltip.js +54 -0
- package/dist/esm/components/button/ButtonWithDisabledTooltip.js.map +1 -0
- package/dist/esm/components/button/index.js +3 -0
- package/dist/esm/components/button/index.js.map +1 -0
- package/dist/esm/components/collection/Collection.js +8 -6
- package/dist/esm/components/collection/Collection.js.map +1 -1
- package/dist/esm/components/date-range-picker/DateRangePickerInlineCalendar.js +2 -1
- package/dist/esm/components/date-range-picker/DateRangePickerInlineCalendar.js.map +1 -1
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/inline-confirm/InlineConfirmButton.js +1 -1
- package/dist/esm/components/inline-confirm/InlineConfirmButton.js.map +1 -1
- package/dist/esm/components/inline-confirm/InlineConfirmPrompt.js +2 -1
- package/dist/esm/components/inline-confirm/InlineConfirmPrompt.js.map +1 -1
- package/dist/esm/components/menu/Menu.js +19 -0
- package/dist/esm/components/menu/Menu.js.map +1 -0
- package/dist/esm/components/menu/index.js +3 -0
- package/dist/esm/components/menu/index.js.map +1 -0
- package/dist/esm/components/modal-wizard/ModalWizard.js +3 -2
- package/dist/esm/components/modal-wizard/ModalWizard.js.map +1 -1
- package/dist/esm/components/table/TableDateRangePicker.js +2 -1
- package/dist/esm/components/table/TableDateRangePicker.js.map +1 -1
- package/dist/esm/components/table/TableHeader.js +2 -1
- package/dist/esm/components/table/TableHeader.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/createPolymorphicComponent.js +8 -0
- package/dist/esm/utils/createPolymorphicComponent.js.map +1 -0
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/overrideComponent.js +19 -0
- package/dist/esm/utils/overrideComponent.js.map +1 -0
- package/package.json +5 -3
- package/src/components/button/Button.tsx +27 -0
- package/src/components/button/ButtonWithDisabledTooltip.tsx +58 -0
- package/src/components/button/__tests__/ButtonWithDisabledTooltip.spec.tsx +52 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/collection/Collection.tsx +6 -4
- package/src/components/date-range-picker/DateRangePickerInlineCalendar.tsx +2 -1
- package/src/components/index.ts +2 -0
- package/src/components/inline-confirm/InlineConfirmButton.tsx +2 -1
- package/src/components/inline-confirm/InlineConfirmPrompt.tsx +2 -1
- package/src/components/menu/Menu.tsx +18 -0
- package/src/components/menu/index.ts +1 -0
- package/src/components/modal-wizard/ModalWizard.tsx +4 -2
- package/src/components/table/TableDateRangePicker.tsx +3 -1
- package/src/components/table/TableHeader.tsx +2 -1
- package/src/components/table/__tests__/TableActions.spec.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/utils/__tests__/overrideComponent.spec.tsx +74 -0
- package/src/utils/createPolymorphicComponent.ts +8 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/overrideComponent.ts +18 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/table/TableHeader.tsx"],"sourcesContent":["import {CrossSize16Px} from '@coveord/plasma-react-icons';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/table/TableHeader.tsx"],"sourcesContent":["import {CrossSize16Px} from '@coveord/plasma-react-icons';\nimport {createStyles, DefaultProps, Group, Selectors, Space, Tooltip} from '@mantine/core';\nimport {FunctionComponent, ReactNode} from 'react';\n\nimport {Button} from '../button';\nimport {useTable} from './useTable';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n position: 'sticky',\n top: 0,\n zIndex: 13, // skeleton is 11\n backgroundColor: theme.colors.gray[1],\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n },\n}));\n\ntype TableHeaderStylesNames = Selectors<typeof useStyles>;\ninterface TableHeaderProps extends DefaultProps<TableHeaderStylesNames> {\n /* Children of header (ie: actions, datepicker, etc.) */\n children?: ReactNode;\n}\nexport const TableHeader: FunctionComponent<TableHeaderProps> = ({\n classNames,\n styles,\n unstyled,\n children,\n ...others\n}) => {\n const {getSelectedRows, multiRowSelectionEnabled, clearSelection} = useTable();\n const {classes} = useStyles(null, {name: 'TableHeader', classNames, styles, unstyled});\n const selectedRows = getSelectedRows();\n return multiRowSelectionEnabled ? (\n <Group position=\"apart\" className={classes.root}>\n {selectedRows.length > 0 ? (\n <Tooltip label=\"Unselect all\">\n <Button onClick={clearSelection} ml=\"lg\" variant=\"subtle\" leftIcon={<CrossSize16Px height={16} />}>\n {selectedRows.length} selected\n </Button>\n </Tooltip>\n ) : (\n <Space />\n )}\n <Group position=\"right\" spacing=\"lg\" px=\"md\" py=\"sm\" {...others}>\n {children}\n </Group>\n </Group>\n ) : (\n <Group position=\"right\" spacing=\"lg\" px=\"md\" py=\"sm\" className={classes.root} {...others}>\n {children}\n </Group>\n );\n};\n"],"names":["TableHeader","useStyles","createStyles","theme","root","position","top","zIndex","backgroundColor","colors","gray","borderBottom","classNames","styles","unstyled","children","others","useTable","getSelectedRows","multiRowSelectionEnabled","clearSelection","classes","name","selectedRows","Group","className","length","Tooltip","label","Button","onClick","ml","variant","leftIcon","CrossSize16Px","height","Space","spacing","px","py"],"mappings":"AAAA;;;;+BAsBaA;;;eAAAA;;;;;;;gCAtBe;oBAC+C;sBAGtD;wBACE;AAEvB,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,MAAM;YACFC,UAAU;YACVC,KAAK;YACLC,QAAQ;YACRC,iBAAiBL,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;YACrCC,cAAc,AAAC,aAAiC,OAArBR,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;QACnD;IACJ;;AAOO,IAAMV,cAAmD,iBAM1D;QALFY,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACAC,kBAAAA,UACGC;QAJHJ;QACAC;QACAC;QACAC;;IAGA,IAAoEE,aAAAA,IAAAA,kBAAQ,KAArEC,kBAA6DD,WAA7DC,iBAAiBC,2BAA4CF,WAA5CE,0BAA0BC,iBAAkBH,WAAlBG;IAClD,IAAM,AAACC,UAAWpB,UAAU,IAAI,EAAE;QAACqB,MAAM;QAAeV,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,GAA7EO;IACP,IAAME,eAAeL;IACrB,OAAOC,yCACH,sBAACK,WAAK;QAACnB,UAAS;QAAQoB,WAAWJ,QAAQjB,IAAI;;YAC1CmB,aAAaG,MAAM,GAAG,kBACnB,qBAACC,aAAO;gBAACC,OAAM;0BACX,cAAA,sBAACC,cAAM;oBAACC,SAASV;oBAAgBW,IAAG;oBAAKC,SAAQ;oBAASC,wBAAU,qBAACC,+BAAa;wBAACC,QAAQ;;;wBACtFZ,aAAaG,MAAM;wBAAC;;;+BAI7B,qBAACU,WAAK,KACT;0BACD,qBAACZ,WAAK;gBAACnB,UAAS;gBAAQgC,SAAQ;gBAAKC,IAAG;gBAAKC,IAAG;eAASvB;0BACpDD;;;uBAIT,qBAACS,WAAK;QAACnB,UAAS;QAAQgC,SAAQ;QAAKC,IAAG;QAAKC,IAAG;QAAKd,WAAWJ,QAAQjB,IAAI;OAAMY;kBAC7ED;OAER;AACL"}
|
package/dist/cjs/index.js
CHANGED
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport {createColumnHelper, type ColumnDef} from '@tanstack/table-core';\nexport * from './components';\nexport * from '@mantine/form';\n// explicitly overriding mantine components\nexport {Header, Table, type HeaderProps, Modal} from './components';\nexport {useForm, createFormContext} from './form';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["createColumnHelper","Header","Table","Modal","useForm","createFormContext"],"mappings":"AAAA;;;;;;;;;;;IAQQA,kBAAkB;eAAlBA,6BAAkB;;IAIlBC,MAAM;eAANA,kBAAM;;IAAEC,KAAK;eAALA,iBAAK;;IAAoBC,KAAK;eAALA,iBAAK;;
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport {createColumnHelper, type ColumnDef} from '@tanstack/table-core';\nexport * from './components';\nexport * from '@mantine/form';\n// explicitly overriding mantine components\nexport {Header, Table, type HeaderProps, Modal, Button, type ButtonProps, Menu, type MenuItemProps} from './components';\nexport {useForm, createFormContext} from './form';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["createColumnHelper","Header","Table","Modal","Button","Menu","useForm","createFormContext"],"mappings":"AAAA;;;;;;;;;;;IAQQA,kBAAkB;eAAlBA,6BAAkB;;IAIlBC,MAAM;eAANA,kBAAM;;IAAEC,KAAK;eAALA,iBAAK;;IAAoBC,KAAK;eAALA,iBAAK;;IAAEC,MAAM;eAANA,kBAAM;;IAAoBC,IAAI;eAAJA,gBAAI;;IACtEC,OAAO;eAAPA,aAAO;;IAAEC,iBAAiB;eAAjBA,uBAAiB;;;;oBATpB;oBACA;oBAEA;yBACmC;sCACnC;oBACA;oBAG2B;oBAE3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createPolymorphicComponent", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return createPolymorphicComponent;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _utils = require("@mantine/utils");
|
|
12
|
+
var createPolymorphicComponent = _utils.createPolymorphicComponent;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=createPolymorphicComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/createPolymorphicComponent.ts"],"sourcesContent":["import {createPolymorphicComponent as mantineCreatePolymorphicComponent} from '@mantine/utils';\n\n/*\n * createPolymorphicComponent is already exported from @mantine/core, but there is an issue when using pnpm + typescript\n * that forces us to use it directly from @mantine/utils (see https://github.com/microsoft/TypeScript/issues/47663)\n * We are simply rexporting it here to avoid having to deal with this issue everywhere\n */\nexport const createPolymorphicComponent = mantineCreatePolymorphicComponent;\n"],"names":["createPolymorphicComponent","mantineCreatePolymorphicComponent"],"mappings":"AAAA;;;;+BAOaA;;;eAAAA;;;qBAPiE;AAOvE,IAAMA,6BAA6BC,iCAAiC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
var _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
|
6
|
+
_exportStar(require("./createPolymorphicComponent"), exports);
|
|
7
|
+
_exportStar(require("./overrideComponent"), exports);
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from './createPolymorphicComponent';\nexport * from './overrideComponent';\n"],"names":[],"mappings":"AAAA;;;;;oBAAc;oBACA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows to override static properties from a component function
|
|
3
|
+
*
|
|
4
|
+
* @param component The component which holds the static properties
|
|
5
|
+
* @param properties The new static properties to assign on the component
|
|
6
|
+
* @returns A new component with the specified properties. It doesn't change the original component
|
|
7
|
+
* @example const Menu = overrideComponent(MantineMenu, {Item: MyMenuItem}); // Menu.Item will equal MyMenuItem
|
|
8
|
+
*/ "use strict";
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "overrideComponent", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return overrideComponent;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _toConsumableArray = require("@swc/helpers/lib/_to_consumable_array.js").default;
|
|
19
|
+
var overrideComponent = function(component, properties) {
|
|
20
|
+
var componentClone = function() {
|
|
21
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
22
|
+
args[_key] = arguments[_key];
|
|
23
|
+
}
|
|
24
|
+
return component.apply(void 0, _toConsumableArray(args));
|
|
25
|
+
};
|
|
26
|
+
return Object.assign(componentClone, component, properties);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=overrideComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/overrideComponent.ts"],"sourcesContent":["/**\n * Allows to override static properties from a component function\n *\n * @param component The component which holds the static properties\n * @param properties The new static properties to assign on the component\n * @returns A new component with the specified properties. It doesn't change the original component\n * @example const Menu = overrideComponent(MantineMenu, {Item: MyMenuItem}); // Menu.Item will equal MyMenuItem\n */\nexport const overrideComponent = <\n Component extends (...args: Parameters<Component>) => ReturnType<Component>,\n StaticProperties = Record<keyof Component, never>\n>(\n component: Component,\n properties: StaticProperties\n): ((...args: Parameters<Component>) => ReturnType<Component>) & Component & StaticProperties => {\n const componentClone = (...args: Parameters<Component>) => component(...args);\n return Object.assign(componentClone, component, properties);\n};\n"],"names":["overrideComponent","component","properties","componentClone","args","Object","assign"],"mappings":"AAAA;;;;;;;CAOC,GACD;;;;+BAAaA;;;eAAAA;;;;AAAN,IAAMA,oBAAoB,SAI7BC,WACAC,YAC6F;IAC7F,IAAMC,iBAAiB;yCAAIC;YAAAA;;eAAgCH,UAAAA,MAAAA,KAAAA,GAAU,mBAAGG;;IACxE,OAAOC,OAAOC,MAAM,CAACH,gBAAgBF,WAAWC;AACpD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Button as MantineButton, ButtonProps as MantineButtonProps } from '@mantine/core';
|
|
3
|
+
import { ButtonWithDisabledTooltip, ButtonWithDisabledTooltipProps } from './ButtonWithDisabledTooltip';
|
|
4
|
+
export interface ButtonProps extends MantineButtonProps, ButtonWithDisabledTooltipProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const Button: (<C = "button">(props: import("@mantine/utils").PolymorphicComponentProps<C, ButtonProps>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & Omit<import("react").FunctionComponent<(ButtonProps & {
|
|
7
|
+
component?: any;
|
|
8
|
+
} & Omit<Pick<any, string | number | symbol>, "component" | keyof ButtonProps> & {
|
|
9
|
+
ref?: any;
|
|
10
|
+
}) | (ButtonProps & {
|
|
11
|
+
component: import("react").ElementType<any>;
|
|
12
|
+
})>, never> & {
|
|
13
|
+
Group: typeof MantineButton.Group;
|
|
14
|
+
DisabledTooltip: typeof ButtonWithDisabledTooltip;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,IAAI,aAAa,EAAE,WAAW,IAAI,kBAAkB,EAAkB,MAAM,eAAe,CAAC;AAI1G,OAAO,EAAC,yBAAyB,EAAE,8BAA8B,EAAC,MAAM,6BAA6B,CAAC;AAEtG,MAAM,WAAW,WAAY,SAAQ,kBAAkB,EAAE,8BAA8B;CAAG;AAc1F,eAAO,MAAM,MAAM;;;;;;;WAGP,OAAO,cAAc,KAAK;qBAAmB,gCAAgC;CAC/E,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Property } from 'csstype';
|
|
2
|
+
import { MouseEventHandler } from 'react';
|
|
3
|
+
export interface ButtonWithDisabledTooltipProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
/**
|
|
7
|
+
* The tooltip message to display when disabled
|
|
8
|
+
*/
|
|
9
|
+
disabledTooltip?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The background color when disabled
|
|
12
|
+
*
|
|
13
|
+
* @default 'unset'
|
|
14
|
+
*/
|
|
15
|
+
disabledHoverColor?: Property.BackgroundColor;
|
|
16
|
+
}
|
|
17
|
+
export declare const ButtonWithDisabledTooltip: (<C = "button">(props: import("@mantine/utils").PolymorphicComponentProps<C, ButtonWithDisabledTooltipProps>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & Omit<import("react").FunctionComponent<(ButtonWithDisabledTooltipProps & {
|
|
18
|
+
component?: any;
|
|
19
|
+
} & Omit<Pick<any, string | number | symbol>, "component" | keyof ButtonWithDisabledTooltipProps> & {
|
|
20
|
+
ref?: any;
|
|
21
|
+
}) | (ButtonWithDisabledTooltipProps & {
|
|
22
|
+
component: import("react").ElementType<any>;
|
|
23
|
+
})>, never> & Record<string, never>;
|
|
24
|
+
//# sourceMappingURL=ButtonWithDisabledTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonWithDisabledTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/button/ButtonWithDisabledTooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACjC,OAAO,EAAa,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAIpD,MAAM,WAAW,8BAA8B;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC/C;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC;CACjD;AAoCD,eAAO,MAAM,yBAAyB;;;;;;mCAErC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAC,KAAK,8BAA8B,EAAC,MAAM,6BAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../../../src/components/collection/Collection.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../../../src/components/collection/Collection.tsx"],"names":[],"mappings":"AACA,OAAO,EAEH,YAAY,EAGZ,qBAAqB,EACrB,iBAAiB,EACjB,SAAS,EAIZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAIhC,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAG5C,UAAU,eAAe,CAAC,CAAC,CACvB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,EACvE,YAAY,CAAC,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;IAC7C;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC;IACX;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IAChD;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAChC;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAClD;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAWD,eAAO,MAAM,UAAU,+CAwHtB,CAAC"}
|
package/dist/definitions/components/date-range-picker/DateRangePickerInlineCalendar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePickerInlineCalendar.d.ts","sourceRoot":"","sources":["../../../../src/components/date-range-picker/DateRangePickerInlineCalendar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,oBAAoB,EAAiB,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"DateRangePickerInlineCalendar.d.ts","sourceRoot":"","sources":["../../../../src/components/date-range-picker/DateRangePickerInlineCalendar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,oBAAoB,EAAiB,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAIvF,OAAO,EAAC,qBAAqB,EAA8B,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAA0B,4BAA4B,EAAC,MAAM,2BAA2B,CAAC;AAEhG,MAAM,WAAW,kCACb,SAAQ,IAAI,CAAC,4BAA4B,EAAE,YAAY,GAAG,UAAU,CAAC;IACrE;;OAEG;IACH,YAAY,EAAE,oBAAoB,CAAC;IACnC;;;;OAIG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IAChD;;OAEG;IACH,kBAAkB,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B,4FAQvC,kCAAkC,gBAiEpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineConfirmButton.d.ts","sourceRoot":"","sources":["../../../../src/components/inline-confirm/InlineConfirmButton.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"InlineConfirmButton.d.ts","sourceRoot":"","sources":["../../../../src/components/inline-confirm/InlineConfirmButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAoB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAS,WAAW,EAAC,MAAM,WAAW,CAAC;AAG9C,UAAU,wBAAyB,SAAQ,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACpG,EAAE,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,mBAAmB,UAAW,wBAAwB,gBAQlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineConfirmPrompt.d.ts","sourceRoot":"","sources":["../../../../src/components/inline-confirm/InlineConfirmPrompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"InlineConfirmPrompt.d.ts","sourceRoot":"","sources":["../../../../src/components/inline-confirm/InlineConfirmPrompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAK9D,UAAU,wBAAwB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,CAAC,wBAAwB,CAkC3E,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Menu as MantineMenu, MenuItemProps as MantineMenuItemProps } from '@mantine/core';
|
|
3
|
+
import { ButtonWithDisabledTooltipProps } from '../button';
|
|
4
|
+
export interface MenuItemProps extends MantineMenuItemProps, ButtonWithDisabledTooltipProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const Menu: ((props: import("@mantine/core").MenuProps) => JSX.Element) & typeof MantineMenu & {
|
|
7
|
+
displayName: string;
|
|
8
|
+
Item: (<C = "button">(props: import("@mantine/utils").PolymorphicComponentProps<C, MenuItemProps>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & Omit<import("react").FunctionComponent<(MenuItemProps & {
|
|
9
|
+
component?: any;
|
|
10
|
+
} & Omit<Pick<any, string | number | symbol>, "component" | keyof MenuItemProps> & {
|
|
11
|
+
ref?: any;
|
|
12
|
+
}) | (MenuItemProps & {
|
|
13
|
+
component: import("react").ElementType<any>;
|
|
14
|
+
})>, never> & Record<string, never>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/Menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,IAAI,WAAW,EAAE,aAAa,IAAI,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAIzF,OAAO,EAAS,8BAA8B,EAAC,MAAM,WAAW,CAAC;AAEjE,MAAM,WAAW,aAAc,SAAQ,oBAAoB,EAAE,8BAA8B;CAAG;AAQ9F,eAAO,MAAM,IAAI;;;;;;;;;CAGf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalWizard.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ModalWizard.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAS,UAAU,EAAY,SAAS,EAAC,MAAM,eAAe,CAAC;AACtG,OAAO,EAAW,YAAY,EAAoB,MAAM,OAAO,CAAC;AAKhE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,QAAA,MAAM,SAAS;;;;CAUZ,CAAC;AAEJ,KAAK,sBAAsB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAE1D,UAAU,gBACN,SAAQ,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAC,EACvE,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IAC1C;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;IAExB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC;IAEjC;;SAEK;IACL,QAAQ,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;CACxD;AAED,UAAU,eAAe;IACrB,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAAC;IAExC,IAAI,EAAE,OAAO,eAAe,CAAC;CAChC;AAED,eAAO,MAAM,WAAW,EAAE,eA0HzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableDateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableDateRangePicker.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,iBAAiB,EAAW,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TableDateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableDateRangePicker.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAgC,kCAAkC,EAAC,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAC,qBAAqB,EAAC,MAAM,kDAAkD,CAAC;AAGvF,UAAU,yBACN,SAAQ,IAAI,CAAC,kCAAkC,EAAE,YAAY,GAAG,UAAU,GAAG,oBAAoB,CAAC;IAClG;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,CAuC7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableHeader.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableHeader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,YAAY,EAAS,SAAS,EAAiB,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAKnD,QAAA,MAAM,SAAS;;;;CAQZ,CAAC;AAEJ,KAAK,sBAAsB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAC1D,UAAU,gBAAiB,SAAQ,YAAY,CAAC,sBAAsB,CAAC;IAEnE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AACD,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CA8B3D,CAAC"}
|
|
@@ -7,7 +7,7 @@ export * from '@mantine/hooks';
|
|
|
7
7
|
export { createColumnHelper, type ColumnDef } from '@tanstack/table-core';
|
|
8
8
|
export * from './components';
|
|
9
9
|
export * from '@mantine/form';
|
|
10
|
-
export { Header, Table, type HeaderProps, Modal } from './components';
|
|
10
|
+
export { Header, Table, type HeaderProps, Modal, Button, type ButtonProps, Menu, type MenuItemProps } from './components';
|
|
11
11
|
export { useForm, createFormContext } from './form';
|
|
12
12
|
export * from './theme';
|
|
13
13
|
declare module '@mantine/core' {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAElD,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAE,KAAK,SAAS,EAAC,MAAM,sBAAsB,CAAC;AACxE,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAElD,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAE,KAAK,SAAS,EAAC,MAAM,sBAAsB,CAAC;AACxE,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,IAAI,EAAE,KAAK,aAAa,EAAC,MAAM,cAAc,CAAC;AACxH,OAAO,EAAC,OAAO,EAAE,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AAElD,cAAc,SAAS,CAAC;AAExB,OAAO,QAAQ,eAAe,CAAC;IAC3B,UAAiB,0BAA0B;QAEvC,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;KAChF;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPolymorphicComponent.d.ts","sourceRoot":"","sources":["../../../src/utils/createPolymorphicComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,IAAI,iCAAiC,EAAC,MAAM,gBAAgB,CAAC;AAO/F,eAAO,MAAM,0BAA0B,0CAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows to override static properties from a component function
|
|
3
|
+
*
|
|
4
|
+
* @param component The component which holds the static properties
|
|
5
|
+
* @param properties The new static properties to assign on the component
|
|
6
|
+
* @returns A new component with the specified properties. It doesn't change the original component
|
|
7
|
+
* @example const Menu = overrideComponent(MantineMenu, {Item: MyMenuItem}); // Menu.Item will equal MyMenuItem
|
|
8
|
+
*/
|
|
9
|
+
export declare const overrideComponent: <Component extends (...args: Parameters<Component>) => ReturnType<Component>, StaticProperties = Record<keyof Component, never>>(component: Component, properties: StaticProperties) => ((...args: Parameters<Component>) => ReturnType<Component>) & Component & StaticProperties;
|
|
10
|
+
//# sourceMappingURL=overrideComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overrideComponent.d.ts","sourceRoot":"","sources":["../../../src/utils/overrideComponent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,oRAS7B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Button as MantineButton, useMantineTheme } from "@mantine/core";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { createPolymorphicComponent } from "../../utils";
|
|
6
|
+
import { ButtonWithDisabledTooltip } from "./ButtonWithDisabledTooltip";
|
|
7
|
+
var _Button = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
8
|
+
var theme = useMantineTheme();
|
|
9
|
+
return /*#__PURE__*/ _jsx(ButtonWithDisabledTooltip, _object_spread({
|
|
10
|
+
component: MantineButton,
|
|
11
|
+
ref: ref,
|
|
12
|
+
disabledHoverColor: theme.colors.gray[2]
|
|
13
|
+
}, props));
|
|
14
|
+
});
|
|
15
|
+
export var Button = createPolymorphicComponent(_Button);
|
|
16
|
+
Button.DisabledTooltip = ButtonWithDisabledTooltip;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import {Button as MantineButton, ButtonProps as MantineButtonProps, useMantineTheme} from '@mantine/core';\nimport {forwardRef} from 'react';\n\nimport {createPolymorphicComponent} from '../../utils';\nimport {ButtonWithDisabledTooltip, ButtonWithDisabledTooltipProps} from './ButtonWithDisabledTooltip';\n\nexport interface ButtonProps extends MantineButtonProps, ButtonWithDisabledTooltipProps {}\n\nconst _Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n const theme = useMantineTheme();\n return (\n <ButtonWithDisabledTooltip\n component={MantineButton}\n ref={ref}\n disabledHoverColor={theme.colors.gray[2]}\n {...props}\n />\n );\n});\n\nexport const Button = createPolymorphicComponent<\n 'button',\n ButtonProps,\n {Group: typeof MantineButton.Group; DisabledTooltip: typeof ButtonWithDisabledTooltip}\n>(_Button);\n\nButton.DisabledTooltip = ButtonWithDisabledTooltip;\n"],"names":["Button","MantineButton","useMantineTheme","forwardRef","createPolymorphicComponent","ButtonWithDisabledTooltip","_Button","props","ref","theme","component","disabledHoverColor","colors","gray","DisabledTooltip"],"mappings":"AAAA;;AAAA,SAAQA,UAAUC,aAAa,EAAqCC,eAAe,QAAO,gBAAgB;AAC1G,SAAQC,UAAU,QAAO,QAAQ;AAEjC,SAAQC,0BAA0B,QAAO,cAAc;AACvD,SAAQC,yBAAyB,QAAuC,8BAA8B;AAItG,IAAMC,wBAAUH,WAA2C,SAACI,OAAOC,KAAQ;IACvE,IAAMC,QAAQP;IACd,qBACI,KAACG;QACGK,WAAWT;QACXO,KAAKA;QACLG,oBAAoBF,MAAMG,MAAM,CAACC,IAAI,CAAC,EAAE;OACpCN;AAGhB;AAEA,OAAO,IAAMP,SAASI,2BAIpBE,SAAS;AAEXN,OAAOc,eAAe,GAAGT"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
2
|
+
import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
3
|
+
import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Box, Tooltip } from "@mantine/core";
|
|
6
|
+
import { forwardRef } from "react";
|
|
7
|
+
import { createPolymorphicComponent } from "../../utils";
|
|
8
|
+
var _ButtonWithDisabledTooltip = /*#__PURE__*/ forwardRef(function(_param, ref) {
|
|
9
|
+
var disabledTooltip = _param.disabledTooltip, disabled = _param.disabled, onClick = _param.onClick, tmp = _param.disabledHoverColor, hoverColor = tmp === void 0 ? "unset" : tmp, others = _object_without_properties(_param, [
|
|
10
|
+
"disabledTooltip",
|
|
11
|
+
"disabled",
|
|
12
|
+
"onClick",
|
|
13
|
+
"disabledHoverColor"
|
|
14
|
+
]);
|
|
15
|
+
return disabledTooltip ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
16
|
+
label: disabledTooltip,
|
|
17
|
+
disabled: !disabled,
|
|
18
|
+
children: /*#__PURE__*/ _jsx(Box, _object_spread(_object_spread_props(_object_spread({
|
|
19
|
+
component: "button",
|
|
20
|
+
ref: ref
|
|
21
|
+
}, disabled ? {
|
|
22
|
+
"data-disabled": true
|
|
23
|
+
} : {}), {
|
|
24
|
+
sx: function(theme) {
|
|
25
|
+
return {
|
|
26
|
+
"&[data-disabled]": {
|
|
27
|
+
pointerEvents: "all",
|
|
28
|
+
color: theme.colors.gray[5]
|
|
29
|
+
},
|
|
30
|
+
"&[data-disabled]:hover": {
|
|
31
|
+
backgroundColor: hoverColor,
|
|
32
|
+
cursor: "not-allowed"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
onClick: function(event) {
|
|
37
|
+
if (disabled) {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
event.stopPropagation();
|
|
40
|
+
} else {
|
|
41
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}), others))
|
|
45
|
+
}) : /*#__PURE__*/ _jsx(Box, _object_spread({
|
|
46
|
+
component: "button",
|
|
47
|
+
ref: ref,
|
|
48
|
+
disabled: disabled,
|
|
49
|
+
onClick: onClick
|
|
50
|
+
}, others));
|
|
51
|
+
});
|
|
52
|
+
export var ButtonWithDisabledTooltip = createPolymorphicComponent(_ButtonWithDisabledTooltip);
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=ButtonWithDisabledTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/button/ButtonWithDisabledTooltip.tsx"],"sourcesContent":["import {Box, Tooltip} from '@mantine/core';\nimport {Property} from 'csstype';\nimport {forwardRef, MouseEventHandler} from 'react';\n\nimport {createPolymorphicComponent} from '../../utils';\n\nexport interface ButtonWithDisabledTooltipProps {\n disabled?: boolean;\n onClick?: MouseEventHandler<HTMLButtonElement>;\n /**\n * The tooltip message to display when disabled\n */\n disabledTooltip?: string;\n /**\n * The background color when disabled\n *\n * @default 'unset'\n */\n disabledHoverColor?: Property.BackgroundColor;\n}\n\nconst _ButtonWithDisabledTooltip = forwardRef<HTMLButtonElement, ButtonWithDisabledTooltipProps>(\n ({disabledTooltip, disabled, onClick, disabledHoverColor: hoverColor = 'unset', ...others}, ref) =>\n disabledTooltip ? (\n <Tooltip label={disabledTooltip} disabled={!disabled}>\n <Box\n component=\"button\"\n ref={ref}\n {...(disabled ? {'data-disabled': true} : {})}\n sx={(theme) => ({\n '&[data-disabled]': {\n pointerEvents: 'all',\n color: theme.colors.gray[5],\n },\n '&[data-disabled]:hover': {\n backgroundColor: hoverColor,\n cursor: 'not-allowed',\n },\n })}\n onClick={(event) => {\n if (disabled) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n onClick?.(event);\n }\n }}\n {...others}\n />\n </Tooltip>\n ) : (\n <Box component=\"button\" ref={ref} disabled={disabled} onClick={onClick} {...others} />\n )\n);\n\nexport const ButtonWithDisabledTooltip = createPolymorphicComponent<'button', ButtonWithDisabledTooltipProps>(\n _ButtonWithDisabledTooltip\n);\n"],"names":["Box","Tooltip","forwardRef","createPolymorphicComponent","_ButtonWithDisabledTooltip","ref","disabledTooltip","disabled","onClick","hoverColor","disabledHoverColor","others","label","component","sx","theme","pointerEvents","color","colors","gray","backgroundColor","cursor","event","preventDefault","stopPropagation","ButtonWithDisabledTooltip"],"mappings":"AAAA;;;;AAAA,SAAQA,GAAG,EAAEC,OAAO,QAAO,gBAAgB;AAE3C,SAAQC,UAAU,QAA0B,QAAQ;AAEpD,SAAQC,0BAA0B,QAAO,cAAc;AAiBvD,IAAMC,2CAA6BF,WAC/B,iBAA4FG;QAA1FC,yBAAAA,iBAAiBC,kBAAAA,UAAUC,iBAAAA,SAA6BC,aAApBC,oBAAoBD,aAAAA,iBAAa,UAAbA,KAAyBE;QAAjFL;QAAiBC;QAAUC;QAASE;;IAClCJ,OAAAA,gCACI,KAACL;QAAQW,OAAON;QAAiBC,UAAU,CAACA;kBACxC,cAAA,KAACP;YACGa,WAAU;YACVR,KAAKA;WACAE,WAAW;YAAC,iBAAiB,IAAI;QAAA,IAAI,CAAC,CAAC;YAC5CO,IAAI,SAACC;uBAAW;oBACZ,oBAAoB;wBAChBC,eAAe;wBACfC,OAAOF,MAAMG,MAAM,CAACC,IAAI,CAAC,EAAE;oBAC/B;oBACA,0BAA0B;wBACtBC,iBAAiBX;wBACjBY,QAAQ;oBACZ;gBACJ;;YACAb,SAAS,SAACc,OAAU;gBAChB,IAAIf,UAAU;oBACVe,MAAMC,cAAc;oBACpBD,MAAME,eAAe;gBACzB,OAAO;oBACHhB,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUc;gBACd,CAAC;YACL;YACIX;uBAIZ,KAACX;QAAIa,WAAU;QAASR,KAAKA;QAAKE,UAAUA;QAAUC,SAASA;OAAaG,QAC/E;;AAGT,OAAO,IAAMc,4BAA4BtB,2BACrCC,4BACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/button/index.ts"],"sourcesContent":["export * from './Button';\nexport {type ButtonWithDisabledTooltipProps} from './ButtonWithDisabledTooltip';\n"],"names":[],"mappings":"AAAA,cAAc,WAAW"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
2
2
|
import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
3
3
|
import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs";
|
|
4
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { AddSize16Px } from "@coveord/plasma-react-icons";
|
|
6
|
-
import { Box,
|
|
6
|
+
import { Box, Group, Input, Stack, Tooltip, useComponentDefaultProps } from "@mantine/core";
|
|
7
7
|
import { useDidUpdate, useId } from "@mantine/hooks";
|
|
8
8
|
import { DragDropContext, Droppable } from "react-beautiful-dnd";
|
|
9
|
+
import { Button } from "../button";
|
|
9
10
|
import useStyles from "./Collection.styles";
|
|
10
11
|
import { CollectionItem } from "./CollectionItem";
|
|
11
12
|
var defaultProps = {
|
|
@@ -17,7 +18,7 @@ var defaultProps = {
|
|
|
17
18
|
required: false
|
|
18
19
|
};
|
|
19
20
|
export var Collection = function(props) {
|
|
20
|
-
var _useComponentDefaultProps = useComponentDefaultProps("Collection", defaultProps, props), value = _useComponentDefaultProps.value, onChange = _useComponentDefaultProps.onChange, onRemoveItem = _useComponentDefaultProps.onRemoveItem, onReorderItem = _useComponentDefaultProps.onReorderItem, onInsertItem = _useComponentDefaultProps.onInsertItem, disabled = _useComponentDefaultProps.disabled, draggable = _useComponentDefaultProps.draggable, children = _useComponentDefaultProps.children, spacing = _useComponentDefaultProps.spacing, required = _useComponentDefaultProps.required, newItem = _useComponentDefaultProps.newItem, addLabel = _useComponentDefaultProps.addLabel, addDisabledTooltip = _useComponentDefaultProps.addDisabledTooltip, allowAdd = _useComponentDefaultProps.allowAdd, label = _useComponentDefaultProps.label, labelProps = _useComponentDefaultProps.labelProps, description = _useComponentDefaultProps.description, descriptionProps = _useComponentDefaultProps.descriptionProps, error = _useComponentDefaultProps.error, errorProps = _useComponentDefaultProps.errorProps, // Style props
|
|
21
|
+
var _useComponentDefaultProps = useComponentDefaultProps("Collection", defaultProps, props), value = _useComponentDefaultProps.value, onChange = _useComponentDefaultProps.onChange, onRemoveItem = _useComponentDefaultProps.onRemoveItem, onReorderItem = _useComponentDefaultProps.onReorderItem, onInsertItem = _useComponentDefaultProps.onInsertItem, disabled = _useComponentDefaultProps.disabled, draggable = _useComponentDefaultProps.draggable, children = _useComponentDefaultProps.children, spacing = _useComponentDefaultProps.spacing, required = _useComponentDefaultProps.required, newItem = _useComponentDefaultProps.newItem, addLabel = _useComponentDefaultProps.addLabel, addDisabledTooltip = _useComponentDefaultProps.addDisabledTooltip, allowAdd = _useComponentDefaultProps.allowAdd, label = _useComponentDefaultProps.label, labelProps = _useComponentDefaultProps.labelProps, withAsterisk = _useComponentDefaultProps.withAsterisk, description = _useComponentDefaultProps.description, descriptionProps = _useComponentDefaultProps.descriptionProps, error = _useComponentDefaultProps.error, errorProps = _useComponentDefaultProps.errorProps, // Style props
|
|
21
22
|
classNames = _useComponentDefaultProps.classNames, className = _useComponentDefaultProps.className, styles = _useComponentDefaultProps.styles, unstyled = _useComponentDefaultProps.unstyled, others = _object_without_properties(_useComponentDefaultProps, [
|
|
22
23
|
"value",
|
|
23
24
|
"onChange",
|
|
@@ -35,6 +36,7 @@ export var Collection = function(props) {
|
|
|
35
36
|
"allowAdd",
|
|
36
37
|
"label",
|
|
37
38
|
"labelProps",
|
|
39
|
+
"withAsterisk",
|
|
38
40
|
"description",
|
|
39
41
|
"descriptionProps",
|
|
40
42
|
"error",
|
|
@@ -59,8 +61,9 @@ export var Collection = function(props) {
|
|
|
59
61
|
}, [
|
|
60
62
|
JSON.stringify(value)
|
|
61
63
|
]);
|
|
64
|
+
var isRequired = typeof withAsterisk === "boolean" ? withAsterisk : required;
|
|
62
65
|
var _label = label ? /*#__PURE__*/ _jsx(Input.Label, _object_spread_props(_object_spread({
|
|
63
|
-
required:
|
|
66
|
+
required: isRequired
|
|
64
67
|
}, labelProps), {
|
|
65
68
|
children: label
|
|
66
69
|
})) : null;
|
|
@@ -70,8 +73,7 @@ export var Collection = function(props) {
|
|
|
70
73
|
var _error = error ? /*#__PURE__*/ _jsx(Input.Error, _object_spread_props(_object_spread({}, errorProps), {
|
|
71
74
|
children: error
|
|
72
75
|
})) : null;
|
|
73
|
-
var _header = _label || _description ? /*#__PURE__*/ _jsxs(
|
|
74
|
-
mb: "sm",
|
|
76
|
+
var _header = _label || _description ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
75
77
|
children: [
|
|
76
78
|
_label,
|
|
77
79
|
_description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/collection/Collection.tsx"],"sourcesContent":["import {AddSize16Px} from '@coveord/plasma-react-icons';\nimport {\n Box,\n Button,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n MantineNumberSize,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {ReorderPayload} from '@mantine/form/lib/types';\nimport {useDidUpdate, useId} from '@mantine/hooks';\nimport {ReactNode} from 'react';\nimport {DragDropContext, Droppable} from 'react-beautiful-dnd';\n\nimport useStyles from './Collection.styles';\nimport {CollectionItem} from './CollectionItem';\n\ninterface CollectionProps<T>\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The default value each new item should have\n */\n newItem: T;\n /**\n * A render function called for each item passed in the `value` prop.\n *\n * @param item The current item's value\n * @param index The current item's index\n */\n children: (item: T, index: number) => ReactNode;\n /**\n * The list of items to display inside the collection\n *\n * @default []\n */\n value?: T[];\n /**\n * Unused, has no effect\n */\n onFocus?: () => void;\n /**\n * Function called whenever the value needs to be updated\n *\n * @param value The whole list of items after the change\n */\n onChange?: (value: T[]) => void;\n /**\n * Function called after an item is removed from the collection using the remove button\n *\n * @param itemIndex The index of the item that was removed\n */\n onRemoveItem?: (itemIndex: number) => void;\n /**\n * Function that gets called whenever a collection item needs to be reordered\n *\n * @param payload The origin and destination index of the item to reorder\n */\n onReorderItem?: (payload: ReorderPayload) => void;\n /**\n * Function that gets called when a new item needs to be added to the collection\n *\n * @param value The the value of the item to insert\n * @param index The index of the new item to insert\n */\n onInsertItem?: (value: T, index: number) => void;\n /**\n * Whether the collection should have drag and drop behavior enabled\n *\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether the collection is disabled, or in other words in read only mode\n *\n * @default false\n */\n disabled?: boolean;\n /**\n * Function that determines if the add item button should be enabled given the current items of the collection.\n * The button is always enabled if this props remains undefined\n *\n * @param values The current items of the collection\n */\n allowAdd?: (values: T[]) => boolean;\n /**\n * The label of the add item button\n *\n * @default \"Add item\"\n */\n addLabel?: string;\n /**\n * The tooltip text displayed when hovering over the disabled add item button\n *\n * @default 'There is already an empty item'\n */\n addDisabledTooltip?: string;\n /**\n * The spacing between the colleciton items\n *\n * @default 'xs'\n */\n spacing?: MantineNumberSize;\n /**\n * Whether the collection is required. When required is true, the collection will hide the remove button if there is only one item\n *\n * @default false\n */\n required?: boolean;\n}\n\nconst defaultProps: Partial<CollectionProps<unknown>> = {\n draggable: false,\n addLabel: 'Add item',\n addDisabledTooltip: 'There is already an empty item',\n disabled: false,\n spacing: 'xs',\n required: false,\n};\n\nexport const Collection = <T,>(props: CollectionProps<T>) => {\n const {\n value,\n onChange,\n onRemoveItem,\n onReorderItem,\n onInsertItem,\n disabled,\n draggable,\n children,\n spacing,\n required,\n newItem,\n addLabel,\n addDisabledTooltip,\n allowAdd,\n label,\n labelProps,\n description,\n descriptionProps,\n error,\n errorProps,\n\n // Style props\n classNames,\n className,\n styles,\n unstyled,\n\n ...others\n } = useComponentDefaultProps('Collection', defaultProps as CollectionProps<T>, props);\n const {classes, cx} = useStyles(null, {classNames, name: 'Collection', styles, unstyled});\n const collectionID = useId('dnd-droppable');\n\n const hasOnlyOneItem = value.length === 1;\n\n /**\n * Enforcing onChange when the value is modified will make sure the errors are carried through.\n */\n useDidUpdate(() => {\n onChange?.(value);\n }, [JSON.stringify(value)]);\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description {...descriptionProps}>{description}</Input.Description>\n ) : null;\n const _error = error ? <Input.Error {...errorProps}>{error}</Input.Error> : null;\n const _header =\n _label || _description ? (\n <Box mb=\"sm\">\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const items = value.map((item, index) => (\n <CollectionItem\n key={index}\n disabled={disabled}\n draggable={draggable}\n index={index}\n onRemove={() => onRemoveItem?.(index)}\n styles={styles}\n removable={!(required && hasOnlyOneItem)}\n >\n {children(item, index)}\n </CollectionItem>\n ));\n\n const addAllowed = allowAdd?.(value) ?? true;\n\n const _addButton = disabled ? null : (\n <Group>\n <Tooltip label={addDisabledTooltip} disabled={addAllowed}>\n <Box>\n <Button\n variant=\"subtle\"\n leftIcon={<AddSize16Px height={16} />}\n onClick={() => onInsertItem(newItem, value?.length ?? 0)}\n disabled={!addAllowed}\n >\n {addLabel}\n </Button>\n </Box>\n </Tooltip>\n </Group>\n );\n\n return (\n <DragDropContext\n onDragEnd={({destination, source}) => onReorderItem({from: source.index, to: destination?.index || 0})}\n >\n <Droppable direction=\"vertical\" droppableId={collectionID}>\n {(provided) => (\n <Box\n {...provided.droppableProps}\n ref={provided.innerRef}\n className={cx(classes.root, className)}\n {...others}\n >\n {_header}\n <Stack spacing={spacing}>\n {items}\n {provided.placeholder}\n {_addButton}\n {_error}\n </Stack>\n </Box>\n )}\n </Droppable>\n </DragDropContext>\n );\n};\n"],"names":["AddSize16Px","Box","Button","Group","Input","Stack","Tooltip","useComponentDefaultProps","useDidUpdate","useId","DragDropContext","Droppable","useStyles","CollectionItem","defaultProps","draggable","addLabel","addDisabledTooltip","disabled","spacing","required","Collection","props","value","onChange","onRemoveItem","onReorderItem","onInsertItem","children","newItem","allowAdd","label","labelProps","description","descriptionProps","error","errorProps","classNames","className","styles","unstyled","others","name","classes","cx","collectionID","hasOnlyOneItem","length","JSON","stringify","_label","Label","_description","Description","_error","Error","_header","mb","items","map","item","index","onRemove","removable","addAllowed","_addButton","variant","leftIcon","height","onClick","onDragEnd","destination","source","from","to","direction","droppableId","provided","droppableProps","ref","innerRef","root","placeholder"],"mappings":"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"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/collection/Collection.tsx"],"sourcesContent":["import {AddSize16Px} from '@coveord/plasma-react-icons';\nimport {\n Box,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n MantineNumberSize,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {ReorderPayload} from '@mantine/form/lib/types';\nimport {useDidUpdate, useId} from '@mantine/hooks';\nimport {ReactNode} from 'react';\nimport {DragDropContext, Droppable} from 'react-beautiful-dnd';\n\nimport {Button} from '../button';\nimport useStyles from './Collection.styles';\nimport {CollectionItem} from './CollectionItem';\n\ninterface CollectionProps<T>\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The default value each new item should have\n */\n newItem: T;\n /**\n * A render function called for each item passed in the `value` prop.\n *\n * @param item The current item's value\n * @param index The current item's index\n */\n children: (item: T, index: number) => ReactNode;\n /**\n * The list of items to display inside the collection\n *\n * @default []\n */\n value?: T[];\n /**\n * Unused, has no effect\n */\n onFocus?: () => void;\n /**\n * Function called whenever the value needs to be updated\n *\n * @param value The whole list of items after the change\n */\n onChange?: (value: T[]) => void;\n /**\n * Function called after an item is removed from the collection using the remove button\n *\n * @param itemIndex The index of the item that was removed\n */\n onRemoveItem?: (itemIndex: number) => void;\n /**\n * Function that gets called whenever a collection item needs to be reordered\n *\n * @param payload The origin and destination index of the item to reorder\n */\n onReorderItem?: (payload: ReorderPayload) => void;\n /**\n * Function that gets called when a new item needs to be added to the collection\n *\n * @param value The the value of the item to insert\n * @param index The index of the new item to insert\n */\n onInsertItem?: (value: T, index: number) => void;\n /**\n * Whether the collection should have drag and drop behavior enabled\n *\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether the collection is disabled, or in other words in read only mode\n *\n * @default false\n */\n disabled?: boolean;\n /**\n * Function that determines if the add item button should be enabled given the current items of the collection.\n * The button is always enabled if this props remains undefined\n *\n * @param values The current items of the collection\n */\n allowAdd?: (values: T[]) => boolean;\n /**\n * The label of the add item button\n *\n * @default \"Add item\"\n */\n addLabel?: string;\n /**\n * The tooltip text displayed when hovering over the disabled add item button\n *\n * @default 'There is already an empty item'\n */\n addDisabledTooltip?: string;\n /**\n * The spacing between the colleciton items\n *\n * @default 'xs'\n */\n spacing?: MantineNumberSize;\n /**\n * Whether the collection is required. When required is true, the collection will hide the remove button if there is only one item\n *\n * @default false\n */\n required?: boolean;\n}\n\nconst defaultProps: Partial<CollectionProps<unknown>> = {\n draggable: false,\n addLabel: 'Add item',\n addDisabledTooltip: 'There is already an empty item',\n disabled: false,\n spacing: 'xs',\n required: false,\n};\n\nexport const Collection = <T,>(props: CollectionProps<T>) => {\n const {\n value,\n onChange,\n onRemoveItem,\n onReorderItem,\n onInsertItem,\n disabled,\n draggable,\n children,\n spacing,\n required,\n newItem,\n addLabel,\n addDisabledTooltip,\n allowAdd,\n label,\n labelProps,\n withAsterisk,\n description,\n descriptionProps,\n error,\n errorProps,\n\n // Style props\n classNames,\n className,\n styles,\n unstyled,\n\n ...others\n } = useComponentDefaultProps('Collection', defaultProps as CollectionProps<T>, props);\n const {classes, cx} = useStyles(null, {classNames, name: 'Collection', styles, unstyled});\n const collectionID = useId('dnd-droppable');\n\n const hasOnlyOneItem = value.length === 1;\n\n /**\n * Enforcing onChange when the value is modified will make sure the errors are carried through.\n */\n useDidUpdate(() => {\n onChange?.(value);\n }, [JSON.stringify(value)]);\n\n const isRequired = typeof withAsterisk === 'boolean' ? withAsterisk : required;\n const _label = label ? (\n <Input.Label required={isRequired} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description {...descriptionProps}>{description}</Input.Description>\n ) : null;\n const _error = error ? <Input.Error {...errorProps}>{error}</Input.Error> : null;\n const _header =\n _label || _description ? (\n <>\n {_label}\n {_description}\n </>\n ) : null;\n\n const items = value.map((item, index) => (\n <CollectionItem\n key={index}\n disabled={disabled}\n draggable={draggable}\n index={index}\n onRemove={() => onRemoveItem?.(index)}\n styles={styles}\n removable={!(required && hasOnlyOneItem)}\n >\n {children(item, index)}\n </CollectionItem>\n ));\n\n const addAllowed = allowAdd?.(value) ?? true;\n\n const _addButton = disabled ? null : (\n <Group>\n <Tooltip label={addDisabledTooltip} disabled={addAllowed}>\n <Box>\n <Button\n variant=\"subtle\"\n leftIcon={<AddSize16Px height={16} />}\n onClick={() => onInsertItem(newItem, value?.length ?? 0)}\n disabled={!addAllowed}\n >\n {addLabel}\n </Button>\n </Box>\n </Tooltip>\n </Group>\n );\n\n return (\n <DragDropContext\n onDragEnd={({destination, source}) => onReorderItem({from: source.index, to: destination?.index || 0})}\n >\n <Droppable direction=\"vertical\" droppableId={collectionID}>\n {(provided) => (\n <Box\n {...provided.droppableProps}\n ref={provided.innerRef}\n className={cx(classes.root, className)}\n {...others}\n >\n {_header}\n <Stack spacing={spacing}>\n {items}\n {provided.placeholder}\n {_addButton}\n {_error}\n </Stack>\n </Box>\n )}\n </Droppable>\n </DragDropContext>\n );\n};\n"],"names":["AddSize16Px","Box","Group","Input","Stack","Tooltip","useComponentDefaultProps","useDidUpdate","useId","DragDropContext","Droppable","Button","useStyles","CollectionItem","defaultProps","draggable","addLabel","addDisabledTooltip","disabled","spacing","required","Collection","props","value","onChange","onRemoveItem","onReorderItem","onInsertItem","children","newItem","allowAdd","label","labelProps","withAsterisk","description","descriptionProps","error","errorProps","classNames","className","styles","unstyled","others","name","classes","cx","collectionID","hasOnlyOneItem","length","JSON","stringify","isRequired","_label","Label","_description","Description","_error","Error","_header","items","map","item","index","onRemove","removable","addAllowed","_addButton","variant","leftIcon","height","onClick","onDragEnd","destination","source","from","to","direction","droppableId","provided","droppableProps","ref","innerRef","root","placeholder"],"mappings":"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"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
2
2
|
import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { Center, Group, Space } from "@mantine/core";
|
|
5
5
|
import { RangeCalendar } from "@mantine/dates";
|
|
6
6
|
import { useForm } from "@mantine/form";
|
|
7
|
+
import { Button } from "../button";
|
|
7
8
|
import { DateRangePickerPresetSelect } from "./DateRangePickerPresetSelect";
|
|
8
9
|
import { EditableDateRangePicker } from "./EditableDateRangePicker";
|
|
9
10
|
export var DateRangePickerInlineCalendar = function(param) {
|