@impulse-ui-native/select 9.1.1 → 9.1.2

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.
@@ -29,6 +29,10 @@ function SelectControlComponent(props) {
29
29
  error: Boolean(error)
30
30
  }).iconColor;
31
31
  const SuffixContent = loading ? Control.Loader : Suffix;
32
+ const hasPrefix = Prefix || PrefixIcon;
33
+ const showPrefixIcon = !Prefix && PrefixIcon;
34
+ const hasSuffix = SuffixContent || SuffixIcon;
35
+ const showSuffixIcon = !SuffixContent && SuffixIcon;
32
36
  return /* @__PURE__ */ jsx(
33
37
  Control.Provider,
34
38
  {
@@ -39,14 +43,14 @@ function SelectControlComponent(props) {
39
43
  children: /* @__PURE__ */ jsxs(Control.Root, { children: [
40
44
  /* @__PURE__ */ jsx(Control.Label, { children: label }),
41
45
  /* @__PURE__ */ jsx(Pressable, { onPress, children: /* @__PURE__ */ jsxs(Control.Container, { children: [
42
- Prefix || PrefixIcon ? /* @__PURE__ */ jsxs(Control.Addon, { onPress: onPressPrefix, children: [
46
+ hasPrefix ? /* @__PURE__ */ jsxs(Control.Addon, { onPress: onPressPrefix, children: [
43
47
  Prefix ? /* @__PURE__ */ jsx(Prefix, {}) : null,
44
- !Prefix && PrefixIcon ? /* @__PURE__ */ jsx(Icon, { color: addonColor, icon: PrefixIcon }) : null
48
+ showPrefixIcon ? /* @__PURE__ */ jsx(Icon, { color: addonColor, icon: PrefixIcon }) : null
45
49
  ] }) : null,
46
50
  children,
47
- SuffixContent || SuffixIcon ? /* @__PURE__ */ jsxs(Control.Addon, { onPress: onPressSuffix, children: [
51
+ hasSuffix ? /* @__PURE__ */ jsxs(Control.Addon, { onPress: onPressSuffix, children: [
48
52
  SuffixContent ? /* @__PURE__ */ jsx(SuffixContent, {}) : null,
49
- !SuffixContent && SuffixIcon ? /* @__PURE__ */ jsx(Icon, { color: addonColor, icon: SuffixIcon }) : null
53
+ showSuffixIcon ? /* @__PURE__ */ jsx(Icon, { color: addonColor, icon: SuffixIcon }) : null
50
54
  ] }) : null
51
55
  ] }) }),
52
56
  error ? /* @__PURE__ */ jsx(Control.Error, { children: error }) : null
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/select-control.tsx"],"sourcesContent":["import type { PropsWithChildren, ReactElement } from \"react\";\nimport { memo } from \"react\";\n\nimport { Icon } from \"@impulse-ui-native/icon\";\nimport { Control, Pressable } from \"@impulse-ui-native/primitives\";\nimport {\n getFieldStateTokens,\n useComponentsTokens,\n} from \"@impulse-ui-native/theme\";\n\nimport type { PrimitiveValue, SelectControlProps } from \"../types\";\n\nfunction SelectControlComponent<Value extends PrimitiveValue>(\n props: PropsWithChildren<SelectControlProps<Value>>,\n) {\n const {\n size = \"medium\",\n variant = \"outlined\",\n label,\n error,\n disabled,\n loading,\n PrefixIcon,\n Prefix,\n onPressPrefix,\n SuffixIcon,\n Suffix,\n onPressSuffix,\n onPress,\n children,\n } = props;\n\n const addonTokens = useComponentsTokens().controlAddon;\n const addonColor = getFieldStateTokens(addonTokens.variants[variant], {\n disabled,\n error: Boolean(error),\n }).iconColor;\n\n const SuffixContent = loading ? Control.Loader : Suffix;\n\n return (\n <Control.Provider\n size={size}\n variant={variant}\n error={error}\n disabled={disabled}\n >\n <Control.Root>\n <Control.Label>{label}</Control.Label>\n <Pressable onPress={onPress}>\n <Control.Container>\n {Prefix || PrefixIcon ? (\n <Control.Addon onPress={onPressPrefix}>\n {Prefix ? <Prefix /> : null}\n {!Prefix && PrefixIcon ? (\n <Icon color={addonColor} icon={PrefixIcon} />\n ) : null}\n </Control.Addon>\n ) : null}\n {children}\n {SuffixContent || SuffixIcon ? (\n <Control.Addon onPress={onPressSuffix}>\n {SuffixContent ? <SuffixContent /> : null}\n {!SuffixContent && SuffixIcon ? (\n <Icon color={addonColor} icon={SuffixIcon} />\n ) : null}\n </Control.Addon>\n ) : null}\n </Control.Container>\n </Pressable>\n {error ? <Control.Error>{error}</Control.Error> : null}\n </Control.Root>\n </Control.Provider>\n );\n}\n\nexport const SelectControl = memo(SelectControlComponent) as <\n Value extends PrimitiveValue,\n>(\n props: PropsWithChildren<SelectControlProps<Value>>,\n) => ReactElement | null;\n"],"mappings":"AAgDQ,cAIM,YAJN;AA/CR,SAAS,YAAY;AAErB,SAAS,YAAY;AACrB,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAIP,SAAS,uBACP,OACA;AACA,QAAM;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,cAAc,oBAAoB,EAAE;AAC1C,QAAM,aAAa,oBAAoB,YAAY,SAAS,OAAO,GAAG;AAAA,IACpE;AAAA,IACA,OAAO,QAAQ,KAAK;AAAA,EACtB,CAAC,EAAE;AAEH,QAAM,gBAAgB,UAAU,QAAQ,SAAS;AAEjD,SACE;AAAA,IAAC,QAAQ;AAAA,IAAR;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,+BAAC,QAAQ,MAAR,EACC;AAAA,4BAAC,QAAQ,OAAR,EAAe,iBAAM;AAAA,QACtB,oBAAC,aAAU,SACT,+BAAC,QAAQ,WAAR,EACE;AAAA,oBAAU,aACT,qBAAC,QAAQ,OAAR,EAAc,SAAS,eACrB;AAAA,qBAAS,oBAAC,UAAO,IAAK;AAAA,YACtB,CAAC,UAAU,aACV,oBAAC,QAAK,OAAO,YAAY,MAAM,YAAY,IACzC;AAAA,aACN,IACE;AAAA,UACH;AAAA,UACA,iBAAiB,aAChB,qBAAC,QAAQ,OAAR,EAAc,SAAS,eACrB;AAAA,4BAAgB,oBAAC,iBAAc,IAAK;AAAA,YACpC,CAAC,iBAAiB,aACjB,oBAAC,QAAK,OAAO,YAAY,MAAM,YAAY,IACzC;AAAA,aACN,IACE;AAAA,WACN,GACF;AAAA,QACC,QAAQ,oBAAC,QAAQ,OAAR,EAAe,iBAAM,IAAmB;AAAA,SACpD;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,gBAAgB,KAAK,sBAAsB;","names":[]}
1
+ {"version":3,"sources":["../../src/components/select-control.tsx"],"sourcesContent":["import type { PropsWithChildren, ReactElement } from \"react\";\nimport { memo } from \"react\";\n\nimport { Icon } from \"@impulse-ui-native/icon\";\nimport { Control, Pressable } from \"@impulse-ui-native/primitives\";\nimport {\n getFieldStateTokens,\n useComponentsTokens,\n} from \"@impulse-ui-native/theme\";\n\nimport type { PrimitiveValue, SelectControlProps } from \"../types\";\n\nfunction SelectControlComponent<Value extends PrimitiveValue>(\n props: PropsWithChildren<SelectControlProps<Value>>,\n) {\n const {\n size = \"medium\",\n variant = \"outlined\",\n label,\n error,\n disabled,\n loading,\n PrefixIcon,\n Prefix,\n onPressPrefix,\n SuffixIcon,\n Suffix,\n onPressSuffix,\n onPress,\n children,\n } = props;\n\n const addonTokens = useComponentsTokens().controlAddon;\n const addonColor = getFieldStateTokens(addonTokens.variants[variant], {\n disabled,\n error: Boolean(error),\n }).iconColor;\n\n const SuffixContent = loading ? Control.Loader : Suffix;\n\n const hasPrefix = Prefix || PrefixIcon;\n const showPrefixIcon = !Prefix && PrefixIcon;\n const hasSuffix = SuffixContent || SuffixIcon;\n const showSuffixIcon = !SuffixContent && SuffixIcon;\n\n return (\n <Control.Provider\n size={size}\n variant={variant}\n error={error}\n disabled={disabled}\n >\n <Control.Root>\n <Control.Label>{label}</Control.Label>\n <Pressable onPress={onPress}>\n <Control.Container>\n {hasPrefix ? (\n <Control.Addon onPress={onPressPrefix}>\n {Prefix ? <Prefix /> : null}\n {showPrefixIcon ? (\n <Icon color={addonColor} icon={PrefixIcon} />\n ) : null}\n </Control.Addon>\n ) : null}\n {children}\n {hasSuffix ? (\n <Control.Addon onPress={onPressSuffix}>\n {SuffixContent ? <SuffixContent /> : null}\n {showSuffixIcon ? (\n <Icon color={addonColor} icon={SuffixIcon} />\n ) : null}\n </Control.Addon>\n ) : null}\n </Control.Container>\n </Pressable>\n {error ? <Control.Error>{error}</Control.Error> : null}\n </Control.Root>\n </Control.Provider>\n );\n}\n\nexport const SelectControl = memo(SelectControlComponent) as <\n Value extends PrimitiveValue,\n>(\n props: PropsWithChildren<SelectControlProps<Value>>,\n) => ReactElement | null;\n"],"mappings":"AAqDQ,cAIM,YAJN;AApDR,SAAS,YAAY;AAErB,SAAS,YAAY;AACrB,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAIP,SAAS,uBACP,OACA;AACA,QAAM;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,cAAc,oBAAoB,EAAE;AAC1C,QAAM,aAAa,oBAAoB,YAAY,SAAS,OAAO,GAAG;AAAA,IACpE;AAAA,IACA,OAAO,QAAQ,KAAK;AAAA,EACtB,CAAC,EAAE;AAEH,QAAM,gBAAgB,UAAU,QAAQ,SAAS;AAEjD,QAAM,YAAY,UAAU;AAC5B,QAAM,iBAAiB,CAAC,UAAU;AAClC,QAAM,YAAY,iBAAiB;AACnC,QAAM,iBAAiB,CAAC,iBAAiB;AAEzC,SACE;AAAA,IAAC,QAAQ;AAAA,IAAR;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,+BAAC,QAAQ,MAAR,EACC;AAAA,4BAAC,QAAQ,OAAR,EAAe,iBAAM;AAAA,QACtB,oBAAC,aAAU,SACT,+BAAC,QAAQ,WAAR,EACE;AAAA,sBACC,qBAAC,QAAQ,OAAR,EAAc,SAAS,eACrB;AAAA,qBAAS,oBAAC,UAAO,IAAK;AAAA,YACtB,iBACC,oBAAC,QAAK,OAAO,YAAY,MAAM,YAAY,IACzC;AAAA,aACN,IACE;AAAA,UACH;AAAA,UACA,YACC,qBAAC,QAAQ,OAAR,EAAc,SAAS,eACrB;AAAA,4BAAgB,oBAAC,iBAAc,IAAK;AAAA,YACpC,iBACC,oBAAC,QAAK,OAAO,YAAY,MAAM,YAAY,IACzC;AAAA,aACN,IACE;AAAA,WACN,GACF;AAAA,QACC,QAAQ,oBAAC,QAAQ,OAAR,EAAe,iBAAM,IAAmB;AAAA,SACpD;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,gBAAgB,KAAK,sBAAsB;","names":[]}
@@ -20,13 +20,14 @@ const SelectFlyoutComponent = function SelectFlyoutContent(props) {
20
20
  setOpeningKey((key) => key + 1);
21
21
  rest.onOpen?.(id);
22
22
  });
23
+ const shouldScrollToSelected = Boolean(rest.open) && initialScrollToSelected;
23
24
  return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Flyout, { ...rest, onOpen: handleOpen, children: /* @__PURE__ */ jsx(View, { height: tokens.select.flyoutHeight, children: /* @__PURE__ */ jsx(
24
25
  SelectOptions,
25
26
  {
26
27
  options,
27
28
  isSelected,
28
29
  onSelect,
29
- initialScrollToSelected: Boolean(rest.open) && initialScrollToSelected
30
+ initialScrollToSelected: shouldScrollToSelected
30
31
  },
31
32
  openingKey
32
33
  ) }) }) });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/select.flyout.tsx"],"sourcesContent":["import { memo, ReactElement, useState } from \"react\";\n\nimport { useEventCallback } from \"@impulse-ui-native/core\";\nimport { Flyout } from \"@impulse-ui-native/flyout\";\nimport { Portal } from \"@impulse-ui-native/portal\";\nimport { View } from \"@impulse-ui-native/primitives\";\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport { PrimitiveValue, SelectFlyoutProps } from \"../types\";\nimport { SelectOptions } from \"./select-options\";\n\nconst SelectFlyoutComponent = function SelectFlyoutContent<\n Value extends PrimitiveValue,\n>(props: SelectFlyoutProps<Value>) {\n const {\n options,\n isSelected,\n onSelect,\n initialScrollToSelected = true,\n ...rest\n } = props;\n\n const [openingKey, setOpeningKey] = useState(0);\n\n const tokens = useComponentsTokens();\n\n const handleOpen = useEventCallback((id: string) => {\n setOpeningKey((key) => key + 1);\n rest.onOpen?.(id);\n });\n\n return (\n <Portal>\n <Flyout {...rest} onOpen={handleOpen}>\n <View height={tokens.select.flyoutHeight}>\n <SelectOptions\n key={openingKey}\n options={options}\n isSelected={isSelected}\n onSelect={onSelect}\n initialScrollToSelected={\n Boolean(rest.open) && initialScrollToSelected\n }\n />\n </View>\n </Flyout>\n </Portal>\n );\n};\n\nexport const SelectFlyout = memo(SelectFlyoutComponent) as <\n Value extends PrimitiveValue,\n>(\n props: SelectFlyoutProps<Value>,\n) => ReactElement | null;\n"],"mappings":"AAmCU;AAnCV,SAAS,MAAoB,gBAAgB;AAE7C,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,2BAA2B;AAGpC,SAAS,qBAAqB;AAE9B,MAAM,wBAAwB,SAAS,oBAErC,OAAiC;AACjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,0BAA0B;AAAA,IAC1B,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC;AAE9C,QAAM,SAAS,oBAAoB;AAEnC,QAAM,aAAa,iBAAiB,CAAC,OAAe;AAClD,kBAAc,CAAC,QAAQ,MAAM,CAAC;AAC9B,SAAK,SAAS,EAAE;AAAA,EAClB,CAAC;AAED,SACE,oBAAC,UACC,8BAAC,UAAQ,GAAG,MAAM,QAAQ,YACxB,8BAAC,QAAK,QAAQ,OAAO,OAAO,cAC1B;AAAA,IAAC;AAAA;AAAA,MAEC;AAAA,MACA;AAAA,MACA;AAAA,MACA,yBACE,QAAQ,KAAK,IAAI,KAAK;AAAA;AAAA,IALnB;AAAA,EAOP,GACF,GACF,GACF;AAEJ;AAEO,MAAM,eAAe,KAAK,qBAAqB;","names":[]}
1
+ {"version":3,"sources":["../../src/components/select.flyout.tsx"],"sourcesContent":["import { memo, ReactElement, useState } from \"react\";\n\nimport { useEventCallback } from \"@impulse-ui-native/core\";\nimport { Flyout } from \"@impulse-ui-native/flyout\";\nimport { Portal } from \"@impulse-ui-native/portal\";\nimport { View } from \"@impulse-ui-native/primitives\";\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport { PrimitiveValue, SelectFlyoutProps } from \"../types\";\nimport { SelectOptions } from \"./select-options\";\n\nconst SelectFlyoutComponent = function SelectFlyoutContent<\n Value extends PrimitiveValue,\n>(props: SelectFlyoutProps<Value>) {\n const {\n options,\n isSelected,\n onSelect,\n initialScrollToSelected = true,\n ...rest\n } = props;\n\n const [openingKey, setOpeningKey] = useState(0);\n\n const tokens = useComponentsTokens();\n\n const handleOpen = useEventCallback((id: string) => {\n setOpeningKey((key) => key + 1);\n rest.onOpen?.(id);\n });\n\n const shouldScrollToSelected = Boolean(rest.open) && initialScrollToSelected;\n\n return (\n <Portal>\n <Flyout {...rest} onOpen={handleOpen}>\n <View height={tokens.select.flyoutHeight}>\n <SelectOptions\n key={openingKey}\n options={options}\n isSelected={isSelected}\n onSelect={onSelect}\n initialScrollToSelected={shouldScrollToSelected}\n />\n </View>\n </Flyout>\n </Portal>\n );\n};\n\nexport const SelectFlyout = memo(SelectFlyoutComponent) as <\n Value extends PrimitiveValue,\n>(\n props: SelectFlyoutProps<Value>,\n) => ReactElement | null;\n"],"mappings":"AAqCU;AArCV,SAAS,MAAoB,gBAAgB;AAE7C,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,2BAA2B;AAGpC,SAAS,qBAAqB;AAE9B,MAAM,wBAAwB,SAAS,oBAErC,OAAiC;AACjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,0BAA0B;AAAA,IAC1B,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC;AAE9C,QAAM,SAAS,oBAAoB;AAEnC,QAAM,aAAa,iBAAiB,CAAC,OAAe;AAClD,kBAAc,CAAC,QAAQ,MAAM,CAAC;AAC9B,SAAK,SAAS,EAAE;AAAA,EAClB,CAAC;AAED,QAAM,yBAAyB,QAAQ,KAAK,IAAI,KAAK;AAErD,SACE,oBAAC,UACC,8BAAC,UAAQ,GAAG,MAAM,QAAQ,YACxB,8BAAC,QAAK,QAAQ,OAAO,OAAO,cAC1B;AAAA,IAAC;AAAA;AAAA,MAEC;AAAA,MACA;AAAA,MACA;AAAA,MACA,yBAAyB;AAAA;AAAA,IAJpB;AAAA,EAKP,GACF,GACF,GACF;AAEJ;AAEO,MAAM,eAAe,KAAK,qBAAqB;","names":[]}
@@ -30,9 +30,10 @@ function SelectComponent(props) {
30
30
  },
31
31
  [select, close]
32
32
  );
33
+ const hasSelectedValue = selected !== null && selected !== void 0;
33
34
  return /* @__PURE__ */ jsxs(SelectControl, { ...rest, onPress: open, children: [
34
35
  !hasSelected ? /* @__PURE__ */ jsx(Control.Placeholder, { children: placeholder }) : null,
35
- selected !== null && selected !== void 0 ? /* @__PURE__ */ jsx(Control.Value, { children: getLabel(selected) }) : null,
36
+ hasSelectedValue ? /* @__PURE__ */ jsx(Control.Value, { children: getLabel(selected) }) : null,
36
37
  /* @__PURE__ */ jsx(
37
38
  SelectFlyout,
38
39
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/select.tsx"],"sourcesContent":["import { memo, ReactElement, useCallback, useId } from \"react\";\n\nimport { useIsOpen } from \"@impulse-ui-native/core\";\nimport { Control } from \"@impulse-ui-native/primitives\";\n\nimport { useSelect } from \"../hooks/use-select.hook\";\nimport { PrimitiveValue, SelectProps } from \"../types\";\nimport { SelectControl } from \"./select-control\";\nimport { SelectFlyout } from \"./select.flyout\";\n\nfunction SelectComponent<Value extends PrimitiveValue>(\n props: SelectProps<Value>,\n) {\n const {\n options,\n value,\n defaultValue,\n onChange,\n placeholder,\n initialScrollToSelected,\n ...rest\n } = props;\n\n const id = useId();\n\n const { isOpen, open, close } = useIsOpen();\n\n const { selected, hasSelected, select, isSelected, getLabel } = useSelect({\n options,\n value,\n defaultValue,\n onChange,\n });\n\n const handleOnSelect = useCallback(\n (value: Value) => {\n select(value);\n close();\n },\n [select, close],\n );\n\n return (\n <SelectControl {...rest} onPress={open}>\n {!hasSelected ? (\n <Control.Placeholder>{placeholder}</Control.Placeholder>\n ) : null}\n {selected !== null && selected !== undefined ? (\n <Control.Value>{getLabel(selected)}</Control.Value>\n ) : null}\n <SelectFlyout\n id={id}\n title=\"Options\"\n open={isOpen}\n options={options}\n initialScrollToSelected={initialScrollToSelected}\n isSelected={isSelected}\n onCloseFinished={close}\n onSelect={handleOnSelect}\n />\n </SelectControl>\n );\n}\n\nexport const Select = memo(SelectComponent) as <Value extends PrimitiveValue>(\n props: SelectProps<Value>,\n) => ReactElement | null;\n"],"mappings":"AA2CI,SAEI,KAFJ;AA3CJ,SAAS,MAAoB,aAAa,aAAa;AAEvD,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAExB,SAAS,iBAAiB;AAE1B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,SAAS,gBACP,OACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,KAAK,MAAM;AAEjB,QAAM,EAAE,QAAQ,MAAM,MAAM,IAAI,UAAU;AAE1C,QAAM,EAAE,UAAU,aAAa,QAAQ,YAAY,SAAS,IAAI,UAAU;AAAA,IACxE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB;AAAA,IACrB,CAACA,WAAiB;AAChB,aAAOA,MAAK;AACZ,YAAM;AAAA,IACR;AAAA,IACA,CAAC,QAAQ,KAAK;AAAA,EAChB;AAEA,SACE,qBAAC,iBAAe,GAAG,MAAM,SAAS,MAC/B;AAAA,KAAC,cACA,oBAAC,QAAQ,aAAR,EAAqB,uBAAY,IAChC;AAAA,IACH,aAAa,QAAQ,aAAa,SACjC,oBAAC,QAAQ,OAAR,EAAe,mBAAS,QAAQ,GAAE,IACjC;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAM;AAAA,QACN,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA,iBAAiB;AAAA,QACjB,UAAU;AAAA;AAAA,IACZ;AAAA,KACF;AAEJ;AAEO,MAAM,SAAS,KAAK,eAAe;","names":["value"]}
1
+ {"version":3,"sources":["../../src/components/select.tsx"],"sourcesContent":["import { memo, ReactElement, useCallback, useId } from \"react\";\n\nimport { useIsOpen } from \"@impulse-ui-native/core\";\nimport { Control } from \"@impulse-ui-native/primitives\";\n\nimport { useSelect } from \"../hooks/use-select.hook\";\nimport { PrimitiveValue, SelectProps } from \"../types\";\nimport { SelectControl } from \"./select-control\";\nimport { SelectFlyout } from \"./select.flyout\";\n\nfunction SelectComponent<Value extends PrimitiveValue>(\n props: SelectProps<Value>,\n) {\n const {\n options,\n value,\n defaultValue,\n onChange,\n placeholder,\n initialScrollToSelected,\n ...rest\n } = props;\n\n const id = useId();\n\n const { isOpen, open, close } = useIsOpen();\n\n const { selected, hasSelected, select, isSelected, getLabel } = useSelect({\n options,\n value,\n defaultValue,\n onChange,\n });\n\n const handleOnSelect = useCallback(\n (value: Value) => {\n select(value);\n close();\n },\n [select, close],\n );\n\n const hasSelectedValue = selected !== null && selected !== undefined;\n\n return (\n <SelectControl {...rest} onPress={open}>\n {!hasSelected ? (\n <Control.Placeholder>{placeholder}</Control.Placeholder>\n ) : null}\n {hasSelectedValue ? (\n <Control.Value>{getLabel(selected)}</Control.Value>\n ) : null}\n <SelectFlyout\n id={id}\n title=\"Options\"\n open={isOpen}\n options={options}\n initialScrollToSelected={initialScrollToSelected}\n isSelected={isSelected}\n onCloseFinished={close}\n onSelect={handleOnSelect}\n />\n </SelectControl>\n );\n}\n\nexport const Select = memo(SelectComponent) as <Value extends PrimitiveValue>(\n props: SelectProps<Value>,\n) => ReactElement | null;\n"],"mappings":"AA6CI,SAEI,KAFJ;AA7CJ,SAAS,MAAoB,aAAa,aAAa;AAEvD,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAExB,SAAS,iBAAiB;AAE1B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,SAAS,gBACP,OACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,KAAK,MAAM;AAEjB,QAAM,EAAE,QAAQ,MAAM,MAAM,IAAI,UAAU;AAE1C,QAAM,EAAE,UAAU,aAAa,QAAQ,YAAY,SAAS,IAAI,UAAU;AAAA,IACxE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB;AAAA,IACrB,CAACA,WAAiB;AAChB,aAAOA,MAAK;AACZ,YAAM;AAAA,IACR;AAAA,IACA,CAAC,QAAQ,KAAK;AAAA,EAChB;AAEA,QAAM,mBAAmB,aAAa,QAAQ,aAAa;AAE3D,SACE,qBAAC,iBAAe,GAAG,MAAM,SAAS,MAC/B;AAAA,KAAC,cACA,oBAAC,QAAQ,aAAR,EAAqB,uBAAY,IAChC;AAAA,IACH,mBACC,oBAAC,QAAQ,OAAR,EAAe,mBAAS,QAAQ,GAAE,IACjC;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAM;AAAA,QACN,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA,iBAAiB;AAAA,QACjB,UAAU;AAAA;AAAA,IACZ;AAAA,KACF;AAEJ;AAEO,MAAM,SAAS,KAAK,eAAe;","names":["value"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impulse-ui-native/select",
3
- "version": "9.1.1",
3
+ "version": "9.1.2",
4
4
  "description": "Select and option picker components for ImpulseUI Native applications.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -13,11 +13,11 @@
13
13
  "source": "src/index.ts",
14
14
  "module": "dist/index.js",
15
15
  "types": "dist/index.d.mts",
16
- "react-native": "src/index.ts",
16
+ "react-native": "dist/index.js",
17
17
  "exports": {
18
18
  ".": {
19
19
  "types": "./dist/index.d.mts",
20
- "react-native": "./src/index.ts",
20
+ "react-native": "./dist/index.js",
21
21
  "import": "./dist/index.js"
22
22
  }
23
23
  },
@@ -28,14 +28,14 @@
28
28
  ],
29
29
  "sideEffects": false,
30
30
  "dependencies": {
31
- "@impulse-ui-native/theme": "9.1.1",
32
- "@impulse-ui-native/icon": "9.1.1",
33
- "@impulse-ui-native/primitives": "9.1.1",
34
- "@impulse-ui-native/core": "9.1.1",
35
- "@impulse-ui-native/input": "9.1.1",
36
- "@impulse-ui-native/portal": "9.1.1",
37
- "@impulse-ui-native/flyout": "9.1.1",
38
- "@impulse-ui-native/flat-list": "9.1.1"
31
+ "@impulse-ui-native/theme": "9.1.2",
32
+ "@impulse-ui-native/icon": "9.1.2",
33
+ "@impulse-ui-native/core": "9.1.2",
34
+ "@impulse-ui-native/primitives": "9.1.2",
35
+ "@impulse-ui-native/input": "9.1.2",
36
+ "@impulse-ui-native/flyout": "9.1.2",
37
+ "@impulse-ui-native/portal": "9.1.2",
38
+ "@impulse-ui-native/flat-list": "9.1.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/react": "~19.2.14",
@@ -44,8 +44,8 @@
44
44
  "react": "19.2.3",
45
45
  "react-native": "0.86.2",
46
46
  "typescript": "~6.0.3",
47
- "@impulse-ui-native/eslint-config": "1.0.0",
48
47
  "@impulse-ui-native/prettier-config": "1.0.0",
48
+ "@impulse-ui-native/eslint-config": "1.0.0",
49
49
  "@impulse-ui-native/tsconfig": "1.0.0"
50
50
  },
51
51
  "peerDependencies": {