xmlui 0.7.26 → 0.7.27

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.
Files changed (47) hide show
  1. package/dist/{apiInterceptorWorker-BlvgbCSf.mjs → apiInterceptorWorker-Ca5HMlfW.mjs} +1 -1
  2. package/dist/{index-CWLnzVw7.mjs → index-BMOK5q0U.mjs} +8338 -8005
  3. package/dist/scripts/src/components/APICall/APICall.js +63 -28
  4. package/dist/scripts/src/components/Accordion/Accordion.js +27 -7
  5. package/dist/scripts/src/components/Accordion/AccordionNative.js +9 -3
  6. package/dist/scripts/src/components/Alert/Alert.js +25 -6
  7. package/dist/scripts/src/components/App/App.js +48 -13
  8. package/dist/scripts/src/components/AppHeader/AppHeader.js +9 -2
  9. package/dist/scripts/src/components/AppState/AppState.js +14 -8
  10. package/dist/scripts/src/components/Avatar/Avatar.js +14 -3
  11. package/dist/scripts/src/components/Avatar/AvatarNative.js +5 -2
  12. package/dist/scripts/src/components/Backdrop/Backdrop.js +10 -2
  13. package/dist/scripts/src/components/Backdrop/BackdropNative.js +6 -2
  14. package/dist/scripts/src/components/Badge/Badge.js +17 -9
  15. package/dist/scripts/src/components/Badge/BadgeNative.js +6 -4
  16. package/dist/scripts/src/components/Bookmark/Bookmark.js +22 -9
  17. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +6 -2
  18. package/dist/scripts/src/components/ButtonGroup/ButtonGroup.js +22 -8
  19. package/dist/scripts/src/components/Card/Card.js +31 -10
  20. package/dist/scripts/src/components/Card/CardNative.js +6 -3
  21. package/dist/scripts/src/components/Carousel/Carousel.js +59 -12
  22. package/dist/scripts/src/components/Carousel/CarouselNative.js +13 -2
  23. package/dist/scripts/src/components/ChangeListener/ChangeListener.js +10 -3
  24. package/dist/scripts/src/components/ChangeListener/ChangeListenerNative.js +5 -1
  25. package/dist/scripts/src/components/Checkbox/Checkbox.js +8 -6
  26. package/dist/scripts/src/components/ColorPicker/ColorPicker.js +2 -2
  27. package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +8 -2
  28. package/dist/scripts/src/components/Column/Column.js +39 -17
  29. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +11 -3
  30. package/dist/scripts/src/components/ContentSeparator/ContentSeparatorNative.js +5 -2
  31. package/dist/scripts/src/components/DatePicker/DatePicker.js +42 -10
  32. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +67 -26
  33. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +51 -12
  34. package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +14 -3
  35. package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +10 -3
  36. package/dist/scripts/src/components/Switch/Switch.js +6 -6
  37. package/dist/scripts/src/components/Toggle/Toggle.js +10 -2
  38. package/dist/scripts/src/components/metadata-helpers.js +20 -8
  39. package/dist/scripts/src/components-core/loader/DataLoader.js +1 -1
  40. package/dist/scripts/src/components-core/utils/hooks.js +3 -0
  41. package/dist/scripts/src/components-core/utils/misc.js +3 -0
  42. package/dist/style.css +1 -1
  43. package/dist/xmlui-metadata.mjs +6560 -5279
  44. package/dist/xmlui-metadata.umd.js +17 -17
  45. package/dist/xmlui-standalone.umd.js +173 -173
  46. package/dist/xmlui.mjs +1 -1
  47. package/package.json +1 -1
@@ -16,16 +16,37 @@ const COMP = "Card";
16
16
  exports.CardMd = (0, ComponentDefs_1.createMetadata)({
17
17
  description: `The \`${COMP}\` component is a container for cohesive elements, often rendered visually as a card.`,
18
18
  props: {
19
- avatarUrl: (0, ComponentDefs_1.d)(`Show the avatar (\`true\`) or not (\`false\`). If not specified, the ${COMP} will show the ` +
20
- `first letters of the [\`title\`](#title).`),
21
- showAvatar: (0, ComponentDefs_1.d)(`Indicates whether the ${COMP} should be displayed`, null, "boolean"),
22
- title: (0, ComponentDefs_1.d)(`This prop sets the prestyled title.`),
23
- subtitle: (0, ComponentDefs_1.d)(`This prop sets the prestyled subtitle.`),
24
- linkTo: (0, ComponentDefs_1.d)(`This property wraps the title in a \`Link\` component that is clickable to navigate.`),
25
- orientation: (0, ComponentDefs_1.d)(`An optional property that governs the ${COMP}'s orientation ` +
26
- `(whether the ${COMP} lays out its children in a row or a column). ` +
27
- `If the orientation is set to \`horizontal\`, the ${COMP} will display ` +
28
- `its children in a row, except for its [\`title\`](#title) and [\`subtitle\`](#subtitle).`, abstractions_1.orientationOptionMd, "string", CardNative_1.DEFAULT_ORIENTATION),
19
+ avatarUrl: {
20
+ description: `Show the avatar (\`true\`) or not (\`false\`). If not specified, the ${COMP} will show the ` +
21
+ `first letters of the [\`title\`](#title).`,
22
+ type: "string",
23
+ },
24
+ showAvatar: {
25
+ description: `Indicates whether the ${COMP} should be displayed`,
26
+ valueType: "boolean",
27
+ defaultValue: CardNative_1.defaultProps.showAvatar,
28
+ },
29
+ title: {
30
+ description: `This prop sets the prestyled title.`,
31
+ valueType: "string",
32
+ },
33
+ subtitle: {
34
+ description: `This prop sets the prestyled subtitle.`,
35
+ valueType: "string",
36
+ },
37
+ linkTo: {
38
+ description: `This property wraps the title in a \`Link\` component that is clickable to navigate.`,
39
+ valueType: "string",
40
+ },
41
+ orientation: {
42
+ description: `An optional property that governs the ${COMP}'s orientation ` +
43
+ `(whether the ${COMP} lays out its children in a row or a column). ` +
44
+ `If the orientation is set to \`horizontal\`, the ${COMP} will display ` +
45
+ `its children in a row, except for its [\`title\`](#title) and [\`subtitle\`](#subtitle).`,
46
+ availableValues: abstractions_1.orientationOptionMd,
47
+ valueType: "string",
48
+ defaultValue: CardNative_1.defaultProps.orientation,
49
+ },
29
50
  },
30
51
  events: {
31
52
  click: (0, metadata_helpers_1.dClick)(COMP),
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Card = exports.DEFAULT_ORIENTATION = void 0;
6
+ exports.Card = exports.defaultProps = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const classnames_1 = __importDefault(require("classnames"));
@@ -13,8 +13,11 @@ const LinkNative_1 = require("../Link/LinkNative");
13
13
  const HeadingNative_1 = require("../Heading/HeadingNative");
14
14
  const StackNative_1 = require("../Stack/StackNative");
15
15
  const TextNative_1 = require("../Text/TextNative");
16
- exports.DEFAULT_ORIENTATION = "vertical";
17
- exports.Card = (0, react_1.forwardRef)(function Card({ children, orientation = exports.DEFAULT_ORIENTATION, style, title, subtitle, linkTo, avatarUrl, showAvatar = !!avatarUrl || false, onClick, }, forwardedRef) {
16
+ exports.defaultProps = {
17
+ orientation: "vertical",
18
+ showAvatar: false,
19
+ };
20
+ exports.Card = (0, react_1.forwardRef)(function Card({ children, orientation = exports.defaultProps.orientation, style, title, subtitle, linkTo, avatarUrl, showAvatar = !!avatarUrl || exports.defaultProps.showAvatar, onClick, }, forwardedRef) {
18
21
  const titleProps = {
19
22
  level: "h2",
20
23
  };
@@ -11,24 +11,71 @@ const renderers_1 = require("../../components-core/renderers");
11
11
  const themeVars_1 = require("../../components-core/theming/themeVars");
12
12
  const metadata_helpers_1 = require("../metadata-helpers");
13
13
  const CarouselNative_1 = require("./CarouselNative");
14
+ const abstractions_1 = require("../abstractions");
14
15
  const COMP = "Carousel";
15
16
  exports.CarouselMd = (0, ComponentDefs_1.createMetadata)({
16
17
  status: "in progress",
17
18
  description: `This component displays a slideshow by cycling through elements (images, text, or ` +
18
19
  `custom slides) like a carousel.`,
19
20
  props: {
20
- orientation: (0, ComponentDefs_1.d)("This property indicates the orientation of the carousel. The `horizontal` value indicates that the carousel moves horizontally, and the `vertical` value indicates that the carousel moves vertically.", ["horizontal", "vertical"], null, "horizontal"),
21
- indicators: (0, ComponentDefs_1.d)("This property indicates whether the carousel displays the indicators.", null, null, "true"),
22
- controls: (0, ComponentDefs_1.d)("This property indicates whether the carousel displays the controls.", null, null, "true"),
23
- autoplay: (0, ComponentDefs_1.d)("This property indicates whether the carousel automatically scrolls.", null, null, "false"),
24
- loop: (0, ComponentDefs_1.d)("This property indicates whether the carousel loops.", null, null, "false"),
25
- startIndex: (0, ComponentDefs_1.d)("This property indicates the index of the first slide to display.", null, null, "0"),
26
- transitionDuration: (0, ComponentDefs_1.d)("This property specifies the duration of the transition between slides."),
27
- autoplayInterval: (0, ComponentDefs_1.d)("This property specifies the interval between autoplay transitions."),
28
- stopAutoplayOnInteraction: (0, ComponentDefs_1.d)("This property indicates whether autoplay stops on interaction."),
29
- prevIcon: (0, ComponentDefs_1.d)("This property specifies the icon to display for the previous control."),
30
- nextIcon: (0, ComponentDefs_1.d)("This property specifies the icon to display for the next control."),
31
- keyboard: (0, ComponentDefs_1.d)("This property indicates whether the carousel responds to keyboard events."),
21
+ orientation: {
22
+ description: "This property indicates the orientation of the carousel. The `horizontal` value indicates that the carousel moves horizontally, and the `vertical` value indicates that the carousel moves vertically.",
23
+ availableValues: abstractions_1.orientationOptionMd,
24
+ valueType: "string",
25
+ defaultValue: CarouselNative_1.defaultProps.orientation,
26
+ },
27
+ indicators: {
28
+ description: "This property indicates whether the carousel displays the indicators.",
29
+ valueType: "boolean",
30
+ defaultValue: CarouselNative_1.defaultProps.indicators,
31
+ },
32
+ controls: {
33
+ description: "This property indicates whether the carousel displays the controls.",
34
+ valueType: "boolean",
35
+ defaultValue: CarouselNative_1.defaultProps.controls,
36
+ },
37
+ autoplay: {
38
+ description: "This property indicates whether the carousel automatically scrolls.",
39
+ valueType: "boolean",
40
+ defaultValue: CarouselNative_1.defaultProps.autoplay,
41
+ },
42
+ loop: {
43
+ description: "This property indicates whether the carousel loops.",
44
+ valueType: "boolean",
45
+ defaultValue: CarouselNative_1.defaultProps.loop,
46
+ },
47
+ startIndex: {
48
+ description: "This property indicates the index of the first slide to display.",
49
+ valueType: "number",
50
+ defaultValue: CarouselNative_1.defaultProps.startIndex,
51
+ },
52
+ transitionDuration: {
53
+ description: "This property indicates the duration of the transition between slides.",
54
+ valueType: "number",
55
+ defaultValue: CarouselNative_1.defaultProps.transitionDuration,
56
+ },
57
+ autoplayInterval: {
58
+ description: "This property specifies the interval between autoplay transitions.",
59
+ valueType: "number",
60
+ defaultValue: CarouselNative_1.defaultProps.autoplayInterval,
61
+ },
62
+ stopAutoplayOnInteraction: {
63
+ description: "This property indicates whether autoplay stops on interaction.",
64
+ valueType: "boolean",
65
+ defaultValue: CarouselNative_1.defaultProps.stopAutoplayOnInteraction,
66
+ },
67
+ prevIcon: {
68
+ description: "This property specifies the icon to display for the previous control.",
69
+ valueType: "string",
70
+ },
71
+ nextIcon: {
72
+ description: "This property specifies the icon to display for the next control.",
73
+ valueType: "string",
74
+ },
75
+ keyboard: {
76
+ description: "This property indicates whether the carousel responds to keyboard events.",
77
+ valueType: "boolean",
78
+ },
32
79
  },
33
80
  events: {
34
81
  displayDidChange: (0, metadata_helpers_1.dDidChange)(COMP),
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.CarouselComponent = void 0;
39
+ exports.CarouselComponent = exports.defaultProps = void 0;
40
40
  const jsx_runtime_1 = require("react/jsx-runtime");
41
41
  const React = __importStar(require("react"));
42
42
  const react_1 = require("react");
@@ -48,7 +48,18 @@ const Carousel_module_scss_1 = __importDefault(require("./Carousel.module.scss")
48
48
  const constants_1 = require("../../components-core/constants");
49
49
  const CarouselContext_1 = require("./CarouselContext");
50
50
  const IconNative_1 = __importDefault(require("../Icon/IconNative"));
51
- exports.CarouselComponent = (0, react_1.forwardRef)(function CarouselComponent({ orientation = "horizontal", children, style, indicators = true, onDisplayDidChange = constants_1.noop, autoplay = false, controls = true, loop = false, startIndex = 0, prevIcon, nextIcon, transitionDuration = 25, autoplayInterval = 5000, stopAutoplayOnInteraction = true, registerComponentApi, }, forwardedRef) {
51
+ exports.defaultProps = {
52
+ orientation: "horizontal",
53
+ indicators: true,
54
+ autoplay: false,
55
+ controls: true,
56
+ loop: false,
57
+ startIndex: 0,
58
+ transitionDuration: 25,
59
+ autoplayInterval: 5000,
60
+ stopAutoplayOnInteraction: true,
61
+ };
62
+ exports.CarouselComponent = (0, react_1.forwardRef)(function CarouselComponent({ orientation = exports.defaultProps.orientation, children, style, indicators = exports.defaultProps.indicators, onDisplayDidChange = constants_1.noop, autoplay = exports.defaultProps.autoplay, controls = exports.defaultProps.controls, loop = exports.defaultProps.loop, startIndex = exports.defaultProps.startIndex, prevIcon, nextIcon, transitionDuration = exports.defaultProps.transitionDuration, autoplayInterval = exports.defaultProps.autoplayInterval, stopAutoplayOnInteraction = exports.defaultProps.stopAutoplayOnInteraction, registerComponentApi, }, forwardedRef) {
52
63
  const referenceElement = (0, react_1.useRef)(null);
53
64
  const [activeSlide, setActiveSlide] = (0, react_1.useState)(0);
54
65
  const [plugins, setPlugins] = (0, react_1.useState)([]);
@@ -11,9 +11,16 @@ exports.ChangeListenerMd = (0, ComponentDefs_1.createMetadata)({
11
11
  description: `\`${COMP}\` is a functional component (it renders no UI) to trigger an action when a ` +
12
12
  `particular value (component property, state, etc.) changes.`,
13
13
  props: {
14
- listenTo: (0, ComponentDefs_1.d)(`Value to the changes of which this component listens.`),
15
- throttleWaitInMs: (0, ComponentDefs_1.d)(`This variable sets a throttling time (in milliseconds) to apply when executing the \`didChange\` ` +
16
- `event handler. All changes within that throttling time will only fire the \`didChange\` event once.`),
14
+ listenTo: {
15
+ description: `Value to the changes of which this component listens.`,
16
+ valueType: "any",
17
+ },
18
+ throttleWaitInMs: {
19
+ description: `This variable sets a throttling time (in milliseconds) to apply when executing the \`didChange\` ` +
20
+ `event handler. All changes within that throttling time will only fire the \`didChange\` event once.`,
21
+ valueType: "number",
22
+ defaultValue: ChangeListenerNative_1.defaultProps.throttleWaitInMs,
23
+ },
17
24
  },
18
25
  events: {
19
26
  didChange: (0, metadata_helpers_1.dDidChange)(COMP),
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultProps = void 0;
3
4
  exports.ChangeListener = ChangeListener;
4
5
  const react_1 = require("react");
5
6
  const lodash_es_1 = require("lodash-es");
6
7
  const hooks_1 = require("../../components-core/utils/hooks");
7
- function ChangeListener({ listenTo, onChange, throttleWaitInMs = 0 }) {
8
+ exports.defaultProps = {
9
+ throttleWaitInMs: 0,
10
+ };
11
+ function ChangeListener({ listenTo, onChange, throttleWaitInMs = exports.defaultProps.throttleWaitInMs }) {
8
12
  const prevValue = (0, hooks_1.usePrevious)(listenTo);
9
13
  const throttledOnChange = (0, react_1.useMemo)(() => {
10
14
  if (throttleWaitInMs !== 0 && onChange) {
@@ -18,20 +18,22 @@ exports.CheckboxMd = (0, ComponentDefs_1.createMetadata)({
18
18
  description: `The \`${COMP}\` component allows users to make binary choices, typically between checked or ` +
19
19
  `unchecked. It consists of a small box that can be toggled on or off by clicking on it.`,
20
20
  props: {
21
- indeterminate: (0, metadata_helpers_1.dIndeterminate)(),
21
+ indeterminate: (0, metadata_helpers_1.dIndeterminate)(Toggle_1.defaultProps.indeterminate),
22
22
  label: (0, metadata_helpers_1.dLabel)(),
23
23
  labelPosition: (0, metadata_helpers_1.dLabelPosition)("end"),
24
24
  labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
25
25
  labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
26
26
  required: (0, metadata_helpers_1.dRequired)(),
27
- initialValue: (0, metadata_helpers_1.dInitialValue)(false),
27
+ initialValue: (0, metadata_helpers_1.dInitialValue)(Toggle_1.defaultProps.initialValue),
28
28
  autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
29
29
  readOnly: (0, metadata_helpers_1.dReadonly)(),
30
30
  enabled: (0, metadata_helpers_1.dEnabled)(),
31
- validationStatus: (0, metadata_helpers_1.dValidationStatus)(),
32
- description: (0, ComponentDefs_1.d)(`(*** NOT IMPLEMENTED YET ***) This optional property displays an alternate description ` +
31
+ validationStatus: (0, metadata_helpers_1.dValidationStatus)(Toggle_1.defaultProps.validationStatus),
32
+ description: (0, metadata_helpers_1.dInternal)(`(*** NOT IMPLEMENTED YET ***) This optional property displays an alternate description ` +
33
33
  `of the ${COMP} besides its label.`),
34
- inputTemplate: (0, ComponentDefs_1.d)("This property is used to define a custom checkbox input template"),
34
+ inputTemplate: {
35
+ description: "This property is used to define a custom checkbox input template",
36
+ },
35
37
  },
36
38
  events: {
37
39
  click: (0, metadata_helpers_1.dClick)(COMP),
@@ -70,5 +72,5 @@ exports.checkboxComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
70
72
  const inputTemplate = node.children || ((_a = node.props) === null || _a === void 0 ? void 0 : _a.inputTemplate);
71
73
  return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { inputRenderer: inputTemplate
72
74
  ? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
73
- : undefined, enabled: extractValue.asOptionalBoolean(node.props.enabled), style: layoutCss, initialValue: extractValue.asOptionalBoolean(node.props.initialValue, false), value: state === null || state === void 0 ? void 0 : state.value, readOnly: extractValue.asOptionalBoolean(node.props.readOnly), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), indeterminate: extractValue.asOptionalBoolean(node.props.indeterminate), registerComponentApi: registerComponentApi }));
75
+ : undefined, enabled: extractValue.asOptionalBoolean(node.props.enabled), style: layoutCss, initialValue: extractValue.asOptionalBoolean(node.props.initialValue, Toggle_1.defaultProps.initialValue), value: state === null || state === void 0 ? void 0 : state.value, readOnly: extractValue.asOptionalBoolean(node.props.readOnly), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), indeterminate: extractValue.asOptionalBoolean(node.props.indeterminate), registerComponentApi: registerComponentApi }));
74
76
  });
@@ -17,14 +17,14 @@ exports.ColorPickerMd = (0, ComponentDefs_1.createMetadata)({
17
17
  props: {
18
18
  initialValue: (0, metadata_helpers_1.dInitialValue)(),
19
19
  label: (0, metadata_helpers_1.dLabel)(),
20
- labelPosition: (0, metadata_helpers_1.dLabelPosition)("top"),
20
+ labelPosition: (0, metadata_helpers_1.dLabelPosition)(),
21
21
  labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
22
22
  labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
23
23
  enabled: (0, metadata_helpers_1.dEnabled)(),
24
24
  autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
25
25
  required: (0, metadata_helpers_1.dRequired)(),
26
26
  readOnly: (0, metadata_helpers_1.dReadonly)(),
27
- validationStatus: (0, metadata_helpers_1.dValidationStatus)(),
27
+ validationStatus: (0, metadata_helpers_1.dValidationStatus)(ColorPickerNative_1.defaultProps.validationStatus),
28
28
  },
29
29
  events: {
30
30
  didChange: (0, metadata_helpers_1.dDidChange)(COMP),
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ColorPicker = void 0;
6
+ exports.ColorPicker = exports.defaultProps = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const react_2 = require("react");
@@ -12,7 +12,13 @@ const constants_1 = require("../../components-core/constants");
12
12
  const misc_1 = require("../../components-core/utils/misc");
13
13
  const ColorPicker_module_scss_1 = __importDefault(require("./ColorPicker.module.scss"));
14
14
  const classnames_1 = __importDefault(require("classnames"));
15
- exports.ColorPicker = (0, react_2.forwardRef)(({ style, updateState, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, enabled = true, value = "", autoFocus, tabIndex = -1, label, labelPosition, labelWidth, labelBreak, required, validationStatus = "none", initialValue, }, forwardedRef) => {
15
+ exports.defaultProps = {
16
+ initialValue: "",
17
+ value: "",
18
+ enabled: true,
19
+ validationStatus: "none",
20
+ };
21
+ exports.ColorPicker = (0, react_2.forwardRef)(({ style, updateState, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, enabled = exports.defaultProps.enabled, value = exports.defaultProps.value, autoFocus, tabIndex = -1, label, labelPosition, labelWidth, labelBreak, required, validationStatus = exports.defaultProps.validationStatus, initialValue = exports.defaultProps.initialValue, }, forwardedRef) => {
16
22
  const inputRef = (0, react_2.useRef)(null);
17
23
  const updateValue = (0, react_2.useCallback)((value) => {
18
24
  updateState({ value });
@@ -12,23 +12,45 @@ exports.ColumnMd = (0, ComponentDefs_1.createMetadata)({
12
12
  props: {
13
13
  bindTo: {
14
14
  description: `Indicates what part of the data to lay out in the column.`,
15
- isRequired: true,
16
- },
17
- header: (0, ComponentDefs_1.d)(`Adds a label for a particular column.`),
18
- width: (0, ComponentDefs_1.d)(`This property defines the width of the column. You can use a numeric value, a pixel ` +
19
- `value (such as \`100px\`), or a star size value (such as \`*\`, \`2*\`, etc.). ` +
20
- `You will get an error if you use any other unit (or value).`),
21
- minWidth: (0, ComponentDefs_1.d)(`Indicates the minimum width a particular column can have.`),
22
- maxWidth: (0, ComponentDefs_1.d)(`Indicates the maximum width a particular column can have.`),
23
- canSort: (0, ComponentDefs_1.d)(`This property sets whether the user can sort by a column by clicking on its header ` +
24
- `(\`true\`) or not (\`false\`).`),
25
- pinTo: (0, ComponentDefs_1.d)(`This property allows the column to be pinned to ` +
26
- `the \`left\` (left-to-right writing style) or \`right\` (left-to-right writing style) edge ` +
27
- `of the table. If the writing style is right-to-left, the locations are switched.`, ["left", "right"], "string"),
28
- canResize: (0, ComponentDefs_1.d)(`This property indicates whether the user can resize the column. If set to ` +
29
- `\`true\`, the column can be resized by dragging the column border. If set to ` +
30
- `\`false\`, the column cannot be resized. Double-clicking the column border ` +
31
- `resets to the original size.`),
15
+ valueType: "string",
16
+ },
17
+ header: {
18
+ description: `Adds a label for a particular column.`,
19
+ valueType: "string",
20
+ },
21
+ width: {
22
+ description: `This property defines the width of the column. You can use a numeric value, a pixel ` +
23
+ `value (such as \`100px\`), or a star size value (such as \`*\`, \`2*\`, etc.). ` +
24
+ `You will get an error if you use any other unit (or value).`,
25
+ valueType: "any",
26
+ },
27
+ minWidth: {
28
+ description: `Indicates the minimum width a particular column can have. Same rules apply as with [width](#width).`,
29
+ valueType: "any",
30
+ },
31
+ maxWidth: {
32
+ description: `Indicates the maximum width a particular column can have. Same rules apply as with [width](#width).`,
33
+ valueType: "any",
34
+ },
35
+ canSort: {
36
+ description: `This property sets whether the user can sort by a column by clicking on its header ` +
37
+ `(\`true\`) or not (\`false\`).`,
38
+ valueType: "boolean",
39
+ },
40
+ pinTo: {
41
+ description: `This property allows the column to be pinned to ` +
42
+ `the \`left\` (left-to-right writing style) or \`right\` (left-to-right writing style) edge ` +
43
+ `of the table. If the writing style is right-to-left, the locations are switched.`,
44
+ availableValues: ["left", "right"],
45
+ valueType: "string",
46
+ },
47
+ canResize: {
48
+ description: `This property indicates whether the user can resize the column. If set to ` +
49
+ `\`true\`, the column can be resized by dragging the column border. If set to ` +
50
+ `\`false\`, the column cannot be resized. Double-clicking the column border ` +
51
+ `resets to the original size.`,
52
+ valueType: "boolean",
53
+ },
32
54
  },
33
55
  contextVars: {
34
56
  $item: {
@@ -17,9 +17,17 @@ exports.ContentSeparatorMd = (0, ComponentDefs_1.createMetadata)({
17
17
  `It serves as a visual cue to distinguish between different sections or groups of content, ` +
18
18
  `helping to improve readability and organization.`,
19
19
  props: {
20
- size: (0, ComponentDefs_1.d)(`This property defines the component's height (if the \`orientation\` is horizontal) ` +
21
- `or the width (if the \`orientation\` is vertical).`),
22
- orientation: (0, ComponentDefs_1.d)("Sets the main axis of the component", abstractions_1.orientationOptionMd),
20
+ size: {
21
+ description: `This property defines the component's height (if the \`orientation\` is horizontal) ` +
22
+ `or the width (if the \`orientation\` is vertical).`,
23
+ valueType: "any",
24
+ },
25
+ orientation: {
26
+ description: "Sets the main axis of the component",
27
+ availableValues: abstractions_1.orientationOptionMd,
28
+ defaultValue: ContentSeparatorNative_1.defaultProps.orientation,
29
+ valueType: "string",
30
+ },
23
31
  },
24
32
  themeVars: (0, themeVars_1.parseScssVar)(ContentSeparator_module_scss_1.default.themeVars),
25
33
  defaultThemeVars: {
@@ -3,11 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ContentSeparator = void 0;
6
+ exports.ContentSeparator = exports.defaultProps = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const classnames_1 = __importDefault(require("classnames"));
9
9
  const ContentSeparator_module_scss_1 = __importDefault(require("./ContentSeparator.module.scss"));
10
- const ContentSeparator = ({ orientation = "horizontal", size, style, }) => {
10
+ exports.defaultProps = {
11
+ orientation: "horizontal",
12
+ };
13
+ const ContentSeparator = ({ orientation = exports.defaultProps.orientation, size, style, }) => {
11
14
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(ContentSeparator_module_scss_1.default.separator, {
12
15
  [ContentSeparator_module_scss_1.default.horizontal]: orientation === "horizontal",
13
16
  [ContentSeparator_module_scss_1.default.vertical]: orientation === "vertical",
@@ -20,16 +20,48 @@ exports.DatePickerMd = (0, ComponentDefs_1.createMetadata)({
20
20
  initialValue: (0, metadata_helpers_1.dInitialValue)(),
21
21
  autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
22
22
  readOnly: (0, metadata_helpers_1.dReadonly)(),
23
- enabled: (0, metadata_helpers_1.dEnabled)(),
24
- validationStatus: (0, metadata_helpers_1.dValidationStatus)(),
25
- mode: (0, ComponentDefs_1.d)("The mode of the datepicker (single or range)"),
26
- dateFormat: (0, ComponentDefs_1.d)("The format of the date displayed in the input field"),
27
- showWeekNumber: (0, ComponentDefs_1.d)("Whether to show the week number in the calendar"),
28
- weekStartsOn: (0, ComponentDefs_1.d)("The first day of the week. 0 is Sunday, 1 is Monday, etc."),
29
- fromDate: (0, ComponentDefs_1.d)("The start date of the range of selectable dates"),
30
- toDate: (0, ComponentDefs_1.d)("The end date of the range of selectable dates"),
31
- disabledDates: (0, ComponentDefs_1.d)("An array of dates that are disabled"),
32
- inline: (0, ComponentDefs_1.d)("The datepicker is displayed inline"),
23
+ enabled: (0, metadata_helpers_1.dEnabled)(DatePickerNative_1.defaultProps.enabled),
24
+ validationStatus: (0, metadata_helpers_1.dValidationStatus)(DatePickerNative_1.defaultProps.validationStatus),
25
+ mode: {
26
+ description: "The mode of the datepicker (single or range)",
27
+ valueType: "string",
28
+ availableValues: DatePickerNative_1.DatePickerModeValues,
29
+ defaultValue: DatePickerNative_1.defaultProps.mode,
30
+ },
31
+ dateFormat: {
32
+ description: "The format of the date displayed in the input field",
33
+ valueType: "string",
34
+ defaultValue: DatePickerNative_1.defaultProps.dateFormat,
35
+ availableValues: DatePickerNative_1.dateFormats,
36
+ },
37
+ showWeekNumber: {
38
+ description: "Whether to show the week number in the calendar",
39
+ valueType: "boolean",
40
+ defaultValue: DatePickerNative_1.defaultProps.showWeekNumber,
41
+ },
42
+ weekStartsOn: {
43
+ description: "The first day of the week. 0 is Sunday, 1 is Monday, etc.",
44
+ valueType: "number",
45
+ defaultValue: DatePickerNative_1.defaultProps.weekStartsOn,
46
+ availableValues: DatePickerNative_1.weekDaysMd,
47
+ },
48
+ fromDate: {
49
+ description: "The start date of the range of selectable dates",
50
+ valueType: "string",
51
+ },
52
+ toDate: {
53
+ description: "The end date of the range of selectable dates",
54
+ valueType: "string",
55
+ },
56
+ disabledDates: {
57
+ description: "An array of dates that are disabled",
58
+ valueType: "any",
59
+ },
60
+ inline: {
61
+ description: "Whether to display the datepicker inline",
62
+ valueType: "boolean",
63
+ defaultValue: DatePickerNative_1.defaultProps.inline,
64
+ },
33
65
  startText: (0, metadata_helpers_1.dStartText)(),
34
66
  startIcon: (0, metadata_helpers_1.dStartIcon)(),
35
67
  endText: (0, metadata_helpers_1.dEndText)(),
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.DatePicker = void 0;
39
+ exports.DatePicker = exports.defaultProps = exports.dateFormats = exports.weekDaysMd = exports.DatePickerModeValues = void 0;
40
40
  const jsx_runtime_1 = require("react/jsx-runtime");
41
41
  const react_1 = require("react");
42
42
  const react_day_picker_1 = require("react-day-picker");
@@ -49,6 +49,7 @@ const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
49
49
  const constants_1 = require("../../components-core/constants");
50
50
  const misc_1 = require("../../components-core/utils/misc");
51
51
  const InputAdornment_1 = require("../Input/InputAdornment");
52
+ exports.DatePickerModeValues = ["single", "range"];
52
53
  var WeekDays;
53
54
  (function (WeekDays) {
54
55
  WeekDays[WeekDays["Sunday"] = 0] = "Sunday";
@@ -59,7 +60,38 @@ var WeekDays;
59
60
  WeekDays[WeekDays["Friday"] = 5] = "Friday";
60
61
  WeekDays[WeekDays["Saturday"] = 6] = "Saturday";
61
62
  })(WeekDays || (WeekDays = {}));
62
- const dateFormats = [
63
+ ;
64
+ exports.weekDaysMd = [
65
+ {
66
+ value: WeekDays.Sunday,
67
+ description: "Sunday",
68
+ },
69
+ {
70
+ value: WeekDays.Monday,
71
+ description: "Monday",
72
+ },
73
+ {
74
+ value: WeekDays.Tuesday,
75
+ description: "Tuesday",
76
+ },
77
+ {
78
+ value: WeekDays.Wednesday,
79
+ description: "Wednesday",
80
+ },
81
+ {
82
+ value: WeekDays.Thursday,
83
+ description: "Thursday",
84
+ },
85
+ {
86
+ value: WeekDays.Friday,
87
+ description: "Friday",
88
+ },
89
+ {
90
+ value: WeekDays.Saturday,
91
+ description: "Saturday",
92
+ },
93
+ ];
94
+ exports.dateFormats = [
63
95
  "MM/dd/yyyy",
64
96
  "MM-dd-yyyy",
65
97
  "yyyy/MM/dd",
@@ -69,29 +101,17 @@ const dateFormats = [
69
101
  "yyyyMMdd",
70
102
  "MMddyyyy",
71
103
  ];
72
- const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;
73
- const parseISODate = (dateString) => {
74
- if (dateString && isoRegex.test(dateString)) {
75
- const parsedDate = (0, date_fns_1.parseISO)(dateString);
76
- if ((0, date_fns_1.isValid)(parsedDate)) {
77
- return parsedDate;
78
- }
79
- }
80
- return undefined;
81
- };
82
- const parseDate = (dateString) => {
83
- if (dateString) {
84
- for (const format of dateFormats) {
85
- const parsedDate = (0, date_fns_1.parse)(dateString, format, new Date());
86
- if ((0, date_fns_1.isValid)(parsedDate)) {
87
- return parsedDate;
88
- }
89
- }
90
- }
91
- return undefined;
104
+ exports.defaultProps = {
105
+ mode: "single",
106
+ validationStatus: "none",
107
+ enabled: true,
108
+ inline: false,
109
+ dateFormat: "MM/dd/yyyy",
110
+ showWeekNumber: false,
111
+ weekStartsOn: WeekDays.Sunday,
112
+ disabledDates: [],
92
113
  };
93
- exports.DatePicker = (0, react_1.forwardRef)(function DatePicker({ id, initialValue, value, mode = "single", enabled = true, placeholder, updateState = constants_1.noop, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, dateFormat = "MM/dd/yyyy", // Default dateFormat
94
- showWeekNumber = false, weekStartsOn = WeekDays.Sunday, fromDate, toDate, disabledDates = [], style, registerComponentApi, inline = false, startText, startIcon, endText, endIcon, }, forwardedRef) {
114
+ exports.DatePicker = (0, react_1.forwardRef)(function DatePicker({ id, initialValue, value, mode = exports.defaultProps.mode, enabled = exports.defaultProps.enabled, placeholder, updateState = constants_1.noop, validationStatus = exports.defaultProps.validationStatus, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, dateFormat = exports.defaultProps.dateFormat, showWeekNumber = exports.defaultProps.showWeekNumber, weekStartsOn = exports.defaultProps.weekStartsOn, fromDate, toDate, disabledDates = exports.defaultProps.disabledDates, style, registerComponentApi, inline = exports.defaultProps.inline, startText, startIcon, endText, endIcon, }, forwardedRef) {
95
115
  const _weekStartsOn = weekStartsOn >= 0 && weekStartsOn <= 6 ? weekStartsOn : WeekDays.Sunday;
96
116
  const [isButtonFocused, setIsButtonFocused] = (0, react_1.useState)(false);
97
117
  const [isMenuFocused, setIsMenuFocused] = (0, react_1.useState)(false);
@@ -110,8 +130,8 @@ showWeekNumber = false, weekStartsOn = WeekDays.Sunday, fromDate, toDate, disabl
110
130
  return undefined;
111
131
  }, [value, mode]);
112
132
  (0, react_1.useEffect)(() => {
113
- if (!dateFormats.includes(dateFormat)) {
114
- throw new Error(`Invalid dateFormat: ${dateFormat}. Supported formats are: ${dateFormats.join(", ")}`);
133
+ if (!exports.dateFormats.includes(dateFormat)) {
134
+ throw new Error(`Invalid dateFormat: ${dateFormat}. Supported formats are: ${exports.dateFormats.join(", ")}`);
115
135
  }
116
136
  }, [dateFormat]);
117
137
  const startDate = (0, react_1.useMemo)(() => {
@@ -194,3 +214,24 @@ showWeekNumber = false, weekStartsOn = WeekDays.Sunday, fromDate, toDate, disabl
194
214
  [DatePicker_module_scss_1.default.valid]: validationStatus === "valid",
195
215
  }), onFocus: handleOnButtonFocus, onBlur: handleOnButtonBlur, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: DatePicker_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("div", { className: DatePicker_module_scss_1.default.datePickerValue, children: mode === "single" && selected ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, date_fns_1.format)(selected, dateFormat) })) : mode === "range" && typeof selected === "object" && selected.from ? (selected.to ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, date_fns_1.format)(selected.from, dateFormat), " - ", (0, date_fns_1.format)(selected.to, dateFormat)] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, date_fns_1.format)(selected.from, dateFormat) }))) : placeholder ? ((0, jsx_runtime_1.jsx)("span", { className: DatePicker_module_scss_1.default.placeholder, children: placeholder })) : ((0, jsx_runtime_1.jsx)("span", { children: "\u00A0" })) }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: DatePicker_module_scss_1.default.adornment })] }) }), (0, jsx_runtime_1.jsx)(ReactDropdownMenu.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(ReactDropdownMenu.Content, { align: "start", className: DatePicker_module_scss_1.default.datePickerMenu, onFocus: handleOnMenuFocus, onBlur: handleOnMenuBlur, onInteractOutside: handleOnMenuBlur, children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { fixedWeeks: true, fromDate: startDate, toDate: endDate, disabled: disabled, weekStartsOn: _weekStartsOn, showWeekNumber: showWeekNumber, showOutsideDays: true, classNames: DatePicker_module_scss_1.default, mode: mode === "single" ? "single" : "range", selected: selected, onSelect: handleSelect, initialFocus: true, numberOfMonths: mode === "range" ? 2 : 1 }) }) })] }));
196
216
  });
217
+ const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;
218
+ const parseISODate = (dateString) => {
219
+ if (dateString && isoRegex.test(dateString)) {
220
+ const parsedDate = (0, date_fns_1.parseISO)(dateString);
221
+ if ((0, date_fns_1.isValid)(parsedDate)) {
222
+ return parsedDate;
223
+ }
224
+ }
225
+ return undefined;
226
+ };
227
+ const parseDate = (dateString) => {
228
+ if (dateString) {
229
+ for (const format of exports.dateFormats) {
230
+ const parsedDate = (0, date_fns_1.parse)(dateString, format, new Date());
231
+ if ((0, date_fns_1.isValid)(parsedDate)) {
232
+ return parsedDate;
233
+ }
234
+ }
235
+ }
236
+ return undefined;
237
+ };