paris 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # paris
2
2
 
3
+ ## 0.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 087723b: Input: Adjusted padding to reduce input height to 34px
8
+
9
+ ## 0.9.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 525d2ff: feat: Add override props and make TextArea forward ref
14
+
3
15
  ## 0.9.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "paris",
3
3
  "author": "Sanil Chawla <sanil@slingshot.fm> (https://sanil.co)",
4
4
  "description": "Paris is Slingshot's React design system. It's a collection of reusable components, design tokens, and guidelines that help us build consistent, accessible, and performant user interfaces.",
5
- "version": "0.9.0",
5
+ "version": "0.9.2",
6
6
  "homepage": "https://paris.slingshot.fm",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import type { ReactNode } from 'react';
3
+ import type { ReactNode, ComponentPropsWithoutRef } from 'react';
4
4
  import {
5
5
  useEffect,
6
6
  useRef, Fragment, useMemo, useState,
@@ -110,6 +110,23 @@ export type DrawerProps<T extends string[] | readonly string[] = string[]> = {
110
110
  overlayStyle?: 'grey' | 'blur';
111
111
  /** The contents of the Drawer. */
112
112
  children?: ReactNode | ReactNode[];
113
+
114
+ /** Prop overrides for other rendered elements. Overrides for the input itself should be passed directly to the component. */
115
+ overrides?: {
116
+ dialog?: ComponentPropsWithoutRef<'div'>;
117
+ overlay?: ComponentPropsWithoutRef<'div'>;
118
+ panelContainer?: ComponentPropsWithoutRef<'div'>;
119
+ panel?: ComponentPropsWithoutRef<'div'>;
120
+ titleBar?: ComponentPropsWithoutRef<'div'>;
121
+ titleArea?: ComponentPropsWithoutRef<'div'>;
122
+ titleBarButtons?: ComponentPropsWithoutRef<'div'>;
123
+ content?: ComponentPropsWithoutRef<'div'>;
124
+ contentChildren?: ComponentPropsWithoutRef<'div'>;
125
+ contentChildrenChildren: ComponentPropsWithoutRef<'div'>;
126
+ bottomPanelSpacer?: ComponentPropsWithoutRef<'div'>;
127
+ bottomPanel?: ComponentPropsWithoutRef<'div'>;
128
+ bottomPanelContent?: ComponentPropsWithoutRef<'div'>;
129
+ };
113
130
  };
114
131
 
115
132
  /**
@@ -137,6 +154,7 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
137
154
  overlayStyle = 'grey',
138
155
  additionalActions,
139
156
  children,
157
+ overrides,
140
158
  }: DrawerProps<T>) => {
141
159
  // Check if the drawer is on the x-axis.
142
160
  const xAxisDrawer = useMemo(() => ['left', 'right'].includes(from), [from]);
@@ -192,13 +210,16 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
192
210
  as="div"
193
211
  className={clsx(
194
212
  styles.root,
213
+ overrides?.dialog?.className,
195
214
  )}
196
215
  onClose={onClose}
216
+ {...overrides?.dialog}
197
217
  >
198
218
  <div
199
219
  className={clsx(
200
220
  overlayStyle === 'blur' && styles.overlayBlurContainer,
201
221
  overlayStyle === 'grey' && styles.overlayGreyContainer,
222
+ overrides?.overlay?.className,
202
223
  )}
203
224
  >
204
225
  <Transition.Child
@@ -225,10 +246,13 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
225
246
  styles.panelContainer,
226
247
  styles[`from-${from}`],
227
248
  { [styles[`size-${size}`]]: sizeIsPreset },
249
+ overrides?.panelContainer?.className,
228
250
  )}
229
251
  style={!sizeIsPreset ? {
230
252
  [xAxisDrawer ? 'width' : 'height']: size,
231
- } : {}}
253
+ ...overrides?.panelContainer?.style,
254
+ } : overrides?.panelContainer?.style}
255
+ {...overrides?.panelContainer}
232
256
  >
233
257
  <Transition.Child
234
258
  as={Fragment}
@@ -243,14 +267,13 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
243
267
  className={clsx(
244
268
  styles.panel,
245
269
  styles[`from-${from}`],
270
+ overrides?.panel?.className,
246
271
  )}
247
272
  >
248
273
  {/* Dialog title bar */}
249
- <div className={styles.titleBar}>
274
+ <div className={clsx(styles.titleBar, overrides?.titleBar?.className)}>
250
275
  <div
251
- className={clsx(
252
- styles.titleArea,
253
- )}
276
+ className={clsx(styles.titleArea, overrides?.titleArea?.className)}
254
277
  >
255
278
  <RemoveFromDOM
256
279
  // Hide when pagination is not enabled.
@@ -300,7 +323,7 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
300
323
  </Dialog.Title>
301
324
  </VisuallyHidden>
302
325
  </div>
303
- <div className={styles.titleBarButtons}>
326
+ <div className={clsx(styles.titleBarButtons, overrides?.titleBarButtons?.className)}>
304
327
  {/* Action Menu */}
305
328
  <RemoveFromDOM when={!hasAdditionalActions}>
306
329
  {additionalActions}
@@ -329,8 +352,8 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
329
352
  </div>
330
353
  </div>
331
354
 
332
- <div className={styles.content}>
333
- <div className={styles.contentChildren}>
355
+ <div className={clsx(styles.content, overrides?.content?.className)}>
356
+ <div className={clsx(styles.contentChildren, overrides?.contentChildren?.className)}>
334
357
  {(isPaginated && Array.isArray(children)) ? children.map((child) => (child && typeof child === 'object' && 'key' in child) && (
335
358
  <Transition
336
359
  show={child.key === pagination?.currentPage && loadedPage === child.key}
@@ -345,6 +368,7 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
345
368
  afterLeave={() => {
346
369
  setLoadedPage(pagination?.currentPage || null);
347
370
  }}
371
+ className={clsx(overrides?.contentChildrenChildren?.className)}
348
372
  >
349
373
  {child}
350
374
  </Transition>
@@ -352,13 +376,13 @@ export const Drawer = <T extends string[] | readonly string[] = string[]>({
352
376
  </div>
353
377
  {bottomPanel && (
354
378
  <>
355
- <div tabIndex={-1} aria-hidden="true" className={styles.bottomPanelSpacer}>
379
+ <div tabIndex={-1} aria-hidden="true" className={clsx(styles.bottomPanelSpacer, overrides?.bottomPanelSpacer?.className)}>
356
380
  {bottomPanel}
357
381
  </div>
358
- <div className={styles.bottomPanel}>
382
+ <div className={clsx(styles.bottomPanel, overrides?.bottomPanel?.className)}>
359
383
  <div className={styles.glassOpacity} />
360
384
  <div className={styles.glassBlend} />
361
- <div className={styles.bottomPanelContent}>
385
+ <div className={clsx(styles.bottomPanelContent, overrides?.bottomPanelContent?.className)}>
362
386
  {bottomPanel}
363
387
  </div>
364
388
  </div>
@@ -9,7 +9,7 @@
9
9
 
10
10
  //height: 36px;
11
11
  width: 100%;
12
- padding: calc(7.5px - var(--pte-typography-verticalMetricsAdjust)) 14px 7.5px;
12
+ padding: calc(6px - var(--pte-typography-verticalMetricsAdjust)) 13px 6px;
13
13
 
14
14
  font-size: var(--pte-typography-styles-paragraphSmall-fontSize);
15
15
  font-style: var(--pte-typography-styles-paragraphSmall-fontStyle);
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
 
3
- import type { CSSProperties, FC, ReactNode } from 'react';
3
+ import type {
4
+ ComponentPropsWithoutRef, CSSProperties, FC, ReactNode,
5
+ } from 'react';
4
6
  import { useId, useState } from 'react';
5
7
  import { Tab } from '@headlessui/react';
6
8
  import clsx from 'clsx';
@@ -54,6 +56,16 @@ export type TabsProps = {
54
56
  * @param index - The index of the tab that was selected.
55
57
  */
56
58
  onTabChange?: (index: number) => void | Promise<void>;
59
+ /**
60
+ * Prop overrides for other rendered elements. Overrides for the input itself should be passed directly to the component.
61
+ */
62
+ overrides?: {
63
+ group?: ComponentPropsWithoutRef<'div'>;
64
+ panel?: ComponentPropsWithoutRef<'div'>;
65
+ panelContainer?: ComponentPropsWithoutRef<'div'>;
66
+ tabList?: ComponentPropsWithoutRef<'div'>;
67
+ tabBackground?: ComponentPropsWithoutRef<'div'>;
68
+ }
57
69
  };
58
70
 
59
71
  /**
@@ -77,6 +89,7 @@ export const Tabs: FC<TabsProps> = ({
77
89
  defaultIndex = 0,
78
90
  index,
79
91
  onTabChange,
92
+ overrides,
80
93
  }) => {
81
94
  const id = useId();
82
95
  const [selectedIndex, setSelectedIndex] = useState(defaultIndex);
@@ -91,9 +104,9 @@ export const Tabs: FC<TabsProps> = ({
91
104
  onTabChange?.(i);
92
105
  }
93
106
  }}
94
- className={clsx(styles.tabGroup, styles[backgroundStyle])}
107
+ className={clsx(styles.tabGroup, styles[backgroundStyle], overrides?.group?.className)}
95
108
  >
96
- <div className={clsx(styles.tabBackground, styles[backgroundStyle])}>
109
+ <div className={clsx(styles.tabBackground, styles[backgroundStyle], overrides?.tabBackground?.className)}>
97
110
  {backgroundStyle === 'glass' && (
98
111
  <div className={styles.glassContainer}>
99
112
  <div className={styles.glassOpacity} />
@@ -109,6 +122,7 @@ export const Tabs: FC<TabsProps> = ({
109
122
  styles.tabList,
110
123
  styles[barStyle],
111
124
  styles[backgroundStyle],
125
+ overrides?.tabList?.className,
112
126
  )}
113
127
  >
114
128
  {tabs.map(({ title }, i) => (
@@ -140,7 +154,7 @@ export const Tabs: FC<TabsProps> = ({
140
154
  </div>
141
155
 
142
156
  <Tab.Panels
143
- className={clsx(styles.tabPanels, styles[backgroundStyle])}
157
+ className={clsx(styles.tabPanels, styles[backgroundStyle], overrides?.panelContainer?.className)}
144
158
  >
145
159
  {tabs.map(({ title, content }) => (
146
160
  <Tab.Panel
@@ -150,6 +164,7 @@ export const Tabs: FC<TabsProps> = ({
150
164
  styles[backgroundStyle],
151
165
  styles[barStyle],
152
166
  styles[kind],
167
+ overrides?.panel?.className,
153
168
  )}
154
169
  >
155
170
  {content}
@@ -1,5 +1,5 @@
1
- import type { ComponentPropsWithoutRef, FC } from 'react';
2
- import { useId } from 'react';
1
+ import type { ComponentPropsWithoutRef, ForwardedRef } from 'react';
2
+ import { forwardRef, useId } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import type { InputProps } from '../input';
5
5
  import styles from '../input/Input.module.scss';
@@ -19,7 +19,7 @@ import { Field } from '../field';
19
19
  * ```
20
20
  * @constructor
21
21
  */
22
- export const TextArea: FC<InputProps & ComponentPropsWithoutRef<'textarea'>> = ({
22
+ export const TextArea = forwardRef<HTMLTextAreaElement, InputProps & ComponentPropsWithoutRef<'textarea'>>(({
23
23
  label,
24
24
  status,
25
25
  type,
@@ -32,7 +32,7 @@ export const TextArea: FC<InputProps & ComponentPropsWithoutRef<'textarea'>> = (
32
32
  overrides,
33
33
  rows = 3,
34
34
  ...props
35
- }) => {
35
+ }, ref: ForwardedRef<HTMLTextAreaElement>) => {
36
36
  const textareaID = useId();
37
37
  return (
38
38
  <Field
@@ -69,6 +69,7 @@ export const TextArea: FC<InputProps & ComponentPropsWithoutRef<'textarea'>> = (
69
69
  <textarea
70
70
  {...props}
71
71
  id={textareaID}
72
+ ref={ref}
72
73
  aria-label={typeof label === 'string' ? label : props['aria-label']}
73
74
  aria-describedby={`${textareaID}-description`}
74
75
  aria-disabled={disabled}
@@ -97,4 +98,4 @@ export const TextArea: FC<InputProps & ComponentPropsWithoutRef<'textarea'>> = (
97
98
  </div>
98
99
  </Field>
99
100
  );
100
- };
101
+ });