@ahrowe/ui 0.17.3 → 0.18.0

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.
@@ -26,6 +26,7 @@ import { SplitButtonProps } from '../splitButton/splitButton.types';
26
26
  import { RevealLensProps } from '../revealLens/revealLens.types';
27
27
  import { TiltProps } from '../tilt/tilt.types';
28
28
  import { FlipProps } from '../flip/flip.types';
29
+ import { OptionPickerProps } from '../optionPicker/optionPicker.types';
29
30
  /**
30
31
  * Global default props keyed by component name.
31
32
  *
@@ -68,6 +69,7 @@ export interface ComponentDefaults {
68
69
  RevealLens?: Partial<RevealLensProps>;
69
70
  Tilt?: Partial<TiltProps>;
70
71
  Flip?: Partial<FlipProps>;
72
+ OptionPicker?: Partial<OptionPickerProps>;
71
73
  }
72
74
  export interface ConfigProviderProps {
73
75
  children: React.ReactNode;
@@ -1,4 +1,4 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { OptionPickerProps } from './optionPicker.types';
3
- declare function OptionPicker({ className, options, onChange, value, ...rest }: OptionPickerProps): ReactElement;
3
+ declare function OptionPicker(props: OptionPickerProps): ReactElement;
4
4
  export default OptionPicker;
@@ -1,11 +1,15 @@
1
1
  import { ReactElement } from 'react';
2
- import { HtmlProps } from '../types/slots.types';
2
+ import { HtmlProps, SlotClassNames, SlotStyles } from '../types/slots.types';
3
3
  export interface Option {
4
4
  label: ReactElement | string;
5
5
  key: string;
6
6
  }
7
+ export type OptionPickerSlots = 'root' | 'chip' | 'option';
7
8
  export interface OptionPickerProps extends HtmlProps {
8
9
  className?: string;
10
+ style?: React.CSSProperties;
11
+ classNames?: SlotClassNames<OptionPickerSlots>;
12
+ styles?: SlotStyles<OptionPickerSlots>;
9
13
  options: Option[];
10
14
  onChange: (key: string, event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
11
15
  value: string;
@@ -60,7 +60,7 @@ So a global default only fills in props a given instance left out — any instan
60
60
 
61
61
  Each entry is a `Partial<...Props>`, so any of that component's props can be defaulted:
62
62
 
63
- - **Form inputs:** `Input` · `Textarea` · `NumberInput` · `Dropdown` · `InputDropdown` · `Checkbox` · `Switch` · `RadioGroup` · `DatePicker`
63
+ - **Form inputs:** `Input` · `Textarea` · `NumberInput` · `Dropdown` · `InputDropdown` · `Checkbox` · `Switch` · `RadioGroup` · `DatePicker` · `OptionPicker`
64
64
  - **Display:** `Button` · `ActionButtons` · `Badge` · `Chip` · `Card` · `SectionHeader` · `Skeleton` · `Accordion` · `Divider`
65
65
  - **Overlays:** `ConfirmModal`
66
66
 
@@ -32,3 +32,7 @@ const options: Option[] = [
32
32
  | `value` | `string` | Currently selected key |
33
33
  | `onChange` | `(key: string, event: MouseEvent) => void` | Called when user picks a new option |
34
34
  | `className` | `string` | Root element class |
35
+
36
+ **Global defaults:** adopts `ConfigProvider`, e.g. `defaultProps={{ OptionPicker: { className: 'my-picker' } }}`. See [ConfigProvider.md](ConfigProvider.md).
37
+
38
+ **Slots:** `root` `chip` `option`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahrowe/ui",
3
- "version": "0.17.3",
3
+ "version": "0.18.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },