musae 1.3.1-beta.6 → 1.3.1-beta.8

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 (72) hide show
  1. package/dist/components/bottom-sheet/bottom-sheet.cjs +2 -1
  2. package/dist/components/bottom-sheet/bottom-sheet.mjs +2 -1
  3. package/dist/components/cascader/cascader.cjs +0 -1
  4. package/dist/components/cascader/cascader.mjs +0 -1
  5. package/dist/components/date-picker/date-picker.cjs +0 -1
  6. package/dist/components/date-picker/date-picker.mjs +0 -1
  7. package/dist/components/date-range-picker/date-range-picker.cjs +0 -1
  8. package/dist/components/date-range-picker/date-range-picker.mjs +0 -1
  9. package/dist/components/input/__test__/input-appearance.test.d.ts +1 -0
  10. package/dist/components/input/__test__/style-contract.test.d.ts +1 -0
  11. package/dist/components/input/hooks.cjs +0 -22
  12. package/dist/components/input/hooks.d.ts +1 -12
  13. package/dist/components/input/hooks.mjs +1 -22
  14. package/dist/components/input/input.cjs +13 -16
  15. package/dist/components/input/input.mjs +14 -17
  16. package/dist/components/input/styles.stylex.cjs +10 -0
  17. package/dist/components/input/styles.stylex.d.ts +8 -0
  18. package/dist/components/input/styles.stylex.mjs +10 -0
  19. package/dist/components/password-input/__test__/password-input.test.d.ts +1 -0
  20. package/dist/components/password-input/password-input.cjs +1 -0
  21. package/dist/components/password-input/password-input.mjs +1 -0
  22. package/dist/components/portal/__test__/portal.test.d.ts +1 -0
  23. package/dist/components/search/__test__/hooks.test.d.ts +1 -0
  24. package/dist/components/search/__test__/style-contract.test.d.ts +1 -0
  25. package/dist/components/search/bar.cjs +82 -0
  26. package/dist/components/search/bar.d.ts +18 -0
  27. package/dist/components/search/bar.mjs +78 -0
  28. package/dist/components/search/context.cjs +16 -0
  29. package/dist/components/search/context.d.ts +16 -0
  30. package/dist/components/search/context.mjs +16 -0
  31. package/dist/components/search/field.cjs +64 -0
  32. package/dist/components/search/field.d.ts +19 -0
  33. package/dist/components/search/field.mjs +60 -0
  34. package/dist/components/search/hooks.cjs +50 -0
  35. package/dist/components/search/hooks.d.ts +12 -0
  36. package/dist/components/search/hooks.mjs +47 -0
  37. package/dist/components/search/index.d.ts +1 -1
  38. package/dist/components/search/result-list.cjs +84 -0
  39. package/dist/components/search/result-list.d.ts +16 -0
  40. package/dist/components/search/result-list.mjs +80 -0
  41. package/dist/components/search/search.cjs +164 -44
  42. package/dist/components/search/search.d.ts +11 -1
  43. package/dist/components/search/search.mjs +166 -46
  44. package/dist/components/search/styles.cjs +211 -33
  45. package/dist/components/search/styles.d.ts +180 -36
  46. package/dist/components/search/styles.mjs +211 -33
  47. package/dist/components/search/view.cjs +108 -0
  48. package/dist/components/search/view.d.ts +22 -0
  49. package/dist/components/search/view.mjs +104 -0
  50. package/dist/components/select/selector.cjs +0 -1
  51. package/dist/components/select/selector.d.ts +1 -1
  52. package/dist/components/select/selector.mjs +0 -1
  53. package/dist/components/sheet/sheet.cjs +1 -1
  54. package/dist/components/sheet/sheet.mjs +1 -1
  55. package/dist/components/sheet/styles.cjs +0 -9
  56. package/dist/components/sheet/styles.d.ts +0 -10
  57. package/dist/components/sheet/styles.mjs +0 -9
  58. package/dist/components/theme/tokens.stylex.cjs +8 -0
  59. package/dist/components/theme/tokens.stylex.d.ts +14 -0
  60. package/dist/components/theme/tokens.stylex.mjs +8 -1
  61. package/dist/components/time-picker/time-picker.cjs +0 -1
  62. package/dist/components/time-picker/time-picker.mjs +0 -1
  63. package/dist/index.d.ts +1 -0
  64. package/dist/styles.css +72 -82
  65. package/dist/types/bottom-sheet.d.ts +17 -15
  66. package/dist/types/input.d.ts +31 -28
  67. package/dist/types/search.d.ts +84 -1
  68. package/dist/types/select.d.ts +2 -2
  69. package/dist/utils/react.cjs +2 -2
  70. package/dist/utils/react.d.ts +2 -2
  71. package/dist/utils/react.mjs +2 -2
  72. package/package.json +1 -1
@@ -21,7 +21,8 @@ var _excluded = ["open", "height", "closable", "modal"];
21
21
  * with a drag handle indicator. Built on the shared Sheet base component.
22
22
  */
23
23
  var BottomSheet = function BottomSheet(_ref) {
24
- var open = _ref.open,
24
+ var _ref$open = _ref.open,
25
+ open = _ref$open === void 0 ? false : _ref$open,
25
26
  _ref$height = _ref.height,
26
27
  height = _ref$height === void 0 ? "50vh" : _ref$height,
27
28
  _ref$closable = _ref.closable,
@@ -17,7 +17,8 @@ var _excluded = ["open", "height", "closable", "modal"];
17
17
  * with a drag handle indicator. Built on the shared Sheet base component.
18
18
  */
19
19
  var BottomSheet = function BottomSheet(_ref) {
20
- var open = _ref.open,
20
+ var _ref$open = _ref.open,
21
+ open = _ref$open === void 0 ? false : _ref$open,
21
22
  _ref$height = _ref.height,
22
23
  height = _ref$height === void 0 ? "50vh" : _ref$height,
23
24
  _ref$closable = _ref.closable,
@@ -88,7 +88,6 @@ var Cascader = function Cascader(_ref) {
88
88
  leading: mode === "multiple" ? inputed : undefined,
89
89
  onBlur: close,
90
90
  onClick: toggle,
91
- onInputorClick: toggle,
92
91
  readOnly: true
93
92
  });
94
93
  });
@@ -84,7 +84,6 @@ var Cascader = function Cascader(_ref) {
84
84
  leading: mode === "multiple" ? inputed : undefined,
85
85
  onBlur: close,
86
86
  onClick: toggle,
87
- onInputorClick: toggle,
88
87
  readOnly: true
89
88
  });
90
89
  });
@@ -53,7 +53,6 @@ var DatePicker = function DatePicker(props) {
53
53
  value: (_value$format = value === null || value === void 0 ? void 0 : value.format("YYYY-MM-DD")) !== null && _value$format !== void 0 ? _value$format : "",
54
54
  onBlur: close,
55
55
  onClick: toggle,
56
- onInputorClick: toggle,
57
56
  readOnly: true
58
57
  });
59
58
  });
@@ -49,7 +49,6 @@ var DatePicker = function DatePicker(props$1) {
49
49
  value: (_value$format = value === null || value === void 0 ? void 0 : value.format("YYYY-MM-DD")) !== null && _value$format !== void 0 ? _value$format : "",
50
50
  onBlur: close,
51
51
  onClick: toggle,
52
- onInputorClick: toggle,
53
52
  readOnly: true
54
53
  });
55
54
  });
@@ -59,7 +59,6 @@ var DateRangePicker = function DateRangePicker(_ref) {
59
59
  value: (_from$format = from === null || from === void 0 ? void 0 : from.format("YYYY-MM-DD")) !== null && _from$format !== void 0 ? _from$format : "",
60
60
  onBlur: close,
61
61
  onClick: toggle,
62
- onInputorClick: toggle,
63
62
  readOnly: true,
64
63
  trailing: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(swapHoriz.default, {
65
64
  className: classNames.separator
@@ -55,7 +55,6 @@ var DateRangePicker = function DateRangePicker(_ref) {
55
55
  value: (_from$format = from === null || from === void 0 ? void 0 : from.format("YYYY-MM-DD")) !== null && _from$format !== void 0 ? _from$format : "",
56
56
  onBlur: close,
57
57
  onClick: toggle,
58
- onInputorClick: toggle,
59
58
  readOnly: true,
60
59
  trailing: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconSwapHoriz, {
61
60
  className: classNames.separator
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var relax = require('@aiszlab/relax');
5
4
 
6
5
  /**
7
6
  * @description
@@ -38,26 +37,5 @@ var useInputEvents = function useInputEvents(_ref) {
38
37
  click: click
39
38
  };
40
39
  };
41
- /**
42
- * @description
43
- * inputor events
44
- */
45
- var useInputorEvents = function useInputorEvents(_ref2) {
46
- var inputRef = _ref2.inputRef,
47
- onClick = _ref2.onClick;
48
- // click
49
- var click = React.useCallback(function (event) {
50
- var _inputRef$current;
51
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
52
- if (relax.isFunction(onClick)) {
53
- event.stopPropagation();
54
- onClick(event);
55
- }
56
- }, [inputRef, onClick]);
57
- return {
58
- click: click
59
- };
60
- };
61
40
 
62
41
  exports.useInputEvents = useInputEvents;
63
- exports.useInputorEvents = useInputorEvents;
@@ -1,6 +1,5 @@
1
- import { type ChangeEventHandler, type Dispatch, type FocusEventHandler, type MouseEventHandler, type SetStateAction, type RefObject } from "react";
1
+ import { type ChangeEventHandler, type Dispatch, type FocusEventHandler, type MouseEventHandler, type SetStateAction } from "react";
2
2
  import type { InputProps } from "../../types/input";
3
- import type { Nullable } from "@aiszlab/relax/types";
4
3
  /**
5
4
  * @description
6
5
  * use events for input
@@ -13,13 +12,3 @@ export declare const useInputEvents: ({ setValue, onBlur, onChange, onClick, onF
13
12
  change: ChangeEventHandler<HTMLInputElement>;
14
13
  click: MouseEventHandler<HTMLInputElement>;
15
14
  };
16
- /**
17
- * @description
18
- * inputor events
19
- */
20
- export declare const useInputorEvents: ({ inputRef, onClick, }: {
21
- inputRef: RefObject<Nullable<HTMLInputElement>>;
22
- onClick?: InputProps["onInputorClick"];
23
- }) => {
24
- click: MouseEventHandler<HTMLDivElement>;
25
- };
@@ -1,5 +1,4 @@
1
1
  import { useCallback } from 'react';
2
- import { isFunction } from '@aiszlab/relax';
3
2
 
4
3
  /**
5
4
  * @description
@@ -36,25 +35,5 @@ var useInputEvents = function useInputEvents(_ref) {
36
35
  click: click
37
36
  };
38
37
  };
39
- /**
40
- * @description
41
- * inputor events
42
- */
43
- var useInputorEvents = function useInputorEvents(_ref2) {
44
- var inputRef = _ref2.inputRef,
45
- onClick = _ref2.onClick;
46
- // click
47
- var click = useCallback(function (event) {
48
- var _inputRef$current;
49
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
50
- if (isFunction(onClick)) {
51
- event.stopPropagation();
52
- onClick(event);
53
- }
54
- }, [inputRef, onClick]);
55
- return {
56
- click: click
57
- };
58
- };
59
38
 
60
- export { useInputEvents, useInputorEvents };
39
+ export { useInputEvents };
@@ -18,7 +18,7 @@ var context = require('./context.cjs');
18
18
  var theme = require('../theme/theme.cjs');
19
19
  var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
20
20
 
21
- var _excluded = ["className", "style", "type", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "onInputorClick", "label"];
21
+ var _excluded = ["className", "style", "type", "variant", "shaped", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "label"];
22
22
  /**
23
23
  * @author murukal
24
24
  * @zh 输入组件
@@ -27,7 +27,10 @@ var _excluded = ["className", "style", "type", "invalid", "disabled", "maxLength
27
27
  var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
28
28
  var className$1 = _ref.className,
29
29
  style = _ref.style,
30
- type = _ref.type,
30
+ type = _ref.type;
31
+ _ref.variant;
32
+ var _ref$shaped = _ref.shaped,
33
+ shaped = _ref$shaped === void 0 ? false : _ref$shaped,
31
34
  _ref$invalid = _ref.invalid,
32
35
  invalid = _ref$invalid === void 0 ? false : _ref$invalid,
33
36
  disabled = _ref.disabled,
@@ -39,17 +42,17 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
39
42
  onFocus = _ref.onFocus,
40
43
  leading = _ref.leading,
41
44
  trailing = _ref.trailing,
42
- onInputorClick = _ref.onInputorClick,
43
45
  label = _ref.label,
44
46
  inputProps = _objectWithoutProperties(_ref, _excluded);
45
47
  var inputorRef = React.useRef(null);
46
48
  var inputRef = React.useRef(null);
47
49
  var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
48
50
  var hasPlaceholder = !!inputProps.placeholder;
51
+ var hasLabel = !!label;
49
52
  var _useIdentity = relax.useIdentity(),
50
53
  _useIdentity2 = _slicedToArray(_useIdentity, 1),
51
54
  id = _useIdentity2[0];
52
- var _themeColorVars = useThemeColorVars.useThemeColorVars(["primary", "outline", "error", "on-surface-variant", ["on-surface", tokens_stylex.OPACITY.thickest], ["on-surface", tokens_stylex.OPACITY.medium], ["on-surface", tokens_stylex.OPACITY.thin]]);
55
+ var _themeColorVars = useThemeColorVars.useThemeColorVars(["primary", "outline", "error", "surface-container-high", "on-surface-variant", ["on-surface", tokens_stylex.OPACITY.thickest], ["on-surface", tokens_stylex.OPACITY.medium], ["on-surface", tokens_stylex.OPACITY.thin]]);
53
56
  // controlled value
54
57
  var _useControlledState = relax.useControlledState(valueInProps, {
55
58
  defaultState: ""
@@ -90,11 +93,6 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
90
93
  onClick: onClick,
91
94
  onFocus: onFocus
92
95
  });
93
- // inputor events
94
- var inputorEvents = hooks.useInputorEvents({
95
- inputRef: inputRef,
96
- onClick: disabled ? undefined : onInputorClick
97
- });
98
96
  // is focused
99
97
  var _useFocus = relax.useFocus({
100
98
  onBlur: inputEvents.blur,
@@ -109,16 +107,15 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
109
107
  leading: stylex.props(styles_stylex.default.leading.base),
110
108
  trailing: stylex.props(styles_stylex.default.trailing.base),
111
109
  outline: stylex.props(styles_stylex.default.outline.base),
112
- outlineLeading: stylex.props(styles_stylex.default.outlineLeading.base, disabled && styles_stylex.default.outlineLeading.disabled, invalid && styles_stylex.default.outlineLeading.invalid),
113
- outlineNotch: stylex.props(styles_stylex.default.outlineNotch.base, theme.$body.small, !!label && styles_stylex.default.outlineNotch.withLabel, hasPlaceholder && !!label && styles_stylex.default.outlineNotch.withLabelAndPlaceholder, disabled && styles_stylex.default.outlineNotch.disabled, invalid && styles_stylex.default.outlineNotch.invalid),
114
- outlineTrailing: stylex.props(styles_stylex.default.outlineTrailing.base, disabled && styles_stylex.default.outlineTrailing.disabled, invalid && styles_stylex.default.outlineTrailing.invalid),
110
+ outlineLeading: stylex.props(styles_stylex.default.outlineLeading.base, disabled && styles_stylex.default.outlineLeading.disabled, invalid && styles_stylex.default.outlineLeading.invalid, shaped && styles_stylex.default.outlineLeading.shaped),
111
+ outlineNotch: stylex.props(styles_stylex.default.outlineNotch.base, theme.$body.small, hasLabel && styles_stylex.default.outlineNotch.withLabel, hasLabel && hasPlaceholder && styles_stylex.default.outlineNotch.withLabelAndPlaceholder, disabled && styles_stylex.default.outlineNotch.disabled, invalid && styles_stylex.default.outlineNotch.invalid),
112
+ outlineTrailing: stylex.props(styles_stylex.default.outlineTrailing.base, disabled && styles_stylex.default.outlineTrailing.disabled, invalid && styles_stylex.default.outlineTrailing.invalid, shaped && styles_stylex.default.outlineTrailing.shaped),
115
113
  floatingLabel: stylex.props(styles_stylex.default.floatingLabel.base, hasPlaceholder && styles_stylex.default.floatingLabel.placeholder, disabled && styles_stylex.default.floatingLabel.disabled, invalid && styles_stylex.default.floatingLabel.invalid)
116
114
  };
117
115
  return /*#__PURE__*/React.createElement("div", _objectSpread({
118
116
  ref: inputorRef,
119
117
  className: className.stringify(classNames.inputor, _defineProperty(_defineProperty({}, classNames.focused, isFocused), classNames.invalid, !!invalid), className$1, styled.root.className),
120
- style: _objectSpread(_objectSpread(_objectSpread({}, styled.root.style), style), _themeColorVars),
121
- onClick: inputorEvents.click
118
+ style: _objectSpread(_objectSpread(_objectSpread({}, styled.root.style), style), _themeColorVars)
122
119
  }, !disabled && {
123
120
  tabIndex: -1
124
121
  }), !!leading && (/*#__PURE__*/React.createElement("div", {
@@ -145,10 +142,10 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
145
142
  }), /*#__PURE__*/React.createElement("div", {
146
143
  className: className.stringify(classNames.outlineNotch, styled.outlineNotch.className),
147
144
  style: styled.outlineNotch.style
148
- }, /*#__PURE__*/React.createElement("label", {
145
+ }, hasLabel && (/*#__PURE__*/React.createElement("label", {
149
146
  htmlFor: id,
150
147
  className: className.stringify(styled.floatingLabel.className)
151
- }, label)), /*#__PURE__*/React.createElement("div", {
148
+ }, label))), /*#__PURE__*/React.createElement("div", {
152
149
  className: className.stringify(classNames.outlineTrailing, styled.outlineTrailing.className),
153
150
  style: styled.outlineTrailing.style
154
151
  })), !!trailing && (/*#__PURE__*/React.createElement("div", {
@@ -4,7 +4,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
5
  import styles, { textFieldMarker } from './styles.stylex.mjs';
6
6
  import React, { forwardRef, useRef, useImperativeHandle } from 'react';
7
- import { useInputEvents, useInputorEvents } from './hooks.mjs';
7
+ import { useInputEvents } from './hooks.mjs';
8
8
  import { useIdentity, useControlledState, useFocus } from '@aiszlab/relax';
9
9
  import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
10
10
  import { OPACITY } from '../theme/tokens.stylex.mjs';
@@ -14,7 +14,7 @@ import { CLASS_NAMES } from './context.mjs';
14
14
  import { $body } from '../theme/theme.mjs';
15
15
  import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
16
16
 
17
- var _excluded = ["className", "style", "type", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "onInputorClick", "label"];
17
+ var _excluded = ["className", "style", "type", "variant", "shaped", "invalid", "disabled", "maxLength", "value", "onBlur", "onChange", "onClick", "onFocus", "leading", "trailing", "label"];
18
18
  /**
19
19
  * @author murukal
20
20
  * @zh 输入组件
@@ -23,7 +23,10 @@ var _excluded = ["className", "style", "type", "invalid", "disabled", "maxLength
23
23
  var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
24
24
  var className = _ref.className,
25
25
  style = _ref.style,
26
- type = _ref.type,
26
+ type = _ref.type;
27
+ _ref.variant;
28
+ var _ref$shaped = _ref.shaped,
29
+ shaped = _ref$shaped === void 0 ? false : _ref$shaped,
27
30
  _ref$invalid = _ref.invalid,
28
31
  invalid = _ref$invalid === void 0 ? false : _ref$invalid,
29
32
  disabled = _ref.disabled,
@@ -35,17 +38,17 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
35
38
  onFocus = _ref.onFocus,
36
39
  leading = _ref.leading,
37
40
  trailing = _ref.trailing,
38
- onInputorClick = _ref.onInputorClick,
39
41
  label = _ref.label,
40
42
  inputProps = _objectWithoutProperties(_ref, _excluded);
41
43
  var inputorRef = useRef(null);
42
44
  var inputRef = useRef(null);
43
45
  var classNames = useClassNames(CLASS_NAMES);
44
46
  var hasPlaceholder = !!inputProps.placeholder;
47
+ var hasLabel = !!label;
45
48
  var _useIdentity = useIdentity(),
46
49
  _useIdentity2 = _slicedToArray(_useIdentity, 1),
47
50
  id = _useIdentity2[0];
48
- var _themeColorVars = useThemeColorVars(["primary", "outline", "error", "on-surface-variant", ["on-surface", OPACITY.thickest], ["on-surface", OPACITY.medium], ["on-surface", OPACITY.thin]]);
51
+ var _themeColorVars = useThemeColorVars(["primary", "outline", "error", "surface-container-high", "on-surface-variant", ["on-surface", OPACITY.thickest], ["on-surface", OPACITY.medium], ["on-surface", OPACITY.thin]]);
49
52
  // controlled value
50
53
  var _useControlledState = useControlledState(valueInProps, {
51
54
  defaultState: ""
@@ -86,11 +89,6 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
86
89
  onClick: onClick,
87
90
  onFocus: onFocus
88
91
  });
89
- // inputor events
90
- var inputorEvents = useInputorEvents({
91
- inputRef: inputRef,
92
- onClick: disabled ? undefined : onInputorClick
93
- });
94
92
  // is focused
95
93
  var _useFocus = useFocus({
96
94
  onBlur: inputEvents.blur,
@@ -105,16 +103,15 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
105
103
  leading: props(styles.leading.base),
106
104
  trailing: props(styles.trailing.base),
107
105
  outline: props(styles.outline.base),
108
- outlineLeading: props(styles.outlineLeading.base, disabled && styles.outlineLeading.disabled, invalid && styles.outlineLeading.invalid),
109
- outlineNotch: props(styles.outlineNotch.base, $body.small, !!label && styles.outlineNotch.withLabel, hasPlaceholder && !!label && styles.outlineNotch.withLabelAndPlaceholder, disabled && styles.outlineNotch.disabled, invalid && styles.outlineNotch.invalid),
110
- outlineTrailing: props(styles.outlineTrailing.base, disabled && styles.outlineTrailing.disabled, invalid && styles.outlineTrailing.invalid),
106
+ outlineLeading: props(styles.outlineLeading.base, disabled && styles.outlineLeading.disabled, invalid && styles.outlineLeading.invalid, shaped && styles.outlineLeading.shaped),
107
+ outlineNotch: props(styles.outlineNotch.base, $body.small, hasLabel && styles.outlineNotch.withLabel, hasLabel && hasPlaceholder && styles.outlineNotch.withLabelAndPlaceholder, disabled && styles.outlineNotch.disabled, invalid && styles.outlineNotch.invalid),
108
+ outlineTrailing: props(styles.outlineTrailing.base, disabled && styles.outlineTrailing.disabled, invalid && styles.outlineTrailing.invalid, shaped && styles.outlineTrailing.shaped),
111
109
  floatingLabel: props(styles.floatingLabel.base, hasPlaceholder && styles.floatingLabel.placeholder, disabled && styles.floatingLabel.disabled, invalid && styles.floatingLabel.invalid)
112
110
  };
113
111
  return /*#__PURE__*/React.createElement("div", _objectSpread({
114
112
  ref: inputorRef,
115
113
  className: stringify(classNames.inputor, _defineProperty(_defineProperty({}, classNames.focused, isFocused), classNames.invalid, !!invalid), className, styled.root.className),
116
- style: _objectSpread(_objectSpread(_objectSpread({}, styled.root.style), style), _themeColorVars),
117
- onClick: inputorEvents.click
114
+ style: _objectSpread(_objectSpread(_objectSpread({}, styled.root.style), style), _themeColorVars)
118
115
  }, !disabled && {
119
116
  tabIndex: -1
120
117
  }), !!leading && (/*#__PURE__*/React.createElement("div", {
@@ -141,10 +138,10 @@ var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
141
138
  }), /*#__PURE__*/React.createElement("div", {
142
139
  className: stringify(classNames.outlineNotch, styled.outlineNotch.className),
143
140
  style: styled.outlineNotch.style
144
- }, /*#__PURE__*/React.createElement("label", {
141
+ }, hasLabel && (/*#__PURE__*/React.createElement("label", {
145
142
  htmlFor: id,
146
143
  className: stringify(styled.floatingLabel.className)
147
- }, label)), /*#__PURE__*/React.createElement("div", {
144
+ }, label))), /*#__PURE__*/React.createElement("div", {
148
145
  className: stringify(classNames.outlineTrailing, styled.outlineTrailing.className),
149
146
  style: styled.outlineTrailing.style
150
147
  })), !!trailing && (/*#__PURE__*/React.createElement("div", {
@@ -113,6 +113,11 @@ var outlineLeading = {
113
113
  kVAM5u: "musaex-1ofxpqo",
114
114
  k6qhrQ: "musaex-7rzjjb",
115
115
  $$css: true
116
+ },
117
+ shaped: {
118
+ krdFHd: "musaex-16hqlox",
119
+ kVL7Gh: "musaex-e8lclw",
120
+ $$css: true
116
121
  }
117
122
  };
118
123
  var outlineTrailing = {
@@ -142,6 +147,11 @@ var outlineTrailing = {
142
147
  kVAM5u: "musaex-1ofxpqo",
143
148
  k6qhrQ: "musaex-7rzjjb",
144
149
  $$css: true
150
+ },
151
+ shaped: {
152
+ kfmiAY: "musaex-ortkii",
153
+ kT0f0o: "musaex-1ogpvgu",
154
+ $$css: true
145
155
  }
146
156
  };
147
157
  var outlineNotch = {
@@ -106,6 +106,10 @@ declare const styles: {
106
106
  }>;
107
107
  readonly borderColor: import("@stylexjs/stylex").StyleXClassNameFor<"borderColor", "var(--color-error)">;
108
108
  }>;
109
+ readonly shaped: Readonly<{
110
+ readonly borderStartStartRadius: import("@stylexjs/stylex").StyleXClassNameFor<"borderStartStartRadius", string>;
111
+ readonly borderEndStartRadius: import("@stylexjs/stylex").StyleXClassNameFor<"borderEndStartRadius", string>;
112
+ }>;
109
113
  }>;
110
114
  outlineNotch: Readonly<{
111
115
  readonly base: Readonly<{
@@ -174,6 +178,10 @@ declare const styles: {
174
178
  }>;
175
179
  readonly borderColor: import("@stylexjs/stylex").StyleXClassNameFor<"borderColor", "var(--color-error)">;
176
180
  }>;
181
+ readonly shaped: Readonly<{
182
+ readonly borderStartEndRadius: import("@stylexjs/stylex").StyleXClassNameFor<"borderStartEndRadius", string>;
183
+ readonly borderEndEndRadius: import("@stylexjs/stylex").StyleXClassNameFor<"borderEndEndRadius", string>;
184
+ }>;
177
185
  }>;
178
186
  floatingLabel: Readonly<{
179
187
  readonly base: Readonly<{
@@ -109,6 +109,11 @@ var outlineLeading = {
109
109
  kVAM5u: "musaex-1ofxpqo",
110
110
  k6qhrQ: "musaex-7rzjjb",
111
111
  $$css: true
112
+ },
113
+ shaped: {
114
+ krdFHd: "musaex-16hqlox",
115
+ kVL7Gh: "musaex-e8lclw",
116
+ $$css: true
112
117
  }
113
118
  };
114
119
  var outlineTrailing = {
@@ -138,6 +143,11 @@ var outlineTrailing = {
138
143
  kVAM5u: "musaex-1ofxpqo",
139
144
  k6qhrQ: "musaex-7rzjjb",
140
145
  $$css: true
146
+ },
147
+ shaped: {
148
+ kfmiAY: "musaex-ortkii",
149
+ kT0f0o: "musaex-1ogpvgu",
150
+ $$css: true
141
151
  }
142
152
  };
143
153
  var outlineNotch = {
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -39,6 +39,7 @@ var PasswordInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
39
39
  ref: ref,
40
40
  type: isVisible ? "text" : "password",
41
41
  trailing: /*#__PURE__*/React.createElement(isVisible ? visibilityOff.default : visibility.default, _objectSpread({
42
+ role: "button",
42
43
  onClick: toggle,
43
44
  onMouseDown: function onMouseDown(event) {
44
45
  return event.preventDefault();
@@ -35,6 +35,7 @@ var PasswordInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
35
35
  ref: ref,
36
36
  type: isVisible ? "text" : "password",
37
37
  trailing: /*#__PURE__*/createElement(isVisible ? IconVisibilityOff : IconVisibility, _objectSpread({
38
+ role: "button",
38
39
  onClick: toggle,
39
40
  onMouseDown: function onMouseDown(event) {
40
41
  return event.preventDefault();
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var button = require('../button/button.cjs');
6
+ var search = require('../icon/icons/action/search.cjs');
7
+ var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
8
+ var className = require('@aiszlab/relax/class-name');
9
+ var React = require('react');
10
+ var useClassNames = require('../../hooks/use-class-names.cjs');
11
+ var context = require('./context.cjs');
12
+ var field = require('./field.cjs');
13
+ var styles = require('./styles.cjs');
14
+ var close = require('../icon/icons/navigation/close.cjs');
15
+
16
+ var SearchBar = function SearchBar(_ref) {
17
+ var clearable = _ref.clearable,
18
+ disabled = _ref.disabled,
19
+ leading = _ref.leading,
20
+ placeholder = _ref.placeholder,
21
+ searchButton = _ref.searchButton,
22
+ trailing = _ref.trailing,
23
+ inputRef = _ref.inputRef,
24
+ value = _ref.value,
25
+ onChange = _ref.onChange,
26
+ onClear = _ref.onClear,
27
+ onFocus = _ref.onFocus,
28
+ onKeyDown = _ref.onKeyDown,
29
+ onSearch = _ref.onSearch;
30
+ var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
31
+ var hasValue = value.length > 0;
32
+ var styled = {
33
+ leading: stylex.props(styles.default.leading.base),
34
+ trailing: stylex.props(styles.default.trailing.base),
35
+ clear: stylex.props(styles.default.clear.base),
36
+ searchButton: stylex.props(styles.default.searchButton.base)
37
+ };
38
+ var clearAction = hasValue && clearable && !disabled && (/*#__PURE__*/React.createElement("button", {
39
+ type: "button",
40
+ className: className.stringify(classNames.searchClear, styled.clear.className),
41
+ style: styled.clear.style,
42
+ onClick: function onClick(event) {
43
+ event.stopPropagation();
44
+ onClear();
45
+ },
46
+ "aria-label": "Clear search"
47
+ }, /*#__PURE__*/React.createElement(close.default, {
48
+ size: 24
49
+ })));
50
+ var searchButtonAction = searchButton && (/*#__PURE__*/React.createElement(button.Button, {
51
+ className: className.stringify(classNames.searchButton, styled.searchButton.className),
52
+ style: styled.searchButton.style,
53
+ onClick: function onClick(event) {
54
+ event.stopPropagation();
55
+ onSearch();
56
+ },
57
+ disabled: disabled
58
+ }, searchButton));
59
+ var hasConsumerTrailing = !!trailing;
60
+ var hasTrailing = !!clearAction || hasConsumerTrailing || !!searchButtonAction;
61
+ return /*#__PURE__*/React.createElement(field.default, {
62
+ inputRef: inputRef,
63
+ value: value,
64
+ placeholder: placeholder,
65
+ disabled: disabled,
66
+ onChange: onChange,
67
+ onFocus: onFocus,
68
+ onKeyDown: onKeyDown,
69
+ leading: /*#__PURE__*/React.createElement("span", {
70
+ className: className.stringify(classNames.searchLeading, styled.leading.className),
71
+ style: styled.leading.style
72
+ }, leading !== null && leading !== void 0 ? leading : /*#__PURE__*/React.createElement(search.default, {
73
+ size: 24
74
+ })),
75
+ trailing: hasTrailing ? (/*#__PURE__*/React.createElement("span", {
76
+ className: className.stringify(classNames.searchTrailing, styled.trailing.className),
77
+ style: styled.trailing.style
78
+ }, clearAction, trailing, searchButtonAction)) : undefined
79
+ });
80
+ };
81
+
82
+ exports.default = SearchBar;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import type { FocusEventHandler, KeyboardEventHandler, Ref } from "react";
3
+ import type { SearchProps } from "../../types/search";
4
+ /**
5
+ * @zh 私有 Search Bar 属性
6
+ * @en Private Search Bar props
7
+ */
8
+ export type SearchBarProps = Pick<SearchProps, "clearable" | "disabled" | "leading" | "placeholder" | "searchButton" | "trailing"> & {
9
+ inputRef: Ref<HTMLInputElement>;
10
+ value: string;
11
+ onChange: (value: string) => void;
12
+ onClear: () => void;
13
+ onFocus: FocusEventHandler<HTMLInputElement>;
14
+ onKeyDown: KeyboardEventHandler<HTMLInputElement>;
15
+ onSearch: () => void;
16
+ };
17
+ declare const SearchBar: ({ clearable, disabled, leading, placeholder, searchButton, trailing, inputRef, value, onChange, onClear, onFocus, onKeyDown, onSearch, }: SearchBarProps) => React.JSX.Element;
18
+ export default SearchBar;
@@ -0,0 +1,78 @@
1
+ import { Button } from '../button/button.mjs';
2
+ import IconSearch from '../icon/icons/action/search.mjs';
3
+ import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
4
+ import { stringify } from '@aiszlab/relax/class-name';
5
+ import React from 'react';
6
+ import { useClassNames } from '../../hooks/use-class-names.mjs';
7
+ import { CLASS_NAMES } from './context.mjs';
8
+ import SearchField from './field.mjs';
9
+ import styles from './styles.mjs';
10
+ import IconClose from '../icon/icons/navigation/close.mjs';
11
+
12
+ var SearchBar = function SearchBar(_ref) {
13
+ var clearable = _ref.clearable,
14
+ disabled = _ref.disabled,
15
+ leading = _ref.leading,
16
+ placeholder = _ref.placeholder,
17
+ searchButton = _ref.searchButton,
18
+ trailing = _ref.trailing,
19
+ inputRef = _ref.inputRef,
20
+ value = _ref.value,
21
+ onChange = _ref.onChange,
22
+ onClear = _ref.onClear,
23
+ onFocus = _ref.onFocus,
24
+ onKeyDown = _ref.onKeyDown,
25
+ onSearch = _ref.onSearch;
26
+ var classNames = useClassNames(CLASS_NAMES);
27
+ var hasValue = value.length > 0;
28
+ var styled = {
29
+ leading: props(styles.leading.base),
30
+ trailing: props(styles.trailing.base),
31
+ clear: props(styles.clear.base),
32
+ searchButton: props(styles.searchButton.base)
33
+ };
34
+ var clearAction = hasValue && clearable && !disabled && (/*#__PURE__*/React.createElement("button", {
35
+ type: "button",
36
+ className: stringify(classNames.searchClear, styled.clear.className),
37
+ style: styled.clear.style,
38
+ onClick: function onClick(event) {
39
+ event.stopPropagation();
40
+ onClear();
41
+ },
42
+ "aria-label": "Clear search"
43
+ }, /*#__PURE__*/React.createElement(IconClose, {
44
+ size: 24
45
+ })));
46
+ var searchButtonAction = searchButton && (/*#__PURE__*/React.createElement(Button, {
47
+ className: stringify(classNames.searchButton, styled.searchButton.className),
48
+ style: styled.searchButton.style,
49
+ onClick: function onClick(event) {
50
+ event.stopPropagation();
51
+ onSearch();
52
+ },
53
+ disabled: disabled
54
+ }, searchButton));
55
+ var hasConsumerTrailing = !!trailing;
56
+ var hasTrailing = !!clearAction || hasConsumerTrailing || !!searchButtonAction;
57
+ return /*#__PURE__*/React.createElement(SearchField, {
58
+ inputRef: inputRef,
59
+ value: value,
60
+ placeholder: placeholder,
61
+ disabled: disabled,
62
+ onChange: onChange,
63
+ onFocus: onFocus,
64
+ onKeyDown: onKeyDown,
65
+ leading: /*#__PURE__*/React.createElement("span", {
66
+ className: stringify(classNames.searchLeading, styled.leading.className),
67
+ style: styled.leading.style
68
+ }, leading !== null && leading !== void 0 ? leading : /*#__PURE__*/React.createElement(IconSearch, {
69
+ size: 24
70
+ })),
71
+ trailing: hasTrailing ? (/*#__PURE__*/React.createElement("span", {
72
+ className: stringify(classNames.searchTrailing, styled.trailing.className),
73
+ style: styled.trailing.style
74
+ }, clearAction, trailing, searchButtonAction)) : undefined
75
+ });
76
+ };
77
+
78
+ export { SearchBar as default };