@dhis2-ui/select 9.3.0 → 9.4.0-alpha.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.
@@ -48,7 +48,7 @@ const Input = _ref => {
48
48
  };
49
49
 
50
50
  return /*#__PURE__*/_react.default.createElement("div", {
51
- className: _style.default.dynamic([["691091786", [_uiConstants.colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + ((0, _classnames.default)('root', className) || "")
51
+ className: _style.default.dynamic([["1209882888", [_uiConstants.colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + ((0, _classnames.default)('root', className) || "")
52
52
  }, /*#__PURE__*/_react.default.createElement(_index.InputPrefix, {
53
53
  prefix: prefix,
54
54
  dataTest: "".concat(dataTest, "-prefix")
@@ -56,22 +56,22 @@ const Input = _ref => {
56
56
  placeholder: placeholder,
57
57
  dataTest: "".concat(dataTest, "-placeholder")
58
58
  }), hasSelection && /*#__PURE__*/_react.default.createElement("div", {
59
- className: _style.default.dynamic([["691091786", [_uiConstants.colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-input"
59
+ className: _style.default.dynamic([["1209882888", [_uiConstants.colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-input"
60
60
  }, /*#__PURE__*/_react.default.createElement(_selectionList.SelectionList, {
61
61
  selected: selected,
62
62
  onChange: onChange,
63
63
  options: options,
64
64
  disabled: disabled
65
65
  })), hasSelection && clearable && !disabled && /*#__PURE__*/_react.default.createElement("div", {
66
- className: _style.default.dynamic([["691091786", [_uiConstants.colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-right"
66
+ className: _style.default.dynamic([["1209882888", [_uiConstants.colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-right"
67
67
  }, /*#__PURE__*/_react.default.createElement(_index.InputClearButton, {
68
68
  onClear: onClear,
69
69
  clearText: clearText,
70
70
  dataTest: "".concat(dataTest, "-clear")
71
71
  })), /*#__PURE__*/_react.default.createElement(_style.default, {
72
- id: "691091786",
72
+ id: "1209882888",
73
73
  dynamic: [_uiConstants.colors.grey900]
74
- }, [".root.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:".concat(_uiConstants.colors.grey900, ";font-size:14px;line-height:16px;}"), ".root-input.__jsx-style-dynamic-selector{overflow-y:auto;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:wrap;-ms-flex-flow:wrap;flex-flow:wrap;gap:4px;}", ".root-right.__jsx-style-dynamic-selector{margin-left:auto;margin-right:10px;}"]), /*#__PURE__*/_react.default.createElement(_style.default, {
74
+ }, [".root.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:".concat(_uiConstants.colors.grey900, ";font-size:14px;line-height:16px;}"), ".root-input.__jsx-style-dynamic-selector{overflow-y:auto;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:wrap;-ms-flex-flow:wrap;flex-flow:wrap;gap:4px;}", ".root-right.__jsx-style-dynamic-selector{margin-inline-start:auto;margin-inline-end:10px;}"]), /*#__PURE__*/_react.default.createElement(_style.default, {
75
75
  id: "1331770409",
76
76
  dynamic: [inputMaxHeight]
77
77
  }, [".root-input.__jsx-style-dynamic-selector{max-height:".concat(inputMaxHeight, ";}")]));
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.WithPrefixAndSelection = exports.WithPrefix = exports.WithPlaceholderAndSelection = exports.WithPlaceholder = exports.WithOptionsLoadingAndLoadingText = exports.WithOptionsAndOnChange = exports.WithOptionsAndMultipleSelections = exports.WithOptionsAndLoading = exports.WithOptionsAndDisabled = exports.WithOptionsAndASelection = exports.WithOptionsASelectionAndDisabled = exports.WithOnFocus = exports.WithOnBlur = exports.WithMultipleSelectionsWrapped = exports.WithMoreThanThreeOptionsAndA100PxMaxHeight = exports.WithMoreThanTenOptions = exports.WithInvalidOptions = exports.WithInvalidFilterableOptions = exports.WithInitialFocus = exports.WithFilterField = exports.WithDisabledOptionAndOnChange = exports.WithCustomOptionsAndOnChange = exports.WithClearButtonSelectionAndOnChange = exports.ShiftedIntoView = exports.FlippedPosition = exports.EmptyWithEmptyText = exports.EmptyWithEmptyComponent = exports.Empty = exports.DenseWithSelections = exports.Dense = exports.DefaultPosition = void 0;
6
+ exports.default = exports.WithPrefixAndSelection = exports.WithPrefix = exports.WithPlaceholderAndSelection = exports.WithPlaceholder = exports.WithOptionsLoadingAndLoadingText = exports.WithOptionsAndOnChange = exports.WithOptionsAndMultipleSelections = exports.WithOptionsAndLoading = exports.WithOptionsAndDisabled = exports.WithOptionsAndASelection = exports.WithOptionsASelectionAndDisabled = exports.WithOnFocus = exports.WithOnBlur = exports.WithMultipleSelectionsWrapped = exports.WithMoreThanThreeOptionsAndA100PxMaxHeight = exports.WithMoreThanTenOptions = exports.WithInvalidOptions = exports.WithInvalidFilterableOptions = exports.WithInitialFocus = exports.WithFilterField = exports.WithDisabledOptionAndOnChange = exports.WithCustomOptionsAndOnChange = exports.WithClearButtonSelectionAndOnChange = exports.ShiftedIntoView = exports.RTL = exports.FlippedPosition = exports.EmptyWithEmptyText = exports.EmptyWithEmptyComponent = exports.Empty = exports.DenseWithSelections = exports.Dense = exports.DefaultPosition = void 0;
7
7
 
8
8
  var _style = _interopRequireDefault(require("styled-jsx/style"));
9
9
 
@@ -11,12 +11,16 @@ var _uiConstants = require("@dhis2/ui-constants");
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
- var _react = _interopRequireDefault(require("react"));
14
+ var _react = _interopRequireWildcard(require("react"));
15
15
 
16
16
  var _index = require("../index.js");
17
17
 
18
18
  var _index2 = require("./index.js");
19
19
 
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
20
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
25
 
22
26
  const description = "\nMultiple selection allows the user to select more than one option from the list. Checkboxes are used to highlight the possibility of making more than one selection. Selected options are displayed as chips inside the input. Make sure to communicate clearly to the user if there is a limit to the number of selectable elements.\n\nUse multiple selection wherever the user needs to make more than one selection. If the multiple selection is complex, requires a defined order or needs to made from different groups, consider using a transfer component instead.\n\nRead more about using `Select` components at [Design System: Select](https://github.com/dhis2/design-system/blob/master/molecules/select.md).\n\n```js\nimport { MultiSelect, MultiSelectOption } from '@dhis2/ui'\n```\n\n_**Note:** Due to demo limitations on this page, only one representative example is rendered here. For more (props-interactive) examples, see individual stories in the 'Canvas' tab._\n";
@@ -545,4 +549,22 @@ const ShiftedIntoView = args => /*#__PURE__*/_react.default.createElement(_react
545
549
  id: "1828862170"
546
550
  }, ["html,body,#root{position:relative;height:300px !important;max-height:300px;}", "#root{padding-top:130px !important;}"]));
547
551
 
548
- exports.ShiftedIntoView = ShiftedIntoView;
552
+ exports.ShiftedIntoView = ShiftedIntoView;
553
+
554
+ const RTL = args => {
555
+ (0, _react.useEffect)(() => {
556
+ document.body.dir = 'rtl';
557
+ return () => {
558
+ document.body.dir = 'ltr';
559
+ };
560
+ }, []);
561
+ return /*#__PURE__*/_react.default.createElement("div", {
562
+ dir: "rtl"
563
+ }, /*#__PURE__*/_react.default.createElement(WithOptionsTemplate, args));
564
+ };
565
+
566
+ exports.RTL = RTL;
567
+ RTL.args = {
568
+ selected: ['1', '2'],
569
+ prefix: 'RTL text'
570
+ };
@@ -32,7 +32,7 @@ const Input = _ref => {
32
32
  };
33
33
 
34
34
  return /*#__PURE__*/React.createElement("div", {
35
- className: _JSXStyle.dynamic([["691091786", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + (cx('root', className) || "")
35
+ className: _JSXStyle.dynamic([["1209882888", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + (cx('root', className) || "")
36
36
  }, /*#__PURE__*/React.createElement(InputPrefix, {
37
37
  prefix: prefix,
38
38
  dataTest: "".concat(dataTest, "-prefix")
@@ -40,22 +40,22 @@ const Input = _ref => {
40
40
  placeholder: placeholder,
41
41
  dataTest: "".concat(dataTest, "-placeholder")
42
42
  }), hasSelection && /*#__PURE__*/React.createElement("div", {
43
- className: _JSXStyle.dynamic([["691091786", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-input"
43
+ className: _JSXStyle.dynamic([["1209882888", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-input"
44
44
  }, /*#__PURE__*/React.createElement(SelectionList, {
45
45
  selected: selected,
46
46
  onChange: onChange,
47
47
  options: options,
48
48
  disabled: disabled
49
49
  })), hasSelection && clearable && !disabled && /*#__PURE__*/React.createElement("div", {
50
- className: _JSXStyle.dynamic([["691091786", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-right"
50
+ className: _JSXStyle.dynamic([["1209882888", [colors.grey900]], ["1331770409", [inputMaxHeight]]]) + " " + "root-right"
51
51
  }, /*#__PURE__*/React.createElement(InputClearButton, {
52
52
  onClear: onClear,
53
53
  clearText: clearText,
54
54
  dataTest: "".concat(dataTest, "-clear")
55
55
  })), /*#__PURE__*/React.createElement(_JSXStyle, {
56
- id: "691091786",
56
+ id: "1209882888",
57
57
  dynamic: [colors.grey900]
58
- }, [".root.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:".concat(colors.grey900, ";font-size:14px;line-height:16px;}"), ".root-input.__jsx-style-dynamic-selector{overflow-y:auto;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:wrap;-ms-flex-flow:wrap;flex-flow:wrap;gap:4px;}", ".root-right.__jsx-style-dynamic-selector{margin-left:auto;margin-right:10px;}"]), /*#__PURE__*/React.createElement(_JSXStyle, {
58
+ }, [".root.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:".concat(colors.grey900, ";font-size:14px;line-height:16px;}"), ".root-input.__jsx-style-dynamic-selector{overflow-y:auto;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:wrap;-ms-flex-flow:wrap;flex-flow:wrap;gap:4px;}", ".root-right.__jsx-style-dynamic-selector{margin-inline-start:auto;margin-inline-end:10px;}"]), /*#__PURE__*/React.createElement(_JSXStyle, {
59
59
  id: "1331770409",
60
60
  dynamic: [inputMaxHeight]
61
61
  }, [".root-input.__jsx-style-dynamic-selector{max-height:".concat(inputMaxHeight, ";}")]));
@@ -1,7 +1,7 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import { sharedPropTypes } from '@dhis2/ui-constants';
3
3
  import PropTypes from 'prop-types';
4
- import React from 'react';
4
+ import React, { useEffect } from 'react';
5
5
  import { MultiSelectOption } from '../index.js';
6
6
  import { MultiSelect } from './index.js';
7
7
  const description = "\nMultiple selection allows the user to select more than one option from the list. Checkboxes are used to highlight the possibility of making more than one selection. Selected options are displayed as chips inside the input. Make sure to communicate clearly to the user if there is a limit to the number of selectable elements.\n\nUse multiple selection wherever the user needs to make more than one selection. If the multiple selection is complex, requires a defined order or needs to made from different groups, consider using a transfer component instead.\n\nRead more about using `Select` components at [Design System: Select](https://github.com/dhis2/design-system/blob/master/molecules/select.md).\n\n```js\nimport { MultiSelect, MultiSelectOption } from '@dhis2/ui'\n```\n\n_**Note:** Due to demo limitations on this page, only one representative example is rendered here. For more (props-interactive) examples, see individual stories in the 'Canvas' tab._\n";
@@ -477,4 +477,19 @@ export const ShiftedIntoView = args => /*#__PURE__*/React.createElement(React.Fr
477
477
  label: "option twelve"
478
478
  })), /*#__PURE__*/React.createElement(_JSXStyle, {
479
479
  id: "1828862170"
480
- }, ["html,body,#root{position:relative;height:300px !important;max-height:300px;}", "#root{padding-top:130px !important;}"]));
480
+ }, ["html,body,#root{position:relative;height:300px !important;max-height:300px;}", "#root{padding-top:130px !important;}"]));
481
+ export const RTL = args => {
482
+ useEffect(() => {
483
+ document.body.dir = 'rtl';
484
+ return () => {
485
+ document.body.dir = 'ltr';
486
+ };
487
+ }, []);
488
+ return /*#__PURE__*/React.createElement("div", {
489
+ dir: "rtl"
490
+ }, /*#__PURE__*/React.createElement(WithOptionsTemplate, args));
491
+ };
492
+ RTL.args = {
493
+ selected: ['1', '2'],
494
+ prefix: 'RTL text'
495
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/select",
3
- "version": "9.3.0",
3
+ "version": "9.4.0-alpha.1",
4
4
  "description": "UI Select",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,19 +34,19 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@dhis2/prop-types": "^3.1.2",
37
- "@dhis2-ui/box": "9.3.0",
38
- "@dhis2-ui/button": "9.3.0",
39
- "@dhis2-ui/card": "9.3.0",
40
- "@dhis2-ui/checkbox": "9.3.0",
41
- "@dhis2-ui/chip": "9.3.0",
42
- "@dhis2-ui/field": "9.3.0",
43
- "@dhis2-ui/input": "9.3.0",
44
- "@dhis2-ui/layer": "9.3.0",
45
- "@dhis2-ui/loader": "9.3.0",
46
- "@dhis2-ui/popper": "9.3.0",
47
- "@dhis2-ui/status-icon": "9.3.0",
48
- "@dhis2/ui-constants": "9.3.0",
49
- "@dhis2/ui-icons": "9.3.0",
37
+ "@dhis2-ui/box": "9.4.0-alpha.1",
38
+ "@dhis2-ui/button": "9.4.0-alpha.1",
39
+ "@dhis2-ui/card": "9.4.0-alpha.1",
40
+ "@dhis2-ui/checkbox": "9.4.0-alpha.1",
41
+ "@dhis2-ui/chip": "9.4.0-alpha.1",
42
+ "@dhis2-ui/field": "9.4.0-alpha.1",
43
+ "@dhis2-ui/input": "9.4.0-alpha.1",
44
+ "@dhis2-ui/layer": "9.4.0-alpha.1",
45
+ "@dhis2-ui/loader": "9.4.0-alpha.1",
46
+ "@dhis2-ui/popper": "9.4.0-alpha.1",
47
+ "@dhis2-ui/status-icon": "9.4.0-alpha.1",
48
+ "@dhis2/ui-constants": "9.4.0-alpha.1",
49
+ "@dhis2/ui-icons": "9.4.0-alpha.1",
50
50
  "classnames": "^2.3.1",
51
51
  "prop-types": "^15.7.2"
52
52
  },