Skip to content

Commit b77a25e

Browse files
authored
feat: add base select component (#1422)
* working * working * working * initial review iteration * add styled select * respond to feedback * respond to feedback & tweaks * respond to feedback * tweak verbage, add tests * add ltr support to select option, add outline to multiselect & tweaks * respond to feedback * fix some schema issues, fix autofocus behavior * cleanup some duplicate code, tweak some code comments * remove commented out code * use svg glyph for down arrow, style tweaks * respond to feedback * fix id names
1 parent 6fdd98c commit b77a25e

File tree

39 files changed

+2143
-11
lines changed

39 files changed

+2143
-11
lines changed

packages/fast-components-class-name-contracts-base/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export * from "./number-field";
1717
export * from "./managed-classes";
1818
export * from "./progress";
1919
export * from "./radio";
20+
export * from "./select";
2021
export * from "./tabs";
2122
export * from "./text-area";
2223
export * from "./text-field";

packages/fast-components-class-name-contracts-base/src/listbox-item/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ export interface ListboxItemClassNameContract {
1111
* The disabled modifier
1212
*/
1313
listboxItem__disabled?: string;
14+
15+
/**
16+
* The selected modifier
17+
*/
18+
listboxItem__selected?: string;
1419
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* The class name contract for the select component
3+
*/
4+
export interface SelectClassNameContract {
5+
/**
6+
* The root of the select component
7+
*/
8+
select?: string;
9+
10+
/**
11+
* The disabled modifier
12+
*/
13+
select__disabled?: string;
14+
15+
/**
16+
* The menu of the select component
17+
*/
18+
select_menu?: string;
19+
20+
/**
21+
* The menu open modifier
22+
*/
23+
select_menu__open?: string;
24+
25+
/**
26+
* The multi select modifier
27+
*/
28+
select__multiSelectable?: string;
29+
}

packages/fast-components-class-name-contracts-msft/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ export * from "./metatext";
1313
export * from "./paragraph";
1414
export * from "./pivot";
1515
export * from "./progress";
16+
export * from "./select";
17+
export * from "./select-option";
1618
export * from "./subheading";
1719
export * from "./text-action";
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { ListboxItemClassNameContract as BaseListboxItemClassNameContract } from "@microsoft/fast-components-class-name-contracts-base";
2+
3+
/**
4+
* The class name contract for the context menu item component
5+
*/
6+
export interface SelectOptionClassNameContract extends BaseListboxItemClassNameContract {
7+
/**
8+
* The root of the select option component
9+
*/
10+
selectOption?: string;
11+
12+
/**
13+
* The disabled modifier
14+
*/
15+
selectOption__disabled?: string;
16+
17+
/**
18+
* The selected modifier
19+
*/
20+
selectOption__selected?: string;
21+
22+
/**
23+
* Select option content region
24+
*/
25+
selectOption_contentRegion?: string;
26+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { SelectClassNameContract as BaseSelectClassNameContract } from "@microsoft/fast-components-class-name-contracts-base";
2+
3+
/**
4+
* The class name contract for the select component
5+
*/
6+
export interface SelectClassNameContract extends BaseSelectClassNameContract {
7+
/**
8+
* The glyph shown in the select toggle button
9+
*/
10+
select_toggleGlyph?: string;
11+
}

packages/fast-components-react-base/app/examples.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ export { ProgressExamples };
5252
import RadioExamples from "../src/radio/examples.data";
5353
export { RadioExamples };
5454

55+
import SelectExamples from "../src/select/examples.data";
56+
export { SelectExamples };
57+
5558
import TabsExamples from "../src/tabs/examples.data";
5659
export { TabsExamples };
5760

packages/fast-components-react-base/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ import Radio from "./radio";
7070
export { Radio };
7171
export * from "./radio";
7272

73+
import Select from "./select";
74+
export { Select };
75+
export * from "./select";
76+
7377
import Tabs from "./tabs";
7478
export { Tabs };
7579
export * from "./tabs";

packages/fast-components-react-base/src/listbox-item/examples.data.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import Documentation from "./.tmp/documentation";
99

1010
const managedClasses: ListboxItemManagedClasses = {
1111
managedClasses: {
12-
listboxItem: "listbox-item",
12+
listboxItem: "listboxItem",
13+
listboxItem__disabled: "listboxItem__disabled",
14+
listboxItem__selected: "listboxItem__selected",
1315
},
1416
};
1517

packages/fast-components-react-base/src/listbox-item/listbox-item.schema.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
"text"
3131
]
3232
}
33-
}
33+
},
34+
"required": [
35+
"id",
36+
"value"
37+
]
3438
}
3539

0 commit comments

Comments
 (0)