@workday/canvas-kit-react 11.0.0-alpha.715-next.0 → 11.0.0-alpha.718-next.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/collection/lib/ListBox.tsx +50 -19
- package/combobox/lib/ComboboxMenuItem.tsx +24 -6
- package/combobox/lib/ComboboxMenuList.tsx +11 -10
- package/dist/commonjs/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/ListBox.js +18 -5
- package/dist/commonjs/combobox/lib/Combobox.d.ts +77 -5
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenu.d.ts +77 -5
- package/dist/commonjs/combobox/lib/ComboboxMenu.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.d.ts +157 -7
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.js +17 -3
- package/dist/commonjs/combobox/lib/ComboboxMenuList.d.ts +0 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuList.js +8 -3
- package/dist/commonjs/menu/index.d.ts +1 -1
- package/dist/commonjs/menu/index.d.ts.map +1 -1
- package/dist/commonjs/menu/index.js +2 -1
- package/dist/commonjs/menu/lib/MenuCard.d.ts +9 -0
- package/dist/commonjs/menu/lib/MenuCard.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuCard.js +18 -21
- package/dist/commonjs/menu/lib/MenuList.d.ts +10 -0
- package/dist/commonjs/menu/lib/MenuList.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuList.js +14 -3
- package/dist/commonjs/select/lib/Select.d.ts +437 -13
- package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
- package/dist/commonjs/select/lib/Select.js +21 -12
- package/dist/es6/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/es6/collection/lib/ListBox.js +19 -6
- package/dist/es6/combobox/lib/Combobox.d.ts +77 -5
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxMenu.d.ts +77 -5
- package/dist/es6/combobox/lib/ComboboxMenu.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxMenuItem.d.ts +157 -7
- package/dist/es6/combobox/lib/ComboboxMenuItem.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxMenuItem.js +17 -3
- package/dist/es6/combobox/lib/ComboboxMenuList.d.ts +0 -1
- package/dist/es6/combobox/lib/ComboboxMenuList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxMenuList.js +9 -4
- package/dist/es6/menu/index.d.ts +1 -1
- package/dist/es6/menu/index.d.ts.map +1 -1
- package/dist/es6/menu/index.js +1 -1
- package/dist/es6/menu/lib/MenuCard.d.ts +9 -0
- package/dist/es6/menu/lib/MenuCard.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuCard.js +18 -21
- package/dist/es6/menu/lib/MenuList.d.ts +10 -0
- package/dist/es6/menu/lib/MenuList.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuList.js +13 -2
- package/dist/es6/select/lib/Select.d.ts +437 -13
- package/dist/es6/select/lib/Select.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.js +21 -12
- package/menu/index.ts +1 -1
- package/menu/lib/MenuCard.tsx +37 -32
- package/menu/lib/MenuList.tsx +24 -8
- package/package.json +4 -4
- package/select/lib/Select.tsx +45 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../select/lib/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../select/lib/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAA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CAAC"}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { caretDownSmallIcon } from '@workday/canvas-system-icons-web';
|
|
3
3
|
import { Combobox } from '@workday/canvas-kit-react/combobox';
|
|
4
|
+
import { createStencil, createStyles, px2rem } from '@workday/canvas-kit-styling';
|
|
4
5
|
import { InputGroup, TextInput } from '@workday/canvas-kit-react/text-input';
|
|
5
6
|
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
6
7
|
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
7
|
-
import { caretDownSmallIcon } from '@workday/canvas-system-icons-web';
|
|
8
|
-
import { useSelectModel } from './hooks/useSelectModel';
|
|
9
8
|
import { useSelectCard } from './hooks/useSelectCard';
|
|
10
9
|
import { useSelectInput } from './hooks/useSelectInput';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import { useSelectModel } from './hooks/useSelectModel';
|
|
11
|
+
import { createSubcomponent, createContainer, } from '@workday/canvas-kit-react/common';
|
|
12
|
+
import { system } from '@workday/canvas-tokens-web';
|
|
13
|
+
const selectInputStencil = createStencil({
|
|
14
|
+
base: { name: "1gpclr4", styles: "caret-color:transparent;cursor:default;&::selection{background-color:transparent;}" }
|
|
15
|
+
}, "select-input");
|
|
16
|
+
const selectIconsStencil = createStencil({
|
|
17
|
+
base: { name: "1isip6o", styles: "position:absolute;pointer-events:none;" }
|
|
18
|
+
}, "select-icons");
|
|
19
|
+
const hiddenSelectInputStencil = createStencil({
|
|
20
|
+
base: { name: "1xuodxn", styles: "position:absolute;top:var(--cnvs-sys-space-zero, 0);bottom:var(--cnvs-sys-space-zero, 0);left:var(--cnvs-sys-space-zero, 0);right:var(--cnvs-sys-space-zero, 0);opacity:0;cursor:default;pointer-events:none;" }
|
|
21
|
+
}, "hidden-select-input");
|
|
14
22
|
export const SelectInput = createSubcomponent(TextInput)({
|
|
15
23
|
modelHook: useSelectModel,
|
|
16
24
|
elemPropsHook: useSelectInput,
|
|
17
25
|
})(({ placeholder = 'Choose an option', inputStartIcon, error, textInputProps, disabled, width, ref, onChange, onInput, onFocus, value, name, ...elemProps }, Element, model) => {
|
|
18
|
-
return (React.createElement(InputGroup, {
|
|
19
|
-
inputStartIcon && model.state.selectedIds.length > 0 && (React.createElement(InputGroup.InnerStart, {
|
|
26
|
+
return (React.createElement(InputGroup, { "data-width": "ck-formfield-width" },
|
|
27
|
+
inputStartIcon && model.state.selectedIds.length > 0 && (React.createElement(InputGroup.InnerStart, Object.assign({}, selectIconsStencil()),
|
|
20
28
|
React.createElement(SystemIcon, { icon: inputStartIcon }))),
|
|
21
|
-
React.createElement(InputGroup.Input, { error: error, disabled: disabled,
|
|
22
|
-
React.createElement(InputGroup.Input, Object.assign({ as: Element, disabled: disabled, placeholder: placeholder, error: error }, textInputProps, mergeStyles(elemProps,
|
|
23
|
-
React.createElement(InputGroup.InnerEnd, {
|
|
29
|
+
React.createElement(InputGroup.Input, Object.assign({ error: error, disabled: disabled, tabIndex: -1, "aria-hidden": true, onChange: onChange, onInput: onInput, value: value, onFocus: onFocus, name: name, ref: ref }, hiddenSelectInputStencil())),
|
|
30
|
+
React.createElement(InputGroup.Input, Object.assign({ as: Element, disabled: disabled, placeholder: placeholder, error: error }, textInputProps, mergeStyles(elemProps, selectInputStencil()))),
|
|
31
|
+
React.createElement(InputGroup.InnerEnd, Object.assign({}, selectIconsStencil()),
|
|
24
32
|
React.createElement(SystemIcon, { icon: caretDownSmallIcon }))));
|
|
25
33
|
});
|
|
26
34
|
export const SelectItem = createSubcomponent('li')({
|
|
@@ -31,11 +39,12 @@ export const SelectItem = createSubcomponent('li')({
|
|
|
31
39
|
})(({ children, ...elemProps }, Element, _model) => {
|
|
32
40
|
return (React.createElement(Combobox.Menu.Item, Object.assign({ role: "option", as: Element }, elemProps), children));
|
|
33
41
|
});
|
|
42
|
+
const selectCardStyles = createStyles({ name: "1621qa2", styles: "max-height:18.75rem;" });
|
|
34
43
|
export const SelectCard = createSubcomponent('div')({
|
|
35
44
|
modelHook: useSelectModel,
|
|
36
45
|
elemPropsHook: useSelectCard,
|
|
37
46
|
})(({ children, ...elemProps }, Element) => {
|
|
38
|
-
return (React.createElement(Combobox.Menu.Card, Object.assign({
|
|
47
|
+
return (React.createElement(Combobox.Menu.Card, Object.assign({ as: Element }, mergeStyles(elemProps, selectCardStyles)), children));
|
|
39
48
|
});
|
|
40
49
|
/**
|
|
41
50
|
* Use `Select` to allow users to choose an option from a list or type characters to select a matching option.
|
package/menu/index.ts
CHANGED
|
@@ -3,6 +3,6 @@ export {Menu} from './lib/Menu';
|
|
|
3
3
|
|
|
4
4
|
export {useMenuCard} from './lib/MenuCard';
|
|
5
5
|
export {useMenuItem, StyledMenuItem, MenuItemProps} from './lib/MenuItem';
|
|
6
|
-
export {useMenuList} from './lib/MenuList';
|
|
6
|
+
export {useMenuList, menuListStencil} from './lib/MenuList';
|
|
7
7
|
export {useMenuPopper} from './lib/MenuPopper';
|
|
8
8
|
export {useMenuTarget, useMenuTargetContext} from './lib/MenuTarget';
|
package/menu/lib/MenuCard.tsx
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import {Card} from '@workday/canvas-kit-react/card';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import {
|
|
6
|
-
styled,
|
|
7
|
-
TransformOrigin,
|
|
8
6
|
createSubcomponent,
|
|
9
|
-
StyledType,
|
|
10
7
|
ExtractProps,
|
|
11
8
|
createElemPropsHook,
|
|
12
9
|
} from '@workday/canvas-kit-react/common';
|
|
13
10
|
import {getTransformFromPlacement} from '@workday/canvas-kit-react/popup';
|
|
11
|
+
import {system, base} from '@workday/canvas-tokens-web';
|
|
14
12
|
|
|
15
13
|
import {useMenuModel} from './useMenuModel';
|
|
14
|
+
import {createStencil, calc, px2rem} from '@workday/canvas-kit-styling';
|
|
15
|
+
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
16
16
|
|
|
17
17
|
export interface MenuCardProps extends ExtractProps<typeof Card, never> {
|
|
18
18
|
children?: React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
export const menuCardStencil = createStencil({
|
|
22
|
+
vars: {
|
|
23
|
+
minWidth: px2rem(1),
|
|
24
|
+
transformOriginVertical: 'top',
|
|
25
|
+
transformOriginHorizontal: 'left',
|
|
26
|
+
},
|
|
27
|
+
base: ({transformOriginVertical, transformOriginHorizontal, minWidth}) => ({
|
|
28
|
+
...system.type.subtext.large,
|
|
29
|
+
color: base.blackPepper300,
|
|
26
30
|
position: 'relative',
|
|
27
31
|
display: 'flex',
|
|
28
32
|
flexDirection: 'column',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
);
|
|
33
|
+
transition: `transform ease-out 150ms`,
|
|
34
|
+
padding: system.space.zero,
|
|
35
|
+
maxWidth: calc.subtract('100vw', system.space.x8),
|
|
36
|
+
boxShadow: system.depth[3],
|
|
37
|
+
minWidth: minWidth,
|
|
38
|
+
boxSizing: 'border-box',
|
|
39
|
+
transformOrigin: `${transformOriginVertical} ${transformOriginHorizontal}`,
|
|
40
|
+
// Allow overriding of animation in special cases
|
|
41
|
+
'.wd-no-animation &': {
|
|
42
|
+
animation: 'none',
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
44
46
|
|
|
45
47
|
export const useMenuCard = createElemPropsHook(useMenuModel)(() => {
|
|
46
48
|
return {};
|
|
@@ -50,21 +52,24 @@ export const MenuCard = createSubcomponent('div')({
|
|
|
50
52
|
displayName: 'Menu.Card',
|
|
51
53
|
modelHook: useMenuModel,
|
|
52
54
|
elemPropsHook: useMenuCard,
|
|
53
|
-
})<MenuCardProps>((elemProps, Element, model) => {
|
|
55
|
+
})<MenuCardProps>(({minWidth, ...elemProps}, Element, model) => {
|
|
54
56
|
const transformOrigin = React.useMemo(() => {
|
|
55
57
|
return getTransformFromPlacement(model.state.placement || 'bottom');
|
|
56
58
|
}, [model.state.placement]);
|
|
57
59
|
|
|
58
60
|
return (
|
|
59
|
-
<
|
|
61
|
+
<Card
|
|
60
62
|
as={Element}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
{...mergeStyles(
|
|
64
|
+
elemProps,
|
|
65
|
+
menuCardStencil({
|
|
66
|
+
minWidth: typeof minWidth === 'number' ? px2rem(minWidth as number) : minWidth,
|
|
67
|
+
transformOriginVertical: transformOrigin.vertical,
|
|
68
|
+
transformOriginHorizontal: transformOrigin.horizontal,
|
|
69
|
+
})
|
|
70
|
+
)}
|
|
66
71
|
>
|
|
67
72
|
{elemProps.children}
|
|
68
|
-
</
|
|
73
|
+
</Card>
|
|
69
74
|
);
|
|
70
75
|
});
|
package/menu/lib/MenuList.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import {commonColors} from '@workday/canvas-kit-react/tokens';
|
|
4
3
|
import {
|
|
5
4
|
createSubcomponent,
|
|
6
5
|
createElemPropsHook,
|
|
@@ -11,6 +10,9 @@ import {ListBox, ListProps} from '@workday/canvas-kit-react/collection';
|
|
|
11
10
|
import {useReturnFocus, useFocusRedirect} from '@workday/canvas-kit-react/popup';
|
|
12
11
|
|
|
13
12
|
import {useMenuModel} from './useMenuModel';
|
|
13
|
+
import {createStencil, cssVar} from '@workday/canvas-kit-styling';
|
|
14
|
+
import {base, system} from '@workday/canvas-tokens-web';
|
|
15
|
+
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
14
16
|
|
|
15
17
|
export interface MenuListProps<T = any>
|
|
16
18
|
extends Omit<ExtractProps<typeof ListBox, never>, 'children'> {
|
|
@@ -31,6 +33,25 @@ export const useMenuList = composeHooks(
|
|
|
31
33
|
useFocusRedirect
|
|
32
34
|
);
|
|
33
35
|
|
|
36
|
+
export const menuListStencil = createStencil({
|
|
37
|
+
base: {
|
|
38
|
+
background: base.frenchVanilla100,
|
|
39
|
+
borderRadius: system.shape.zero,
|
|
40
|
+
padding: system.space.zero,
|
|
41
|
+
gap: system.space.zero,
|
|
42
|
+
},
|
|
43
|
+
modifiers: {
|
|
44
|
+
orientation: {
|
|
45
|
+
vertical: {
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
},
|
|
48
|
+
horizontal: {
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
34
55
|
export const MenuList = createSubcomponent('div')({
|
|
35
56
|
displayName: 'Menu.List',
|
|
36
57
|
modelHook: useMenuModel,
|
|
@@ -40,14 +61,9 @@ export const MenuList = createSubcomponent('div')({
|
|
|
40
61
|
<ListBox
|
|
41
62
|
as={Element}
|
|
42
63
|
model={model}
|
|
43
|
-
|
|
44
|
-
borderRadius="zero"
|
|
45
|
-
padding="zero"
|
|
46
|
-
marginY="xxs"
|
|
47
|
-
gap="zero"
|
|
64
|
+
marginY={cssVar(system.space.x2)}
|
|
48
65
|
overflowY="auto"
|
|
49
|
-
|
|
50
|
-
{...elemProps}
|
|
66
|
+
{...mergeStyles(elemProps, menuListStencil({orientation: model.state.orientation}))}
|
|
51
67
|
>
|
|
52
68
|
{children}
|
|
53
69
|
</ListBox>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.718-next.0",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@emotion/styled": "^11.6.0",
|
|
51
51
|
"@popperjs/core": "^2.5.4",
|
|
52
52
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
53
|
-
"@workday/canvas-kit-popup-stack": "^11.0.0-alpha.
|
|
54
|
-
"@workday/canvas-kit-styling": "^11.0.0-alpha.
|
|
53
|
+
"@workday/canvas-kit-popup-stack": "^11.0.0-alpha.718-next.0",
|
|
54
|
+
"@workday/canvas-kit-styling": "^11.0.0-alpha.718-next.0",
|
|
55
55
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
56
56
|
"@workday/canvas-tokens-web": "^1.0.2",
|
|
57
57
|
"@workday/design-assets-types": "^0.2.8",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
69
69
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "2281ef0e9e908a07a62610a9b41dc6b1e744bb3e"
|
|
72
72
|
}
|
package/select/lib/Select.tsx
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
ExtractProps,
|
|
5
|
-
createContainer,
|
|
6
|
-
Themeable,
|
|
7
|
-
} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
3
|
+
import {caretDownSmallIcon} from '@workday/canvas-system-icons-web';
|
|
8
4
|
import {Combobox} from '@workday/canvas-kit-react/combobox';
|
|
9
|
-
|
|
5
|
+
import {createStencil, createStyles, CSProps, px2rem} from '@workday/canvas-kit-styling';
|
|
10
6
|
import {InputGroup, TextInput} from '@workday/canvas-kit-react/text-input';
|
|
11
7
|
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
12
8
|
import {SystemIcon} from '@workday/canvas-kit-react/icon';
|
|
13
|
-
import {caretDownSmallIcon} from '@workday/canvas-system-icons-web';
|
|
14
|
-
import {useSelectModel} from './hooks/useSelectModel';
|
|
15
9
|
import {useSelectCard} from './hooks/useSelectCard';
|
|
16
10
|
import {useSelectInput} from './hooks/useSelectInput';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
11
|
+
import {useSelectModel} from './hooks/useSelectModel';
|
|
12
|
+
import {
|
|
13
|
+
createSubcomponent,
|
|
14
|
+
ExtractProps,
|
|
15
|
+
createContainer,
|
|
16
|
+
Themeable,
|
|
17
|
+
} from '@workday/canvas-kit-react/common';
|
|
18
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
19
19
|
|
|
20
20
|
export interface SelectInputProps extends ExtractProps<typeof TextInput>, CSProps {
|
|
21
21
|
/**
|
|
@@ -26,23 +26,33 @@ export interface SelectInputProps extends ExtractProps<typeof TextInput>, CSProp
|
|
|
26
26
|
inputStartIcon?: CanvasSystemIcon;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const selectInputStencil = createStencil({
|
|
30
|
+
base: {
|
|
31
|
+
caretColor: 'transparent',
|
|
32
|
+
cursor: 'default',
|
|
33
|
+
'&::selection': {
|
|
34
|
+
backgroundColor: 'transparent',
|
|
35
|
+
},
|
|
34
36
|
},
|
|
35
37
|
});
|
|
36
38
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
const selectIconsStencil = createStencil({
|
|
40
|
+
base: {
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
pointerEvents: 'none',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
const hiddenSelectInputStencil = createStencil({
|
|
46
|
+
base: {
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
top: system.space.zero,
|
|
49
|
+
bottom: system.space.zero,
|
|
50
|
+
left: system.space.zero,
|
|
51
|
+
right: system.space.zero,
|
|
52
|
+
opacity: 0,
|
|
53
|
+
cursor: 'default',
|
|
54
|
+
pointerEvents: 'none',
|
|
55
|
+
},
|
|
46
56
|
});
|
|
47
57
|
|
|
48
58
|
export const SelectInput = createSubcomponent(TextInput)({
|
|
@@ -69,9 +79,9 @@ export const SelectInput = createSubcomponent(TextInput)({
|
|
|
69
79
|
model
|
|
70
80
|
) => {
|
|
71
81
|
return (
|
|
72
|
-
<InputGroup
|
|
82
|
+
<InputGroup data-width="ck-formfield-width">
|
|
73
83
|
{inputStartIcon && model.state.selectedIds.length > 0 && (
|
|
74
|
-
<InputGroup.InnerStart
|
|
84
|
+
<InputGroup.InnerStart {...selectIconsStencil()}>
|
|
75
85
|
<SystemIcon icon={inputStartIcon} />
|
|
76
86
|
</InputGroup.InnerStart>
|
|
77
87
|
)}
|
|
@@ -79,7 +89,6 @@ export const SelectInput = createSubcomponent(TextInput)({
|
|
|
79
89
|
<InputGroup.Input
|
|
80
90
|
error={error}
|
|
81
91
|
disabled={disabled}
|
|
82
|
-
className={hiddenSelectStyles}
|
|
83
92
|
tabIndex={-1}
|
|
84
93
|
aria-hidden={true}
|
|
85
94
|
onChange={onChange}
|
|
@@ -88,6 +97,7 @@ export const SelectInput = createSubcomponent(TextInput)({
|
|
|
88
97
|
onFocus={onFocus}
|
|
89
98
|
name={name}
|
|
90
99
|
ref={ref}
|
|
100
|
+
{...hiddenSelectInputStencil()}
|
|
91
101
|
/>
|
|
92
102
|
{/* Visual input */}
|
|
93
103
|
<InputGroup.Input
|
|
@@ -96,9 +106,9 @@ export const SelectInput = createSubcomponent(TextInput)({
|
|
|
96
106
|
placeholder={placeholder}
|
|
97
107
|
error={error}
|
|
98
108
|
{...textInputProps}
|
|
99
|
-
{...mergeStyles(elemProps,
|
|
109
|
+
{...mergeStyles(elemProps, selectInputStencil())}
|
|
100
110
|
/>
|
|
101
|
-
<InputGroup.InnerEnd
|
|
111
|
+
<InputGroup.InnerEnd {...selectIconsStencil()}>
|
|
102
112
|
<SystemIcon icon={caretDownSmallIcon} />
|
|
103
113
|
</InputGroup.InnerEnd>
|
|
104
114
|
</InputGroup>
|
|
@@ -119,12 +129,16 @@ export const SelectItem = createSubcomponent('li')({
|
|
|
119
129
|
);
|
|
120
130
|
});
|
|
121
131
|
|
|
132
|
+
const selectCardStyles = createStyles({
|
|
133
|
+
maxHeight: px2rem(300),
|
|
134
|
+
});
|
|
135
|
+
|
|
122
136
|
export const SelectCard = createSubcomponent('div')({
|
|
123
137
|
modelHook: useSelectModel,
|
|
124
138
|
elemPropsHook: useSelectCard,
|
|
125
139
|
})<ExtractProps<typeof Combobox.Menu.Card>>(({children, ...elemProps}, Element) => {
|
|
126
140
|
return (
|
|
127
|
-
<Combobox.Menu.Card
|
|
141
|
+
<Combobox.Menu.Card as={Element} {...mergeStyles(elemProps, selectCardStyles)}>
|
|
128
142
|
{children}
|
|
129
143
|
</Combobox.Menu.Card>
|
|
130
144
|
);
|