@soul-refiner/design-system 0.2.98 → 0.2.99

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.
@@ -19,9 +19,10 @@ export interface DropdownProps extends NativeProps, React.PropsWithChildren {
19
19
  additionalOptions?: Omit<DropdownOptionProps, 'selected' | 'onClick'>[];
20
20
  additionalOnChange?: (value: string) => void;
21
21
  defaultAdditionalValue?: string;
22
+ useFullWidth?: boolean;
22
23
  }
23
24
  declare const Dropdown: {
24
- ({ checkbox, children, closeOnChange, closeOnBlur, defaultValue, disabled, hasArrow, maintainState, multiple, offset, onChange, open: openDirection, options, sx, trigger, containerSx, additionalOptions, additionalOnChange, defaultAdditionalValue, ...rest }: DropdownProps): React.JSX.Element;
25
+ ({ checkbox, children, closeOnChange, closeOnBlur, defaultValue, disabled, hasArrow, maintainState, multiple, offset, onChange, open: openDirection, options, sx, trigger, containerSx, additionalOptions, additionalOnChange, defaultAdditionalValue, useFullWidth, ...rest }: DropdownProps): React.JSX.Element;
25
26
  Option: {
26
27
  ({ checkbox, disabled, icon, label, onClick, selected, sublabel, sx, value, color, }: DropdownOptionProps): React.JSX.Element;
27
28
  displayName: string;
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { Box, Checkbox, P } from '../../';
5
- const Dropdown = ({ checkbox, children, closeOnChange = true, closeOnBlur = true, defaultValue = '', disabled = false, hasArrow, maintainState = true, multiple, offset = [0, 16], onChange, open: openDirection = 'right', options, sx, trigger, containerSx, additionalOptions, additionalOnChange, defaultAdditionalValue, ...rest }) => {
5
+ const Dropdown = ({ checkbox, children, closeOnChange = true, closeOnBlur = true, defaultValue = '', disabled = false, hasArrow, maintainState = true, multiple, offset = [0, 16], onChange, open: openDirection = 'right', options, sx, trigger, containerSx, additionalOptions, additionalOnChange, defaultAdditionalValue, useFullWidth = false, ...rest }) => {
6
6
  const id = React.useId();
7
7
  const wrapperRef = React.useRef(null);
8
8
  const optionsRef = React.useRef(null);
@@ -104,7 +104,7 @@ const Dropdown = ({ checkbox, children, closeOnChange = true, closeOnBlur = true
104
104
  trigger.type?.name !== 'Button')
105
105
  ? { onClick: handleOpen }
106
106
  : { isDropdownOpen: open, onClick: handleOpen }),
107
- open && (React.createElement(Container, { "$hasArrow": hasArrow, "$offset": offset, "$openDirection": openDirection, ref: optionsRef, "$sx": containerSx },
107
+ open && (React.createElement(Container, { "$hasArrow": hasArrow, "$offset": offset, "$openDirection": openDirection, ref: optionsRef, "$sx": containerSx, "$useFullWidth": useFullWidth },
108
108
  React.createElement("div", { style: { display: 'flex' } },
109
109
  React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } }, dropdownOptions),
110
110
  !!additionalOptions?.length && (React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } }, additionalOptions.map((additionalOption) => (React.createElement(Option, { key: additionalOption.value, onClick: handleAdditionalChange, selected: additionalSelected === additionalOption.value, label: additionalOption.label, value: additionalOption.value }))))))))));
@@ -119,7 +119,7 @@ const Container = styled.div `
119
119
  z-index: 1;
120
120
  background-color: var(--color-white);
121
121
  position: absolute;
122
- width: max-content;
122
+ ${({ $useFullWidth }) => $useFullWidth ? 'width: 100%;' : 'width: max-content;'}
123
123
  z-index: 100;
124
124
  outline: none;
125
125
  cursor: pointer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "0.2.98",
3
+ "version": "0.2.99",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {