@headless-adminapp/fluent 0.0.17-alpha.37 → 0.0.17-alpha.39

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.
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ interface GridHeaderMobileProps {
3
+ }
4
+ export declare const GridHeaderMobile: FC<GridHeaderMobileProps>;
5
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GridHeaderMobile = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
7
+ const locale_1 = require("@headless-adminapp/app/locale");
8
+ const icons_1 = require("@headless-adminapp/icons");
9
+ const AppStringContext_1 = require("../App/AppStringContext");
10
+ const GridHeaderMobile = () => {
11
+ const viewLookup = (0, hooks_1.useGridViewLookupData)();
12
+ const selectedView = (0, hooks_1.useSelectedView)();
13
+ const changeView = (0, hooks_1.useChangeView)();
14
+ const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
15
+ const { language } = (0, locale_1.useLocale)();
16
+ const appStrings = (0, AppStringContext_1.useAppStrings)();
17
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
18
+ alignItems: 'center',
19
+ paddingInline: 8,
20
+ gap: 8,
21
+ display: 'flex',
22
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { alignItems: 'center', display: 'flex', gap: 16, flex: 1 }, children: (0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value), style: { flex: 1 } }) }), (0, jsx_runtime_1.jsx)("div", { style: {
23
+ alignItems: 'center',
24
+ gap: 16,
25
+ justifyContent: 'space-between',
26
+ display: 'flex',
27
+ }, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, {}), iconPosition: "after" }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => {
28
+ var _a, _b;
29
+ return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), icon: selectedView.id === view.id ? ((0, jsx_runtime_1.jsx)(icons_1.Icons.Checkmark, {})) : undefined, children: (_b = (_a = view.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : view.name }, view.id));
30
+ }) }) })] }) })] }));
31
+ };
32
+ exports.GridHeaderMobile = GridHeaderMobile;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ interface GridListContainerProps {
3
+ disableSelection?: boolean;
4
+ disableContextMenu?: boolean;
5
+ disableColumnResize?: boolean;
6
+ disableColumnSort?: boolean;
7
+ disableColumnReorder?: boolean;
8
+ disableColumnFilter?: boolean;
9
+ noPadding?: boolean;
10
+ }
11
+ export declare const GridListContainer: FC<GridListContainerProps>;
12
+ export {};
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GridListContainer = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const datagrid_1 = require("@headless-adminapp/app/datagrid");
7
+ const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
8
+ const locale_1 = require("@headless-adminapp/app/locale");
9
+ const mutable_1 = require("@headless-adminapp/app/mutable");
10
+ const navigation_1 = require("@headless-adminapp/app/navigation");
11
+ const hooks_2 = require("@headless-adminapp/app/recordset/hooks");
12
+ const react_virtual_1 = require("@tanstack/react-virtual");
13
+ const react_1 = require("react");
14
+ const uuid_1 = require("uuid");
15
+ const RecordCard_1 = require("../PageEntityForm/RecordCard");
16
+ const RecordCardLoading_1 = require("../PageEntityForm/RecordCardLoading");
17
+ const ScrollbarWithMoreDataRequest_1 = require("./ScrollbarWithMoreDataRequest");
18
+ const useStyles = (0, react_components_1.makeStyles)({
19
+ root: {
20
+ '&:hover': {
21
+ background: react_components_1.tokens.colorNeutralBackground1Hover,
22
+ },
23
+ },
24
+ });
25
+ const fallbackData = [];
26
+ const GridListContainer = ({}) => {
27
+ const styles = useStyles();
28
+ const data = (0, hooks_1.useGridData)();
29
+ const dataState = (0, hooks_1.useGridDataState)();
30
+ const fetchNextPage = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.fetchNextPage);
31
+ const schema = (0, hooks_1.useDataGridSchema)();
32
+ const view = (0, hooks_1.useSelectedView)();
33
+ const tableWrapperRef = (0, react_1.useRef)(null);
34
+ const { direction } = (0, locale_1.useLocale)();
35
+ const dataRef = (0, react_1.useRef)(data);
36
+ dataRef.current = data;
37
+ const uniqueRecords = (0, react_1.useMemo)(() => {
38
+ var _a;
39
+ return ((_a = data === null || data === void 0 ? void 0 : data.records.map((record) => (Object.assign(Object.assign({}, record), { __uuid: (0, uuid_1.v4)() })))) !== null && _a !== void 0 ? _a : fallbackData);
40
+ }, [data === null || data === void 0 ? void 0 : data.records]);
41
+ const rows = uniqueRecords;
42
+ const virtualizer = (0, react_virtual_1.useVirtualizer)({
43
+ count: rows.length,
44
+ getScrollElement: () => { var _a, _b; return (_b = (_a = tableWrapperRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement; },
45
+ estimateSize: () => 40,
46
+ overscan: 5,
47
+ enabled: true,
48
+ });
49
+ const virtualItems = virtualizer.getVirtualItems();
50
+ const virtualSize = virtualizer.getTotalSize();
51
+ const recordSetSetter = (0, hooks_2.useRecordSetSetter)();
52
+ const openFormInternal = (0, navigation_1.useOpenForm)();
53
+ const openRecord = (0, react_1.useCallback)((id) => {
54
+ var _a, _b;
55
+ recordSetSetter(schema.logicalName, (_b = (_a = dataRef.current) === null || _a === void 0 ? void 0 : _a.records.map((x) => x[schema.idAttribute])) !== null && _b !== void 0 ? _b : []);
56
+ openFormInternal({
57
+ logicalName: schema.logicalName,
58
+ id,
59
+ });
60
+ }, [openFormInternal, recordSetSetter, schema.idAttribute, schema.logicalName]);
61
+ return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data === null || data === void 0 ? void 0 : data.records, hasMore: dataState === null || dataState === void 0 ? void 0 : dataState.hasNextPage, rtl: direction === 'rtl', onRequestMore: () => {
62
+ fetchNextPage();
63
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
64
+ position: 'relative',
65
+ }, ref: tableWrapperRef, children: (0, jsx_runtime_1.jsxs)("div", { style: {
66
+ display: 'flex',
67
+ flexDirection: 'column',
68
+ width: '100%',
69
+ height: virtualizer.getTotalSize(),
70
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
71
+ display: 'flex',
72
+ flexDirection: 'column',
73
+ }, children: virtualItems.map((virtualRow) => {
74
+ const row = rows[virtualRow.index];
75
+ return ((0, jsx_runtime_1.jsx)("div", { ref: virtualizer.measureElement, "data-index": virtualRow.index, className: (0, react_components_1.mergeClasses)(styles.root), style: {
76
+ width: '100%',
77
+ position: 'absolute',
78
+ transform: `translateY(${virtualRow.start}px)`,
79
+ }, onClick: () => {
80
+ const id = row[schema.idAttribute];
81
+ openRecord(id);
82
+ }, children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view.experience.card, record: row, schema: schema, selected: false }) }, virtualRow.key));
83
+ }) }), dataState.isFetching && ((0, jsx_runtime_1.jsx)("div", { style: {
84
+ display: 'flex',
85
+ flexDirection: 'column',
86
+ width: '100%',
87
+ position: 'absolute',
88
+ transform: `translateY(${virtualSize}px)`,
89
+ }, children: Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)(RecordCardLoading_1.RecordCardLoading, { cardView: view.experience.card, schema: schema }, index))) }))] }) }) }) }));
90
+ };
91
+ exports.GridListContainer = GridListContainer;
@@ -4,5 +4,6 @@ export interface TableCellLinkProps {
4
4
  href?: string;
5
5
  onClick?: () => void;
6
6
  width: number;
7
+ target?: string;
7
8
  }
8
9
  export declare const TableCellLink: FC<TableCellLinkProps>;
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const hooks_1 = require("@headless-adminapp/app/route/hooks");
7
7
  const react_1 = require("react");
8
- exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width }) => {
8
+ exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width, target }) => {
9
9
  const router = (0, hooks_1.useRouter)();
10
10
  return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: {
11
11
  textOverflow: 'ellipsis',
@@ -16,7 +16,10 @@ exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width }) => {
16
16
  maxWidth: width,
17
17
  display: 'flex',
18
18
  alignItems: 'center',
19
- }, children: (0, jsx_runtime_1.jsx)(react_components_1.Link, { as: "a", href: href, onClick: (event) => {
19
+ }, children: (0, jsx_runtime_1.jsx)(react_components_1.Link, { as: "a", href: href, target: target, onClick: (event) => {
20
+ if (target === '_blank') {
21
+ return;
22
+ }
20
23
  if (event.metaKey || event.ctrlKey) {
21
24
  return;
22
25
  }
@@ -45,7 +45,7 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
45
45
  const isSubgrid = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.isSubGrid);
46
46
  const contextCommands = isSubgrid
47
47
  ? // eslint-disable-next-line react-hooks/rules-of-hooks
48
- (0, hooks_1.useSubGridCommands)()
48
+ (0, hooks_1.useSubGridContextCommands)()
49
49
  : // eslint-disable-next-line react-hooks/rules-of-hooks
50
50
  (0, hooks_1.useMainGridContextCommands)();
51
51
  const mutableContextCommandState = (0, mutable_1.useMutableState)(contextCommands, true);
@@ -241,6 +241,12 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
241
241
  recordSetSetter('', []);
242
242
  router.push(path);
243
243
  } }, column.id));
244
+ case 'attachment':
245
+ const url = value === null || value === void 0 ? void 0 : value.url;
246
+ if (!url) {
247
+ return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: "", width: info.column.getSize() }, column.id));
248
+ }
249
+ return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: formattedValue, width: info.column.getSize(), href: url, target: "_blank" }, column.id));
244
250
  }
245
251
  return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: formattedValue, width: info.column.getSize() }, column.id));
246
252
  },
@@ -20,6 +20,9 @@ function WidgetDataGridContainer({ content, }) {
20
20
  if (!view) {
21
21
  return (0, jsx_runtime_1.jsx)("div", { children: "Loading..." });
22
22
  }
23
+ if (!schema) {
24
+ return (0, jsx_runtime_1.jsx)("div", { children: "Schema not found" });
25
+ }
23
26
  return ((0, jsx_runtime_1.jsx)("div", { style: {
24
27
  display: 'flex',
25
28
  flex: 1,
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Widgets = Widgets;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const hooks_1 = require("@headless-adminapp/app/hooks");
5
6
  const insights_1 = require("@headless-adminapp/app/insights");
6
7
  const mutable_1 = require("@headless-adminapp/app/mutable");
7
8
  const widget_1 = require("@headless-adminapp/app/widget");
@@ -25,8 +26,9 @@ const WidgetProvider = ({ children, widget, }) => {
25
26
  return ((0, jsx_runtime_1.jsx)(widget_1.WidgetContext.Provider, { value: contextValue, children: children }));
26
27
  };
27
28
  function Widgets({ widgets, }) {
29
+ const isMobile = (0, hooks_1.useIsMobile)();
28
30
  return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGrid, { children: widgets.map((widget, index) => {
29
- return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGridItem, { row: widget.rows, column: widget.columns, children: (0, jsx_runtime_1.jsx)(WidgetProvider, { widget: widget, children: (0, jsx_runtime_1.jsx)(WidgetItem, {}) }) }, index));
31
+ return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGridItem, { row: widget.rows, column: isMobile ? 12 : widget.columns, children: (0, jsx_runtime_1.jsx)(WidgetProvider, { widget: widget, children: (0, jsx_runtime_1.jsx)(WidgetItem, {}) }) }, index));
30
32
  }) }));
31
33
  }
32
34
  function WidgetItem() {
@@ -52,7 +52,7 @@ function RecordCard({ schema, cardView, record, selected, }) {
52
52
  display: 'flex',
53
53
  flexDirection: 'column',
54
54
  flex: 1,
55
- }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: _record[cardView.primaryColumn] }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((column) => {
55
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { wordBreak: 'break-all' }, children: _record[cardView.primaryColumn] }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((column) => {
56
56
  const value = _record[column.name];
57
57
  if (!value) {
58
58
  return null;
@@ -0,0 +1,8 @@
1
+ import { CardView } from '@headless-adminapp/core/experience/view';
2
+ import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
3
+ interface RecordCardLoadingProps<S extends SchemaAttributes = SchemaAttributes> {
4
+ schema: Schema<S>;
5
+ cardView: CardView<S>;
6
+ }
7
+ export declare function RecordCardLoading<S extends SchemaAttributes = SchemaAttributes>({ cardView }: RecordCardLoadingProps<S>): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordCardLoading = RecordCardLoading;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const useStyles = (0, react_components_1.makeStyles)({
7
+ root: {
8
+ width: '100%',
9
+ display: 'flex',
10
+ flexDirection: 'row',
11
+ paddingInline: react_components_1.tokens.spacingHorizontalL,
12
+ paddingBlock: react_components_1.tokens.spacingVerticalS,
13
+ gap: react_components_1.tokens.spacingHorizontalS,
14
+ },
15
+ });
16
+ function RecordCardLoading({ cardView }) {
17
+ var _a;
18
+ const styles = useStyles();
19
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, react_components_1.mergeClasses)(styles.root), children: [cardView.showAvatar && ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { color: "neutral", style: { cursor: 'pointer' } })), (0, jsx_runtime_1.jsxs)("div", { style: {
20
+ display: 'flex',
21
+ flexDirection: 'column',
22
+ flex: 1,
23
+ gap: react_components_1.tokens.spacingVerticalXXS,
24
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { paddingBlock: 2 }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16, style: { height: 16 } }) }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((_, index) => ((0, jsx_runtime_1.jsx)("div", { style: { paddingBlock: 2 }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16, style: { width: 160, height: 12 } }) }, index)))] })] }));
25
+ }
@@ -26,6 +26,7 @@ const SwitchControl_1 = require("../form/controls/SwitchControl");
26
26
  const TelephoneControl_1 = require("../form/controls/TelephoneControl");
27
27
  const TextAreaControl_1 = require("../form/controls/TextAreaControl");
28
28
  const TextControl_1 = require("../form/controls/TextControl");
29
+ const UrlControl_1 = require("../form/controls/UrlControl");
29
30
  const StandardControl = (props) => {
30
31
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
31
32
  const { attribute, label: _label, isError,
@@ -74,7 +75,7 @@ const StandardControl = (props) => {
74
75
  return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
75
76
  }
76
77
  case 'url': {
77
- const Control = (_e = componentStore_1.componentStore.getComponent('Form.UrlControl')) !== null && _e !== void 0 ? _e : TextControl_1.TextControl;
78
+ const Control = (_e = componentStore_1.componentStore.getComponent('Form.UrlControl')) !== null && _e !== void 0 ? _e : UrlControl_1.UrlControl;
78
79
  return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
79
80
  }
80
81
  case 'textarea': {
@@ -3,13 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PageEntityView = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const datagrid_1 = require("@headless-adminapp/app/datagrid");
6
+ const hooks_1 = require("@headless-adminapp/app/hooks");
6
7
  const PageEntityViewProvider_1 = require("@headless-adminapp/app/providers/PageEntityViewProvider");
7
8
  const icons_1 = require("@headless-adminapp/icons");
8
9
  const PageBroken_1 = require("../components/PageBroken");
9
10
  const PageLoading_1 = require("../components/PageLoading");
10
11
  const PageEntityViewDesktopContainer_1 = require("./PageEntityViewDesktopContainer");
12
+ const PageEntityViewMobileContainer_1 = require("./PageEntityViewMobileContainer");
11
13
  const PageEntityView = ({ logicalName, viewId, onChangeView, }) => {
12
14
  const result = (0, datagrid_1.useLoadMainGridPage)(logicalName, viewId);
15
+ const isMobile = (0, hooks_1.useIsMobile)();
13
16
  if (result.loading) {
14
17
  return (0, jsx_runtime_1.jsx)(PageLoading_1.PageLoading, {});
15
18
  }
@@ -17,6 +20,6 @@ const PageEntityView = ({ logicalName, viewId, onChangeView, }) => {
17
20
  return ((0, jsx_runtime_1.jsx)(PageBroken_1.PageBroken, { Icon: icons_1.Icons.Error, title: result.title, message: result.message }));
18
21
  }
19
22
  const { schema, commands, viewLookup, view } = result;
20
- return ((0, jsx_runtime_1.jsx)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: (0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainer, {}) }));
23
+ return ((0, jsx_runtime_1.jsx)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: isMobile ? ((0, jsx_runtime_1.jsx)(PageEntityViewMobileContainer_1.PageEntityViewMobileContainer, {})) : ((0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainer, {})) }));
21
24
  };
22
25
  exports.PageEntityView = PageEntityView;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const PageEntityViewMobileContainer: FC;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageEntityViewMobileContainer = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const CommandContainer_1 = require("../DataGrid/CommandContainer");
7
+ const GridHeaderMobile_1 = require("../DataGrid/GridHeaderMobile");
8
+ const GridListContainer_1 = require("../DataGrid/GridListContainer");
9
+ const GridPaginationContainer_1 = require("../DataGrid/GridPaginationContainer");
10
+ const PageEntityViewDesktopFrame_1 = require("./PageEntityViewDesktopFrame");
11
+ const PageEntityViewMobileContainer = () => {
12
+ return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PageEntityViewDesktopFrame_1.PageEntityViewDesktopFrame, { commandBar: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, {}), header: (0, jsx_runtime_1.jsx)(GridHeaderMobile_1.GridHeaderMobile, {}), content: (0, jsx_runtime_1.jsx)(GridListContainer_1.GridListContainer, {}), footer: (0, jsx_runtime_1.jsx)(GridPaginationContainer_1.GridPaginationContainer, {}) }) }));
13
+ };
14
+ exports.PageEntityViewMobileContainer = PageEntityViewMobileContainer;
@@ -2,4 +2,4 @@ import { ControlProps } from './types';
2
2
  export interface TelephoneControlProps extends ControlProps<string> {
3
3
  autoComplete?: string;
4
4
  }
5
- export declare function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, }: TelephoneControlProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, autoComplete, }: TelephoneControlProps): import("react/jsx-runtime").JSX.Element;
@@ -4,10 +4,10 @@ exports.TelephoneControl = TelephoneControl;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const icons_1 = require("@headless-adminapp/icons");
7
- function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, }) {
7
+ function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, autoComplete, }) {
8
8
  return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "tel", placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
9
9
  // invalid={error}
10
- disabled: disabled, autoComplete: autoComplete, style: {
10
+ readOnly: disabled || readOnly, autoComplete: autoComplete, style: {
11
11
  width: '100%',
12
12
  paddingRight: react_components_1.tokens.spacingHorizontalXS,
13
13
  },
@@ -3,4 +3,4 @@ export interface TextAreaControlProps extends ControlProps<string> {
3
3
  rows?: number;
4
4
  textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
5
5
  }
6
- export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, rows, textTransform, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows, textTransform, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TextAreaControl = TextAreaControl;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
- function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, rows = 5, textTransform, }) {
6
+ function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows = 5, textTransform, }) {
7
7
  return ((0, jsx_runtime_1.jsx)(react_components_1.Textarea, { placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => {
8
8
  textTransform === 'uppercase'
9
9
  ? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toUpperCase())
@@ -12,5 +12,5 @@ function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFoc
12
12
  : onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
13
13
  }, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
14
14
  // error={error}
15
- disabled: disabled, rows: rows }));
15
+ readOnly: disabled || readOnly, rows: rows }));
16
16
  }
@@ -0,0 +1,4 @@
1
+ import { ControlProps } from './types';
2
+ export interface UrlControlProps extends ControlProps<string> {
3
+ }
4
+ export declare function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }: UrlControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UrlControl = UrlControl;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const icons_1 = require("@headless-adminapp/icons");
7
+ function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
8
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "url", placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
9
+ // invalid={error}
10
+ readOnly: disabled || readOnly, autoComplete: "off", style: {
11
+ width: '100%',
12
+ paddingRight: react_components_1.tokens.spacingHorizontalXS,
13
+ },
14
+ // size="sm"
15
+ contentAfter: !!value ? ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", size: "small", onClick: () => window.open(value, '_blank'), icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.OpenInNew, {}) })) : undefined }));
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/fluent",
3
- "version": "0.0.17-alpha.37",
3
+ "version": "0.0.17-alpha.39",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -48,5 +48,5 @@
48
48
  "uuid": "11.0.3",
49
49
  "yup": "^1.4.0"
50
50
  },
51
- "gitHead": "2a9d7f74b4685eb5c823ad55f83c16f3ff912e21"
51
+ "gitHead": "2bfa7d267f5fa6beb476fda508c43661444dc894"
52
52
  }
package/types/index.d.ts CHANGED
@@ -39,6 +39,7 @@ declare module '@headless-adminapp/icons/types' {
39
39
  Copy: Icon;
40
40
  Document: Icon;
41
41
  Image: Icon;
42
+ Checkmark: Icon;
42
43
  }
43
44
  }
44
45
  export {};