lupine.components 1.1.7 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lupine.components",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "license": "MIT",
5
5
  "author": "uuware.com",
6
6
  "homepage": "https://github.com/uuware/lupine.js",
@@ -226,3 +226,45 @@ export class ActionSheetMessage {
226
226
  return handleClose;
227
227
  }
228
228
  }
229
+
230
+ export type ActionSheetInputProps = Omit<
231
+ ActionSheetShowProps,
232
+ 'children' | 'handleClicked' | 'closeEvent' | 'handleConfirmClicked'
233
+ > & {
234
+ defaultValue?: string;
235
+ handleConfirmValue: (value: string, close: ActionSheetCloseProps) => void;
236
+ };
237
+ export class ActionSheetInput {
238
+ static async show({
239
+ title,
240
+ defaultValue,
241
+ contentMaxHeight,
242
+ closeWhenClickOutside = true,
243
+ confirmButtonText = 'OK',
244
+ handleConfirmValue: handleConfirmValue,
245
+ cancelButtonText = 'Cancel',
246
+ }: ActionSheetInputProps): Promise<ActionSheetCloseProps> {
247
+ let value: string = defaultValue || '';
248
+ const handleClose = await ActionSheet.show({
249
+ title,
250
+ children: (
251
+ <div css={{ padding: '8px', borderTop: '1px solid var(--primary-border-color)' }}>
252
+ <input
253
+ class='input-base w-100p'
254
+ type='text'
255
+ value={value}
256
+ onInput={(e) => (value = (e.target as HTMLInputElement).value)}
257
+ />
258
+ </div>
259
+ ),
260
+ contentMaxHeight,
261
+ confirmButtonText,
262
+ handleConfirmClicked: (close) => {
263
+ handleConfirmValue(value, close);
264
+ },
265
+ cancelButtonText,
266
+ closeWhenClickOutside,
267
+ });
268
+ return handleClose;
269
+ }
270
+ }
@@ -4,6 +4,7 @@ import { stopPropagation } from '../lib';
4
4
  export type PopupMenuHookProps = {
5
5
  openMenu?: (event?: MouseEvent) => void;
6
6
  getValue?: () => string;
7
+ setLabel?: (label: string) => void;
7
8
  };
8
9
 
9
10
  // defaultValue=<i class='ifc-icon co-cil-hamburger-menu'></i>
@@ -231,6 +232,9 @@ export const PopupMenu = ({
231
232
  if (hook) {
232
233
  hook.openMenu = openMenu;
233
234
  hook.getValue = () => selectedValue;
235
+ hook.setLabel = (label: string) => {
236
+ ref.$('.popup-menu-item .popup-menu-text').innerText = label;
237
+ };
234
238
  }
235
239
  const itemClick = (event: any) => {
236
240
  stopPropagation(event);