@dhis2-ui/select 10.16.4 → 10.17.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.
Files changed (31) hide show
  1. package/build/cjs/multi-select/multi-select.js +8 -0
  2. package/build/cjs/multi-select/multi-select.prod.stories.js +40 -1
  3. package/build/cjs/multi-select-field/multi-select-field.js +8 -0
  4. package/build/cjs/multi-select-field/multi-select-field.prod.stories.js +42 -2
  5. package/build/cjs/select/menu-wrapper.js +17 -6
  6. package/build/cjs/select/select.js +18 -12
  7. package/build/cjs/single-select/single-select.js +8 -0
  8. package/build/cjs/single-select/single-select.prod.stories.js +41 -2
  9. package/build/cjs/single-select-field/single-select-field.js +8 -0
  10. package/build/cjs/single-select-field/single-select-field.prod.stories.js +42 -2
  11. package/build/es/multi-select/multi-select.js +8 -0
  12. package/build/es/multi-select/multi-select.prod.stories.js +37 -0
  13. package/build/es/multi-select-field/multi-select-field.js +8 -0
  14. package/build/es/multi-select-field/multi-select-field.prod.stories.js +41 -1
  15. package/build/es/select/menu-wrapper.js +17 -6
  16. package/build/es/select/select.js +18 -12
  17. package/build/es/single-select/single-select.js +8 -0
  18. package/build/es/single-select/single-select.prod.stories.js +38 -1
  19. package/build/es/single-select-field/single-select-field.js +8 -0
  20. package/build/es/single-select-field/single-select-field.prod.stories.js +41 -1
  21. package/package.json +15 -15
  22. package/src/multi-select/multi-select.js +8 -0
  23. package/src/multi-select/multi-select.prod.stories.js +26 -0
  24. package/src/multi-select-field/multi-select-field.js +8 -0
  25. package/src/multi-select-field/multi-select-field.prod.stories.js +31 -0
  26. package/src/select/menu-wrapper.js +19 -3
  27. package/src/select/select.js +18 -12
  28. package/src/single-select/single-select.js +8 -0
  29. package/src/single-select/single-select.prod.stories.js +26 -0
  30. package/src/single-select-field/single-select-field.js +8 -0
  31. package/src/single-select-field/single-select-field.prod.stories.js +31 -0
@@ -45,6 +45,8 @@ class SingleSelectField extends React.Component {
45
45
  helpText,
46
46
  validationText,
47
47
  maxHeight,
48
+ menuMinWidth,
49
+ menuMaxWidth,
48
50
  inputMaxHeight,
49
51
  inputWidth,
50
52
  children,
@@ -81,6 +83,8 @@ class SingleSelectField extends React.Component {
81
83
  selected={selected}
82
84
  tabIndex={tabIndex}
83
85
  maxHeight={maxHeight}
86
+ menuMinWidth={menuMinWidth}
87
+ menuMaxWidth={menuMaxWidth}
84
88
  inputMaxHeight={inputMaxHeight}
85
89
  onChange={onChange}
86
90
  onFocus={onFocus}
@@ -148,6 +152,10 @@ SingleSelectField.propTypes = {
148
152
  loadingText: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
149
153
  /** Constrains height of the SingleSelect */
150
154
  maxHeight: PropTypes.string,
155
+ /** See [dropdown menu width](https://developers.dhis2.org/docs/ui/components/select#dropdown-menu-width) */
156
+ menuMaxWidth: PropTypes.string,
157
+ /** See [dropdown menu width](https://developers.dhis2.org/docs/ui/components/select#dropdown-menu-width) */
158
+ menuMinWidth: PropTypes.string,
151
159
  /** Text to display when there are no filter results */
152
160
  noMatchText: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
153
161
  /** Placeholder text when the SingleSelect is empty */
@@ -144,3 +144,34 @@ DefaultFilterPlaceholderAndNoMatchText.storyName =
144
144
  export const DefaultLoadingText = Template.bind({})
145
145
  DefaultLoadingText.args = { loading: true, ...DefaultEmpty.args }
146
146
  DefaultLoadingText.storyName = 'Default: loadingText'
147
+
148
+ export const WithMenuMaxWidth = Template.bind({})
149
+ WithMenuMaxWidth.args = {
150
+ inputWidth: '120px',
151
+ menuMaxWidth: '200px',
152
+ children: [
153
+ <SingleSelectOption key="1" value="1" label="option one" />,
154
+ <SingleSelectOption key="2" value="2" label="option two" />,
155
+ <SingleSelectOption
156
+ key="3"
157
+ value="3"
158
+ label="A much longer option label"
159
+ />,
160
+ ],
161
+ }
162
+
163
+ export const WithMenuMinWidth = Template.bind({})
164
+ WithMenuMinWidth.args = {
165
+ inputWidth: '120px',
166
+ menuMinWidth: '240px',
167
+ children: [
168
+ <SingleSelectOption key="1" value="1" label="option one" />,
169
+ <SingleSelectOption key="2" value="2" label="option two" />,
170
+ <SingleSelectOption key="3" value="3" label="option three" />,
171
+ <SingleSelectOption
172
+ key="4"
173
+ value="4"
174
+ label="A longer option that exceeds the minimum"
175
+ />,
176
+ ],
177
+ }