@xqmsg/ui-core 0.25.1 → 0.26.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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.25.1",
2
+ "version": "0.26.0",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -113,7 +113,7 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
113
113
  return (
114
114
  <Form formHandler={formHandler}>
115
115
  <Input
116
- label="To"
116
+ label="Pilled Text Input - scroll mode"
117
117
  name="recipients"
118
118
  inputType="pilled-text"
119
119
  placeholder="Enter email address..."
@@ -126,6 +126,23 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
126
126
  ariaLabel="email input"
127
127
  isRequired
128
128
  truncatePillLength={1000}
129
+ overflowMode="scroll"
130
+ />
131
+ <Input
132
+ label="Pilled Text - wrap mode"
133
+ name="recipients"
134
+ inputType="pilled-text"
135
+ placeholder="Enter email address..."
136
+ isInvalid={!!form.formState.errors['prop5']?.message}
137
+ errorText={form.formState.errors['prop5']?.message}
138
+ control={form.control}
139
+ setValue={form.setValue}
140
+ setError={form.setError}
141
+ clearErrors={form.clearErrors}
142
+ ariaLabel="email input"
143
+ isRequired
144
+ truncatePillLength={1000}
145
+ overflowMode="wrap"
129
146
  />
130
147
  <Input
131
148
  {...args}
@@ -326,6 +326,8 @@ const StackedPilledInput = React.forwardRef<
326
326
  onClick={() => {
327
327
  if (isFocussed && tokenIndex !== null) {
328
328
  setTokenIndex(null);
329
+ } else if (!scrollMode) {
330
+ setIsFocussed(true);
329
331
  }
330
332
 
331
333
  if (!disabled) {
@@ -344,7 +346,8 @@ const StackedPilledInput = React.forwardRef<
344
346
  overflowX={scrollMode ? 'scroll' : 'hidden'}
345
347
  flexWrap={scrollMode ? 'nowrap' : 'wrap'}
346
348
  overflowY="hidden"
347
- maxWidth={isFocussed ? '80%' : '100%'}
349
+ width={scrollMode ? 'auto' : '100%'}
350
+ maxWidth={isFocussed && scrollMode ? '80%' : '100%'}
348
351
  style={{
349
352
  scrollbarWidth: 'none' /* Firefox */,
350
353
  msOverflowStyle: 'none',
@@ -406,8 +409,41 @@ const StackedPilledInput = React.forwardRef<
406
409
  {placeholder}
407
410
  </Text>
408
411
  ) : null}
412
+ {!disabled && !scrollMode && (
413
+ <Flex
414
+ flex={1}
415
+ minWidth={isFocussed && !tokenIndex ? 'auto' : '100px'}
416
+ >
417
+ <Input
418
+ onKeyDown={onHandleKeyDown}
419
+ type="text"
420
+ padding={0}
421
+ alignContent="flex-start"
422
+ float="right"
423
+ border="none"
424
+ height="auto"
425
+ color={
426
+ tokenIndex !== null ? 'transparent' : colors.label.primary
427
+ }
428
+ _focus={{ boxShadow: 'none !important' }}
429
+ value={localValue}
430
+ onChange={handleOnChange}
431
+ ref={inputRef}
432
+ onFocus={() => setIsFocussed(true)}
433
+ fontSize={isMobile ? '17px' : '13px'}
434
+ lineHeight={1.5}
435
+ placeholder={
436
+ isMobile && label && lastestFormValueToArray.length === 0
437
+ ? (label as string)
438
+ : ''
439
+ }
440
+ variant={variant}
441
+ style={isMobile ? { border: 'none' } : undefined}
442
+ />
443
+ </Flex>
444
+ )}
409
445
  </Flex>
410
- {!disabled && (
446
+ {!disabled && scrollMode && (
411
447
  <Flex flex={1} minWidth={isFocussed && !tokenIndex ? '20%' : 0}>
412
448
  <Input
413
449
  onKeyDown={onHandleKeyDown}
@@ -49,7 +49,7 @@ const Token: React.FC<TokenProps> = ({
49
49
  wordBreak="break-word"
50
50
  color={colors.label.primary.light}
51
51
  fontSize={isMobile ? '17px' : '13px'}
52
- lineHeight={isMobile ? '17px' : '13px'}
52
+ lineHeight="1.5"
53
53
  pr="2px"
54
54
  maxWidth={maxWidth}
55
55
  overflow="hidden"