|
8 | 8 | 'DividerT', 'Divider', 'DividerSplit', 'DividerLine', 'Article', 'ArticleTitle', 'ArticleMeta', 'SectionT',
|
9 | 9 | 'Section', 'Form', 'Fieldset', 'Legend', 'Input', 'Radio', 'CheckboxX', 'Range', 'TextArea', 'Switch',
|
10 | 10 | 'Upload', 'UploadZone', 'FormLabel', 'LabelT', 'Label', 'UkFormSection', 'GenericLabelInput', 'LabelInput',
|
11 |
| - 'LabelTextArea', 'LabelSwitch', 'LabelRadio', 'LabelCheckboxX', 'Options', 'Select', 'LabelRange', 'AT', |
12 |
| - 'ListT', 'ModalContainer', 'ModalDialog', 'ModalHeader', 'ModalBody', 'ModalFooter', 'ModalTitle', |
13 |
| - 'ModalCloseButton', 'Modal', 'Placeholder', 'Progress', 'UkIcon', 'UkIconLink', 'DiceBearAvatar', 'Center', |
14 |
| - 'FlexT', 'Grid', 'DivFullySpaced', 'DivCentered', 'DivLAligned', 'DivRAligned', 'DivVStacked', 'DivHStacked', |
15 |
| - 'NavT', 'NavContainer', 'NavParentLi', 'NavDividerLi', 'NavHeaderLi', 'NavSubtitle', 'NavCloseLi', |
16 |
| - 'ScrollspyT', 'NavBar', 'SliderContainer', 'SliderItems', 'SliderNav', 'Slider', 'DropDownNavContainer', |
17 |
| - 'TabContainer', 'CardT', 'CardTitle', 'CardHeader', 'CardBody', 'CardFooter', 'CardContainer', 'Card', |
18 |
| - 'TableT', 'Table', 'Td', 'Th', 'Tbody', 'TableFromLists', 'TableFromDicts', 'apply_classes', 'render_md', |
19 |
| - 'get_franken_renderer', 'ThemePicker', 'LightboxContainer', 'LightboxItem'] |
| 11 | + 'LabelTextArea', 'LabelSwitch', 'LabelRadio', 'LabelCheckboxX', 'Options', 'Select', 'LabelSelect', |
| 12 | + 'LabelRange', 'AT', 'ListT', 'ModalContainer', 'ModalDialog', 'ModalHeader', 'ModalBody', 'ModalFooter', |
| 13 | + 'ModalTitle', 'ModalCloseButton', 'Modal', 'Placeholder', 'Progress', 'UkIcon', 'UkIconLink', |
| 14 | + 'DiceBearAvatar', 'Center', 'FlexT', 'Grid', 'DivFullySpaced', 'DivCentered', 'DivLAligned', 'DivRAligned', |
| 15 | + 'DivVStacked', 'DivHStacked', 'NavT', 'NavContainer', 'NavParentLi', 'NavDividerLi', 'NavHeaderLi', |
| 16 | + 'NavSubtitle', 'NavCloseLi', 'ScrollspyT', 'NavBar', 'SliderContainer', 'SliderItems', 'SliderNav', 'Slider', |
| 17 | + 'DropDownNavContainer', 'TabContainer', 'CardT', 'CardTitle', 'CardHeader', 'CardBody', 'CardFooter', |
| 18 | + 'CardContainer', 'Card', 'TableT', 'Table', 'Td', 'Th', 'Tbody', 'TableFromLists', 'TableFromDicts', |
| 19 | + 'apply_classes', 'render_md', 'get_franken_renderer', 'ThemePicker', 'LightboxContainer', 'LightboxItem'] |
20 | 20 |
|
21 | 21 | # %% ../nbs/02_franken.ipynb
|
22 | 22 | import fasthtml.common as fh
|
@@ -807,6 +807,27 @@ def Select(*option, # Options for the select dropdown (can use `Optio
|
807 | 807 |
|
808 | 808 | return Div(cls=cls)(uk_select)
|
809 | 809 |
|
| 810 | +# %% ../nbs/02_franken.ipynb |
| 811 | +def LabelSelect(*option, # Options for the select dropdown (can use `Options` helper function to create) |
| 812 | + label=(), # String or FT component for the label |
| 813 | + lbl_cls=(), # Additional classes for the label |
| 814 | + inp_cls=(), # Additional classes for the select input |
| 815 | + cls=('space-y-2',), # Classes for the outer div |
| 816 | + id="", # ID for the select input |
| 817 | + name="", # Name attribute for the select input |
| 818 | + placeholder="", # Placeholder text for the select input |
| 819 | + searchable=False, # Whether the select should be searchable |
| 820 | + select_kwargs=None, # Additional Arguments passed to Select |
| 821 | + **kwargs): # Additional arguments passed to Select |
| 822 | + "A FormLabel and Select pair that provides default spacing and links/names them based on id" |
| 823 | + lbl_cls, inp_cls, cls = map(stringify, (lbl_cls, inp_cls, cls)) |
| 824 | + select_kwargs = ifnone(select_kwargs, {}) |
| 825 | + if label: |
| 826 | + lbl = FormLabel(cls=f'{lbl_cls}', fr=id)(label) |
| 827 | + select = Select(*option, inp_cls=inp_cls, id=id, name=name if name else id, |
| 828 | + placeholder=placeholder, searchable=searchable, select_kwargs=select_kwargs, **kwargs) |
| 829 | + return Div(cls=cls)(lbl, select) if label else Div(cls=cls)(select) |
| 830 | + |
810 | 831 | # %% ../nbs/02_franken.ipynb
|
811 | 832 | @delegates(GenericLabelInput, but=['input_fn','cls'])
|
812 | 833 | def LabelRange(label:str|FT, # FormLabel content (often text)
|
|
0 commit comments