sit-onyx 1.4.0-dev-20251118111042 → 1.4.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.
@@ -1,21 +1,28 @@
1
- import { SliderMode } from '../OnyxSlider/types.js';
2
- import { OnyxSliderControlProps } from './types.js';
3
1
  /**
4
2
  * @experimental
5
3
  * @deprecated This component is still under active development and its API might change in patch releases.
6
4
  */
7
- declare const _default: <TSliderMode extends SliderMode>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
8
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
9
- readonly "onUpdate:modelValue"?: ((value: number) => any) | undefined;
10
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue"> & OnyxSliderControlProps & Partial<{}>> & import('vue').PublicProps;
11
- expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
12
- attrs: any;
13
- slots: {};
14
- emit: (evt: "update:modelValue", value: number) => void;
15
- }>) => import('vue').VNode & {
16
- __ctx?: Awaited<typeof __VLS_setup>;
17
- };
5
+ declare const _default: import('vue').DefineComponent<(import('../../composables/density.js', { with: { "resolution-mode": "import" } }).DensityProp & import('./types.js', { with: { "resolution-mode": "import" } }).OnyxSliderControlValueProps & {
6
+ modelValue: number;
7
+ disabled?: boolean;
8
+ }) | (import('../../composables/density.js', { with: { "resolution-mode": "import" } }).DensityProp & import('./types.js', { with: { "resolution-mode": "import" } }).OnyxSliderControlIconProps & {
9
+ modelValue: number;
10
+ disabled?: boolean;
11
+ }) | (import('../../composables/density.js', { with: { "resolution-mode": "import" } }).DensityProp & import('./types.js', { with: { "resolution-mode": "import" } }).OnyxSliderControlInputProps & {
12
+ modelValue: number;
13
+ disabled?: boolean;
14
+ }), {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
15
+ "update:modelValue": (value: number) => any;
16
+ }, string, import('vue').PublicProps, Readonly<(import('../../composables/density.js', { with: { "resolution-mode": "import" } }).DensityProp & import('./types.js', { with: { "resolution-mode": "import" } }).OnyxSliderControlValueProps & {
17
+ modelValue: number;
18
+ disabled?: boolean;
19
+ }) | (import('../../composables/density.js', { with: { "resolution-mode": "import" } }).DensityProp & import('./types.js', { with: { "resolution-mode": "import" } }).OnyxSliderControlIconProps & {
20
+ modelValue: number;
21
+ disabled?: boolean;
22
+ }) | (import('../../composables/density.js', { with: { "resolution-mode": "import" } }).DensityProp & import('./types.js', { with: { "resolution-mode": "import" } }).OnyxSliderControlInputProps & {
23
+ modelValue: number;
24
+ disabled?: boolean;
25
+ })> & Readonly<{
26
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
18
28
  export default _default;
19
- type __VLS_PrettifyLocal<T> = {
20
- [K in keyof T]: T[K];
21
- } & {};
@@ -1,48 +1,40 @@
1
1
  import { DensityProp } from '../../composables/density.js';
2
2
  export declare const SLIDER_CONTROLS: readonly ["icon", "value", "input"];
3
3
  export type SliderControl = (typeof SLIDER_CONTROLS)[number];
4
- export type OnyxSliderControlSharedProps = {
5
- /**
6
- * The type of control to render.
7
- *
8
- * - `value`: Renders a read-only display of the provided slider value.
9
- * - `icon`: Renders an icon button for increasing or decreasing the slider value.
10
- * - `input`: Renders an `<OnyxStepper />` component for direct value entry.
11
- */
12
- control: SliderControl;
13
- /**
14
- * Slider control model value
15
- */
16
- modelValue?: number;
17
- /**
18
- * The direction the icon button represents.
19
- *
20
- * - `decrease`: Decreases the slider value and renders a "minus" icon.
21
- * - `increase`: Increases the slider value and renders a "plus" icon.
22
- */
23
- direction?: "increase" | "decrease";
24
- /**
25
- * `shiftStep` of associated slider. Used to determine the amount to increase/decrease the value by when the icon button is clicked.
26
- */
27
- shiftStep?: number;
28
- /**
29
- * Indicates whether the control is disabled.
30
- */
31
- disabled?: boolean;
32
- };
33
4
  export type OnyxSliderControlValueProps = {
34
5
  control: "value";
35
- modelValue: number;
6
+ step?: never;
7
+ min?: never;
8
+ max?: never;
36
9
  };
37
10
  export type OnyxSliderControlIconProps = {
38
11
  control: "icon";
39
- direction: "increase" | "decrease";
40
- shiftStep: number;
41
- disabled?: boolean;
12
+ direction: SliderControlDirection;
13
+ /**
14
+ * Step size to change value when clicking the icon button.
15
+ */
16
+ step: number;
17
+ min?: never;
18
+ max?: never;
42
19
  };
43
20
  export type OnyxSliderControlInputProps = {
44
21
  control: "input";
45
- disabled?: boolean;
22
+ direction?: SliderControlDirection;
23
+ /**
24
+ * Step size to use for the stepper.
25
+ */
26
+ step: number;
27
+ min: number;
28
+ max: number;
29
+ };
30
+ export type SliderControlDirection = "increase" | "decrease";
31
+ export type OnyxSliderControlProps = DensityProp & (OnyxSliderControlValueProps | OnyxSliderControlIconProps | OnyxSliderControlInputProps) & {
32
+ /**
33
+ * Current control value.
34
+ */
46
35
  modelValue: number;
36
+ /**
37
+ * Whether the control is disabled.
38
+ */
39
+ disabled?: boolean;
47
40
  };
48
- export type OnyxSliderControlProps = OnyxSliderControlSharedProps & DensityProp & (OnyxSliderControlValueProps | OnyxSliderControlIconProps | OnyxSliderControlInputProps);
@@ -13754,12 +13754,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
13754
13754
  ...__default__$1,
13755
13755
  __name: "OnyxSliderControl",
13756
13756
  props: {
13757
- control: { type: String, required: true, default: "value" },
13758
- modelValue: { type: Number, required: false },
13757
+ density: { type: null, required: false },
13758
+ control: { type: String, required: true },
13759
+ step: { type: null, required: false },
13760
+ min: { type: null, required: false },
13761
+ max: { type: null, required: false },
13759
13762
  direction: { type: String, required: false },
13760
- shiftStep: { type: Number, required: false },
13761
- disabled: { type: Boolean, required: false },
13762
- density: { type: null, required: false }
13763
+ modelValue: { type: Number, required: true },
13764
+ disabled: { type: Boolean, required: false }
13763
13765
  },
13764
13766
  emits: ["update:modelValue"],
13765
13767
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -13774,16 +13776,16 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
13774
13776
  key: "modelValue"
13775
13777
  });
13776
13778
  const handleIconClick = () => {
13777
- const currentValue = modelValue.value;
13778
- if (props.control !== "icon" || typeof currentValue !== "number") return;
13779
- const newValue = props.direction === "increase" ? currentValue + (props.shiftStep ?? 1) : currentValue - (props.shiftStep ?? 1);
13780
- modelValue.value = newValue;
13779
+ if (props.control !== "icon") return;
13780
+ const offset = props.direction === "increase" ? props.step : -props.step;
13781
+ modelValue.value += offset;
13781
13782
  };
13782
13783
  const handleStepperChange = (value) => {
13783
13784
  if (value == void 0) return;
13784
13785
  modelValue.value = value;
13785
13786
  };
13786
13787
  const stepperLabel = computed(() => {
13788
+ if (props.control !== "input") return t.value("slider.changeValue");
13787
13789
  if (props.direction === "increase") return t.value("slider.changeStartValue");
13788
13790
  else if (props.direction === "decrease") return t.value("slider.changeEndValue");
13789
13791
  return t.value("slider.changeValue");
@@ -13816,8 +13818,7 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
13816
13818
  ],
13817
13819
  64
13818
13820
  /* STABLE_FRAGMENT */
13819
- )) : createCommentVNode("v-if", true),
13820
- $setup.props.control === "icon" ? (openBlock(), createElementBlock(
13821
+ )) : $setup.props.control === "icon" ? (openBlock(), createElementBlock(
13821
13822
  Fragment,
13822
13823
  { key: 1 },
13823
13824
  [
@@ -13825,7 +13826,7 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
13825
13826
  key: 0,
13826
13827
  disabled: $setup.props.disabled,
13827
13828
  color: "neutral",
13828
- label: $setup.t("slider.decreaseValueBy", { n: $setup.props.shiftStep }),
13829
+ label: $setup.t("slider.decreaseValueBy", { n: $setup.props.step }),
13829
13830
  icon: $setup.iconMinusSmall,
13830
13831
  onClick: $setup.handleIconClick
13831
13832
  }, null, 8, ["disabled", "label", "icon"])) : createCommentVNode("v-if", true),
@@ -13833,23 +13834,25 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
13833
13834
  key: 1,
13834
13835
  disabled: $setup.props.disabled,
13835
13836
  color: "neutral",
13836
- label: $setup.t("slider.increaseValueBy", { n: $setup.props.shiftStep }),
13837
+ label: $setup.t("slider.increaseValueBy", { n: $setup.props.step }),
13837
13838
  icon: $setup.iconPlusSmall,
13838
13839
  onClick: $setup.handleIconClick
13839
13840
  }, null, 8, ["disabled", "label", "icon"])) : createCommentVNode("v-if", true)
13840
13841
  ],
13841
13842
  64
13842
13843
  /* STABLE_FRAGMENT */
13843
- )) : createCommentVNode("v-if", true),
13844
- $setup.props.control === "input" ? (openBlock(), createBlock($setup["OnyxStepper"], {
13844
+ )) : $setup.props.control === "input" ? (openBlock(), createBlock($setup["OnyxStepper"], {
13845
13845
  key: 2,
13846
13846
  label: $setup.stepperLabel,
13847
13847
  "hide-label": "",
13848
13848
  "hide-buttons": "",
13849
13849
  disabled: $setup.props.disabled,
13850
13850
  "model-value": $setup.props.modelValue,
13851
+ "step-size": $setup.props.step,
13852
+ min: $setup.props.min,
13853
+ max: $setup.props.max,
13851
13854
  "onUpdate:modelValue": $setup.handleStepperChange
13852
- }, null, 8, ["label", "disabled", "model-value"])) : createCommentVNode("v-if", true)
13855
+ }, null, 8, ["label", "disabled", "model-value", "step-size", "min", "max"])) : createCommentVNode("v-if", true)
13853
13856
  ],
13854
13857
  2
13855
13858
  /* CLASS */
@@ -13905,7 +13908,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
13905
13908
  const { min, max, step, label } = toRefs(props);
13906
13909
  const {
13907
13910
  elements: { root, track, thumbContainer, thumbInput, mark, markLabel },
13908
- state: { normalizedValue, marks, shiftStep },
13911
+ state: { normalizedValue, marks },
13909
13912
  internals: { updateValue }
13910
13913
  } = _unstableCreateSlider({
13911
13914
  value: modelValue,
@@ -13918,13 +13921,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
13918
13921
  shiftStep: toRef(props, "shiftStep"),
13919
13922
  onChange: (newValue) => modelValue.value = newValue
13920
13923
  });
13921
- const __returned__ = { props, emit, modelValue, vCustomValidity, errorMessages, formElementProps, messages, densityClass, disabled, showError, errorClass, skeleton, min, max, step, label, root, track, thumbContainer, thumbInput, mark, markLabel, normalizedValue, marks, shiftStep, updateValue, OnyxFormElement, OnyxSkeleton, OnyxSliderControl, OnyxTooltip, OnyxVisuallyHidden };
13924
+ const __returned__ = { props, emit, modelValue, vCustomValidity, errorMessages, formElementProps, messages, densityClass, disabled, showError, errorClass, skeleton, min, max, step, label, root, track, thumbContainer, thumbInput, mark, markLabel, normalizedValue, marks, updateValue, OnyxFormElement, OnyxSkeleton, OnyxSliderControl, OnyxTooltip, OnyxVisuallyHidden };
13922
13925
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
13923
13926
  return __returned__;
13924
13927
  }
13925
13928
  });
13926
13929
  const _hoisted_1$6 = { class: "onyx-slider__container" };
13927
- const _hoisted_2$5 = ["id", "disabled", "aria-label", "autofocus"];
13930
+ const _hoisted_2$5 = ["id", "tabindex", "disabled", "aria-label", "autofocus"];
13928
13931
  function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
13929
13932
  return $setup.skeleton ? (openBlock(), createElementBlock(
13930
13933
  "div",
@@ -13965,18 +13968,21 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
13965
13968
  key: 1,
13966
13969
  control: "icon",
13967
13970
  direction: "decrease",
13968
- "shift-step": $setup.shiftStep,
13971
+ step: $setup.props.step,
13969
13972
  "model-value": $setup.normalizedValue[0],
13970
- disabled: $setup.disabled || ($setup.normalizedValue[0] ?? $setup.props.min) <= $setup.props.min,
13973
+ disabled: $setup.disabled || $setup.normalizedValue[0] <= $setup.props.min,
13971
13974
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.updateValue($event, 0))
13972
- }, null, 8, ["shift-step", "model-value", "disabled"])) : $setup.props.control === "input" && $setup.props.mode === "range" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
13975
+ }, null, 8, ["step", "model-value", "disabled"])) : $setup.props.control === "input" && $setup.props.mode === "range" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
13973
13976
  key: 2,
13974
13977
  control: "input",
13975
13978
  direction: "increase",
13979
+ "model-value": $setup.normalizedValue[0],
13976
13980
  disabled: $setup.disabled,
13977
- "model-value": $setup.normalizedValue[0] ?? 0,
13981
+ step: $setup.props.step,
13982
+ min: $setup.props.min,
13983
+ max: $setup.props.max,
13978
13984
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.updateValue($event, 0))
13979
- }, null, 8, ["disabled", "model-value"])) : createCommentVNode("v-if", true),
13985
+ }, null, 8, ["model-value", "disabled", "step", "min", "max"])) : createCommentVNode("v-if", true),
13980
13986
  createElementVNode(
13981
13987
  "span",
13982
13988
  mergeProps({ class: "onyx-slider__root" }, $setup.root),
@@ -14060,7 +14066,8 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
14060
14066
  default: withCtx(() => [
14061
14067
  withDirectives(createElementVNode("input", mergeProps({
14062
14068
  id: index === 0 ? inputId : void 0,
14063
- class: "onyx-slider__native"
14069
+ class: "onyx-slider__native",
14070
+ tabindex: $setup.props.control === "input" ? -1 : void 0
14064
14071
  }, { ref_for: true }, $setup.thumbInput({ value, index }), {
14065
14072
  disabled: $setup.disabled,
14066
14073
  "aria-label": $setup.props.label,
@@ -14103,17 +14110,21 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
14103
14110
  key: 4,
14104
14111
  control: "icon",
14105
14112
  direction: "increase",
14106
- "shift-step": $setup.shiftStep,
14113
+ step: $setup.props.step,
14107
14114
  "model-value": $setup.normalizedValue[0],
14115
+ disabled: $setup.disabled || $setup.normalizedValue[0] >= $setup.props.max,
14108
14116
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $setup.updateValue($event, 0))
14109
- }, null, 8, ["shift-step", "model-value"])) : $setup.props.control === "input" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
14117
+ }, null, 8, ["step", "model-value", "disabled"])) : $setup.props.control === "input" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
14110
14118
  key: 5,
14111
14119
  control: "input",
14112
14120
  direction: $setup.props.mode === "range" ? "decrease" : void 0,
14121
+ "model-value": $setup.normalizedValue[1] ?? $setup.normalizedValue[0],
14113
14122
  disabled: $setup.disabled,
14114
- "model-value": $setup.normalizedValue[1] ?? $setup.normalizedValue[0] ?? 0,
14123
+ step: $setup.props.step,
14124
+ min: $setup.props.min,
14125
+ max: $setup.props.max,
14115
14126
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.updateValue($event, $setup.props.mode === "range" ? 1 : 0))
14116
- }, null, 8, ["direction", "disabled", "model-value"])) : createCommentVNode("v-if", true)
14127
+ }, null, 8, ["direction", "model-value", "disabled", "step", "min", "max"])) : createCommentVNode("v-if", true)
14117
14128
  ])
14118
14129
  ]),
14119
14130
  _: 1