Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/leemonade/bubbles into d…
Browse files Browse the repository at this point in the history
…evelop

* 'develop' of https://github.com/leemonade/bubbles:
  chore: version bump
  feat(FileUpload): Add border to selected files and status icon
  chore: version bump
  feat(ProgressBottomBar):  new component fix(TextEditor): readOnly refresh feat(ComputerKeyboardNext): change SVG fix(Accordion): set hover color to transparent
  chore: version bump
  • Loading branch information
johan-fx committed Jan 18, 2024
2 parents 78f609f + 185541e commit 93e9777
Show file tree
Hide file tree
Showing 30 changed files with 545 additions and 57 deletions.
27 changes: 27 additions & 0 deletions packages/calendars/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# @bubbles-ui/calendars

## 1.2.122

### Patch Changes

- Versions bump
- Updated dependencies
- @bubbles-ui/components@1.2.122
- @bubbles-ui/icons@1.2.122

## 1.2.121

### Patch Changes

- Versions bump
- Updated dependencies
- @bubbles-ui/components@1.2.121
- @bubbles-ui/icons@1.2.121

## 1.2.120

### Patch Changes

- Versions bump
- Updated dependencies
- @bubbles-ui/components@1.2.120
- @bubbles-ui/icons@1.2.120

## 1.2.119

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/calendars/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bubbles-ui/calendars",
"version": "1.2.119",
"version": "1.2.122",
"description": "The Bubbles Design System is Leemonade's open-source design system for products and experiences.",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down Expand Up @@ -59,8 +59,8 @@
"rrule": "^2.6.8"
},
"peerDependencies": {
"@bubbles-ui/components": "^1.2.119",
"@bubbles-ui/icons": "^1.2.119",
"@bubbles-ui/components": "^1.2.122",
"@bubbles-ui/icons": "^1.2.122",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"webpack": "*"
Expand Down
24 changes: 24 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# @bubbles-ui/components

## 1.2.122

### Patch Changes

- Versions bump
- Updated dependencies
- @bubbles-ui/icons@1.2.122

## 1.2.121

### Patch Changes

- Versions bump
- Updated dependencies
- @bubbles-ui/icons@1.2.121

## 1.2.120

### Patch Changes

- Versions bump
- Updated dependencies
- @bubbles-ui/icons@1.2.120

## 1.2.119

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bubbles-ui/components",
"version": "1.2.119",
"version": "1.2.122",
"description": "The Bubbles Design System is Leemonade's open-source design system for products and experiences.",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down Expand Up @@ -61,7 +61,7 @@
"chromatic": "npx chromatic --project-token=7b10302a7b6b --build-script-name=build:storybook:raw"
},
"dependencies": {
"@bubbles-ui/icons": "^1.2.119",
"@bubbles-ui/icons": "^1.2.122",
"@emotion/react": "^11.10.0",
"@heroicons/react": "^1.0.5",
"@hookform/resolvers": "^3.3.2",
Expand Down
63 changes: 57 additions & 6 deletions packages/components/src/form/FileUpload/FileUpload.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import React, { useMemo, useRef } from 'react';
import React, { useEffect, useMemo, useRef } from 'react';
import PropTypes from 'prop-types';
import { Group, Text } from '@mantine/core';
import { Dropzone as MantineDropzone } from '@mantine/dropzone';
import { DeleteBinIcon, SynchronizeArrowIcon } from '@bubbles-ui/icons/outline/';
import {
DeleteBinIcon,
SynchronizeArrowIcon,
RemoveCircleIcon,
CheckCircleIcon,
} from '@bubbles-ui/icons/outline/';
import { isEmpty, isFunction, isString } from 'lodash';
import { FileUploadStyles } from './FileUpload.styles';
import { Stack, Box } from '../../layout';
import { FileItemDisplay } from '../../informative/FileItemDisplay';
import { Alert } from '../../feedback/Alert';
import { InputWrapper, INPUT_WRAPPER_PROP_TYPES } from '../InputWrapper';
import { Button } from '../Button';
import { Loader } from '../../../lib/feedback/Loader/Loader';

export const FILE_UPLOAD_DEFAULT_PROPS = {
disabled: false,
Expand Down Expand Up @@ -94,7 +100,7 @@ const FileUpload = ({
}
}, [initialFiles]);

const { classes, cx } = FileUploadStyles(
const { classes, theme } = FileUploadStyles(
{ disabled, single, files, hasError },
{ name: 'FileUpload' },
);
Expand Down Expand Up @@ -151,10 +157,55 @@ const FileUpload = ({
</Alert>
)}
{files.length > 0 && (
<Stack className={classes.fileList} direction={'column'}>
<Stack spacing={4} className={classes.fileList} direction={'column'}>
{files.map((file, index) => (
<Stack key={index} alignItems="center" spacing={8} className={classes.droppedFile}>
<FileItemDisplay iconSize={30} filename={file.name} thumbnailUrl={getFileUrl(file)} />
<Stack key={index} alignItems="center" spacing={4} className={classes.droppedFile}>
<Stack
className={classes.fileItemDisplay}
spacing={4}
justifyContent="space-between"
alignItems="center"
>
<FileItemDisplay
iconSize={20}
filename={file.name}
thumbnailUrl={getFileUrl(file)}
/>
{file.status === 'loading' && (
<Box sx={{ position: 'relative', width: 20, height: 20, minWidth: 20 }}>
<Box
sx={{
position: 'absolute',
left: -1,
top: -7.5,
width: 45,

height: 40,
}}
>
<Loader />
</Box>
</Box>
)}
{file.status === 'success' && (
<Box sx={{ width: 20, height: 20 }}>
<CheckCircleIcon
color={theme.other.core.color.success['500']}
width={20}
height={20}
/>
</Box>
)}
{file.status === 'error' && (
<Box sx={{ width: 20, height: 20 }}>
<RemoveCircleIcon
color={theme.other.core.color.danger['500']}
width={20}
height={20}
/>
</Box>
)}
</Stack>
<Box noFlex>
<Button
onClick={() => removeFile(index)}
Expand Down
33 changes: 28 additions & 5 deletions packages/components/src/form/FileUpload/FileUpload.stories.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { Box } from '@mantine/core';
import { FileUpload, FILE_UPLOAD_DEFAULT_PROPS } from './FileUpload';
import mdx from './FileUpload.mdx';
import { MIME_TYPES } from '@mantine/dropzone';
import { CloudUploadIcon } from '@bubbles-ui/icons/outline';
import { FileUpload, FILE_UPLOAD_DEFAULT_PROPS } from './FileUpload';
import mdx from './FileUpload.mdx';

export default {
title: 'Molecules/Form/FileUpload',
Expand All @@ -20,12 +20,11 @@ export default {
argTypes: {
onChange: { action: 'File dropped' },
accept: { options: MIME_TYPES, control: { type: 'multi-select' } },
status: { options: ['error', 'loading', 'success'], control: { type: 'select' } },
},
};

const Template = ({ children, ...props }) => {
return <FileUpload {...props}>{children}</FileUpload>;
};
const Template = ({ children, ...props }) => <FileUpload {...props}>{children}</FileUpload>;

export const Playground = Template.bind({});

Expand All @@ -36,3 +35,27 @@ Playground.args = {
subtitle: 'or drop here a file from your computer',
errorMessage: { title: 'Error', message: 'File was rejected' },
};

export const WithLoaders = Template.bind({});

WithLoaders.args = {
...FILE_UPLOAD_DEFAULT_PROPS,
initialFiles: [
{
name: 'My document.docx',
status: 'success',
},
{
name: 'My awesome image.svg',
status: 'loading',
},
{
name: 'My boring pdf.pdf',
status: 'error',
},
],
icon: <CloudUploadIcon height={32} width={32} />,
title: 'Click to browse your file',
subtitle: 'or drop here a file from your computer',
errorMessage: { title: 'Error', message: 'File was rejected' },
};
10 changes: 10 additions & 0 deletions packages/components/src/form/FileUpload/FileUpload.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const FileUploadStyles = createStyles((theme, { disabled, single, files, hasErro
color: dropzoneTheme.content.color['default--subtle'],
},
droppedFile: {
minWidth: 500,
// padding: `${pxToRem(28)} ${pxToRem(16)} ${pxToRem(28)} ${pxToRem(28)}`,
},
fileList: {
Expand All @@ -85,6 +86,15 @@ const FileUploadStyles = createStyles((theme, { disabled, single, files, hasErro
uploadButton: {
marginTop: pxToRem(theme.spacing[4]),
},
fileItemDisplay: {
...theme.other.global.content.typo.body['sm--semiBold'],
padding: '18px 8px',
borderWidth: 1,
borderStyle: 'solid',
borderColor: theme.other.global.border.color.line.muted,
borderRadius: 4,
minWidth: '100%',
},
};
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createStyles } from '@mantine/styles';
import { pxToRem, getPaddings, getFontExpressive, getFontProductive } from '../../theme.mixins';
import { pxToRem } from '../../theme.mixins';

const BORDER_RADIUS = 8;

export const ActivityAccordionStyles = createStyles((theme, { compact }) => {
const ActivityAccordionStyles = createStyles((theme, { compact }) => {
const PANEL_COLORS = {
default: theme.colors.uiBackground01,
solid: theme.colors.interactive03h,
Expand All @@ -14,6 +14,9 @@ export const ActivityAccordionStyles = createStyles((theme, { compact }) => {
display: 'flex',
flexDirection: 'column',
gap: theme.spacing[2],
'& .mantine-Accordion-control:hover': {
backgroundColor: 'transparent',
},
},
item: {
backgroundColor: theme.colors.uiBackground01,
Expand Down Expand Up @@ -54,3 +57,5 @@ export const ActivityAccordionStyles = createStyles((theme, { compact }) => {
},
};
});

export { ActivityAccordionStyles };
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import propTypes from 'prop-types';

export const PROGRESSBOTTOMBAR_RADIUS = ['xs', 'sm', 'md', 'lg', 'xl'];
export const PROGRESSBOTTOMBAR_SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];

// SECTIONS PROP EXAMPLE
// If you want to use sections prop, you need to pass an array of objects with value, color and label keys.
// only value and color keys are required.
//
// sections={[
// { value: 33, color: 'pink', label: 'Documents', tooltip: 'Document – 33 Gb' },
// { value: 28, color: 'grape', label: 'Apps', tooltip: 'Apps – 28 Gb' },
// { value: 25, color: 'violet', label: 'Other', tooltip: 'Other – 25 Gb' },
// ]}

export const PROGRESSBOTTOMBAR_DEFAULT_PROPS = {
animate: false,
color: 'orange',
label: '',
labelLeft: 'labelLeft',
labelRight: 'LabelRight',
radius: 'lg',
sections: null,
size: 'sm',
striped: false,
value: 100,
};

export const PROGRESSBOTTOMBAR_PROP_TYPES = {
animate: propTypes.bool,
color: propTypes.string,
label: propTypes.string,
labelLeft: propTypes.string,
labelRight: propTypes.string,
radius: propTypes.oneOf(PROGRESSBOTTOMBAR_RADIUS),
sections: propTypes.array,
size: propTypes.oneOf(PROGRESSBOTTOMBAR_SIZES),
striped: propTypes.bool,
value: propTypes.number,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from 'react';
import { Progress as MantineProgress } from '@mantine/core';
import { Box, Text } from '@bubbles-ui/components';
import {
PROGRESSBOTTOMBAR_DEFAULT_PROPS,
PROGRESSBOTTOMBAR_PROP_TYPES,
} from './ProgressBottomBar.constants';
import { ProgressBottomBarStyles } from './ProgressBottomBar.styles';

const ProgressBottomBar = ({
animate,
label,
labelTop,
color,
radius,
sections,
size,
striped,
value,
}) => {
const { classes, theme } = ProgressBottomBarStyles();
return (
<Box>
{labelTop && (
<Box className={classes.topLabelContainer}>
<Text className={classes.labelTop}>{labelTop}</Text>
</Box>
)}
<MantineProgress
value={value}
label={label}
color={'#4D5358'}
animate={animate}
radius={radius}
sections={sections}
size={size}
striped={striped}
/>
</Box>
);
};

ProgressBottomBar.propTypes = PROGRESSBOTTOMBAR_PROP_TYPES;
ProgressBottomBar.defaultProps = PROGRESSBOTTOMBAR_DEFAULT_PROPS;
ProgressBottomBar.displayName = 'ProgressBottomBar';

export { ProgressBottomBar };
export default ProgressBottomBar;
Loading

0 comments on commit 93e9777

Please sign in to comment.