@coveord/plasma-mantine 54.4.1 → 55.0.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 +36 -36
- package/__mocks__/@monaco-editor/react.tsx +5 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/button/ButtonWithDisabledTooltip.d.ts +1 -1
- package/dist/cjs/components/code-editor/CodeEditor.d.ts.map +1 -1
- package/dist/cjs/components/code-editor/CodeEditor.js +25 -2
- package/dist/cjs/components/code-editor/CodeEditor.js.map +1 -1
- package/dist/cjs/components/code-editor/CodeEditor.module.css +10 -0
- package/dist/cjs/components/collection/Collection.d.ts +6 -0
- package/dist/cjs/components/collection/Collection.d.ts.map +1 -1
- package/dist/cjs/components/collection/Collection.js +7 -4
- package/dist/cjs/components/collection/Collection.js.map +1 -1
- package/dist/cjs/components/copyToClipboard/CopyToClipboard.d.ts +9 -1
- package/dist/cjs/components/copyToClipboard/CopyToClipboard.d.ts.map +1 -1
- package/dist/cjs/components/copyToClipboard/CopyToClipboard.js +5 -6
- package/dist/cjs/components/copyToClipboard/CopyToClipboard.js.map +1 -1
- package/dist/cjs/components/index.d.ts +7 -6
- package/dist/cjs/components/index.d.ts.map +1 -1
- package/dist/cjs/components/index.js +7 -6
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/read-only/PasswordInput.d.ts +8 -0
- package/dist/cjs/components/read-only/PasswordInput.d.ts.map +1 -0
- package/dist/cjs/components/read-only/PasswordInput.js +29 -0
- package/dist/cjs/components/read-only/PasswordInput.js.map +1 -0
- package/dist/cjs/components/read-only/ReadOnlyInputStyles.d.ts +16 -0
- package/dist/cjs/components/read-only/ReadOnlyInputStyles.d.ts.map +1 -0
- package/dist/cjs/components/read-only/ReadOnlyInputStyles.js +28 -0
- package/dist/cjs/components/read-only/ReadOnlyInputStyles.js.map +1 -0
- package/dist/cjs/components/read-only/Select.d.ts +7 -0
- package/dist/cjs/components/read-only/Select.d.ts.map +1 -0
- package/dist/cjs/components/read-only/Select.js +29 -0
- package/dist/cjs/components/read-only/Select.js.map +1 -0
- package/dist/cjs/components/read-only/index.d.ts +3 -0
- package/dist/cjs/components/read-only/index.d.ts.map +1 -0
- package/dist/cjs/components/read-only/index.js +9 -0
- package/dist/cjs/components/read-only/index.js.map +1 -0
- package/dist/cjs/components/table/table-predicate/TablePredicate.d.ts +2 -3
- package/dist/cjs/components/table/table-predicate/TablePredicate.d.ts.map +1 -1
- package/dist/cjs/components/table/table-predicate/TablePredicate.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles/Input.module.css +1 -1
- package/dist/cjs/styles/ReadOnlyInput.module.css +8 -0
- package/dist/cjs/styles/ReadOnlyState.module.css +3 -0
- package/dist/cjs/theme/Theme.d.ts.map +1 -1
- package/dist/cjs/theme/Theme.js +96 -6
- package/dist/cjs/theme/Theme.js.map +1 -1
- package/dist/esm/components/button/ButtonWithDisabledTooltip.d.ts +1 -1
- package/dist/esm/components/code-editor/CodeEditor.d.ts.map +1 -1
- package/dist/esm/components/code-editor/CodeEditor.js +26 -1
- package/dist/esm/components/code-editor/CodeEditor.js.map +1 -1
- package/dist/esm/components/code-editor/CodeEditor.module.css +10 -0
- package/dist/esm/components/collection/Collection.d.ts +6 -0
- package/dist/esm/components/collection/Collection.d.ts.map +1 -1
- package/dist/esm/components/collection/Collection.js +6 -4
- package/dist/esm/components/collection/Collection.js.map +1 -1
- package/dist/esm/components/copyToClipboard/CopyToClipboard.d.ts +9 -1
- package/dist/esm/components/copyToClipboard/CopyToClipboard.d.ts.map +1 -1
- package/dist/esm/components/copyToClipboard/CopyToClipboard.js +3 -5
- package/dist/esm/components/copyToClipboard/CopyToClipboard.js.map +1 -1
- package/dist/esm/components/index.d.ts +7 -6
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +7 -6
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/read-only/PasswordInput.d.ts +8 -0
- package/dist/esm/components/read-only/PasswordInput.d.ts.map +1 -0
- package/dist/esm/components/read-only/PasswordInput.js +20 -0
- package/dist/esm/components/read-only/PasswordInput.js.map +1 -0
- package/dist/esm/components/read-only/ReadOnlyInputStyles.d.ts +16 -0
- package/dist/esm/components/read-only/ReadOnlyInputStyles.d.ts.map +1 -0
- package/dist/esm/components/read-only/ReadOnlyInputStyles.js +16 -0
- package/dist/esm/components/read-only/ReadOnlyInputStyles.js.map +1 -0
- package/dist/esm/components/read-only/Select.d.ts +7 -0
- package/dist/esm/components/read-only/Select.d.ts.map +1 -0
- package/dist/esm/components/read-only/Select.js +20 -0
- package/dist/esm/components/read-only/Select.js.map +1 -0
- package/dist/esm/components/read-only/index.d.ts +3 -0
- package/dist/esm/components/read-only/index.d.ts.map +1 -0
- package/dist/esm/components/read-only/index.js +4 -0
- package/dist/esm/components/read-only/index.js.map +1 -0
- package/dist/esm/components/table/table-predicate/TablePredicate.d.ts +2 -3
- package/dist/esm/components/table/table-predicate/TablePredicate.d.ts.map +1 -1
- package/dist/esm/components/table/table-predicate/TablePredicate.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styles/Input.module.css +1 -1
- package/dist/esm/styles/ReadOnlyInput.module.css +8 -0
- package/dist/esm/styles/ReadOnlyState.module.css +3 -0
- package/dist/esm/theme/Theme.d.ts.map +1 -1
- package/dist/esm/theme/Theme.js +97 -7
- package/dist/esm/theme/Theme.js.map +1 -1
- package/package.json +9 -9
- package/src/components/code-editor/CodeEditor.module.css +10 -0
- package/src/components/code-editor/CodeEditor.tsx +26 -1
- package/src/components/collection/Collection.tsx +12 -3
- package/src/components/copyToClipboard/CopyToClipboard.tsx +12 -6
- package/src/components/index.ts +7 -6
- package/src/components/read-only/PasswordInput.tsx +11 -0
- package/src/components/read-only/ReadOnlyInputStyles.ts +16 -0
- package/src/components/read-only/Select.tsx +11 -0
- package/src/components/read-only/index.ts +2 -0
- package/src/components/table/__tests__/TablePredicate.spec.tsx +2 -1
- package/src/components/table/table-predicate/TablePredicate.tsx +2 -3
- package/src/index.ts +2 -0
- package/src/styles/Input.module.css +1 -1
- package/src/styles/ReadOnlyInput.module.css +8 -0
- package/src/styles/ReadOnlyState.module.css +3 -0
- package/src/theme/Theme.tsx +86 -3
|
@@ -15,12 +15,13 @@ const defaultProps = {
|
|
|
15
15
|
addLabel: 'Add item',
|
|
16
16
|
addDisabledTooltip: 'There is already an empty item',
|
|
17
17
|
disabled: false,
|
|
18
|
+
readOnly: false,
|
|
18
19
|
gap: 'xs',
|
|
19
20
|
required: false,
|
|
20
21
|
getItemId: ({ id })=>id
|
|
21
22
|
};
|
|
22
23
|
export const Collection = (props)=>{
|
|
23
|
-
const { value, onChange, onRemoveItem, onReorderItem, onInsertItem, disabled, draggable, children, gap, required, newItem, addLabel, addDisabledTooltip, allowAdd, label, labelProps, withAsterisk, description, descriptionProps, error, errorProps, getItemId, ref, // Style props
|
|
24
|
+
const { value, onChange, onRemoveItem, onReorderItem, onInsertItem, disabled, readOnly, draggable, children, gap, required, newItem, addLabel, addDisabledTooltip, allowAdd, label, labelProps, withAsterisk, description, descriptionProps, error, errorProps, getItemId, ref, // Style props
|
|
24
25
|
style, className, classNames, styles, unstyled, ...others } = useProps('Collection', defaultProps, props);
|
|
25
26
|
const getStyles = useStyles({
|
|
26
27
|
name: 'Collection',
|
|
@@ -35,6 +36,7 @@ export const Collection = (props)=>{
|
|
|
35
36
|
const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
|
|
36
37
|
coordinateGetter: sortableKeyboardCoordinates
|
|
37
38
|
}));
|
|
39
|
+
const canEdit = !disabled && !readOnly;
|
|
38
40
|
const hasOnlyOneItem = value.length === 1;
|
|
39
41
|
/**
|
|
40
42
|
* Enforcing onChange when the value is modified will make sure the errors are carried through.
|
|
@@ -69,14 +71,14 @@ export const Collection = (props)=>{
|
|
|
69
71
|
}));
|
|
70
72
|
const items = standardizedItems.map((item, index)=>/*#__PURE__*/ _jsx(CollectionItem, {
|
|
71
73
|
id: item.id,
|
|
72
|
-
disabled:
|
|
74
|
+
disabled: !canEdit,
|
|
73
75
|
draggable: draggable,
|
|
74
76
|
onRemove: ()=>onRemoveItem?.(index),
|
|
75
77
|
removable: !(required && hasOnlyOneItem),
|
|
76
78
|
children: children(item.data, index)
|
|
77
79
|
}, item.id));
|
|
78
80
|
const addAllowed = allowAdd?.(value) ?? true;
|
|
79
|
-
const _addButton =
|
|
81
|
+
const _addButton = canEdit ? /*#__PURE__*/ _jsx(Group, {
|
|
80
82
|
children: /*#__PURE__*/ _jsx(Tooltip, {
|
|
81
83
|
label: addDisabledTooltip,
|
|
82
84
|
disabled: addAllowed,
|
|
@@ -92,7 +94,7 @@ export const Collection = (props)=>{
|
|
|
92
94
|
})
|
|
93
95
|
})
|
|
94
96
|
})
|
|
95
|
-
});
|
|
97
|
+
}) : null;
|
|
96
98
|
const getIndex = (id)=>standardizedItems.findIndex((item)=>item.id === id);
|
|
97
99
|
const handleDragEnd = ({ over, active })=>{
|
|
98
100
|
if (over) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/collection/Collection.tsx"],"sourcesContent":["import {AddSize16Px} from '@coveord/plasma-react-icons';\nimport {DndContext, DragEndEvent, KeyboardSensor, PointerSensor, useSensor, useSensors} from '@dnd-kit/core';\nimport {restrictToParentElement, restrictToVerticalAxis} from '@dnd-kit/modifiers';\nimport {SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy} from '@dnd-kit/sortable';\nimport {\n Box,\n BoxProps,\n Factory,\n Group,\n Input,\n MantineSpacing,\n Stack,\n StylesApiProps,\n Tooltip,\n __InputWrapperProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport {ReorderPayload} from '@mantine/form/lib/types';\nimport {useDidUpdate} from '@mantine/hooks';\nimport {ForwardedRef, ReactNode} from 'react';\n\nimport {CustomComponentThemeExtend, identity} from '../../utils';\nimport {Button} from '../button';\nimport classes from './Collection.module.css';\nimport {CollectionProvider} from './CollectionContext';\nimport {CollectionItem} from './CollectionItem';\n\nexport interface CollectionProps<T> extends __InputWrapperProps, BoxProps, StylesApiProps<CollectionFactory> {\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 * Defines how each item is uniquely identified. It is highly recommended that you specify this prop to an ID that makes sense.\n *\n * This method is required when using this component with ReactHookForm.\n *\n * @see {@link https://react-hook-form.com/api/usefieldarray/} for using a collection with ReactHookForm.\n *\n * @param originalItem The original item\n */\n getItemId?: (originalItem: T) => string;\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 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 gap between the colleciton items\n *\n * @default 'xs'\n */\n gap?: MantineSpacing;\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\nexport type CollectionStylesNames = 'root' | 'item' | 'itemDragging' | 'dragHandle';\n\nexport type CollectionFactory = Factory<{\n props: CollectionProps<unknown>;\n ref: HTMLDivElement;\n stylesNames: CollectionStylesNames;\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 gap: 'xs',\n required: false,\n getItemId: ({id}: any) => id,\n};\n\nexport const Collection = <T,>(props: CollectionProps<T> & {ref?: ForwardedRef<HTMLDivElement>}) => {\n const {\n value,\n onChange,\n onRemoveItem,\n onReorderItem,\n onInsertItem,\n disabled,\n draggable,\n children,\n gap,\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 getItemId,\n ref,\n\n // Style props\n style,\n className,\n classNames,\n styles,\n unstyled,\n ...others\n } = useProps('Collection', defaultProps as CollectionProps<T>, props);\n\n const getStyles = useStyles<CollectionFactory>({\n name: 'Collection',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n });\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\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 standardizedItems = value.map((item, index) => ({id: getItemId?.(item) ?? String(index), data: item}));\n\n const items = standardizedItems.map((item, index) => (\n <CollectionItem\n key={item.id}\n id={item.id}\n disabled={disabled}\n draggable={draggable}\n onRemove={() => onRemoveItem?.(index)}\n removable={!(required && hasOnlyOneItem)}\n >\n {children(item.data, 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 leftSection={<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 const getIndex = (id: string) => standardizedItems.findIndex((item) => item.id === id);\n\n const handleDragEnd = ({over, active}: DragEndEvent): void => {\n if (over) {\n const activeIndex = getIndex(String(active.id));\n const overIndex = getIndex(String(over.id));\n if (activeIndex !== overIndex) {\n onReorderItem?.({from: activeIndex, to: overIndex});\n }\n }\n };\n\n return (\n <CollectionProvider value={{getStyles}}>\n <DndContext\n onDragEnd={handleDragEnd}\n sensors={sensors}\n modifiers={[restrictToVerticalAxis, restrictToParentElement]}\n >\n <SortableContext items={standardizedItems} strategy={verticalListSortingStrategy}>\n <Box ref={ref} {...others} {...getStyles('root')}>\n {_header}\n <Stack gap={gap}>\n {items}\n {_addButton}\n {_error}\n </Stack>\n </Box>\n </SortableContext>\n </DndContext>\n </CollectionProvider>\n );\n};\n\nCollection.extend = identity as CustomComponentThemeExtend<CollectionFactory>;\n"],"names":["AddSize16Px","DndContext","KeyboardSensor","PointerSensor","useSensor","useSensors","restrictToParentElement","restrictToVerticalAxis","SortableContext","sortableKeyboardCoordinates","verticalListSortingStrategy","Box","Group","Input","Stack","Tooltip","useProps","useStyles","useDidUpdate","identity","Button","classes","CollectionProvider","CollectionItem","defaultProps","draggable","addLabel","addDisabledTooltip","disabled","gap","required","getItemId","id","Collection","props","value","onChange","onRemoveItem","onReorderItem","onInsertItem","children","newItem","allowAdd","label","labelProps","withAsterisk","description","descriptionProps","error","errorProps","ref","style","className","classNames","styles","unstyled","others","getStyles","name","sensors","coordinateGetter","hasOnlyOneItem","length","JSON","stringify","isRequired","_label","Label","_description","Description","_error","Error","_header","standardizedItems","map","item","index","String","data","items","onRemove","removable","addAllowed","_addButton","variant","leftSection","height","onClick","getIndex","findIndex","handleDragEnd","over","active","activeIndex","overIndex","from","to","onDragEnd","modifiers","strategy","extend"],"mappings":"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"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/collection/Collection.tsx"],"sourcesContent":["import {AddSize16Px} from '@coveord/plasma-react-icons';\nimport {DndContext, DragEndEvent, KeyboardSensor, PointerSensor, useSensor, useSensors} from '@dnd-kit/core';\nimport {restrictToParentElement, restrictToVerticalAxis} from '@dnd-kit/modifiers';\nimport {SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy} from '@dnd-kit/sortable';\nimport {\n Box,\n BoxProps,\n Factory,\n Group,\n Input,\n MantineSpacing,\n Stack,\n StylesApiProps,\n Tooltip,\n __InputWrapperProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport {ReorderPayload} from '@mantine/form/lib/types';\nimport {useDidUpdate} from '@mantine/hooks';\nimport {ForwardedRef, ReactNode} from 'react';\n\nimport {CustomComponentThemeExtend, identity} from '../../utils';\nimport {Button} from '../button';\nimport classes from './Collection.module.css';\nimport {CollectionProvider} from './CollectionContext';\nimport {CollectionItem} from './CollectionItem';\n\nexport interface CollectionProps<T> extends __InputWrapperProps, BoxProps, StylesApiProps<CollectionFactory> {\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 * Defines how each item is uniquely identified. It is highly recommended that you specify this prop to an ID that makes sense.\n *\n * This method is required when using this component with ReactHookForm.\n *\n * @see {@link https://react-hook-form.com/api/usefieldarray/} for using a collection with ReactHookForm.\n *\n * @param originalItem The original item\n */\n getItemId?: (originalItem: T) => string;\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 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 * Whether the collection is readOnly. If true, the collection will not allow adding or removing items\n *\n * @default false\n */\n readOnly?: 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 gap between the colleciton items\n *\n * @default 'xs'\n */\n gap?: MantineSpacing;\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\nexport type CollectionStylesNames = 'root' | 'item' | 'itemDragging' | 'dragHandle';\n\nexport type CollectionFactory = Factory<{\n props: CollectionProps<unknown>;\n ref: HTMLDivElement;\n stylesNames: CollectionStylesNames;\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 readOnly: false,\n gap: 'xs',\n required: false,\n getItemId: ({id}: any) => id,\n};\n\nexport const Collection = <T,>(props: CollectionProps<T> & {ref?: ForwardedRef<HTMLDivElement>}) => {\n const {\n value,\n onChange,\n onRemoveItem,\n onReorderItem,\n onInsertItem,\n disabled,\n readOnly,\n draggable,\n children,\n gap,\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 getItemId,\n ref,\n\n // Style props\n style,\n className,\n classNames,\n styles,\n unstyled,\n ...others\n } = useProps('Collection', defaultProps as CollectionProps<T>, props);\n\n const getStyles = useStyles<CollectionFactory>({\n name: 'Collection',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n });\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n const canEdit = !disabled && !readOnly;\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 standardizedItems = value.map((item, index) => ({id: getItemId?.(item) ?? String(index), data: item}));\n\n const items = standardizedItems.map((item, index) => (\n <CollectionItem\n key={item.id}\n id={item.id}\n disabled={!canEdit}\n draggable={draggable}\n onRemove={() => onRemoveItem?.(index)}\n removable={!(required && hasOnlyOneItem)}\n >\n {children(item.data, index)}\n </CollectionItem>\n ));\n\n const addAllowed = allowAdd?.(value) ?? true;\n\n const _addButton = canEdit ? (\n <Group>\n <Tooltip label={addDisabledTooltip} disabled={addAllowed}>\n <Box>\n <Button\n variant=\"subtle\"\n leftSection={<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 ) : null;\n\n const getIndex = (id: string) => standardizedItems.findIndex((item) => item.id === id);\n\n const handleDragEnd = ({over, active}: DragEndEvent): void => {\n if (over) {\n const activeIndex = getIndex(String(active.id));\n const overIndex = getIndex(String(over.id));\n if (activeIndex !== overIndex) {\n onReorderItem?.({from: activeIndex, to: overIndex});\n }\n }\n };\n\n return (\n <CollectionProvider value={{getStyles}}>\n <DndContext\n onDragEnd={handleDragEnd}\n sensors={sensors}\n modifiers={[restrictToVerticalAxis, restrictToParentElement]}\n >\n <SortableContext items={standardizedItems} strategy={verticalListSortingStrategy}>\n <Box ref={ref} {...others} {...getStyles('root')}>\n {_header}\n <Stack gap={gap}>\n {items}\n {_addButton}\n {_error}\n </Stack>\n </Box>\n </SortableContext>\n </DndContext>\n </CollectionProvider>\n );\n};\n\nCollection.extend = identity as CustomComponentThemeExtend<CollectionFactory>;\n"],"names":["AddSize16Px","DndContext","KeyboardSensor","PointerSensor","useSensor","useSensors","restrictToParentElement","restrictToVerticalAxis","SortableContext","sortableKeyboardCoordinates","verticalListSortingStrategy","Box","Group","Input","Stack","Tooltip","useProps","useStyles","useDidUpdate","identity","Button","classes","CollectionProvider","CollectionItem","defaultProps","draggable","addLabel","addDisabledTooltip","disabled","readOnly","gap","required","getItemId","id","Collection","props","value","onChange","onRemoveItem","onReorderItem","onInsertItem","children","newItem","allowAdd","label","labelProps","withAsterisk","description","descriptionProps","error","errorProps","ref","style","className","classNames","styles","unstyled","others","getStyles","name","sensors","coordinateGetter","canEdit","hasOnlyOneItem","length","JSON","stringify","isRequired","_label","Label","_description","Description","_error","Error","_header","standardizedItems","map","item","index","String","data","items","onRemove","removable","addAllowed","_addButton","variant","leftSection","height","onClick","getIndex","findIndex","handleDragEnd","over","active","activeIndex","overIndex","from","to","onDragEnd","modifiers","strategy","extend"],"mappings":"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"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MantineColor } from '@mantine/core';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
1
3
|
export interface CopyToClipboardProps {
|
|
2
4
|
/**
|
|
3
5
|
* The value to be copied to the clipboard.
|
|
@@ -13,6 +15,12 @@ export interface CopyToClipboardProps {
|
|
|
13
15
|
* Called each time the value is copied to the clipboard
|
|
14
16
|
*/
|
|
15
17
|
onCopy?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* The color of the icon when idle
|
|
20
|
+
*
|
|
21
|
+
* @default 'gray'
|
|
22
|
+
*/
|
|
23
|
+
color?: MantineColor | (string & {});
|
|
16
24
|
}
|
|
17
|
-
export declare const CopyToClipboard:
|
|
25
|
+
export declare const CopyToClipboard: FunctionComponent<CopyToClipboardProps>;
|
|
18
26
|
//# sourceMappingURL=CopyToClipboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyToClipboard.d.ts","sourceRoot":"","sources":["../../../../src/components/copyToClipboard/CopyToClipboard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CopyToClipboard.d.ts","sourceRoot":"","sources":["../../../../src/components/copyToClipboard/CopyToClipboard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAyB,YAAY,EAAqB,MAAM,eAAe,CAAC;AACvF,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAExC,MAAM,WAAW,oBAAoB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CACxC;AAqBD,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CAU/D,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { CheckSize16Px, CopySize16Px } from '@coveord/plasma-react-icons';
|
|
3
3
|
import { ActionIcon, CopyButton, TextInput, Tooltip } from '@mantine/core';
|
|
4
|
-
const CopyToClipboardButton = ({ value, onCopy })=>/*#__PURE__*/ _jsx(CopyButton, {
|
|
4
|
+
const CopyToClipboardButton = ({ value, onCopy, color })=>/*#__PURE__*/ _jsx(CopyButton, {
|
|
5
5
|
value: value,
|
|
6
6
|
timeout: 2000,
|
|
7
7
|
children: ({ copied, copy })=>/*#__PURE__*/ _jsx(Tooltip, {
|
|
8
8
|
label: copied ? 'Copied' : 'Copy',
|
|
9
9
|
children: /*#__PURE__*/ _jsx(ActionIcon, {
|
|
10
10
|
variant: "subtle",
|
|
11
|
-
color: copied ? 'success' :
|
|
11
|
+
color: copied ? 'success' : color,
|
|
12
12
|
onClick: ()=>{
|
|
13
13
|
copy();
|
|
14
14
|
onCopy?.();
|
|
@@ -22,13 +22,11 @@ const CopyToClipboardButton = ({ value, onCopy })=>/*#__PURE__*/ _jsx(CopyButton
|
|
|
22
22
|
})
|
|
23
23
|
});
|
|
24
24
|
export const CopyToClipboard = ({ withLabel, ...others })=>withLabel ? /*#__PURE__*/ _jsx(TextInput, {
|
|
25
|
-
classNames: {
|
|
26
|
-
input: 'var(--mantine-color-gray-7)'
|
|
27
|
-
},
|
|
28
25
|
value: others.value,
|
|
29
26
|
readOnly: true,
|
|
30
27
|
autoComplete: "off",
|
|
31
28
|
rightSection: /*#__PURE__*/ _jsx(CopyToClipboardButton, {
|
|
29
|
+
color: "action",
|
|
32
30
|
...others
|
|
33
31
|
})
|
|
34
32
|
}) : /*#__PURE__*/ _jsx(CopyToClipboardButton, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/copyToClipboard/CopyToClipboard.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {ActionIcon, CopyButton, TextInput, Tooltip} from '@mantine/core';\n\nexport interface CopyToClipboardProps {\n /**\n * The value to be copied to the clipboard.\n */\n value: string;\n /**\n * Whether to display the string to be copied alongside the button.\n *\n * @default false\n */\n withLabel?: boolean;\n /**\n * Called each time the value is copied to the clipboard\n */\n onCopy?: () => void;\n}\n\nconst CopyToClipboardButton:
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/copyToClipboard/CopyToClipboard.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {ActionIcon, CopyButton, MantineColor, TextInput, Tooltip} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nexport interface CopyToClipboardProps {\n /**\n * The value to be copied to the clipboard.\n */\n value: string;\n /**\n * Whether to display the string to be copied alongside the button.\n *\n * @default false\n */\n withLabel?: boolean;\n /**\n * Called each time the value is copied to the clipboard\n */\n onCopy?: () => void;\n /**\n * The color of the icon when idle\n *\n * @default 'gray'\n */\n color?: MantineColor | (string & {});\n}\n\nconst CopyToClipboardButton: FunctionComponent<Omit<CopyToClipboardProps, 'withLabel'>> = ({value, onCopy, color}) => (\n <CopyButton value={value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'}>\n <ActionIcon\n variant=\"subtle\"\n color={copied ? 'success' : color}\n onClick={() => {\n copy();\n onCopy?.();\n }}\n >\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n);\n\nexport const CopyToClipboard: FunctionComponent<CopyToClipboardProps> = ({withLabel, ...others}) =>\n withLabel ? (\n <TextInput\n value={others.value}\n readOnly\n autoComplete=\"off\"\n rightSection={<CopyToClipboardButton color=\"action\" {...others} />}\n />\n ) : (\n <CopyToClipboardButton {...others} />\n );\n"],"names":["CheckSize16Px","CopySize16Px","ActionIcon","CopyButton","TextInput","Tooltip","CopyToClipboardButton","value","onCopy","color","timeout","copied","copy","label","variant","onClick","height","CopyToClipboard","withLabel","others","readOnly","autoComplete","rightSection"],"mappings":";AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,8BAA8B;AACxE,SAAQC,UAAU,EAAEC,UAAU,EAAgBC,SAAS,EAAEC,OAAO,QAAO,gBAAgB;AA0BvF,MAAMC,wBAAoF,CAAC,EAACC,KAAK,EAAEC,MAAM,EAAEC,KAAK,EAAC,iBAC7G,KAACN;QAAWI,OAAOA;QAAOG,SAAS;kBAC9B,CAAC,EAACC,MAAM,EAAEC,IAAI,EAAC,iBACZ,KAACP;gBAAQQ,OAAOF,SAAS,WAAW;0BAChC,cAAA,KAACT;oBACGY,SAAQ;oBACRL,OAAOE,SAAS,YAAYF;oBAC5BM,SAAS;wBACLH;wBACAJ;oBACJ;8BAECG,uBAAS,KAACX;wBAAcgB,QAAQ;uCAAS,KAACf;wBAAae,QAAQ;;;;;AAOpF,OAAO,MAAMC,kBAA2D,CAAC,EAACC,SAAS,EAAE,GAAGC,QAAO,GAC3FD,0BACI,KAACd;QACGG,OAAOY,OAAOZ,KAAK;QACnBa,QAAQ;QACRC,cAAa;QACbC,4BAAc,KAAChB;YAAsBG,OAAM;YAAU,GAAGU,MAAM;;uBAGlE,KAACb;QAAuB,GAAGa,MAAM;OACnC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
export * from './action-icon';
|
|
1
2
|
export * from './blank-slate';
|
|
2
3
|
export * from './browser-preview';
|
|
4
|
+
export * from './button';
|
|
3
5
|
export * from './code-editor';
|
|
4
6
|
export * from './collection';
|
|
7
|
+
export * from './copyToClipboard';
|
|
5
8
|
export * from './date-range-picker';
|
|
6
|
-
export * from './sticky-footer';
|
|
7
9
|
export * from './header';
|
|
8
10
|
export * from './inline-confirm';
|
|
9
|
-
export * from './table';
|
|
10
|
-
export * from './prompt';
|
|
11
|
-
export * from './button';
|
|
12
|
-
export * from './action-icon';
|
|
13
11
|
export * from './menu';
|
|
14
|
-
export * from './
|
|
12
|
+
export * from './prompt';
|
|
13
|
+
export * from './read-only';
|
|
14
|
+
export * from './sticky-footer';
|
|
15
|
+
export * from './table';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,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,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
export * from './action-icon';
|
|
1
2
|
export * from './blank-slate';
|
|
2
3
|
export * from './browser-preview';
|
|
4
|
+
export * from './button';
|
|
3
5
|
export * from './code-editor';
|
|
4
6
|
export * from './collection';
|
|
7
|
+
export * from './copyToClipboard';
|
|
5
8
|
export * from './date-range-picker';
|
|
6
|
-
export * from './sticky-footer';
|
|
7
9
|
export * from './header';
|
|
8
10
|
export * from './inline-confirm';
|
|
9
|
-
export * from './table';
|
|
10
|
-
export * from './prompt';
|
|
11
|
-
export * from './button';
|
|
12
|
-
export * from './action-icon';
|
|
13
11
|
export * from './menu';
|
|
14
|
-
export * from './
|
|
12
|
+
export * from './prompt';
|
|
13
|
+
export * from './read-only';
|
|
14
|
+
export * from './sticky-footer';
|
|
15
|
+
export * from './table';
|
|
15
16
|
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './blank-slate';\nexport * from './browser-preview';\nexport * from './code-editor';\nexport * from './collection';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './action-icon';\nexport * from './blank-slate';\nexport * from './browser-preview';\nexport * from './button';\nexport * from './code-editor';\nexport * from './collection';\nexport * from './copyToClipboard';\nexport * from './date-range-picker';\nexport * from './header';\nexport * from './inline-confirm';\nexport * from './menu';\nexport * from './prompt';\nexport * from './read-only';\nexport * from './sticky-footer';\nexport * from './table';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,WAAW;AACzB,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,UAAU"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PasswordInput: import("@mantine/core").MantineComponent<{
|
|
2
|
+
props: import("@mantine/core").PasswordInputProps;
|
|
3
|
+
ref: HTMLInputElement;
|
|
4
|
+
stylesNames: import("@mantine/core").PasswordInputStylesNames;
|
|
5
|
+
vars: import("@mantine/core").PasswordInputCssVariables;
|
|
6
|
+
variant: import("@mantine/core").InputVariant;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=PasswordInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordInput.d.ts","sourceRoot":"","sources":["../../../../src/components/read-only/PasswordInput.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;EAKxB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { factory, PasswordInput as MantinePasswordInput } from '@mantine/core';
|
|
3
|
+
import { readOnlyInputStyles } from './ReadOnlyInputStyles';
|
|
4
|
+
const ReadOnlyPasswordInput = MantinePasswordInput.withProps({
|
|
5
|
+
styles: readOnlyInputStyles
|
|
6
|
+
});
|
|
7
|
+
export const PasswordInput = factory((props, ref)=>{
|
|
8
|
+
if (props.readOnly && !props.disabled) {
|
|
9
|
+
return /*#__PURE__*/ _jsx(ReadOnlyPasswordInput, {
|
|
10
|
+
ref: ref,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return /*#__PURE__*/ _jsx(MantinePasswordInput, {
|
|
15
|
+
ref: ref,
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=PasswordInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/read-only/PasswordInput.tsx"],"sourcesContent":["import {factory, PasswordInput as MantinePasswordInput, type PasswordInputFactory} from '@mantine/core';\nimport {readOnlyInputStyles} from './ReadOnlyInputStyles';\n\nconst ReadOnlyPasswordInput = MantinePasswordInput.withProps({styles: readOnlyInputStyles});\n\nexport const PasswordInput = factory<PasswordInputFactory>((props, ref) => {\n if (props.readOnly && !props.disabled) {\n return <ReadOnlyPasswordInput ref={ref} {...props} />;\n }\n return <MantinePasswordInput ref={ref} {...props} />;\n});\n"],"names":["factory","PasswordInput","MantinePasswordInput","readOnlyInputStyles","ReadOnlyPasswordInput","withProps","styles","props","ref","readOnly","disabled"],"mappings":";AAAA,SAAQA,OAAO,EAAEC,iBAAiBC,oBAAoB,QAAkC,gBAAgB;AACxG,SAAQC,mBAAmB,QAAO,wBAAwB;AAE1D,MAAMC,wBAAwBF,qBAAqBG,SAAS,CAAC;IAACC,QAAQH;AAAmB;AAEzF,OAAO,MAAMF,gBAAgBD,QAA8B,CAACO,OAAOC;IAC/D,IAAID,MAAME,QAAQ,IAAI,CAACF,MAAMG,QAAQ,EAAE;QACnC,qBAAO,KAACN;YAAsBI,KAAKA;YAAM,GAAGD,KAAK;;IACrD;IACA,qBAAO,KAACL;QAAqBM,KAAKA;QAAM,GAAGD,KAAK;;AACpD,GAAG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MantineTheme } from '@mantine/core';
|
|
2
|
+
export declare const readOnlyInputStyles: (theme: MantineTheme) => {
|
|
3
|
+
wrapper: {
|
|
4
|
+
'--input-bd': string;
|
|
5
|
+
'--input-bg': string;
|
|
6
|
+
'--input-color': string;
|
|
7
|
+
'--input-placeholder-color': string;
|
|
8
|
+
};
|
|
9
|
+
label: {
|
|
10
|
+
'--input-asterisk-color': string;
|
|
11
|
+
};
|
|
12
|
+
input: {
|
|
13
|
+
cursor: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=ReadOnlyInputStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadOnlyInputStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/read-only/ReadOnlyInputStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,YAAY,EAAC,MAAM,eAAe,CAAC;AAEhD,eAAO,MAAM,mBAAmB,UAAW,YAAY;;;;;;;;;;;;;CAarD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const readOnlyInputStyles = (theme)=>({
|
|
2
|
+
wrapper: {
|
|
3
|
+
'--input-bd': 'transparent',
|
|
4
|
+
'--input-bg': theme.colors.gray[2],
|
|
5
|
+
'--input-color': theme.colors.gray[7],
|
|
6
|
+
'--input-placeholder-color': theme.colors.gray[7]
|
|
7
|
+
},
|
|
8
|
+
label: {
|
|
9
|
+
'--input-asterisk-color': theme.colors.red[2]
|
|
10
|
+
},
|
|
11
|
+
input: {
|
|
12
|
+
cursor: 'text'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=ReadOnlyInputStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/read-only/ReadOnlyInputStyles.ts"],"sourcesContent":["import {type MantineTheme} from '@mantine/core';\n\nexport const readOnlyInputStyles = (theme: MantineTheme) => ({\n wrapper: {\n '--input-bd': 'transparent',\n '--input-bg': theme.colors.gray[2],\n '--input-color': theme.colors.gray[7],\n '--input-placeholder-color': theme.colors.gray[7],\n },\n label: {\n '--input-asterisk-color': theme.colors.red[2],\n },\n input: {\n cursor: 'text',\n },\n});\n"],"names":["readOnlyInputStyles","theme","wrapper","colors","gray","label","red","input","cursor"],"mappings":"AAEA,OAAO,MAAMA,sBAAsB,CAACC,QAAyB,CAAA;QACzDC,SAAS;YACL,cAAc;YACd,cAAcD,MAAME,MAAM,CAACC,IAAI,CAAC,EAAE;YAClC,iBAAiBH,MAAME,MAAM,CAACC,IAAI,CAAC,EAAE;YACrC,6BAA6BH,MAAME,MAAM,CAACC,IAAI,CAAC,EAAE;QACrD;QACAC,OAAO;YACH,0BAA0BJ,MAAME,MAAM,CAACG,GAAG,CAAC,EAAE;QACjD;QACAC,OAAO;YACHC,QAAQ;QACZ;IACJ,CAAA,EAAG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const Select: import("@mantine/core").MantineComponent<{
|
|
2
|
+
props: import("@mantine/core").SelectProps;
|
|
3
|
+
ref: HTMLInputElement;
|
|
4
|
+
stylesNames: import("@mantine/core").SelectStylesNames;
|
|
5
|
+
variant: import("@mantine/core").InputVariant;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/read-only/Select.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM;;;;;EAKjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { factory, Select as MantineSelect } from '@mantine/core';
|
|
3
|
+
import { readOnlyInputStyles } from './ReadOnlyInputStyles';
|
|
4
|
+
const ReadOnlySelect = MantineSelect.withProps({
|
|
5
|
+
styles: readOnlyInputStyles
|
|
6
|
+
});
|
|
7
|
+
export const Select = factory((props, ref)=>{
|
|
8
|
+
if (props.readOnly && !props.disabled) {
|
|
9
|
+
return /*#__PURE__*/ _jsx(ReadOnlySelect, {
|
|
10
|
+
ref: ref,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return /*#__PURE__*/ _jsx(MantineSelect, {
|
|
15
|
+
ref: ref,
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/read-only/Select.tsx"],"sourcesContent":["import {factory, Select as MantineSelect, SelectFactory} from '@mantine/core';\nimport {readOnlyInputStyles} from './ReadOnlyInputStyles';\n\nconst ReadOnlySelect = MantineSelect.withProps({styles: readOnlyInputStyles});\n\nexport const Select = factory<SelectFactory>((props, ref) => {\n if (props.readOnly && !props.disabled) {\n return <ReadOnlySelect ref={ref} {...props} />;\n }\n return <MantineSelect ref={ref} {...props} />;\n});\n"],"names":["factory","Select","MantineSelect","readOnlyInputStyles","ReadOnlySelect","withProps","styles","props","ref","readOnly","disabled"],"mappings":";AAAA,SAAQA,OAAO,EAAEC,UAAUC,aAAa,QAAsB,gBAAgB;AAC9E,SAAQC,mBAAmB,QAAO,wBAAwB;AAE1D,MAAMC,iBAAiBF,cAAcG,SAAS,CAAC;IAACC,QAAQH;AAAmB;AAE3E,OAAO,MAAMF,SAASD,QAAuB,CAACO,OAAOC;IACjD,IAAID,MAAME,QAAQ,IAAI,CAACF,MAAMG,QAAQ,EAAE;QACnC,qBAAO,KAACN;YAAeI,KAAKA;YAAM,GAAGD,KAAK;;IAC9C;IACA,qBAAO,KAACL;QAAcM,KAAKA;QAAM,GAAGD,KAAK;;AAC7C,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/read-only/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/read-only/index.ts"],"sourcesContent":["export * from './PasswordInput';\nexport * from './Select';\n"],"names":[],"mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,WAAW"}
|
|
@@ -11,11 +11,10 @@ export interface TablePredicateProps extends BoxProps, Pick<SelectProps, 'render
|
|
|
11
11
|
*/
|
|
12
12
|
data: ComboboxData;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* The label to display next to the Select
|
|
15
15
|
*
|
|
16
|
-
* @default default to the predicate id
|
|
17
16
|
*/
|
|
18
|
-
label
|
|
17
|
+
label: string;
|
|
19
18
|
}
|
|
20
19
|
export type TablePredicateFactory = Factory<{
|
|
21
20
|
props: TablePredicateProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePredicate.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/table-predicate/TablePredicate.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,YAAY,EACZ,sBAAsB,EAEtB,OAAO,EAIP,WAAW,EAGd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAKxC,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEhH,MAAM,WAAW,mBACb,SAAQ,QAAQ,EACZ,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EACjC,sBAAsB,CAAC,qBAAqB,CAAC;IACjD;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB
|
|
1
|
+
{"version":3,"file":"TablePredicate.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/table-predicate/TablePredicate.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,YAAY,EACZ,sBAAsB,EAEtB,OAAO,EAIP,WAAW,EAGd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAKxC,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEhH,MAAM,WAAW,mBACb,SAAQ,QAAQ,EACZ,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EACjC,sBAAsB,CAAC,qBAAqB,CAAC;IACjD;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC;IACxC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,GAAG,EAAE,cAAc,CAAC;IACpB,WAAW,EAAE,yBAAyB,CAAC;IACvC,QAAQ,EAAE,IAAI,CAAC;CAClB,CAAC,CAAC;AAIH,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CAsChE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/table/table-predicate/TablePredicate.tsx"],"sourcesContent":["import {\n BoxProps,\n ComboboxData,\n CompoundStylesApiProps,\n factory,\n Factory,\n Grid,\n Group,\n Select,\n SelectProps,\n Text,\n useProps,\n} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {TableComponentsOrder} from '../Table';\nimport {useTableContext} from '../TableContext';\n\nexport type TablePredicateStylesNames = 'predicate' | 'predicateWrapper' | 'predicateLabel' | 'predicateSelect';\n\nexport interface TablePredicateProps\n extends BoxProps,\n Pick<SelectProps, 'renderOption'>,\n CompoundStylesApiProps<TablePredicateFactory> {\n /**\n * Unique identifier for this predicate. Will be used to access the selected value in the table state\n */\n id: string;\n /**\n * The values to display in the predicate\n */\n data: ComboboxData;\n /**\n *
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/table/table-predicate/TablePredicate.tsx"],"sourcesContent":["import {\n BoxProps,\n ComboboxData,\n CompoundStylesApiProps,\n factory,\n Factory,\n Grid,\n Group,\n Select,\n SelectProps,\n Text,\n useProps,\n} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {TableComponentsOrder} from '../Table';\nimport {useTableContext} from '../TableContext';\n\nexport type TablePredicateStylesNames = 'predicate' | 'predicateWrapper' | 'predicateLabel' | 'predicateSelect';\n\nexport interface TablePredicateProps\n extends BoxProps,\n Pick<SelectProps, 'renderOption'>,\n CompoundStylesApiProps<TablePredicateFactory> {\n /**\n * Unique identifier for this predicate. Will be used to access the selected value in the table state\n */\n id: string;\n /**\n * The values to display in the predicate\n */\n data: ComboboxData;\n /**\n * The label to display next to the Select\n *\n */\n label: string;\n}\n\nexport type TablePredicateFactory = Factory<{\n props: TablePredicateProps;\n ref: HTMLDivElement;\n stylesNames: TablePredicateStylesNames;\n compound: true;\n}>;\n\nconst defaultProps: Partial<TablePredicateProps> = {};\n\nexport const TablePredicate: FunctionComponent<TablePredicateProps> = factory<TablePredicateFactory>((props, ref) => {\n const {store, getStyles} = useTableContext();\n const {id, data, label, classNames, className, styles, style, renderOption, vars, ...others} = useProps(\n 'PlasmaTablePredicate',\n defaultProps,\n props,\n );\n\n const handleChange = (newValue: string) => {\n store.setPredicates((prev) => ({...prev, [id]: newValue}));\n store.setPagination((prev) => ({...prev, pageIndex: 0}));\n };\n\n const stylesApiProps = {classNames, styles};\n\n return (\n <Grid.Col\n span=\"content\"\n order={TableComponentsOrder.Predicate}\n ref={ref}\n {...getStyles('predicate', {className, style, ...stylesApiProps})}\n {...others}\n >\n <Group gap=\"xs\" {...getStyles('predicateWrapper', stylesApiProps)}>\n {label ? <Text {...getStyles('predicateLabel', stylesApiProps)}>{label}:</Text> : null}\n <Select\n comboboxProps={{withinPortal: true}}\n value={store.state.predicates[id]}\n onChange={handleChange}\n data={data}\n aria-label={label ?? id}\n searchable={data.length > 7}\n renderOption={renderOption}\n {...getStyles('predicateSelect', stylesApiProps)}\n />\n </Group>\n </Grid.Col>\n );\n});\n"],"names":["factory","Grid","Group","Select","Text","useProps","TableComponentsOrder","useTableContext","defaultProps","TablePredicate","props","ref","store","getStyles","id","data","label","classNames","className","styles","style","renderOption","vars","others","handleChange","newValue","setPredicates","prev","setPagination","pageIndex","stylesApiProps","Col","span","order","Predicate","gap","comboboxProps","withinPortal","value","state","predicates","onChange","aria-label","searchable","length"],"mappings":";AAAA,SAIIA,OAAO,EAEPC,IAAI,EACJC,KAAK,EACLC,MAAM,EAENC,IAAI,EACJC,QAAQ,QACL,gBAAgB;AAGvB,SAAQC,oBAAoB,QAAO,WAAW;AAC9C,SAAQC,eAAe,QAAO,kBAAkB;AA8BhD,MAAMC,eAA6C,CAAC;AAEpD,OAAO,MAAMC,iBAAyDT,QAA+B,CAACU,OAAOC;IACzG,MAAM,EAACC,KAAK,EAAEC,SAAS,EAAC,GAAGN;IAC3B,MAAM,EAACO,EAAE,EAAEC,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEC,IAAI,EAAE,GAAGC,QAAO,GAAGlB,SAC3F,wBACAG,cACAE;IAGJ,MAAMc,eAAe,CAACC;QAClBb,MAAMc,aAAa,CAAC,CAACC,OAAU,CAAA;gBAAC,GAAGA,IAAI;gBAAE,CAACb,GAAG,EAAEW;YAAQ,CAAA;QACvDb,MAAMgB,aAAa,CAAC,CAACD,OAAU,CAAA;gBAAC,GAAGA,IAAI;gBAAEE,WAAW;YAAC,CAAA;IACzD;IAEA,MAAMC,iBAAiB;QAACb;QAAYE;IAAM;IAE1C,qBACI,KAAClB,KAAK8B,GAAG;QACLC,MAAK;QACLC,OAAO3B,qBAAqB4B,SAAS;QACrCvB,KAAKA;QACJ,GAAGE,UAAU,aAAa;YAACK;YAAWE;YAAO,GAAGU,cAAc;QAAA,EAAE;QAChE,GAAGP,MAAM;kBAEV,cAAA,MAACrB;YAAMiC,KAAI;YAAM,GAAGtB,UAAU,oBAAoBiB,eAAe;;gBAC5Dd,sBAAQ,MAACZ;oBAAM,GAAGS,UAAU,kBAAkBiB,eAAe;;wBAAGd;wBAAM;;qBAAW;8BAClF,KAACb;oBACGiC,eAAe;wBAACC,cAAc;oBAAI;oBAClCC,OAAO1B,MAAM2B,KAAK,CAACC,UAAU,CAAC1B,GAAG;oBACjC2B,UAAUjB;oBACVT,MAAMA;oBACN2B,cAAY1B,SAASF;oBACrB6B,YAAY5B,KAAK6B,MAAM,GAAG;oBAC1BvB,cAAcA;oBACb,GAAGR,UAAU,mBAAmBiB,eAAe;;;;;AAKpE,GAAG"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { type NotificationsProps } from '@mantine/notifications';
|
|
|
11
11
|
export * from '@tanstack/table-core';
|
|
12
12
|
export * from './components';
|
|
13
13
|
export { noop };
|
|
14
|
-
export { ActionIcon, BrowserPreview, Button, CopyToClipboard, Header, Menu, Table, type ActionIconProps, type ButtonProps, type CopyToClipboardProps, type HeaderProps, type MenuItemProps, type TableProps, type TableState, } from './components';
|
|
14
|
+
export { ActionIcon, BrowserPreview, Button, CopyToClipboard, Header, Menu, PasswordInput, Select, Table, type ActionIconProps, type ButtonProps, type CopyToClipboardProps, type HeaderProps, type MenuItemProps, type TableProps, type TableState, } from './components';
|
|
15
15
|
export * from './theme';
|
|
16
16
|
declare module '@mantine/core' {
|
|
17
17
|
interface MantineThemeColorsOverride {
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,KAAK,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvD,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAC,KAAK,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC/D,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,IAAI,EAAC,CAAC;AAGd,OAAO,EACH,UAAU,EACV,cAAc,EACd,MAAM,EACN,eAAe,EACf,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,UAAU,GAClB,MAAM,cAAc,CAAC;AAEtB,cAAc,SAAS,CAAC;AAExB,OAAO,QAAQ,eAAe,CAAC;IAC3B,UAAiB,0BAA0B;QACvC,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,kBAAkB,CAAC,CAAC;KACjF;CACJ;AAED,OAAO,QAAQ,uBAAuB,CAAC;IACnC,UAAU,UAAU,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM;QAC9C;;;;WAIG;QACH,aAAa,EAAE,OAAO,CAAC;KAC1B;CACJ"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,KAAK,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvD,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAC,KAAK,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC/D,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,IAAI,EAAC,CAAC;AAGd,OAAO,EACH,UAAU,EACV,cAAc,EACd,MAAM,EACN,eAAe,EACf,MAAM,EACN,IAAI,EACJ,aAAa,EACb,MAAM,EACN,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,UAAU,GAClB,MAAM,cAAc,CAAC;AAEtB,cAAc,SAAS,CAAC;AAExB,OAAO,QAAQ,eAAe,CAAC;IAC3B,UAAiB,0BAA0B;QACvC,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,kBAAkB,CAAC,CAAC;KACjF;CACJ;AAED,OAAO,QAAQ,uBAAuB,CAAC;IACnC,UAAU,UAAU,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM;QAC9C;;;;WAIG;QACH,aAAa,EAAE,OAAO,CAAC;KAC1B;CACJ"}
|
package/dist/esm/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export * from '@tanstack/table-core';
|
|
|
9
9
|
export * from './components';
|
|
10
10
|
export { noop };
|
|
11
11
|
// explicitly overriding mantine components
|
|
12
|
-
export { ActionIcon, BrowserPreview, Button, CopyToClipboard, Header, Menu, Table } from './components';
|
|
12
|
+
export { ActionIcon, BrowserPreview, Button, CopyToClipboard, Header, Menu, PasswordInput, Select, Table } from './components';
|
|
13
13
|
export * from './theme';
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {MantineColorsTuple, noop} from '@mantine/core';\nimport {type RowData} from '@tanstack/table-core';\nimport {type PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport {Pagination} from '@mantine/core';\nexport * from '@mantine/form';\nexport * from '@mantine/hooks';\nexport * from '@mantine/notifications';\nexport {type NotificationsProps} from '@mantine/notifications';\nexport * from '@tanstack/table-core';\nexport * from './components';\nexport {noop};\n\n// explicitly overriding mantine components\nexport {\n ActionIcon,\n BrowserPreview,\n Button,\n CopyToClipboard,\n Header,\n Menu,\n Table,\n type ActionIconProps,\n type ButtonProps,\n type CopyToClipboardProps,\n type HeaderProps,\n type MenuItemProps,\n type TableProps,\n type TableState,\n} from './components';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n colors: Record<keyof typeof PlasmaColors | (string & {}), MantineColorsTuple>;\n }\n}\n\ndeclare module '@tanstack/react-table' {\n interface ColumnMeta<TData extends RowData, TValue> {\n /**\n * Whether the column is a control column.\n * Control columns are columns that are not part of the data but are used to control the table.\n * For example, a column that contains checkboxes to select rows.\n */\n controlColumn: boolean;\n }\n}\n"],"names":["noop","Pagination","ActionIcon","BrowserPreview","Button","CopyToClipboard","Header","Menu","Table"],"mappings":"AAAA,SAA4BA,IAAI,QAAO,gBAAgB;AAIvD,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,SAAQC,UAAU,QAAO,gBAAgB;AACzC,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,yBAAyB;AAEvC,cAAc,uBAAuB;AACrC,cAAc,eAAe;AAC7B,SAAQD,IAAI,GAAE;AAEd,2CAA2C;AAC3C,SACIE,UAAU,EACVC,cAAc,EACdC,MAAM,EACNC,eAAe,EACfC,MAAM,EACNC,IAAI,EACJC,KAAK,QAQF,eAAe;AAEtB,cAAc,UAAU"}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {MantineColorsTuple, noop} from '@mantine/core';\nimport {type RowData} from '@tanstack/table-core';\nimport {type PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport {Pagination} from '@mantine/core';\nexport * from '@mantine/form';\nexport * from '@mantine/hooks';\nexport * from '@mantine/notifications';\nexport {type NotificationsProps} from '@mantine/notifications';\nexport * from '@tanstack/table-core';\nexport * from './components';\nexport {noop};\n\n// explicitly overriding mantine components\nexport {\n ActionIcon,\n BrowserPreview,\n Button,\n CopyToClipboard,\n Header,\n Menu,\n PasswordInput,\n Select,\n Table,\n type ActionIconProps,\n type ButtonProps,\n type CopyToClipboardProps,\n type HeaderProps,\n type MenuItemProps,\n type TableProps,\n type TableState,\n} from './components';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n colors: Record<keyof typeof PlasmaColors | (string & {}), MantineColorsTuple>;\n }\n}\n\ndeclare module '@tanstack/react-table' {\n interface ColumnMeta<TData extends RowData, TValue> {\n /**\n * Whether the column is a control column.\n * Control columns are columns that are not part of the data but are used to control the table.\n * For example, a column that contains checkboxes to select rows.\n */\n controlColumn: boolean;\n }\n}\n"],"names":["noop","Pagination","ActionIcon","BrowserPreview","Button","CopyToClipboard","Header","Menu","PasswordInput","Select","Table"],"mappings":"AAAA,SAA4BA,IAAI,QAAO,gBAAgB;AAIvD,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,SAAQC,UAAU,QAAO,gBAAgB;AACzC,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,yBAAyB;AAEvC,cAAc,uBAAuB;AACrC,cAAc,eAAe;AAC7B,SAAQD,IAAI,GAAE;AAEd,2CAA2C;AAC3C,SACIE,UAAU,EACVC,cAAc,EACdC,MAAM,EACNC,eAAe,EACfC,MAAM,EACNC,IAAI,EACJC,aAAa,EACbC,MAAM,EACNC,KAAK,QAQF,eAAe;AAEtB,cAAc,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../src/theme/Theme.tsx"],"names":[],"mappings":"AAUA,OAAO,
|
|
1
|
+
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../src/theme/Theme.tsx"],"names":[],"mappings":"AAUA,OAAO,EAmBH,oBAAoB,EAmBvB,MAAM,eAAe,CAAC;AAgCvB,eAAO,MAAM,WAAW,EAAE,oBAuSxB,CAAC"}
|