@colisweb/rescript-toolkit 3.1.5 → 3.1.6

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -154,11 +154,11 @@ module.exports = {
154
154
  plugins: [require("@tailwindcss/line-clamp")],
155
155
  content: [
156
156
  "public/index.html",
157
- "lib/es6_global/src/**/**.js",
158
- "src/**/**.js",
159
- "node_modules/@colisweb/rescript-toolkit/lib/es6_global/src/**/**.js",
160
- "node_modules/@colisweb/rescript-toolkit/src/**/**.js",
161
- "playground/**/*.js",
162
- "lib/es6_global/playground/**/*.js",
157
+ "lib/es6_global/src/**/**.(c)?js",
158
+ "src/**/**.(c)?js",
159
+ "node_modules/@colisweb/rescript-toolkit/lib/es6_global/src/**/**.(c)?js",
160
+ "node_modules/@colisweb/rescript-toolkit/src/**/**.(c)?js",
161
+ "playground/**/*.(c)?js",
162
+ "lib/es6_global/playground/**/*.(c)?js",
163
163
  ],
164
164
  };
@@ -127,57 +127,60 @@ let make = (
127
127
  ~leftIcon: option<module(Icon)>=?,
128
128
  ~rightIcon: option<module(Icon)>=?,
129
129
  ~iconClassName=?,
130
+ ~testId="",
130
131
  ~buttonRef: option<ReactDOM.domRef>=?,
131
132
  ) => {
132
- <button
133
- ref=?{buttonRef}
134
- ?ariaLabel
135
- ?ariaLabelledby
136
- ?ariaExpanded
137
- ?autoFocus
138
- disabled={isLoading || disabled}
139
- ?type_
140
- ?id
141
- ?tabIndex
142
- ?onFocus
143
- ?onBlur
144
- ?onClick
145
- className={cx([
146
- className,
147
- buttonStyle(~color, ~variant, ~size, ~disabled, ()),
148
- variant === #pill ? "rounded-full" : "",
149
- ])}>
150
- {leftIcon->Option.mapWithDefault(React.null, icon => {
151
- let module(Icon) = icon
152
-
153
- <span className="mr-2">
154
- <Icon
155
- size={switch size {
156
- | #xs => 12
157
- | #sm => 16
158
- | #md => 20
159
- | #lg => 24
160
- }}
161
- className=?iconClassName
162
- />
163
- </span>
164
- })}
165
- children
166
- {rightIcon->Option.mapWithDefault(React.null, icon => {
167
- let module(Icon) = icon
168
-
169
- <span className="ml-2">
170
- <Icon
171
- size={switch size {
172
- | #xs => 14
173
- | #sm => 18
174
- | #md => 22
175
- | #lg => 26
176
- }}
177
- className=?iconClassName
178
- />
179
- </span>
180
- })}
181
- {isLoading ? <Spinner size=#sm color=#current className="ml-2" /> : React.null}
182
- </button>
133
+ <Toolkit__Ui_Spread props={{"data-testid": cx([testId])}}>
134
+ <button
135
+ ref=?{buttonRef}
136
+ ?ariaLabel
137
+ ?ariaLabelledby
138
+ ?ariaExpanded
139
+ ?autoFocus
140
+ disabled={isLoading || disabled}
141
+ ?type_
142
+ ?id
143
+ ?tabIndex
144
+ ?onFocus
145
+ ?onBlur
146
+ ?onClick
147
+ className={cx([
148
+ className,
149
+ buttonStyle(~color, ~variant, ~size, ~disabled, ()),
150
+ variant === #pill ? "rounded-full" : "",
151
+ ])}>
152
+ {leftIcon->Option.mapWithDefault(React.null, icon => {
153
+ let module(Icon) = icon
154
+
155
+ <span className="mr-2">
156
+ <Icon
157
+ size={switch size {
158
+ | #xs => 12
159
+ | #sm => 16
160
+ | #md => 20
161
+ | #lg => 24
162
+ }}
163
+ className=?iconClassName
164
+ />
165
+ </span>
166
+ })}
167
+ children
168
+ {rightIcon->Option.mapWithDefault(React.null, icon => {
169
+ let module(Icon) = icon
170
+
171
+ <span className="ml-2">
172
+ <Icon
173
+ size={switch size {
174
+ | #xs => 14
175
+ | #sm => 18
176
+ | #md => 22
177
+ | #lg => 26
178
+ }}
179
+ className=?iconClassName
180
+ />
181
+ </span>
182
+ })}
183
+ {isLoading ? <Spinner size=#sm color=#current className="ml-2" /> : React.null}
184
+ </button>
185
+ </Toolkit__Ui_Spread>
183
186
  }
@@ -37,5 +37,6 @@ let make: (
37
37
  ~leftIcon: module(ReactIcons.Icon)=?,
38
38
  ~rightIcon: module(ReactIcons.Icon)=?,
39
39
  ~iconClassName: string=?,
40
+ ~testId: string=?,
40
41
  ~buttonRef: ReactDOM.domRef=?,
41
42
  ) => React.element
@@ -23,18 +23,16 @@ module Header = {
23
23
  children
24
24
  </div>
25
25
  {action->Option.mapWithDefault(React.null, ({label, event}) => {
26
- let btn =
27
- <Toolkit__Ui_Button
28
- variant=#pill
29
- size=#xs
30
- color=#info
31
- onClick={_ => event()}
32
- disabled={actionDisabled->Option.getWithDefault(false)}
33
- className="flex-shrink-0 ml-4">
34
- label
35
- </Toolkit__Ui_Button>
36
-
37
- React.cloneElement(btn, {"data-testid": cx(["card-header-button", buttonTestId])})
26
+ <Toolkit__Ui_Button
27
+ variant=#pill
28
+ size=#xs
29
+ color=#info
30
+ onClick={_ => event()}
31
+ testId={buttonTestId}
32
+ disabled={actionDisabled->Option.getWithDefault(false)}
33
+ className="flex-shrink-0 ml-4">
34
+ label
35
+ </Toolkit__Ui_Button>
38
36
  })}
39
37
  </div>
40
38
  }