paris 0.3.0 → 0.4.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/package.json +14 -12
  3. package/src/pages/_app.tsx +1 -1
  4. package/src/pages/index.tsx +1 -1
  5. package/src/stories/Pagination.mdx +73 -0
  6. package/src/stories/button/Button.module.scss +11 -1
  7. package/src/stories/button/Button.tsx +40 -17
  8. package/src/stories/card/Card.module.scss +14 -0
  9. package/src/stories/card/Card.stories.ts +33 -0
  10. package/src/stories/card/Card.tsx +55 -0
  11. package/src/stories/card/index.ts +1 -0
  12. package/src/stories/checkbox/Checkbox.module.scss +57 -0
  13. package/src/stories/checkbox/Checkbox.stories.ts +27 -0
  14. package/src/stories/checkbox/Checkbox.tsx +58 -0
  15. package/src/stories/checkbox/index.ts +1 -0
  16. package/src/stories/combobox/Combobox.module.scss +5 -0
  17. package/src/stories/combobox/Combobox.stories.ts +84 -0
  18. package/src/stories/combobox/Combobox.tsx +264 -0
  19. package/src/stories/combobox/index.ts +1 -0
  20. package/src/stories/dialog/Dialog.module.scss +187 -0
  21. package/src/stories/dialog/Dialog.stories.tsx +70 -0
  22. package/src/stories/dialog/Dialog.tsx +279 -0
  23. package/src/stories/dialog/index.ts +1 -0
  24. package/src/stories/drawer/Drawer.module.scss +284 -0
  25. package/src/stories/drawer/Drawer.stories.tsx +94 -0
  26. package/src/stories/drawer/Drawer.tsx +339 -0
  27. package/src/stories/drawer/index.ts +1 -0
  28. package/src/stories/field/Field.module.scss +5 -0
  29. package/src/stories/field/Field.stories.ts +32 -0
  30. package/src/stories/field/Field.tsx +106 -0
  31. package/src/stories/field/index.ts +1 -0
  32. package/src/stories/icon/ChevronLeft.tsx +11 -0
  33. package/src/stories/icon/ChevronRight.tsx +11 -0
  34. package/src/stories/icon/Close.tsx +11 -0
  35. package/src/stories/icon/Icon.module.scss +5 -0
  36. package/src/stories/icon/Icon.stories.ts +28 -0
  37. package/src/stories/icon/Icon.tsx +46 -0
  38. package/src/stories/icon/index.ts +4 -0
  39. package/src/stories/input/Input.module.scss +3 -2
  40. package/src/stories/input/Input.stories.ts +2 -0
  41. package/src/stories/input/Input.tsx +38 -73
  42. package/src/stories/pagination/index.ts +1 -0
  43. package/src/stories/pagination/usePagination.ts +106 -0
  44. package/src/stories/select/Select.module.scss +8 -4
  45. package/src/stories/select/Select.stories.ts +5 -3
  46. package/src/stories/select/Select.tsx +80 -7
  47. package/src/stories/theme/themes.ts +75 -2
  48. package/src/stories/theme/tw-preflight.css +3 -1
  49. package/src/stories/tilt/Tilt.module.scss +1 -0
  50. package/src/stories/tilt/Tilt.stories.tsx +43 -0
  51. package/src/stories/tilt/Tilt.tsx +65 -0
  52. package/src/stories/tilt/index.ts +1 -0
  53. package/src/stories/utility/RemoveFromDOM.tsx +19 -0
  54. package/src/stories/utility/TextWhenString.tsx +28 -0
  55. package/src/stories/utility/VisuallyHidden.tsx +25 -0
@@ -0,0 +1,43 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import type { Property } from 'csstype';
3
+ import { Tilt } from './Tilt';
4
+ import { Text } from '../text';
5
+ import { pvar } from '../theme';
6
+
7
+ const meta: Meta<typeof Tilt> = {
8
+ title: 'Surfaces/Tilt',
9
+ component: Tilt,
10
+ tags: ['autodocs'],
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof Tilt>;
15
+
16
+ export const Default: Story = {
17
+ args: {
18
+ style: {},
19
+ children: (
20
+ <Text kind="headingMedium">Billie Eilish</Text>
21
+ ),
22
+ onEnter: undefined,
23
+ onLeave: undefined,
24
+ onMove: undefined,
25
+ },
26
+ render: ({ children, style, ...args }) => (
27
+ <Tilt
28
+ {...args}
29
+ style={{
30
+ width: 'max-content',
31
+ userSelect: pvar('utils.defaultUserSelect') as Property.UserSelect,
32
+ // backgroundColor: pvar('colors.backgroundOverlayDark'),
33
+ boxShadow: pvar('lighting.shallowBelow'),
34
+ padding: '8px 16px',
35
+ border: `1px solid ${pvar('borders.dropdown.color')}`,
36
+ borderRadius: pvar('borders.radius.rounded'),
37
+ ...style,
38
+ }}
39
+ >
40
+ {children}
41
+ </Tilt>
42
+ ),
43
+ };
@@ -0,0 +1,65 @@
1
+ 'use client';
2
+
3
+ import type { FC, ReactNode } from 'react';
4
+ import RPTilt from 'react-parallax-tilt';
5
+ import styles from './Tilt.module.scss';
6
+
7
+ export type TiltProps = {
8
+ /**
9
+ * Disables the tilt effect.
10
+ * @default false
11
+ */
12
+ disableTilt?: boolean;
13
+ /** The contents of the Tilt. */
14
+ children?: ReactNode | ReactNode[];
15
+ /** The class names to apply to this element. */
16
+ className?: string;
17
+ } & RPTilt['props'];
18
+
19
+ /**
20
+ * Tilt components allow you to add a parallax tilt effect to any component.
21
+ *
22
+ * Based on [react-parallax-tilt](https://github.com/mkosir/react-parallax-tilt), customized with our preferred defaults.
23
+ *
24
+ * > Card components include a Tilt component by default, by setting the `tilt` prop to `true`. You can override any of the underlying Tilt props by passing them to the Card component's `overrides.tilt` prop.
25
+ *
26
+ * <hr />
27
+ *
28
+ * To use this component, import it as follows:
29
+ *
30
+ * ```js
31
+ * import { Tilt } from 'paris/tilt';
32
+ * ```
33
+ * @constructor
34
+ */
35
+ export const Tilt: FC<TiltProps> = ({
36
+ disableTilt = false,
37
+ scale = 1.05,
38
+ tiltMaxAngleX = 12.5,
39
+ tiltMaxAngleY = 12.5,
40
+ glareEnable = true,
41
+ glareMaxOpacity = 0.5,
42
+ style = {},
43
+ tiltAngleXManual = null,
44
+ tiltAngleYManual = null,
45
+ perspective = 1000,
46
+ children,
47
+ ...props
48
+ }) => (
49
+ <RPTilt
50
+ scale={disableTilt ? 1 : scale}
51
+ tiltMaxAngleX={disableTilt ? 0 : tiltMaxAngleX}
52
+ tiltMaxAngleY={disableTilt ? 0 : tiltMaxAngleY}
53
+ glareEnable={!disableTilt && glareEnable}
54
+ glareMaxOpacity={disableTilt ? 0 : glareMaxOpacity}
55
+ style={style}
56
+ glareBorderRadius={`calc(${style?.borderRadius || '1px'} - 1px)`}
57
+ tiltAngleXManual={disableTilt ? 0 : tiltAngleXManual}
58
+ tiltAngleYManual={disableTilt ? 0 : tiltAngleYManual}
59
+ perspective={perspective}
60
+ {...props}
61
+ className={`${styles.container} ${props.className}`}
62
+ >
63
+ {children}
64
+ </RPTilt>
65
+ );
@@ -0,0 +1 @@
1
+ export * from './Tilt';
@@ -0,0 +1,19 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ import { memo } from 'react';
3
+
4
+ /**
5
+ * A memoized component that conditionally removes its children from the DOM if the `when` prop is `true`.
6
+ */
7
+ export const RemoveFromDOM = memo<PropsWithChildren<{
8
+ /**
9
+ * An optional condition that determines whether the children should be removed from the DOM. If `true`, the children will be removed.
10
+ * @default true
11
+ */
12
+ when: boolean;
13
+ }>>(
14
+ ({ when, children }) => (when ? (<></>) : (
15
+ <>
16
+ {children}
17
+ </>
18
+ )),
19
+ );
@@ -0,0 +1,28 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ import { memo } from 'react';
3
+ import type { TextProps } from '../text';
4
+ import { Text } from '../text';
5
+
6
+ /**
7
+ * A memoized component that renders its children as a {@link Text} component if `children` is just a string.
8
+ */
9
+ export const TextWhenString = memo<PropsWithChildren<TextProps>>(({
10
+ children,
11
+ ...props
12
+ }) => {
13
+ if (typeof children === 'string') {
14
+ return (
15
+ <Text
16
+ {...props}
17
+ >
18
+ {children}
19
+ </Text>
20
+ );
21
+ }
22
+
23
+ return (
24
+ <>
25
+ {children}
26
+ </>
27
+ );
28
+ });
@@ -0,0 +1,25 @@
1
+ import { memo } from 'react';
2
+ import type { PropsWithChildren } from 'react';
3
+ import { VisuallyHidden as AriaVisuallyHidden } from '@ariakit/react';
4
+
5
+ /**
6
+ * A memoized component that visually hides its children, but keeps them accessible to screen readers.
7
+ *
8
+ * Specify the `when` prop to conditionally render the children normally.
9
+ */
10
+ export const VisuallyHidden = memo<PropsWithChildren<{
11
+ /**
12
+ * An optional condition that determines whether the children should be hidden. If `false`, the children will be rendered normally.
13
+ * @default true
14
+ */
15
+ when?: boolean;
16
+ }>>(({
17
+ when = true,
18
+ children,
19
+ }) => (when ? (
20
+ <AriaVisuallyHidden>
21
+ {children}
22
+ </AriaVisuallyHidden>
23
+ ) : (
24
+ <>{children}</>
25
+ )));