@octanejs/select 0.1.1
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/LICENSE +21 -0
- package/README.md +43 -0
- package/UPSTREAM.md +66 -0
- package/package.json +89 -0
- package/src/accessibility-types.ts +70 -0
- package/src/animated/component-element.ts +5 -0
- package/src/animated/index.ts +32 -0
- package/src/animated/input.tsrx +24 -0
- package/src/animated/multi-value.tsrx +23 -0
- package/src/animated/placeholder.tsrx +19 -0
- package/src/animated/single-value.tsrx +18 -0
- package/src/animated/transitions.tsrx +90 -0
- package/src/animated/value-container.tsrx +96 -0
- package/src/animated-registry.ts +10 -0
- package/src/async-creatable.tsrx +30 -0
- package/src/async.tsrx +19 -0
- package/src/base.ts +7 -0
- package/src/builtins.ts +13 -0
- package/src/components.tsrx +875 -0
- package/src/creatable.tsrx +26 -0
- package/src/default-styles.ts +445 -0
- package/src/diacritics.ts +245 -0
- package/src/filters.ts +49 -0
- package/src/index.ts +66 -0
- package/src/menu-placement.ts +143 -0
- package/src/scroll-manager.ts +112 -0
- package/src/select.tsrx +1621 -0
- package/src/state-managed-select.tsrx +19 -0
- package/src/style-adapter.d.ts +25 -0
- package/src/style-adapter.mjs +53 -0
- package/src/style-context.tsrx +37 -0
- package/src/styles.ts +53 -0
- package/src/theme.ts +35 -0
- package/src/types.ts +147 -0
- package/src/use-async.tsrx +146 -0
- package/src/use-creatable.tsrx +151 -0
- package/src/use-state-manager.tsrx +90 -0
- package/src/utils.ts +71 -0
package/src/async.tsrx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { useAsync } from './use-async.tsrx';
|
|
2
|
+
export type { AsyncAdditionalProps, AsyncProps } from './use-async.tsrx';
|
|
3
|
+
|
|
4
|
+
import { Select, type SelectProps } from './select.tsrx';
|
|
5
|
+
import { useAsync, type AsyncProps } from './use-async.tsrx';
|
|
6
|
+
import { useStateManager } from './use-state-manager.tsrx';
|
|
7
|
+
import type { GroupBase } from './types';
|
|
8
|
+
|
|
9
|
+
function AsyncSelect<
|
|
10
|
+
Option = unknown,
|
|
11
|
+
IsMulti extends boolean = false,
|
|
12
|
+
Group extends GroupBase<Option> = GroupBase<Option>,
|
|
13
|
+
>(props: AsyncProps<Option, IsMulti, Group> & SelectProps<Option, IsMulti, Group>) @{
|
|
14
|
+
const asyncProps = useAsync<Option, IsMulti, Group>(props);
|
|
15
|
+
const selectProps = useStateManager<Option, IsMulti, Group>(asyncProps);
|
|
16
|
+
<Select {...selectProps as SelectProps<Option, IsMulti, Group>} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default AsyncSelect;
|
package/src/base.ts
ADDED
package/src/builtins.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GroupBase } from './types';
|
|
2
|
+
|
|
3
|
+
export const formatGroupLabel = <Option, Group extends GroupBase<Option>>(group: Group): string =>
|
|
4
|
+
group.label as string;
|
|
5
|
+
|
|
6
|
+
export const getOptionLabel = <Option>(option: Option): string =>
|
|
7
|
+
(option as { label?: unknown }).label as string;
|
|
8
|
+
|
|
9
|
+
export const getOptionValue = <Option>(option: Option): string =>
|
|
10
|
+
(option as { value?: unknown }).value as string;
|
|
11
|
+
|
|
12
|
+
export const isOptionDisabled = <Option>(option: Option): boolean =>
|
|
13
|
+
Boolean((option as { isDisabled?: unknown }).isDisabled);
|